radeonsi: Set multi plane format also for imported textures

multi_plane_format is used to correctly copy all planes for staging texture
copies, otherwise only the first plane gets copied.
It's now also used in si_video_dec, which doesn't work when decoding into
imported surfaces if multi_plane_format is not set.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15232
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 3dbbd94ffd)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
David Rosca 2026-04-07 10:49:39 +02:00 committed by Eric Engestrom
parent 599bb79ff4
commit 5447f81cc5
2 changed files with 14 additions and 4 deletions

View file

@ -3084,7 +3084,7 @@
"description": "radeonsi: Set multi plane format also for imported textures",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1931,6 +1931,7 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
{
struct si_screen *sscreen = (struct si_screen *)screen;
struct pb_buffer_lean *buf = NULL;
unsigned format_num_planes = util_format_get_num_planes(whandle->format);
buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle,
sscreen->info.max_alignment,
@ -1941,7 +1942,7 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
if (templ->target == PIPE_BUFFER)
return si_buffer_from_winsys_buffer(screen, templ, buf, 0, true);
if (whandle->plane >= util_format_get_num_planes(whandle->format)) {
if (whandle->plane >= format_num_planes) {
struct si_auxiliary_texture *tex = CALLOC_STRUCT_CL(si_auxiliary_texture);
if (!tex)
return NULL;
@ -1956,8 +1957,17 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
return &tex->b.b;
}
return si_texture_from_winsys_buffer(sscreen, templ, buf, whandle->stride, whandle->offset,
whandle->modifier, usage, true, true);
struct pipe_resource *texture =
si_texture_from_winsys_buffer(sscreen, templ, buf, whandle->stride, whandle->offset,
whandle->modifier, usage, true, true);
if (texture && whandle->plane == 0 && format_num_planes >= 2) {
struct si_texture *tex = (struct si_texture *)texture;
tex->multi_plane_format = whandle->format;
}
return texture;
}
bool si_init_flushed_depth_texture(struct pipe_context *ctx, struct pipe_resource *texture)