From 5a17038420ebcd8b5e83339932d561207500c916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 1 Aug 2010 16:42:53 +0200 Subject: [PATCH] r300g: fix microtiling on RS6xx Getting tiling right has always been tricky. There are so many subtle details... --- src/gallium/drivers/r300/r300_texture_desc.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 343089b..f6c1411 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -138,11 +138,24 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, /* Some IGPs need a minimum stride of 64 bytes, hmm... * This doesn't seem to apply to tiled textures, according to r300c. */ - if (!desc->microtile && !desc->macrotile[level] && + if (!desc->macrotile[level] && (screen->caps.family == CHIP_FAMILY_RS600 || screen->caps.family == CHIP_FAMILY_RS690 || screen->caps.family == CHIP_FAMILY_RS740)) { - return stride < 64 ? 64 : stride; + if (desc->microtile) { + unsigned min_tiles_x; + unsigned tile_height = + r300_get_pixel_alignment(desc->b.b.format, + desc->b.b.nr_samples, + desc->microtile, + desc->macrotile[level], + DIM_HEIGHT); + + min_tiles_x = 64 / tile_height; + return stride < min_tiles_x ? min_tiles_x : stride; + } else { + return stride < 64 ? 64 : stride; + } } /* The alignment to 32 bytes is sort of implied by the layout... */ -- 1.7.0.4