Update to 21.3.7

This commit is contained in:
Pete Walter 2022-02-23 22:28:31 +00:00
parent e154693ebd
commit b524c50be0
4 changed files with 2 additions and 159 deletions

View File

@ -1,96 +0,0 @@
From f308e4cd8c50c9bad725a6d4ccbc574b76912929 Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Wed, 6 Oct 2021 22:42:36 +0200
Subject: [PATCH 1/6] tegra: Use private reference count for sampler views
With the recent addition of the shortcuts aiming to avoid atomic
operations, the reference count on sampler views can become unbalanced
in the Tegra driver since they are wrapped and then proxied to the
Nouveau driver.
Fix this by keeping a private reference count.
Fixes: ef5d42741327 ("st/mesa: add a mechanism to bypass atomics when binding sampler views")
Tested-by: Karol Herbst <kherbst@redhat.com>
---
src/gallium/drivers/tegra/tegra_context.c | 30 ++++++++++++++++++-----
src/gallium/drivers/tegra/tegra_context.h | 1 +
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c
index b7dc73bb1be..fe88478a22a 100644
--- a/src/gallium/drivers/tegra/tegra_context.c
+++ b/src/gallium/drivers/tegra/tegra_context.c
@@ -566,10 +566,22 @@ tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader,
{
struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
struct tegra_context *context = to_tegra_context(pcontext);
+ struct tegra_sampler_view *view;
unsigned i;
- for (i = 0; i < num_views; i++)
+ for (i = 0; i < num_views; i++) {
+ /* adjust private reference count */
+ view = to_tegra_sampler_view(pviews[i]);
+ if (view) {
+ view->refcount--;
+ if (!view->refcount) {
+ view->refcount = 100000000;
+ p_atomic_add(&view->gpu->reference.count, view->refcount);
+ }
+ }
+
views[i] = tegra_sampler_view_unwrap(pviews[i]);
+ }
context->gpu->set_sampler_views(context->gpu, shader, start_slot,
num_views, unbind_num_trailing_slots,
@@ -835,15 +847,19 @@ tegra_create_sampler_view(struct pipe_context *pcontext,
if (!view)
return NULL;
- view->gpu = context->gpu->create_sampler_view(context->gpu, resource->gpu,
- template);
- memcpy(&view->base, view->gpu, sizeof(*view->gpu));
+ view->base = *template;
+ view->base.context = pcontext;
/* overwrite to prevent reference from being released */
view->base.texture = NULL;
-
pipe_reference_init(&view->base.reference, 1);
pipe_resource_reference(&view->base.texture, presource);
- view->base.context = pcontext;
+
+ view->gpu = context->gpu->create_sampler_view(context->gpu, resource->gpu,
+ template);
+
+ /* use private reference count */
+ view->gpu->reference.count += 100000000;
+ view->refcount = 100000000;
return &view->base;
}
@@ -855,6 +871,8 @@ tegra_sampler_view_destroy(struct pipe_context *pcontext,
struct tegra_sampler_view *view = to_tegra_sampler_view(pview);
pipe_resource_reference(&view->base.texture, NULL);
+ /* adjust private reference count */
+ p_atomic_add(&view->gpu->reference.count, -view->refcount);
pipe_sampler_view_reference(&view->gpu, NULL);
free(view);
}
diff --git a/src/gallium/drivers/tegra/tegra_context.h b/src/gallium/drivers/tegra/tegra_context.h
index 4869b0913a6..c2d8eb33ca5 100644
--- a/src/gallium/drivers/tegra/tegra_context.h
+++ b/src/gallium/drivers/tegra/tegra_context.h
@@ -47,6 +47,7 @@ tegra_screen_context_create(struct pipe_screen *pscreen, void *priv,
struct tegra_sampler_view {
struct pipe_sampler_view base;
struct pipe_sampler_view *gpu;
+ unsigned int refcount;
};
static inline struct tegra_sampler_view *
--
2.31.1

View File

@ -1,58 +0,0 @@
From 6e786d9e657dc3a0cb659dbf68a11fe75e554d8f Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Wed, 6 Oct 2021 22:47:17 +0200
Subject: [PATCH 2/6] tegra: Use private reference count for resources
With the recent addition of the shortcuts aiming to avoid atomic
operations, the reference count on resources can become unbalanced
in the Tegra driver since they are wrapped and then proxied to the
Nouveau driver.
Fix this by keeping a private reference count.
Fixes: 7688b8ae9802 ("st/mesa: eliminate all atomic ops when setting vertex buffers")
Tested-by: Karol Herbst <kherbst@redhat.com>
---
src/gallium/drivers/tegra/tegra_resource.h | 1 +
src/gallium/drivers/tegra/tegra_screen.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/src/gallium/drivers/tegra/tegra_resource.h b/src/gallium/drivers/tegra/tegra_resource.h
index 67507d64590..892afaf5e0f 100644
--- a/src/gallium/drivers/tegra/tegra_resource.h
+++ b/src/gallium/drivers/tegra/tegra_resource.h
@@ -31,6 +31,7 @@ struct winsys_handle;
struct tegra_resource {
struct pipe_resource base;
struct pipe_resource *gpu;
+ unsigned int refcount;
uint64_t modifier;
uint32_t stride;
diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c
index 2b108b07908..3c4c36e0c94 100644
--- a/src/gallium/drivers/tegra/tegra_screen.c
+++ b/src/gallium/drivers/tegra/tegra_screen.c
@@ -245,6 +245,10 @@ tegra_screen_resource_create(struct pipe_screen *pscreen,
pipe_reference_init(&resource->base.reference, 1);
resource->base.screen = &screen->base;
+ /* use private reference count for wrapped resources */
+ resource->gpu->reference.count += 100000000;
+ resource->refcount = 100000000;
+
return &resource->base;
destroy:
@@ -352,6 +356,8 @@ tegra_screen_resource_destroy(struct pipe_screen *pscreen,
{
struct tegra_resource *resource = to_tegra_resource(presource);
+ /* adjust private reference count */
+ p_atomic_add(&resource->gpu->reference.count, -resource->refcount);
pipe_resource_reference(&resource->gpu, NULL);
free(resource);
}
--
2.31.1

View File

@ -57,7 +57,7 @@
Name: mesa
Summary: Mesa graphics libraries
%global ver 21.3.6
%global ver 21.3.7
Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
Release: %autorelease
License: MIT
@ -73,9 +73,6 @@ Source1: Mesa-MLAA-License-Clarification-Email.txt
# https://bugzilla.redhat.com/show_bug.cgi?id=1989726#c46
# see also:
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/5399
# First two are https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13231
Patch0003: 0001-tegra-Use-private-reference-count-for-sampler-views.patch
Patch0004: 0002-tegra-Use-private-reference-count-for-resources.patch
# Last four revert https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724
Patch0005: 0003-Revert-nouveau-Use-format-modifiers-in-buffer-alloca.patch
Patch0006: 0004-Revert-nouveau-no-modifier-the-invalid-modifier.patch

View File

@ -1 +1 @@
SHA512 (mesa-21.3.6.tar.xz) = 8c930e04eade29f689384ee7d6e2f178acbbf30fa6c9fdf132281279658c3c221ec7f9b1318e3c0a654c6136f925a5c0a35eaf849b65db7674641127c71e8a4f
SHA512 (mesa-21.3.7.tar.xz) = 0991543e9435457fa4d077517408b3f197be32ed61a6c7ca34ddb3906eed208791f1a57227f74115f99df18e612efab1d2c6809b7cf426d273633b53d4aefc88