Mesa (staging/21.1): iris: refcount separate screen objects for resource tracking

2021-05-16 Thread GitLab Mirror
Module: Mesa
Branch: staging/21.1
Commit: d25ff22af39e666307538a459e50b6643af0a6a4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d25ff22af39e666307538a459e50b6643af0a6a4

Author: Mike Blumenkrantz 
Date:   Tue May  4 15:08:07 2021 -0400

iris: refcount separate screen objects for resource tracking

this screen object can never, ever be accessed like this in a resource,
as it may have previously been replaced by a wrapper (e.g., driver trace)
which will then explode when it is accessed directly

instead, keep a separate screen ref on the resource which is known to be
the actual driver object and not a wrapper

Fixes: 0a497eb1303 ("iris: make resources take a ref on the screen object")

Reviewed-by: Lionel Landwerlin lionel.g.landwer...@intel.com
Part-of: 
(cherry picked from commit eb63c7decedb6188122f01d9851c44aa8d1d0e33)

---

 .pick_status.json| 2 +-
 src/gallium/drivers/iris/iris_resource.c | 5 +++--
 src/gallium/drivers/iris/iris_resource.h | 5 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4c46b8e18b5..16c6c86cfa7 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
 "description": "iris: refcount separate screen objects for resource 
tracking",
 "nominated": true,
 "nomination_type": 1,
-"resolution": 0,
+"resolution": 1,
 "master_sha": null,
 "because_sha": "0a497eb1303d23f04ad7d9c28abf953a9105e32a"
 },
diff --git a/src/gallium/drivers/iris/iris_resource.c 
b/src/gallium/drivers/iris/iris_resource.c
index d309f90a78b..817b5e86e0c 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -415,7 +415,7 @@ iris_resource_destroy(struct pipe_screen *screen,
 
threaded_resource_deinit(p_res);
iris_bo_unreference(res->bo);
-   iris_pscreen_unref(res->base.b.screen);
+   iris_pscreen_unref(res->orig_screen);
 
free(res);
 }
