diff --git a/src/r600_exa.c b/src/r600_exa.c index 57867f1..f2ddc67 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -1062,6 +1062,7 @@ static Bool R600CheckCompositeTexture(PicturePtr pPict, { int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; unsigned int i; int max_tex_w, max_tex_h; @@ -1092,7 +1093,7 @@ static Bool R600CheckCompositeTexture(PicturePtr pPict, * clipping. */ /* FIXME R6xx */ - if (pPict->transform != 0 && !pPict->repeat && PICT_FORMAT_A(pPict->format) == 0) { + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -1108,6 +1109,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, struct radeon_accel_state *accel_state = info->accel_state; int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; unsigned int i; tex_resource_t tex_res; tex_sampler_t tex_samp; @@ -1258,11 +1260,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, tex_samp.id = unit; tex_samp.border_color = SQ_TEX_BORDER_COLOR_TRANS_BLACK; - /* Unfortunately we can't rely on the X server doing this for us */ - if (!pPict->repeat) - pPict->repeatType = RepeatNone; - - switch (pPict->repeatType) { + switch (repeatType) { case RepeatNormal: tex_samp.clamp_x = SQ_TEX_WRAP; tex_samp.clamp_y = SQ_TEX_WRAP; @@ -1280,7 +1278,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, tex_samp.clamp_y = SQ_TEX_CLAMP_BORDER; break; default: - RADEON_FALLBACK(("Bad repeat 0x%x\n", pPict->repeatType)); + RADEON_FALLBACK(("Bad repeat 0x%x\n", repeatType)); } switch (pPict->filter) { diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 333580b..2b9bc40 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -243,10 +243,11 @@ static Bool RADEONCheckTexturePOT(PicturePtr pPict, Bool canTile) { int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; - if (pPict->repeat && pPict->repeatType != RepeatPad && + if ((repeatType == RepeatNormal || repeatType == RepeatReflect) && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0) && - !(pPict->repeatType == RepeatNormal && !pPict->transform && canTile)) + !(repeatType == RepeatNormal && !pPict->transform && canTile)) RADEON_FALLBACK(("NPOT repeating %s unsupported (%dx%d), transform=%d\n", canTile ? "source" : "mask", w, h, pPict->transform != 0)); @@ -290,11 +291,12 @@ static Bool RADEONSetupSourceTile(PicturePtr pPict, Bool needMatchingPitch) { RINFO_FROM_SCREEN(pPix->drawable.pScreen); + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; 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 && pPict->repeatType != RepeatPad) { + if (repeatType == RepeatNormal || repeatType == RepeatReflect) { Bool badPitch = needMatchingPitch && !RADEONPitchMatches(pPix); int w = pPict->pDrawable->width; @@ -310,7 +312,7 @@ static Bool RADEONSetupSourceTile(PicturePtr pPict, if ((info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y) && - pPict->repeatType != RepeatNormal) + repeatType != RepeatNormal) RADEON_FALLBACK(("Can only tile RepeatNormal at this time\n")); if (!canTile1d) @@ -372,7 +374,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 && pPict->repeatType != RepeatPad && + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; + Bool repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) && !(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y)); int i; struct radeon_exa_pixmap_priv *driver_priv; @@ -420,11 +423,7 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } - /* Unfortunately we can't rely on the X server doing this for us */ - if (!pPict->repeat) - pPict->repeatType = RepeatNone; - - switch (pPict->repeatType) { + switch (repeatType) { case RepeatNormal: txfilter |= RADEON_CLAMP_S_WRAP | RADEON_CLAMP_T_WRAP; break; @@ -757,7 +756,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 && pPict->repeatType != RepeatPad && + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; + Bool repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) && !(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y)); int i; struct radeon_exa_pixmap_priv *driver_priv; @@ -807,11 +807,7 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } - /* Unfortunately we can't rely on the X server doing this for us */ - if (!pPict->repeat) - pPict->repeatType = RepeatNone; - - switch (pPict->repeatType) { + switch (repeatType) { case RepeatNormal: txfilter |= R200_CLAMP_S_WRAP | R200_CLAMP_T_WRAP; break; @@ -1069,6 +1065,7 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict, ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; int i; @@ -1136,7 +1133,7 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict, * matter. I have not, however, verified that the X server always does such * clipping. */ - if (pPict->transform != 0 && !pPict->repeat && PICT_FORMAT_A(pPict->format) == 0) { + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -1154,6 +1151,7 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; int i, pixel_shift; + unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; struct radeon_exa_pixmap_priv *driver_priv; ACCEL_PREAMBLE(); @@ -1207,11 +1205,7 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, txfilter = (unit << R300_TX_ID_SHIFT); - /* Unfortunately we can't rely on the X server doing this for us */ - if (!pPict->repeat) - pPict->repeatType = RepeatNone; - - switch (pPict->repeatType) { + switch (repeatType) { case RepeatNormal: if (unit != 0 || !info->accel_state->need_src_tile_x) txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP); @@ -1249,7 +1243,7 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } - BEGIN_ACCEL_RELOC(pPict->repeat ? 6 : 7, 1); + BEGIN_ACCEL_RELOC(repeatType == RepeatNone ? 7 : 6, 1); OUT_ACCEL_REG(R300_TX_FILTER0_0 + (unit * 4), txfilter); OUT_ACCEL_REG(R300_TX_FILTER1_0 + (unit * 4), 0); OUT_ACCEL_REG(R300_TX_FORMAT0_0 + (unit * 4), txformat0); @@ -1258,7 +1252,7 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, EMIT_READ_OFFSET((R300_TX_OFFSET_0 + (unit * 4)), txoffset, pPix); - if (!pPict->repeat) + if (repeatType == RepeatNone) OUT_ACCEL_REG(R300_TX_BORDER_COLOR_0 + (unit * 4), 0); FINISH_ACCEL();