diff options
author | Adam Jackson <ajax@redhat.com> | 2011-04-14 16:04:50 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2011-04-14 16:17:02 -0400 |
commit | 982c22f16c8eeee9be81779fbfe17d8d3f9b6897 (patch) | |
tree | 93dd69bc548090b212685cbb2f51c632d6c77e9d /src/radeon_exa_render.c | |
parent | cc7d1fa39da40a532fcdbe6c7924ca47a879e66a (diff) |
R520: Fix textures larger than 2k
Ported from the equivalent fix in Mesa.
Diffstat (limited to 'src/radeon_exa_render.c')
-rw-r--r-- | src/radeon_exa_render.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 43d35558..e5c231fa 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -1180,10 +1180,10 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, int unit) { RINFO_FROM_SCREEN(pPix->drawable.pScreen); - uint32_t txfilter, txformat0, txformat1, txoffset, txpitch; + uint32_t txfilter, txformat0, txformat1, txoffset, txpitch, us_format = 0; int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; - int i, pixel_shift; + int i, pixel_shift, out_size = 6; unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; struct radeon_exa_pixmap_priv *driver_priv; ACCEL_PREAMBLE(); @@ -1230,6 +1230,26 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, if (IS_R500_3D && ((h - 1) & 0x800)) txpitch |= R500_TXHEIGHT_11; + if (info->ChipFamily == CHIP_FAMILY_R520) { + unsigned us_width = (w - 1) & 0x7ff; + unsigned us_height = (h - 1) & 0x7ff; + unsigned us_depth = 0; + + if (w > 2048) { + us_width = (0x7ff + us_width) >> 1; + us_depth |= 0x0d; + } + if (h > 2048) { + us_height = (0x7ff + us_height) >> 1; + us_depth |= 0x0e; + } + + us_format = (us_width << R300_TXWIDTH_SHIFT) | + (us_height << R300_TXHEIGHT_SHIFT) | + (us_depth << R300_TXDEPTH_SHIFT); + out_size++; + } + /* Use TXPITCH instead of TXWIDTH for address computations: we could * omit this if there is no padding, but there is no apparent advantage * in doing so. @@ -1276,7 +1296,9 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } - BEGIN_ACCEL_RELOC(repeatType == RepeatNone ? 7 : 6, 1); + if (repeatType == RepeatNone) + out_size++; + BEGIN_ACCEL_RELOC(out_size, 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); @@ -1287,6 +1309,8 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, if (repeatType == RepeatNone) OUT_ACCEL_REG(R300_TX_BORDER_COLOR_0 + (unit * 4), 0); + if (info->ChipFamily == CHIP_FAMILY_R520) + OUT_ACCEL_REG(R500_US_FORMAT0_0 + (unit * 4), us_format); FINISH_ACCEL(); if (pPict->transform != 0) { |