diff options
author | Marek Olšák <[email protected]> | 2017-08-17 23:24:00 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-08-29 19:14:12 +0100 |
commit | d93e6a04090fa629db4f426df94eeea502b730ae (patch) | |
tree | 9e6c5ba08c45e7de88dd6ef550ce0266f98dddd5 | |
parent | cf2f05ff9177ee1b095071e11419f464bf176631 (diff) |
radeonsi/gfx9: properly handle imported textures with unexpected swizzle mode
Cc: 17.2 <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
(cherry picked from commit fdef2f0fd19ac6f2715a802d1e14b8ddfa094f11)
[Emil Velikov: r600_surface_import_metadata is not separate function,
tile_swizzle isn't in branch]
Signed-off-by: Emil Velikov <[email protected]>
Conflicts:
src/gallium/drivers/radeon/r600_texture.c
-rw-r--r-- | src/amd/common/ac_surface.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 26f3729adf9..b3d72dc9299 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -1009,6 +1009,11 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib, case RADEON_SURF_MODE_1D: case RADEON_SURF_MODE_2D: + if (surf->flags & RADEON_SURF_IMPORTED) { + AddrSurfInfoIn.swizzleMode = surf->u.gfx9.surf.swizzle_mode; + break; + } + r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false, &AddrSurfInfoIn.swizzleMode); if (r) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 3aac3c78a98..bebaa5b04e9 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1467,7 +1467,9 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen array_mode = RADEON_SURF_MODE_LINEAR_ALIGNED; is_scanout = metadata.u.gfx9.swizzle_mode == 0 || - metadata.u.gfx9.swizzle_mode % 4 == 2; + metadata.u.gfx9.swizzle_mode % 4 == 2; + + surface.u.gfx9.surf.swizzle_mode = metadata.u.gfx9.swizzle_mode; } else { surface.u.legacy.pipe_config = metadata.u.legacy.pipe_config; surface.u.legacy.bankw = metadata.u.legacy.bankw; @@ -1502,11 +1504,6 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen if (rscreen->apply_opaque_metadata) rscreen->apply_opaque_metadata(rscreen, rtex, &metadata); - /* Validate that addrlib arrived at the same surface parameters. */ - if (rscreen->chip_class >= GFX9) { - assert(metadata.u.gfx9.swizzle_mode == surface.u.gfx9.surf.swizzle_mode); - } - return &rtex->resource.b.b; } |