summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2008-07-10 21:49:55 -0400
committerAlex Deucher <alexdeucher@gmail.com>2008-08-25 09:42:06 -0400
commit75ef8dc214715d3c5c50996b293933842903ba65 (patch)
tree0c3c849ff66c0943f8c07354cc9adb1683a0710e
parent71ad140fa11f3a504c38d6bddf40e3a3c0a20e60 (diff)
Cleanups from rhd port
- remove unused vars - remove static exa render vars
-rw-r--r--src/radeon.h24
-rw-r--r--src/radeon_accel.c18
-rw-r--r--src/radeon_exa_render.c116
3 files changed, 74 insertions, 84 deletions
diff --git a/src/radeon.h b/src/radeon.h
index e2ba3606..78733abf 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -439,8 +439,6 @@ struct radeon_accel_state {
/* common accel data */
int fifo_slots; /* Free slots in the FIFO (64 max) */
/* Computed values for Radeon */
- int pitch;
- int datatype;
uint32_t dp_gui_master_cntl;
uint32_t dp_gui_master_cntl_clip;
uint32_t trans_color;
@@ -465,6 +463,16 @@ struct radeon_accel_state {
#define EXA_ENGINEMODE_UNKNOWN 0
#define EXA_ENGINEMODE_2D 1
#define EXA_ENGINEMODE_3D 2
+
+ Bool is_transform[2];
+ PictTransform *transform[2];
+ Bool has_mask;
+ /* Whether we are tiling horizontally and vertically */
+ Bool need_src_tile_x;
+ Bool need_src_tile_y;
+ /* Size of tiles ... set to 65536x65536 if not tiling in that direction */
+ Bool src_tile_width;
+ Bool src_tile_height;
#endif
#ifdef USE_XAA
@@ -501,18 +509,6 @@ struct radeon_accel_state {
*/
Bool XAAForceTransBlit;
#endif
-#ifdef XF86DRI
- /* Saved scissor values */
- uint32_t sc_left;
- uint32_t sc_right;
- uint32_t sc_top;
- uint32_t sc_bottom;
-
- uint32_t re_top_left;
- uint32_t re_width_height;
-
- uint32_t aux_sc_cntl;
-#endif
};
diff --git a/src/radeon_accel.c b/src/radeon_accel.c
index 6c19b708..132a2f43 100644
--- a/src/radeon_accel.c
+++ b/src/radeon_accel.c
@@ -364,6 +364,7 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
+ int datatype = 0;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"EngineInit (%d/%d)\n",
@@ -446,11 +447,11 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
RADEONEngineReset(pScrn);
switch (info->CurrentLayout.pixel_code) {
- case 8: info->accel_state->datatype = 2; break;
- case 15: info->accel_state->datatype = 3; break;
- case 16: info->accel_state->datatype = 4; break;
- case 24: info->accel_state->datatype = 5; break;
- case 32: info->accel_state->datatype = 6; break;
+ case 8: datatype = 2; break;
+ case 15: datatype = 3; break;
+ case 16: datatype = 4; break;
+ case 24: datatype = 5; break;
+ case 32: datatype = 6; break;
default:
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"Unknown depth/bpp = %d/%d (code = %d)\n",
@@ -458,14 +459,9 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
info->CurrentLayout.bitsPerPixel,
info->CurrentLayout.pixel_code);
}
- info->accel_state->pitch = ((info->CurrentLayout.displayWidth / 8) *
- (info->CurrentLayout.pixel_bytes == 3 ? 3 : 1));
-
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
- "Pitch for acceleration = %d\n", info->accel_state->pitch);
info->accel_state->dp_gui_master_cntl =
- ((info->accel_state->datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
+ ((datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
| RADEON_GMC_CLR_CMP_CNTL_DIS
| RADEON_GMC_DST_PITCH_OFFSET_CNTL);
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index ddb28be0..97199ae9 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -56,15 +56,6 @@
/* Only include the following (generic) bits once. */
#ifdef ONLY_ONCE
-static Bool is_transform[2];
-static PictTransform *transform[2];
-static Bool has_mask;
-/* Whether we are tiling horizontally and vertically */
-static Bool need_src_tile_x;
-static Bool need_src_tile_y;
-/* Size of tiles ... set to 65536x65536 if not tiling in that direction */
-static Bool src_tile_width;
-static Bool src_tile_height;
struct blendinfo {
Bool dst_alpha;
@@ -287,8 +278,10 @@ static Bool RADEONSetupSourceTile(PicturePtr pPict,
Bool canTile1d,
Bool needMatchingPitch)
{
- need_src_tile_x = need_src_tile_y = FALSE;
- src_tile_width = src_tile_height = 65536; /* "infinite" */
+ RINFO_FROM_SCREEN(pPix->drawable.pScreen);
+
+ info->accel_state->need_src_tile_x = info->accel_state->need_src_tile_y = FALSE;
+ info->accel_state->src_tile_width = info->accel_state->src_tile_height = 65536; /* "infinite" */
if (pPict->repeat) {
Bool badPitch = needMatchingPitch && !RADEONPitchMatches(pPix);
@@ -301,17 +294,19 @@ static Bool RADEONSetupSourceTile(PicturePtr pPict,
RADEON_FALLBACK(("Width %d and pitch %u not compatible for repeat\n",
w, (unsigned)exaGetPixmapPitch(pPix)));
} else {
- need_src_tile_x = (w & (w - 1)) != 0 || badPitch;
- need_src_tile_y = (h & (h - 1)) != 0;
+ info->accel_state->need_src_tile_x = (w & (w - 1)) != 0 || badPitch;
+ info->accel_state->need_src_tile_y = (h & (h - 1)) != 0;
if (!canTile1d)
- need_src_tile_x = need_src_tile_y = need_src_tile_x || need_src_tile_y;
+ info->accel_state->need_src_tile_x =
+ info->accel_state->need_src_tile_y =
+ info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y;
}
- if (need_src_tile_x)
- src_tile_width = w;
- if (need_src_tile_y)
- src_tile_height = h;
+ if (info->accel_state->need_src_tile_x)
+ info->accel_state->src_tile_width = w;
+ if (info->accel_state->need_src_tile_y)
+ info->accel_state->src_tile_height = h;
}
return TRUE;
@@ -357,7 +352,8 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
uint32_t txfilter, txformat, txoffset, txpitch;
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
- Bool repeat = pPict->repeat && !(unit == 0 && (need_src_tile_x || need_src_tile_y));
+ Bool repeat = pPict->repeat &&
+ !(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
int i;
ACCEL_PREAMBLE();
@@ -427,10 +423,10 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
FINISH_ACCEL();
if (pPict->transform != 0) {
- is_transform[unit] = TRUE;
- transform[unit] = pPict->transform;
+ info->accel_state->is_transform[unit] = TRUE;
+ info->accel_state->transform[unit] = pPict->transform;
} else {
- is_transform[unit] = FALSE;
+ info->accel_state->is_transform[unit] = FALSE;
}
return TRUE;
@@ -538,9 +534,9 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
return FALSE;
if (pMask)
- has_mask = TRUE;
+ info->accel_state->has_mask = TRUE;
else
- has_mask = FALSE;
+ info->accel_state->has_mask = FALSE;
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -569,7 +565,7 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
return FALSE;
pp_cntl |= RADEON_TEX_1_ENABLE;
} else {
- is_transform[1] = FALSE;
+ info->accel_state->is_transform[1] = FALSE;
}
RADEON_SWITCH_TO_3D();
@@ -670,7 +666,8 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
uint32_t txfilter, txformat, txoffset, txpitch;
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
- Bool repeat = pPict->repeat && !(unit == 0 && (need_src_tile_x || need_src_tile_y));
+ Bool repeat = pPict->repeat &&
+ !(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
int i;
ACCEL_PREAMBLE();
@@ -742,10 +739,10 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
FINISH_ACCEL();
if (pPict->transform != 0) {
- is_transform[unit] = TRUE;
- transform[unit] = pPict->transform;
+ info->accel_state->is_transform[unit] = TRUE;
+ info->accel_state->transform[unit] = pPict->transform;
} else {
- is_transform[unit] = FALSE;
+ info->accel_state->is_transform[unit] = FALSE;
}
return TRUE;
@@ -837,9 +834,9 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
return FALSE;
if (pMask)
- has_mask = TRUE;
+ info->accel_state->has_mask = TRUE;
else
- has_mask = FALSE;
+ info->accel_state->has_mask = FALSE;
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -866,7 +863,7 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
return FALSE;
pp_cntl |= RADEON_TEX_1_ENABLE;
} else {
- is_transform[1] = FALSE;
+ info->accel_state->is_transform[1] = FALSE;
}
RADEON_SWITCH_TO_3D();
@@ -1048,12 +1045,12 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
info->accel_state->texW[unit] = w;
info->accel_state->texH[unit] = h;
- if (pPict->repeat && !(unit == 0 && need_src_tile_x))
+ if (pPict->repeat && !(unit == 0 && info->accel_state->need_src_tile_x))
txfilter = R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP);
else
txfilter = R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL);
- if (pPict->repeat && !(unit == 0 && need_src_tile_y))
+ if (pPict->repeat && !(unit == 0 && info->accel_state->need_src_tile_y))
txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP);
else
txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
@@ -1083,10 +1080,10 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
FINISH_ACCEL();
if (pPict->transform != 0) {
- is_transform[unit] = TRUE;
- transform[unit] = pPict->transform;
+ info->accel_state->is_transform[unit] = TRUE;
+ info->accel_state->transform[unit] = pPict->transform;
} else {
- is_transform[unit] = FALSE;
+ info->accel_state->is_transform[unit] = FALSE;
}
return TRUE;
@@ -1198,9 +1195,9 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
return FALSE;
if (pMask)
- has_mask = TRUE;
+ info->accel_state->has_mask = TRUE;
else
- has_mask = FALSE;
+ info->accel_state->has_mask = FALSE;
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -1230,7 +1227,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
return FALSE;
txenable |= R300_TEX_1_ENABLE;
} else {
- is_transform[1] = FALSE;
+ info->accel_state->is_transform[1] = FALSE;
}
RADEON_SWITCH_TO_3D();
@@ -1938,20 +1935,20 @@ static void FUNC_NAME(RadeonCompositeTile)(PixmapPtr pDst,
maskBottomRight.x = IntToxFixed(maskX + w);
maskBottomRight.y = IntToxFixed(maskY + h);
- if (is_transform[0]) {
- transformPoint(transform[0], &srcTopLeft);
- transformPoint(transform[0], &srcTopRight);
- transformPoint(transform[0], &srcBottomLeft);
- transformPoint(transform[0], &srcBottomRight);
+ if (info->accel_state->is_transform[0]) {
+ transformPoint(info->accel_state->transform[0], &srcTopLeft);
+ transformPoint(info->accel_state->transform[0], &srcTopRight);
+ transformPoint(info->accel_state->transform[0], &srcBottomLeft);
+ transformPoint(info->accel_state->transform[0], &srcBottomRight);
}
- if (is_transform[1]) {
- transformPoint(transform[1], &maskTopLeft);
- transformPoint(transform[1], &maskTopRight);
- transformPoint(transform[1], &maskBottomLeft);
- transformPoint(transform[1], &maskBottomRight);
+ if (info->accel_state->is_transform[1]) {
+ transformPoint(info->accel_state->transform[1], &maskTopLeft);
+ transformPoint(info->accel_state->transform[1], &maskTopRight);
+ transformPoint(info->accel_state->transform[1], &maskBottomLeft);
+ transformPoint(info->accel_state->transform[1], &maskBottomRight);
}
- if (has_mask)
+ if (info->accel_state->has_mask)
vtx_count = VTX_COUNT_MASK;
else
vtx_count = VTX_COUNT;
@@ -1967,7 +1964,7 @@ static void FUNC_NAME(RadeonCompositeTile)(PixmapPtr pDst,
BEGIN_RING(3 * vtx_count + 3);
OUT_RING(CP_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
3 * vtx_count + 1));
- if (has_mask)
+ if (info->accel_state->has_mask)
OUT_RING(RADEON_CP_VC_FRMT_XY |
RADEON_CP_VC_FRMT_ST0 |
RADEON_CP_VC_FRMT_ST1);
@@ -2012,7 +2009,7 @@ static void FUNC_NAME(RadeonCompositeTile)(PixmapPtr pDst,
#endif
- if (has_mask) {
+ if (info->accel_state->has_mask) {
if (info->ChipFamily >= CHIP_FAMILY_R200) {
VTX_OUT_MASK((float)dstX, (float)dstY,
xFixedToFloat(srcTopLeft.x) / info->accel_state->texW[0], xFixedToFloat(srcTopLeft.y) / info->accel_state->texH[0],
@@ -2063,8 +2060,9 @@ static void FUNC_NAME(RadeonComposite)(PixmapPtr pDst,
{
int tileSrcY, tileMaskY, tileDstY;
int remainingHeight;
-
- if (!need_src_tile_x && !need_src_tile_y) {
+ RINFO_FROM_SCREEN(pDst->drawable.pScreen);
+
+ if (!info->accel_state->need_src_tile_x && !info->accel_state->need_src_tile_y) {
FUNC_NAME(RadeonCompositeTile)(pDst,
srcX, srcY,
maskX, maskY,
@@ -2075,7 +2073,7 @@ static void FUNC_NAME(RadeonComposite)(PixmapPtr pDst,
/* Tiling logic borrowed from exaFillRegionTiled */
- modulus(srcY, src_tile_height, tileSrcY);
+ modulus(srcY, info->accel_state->src_tile_height, tileSrcY);
tileMaskY = maskY;
tileDstY = dstY;
@@ -2083,18 +2081,18 @@ static void FUNC_NAME(RadeonComposite)(PixmapPtr pDst,
while (remainingHeight > 0) {
int remainingWidth = width;
int tileSrcX, tileMaskX, tileDstX;
- int h = src_tile_height - tileSrcY;
+ int h = info->accel_state->src_tile_height - tileSrcY;
if (h > remainingHeight)
h = remainingHeight;
remainingHeight -= h;
- modulus(srcX, src_tile_width, tileSrcX);
+ modulus(srcX, info->accel_state->src_tile_width, tileSrcX);
tileMaskX = maskX;
tileDstX = dstX;
while (remainingWidth > 0) {
- int w = src_tile_width - tileSrcX;
+ int w = info->accel_state->src_tile_width - tileSrcX;
if (w > remainingWidth)
w = remainingWidth;
remainingWidth -= w;