radeonsi: Inherit the old modifier when reallocating the texture.

Otherwise the reallocated texture has an invalid modifier when exporting
the VAAPI surface handle.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19097>
This commit is contained in:
nyanmisaka 2022-10-17 22:51:37 +08:00 committed by Marge Bot
parent 5bc52a9103
commit 0e782d9609

View file

@ -446,7 +446,13 @@ static void si_reallocate_texture_inplace(struct si_context *sctx, struct si_tex
return;
}
new_tex = (struct si_texture *)screen->resource_create(screen, &templ);
/* Inherit the modifier from the old texture. */
if (tex->surface.modifier != DRM_FORMAT_MOD_INVALID && screen->resource_create_with_modifiers)
new_tex = (struct si_texture *)screen->resource_create_with_modifiers(screen, &templ,
&tex->surface.modifier, 1);
else
new_tex = (struct si_texture *)screen->resource_create(screen, &templ);
if (!new_tex)
return;