Mesa (staging/21.2): gallium: Reset {d,r}Priv in dri_unbind_context

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 23:00:07 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 1b886f20a7c48a5cd2aec4f14ad6e71557ab8613
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b886f20a7c48a5cd2aec4f14ad6e71557ab8613

Author: Lepton Wu <lepton at chromium.org>
Date:   Fri Jul 23 21:27:00 2021 -0700

gallium: Reset {d,r}Priv in dri_unbind_context

The code in dri_make_current just checks the value of the pointers
to decide to update texture_stamp or not. This is buggy since a new
allocated drawable could share the same address with the previous
released drawable. Fix the stale pointer issue by always resetting
these pointers to NULL in dri_unbind_context.

v2:
   Move the reset codes to the end of the function.

Signed-off-by: Lepton Wu <lepton at chromium.org>
Cc: mesa-stable
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12050>
(cherry picked from commit 7ff30a0499bd872d77b0f377414bbc03463b9f87)

---

 .pick_status.json                       | 2 +-
 src/gallium/frontends/dri/dri_context.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 2033567cbab..f039e7dfbbf 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -814,7 +814,7 @@
         "description": "gallium: Reset {d,r}Priv in dri_unbind_context",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c
index 39eae5f7587..55bfa224bcf 100644
--- a/src/gallium/frontends/dri/dri_context.c
+++ b/src/gallium/frontends/dri/dri_context.c
@@ -271,6 +271,8 @@ dri_unbind_context(__DRIcontext * cPriv)
          stapi->make_current(stapi, NULL, NULL, NULL);
       }
    }
+   ctx->dPriv = NULL;
+   ctx->rPriv = NULL;
 
    return GL_TRUE;
 }



More information about the mesa-commit mailing list