X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fr300%2Fr300_texture_desc.c;h=8fa98c5804e02281fc949f0e5bc3b544c444f92b;hb=04f2c88f45e26d7050cc88aaaac8e8154d6018d0;hp=c5636ca3bcc8d7c209c896adefcbf50849a1fc60;hpb=7bfbf5b28791b9cb192201e6cf251da35da49080;p=mesa.git diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index c5636ca3bcc..8fa98c5804e 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -349,6 +349,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, static unsigned hiz_align_y[4] = {8, 8, 8, 32}; if (util_format_is_depth_or_stencil(tex->b.b.format) && + util_format_get_blocksizebits(tex->b.b.format) == 32 && tex->tex.microtile) { unsigned i, pipes; @@ -416,6 +417,10 @@ static void r300_setup_cmask_properties(struct r300_screen *screen, static unsigned cmask_align_y[4] = {16, 16, 16, 32}; unsigned pipes, stride, cmask_num_dw, cmask_max_size; + if (!screen->caps.has_cmask) { + return; + } + /* We need an AA colorbuffer, no mipmaps. */ if (tex->b.b.nr_samples <= 1 || tex->b.b.last_level > 0 || @@ -424,7 +429,8 @@ static void r300_setup_cmask_properties(struct r300_screen *screen, } /* FP16 AA needs R500 and a fairly new DRM. */ - if (tex->b.b.format == PIPE_FORMAT_R16G16B16A16_FLOAT && + if ((tex->b.b.format == PIPE_FORMAT_R16G16B16A16_FLOAT || + tex->b.b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) && (!screen->caps.is_r500 || screen->info.drm_minor < 29)) { return; } @@ -476,6 +482,10 @@ static void r300_setup_tiling(struct r300_screen *screen, tex->tex.microtile = RADEON_LAYOUT_LINEAR; tex->tex.macrotile[0] = RADEON_LAYOUT_LINEAR; + if (tex->b.b.usage == PIPE_USAGE_STAGING) { + return; + } + if (!util_format_is_plain(format)) { return; } @@ -542,6 +552,39 @@ void r300_texture_desc_init(struct r300_screen *rscreen, tex->tex.height0 = base->height0; tex->tex.depth0 = base->depth0; + /* There is a CB memory addressing hardware bug that limits the width + * of the MSAA buffer in some cases in R520. In order to get around it, + * the following code lowers the sample count depending on the format and + * the width. + * + * The only catch is that all MSAA colorbuffers and a zbuffer which are + * supposed to be used together should always be bound together. Only + * then the correct minimum sample count of all bound buffers is used + * for rendering. */ + if (rscreen->caps.is_r500) { + /* FP16 6x MSAA buffers are limited to a width of 1360 pixels. */ + if ((tex->b.b.format == PIPE_FORMAT_R16G16B16A16_FLOAT || + tex->b.b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) && + tex->b.b.nr_samples == 6 && tex->b.b.width0 > 1360) { + tex->b.b.nr_samples = 4; + } + + /* FP16 4x MSAA buffers are limited to a width of 2048 pixels. */ + if ((tex->b.b.format == PIPE_FORMAT_R16G16B16A16_FLOAT || + tex->b.b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) && + tex->b.b.nr_samples == 4 && tex->b.b.width0 > 2048) { + tex->b.b.nr_samples = 2; + } + } + + /* 32-bit 6x MSAA buffers are limited to a width of 2720 pixels. + * This applies to all R300-R500 cards. */ + if (util_format_get_blocksizebits(tex->b.b.format) == 32 && + !util_format_is_depth_or_stencil(tex->b.b.format) && + tex->b.b.nr_samples == 6 && tex->b.b.width0 > 2720) { + tex->b.b.nr_samples = 4; + } + r300_setup_flags(tex); /* Align a 3D NPOT texture to POT. */