From 28da990bedea508c8cd84ae5db7f46da955d4163 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 30 Sep 2019 14:03:30 -0400 Subject: [PATCH] radeonsi: ignore metadata for non-zero planes Reviewed-by: Bas Nieuwenhuizen --- src/gallium/drivers/radeonsi/si_texture.c | 10 ++++++++-- 1 file 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; } -- 2.30.2