diff options
Diffstat (limited to 'src/gallium/drivers/r300/r300_texture.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 4a5c932b7e..4823755fb7 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -696,7 +696,7 @@ static boolean r300_texture_macro_switch(struct r300_texture *tex, unsigned r300_texture_get_stride(struct r300_screen* screen, struct r300_texture* tex, unsigned level) { - unsigned tile_width, width; + unsigned tile_width, width, stride; if (tex->stride_override) return tex->stride_override; @@ -715,7 +715,19 @@ unsigned r300_texture_get_stride(struct r300_screen* screen, tex->mip_macrotile[level]); width = align(width, tile_width); - return util_format_get_stride(tex->b.b.format, width); + stride = util_format_get_stride(tex->b.b.format, width); + + /* Some IGPs need a minimum stride of 64 bytes, hmm... + * This doesn't seem to apply to tiled textures, according to r300c. */ + if (!tex->microtile && !tex->mip_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; + } + + /* The alignment to 32 bytes is sort of implied by the layout... */ + return stride; } else { return align(util_format_get_stride(tex->b.b.format, width), 32); } @@ -959,13 +971,16 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen, base->width0, base->height0, base->depth0, base->last_level, util_format_short_name(base->format)); - tex->buffer = rws->buffer_create(rws, 2048, - base->bind, - tex->size); + tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ? R300_DOMAIN_GTT : + R300_DOMAIN_VRAM; + + tex->buffer = rws->buffer_create(rws, 2048, base->bind, tex->domain, + tex->size); + rws->buffer_set_tiling(rws, tex->buffer, - tex->pitch[0], - tex->microtile, - tex->macrotile); + tex->pitch[0] * util_format_get_blocksize(tex->b.b.format), + tex->microtile, + tex->macrotile); if (!tex->buffer) { FREE(tex); @@ -1048,6 +1063,7 @@ r300_texture_from_handle(struct pipe_screen* screen, tex->b.vtbl = &r300_texture_vtbl; pipe_reference_init(&tex->b.b.reference, 1); tex->b.b.screen = screen; + tex->domain = R300_DOMAIN_VRAM; tex->stride_override = stride; @@ -1093,9 +1109,9 @@ r300_texture_from_handle(struct pipe_screen* screen, if (override_zb_flags) { rws->buffer_set_tiling(rws, tex->buffer, - tex->pitch[0], - tex->microtile, - tex->macrotile); + tex->pitch[0] * util_format_get_blocksize(tex->b.b.format), + tex->microtile, + tex->macrotile); } return (struct pipe_resource*)tex; } |