Title: [269100] trunk/Tools
Revision
269100
Author
[email protected]
Date
2020-10-28 06:13:28 -0700 (Wed, 28 Oct 2020)

Log Message

[Flatpak SDK] Update Mesa and GTK4 dependencies
https://bugs.webkit.org/show_bug.cgi?id=218281

Patch by Philippe Normand <[email protected]> on 2020-10-28
Reviewed by Carlos Alberto Lopez Perez.

* buildstream/elements/flatpak/sdk.bst: Switch to app-debug-link as in the upstream FDO SDK.
* buildstream/elements/freedesktop-sdk.bst: Bump junction ref.
* buildstream/elements/sdk/mesa.bst: Update to 20.1.10 and add patch not present in stable release yet.
* buildstream/patches/fdo-0001-pango-Bump-to-1.47.patch: Added.
* buildstream/patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch: Removed.
* buildstream/patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch: Removed.
* buildstream/patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch: Removed.
* buildstream/patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (269099 => 269100)


--- trunk/Tools/ChangeLog	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/ChangeLog	2020-10-28 13:13:28 UTC (rev 269100)
@@ -1,3 +1,19 @@
+2020-10-28  Philippe Normand  <[email protected]>
+
+        [Flatpak SDK] Update Mesa and GTK4 dependencies
+        https://bugs.webkit.org/show_bug.cgi?id=218281
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * buildstream/elements/flatpak/sdk.bst: Switch to app-debug-link as in the upstream FDO SDK.
+        * buildstream/elements/freedesktop-sdk.bst: Bump junction ref.
+        * buildstream/elements/sdk/mesa.bst: Update to 20.1.10 and add patch not present in stable release yet.
+        * buildstream/patches/fdo-0001-pango-Bump-to-1.47.patch: Added.
+        * buildstream/patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch: Removed.
+        * buildstream/patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch: Removed.
+        * buildstream/patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch: Removed.
+        * buildstream/patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch: Added.
+
 2020-10-28  Adrian Perez de Castro  <[email protected]>
 
         [GTK4] Build broken with GTK 3.99.3

Modified: trunk/Tools/buildstream/elements/flatpak/sdk.bst (269099 => 269100)


--- trunk/Tools/buildstream/elements/flatpak/sdk.bst	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/elements/flatpak/sdk.bst	2020-10-28 13:13:28 UTC (rev 269100)
@@ -2,7 +2,7 @@
 
 build-depends:
 - flatpak/sdk-image.bst
-- freedesktop-sdk.bst:integration/linker-debuginfo.bst
+- freedesktop-sdk.bst:integration/app-debug-link.bst
 - freedesktop-sdk.bst:integration/sdk-integration.bst
 
 variables:

Modified: trunk/Tools/buildstream/elements/freedesktop-sdk.bst (269099 => 269100)


--- trunk/Tools/buildstream/elements/freedesktop-sdk.bst	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/elements/freedesktop-sdk.bst	2020-10-28 13:13:28 UTC (rev 269100)
@@ -5,9 +5,11 @@
   url: gitlab_com:freedesktop-sdk/freedesktop-sdk.git
   # Changed to track git commit from upstream bst
   track: 'release/20.08'
-  ref: freedesktop-sdk-20.08.0-141-geca1f403e1cffb50c545e187ccea160001cc3445
+  ref: freedesktop-sdk-20.08.0-188-gd64042a0ddd5aeb0433a1c24a49da099c979a713
 - kind: patch
   path: patches/nettle-no-debug.diff
+- kind: patch
+  path: patches/fdo-0001-pango-Bump-to-1.47.patch
 config:
   options:
     target_arch: '%{arch}'

Modified: trunk/Tools/buildstream/elements/sdk/mesa.bst (269099 => 269100)


--- trunk/Tools/buildstream/elements/sdk/mesa.bst	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/elements/sdk/mesa.bst	2020-10-28 13:13:28 UTC (rev 269100)
@@ -106,12 +106,8 @@
 - kind: git_tag
   url: gitlab_freedesktop_org:mesa/mesa.git
   track: '20.1'
