Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
/* mach64_state.c -- State support for mach64 (Rage Pro) driver -*- linux-c -*-
|
|
|
|
* Created: Sun Dec 03 19:20:26 2000 by gareth@valinux.com
|
2005-11-28 23:13:57 +00:00
|
|
|
*/
|
|
|
|
/*-
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
* Copyright 2000 Gareth Hughes
|
|
|
|
* Copyright 2002-2003 Leif Delgass
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT OWNER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Gareth Hughes <gareth@valinux.com>
|
|
|
|
* Leif Delgass <ldelgass@retinalburn.net>
|
2008-08-23 20:59:12 +00:00
|
|
|
* José Fonseca <j_r_fonseca@yahoo.co.uk>
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
*/
|
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
#include "dev/drm/drmP.h"
|
|
|
|
#include "dev/drm/drm.h"
|
|
|
|
#include "dev/drm/mach64_drm.h"
|
|
|
|
#include "dev/drm/mach64_drv.h"
|
|
|
|
|
|
|
|
/* Interface history:
|
|
|
|
*
|
|
|
|
* 1.0 - Initial mach64 DRM
|
|
|
|
*
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_ioctl_desc mach64_ioctls[] = {
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_INIT, mach64_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_CLEAR, mach64_dma_clear, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_SWAP, mach64_dma_swap, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_IDLE, mach64_dma_idle, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_RESET, mach64_engine_reset, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_VERTEX, mach64_dma_vertex, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_BLIT, mach64_dma_blit, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_FLUSH, mach64_dma_flush, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_MACH64_GETPARAM, mach64_get_param, DRM_AUTH),
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int mach64_max_ioctl = DRM_ARRAY_SIZE(mach64_ioctls);
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* DMA hardware state programming functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mach64_print_dirty(const char *msg, unsigned int flags)
|
|
|
|
{
|
|
|
|
DRM_DEBUG("%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
|
|
|
|
msg,
|
|
|
|
flags,
|
|
|
|
(flags & MACH64_UPLOAD_DST_OFF_PITCH) ? "dst_off_pitch, " :
|
|
|
|
"",
|
|
|
|
(flags & MACH64_UPLOAD_Z_ALPHA_CNTL) ? "z_alpha_cntl, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_SCALE_3D_CNTL) ? "scale_3d_cntl, " :
|
|
|
|
"", (flags & MACH64_UPLOAD_DP_FOG_CLR) ? "dp_fog_clr, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_DP_WRITE_MASK) ? "dp_write_mask, " :
|
|
|
|
"",
|
|
|
|
(flags & MACH64_UPLOAD_DP_PIX_WIDTH) ? "dp_pix_width, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_SETUP_CNTL) ? "setup_cntl, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_MISC) ? "misc, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_TEXTURE) ? "texture, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_TEX0IMAGE) ? "tex0 image, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_TEX1IMAGE) ? "tex1 image, " : "",
|
|
|
|
(flags & MACH64_UPLOAD_CLIPRECTS) ? "cliprects, " : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mach64 doesn't have hardware cliprects, just one hardware scissor,
|
|
|
|
* so the GL scissor is intersected with each cliprect here
|
|
|
|
*/
|
|
|
|
/* This function returns 0 on success, 1 for no intersection, and
|
|
|
|
* negative for an error
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
static int mach64_emit_cliprect(struct drm_file *file_priv,
|
|
|
|
drm_mach64_private_t * dev_priv,
|
|
|
|
struct drm_clip_rect * box)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
u32 sc_left_right, sc_top_bottom;
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_clip_rect scissor;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
drm_mach64_context_regs_t *regs = &sarea_priv->context_state;
|
|
|
|
DMALOCALS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("box=%p\n", box);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
/* Get GL scissor */
|
|
|
|
/* FIXME: store scissor in SAREA as a cliprect instead of in
|
|
|
|
* hardware format, or do intersection client-side
|
|
|
|
*/
|
|
|
|
scissor.x1 = regs->sc_left_right & 0xffff;
|
|
|
|
scissor.x2 = (regs->sc_left_right & 0xffff0000) >> 16;
|
|
|
|
scissor.y1 = regs->sc_top_bottom & 0xffff;
|
|
|
|
scissor.y2 = (regs->sc_top_bottom & 0xffff0000) >> 16;
|
|
|
|
|
|
|
|
/* Intersect GL scissor with cliprect */
|
|
|
|
if (box->x1 > scissor.x1)
|
|
|
|
scissor.x1 = box->x1;
|
|
|
|
if (box->y1 > scissor.y1)
|
|
|
|
scissor.y1 = box->y1;
|
|
|
|
if (box->x2 < scissor.x2)
|
|
|
|
scissor.x2 = box->x2;
|
|
|
|
if (box->y2 < scissor.y2)
|
|
|
|
scissor.y2 = box->y2;
|
|
|
|
/* positive return means skip */
|
|
|
|
if (scissor.x1 >= scissor.x2)
|
|
|
|
return 1;
|
|
|
|
if (scissor.y1 >= scissor.y2)
|
|
|
|
return 1;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DMAGETPTR(file_priv, dev_priv, 2); /* returns on failure to get buffer */
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
sc_left_right = ((scissor.x1 << 0) | (scissor.x2 << 16));
|
|
|
|
sc_top_bottom = ((scissor.y1 << 0) | (scissor.y2 << 16));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SC_LEFT_RIGHT, sc_left_right);
|
|
|
|
DMAOUTREG(MACH64_SC_TOP_BOTTOM, sc_top_bottom);
|
|
|
|
|
|
|
|
DMAADVANCE(dev_priv, 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static __inline__ int mach64_emit_state(struct drm_file *file_priv,
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
drm_mach64_private_t * dev_priv)
|
|
|
|
{
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
drm_mach64_context_regs_t *regs = &sarea_priv->context_state;
|
|
|
|
unsigned int dirty = sarea_priv->dirty;
|
|
|
|
u32 offset = ((regs->tex_size_pitch & 0xf0) >> 2);
|
|
|
|
DMALOCALS;
|
|
|
|
|
|
|
|
if (MACH64_VERBOSE) {
|
|
|
|
mach64_print_dirty(__FUNCTION__, dirty);
|
|
|
|
} else {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("dirty=0x%08x\n", dirty);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DMAGETPTR(file_priv, dev_priv, 17); /* returns on failure to get buffer */
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (dirty & MACH64_UPLOAD_MISC) {
|
|
|
|
DMAOUTREG(MACH64_DP_MIX, regs->dp_mix);
|
|
|
|
DMAOUTREG(MACH64_DP_SRC, regs->dp_src);
|
|
|
|
DMAOUTREG(MACH64_CLR_CMP_CNTL, regs->clr_cmp_cntl);
|
|
|
|
DMAOUTREG(MACH64_GUI_TRAJ_CNTL, regs->gui_traj_cntl);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_MISC;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dirty & MACH64_UPLOAD_DST_OFF_PITCH) {
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH, regs->dst_off_pitch);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_DST_OFF_PITCH;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_Z_OFF_PITCH) {
|
|
|
|
DMAOUTREG(MACH64_Z_OFF_PITCH, regs->z_off_pitch);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_Z_OFF_PITCH;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_Z_ALPHA_CNTL) {
|
|
|
|
DMAOUTREG(MACH64_Z_CNTL, regs->z_cntl);
|
|
|
|
DMAOUTREG(MACH64_ALPHA_TST_CNTL, regs->alpha_tst_cntl);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_Z_ALPHA_CNTL;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_SCALE_3D_CNTL) {
|
|
|
|
DMAOUTREG(MACH64_SCALE_3D_CNTL, regs->scale_3d_cntl);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_SCALE_3D_CNTL;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_DP_FOG_CLR) {
|
|
|
|
DMAOUTREG(MACH64_DP_FOG_CLR, regs->dp_fog_clr);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_DP_FOG_CLR;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_DP_WRITE_MASK) {
|
|
|
|
DMAOUTREG(MACH64_DP_WRITE_MASK, regs->dp_write_mask);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_DP_WRITE_MASK;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_DP_PIX_WIDTH) {
|
|
|
|
DMAOUTREG(MACH64_DP_PIX_WIDTH, regs->dp_pix_width);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_DP_PIX_WIDTH;
|
|
|
|
}
|
|
|
|
if (dirty & MACH64_UPLOAD_SETUP_CNTL) {
|
|
|
|
DMAOUTREG(MACH64_SETUP_CNTL, regs->setup_cntl);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_SETUP_CNTL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dirty & MACH64_UPLOAD_TEXTURE) {
|
|
|
|
DMAOUTREG(MACH64_TEX_SIZE_PITCH, regs->tex_size_pitch);
|
|
|
|
DMAOUTREG(MACH64_TEX_CNTL, regs->tex_cntl);
|
|
|
|
DMAOUTREG(MACH64_SECONDARY_TEX_OFF, regs->secondary_tex_off);
|
|
|
|
DMAOUTREG(MACH64_TEX_0_OFF + offset, regs->tex_offset);
|
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_TEXTURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DMAADVANCE(dev_priv, 1);
|
|
|
|
|
|
|
|
sarea_priv->dirty &= MACH64_UPLOAD_CLIPRECTS;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* DMA command dispatch functions
|
|
|
|
*/
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int mach64_dma_dispatch_clear(struct drm_device * dev,
|
|
|
|
struct drm_file *file_priv,
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
unsigned int flags,
|
|
|
|
int cx, int cy, int cw, int ch,
|
|
|
|
unsigned int clear_color,
|
|
|
|
unsigned int clear_depth)
|
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
drm_mach64_context_regs_t *ctx = &sarea_priv->context_state;
|
|
|
|
int nbox = sarea_priv->nbox;
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_clip_rect *pbox = sarea_priv->boxes;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
u32 fb_bpp, depth_bpp;
|
|
|
|
int i;
|
|
|
|
DMALOCALS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("\n");
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
switch (dev_priv->fb_bpp) {
|
|
|
|
case 16:
|
|
|
|
fb_bpp = MACH64_DATATYPE_RGB565;
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
fb_bpp = MACH64_DATATYPE_ARGB8888;
|
|
|
|
break;
|
|
|
|
default:
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
switch (dev_priv->depth_bpp) {
|
|
|
|
case 16:
|
|
|
|
depth_bpp = MACH64_DATATYPE_RGB565;
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
case 32:
|
|
|
|
depth_bpp = MACH64_DATATYPE_ARGB8888;
|
|
|
|
break;
|
|
|
|
default:
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!nbox)
|
|
|
|
return 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DMAGETPTR(file_priv, dev_priv, nbox * 31); /* returns on failure to get buffer */
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
for (i = 0; i < nbox; i++) {
|
|
|
|
int x = pbox[i].x1;
|
|
|
|
int y = pbox[i].y1;
|
|
|
|
int w = pbox[i].x2 - x;
|
|
|
|
int h = pbox[i].y2 - y;
|
|
|
|
|
|
|
|
DRM_DEBUG("dispatch clear %d,%d-%d,%d flags 0x%x\n",
|
|
|
|
pbox[i].x1, pbox[i].y1,
|
|
|
|
pbox[i].x2, pbox[i].y2, flags);
|
|
|
|
|
|
|
|
if (flags & (MACH64_FRONT | MACH64_BACK)) {
|
|
|
|
/* Setup for color buffer clears
|
|
|
|
*/
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_Z_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_SCALE_3D_CNTL, 0);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SC_LEFT_RIGHT, ctx->sc_left_right);
|
|
|
|
DMAOUTREG(MACH64_SC_TOP_BOTTOM, ctx->sc_top_bottom);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_CLR_CMP_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_GUI_TRAJ_CNTL,
|
|
|
|
(MACH64_DST_X_LEFT_TO_RIGHT |
|
|
|
|
MACH64_DST_Y_TOP_TO_BOTTOM));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_PIX_WIDTH, ((fb_bpp << 0) |
|
|
|
|
(fb_bpp << 4) |
|
|
|
|
(fb_bpp << 8) |
|
|
|
|
(fb_bpp << 16) |
|
|
|
|
(fb_bpp << 28)));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_FRGD_CLR, clear_color);
|
|
|
|
DMAOUTREG(MACH64_DP_WRITE_MASK, ctx->dp_write_mask);
|
|
|
|
DMAOUTREG(MACH64_DP_MIX, (MACH64_BKGD_MIX_D |
|
|
|
|
MACH64_FRGD_MIX_S));
|
|
|
|
DMAOUTREG(MACH64_DP_SRC, (MACH64_BKGD_SRC_FRGD_CLR |
|
|
|
|
MACH64_FRGD_SRC_FRGD_CLR |
|
|
|
|
MACH64_MONO_SRC_ONE));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & MACH64_FRONT) {
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH,
|
|
|
|
dev_priv->front_offset_pitch);
|
|
|
|
DMAOUTREG(MACH64_DST_X_Y, (y << 16) | x);
|
|
|
|
DMAOUTREG(MACH64_DST_WIDTH_HEIGHT, (h << 16) | w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & MACH64_BACK) {
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH,
|
|
|
|
dev_priv->back_offset_pitch);
|
|
|
|
DMAOUTREG(MACH64_DST_X_Y, (y << 16) | x);
|
|
|
|
DMAOUTREG(MACH64_DST_WIDTH_HEIGHT, (h << 16) | w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & MACH64_DEPTH) {
|
|
|
|
/* Setup for depth buffer clear
|
|
|
|
*/
|
|
|
|
DMAOUTREG(MACH64_Z_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_SCALE_3D_CNTL, 0);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SC_LEFT_RIGHT, ctx->sc_left_right);
|
|
|
|
DMAOUTREG(MACH64_SC_TOP_BOTTOM, ctx->sc_top_bottom);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_CLR_CMP_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_GUI_TRAJ_CNTL,
|
|
|
|
(MACH64_DST_X_LEFT_TO_RIGHT |
|
|
|
|
MACH64_DST_Y_TOP_TO_BOTTOM));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_PIX_WIDTH, ((depth_bpp << 0) |
|
|
|
|
(depth_bpp << 4) |
|
|
|
|
(depth_bpp << 8) |
|
|
|
|
(depth_bpp << 16) |
|
|
|
|
(depth_bpp << 28)));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_FRGD_CLR, clear_depth);
|
|
|
|
DMAOUTREG(MACH64_DP_WRITE_MASK, 0xffffffff);
|
|
|
|
DMAOUTREG(MACH64_DP_MIX, (MACH64_BKGD_MIX_D |
|
|
|
|
MACH64_FRGD_MIX_S));
|
|
|
|
DMAOUTREG(MACH64_DP_SRC, (MACH64_BKGD_SRC_FRGD_CLR |
|
|
|
|
MACH64_FRGD_SRC_FRGD_CLR |
|
|
|
|
MACH64_MONO_SRC_ONE));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH,
|
|
|
|
dev_priv->depth_offset_pitch);
|
|
|
|
DMAOUTREG(MACH64_DST_X_Y, (y << 16) | x);
|
|
|
|
DMAOUTREG(MACH64_DST_WIDTH_HEIGHT, (h << 16) | w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DMAADVANCE(dev_priv, 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int mach64_dma_dispatch_swap(struct drm_device * dev,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
int nbox = sarea_priv->nbox;
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_clip_rect *pbox = sarea_priv->boxes;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
u32 fb_bpp;
|
|
|
|
int i;
|
|
|
|
DMALOCALS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("\n");
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
switch (dev_priv->fb_bpp) {
|
|
|
|
case 16:
|
|
|
|
fb_bpp = MACH64_DATATYPE_RGB565;
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
default:
|
|
|
|
fb_bpp = MACH64_DATATYPE_ARGB8888;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nbox)
|
|
|
|
return 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DMAGETPTR(file_priv, dev_priv, 13 + nbox * 4); /* returns on failure to get buffer */
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
DMAOUTREG(MACH64_Z_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_SCALE_3D_CNTL, 0);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SC_LEFT_RIGHT, 0 | (8191 << 16)); /* no scissor */
|
|
|
|
DMAOUTREG(MACH64_SC_TOP_BOTTOM, 0 | (16383 << 16));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_CLR_CMP_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_GUI_TRAJ_CNTL, (MACH64_DST_X_LEFT_TO_RIGHT |
|
|
|
|
MACH64_DST_Y_TOP_TO_BOTTOM));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_PIX_WIDTH, ((fb_bpp << 0) |
|
|
|
|
(fb_bpp << 4) |
|
|
|
|
(fb_bpp << 8) |
|
|
|
|
(fb_bpp << 16) | (fb_bpp << 28)));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_WRITE_MASK, 0xffffffff);
|
|
|
|
DMAOUTREG(MACH64_DP_MIX, (MACH64_BKGD_MIX_D | MACH64_FRGD_MIX_S));
|
|
|
|
DMAOUTREG(MACH64_DP_SRC, (MACH64_BKGD_SRC_BKGD_CLR |
|
|
|
|
MACH64_FRGD_SRC_BLIT | MACH64_MONO_SRC_ONE));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SRC_OFF_PITCH, dev_priv->back_offset_pitch);
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH, dev_priv->front_offset_pitch);
|
|
|
|
|
|
|
|
for (i = 0; i < nbox; i++) {
|
|
|
|
int x = pbox[i].x1;
|
|
|
|
int y = pbox[i].y1;
|
|
|
|
int w = pbox[i].x2 - x;
|
|
|
|
int h = pbox[i].y2 - y;
|
|
|
|
|
|
|
|
DRM_DEBUG("dispatch swap %d,%d-%d,%d\n",
|
|
|
|
pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SRC_WIDTH1, w);
|
|
|
|
DMAOUTREG(MACH64_SRC_Y_X, (x << 16) | y);
|
|
|
|
DMAOUTREG(MACH64_DST_Y_X, (x << 16) | y);
|
|
|
|
DMAOUTREG(MACH64_DST_WIDTH_HEIGHT, (h << 16) | w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DMAADVANCE(dev_priv, 1);
|
|
|
|
|
|
|
|
if (dev_priv->driver_mode == MACH64_MODE_DMA_ASYNC) {
|
|
|
|
for (i = 0; i < MACH64_MAX_QUEUED_FRAMES - 1; i++) {
|
|
|
|
dev_priv->frame_ofs[i] = dev_priv->frame_ofs[i + 1];
|
|
|
|
}
|
|
|
|
dev_priv->frame_ofs[i] = GETRINGOFFSET();
|
|
|
|
|
|
|
|
dev_priv->sarea_priv->frames_queued++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mach64_do_get_frames_queued(drm_mach64_private_t * dev_priv)
|
|
|
|
{
|
|
|
|
drm_mach64_descriptor_ring_t *ring = &dev_priv->ring;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
int i, start;
|
|
|
|
u32 head, tail, ofs;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("\n");
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (sarea_priv->frames_queued == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
tail = ring->tail;
|
|
|
|
mach64_ring_tick(dev_priv, ring);
|
|
|
|
head = ring->head;
|
|
|
|
|
|
|
|
start = (MACH64_MAX_QUEUED_FRAMES -
|
|
|
|
DRM_MIN(MACH64_MAX_QUEUED_FRAMES, sarea_priv->frames_queued));
|
|
|
|
|
|
|
|
if (head == tail) {
|
|
|
|
sarea_priv->frames_queued = 0;
|
|
|
|
for (i = start; i < MACH64_MAX_QUEUED_FRAMES; i++) {
|
|
|
|
dev_priv->frame_ofs[i] = ~0;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = start; i < MACH64_MAX_QUEUED_FRAMES; i++) {
|
|
|
|
ofs = dev_priv->frame_ofs[i];
|
|
|
|
DRM_DEBUG("frame_ofs[%d] ofs: %d\n", i, ofs);
|
|
|
|
if (ofs == ~0 ||
|
|
|
|
(head < tail && (ofs < head || ofs >= tail)) ||
|
|
|
|
(head > tail && (ofs < head && ofs >= tail))) {
|
|
|
|
sarea_priv->frames_queued =
|
|
|
|
(MACH64_MAX_QUEUED_FRAMES - 1) - i;
|
|
|
|
dev_priv->frame_ofs[i] = ~0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sarea_priv->frames_queued;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy and verify a client submited buffer.
|
|
|
|
* FIXME: Make an assembly optimized version
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
static __inline__ int copy_from_user_vertex(u32 *to,
|
|
|
|
const u32 __user *ufrom,
|
|
|
|
unsigned long bytes)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
unsigned long n = bytes; /* dwords remaining in buffer */
|
2005-11-28 23:13:57 +00:00
|
|
|
u32 *from, *orig_from;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
from = drm_alloc(bytes, DRM_MEM_DRIVER);
|
|
|
|
if (from == NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return -ENOMEM;
|
2005-11-28 23:13:57 +00:00
|
|
|
|
|
|
|
if (DRM_COPY_FROM_USER(from, ufrom, bytes)) {
|
|
|
|
drm_free(from, bytes, DRM_MEM_DRIVER);
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EFAULT;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2005-11-28 23:13:57 +00:00
|
|
|
orig_from = from; /* we'll be modifying the "from" ptr, so save it */
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
n >>= 2;
|
|
|
|
|
|
|
|
while (n > 1) {
|
|
|
|
u32 data, reg, count;
|
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
data = *from++;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
n--;
|
|
|
|
|
|
|
|
reg = le32_to_cpu(data);
|
|
|
|
count = (reg >> 16) + 1;
|
|
|
|
if (count <= n) {
|
|
|
|
n -= count;
|
|
|
|
reg &= 0xffff;
|
|
|
|
|
|
|
|
/* This is an exact match of Mach64's Setup Engine registers,
|
|
|
|
* excluding SETUP_CNTL (1_C1).
|
|
|
|
*/
|
|
|
|
if ((reg >= 0x0190 && reg < 0x01c1) ||
|
|
|
|
(reg >= 0x01ca && reg <= 0x01cf)) {
|
|
|
|
*to++ = data;
|
2005-11-28 23:13:57 +00:00
|
|
|
memcpy(to, from, count << 2);
|
|
|
|
from += count;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
to += count;
|
|
|
|
} else {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_ERROR("Got bad command: 0x%04x\n", reg);
|
2005-11-28 23:13:57 +00:00
|
|
|
drm_free(orig_from, bytes, DRM_MEM_DRIVER);
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EACCES;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
DRM_ERROR
|
2008-08-23 20:59:12 +00:00
|
|
|
("Got bad command count(=%u) dwords remaining=%lu\n",
|
|
|
|
count, n);
|
2005-11-28 23:13:57 +00:00
|
|
|
drm_free(orig_from, bytes, DRM_MEM_DRIVER);
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
drm_free(orig_from, bytes, DRM_MEM_DRIVER);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
if (n == 0)
|
|
|
|
return 0;
|
|
|
|
else {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_ERROR("Bad buf->used(=%lu)\n", bytes);
|
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int mach64_dma_dispatch_vertex(struct drm_device * dev,
|
|
|
|
struct drm_file *file_priv,
|
|
|
|
drm_mach64_vertex_t * vertex)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_buf *copy_buf;
|
|
|
|
void *buf = vertex->buf;
|
|
|
|
unsigned long used = vertex->used;
|
|
|
|
int ret = 0;
|
|
|
|
int i = 0;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
int done = 0;
|
|
|
|
int verify_ret = 0;
|
|
|
|
DMALOCALS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("buf=%p used=%lu nbox=%d\n",
|
|
|
|
buf, used, sarea_priv->nbox);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!used)
|
|
|
|
goto _vertex_done;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
copy_buf = mach64_freelist_get(dev_priv);
|
|
|
|
if (copy_buf == NULL) {
|
|
|
|
DRM_ERROR("couldn't get buffer\n");
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
/* Mach64's vertex data is actually register writes. To avoid security
|
|
|
|
* compromises these register writes have to be verified and copied from
|
|
|
|
* user space into a private DMA buffer.
|
|
|
|
*/
|
|
|
|
verify_ret = copy_from_user_vertex(GETBUFPTR(copy_buf), buf, used);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (verify_ret != 0) {
|
|
|
|
mach64_freelist_put(dev_priv, copy_buf);
|
|
|
|
goto _vertex_done;
|
|
|
|
}
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
copy_buf->used = used;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DMASETPTR(copy_buf);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (sarea_priv->dirty & ~MACH64_UPLOAD_CLIPRECTS) {
|
|
|
|
ret = mach64_emit_state(file_priv, dev_priv);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
/* Emit the next cliprect */
|
|
|
|
if (i < sarea_priv->nbox) {
|
|
|
|
ret = mach64_emit_cliprect(file_priv, dev_priv,
|
|
|
|
&sarea_priv->boxes[i]);
|
|
|
|
if (ret < 0) {
|
|
|
|
/* failed to get buffer */
|
|
|
|
return ret;
|
|
|
|
} else if (ret != 0) {
|
|
|
|
/* null intersection with scissor */
|
|
|
|
continue;
|
|
|
|
}
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2008-08-23 20:59:12 +00:00
|
|
|
if ((i >= sarea_priv->nbox - 1))
|
|
|
|
done = 1;
|
|
|
|
|
|
|
|
/* Add the buffer to the DMA queue */
|
|
|
|
DMAADVANCE(dev_priv, done);
|
|
|
|
|
|
|
|
} while (++i < sarea_priv->nbox);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!done) {
|
|
|
|
if (copy_buf->pending) {
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DMADISCARDBUF();
|
2008-08-23 20:59:12 +00:00
|
|
|
} else {
|
|
|
|
/* This buffer wasn't used (no cliprects), so place it
|
|
|
|
* back on the free list
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
mach64_freelist_put(dev_priv, copy_buf);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
_vertex_done:
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
sarea_priv->dirty &= ~MACH64_UPLOAD_CLIPRECTS;
|
|
|
|
sarea_priv->nbox = 0;
|
|
|
|
|
|
|
|
return verify_ret;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static __inline__ int copy_from_user_blit(u32 *to,
|
|
|
|
const u32 __user *ufrom,
|
|
|
|
unsigned long bytes)
|
|
|
|
{
|
|
|
|
to = (u32 *)((char *)to + MACH64_HOSTDATA_BLIT_OFFSET);
|
|
|
|
|
|
|
|
if (DRM_COPY_FROM_USER(to, ufrom, bytes)) {
|
|
|
|
return -EFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mach64_dma_dispatch_blit(struct drm_device * dev,
|
|
|
|
struct drm_file *file_priv,
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
drm_mach64_blit_t * blit)
|
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
int dword_shift, dwords;
|
2008-08-23 20:59:12 +00:00
|
|
|
unsigned long used;
|
|
|
|
struct drm_buf *copy_buf;
|
|
|
|
int verify_ret = 0;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DMALOCALS;
|
|
|
|
|
|
|
|
/* The compiler won't optimize away a division by a variable,
|
|
|
|
* even if the only legal values are powers of two. Thus, we'll
|
|
|
|
* use a shift instead.
|
|
|
|
*/
|
|
|
|
switch (blit->format) {
|
|
|
|
case MACH64_DATATYPE_ARGB8888:
|
|
|
|
dword_shift = 0;
|
|
|
|
break;
|
|
|
|
case MACH64_DATATYPE_ARGB1555:
|
|
|
|
case MACH64_DATATYPE_RGB565:
|
|
|
|
case MACH64_DATATYPE_VYUY422:
|
|
|
|
case MACH64_DATATYPE_YVYU422:
|
|
|
|
case MACH64_DATATYPE_ARGB4444:
|
|
|
|
dword_shift = 1;
|
|
|
|
break;
|
|
|
|
case MACH64_DATATYPE_CI8:
|
|
|
|
case MACH64_DATATYPE_RGB8:
|
|
|
|
dword_shift = 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DRM_ERROR("invalid blit format %d\n", blit->format);
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set buf->used to the bytes of blit data based on the blit dimensions
|
|
|
|
* and verify the size. When the setup is emitted to the buffer with
|
|
|
|
* the DMA* macros below, buf->used is incremented to include the bytes
|
|
|
|
* used for setup as well as the blit data.
|
|
|
|
*/
|
|
|
|
dwords = (blit->width * blit->height) >> dword_shift;
|
2008-08-23 20:59:12 +00:00
|
|
|
used = dwords << 2;
|
|
|
|
if (used <= 0 ||
|
|
|
|
used > MACH64_BUFFER_SIZE - MACH64_HOSTDATA_BLIT_OFFSET) {
|
|
|
|
DRM_ERROR("Invalid blit size: %lu bytes\n", used);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_buf = mach64_freelist_get(dev_priv);
|
|
|
|
if (copy_buf == NULL) {
|
|
|
|
DRM_ERROR("couldn't get buffer\n");
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the blit data from userspace.
|
|
|
|
*
|
|
|
|
* XXX: This is overkill. The most efficient solution would be having
|
|
|
|
* two sets of buffers (one set private for vertex data, the other set
|
|
|
|
* client-writable for blits). However that would bring more complexity
|
|
|
|
* and would break backward compatability. The solution currently
|
|
|
|
* implemented is keeping all buffers private, allowing to secure the
|
|
|
|
* driver, without increasing complexity at the expense of some speed
|
|
|
|
* transfering data.
|
|
|
|
*/
|
|
|
|
verify_ret = copy_from_user_blit(GETBUFPTR(copy_buf), blit->buf, used);
|
|
|
|
|
|
|
|
if (verify_ret != 0) {
|
|
|
|
mach64_freelist_put(dev_priv, copy_buf);
|
|
|
|
goto _blit_done;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
copy_buf->used = used;
|
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
/* FIXME: Use a last buffer flag and reduce the state emitted for subsequent,
|
|
|
|
* continuation buffers?
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Blit via BM_HOSTDATA (gui-master) - like HOST_DATA[0-15], but doesn't require
|
|
|
|
* a register command every 16 dwords. State setup is added at the start of the
|
|
|
|
* buffer -- the client leaves space for this based on MACH64_HOSTDATA_BLIT_OFFSET
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
DMASETPTR(copy_buf);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
DMAOUTREG(MACH64_Z_CNTL, 0);
|
|
|
|
DMAOUTREG(MACH64_SCALE_3D_CNTL, 0);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_SC_LEFT_RIGHT, 0 | (8191 << 16)); /* no scissor */
|
|
|
|
DMAOUTREG(MACH64_SC_TOP_BOTTOM, 0 | (16383 << 16));
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_CLR_CMP_CNTL, 0); /* disable */
|
|
|
|
DMAOUTREG(MACH64_GUI_TRAJ_CNTL,
|
|
|
|
MACH64_DST_X_LEFT_TO_RIGHT | MACH64_DST_Y_TOP_TO_BOTTOM);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_PIX_WIDTH, (blit->format << 0) /* dst pix width */
|
|
|
|
|(blit->format << 4) /* composite pix width */
|
|
|
|
|(blit->format << 8) /* src pix width */
|
|
|
|
|(blit->format << 16) /* host data pix width */
|
|
|
|
|(blit->format << 28) /* scaler/3D pix width */
|
|
|
|
);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DP_WRITE_MASK, 0xffffffff); /* enable all planes */
|
|
|
|
DMAOUTREG(MACH64_DP_MIX, MACH64_BKGD_MIX_D | MACH64_FRGD_MIX_S);
|
|
|
|
DMAOUTREG(MACH64_DP_SRC,
|
|
|
|
MACH64_BKGD_SRC_BKGD_CLR
|
|
|
|
| MACH64_FRGD_SRC_HOST | MACH64_MONO_SRC_ONE);
|
|
|
|
|
|
|
|
DMAOUTREG(MACH64_DST_OFF_PITCH,
|
|
|
|
(blit->pitch << 22) | (blit->offset >> 3));
|
|
|
|
DMAOUTREG(MACH64_DST_X_Y, (blit->y << 16) | blit->x);
|
|
|
|
DMAOUTREG(MACH64_DST_WIDTH_HEIGHT, (blit->height << 16) | blit->width);
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("%lu bytes\n", used);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
/* Add the buffer to the queue */
|
|
|
|
DMAADVANCEHOSTDATA(dev_priv);
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
_blit_done:
|
|
|
|
return verify_ret;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* IOCTL functions
|
|
|
|
*/
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int mach64_dma_clear(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_mach64_clear_t *clear = data;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
int ret;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (sarea_priv->nbox > MACH64_NR_SAREA_CLIPRECTS)
|
|
|
|
sarea_priv->nbox = MACH64_NR_SAREA_CLIPRECTS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
ret = mach64_dma_dispatch_clear(dev, file_priv, clear->flags,
|
|
|
|
clear->x, clear->y, clear->w, clear->h,
|
|
|
|
clear->clear_color,
|
|
|
|
clear->clear_depth);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
/* Make sure we restore the 3D state next time.
|
|
|
|
*/
|
|
|
|
sarea_priv->dirty |= (MACH64_UPLOAD_CONTEXT | MACH64_UPLOAD_MISC);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int mach64_dma_swap(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
int ret;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (sarea_priv->nbox > MACH64_NR_SAREA_CLIPRECTS)
|
|
|
|
sarea_priv->nbox = MACH64_NR_SAREA_CLIPRECTS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
ret = mach64_dma_dispatch_swap(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
/* Make sure we restore the 3D state next time.
|
|
|
|
*/
|
|
|
|
sarea_priv->dirty |= (MACH64_UPLOAD_CONTEXT | MACH64_UPLOAD_MISC);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int mach64_dma_vertex(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_mach64_vertex_t *vertex = data;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (!dev_priv) {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_ERROR("called with no initialization\n");
|
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("pid=%d buf=%p used=%lu discard=%d\n",
|
|
|
|
DRM_CURRENTPID,
|
|
|
|
vertex->buf, vertex->used, vertex->discard);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (vertex->prim < 0 || vertex->prim > MACH64_PRIM_POLYGON) {
|
|
|
|
DRM_ERROR("buffer prim %d\n", vertex->prim);
|
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (vertex->used > MACH64_BUFFER_SIZE || (vertex->used & 3) != 0) {
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DRM_ERROR("Invalid vertex buffer size: %lu bytes\n",
|
2008-08-23 20:59:12 +00:00
|
|
|
vertex->used);
|
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sarea_priv->nbox > MACH64_NR_SAREA_CLIPRECTS)
|
|
|
|
sarea_priv->nbox = MACH64_NR_SAREA_CLIPRECTS;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
return mach64_dma_dispatch_vertex(dev, file_priv, vertex);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int mach64_dma_blit(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_mach64_blit_t *blit = data;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
int ret;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
ret = mach64_dma_dispatch_blit(dev, file_priv, blit);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
/* Make sure we restore the 3D state next time.
|
|
|
|
*/
|
|
|
|
sarea_priv->dirty |= (MACH64_UPLOAD_CONTEXT |
|
|
|
|
MACH64_UPLOAD_MISC | MACH64_UPLOAD_CLIPRECTS);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int mach64_get_param(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
{
|
|
|
|
drm_mach64_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_mach64_getparam_t *param = data;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
int value;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("\n");
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
|
|
|
|
if (!dev_priv) {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_ERROR("called with no initialization\n");
|
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
switch (param->param) {
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
case MACH64_PARAM_FRAMES_QUEUED:
|
|
|
|
/* Needs lock since it calls mach64_ring_tick() */
|
2008-08-23 20:59:12 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
value = mach64_do_get_frames_queued(dev_priv);
|
|
|
|
break;
|
|
|
|
case MACH64_PARAM_IRQ_NR:
|
|
|
|
value = dev->irq;
|
|
|
|
break;
|
|
|
|
default:
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (DRM_COPY_TO_USER(param->value, &value, sizeof(int))) {
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DRM_ERROR("copy_to_user\n");
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EFAULT;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|