diff --git a/.pick_status.json b/.pick_status.json index 17f850fdb5d..bcc90e6a96e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index d18e894b40c..613713e6b8f 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -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)