-  ref: mesa-20.1.5-0-g3ba7f954b8a4ca6a8754fec06b8c0d179f2db64a
+  ref: mesa-20.1.10-1-gbdf94921c02b82e0d5f67d7c1ee0aacbce336056
 - kind: patch
   path: patches/mesa/mesa_libdrm_deps.patch
 - kind: patch
-  path: patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch
-- kind: patch
-  path: patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch
-- kind: patch
-  path: patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch
+  path: patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch

Added: trunk/Tools/buildstream/patches/fdo-0001-pango-Bump-to-1.47.patch (0 => 269100)


--- trunk/Tools/buildstream/patches/fdo-0001-pango-Bump-to-1.47.patch	                        (rev 0)
+++ trunk/Tools/buildstream/patches/fdo-0001-pango-Bump-to-1.47.patch	2020-10-28 13:13:28 UTC (rev 269100)
@@ -0,0 +1,33 @@
+From 57bce46dec0b379809a2e40d2c516d9372fe5df7 Mon Sep 17 00:00:00 2001
+From: Philippe Normand <[email protected]>
+Date: Wed, 28 Oct 2020 10:04:50 +0000
+Subject: [PATCH] pango: Bump to 1.47
+
+Required for GTK 3.99.3.
+---
+ elements/components/pango.bst | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/elements/components/pango.bst b/elements/components/pango.bst
+index 101c694c..c0744264 100644
+--- a/elements/components/pango.bst
++++ b/elements/components/pango.bst
+@@ -11,6 +11,7 @@ depends:
+   type: build
+ - filename: components/fribidi.bst
+ - filename: components/libthai.bst
++- filename: components/xorg-lib-xft.bst
+ 
+ public:
+   bst:
+@@ -33,5 +34,5 @@ sources:
+   url: gnome:pango.git
+   track: master
+   match:
+-  - '1.45.*'
+-  ref: 1.45.5-0-gc8be5aecc2d3de5dd633ed491c4ccf5e8c96297c
++  - '1.47.*'
++  ref: 1.47.0-0-g43808377088ea3eecc1607b910dee1477508587b
+-- 
+2.28.0
+

Deleted: trunk/Tools/buildstream/patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch (269099 => 269100)


