Module: Mesa
Branch: main
Commit: 0e782d96095aecfbc43233b9358e8bf915b26062
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e782d96095aecfbc43233b9358e8bf915b26062

Author: nyanmisaka <[email protected]>
Date:   Mon Oct 17 22:51:37 2022 +0800

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 <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19097>

---

 src/gallium/drivers/radeonsi/si_texture.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_texture.c 
b/src/gallium/drivers/radeonsi/si_texture.c
index a14c9f735bc..d5905189f97 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -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;
 

Reply via email to