Mesa (master): st/egl: Use resource reference count for egl_g3d_sync.

Chia-I Wu olv at kemper.freedesktop.org
Sat Oct 23 09:29:29 UTC 2010


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

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sat Oct 23 17:27:58 2010 +0800

st/egl: Use resource reference count for egl_g3d_sync.

---

 src/gallium/state_trackers/egl/common/egl_g3d.h    |    2 --
 .../state_trackers/egl/common/egl_g3d_sync.c       |    5 ++---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index be450bb..72c14f0 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -106,8 +106,6 @@ _EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
 struct egl_g3d_sync {
    _EGLSync base;
 
-   int refs;
-
    /* the mutex protects only the condvar, not the struct */
    pipe_mutex mutex;
    pipe_condvar condvar;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
index ec74e9e..4e6d944 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
@@ -128,13 +128,13 @@ egl_g3d_wait_fence_sync(struct egl_g3d_sync *gsync, EGLTimeKHR timeout)
 static INLINE void
 egl_g3d_ref_sync(struct egl_g3d_sync *gsync)
 {
-   p_atomic_inc(&gsync->refs);
+   _eglGetSync(&gsync->base);
 }
 
 static INLINE void
 egl_g3d_unref_sync(struct egl_g3d_sync *gsync)
 {
-   if (p_atomic_dec_zero(&gsync->refs)) {
+   if (_eglPutSync(&gsync->base)) {
       pipe_condvar_destroy(gsync->condvar);
       pipe_mutex_destroy(gsync->mutex);
 
@@ -194,7 +194,6 @@ egl_g3d_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
 
    pipe_mutex_init(gsync->mutex);
    pipe_condvar_init(gsync->condvar);
-   p_atomic_set(&gsync->refs, 1);
 
    return &gsync->base;
 }




More information about the mesa-commit mailing list