From: Pierre-Eric Pelloux-Prayer Date: Tue, 21 Mar 2023 09:46:53 +0000 (+0100) Subject: radeonsi: add AMD_DEBUG=extra_md X-Git-Tag: upstream/23.3.3~10977 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46d2655a18df222a4f7b310492b2369242f9b844;p=platform%2Fupstream%2Fmesa.git radeonsi: add AMD_DEBUG=extra_md When this debug flag is set, the driver sets the umd metadata for all color textures and enables the use of extended metadata. Extended metadata allows umr to import textures and setting these on all color texture allows to import non-exported textures (eg: dGPU draw surface when DRI_PRIME=1 is used). Reviewed-by: Marek Olšák Part-of: --- diff --git a/docs/envvars.rst b/docs/envvars.rst index 85d1930..de973e6 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1368,6 +1368,8 @@ RadeonSI driver environment variables Enable DPBB. ``dfsm`` Enable DFSM. + ``extra_md`` + add extra information in bo metadatas to help tools (umr) r600 driver environment variables --------------------------------- diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index c83716d..55b9035 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -119,6 +119,8 @@ static const struct debug_named_value radeonsi_debug_options[] = { {"nofmask", DBG(NO_FMASK), "Disable MSAA compression"}, {"nodma", DBG(NO_DMA), "Disable SDMA-copy for DRI_PRIME"}, + {"extra_md", DBG(EXTRA_METADATA), "Set UMD metadata for all textures and with additional fields for umr"}, + {"tmz", DBG(TMZ), "Force allocation of scanout/depth/stencil buffer as encrypted"}, {"sqtt", DBG(SQTT), "Enable SQTT"}, diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index cfa3804..91efb8b 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -256,6 +256,8 @@ enum DBG_NO_FMASK, DBG_NO_DMA, + DBG_EXTRA_METADATA, + DBG_TMZ, DBG_SQTT, diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index f7ef69d..8c5051e 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -556,7 +556,7 @@ static void si_set_tex_bo_metadata(struct si_screen *sscreen, struct si_texture ac_surface_compute_umd_metadata(&sscreen->info, &tex->surface, tex->buffer.b.b.last_level + 1, desc, &md.size_metadata, md.metadata, - false); + sscreen->debug_flags & DBG(EXTRA_METADATA)); sscreen->ws->buffer_set_metadata(sscreen->ws, tex->buffer.buf, &md, &tex->surface); } @@ -1307,6 +1307,11 @@ si_texture_create_with_modifier(struct pipe_screen *screen, */ if (num_planes > 1) plane_templ[i].bind |= PIPE_BIND_SHARED; + /* Setting metadata on suballocated buffers is impossible. So use PIPE_BIND_CUSTOM to + * request a non-suballocated buffer. + */ + if (!is_zs && sscreen->debug_flags & DBG(EXTRA_METADATA)) + plane_templ[i].bind |= PIPE_BIND_CUSTOM; if (si_init_surface(sscreen, &surface[i], &plane_templ[i], tile_mode, modifier, false, plane_templ[i].bind & PIPE_BIND_SCANOUT, @@ -1340,6 +1345,8 @@ si_texture_create_with_modifier(struct pipe_screen *screen, last_plane->buffer.b.b.next = &tex->buffer.b.b; last_plane = tex; } + if (i == 0 && !is_zs && sscreen->debug_flags & DBG(EXTRA_METADATA)) + si_set_tex_bo_metadata(sscreen, tex); } return (struct pipe_resource *)plane0;