From 54ffc5d493ddf0fe43084a236c87faf88a9ce6f4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 10 Dec 2010 15:40:48 +1000 Subject: [PATCH] r300g: hack for rs690 tiling alignment issues --- src/gallium/drivers/r300/r300_texture.c | 2 +- src/gallium/drivers/r300/r300_texture_desc.c | 20 +++++++++++++++----- src/gallium/drivers/r300/r300_texture_desc.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 70fc5d9..6d86bc2 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -899,7 +899,7 @@ struct pipe_surface* r300_create_surface(struct pipe_context * ctx, tex->desc.b.b.nr_samples, tex->desc.microtile, tex->desc.macrotile[level], - DIM_HEIGHT); + DIM_HEIGHT, 0); surface->cbzb_height = align((surface->base.height + 1) / 2, tile_height); diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index aa82c47..99a55f5 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -34,7 +34,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, unsigned num_samples, enum r300_buffer_tiling microtile, enum r300_buffer_tiling macrotile, - enum r300_dim dim) + enum r300_dim dim, boolean is_rs690) { static const unsigned table[2][5][3][2] = { @@ -57,6 +57,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, {{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */ } }; + static const unsigned aa_block[2] = {4, 8}; unsigned tile = 0; unsigned pixsize = util_format_get_blocksize(format); @@ -74,6 +75,12 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, } else { /* Standard alignment. */ tile = table[macrotile][util_logbase2(pixsize)][microtile][dim]; + if (macrotile == 0 && is_rs690 && dim == DIM_WIDTH && pixsize == 4) { + if (microtile && (tile < 8)) + tile = 8; + else if (!microtile && (tile < 16)) + tile = 16; + } } assert(tile); @@ -89,7 +96,7 @@ static boolean r300_texture_macro_switch(struct r300_texture_desc *desc, unsigned tile, texdim; tile = r300_get_pixel_alignment(desc->b.b.format, desc->b.b.nr_samples, - desc->microtile, R300_BUFFER_TILED, dim); + desc->microtile, R300_BUFFER_TILED, dim, 0); if (dim == DIM_WIDTH) { texdim = u_minify(desc->width0, level); } else { @@ -113,6 +120,9 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, unsigned level) { unsigned tile_width, width, stride; + boolean is_rs690 = (screen->caps.family == CHIP_FAMILY_RS600 || + screen->caps.family == CHIP_FAMILY_RS690 || + screen->caps.family == CHIP_FAMILY_RS740); if (desc->stride_in_bytes_override) return desc->stride_in_bytes_override; @@ -131,7 +141,7 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, desc->b.b.nr_samples, desc->microtile, desc->macrotile[level], - DIM_WIDTH); + DIM_WIDTH, is_rs690); width = align(width, tile_width); stride = util_format_get_stride(desc->b.b.format, width); @@ -149,7 +159,7 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, desc->b.b.nr_samples, desc->microtile, desc->macrotile[level], - DIM_HEIGHT); + DIM_HEIGHT, 0); min_stride = 64 / tile_height; } else { @@ -179,7 +189,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc, desc->b.b.nr_samples, desc->microtile, desc->macrotile[level], - DIM_HEIGHT); + DIM_HEIGHT, 0); height = align(height, tile_height); /* This is needed for the kernel checker, unfortunately. */ diff --git a/src/gallium/drivers/r300/r300_texture_desc.h b/src/gallium/drivers/r300/r300_texture_desc.h index 44d8879..121d215 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.h +++ b/src/gallium/drivers/r300/r300_texture_desc.h @@ -41,7 +41,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, unsigned num_samples, enum r300_buffer_tiling microtile, enum r300_buffer_tiling macrotile, - enum r300_dim dim); + enum r300_dim dim, boolean is_rs690); boolean r300_texture_desc_init(struct r300_screen *rscreen, struct r300_texture_desc *desc, -- 1.7.3.3