@@ -429,7 +429,8 @@ iris_alloc_resource(struct pipe_screen *pscreen,
   return NULL;
 
res->base.b = *templ;
-   res->base.b.screen = iris_pscreen_ref(pscreen);
+   res->base.b.screen = pscreen;
+   res->orig_screen = iris_pscreen_ref(pscreen);
pipe_reference_init(>base.b.reference, 1);
threaded_resource_init(>base.b);
 
diff --git a/src/gallium/drivers/iris/iris_resource.h 
b/src/gallium/drivers/iris/iris_resource.h
index 4403afdbd63..01d9050ba21 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -168,6 +168,11 @@ struct iris_resource {
 * be DRM_FORMAT_MOD_INVALID.
 */
const struct isl_drm_modifier_info *mod_info;
+
+   /**
+* The screen the resource was originally created with, stored for 
refcounting.
+*/
+   struct pipe_screen *orig_screen;
 };
 
 /**

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (staging/21.1): iris: refcount separate screen objects for resource tracking

2021-05-12 Thread GitLab Mirror
Module: Mesa
Branch: staging/21.1
Commit: 99800a861975929860ba87b3e791bfbbadcb7909
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99800a861975929860ba87b3e791bfbbadcb7909

Author: Mike Blumenkrantz 
Date:   Tue May  4 15:08:07 2021 -0400

iris: refcount separate screen objects for resource tracking

this screen object can never, ever be accessed like this in a resource,
as it may have previously been replaced by a wrapper (e.g., driver trace)
which will then explode when it is accessed directly

instead, keep a separate screen ref on the resource which is known to be
the actual driver object and not a wrapper

Fixes: 0a497eb1303 ("iris: make resources take a ref on the screen object")

Reviewed-by: Lionel Landwerlin lionel.g.landwer...@intel.com
Part-of: 
(cherry picked from commit eb63c7decedb6188122f01d9851c44aa8d1d0e33)

---

 .pick_status.json| 2 +-
 src/gallium/drivers/iris/iris_resource.c | 5 +++--
 src/gallium/drivers/iris/iris_resource.h | 5 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 940a3ebd602..aeb10c9f992 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
 "description": "iris: refcount separate screen objects for resource 
tracking",
 "nominated": true,
 "nomination_type": 1,
-"resolution": 0,
+"resolution": 1,
 "master_sha": null,
 "because_sha": "0a497eb1303d23f04ad7d9c28abf953a9105e32a"
 },
diff --git a/src/gallium/drivers/iris/iris_resource.c 
b/src/gallium/drivers/iris/iris_resource.c
index d309f90a78b..817b5e86e0c 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -415,7 +415,7 @@ iris_resource_destroy(struct pipe_screen *screen,
 
threaded_resource_deinit(p_res);
iris_bo_unreference(res->bo);
-   iris_pscreen_unref(res->base.b.screen);
+   iris_pscreen_unref(res->orig_screen);
 
free(res);
 }
@@ -429,7 +429,8 @@ iris_alloc_resource(struct pipe_screen *pscreen,
   return NULL;
 
res->base.b = *templ;
-   res->base.b.screen = iris_pscreen_ref(pscreen);
+   res->base.b.screen = pscreen;
+   res->orig_screen = iris_pscreen_ref(pscreen);
pipe_reference_init(>base.b.reference, 1);
threaded_resource_init(>base.b);
 
diff --git a/src/gallium/drivers/iris/iris_resource.h 
b/src/gallium/drivers/iris/iris_resource.h
index 4403afdbd63..01d9050ba21 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -168,6 +168,11 @@ struct iris_resource {
 * be DRM_FORMAT_MOD_INVALID.
 */
const struct isl_drm_modifier_info *mod_info;
+
+   /**
+* The screen the resource was originally created with, stored for 
refcounting.
+*/
+   struct pipe_screen *orig_screen;
 };
 
 /**

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (staging/21.1): iris: refcount separate screen objects for resource tracking

2021-05-11 Thread GitLab Mirror
Module: Mesa
Branch: staging/21.1
Commit: c43cf16d9c115ef35d8cc572064c93eea123636f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c43cf16d9c115ef35d8cc572064c93eea123636f

Author: Mike Blumenkrantz 
Date:   Tue May  4 15:08:07 2021 -0400

iris: refcount separate screen objects for resource tracking

this screen object can never, ever be accessed like this in a resource,
as it may have previously been replaced by a wrapper (e.g., driver trace)
which will then explode when it is accessed directly

instead, keep a separate screen ref on the resource which is known to be
the actual driver object and not a wrapper

Fixes: 0a497eb1303 ("iris: make resources take a ref on the screen object")

Reviewed-by: Lionel Landwerlin lionel.g.landwer...@intel.com
Part-of: 
(cherry picked from commit eb63c7decedb6188122f01d9851c44aa8d1d0e33)

---

 .pick_status.json| 2 +-
 src/gallium/drivers/iris/iris_resource.c | 5 +++--
 src/gallium/drivers/iris/iris_resource.h | 5 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 03b06955754..f8d511c289c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
 "description": "iris: refcount separate screen objects for resource 
tracking",
 "nominated": true,
 "nomination_type": 1,
-"resolution": 0,
+"resolution": 1,
 "master_sha": null,
 "because_sha": "0a497eb1303d23f04ad7d9c28abf953a9105e32a"
 },
diff --git a/src/gallium/drivers/iris/iris_resource.c 
b/src/gallium/drivers/iris/iris_resource.c
index d309f90a78b..817b5e86e0c 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -415,7 +415,7 @@ iris_resource_destroy(struct pipe_screen *screen,
 
threaded_resource_deinit(p_res);
iris_bo_unreference(res->bo);
-   iris_pscreen_unref(res->base.b.screen);
+   iris_pscreen_unref(res->orig_screen);
 
free(res);
 }
@@ -429,7 +429,8 @@ iris_alloc_resource(struct pipe_screen *pscreen,
   return NULL;
 
res->base.b = *templ;
-   res->base.b.screen = iris_pscreen_ref(pscreen);
+   res->base.b.screen = pscreen;
+   res->orig_screen = iris_pscreen_ref(pscreen);
pipe_reference_init(>base.b.reference, 1);
threaded_resource_init(>base.b);
 
diff --git a/src/gallium/drivers/iris/iris_resource.h 
b/src/gallium/drivers/iris/iris_resource.h
index 4403afdbd63..01d9050ba21 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -168,6 +168,11 @@ struct iris_resource {
 * be DRM_FORMAT_MOD_INVALID.
 */
const struct isl_drm_modifier_info *mod_info;
+
+   /**
+* The screen the resource was originally created with, stored for 
refcounting.
+*/
+   struct pipe_screen *orig_screen;
 };
 
 /**

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit