Mesa (master): gallium: do not increase ref count of the new throttle fence

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 17 10:41:20 UTC 2019


Module: Mesa
Branch: master
Commit: 023282a4f667695ea1dbbe9fbe1cd3a9d550a426
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=023282a4f667695ea1dbbe9fbe1cd3a9d550a426

Author: James Xiong <james.xiong at intel.com>
Date:   Wed Oct 16 09:22:22 2019 -0700

gallium: do not increase ref count of the new throttle fence

A new throttle fence was initialized to 1, and increased by 1
again when it's put in drawable->throttle_fence; the ref was
decreased by 1 when it's removed from drawable->throttle_fence,
and never reached to 0, caused leak.

Fixes: ff77bf5cbf7 ("gallium: simplify throttle implementation")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1949

Signed-off-by: James Xiong <james.xiong at intel.com>
Reported-by: Florian Wesch <fw at info-beamer.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>

---

 src/gallium/state_trackers/dri/dri_drawable.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 6335127952c..42c48b50a82 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -489,9 +489,11 @@ dri_flush(__DRIcontext *cPriv,
       st->flush(st, flush_flags, &new_fence);
 
       /* throttle on the previous fence */
-      if (drawable->throttle_fence)
+      if (drawable->throttle_fence) {
          screen->fence_finish(screen, NULL, drawable->throttle_fence, PIPE_TIMEOUT_INFINITE);
-      screen->fence_reference(screen, &drawable->throttle_fence, new_fence);
+         screen->fence_reference(screen, &drawable->throttle_fence, NULL);
+      }
+      drawable->throttle_fence = new_fence;
    }
    else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {
       st->flush(st, flush_flags, NULL);




More information about the mesa-commit mailing list