--- trunk/Tools/buildstream/patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/patches/mesa/0001-mesa-rename-_mesa_free_errors_data.patch	2020-10-28 13:13:28 UTC (rev 269100)
@@ -1,61 +0,0 @@
-From e6f7b4312f5f924c8da74d8989ef4ebec7466240 Mon Sep 17 00:00:00 2001
-From: Pierre-Eric Pelloux-Prayer <[email protected]>
-Date: Tue, 7 Jul 2020 11:00:58 +0200
-Subject: [PATCH 1/3] mesa: rename _mesa_free_errors_data
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Use the _mesa_init_XXX / _mesa_destroy_XXX pattern to clearly associate
-the 2 functions.
-
-Reviewed-by: Marek Olšák <[email protected]>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5789>
----
- src/mesa/main/context.c      | 2 +-
- src/mesa/main/debug_output.c | 2 +-
- src/mesa/main/debug_output.h | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
-index be2e7df5824..d1949ada746 100644
---- a/src/mesa/main/context.c
-+++ b/src/mesa/main/context.c
-@@ -1386,7 +1386,7 @@ _mesa_free_context_data(struct gl_context *ctx)
-    /* needs to be after freeing shared state */
-    _mesa_free_display_list_data(ctx);
- 
--   _mesa_free_errors_data(ctx);
-+   _mesa_destroy_debug_output(ctx);
- 
-    free((void *)ctx->Extensions.String);
- 
-diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c
-index 3f1ca8bf340..6d4c8e72ee3 100644
---- a/src/mesa/main/debug_output.c
-+++ b/src/mesa/main/debug_output.c
-@@ -1281,7 +1281,7 @@ _mesa_init_debug_output(struct gl_context *ctx)
- 
- 
- void
--_mesa_free_errors_data(struct gl_context *ctx)
-+_mesa_destroy_debug_output(struct gl_context *ctx)
- {
-    if (ctx->Debug) {
-       debug_destroy(ctx->Debug);
-diff --git a/src/mesa/main/debug_output.h b/src/mesa/main/debug_output.h
-index 8a5eedc21f0..e467b087b5e 100644
---- a/src/mesa/main/debug_output.h
-+++ b/src/mesa/main/debug_output.h
-@@ -43,7 +43,7 @@ void
- _mesa_init_debug_output(struct gl_context *ctx);
- 
- void
--_mesa_free_errors_data(struct gl_context *ctx);
-+_mesa_destroy_debug_output(struct gl_context *ctx);
- 
- void
- _mesa_debug_get_id(GLuint *id);
--- 
-2.26.2
-

Deleted: trunk/Tools/buildstream/patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch (269099 => 269100)


--- trunk/Tools/buildstream/patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/patches/mesa/0002-mesa-add-bool-param-to-_mesa_free_context_data.patch	2020-10-28 13:13:28 UTC (rev 269100)
@@ -1,200 +0,0 @@
-From 7f0b6a5df8e360e52a97f59948dda927fe9df15e Mon Sep 17 00:00:00 2001
-From: Pierre-Eric Pelloux-Prayer <[email protected]>
-Date: Tue, 7 Jul 2020 11:06:21 +0200
-Subject: [PATCH 2/3] mesa: add bool param to _mesa_free_context_data
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The param controls whether _mesa_destroy_debug_output should be called or not.
-No functional changes; this will be used by the next commit.
-
-Reviewed-by: Marek Olšák <[email protected]>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5789>
----
- src/mesa/drivers/dri/i915/intel_context.c           | 2 +-
- src/mesa/drivers/dri/i965/brw_context.c             | 2 +-
- src/mesa/drivers/dri/nouveau/nouveau_context.c      | 2 +-
- src/mesa/drivers/dri/radeon/radeon_common_context.c | 2 +-
- src/mesa/drivers/osmesa/osmesa.c                    | 8 ++++----
- src/mesa/drivers/x11/xm_api.c                       | 4 ++--
- src/mesa/main/context.c                             | 7 ++++---
- src/mesa/main/context.h                             | 2 +-
- src/mesa/state_tracker/st_context.c                 | 2 +-
- 9 files changed, 16 insertions(+), 15 deletions(-)
-
-diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
-index 73165418dc5..c9426db67b3 100644
---- a/src/mesa/drivers/dri/i915/intel_context.c
-+++ b/src/mesa/drivers/dri/i915/intel_context.c
-@@ -598,7 +598,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
-       driDestroyOptionCache(&intel->optionCache);
- 
-       /* free the Mesa context */
--      _mesa_free_context_data(&intel->ctx);
-+      _mesa_free_context_data(&intel->ctx, true);
- 
-       _math_matrix_dtr(&intel->ViewportMatrix);
- 
-diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
-index 6ca20f24b94..e8ec66b98f1 100644
---- a/src/mesa/drivers/dri/i965/brw_context.c
-+++ b/src/mesa/drivers/dri/i965/brw_context.c
-@@ -1242,7 +1242,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
-    driDestroyOptionCache(&brw->optionCache);
- 
-    /* free the Mesa context */
--   _mesa_free_context_data(&brw->ctx);
-+   _mesa_free_context_data(&brw->ctx, true);
- 
-    ralloc_free(brw);
-    driContextPriv->driverPrivate = NULL;
-diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
-index a63e0a19ddd..c97fc0f23a5 100644
---- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
-+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
-@@ -217,7 +217,7 @@ nouveau_context_deinit(struct gl_context *ctx)
- 	nouveau_object_del(&nctx->hw.chan);
- 
- 	nouveau_scratch_destroy(ctx);
--	_mesa_free_context_data(ctx);
-+	_mesa_free_context_data(ctx, true);
- }
- 
- void
-diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
-index 416d2d988fe..622b38ecc36 100644
---- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
-+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
-@@ -270,7 +270,7 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
- 
- 	/* free atom list */
- 	/* free the Mesa context data */
--	_mesa_free_context_data(&radeon->glCtx);
-+	_mesa_free_context_data(&radeon->glCtx, true);
- 
- 	/* free the option cache */
- 	driDestroyOptionCache(&radeon->optionCache);
-diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
-index dea5ae1fe94..a831b71f257 100644
---- a/src/mesa/drivers/osmesa/osmesa.c
-+++ b/src/mesa/drivers/osmesa/osmesa.c
-@@ -857,7 +857,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
-       osmesa->gl_buffer = _mesa_create_framebuffer(osmesa->gl_visual);
-       if (!osmesa->gl_buffer) {
-          _mesa_destroy_visual( osmesa->gl_visual );
--         _mesa_free_context_data(&osmesa->mesa);
-+         _mesa_free_context_data(&osmesa->mesa, true);
-          free(osmesa);
-          return NULL;
-       }
-@@ -894,7 +894,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
-              !_tnl_CreateContext( ctx ) ||
-              !_swsetup_CreateContext( ctx )) {
-             _mesa_destroy_visual(osmesa->gl_visual);
--            _mesa_free_context_data(ctx);
-+            _mesa_free_context_data(ctx, true);
-             free(osmesa);
-             return NULL;
-          }
-@@ -922,7 +922,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
- 
-          if (ctx->Version < version_major * 10 + version_minor) {
-             _mesa_destroy_visual(osmesa->gl_visual);
--            _mesa_free_context_data(ctx);
-+            _mesa_free_context_data(ctx, true);
-             free(osmesa);
-             return NULL;
-          }
-@@ -958,7 +958,7 @@ OSMesaDestroyContext( OSMesaContext osmesa )
-       _mesa_destroy_visual( osmesa->gl_visual );
-       _mesa_reference_framebuffer( &osmesa->gl_buffer, NULL );
- 
--      _mesa_free_context_data(&osmesa->mesa);
-+      _mesa_free_context_data(&osmesa->mesa, true);
-       free( osmesa );
-    }
- }
-diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
-index 0011a842fb0..a3990d2048b 100644
---- a/src/mesa/drivers/x11/xm_api.c
-+++ b/src/mesa/drivers/x11/xm_api.c
-@@ -943,7 +943,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
-        !_vbo_CreateContext( mesaCtx, false ) ||
-        !_tnl_CreateContext( mesaCtx ) ||
-        !_swsetup_CreateContext( mesaCtx )) {
--      _mesa_free_context_data(&c->mesa);
-+      _mesa_free_context_data(&c->mesa, true);
-       free(c);
-       return NULL;
-    }
-@@ -980,7 +980,7 @@ void XMesaDestroyContext( XMesaContext c )
-    _swrast_DestroyContext( mesaCtx );
-    _tnl_DestroyContext( mesaCtx );
-    _vbo_DestroyContext( mesaCtx );
--   _mesa_free_context_data(mesaCtx);
-+   _mesa_free_context_data(mesaCtx, true);
-    free( c );
- }
- 
-diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
-index d1949ada746..d72a9dfc94e 100644
---- a/src/mesa/main/context.c
-+++ b/src/mesa/main/context.c
-@@ -1317,7 +1317,7 @@ fail:
-  * \sa _mesa_initialize_context() and init_attrib_groups().
-  */
- void
--_mesa_free_context_data(struct gl_context *ctx)
-+_mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output)
- {
-    if (!_mesa_get_current_context()){
-       /* No current context, but we may need one in order to delete
-@@ -1386,7 +1386,8 @@ _mesa_free_context_data(struct gl_context *ctx)
-    /* needs to be after freeing shared state */
-    _mesa_free_display_list_data(ctx);
- 
--   _mesa_destroy_debug_output(ctx);
-+   if (destroy_debug_output)
-+      _mesa_destroy_debug_output(ctx);
- 
-    free((void *)ctx->Extensions.String);
- 
-@@ -1420,7 +1421,7 @@ void
- _mesa_destroy_context( struct gl_context *ctx )
- {
-    if (ctx) {
--      _mesa_free_context_data(ctx);
-+      _mesa_free_context_data(ctx, true);
-       free( (void *) ctx );
-    }
- }
-diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
-index d5b97ac4fc7..e00149aabef 100644
---- a/src/mesa/main/context.h
-+++ b/src/mesa/main/context.h
-@@ -118,7 +118,7 @@ _mesa_initialize_context( struct gl_context *ctx,
-                           const struct dd_function_table *driverFunctions);
- 
- extern void
--_mesa_free_context_data(struct gl_context *ctx);
-+_mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output);
- 
- extern void
- _mesa_destroy_context( struct gl_context *ctx );
-diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
-index 2fc4ffe6728..3b1fb862891 100644
---- a/src/mesa/state_tracker/st_context.c
-+++ b/src/mesa/state_tracker/st_context.c
-@@ -1103,7 +1103,7 @@ st_destroy_context(struct st_context *st)
- 
-    st_destroy_program_variants(st);
- 
--   _mesa_free_context_data(ctx);
-+   _mesa_free_context_data(ctx, true);
- 
-    /* This will free the st_context too, so 'st' must not be accessed
-     * afterwards. */
--- 
-2.26.2
-

Deleted: trunk/Tools/buildstream/patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch (269099 => 269100)


--- trunk/Tools/buildstream/patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch	2020-10-28 12:47:36 UTC (rev 269099)
+++ trunk/Tools/buildstream/patches/mesa/0003-mesa-st-release-debug_output-after-destroying-the-co.patch	2020-10-28 13:13:28 UTC (rev 269100)
@@ -1,53 +0,0 @@
-From 25baceafd3dfbc288fe05876c7c088549e46d9d4 Mon Sep 17 00:00:00 2001
-From: Pierre-Eric Pelloux-Prayer <[email protected]>
-Date: Tue, 7 Jul 2020 11:08:50 +0200
-Subject: [PATCH 3/3] mesa/st: release debug_output after destroying the
- context
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3230
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2218
-Reviewed-by: Marek Olšák <[email protected]>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5789>
----
- src/mesa/state_tracker/st_context.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
-index 3b1fb862891..490e959d6da 100644
---- a/src/mesa/state_tracker/st_context.c
-+++ b/src/mesa/state_tracker/st_context.c
-@@ -29,6 +29,7 @@
- #include "main/accum.h"
- #include "main/api_exec.h"
- #include "main/context.h"
-+#include "main/debug_output.h"
- #include "main/glthread.h"
- #include "main/samplerobj.h"
- #include "main/shaderobj.h"
-@@ -1103,13 +1104,19 @@ st_destroy_context(struct st_context *st)
- 
-    st_destroy_program_variants(st);
- 
--   _mesa_free_context_data(ctx, true);
-+   /* Do not release debug_output yet because it might be in use by other threads.
-+    * These threads will be terminated by _mesa_free_context_data and
-+    * st_destroy_context_priv.
-+    */
-+   _mesa_free_context_data(ctx, false);
- 
-    /* This will free the st_context too, so 'st' must not be accessed
-     * afterwards. */
-    st_destroy_context_priv(st, true);
-    st = NULL;
- 
-+   _mesa_destroy_debug_output(ctx);
-+
-    free(ctx);
- 
-    if (save_ctx == ctx) {
--- 
-2.26.2
-

Added: trunk/Tools/buildstream/patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch (0 => 269100)


--- trunk/Tools/buildstream/patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch	                        (rev 0)
+++ trunk/Tools/buildstream/patches/mesa/0004-mesa-clear-texture-s-views-when-texture-is-remove.patch	2020-10-28 13:13:28 UTC (rev 269100)
@@ -0,0 +1,109 @@
+From 045267d1e6238e45eb98f286332ee233dec53312 Mon Sep 17 00:00:00 2001
+From: Danylo Piliaiev <[email protected]>
+Date: Mon, 18 May 2020 20:44:58 +0300
+Subject: [PATCH] st/mesa: Clear texture's views when texture is removed from
+ Shared->TexObjects
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If texture is shared between several contexts, calling glDeleteTextures
+will remove it from ctx->Shared->TexObjects - which makes impossible for
+contexts, when destroyed, to release their views to this texture. Which
+leaves dangling pointers to destroyed contexts.
+
+Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2960
+Signed-off-by: Danylo Piliaiev <[email protected]>
+Reviewed-by: Tapani Pälli <[email protected]>
+Reviewed-by: Marek Olšák <[email protected]>
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5106>
+---
+ src/mesa/main/dd.h                       |  6 ++++++
+ src/mesa/main/texobj.c                   |  4 ++++
+ src/mesa/state_tracker/st_cb_texture.c   | 17 +++++++++++++++++
+ src/mesa/state_tracker/st_sampler_view.c |  2 +-
+ 4 files changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
+index 4a7d775db45..a4d1d5bdaa0 100644
+--- a/src/mesa/main/dd.h
++++ b/src/mesa/main/dd.h
+@@ -371,6 +371,12 @@ struct dd_function_table {
+    void (*DeleteTexture)(struct gl_context *ctx,
+                          struct gl_texture_object *texObj);
+ 
++   /**
++    * Called to notify that texture is removed from ctx->Shared->TexObjects
++    */
++   void (*TextureRemovedFromShared)(struct gl_context *ctx,
++                                   struct gl_texture_object *texObj);
++
+    /** Called to allocate a new texture image object. */
+    struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
+ 
+diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
+index 8bd9cee4615..3e058975db8 100644
+--- a/src/mesa/main/texobj.c
++++ b/src/mesa/main/texobj.c
+@@ -1514,6 +1514,10 @@ delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures)
+              */
+             _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
+ 
++            if (ctx->Driver.TextureRemovedFromShared) {
++               ctx->Driver.TextureRemovedFromShared(ctx, delObj);
++            }
++
+             /* Unreference the texobj.  If refcount hits zero, the texture
+              * will be deleted.
+              */
+diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
+index 1cb85b8b406..32e390c53d6 100644
+--- a/src/mesa/state_tracker/st_cb_texture.c
++++ b/src/mesa/state_tracker/st_cb_texture.c
+@@ -195,6 +195,22 @@ st_DeleteTextureObject(struct gl_context *ctx,
+    _mesa_delete_texture_object(ctx, texObj);
+ }
+ 
++/**
++ * Called via ctx->Driver.TextureRemovedFromShared()
++ * When texture is removed from ctx->Shared->TexObjects we lose
++ * the ability to clean up views on context destruction, which may
++ * lead to dangling pointers to destroyed contexts.
++ * Release the views to prevent this.
++ */
++static void
++st_TextureReleaseAllSamplerViews(struct gl_context *ctx,
++                                 struct gl_texture_object *texObj)
++{
++   struct st_context *st = st_context(ctx);
++   struct st_texture_object *stObj = st_texture_object(texObj);
++
++   st_texture_release_all_sampler_views(st, stObj);
++}
+ 
+ /** called via ctx->Driver.FreeTextureImageBuffer() */
+ static void
+@@ -3355,6 +3371,7 @@ st_init_texture_functions(struct dd_function_table *functions)
+    functions->NewTextureImage = st_NewTextureImage;
+    functions->DeleteTextureImage = st_DeleteTextureImage;
+    functions->DeleteTexture = st_DeleteTextureObject;
++   functions->TextureRemovedFromShared = st_TextureReleaseAllSamplerViews;
+    functions->AllocTextureImageBuffer = st_AllocTextureImageBuffer;
+    functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer;
+    functions->MapTextureImage = st_MapTextureImage;
+diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
+index 102908e1029..a31e573c01a 100644
+--- a/src/mesa/state_tracker/st_sampler_view.c
++++ b/src/mesa/state_tracker/st_sampler_view.c
+@@ -226,7 +226,7 @@ st_texture_release_all_sampler_views(struct st_context *st,
+    for (unsigned i = 0; i < views->count; ++i) {
+       struct st_sampler_view *stsv = &views->views[i];
+       if (stsv->view) {
+-         if (stsv->st != st) {
++         if (stsv->st && stsv->st != st) {
+             /* Transfer this reference to the zombie list.  It will
+              * likely be freed when the zombie list is freed.
+              */
+-- 
+2.20.1
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to