summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-09-30 14:03:30 -0400
committerMarek Olšák <[email protected]>2019-10-09 17:06:54 -0400
commit28da990bedea508c8cd84ae5db7f46da955d4163 (patch)
tree1a0889ed941e79e086347c0c6bddef0ab7f881d9 /src
parent86e60bc265936e5b21975cf5b6f93fa040902424 (diff)
radeonsi: ignore metadata for non-zero planes
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index 010dea65ea2..7fb671694c6 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -760,11 +760,13 @@ static void si_set_tex_bo_metadata(struct si_screen *sscreen,
static bool si_read_tex_bo_metadata(struct si_screen *sscreen,
struct si_texture *tex,
+ uint64_t offset,
struct radeon_bo_metadata *md)
{
uint32_t *desc = &md->metadata[2];
- if (md->size_metadata < 10 * 4 || /* at least 2(header) + 8(desc) dwords */
+ if (offset || /* Non-zero planes ignore metadata. */
+ md->size_metadata < 10 * 4 || /* at least 2(header) + 8(desc) dwords */
md->metadata[0] == 0 || /* invalid version number */
md->metadata[1] != si_get_bo_metadata_word1(sscreen)) /* invalid PCI ID */ {
/* Disable DCC because it might not be enabled. */
@@ -1743,6 +1745,10 @@ static struct pipe_resource *si_texture_from_winsys_buffer(struct si_screen *ssc
bool is_scanout;
int r;
+ /* Ignore metadata for non-zero planes. */
+ if (offset != 0)
+ dedicated = false;
+
if (dedicated) {
sscreen->ws->buffer_get_metadata(buf, &metadata);
si_get_display_metadata(sscreen, &surface, &metadata,
@@ -1789,7 +1795,7 @@ static struct pipe_resource *si_texture_from_winsys_buffer(struct si_screen *ssc
tex->buffer.external_usage = usage;
tex->num_planes = 1;
- if (!si_read_tex_bo_metadata(sscreen, tex, &metadata)) {
+ if (!si_read_tex_bo_metadata(sscreen, tex, offset, &metadata)) {
si_texture_reference(&tex, NULL);
return NULL;
}