Mesa (master): egl: Drop dpy argument from the link functions.

Chia-I Wu olv at kemper.freedesktop.org
Sat Oct 23 03:32:58 UTC 2010


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

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sat Oct 23 00:37:19 2010 +0800

egl: Drop dpy argument from the link functions.

All display resources are already initialized with a display.  Linking
simply links a resource to its display.

---

 src/egl/main/eglapi.c     |   18 +++++++++---------
 src/egl/main/eglcontext.h |    6 +++---
 src/egl/main/egldisplay.c |   11 +++++------
 src/egl/main/egldisplay.h |    2 +-
 src/egl/main/eglimage.h   |    6 +++---
 src/egl/main/eglsurface.h |    6 +++---
 src/egl/main/eglsync.h    |    6 +++---
 7 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e8f856f..913ddd2 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -416,7 +416,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
       RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
 
    context = drv->API.CreateContext(drv, disp, conf, share, attrib_list);
-   ret = (context) ? _eglLinkContext(context, disp) : EGL_NO_CONTEXT;
+   ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -515,7 +515,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
 
    surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
-   ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
+   ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -536,7 +536,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
 
    surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
-   ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
+   ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -555,7 +555,7 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 
    surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
-   ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
+   ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -1043,7 +1043,7 @@ eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 
    surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
-   ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
+   ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -1235,7 +1235,7 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
 
    surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer,
                                                  conf, attrib_list);
-   ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
+   ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -1298,7 +1298,7 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
 
    img = drv->API.CreateImageKHR(drv,
          disp, context, target, buffer, attr_list);
-   ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
+   ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -1344,7 +1344,7 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
       RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
 
    sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list);
-   ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR;
+   ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR;
 
    RETURN_EGL_EVAL(disp, ret);
 }
@@ -1463,7 +1463,7 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
       RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
 
    img = drv->API.CreateDRMImageMESA(drv, disp, attr_list);
-   ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
+   ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
 
    RETURN_EGL_EVAL(disp, ret);
 }
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 148f160..c2b8280 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -56,13 +56,13 @@ _eglIsContextBound(_EGLContext *ctx)
 
 
 /**
- * Link a context to a display and return the handle of the link.
+ * Link a context to its display and return the handle of the link.
  * The handle can be passed to client directly.
  */
 static INLINE EGLContext
-_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
+_eglLinkContext(_EGLContext *ctx)
 {
-   _eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT, dpy);
+   _eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT);
    return (EGLContext) ctx;
 }
 
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index cc0f03e..47dcc3e 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -233,17 +233,16 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
 
 
 /**
- * Link a resource to a display.
+ * Link a resource to its display.
  */
 void
-_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
+_eglLinkResource(_EGLResource *res, _EGLResourceType type)
 {
-   assert(!res->Display || res->Display == dpy);
+   assert(res->Display);
 
-   res->Display = dpy;
    res->IsLinked = EGL_TRUE;
-   res->Next = dpy->ResourceLists[type];
-   dpy->ResourceLists[type] = res;
+   res->Next = res->Display->ResourceLists[type];
+   res->Display->ResourceLists[type] = res;
 }
 
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 3863cce..f99721e 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -162,7 +162,7 @@ _eglGetDisplayHandle(_EGLDisplay *dpy)
 
 
 extern void
-_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
+_eglLinkResource(_EGLResource *res, _EGLResourceType type);
 
 
 extern void
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 7cd92c1..161230f 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -43,13 +43,13 @@ _eglInitImage(_EGLImage *img, _EGLDisplay *dpy);
 
 
 /**
- * Link an image to a display and return the handle of the link.
+ * Link an image to its display and return the handle of the link.
  * The handle can be passed to client directly.
  */
 static INLINE EGLImageKHR
-_eglLinkImage(_EGLImage *img, _EGLDisplay *dpy)
+_eglLinkImage(_EGLImage *img)
 {
-   _eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE, dpy);
+   _eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE);
    return (EGLImageKHR) img;
 }
 
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index 729499e..2812dc3 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -81,13 +81,13 @@ _eglIsSurfaceBound(_EGLSurface *surf)
 
 
 /**
- * Link a surface to a display and return the handle of the link.
+ * Link a surface to its display and return the handle of the link.
  * The handle can be passed to client directly.
  */
 static INLINE EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
+_eglLinkSurface(_EGLSurface *surf)
 {
-   _eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE, dpy);
+   _eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE);
    return (EGLSurface) surf;
 }
 
diff --git a/src/egl/main/eglsync.h b/src/egl/main/eglsync.h
index 052d016..09d799b 100644
--- a/src/egl/main/eglsync.h
+++ b/src/egl/main/eglsync.h
@@ -34,13 +34,13 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
 
 
 /**
- * Link a sync to a display and return the handle of the link.
+ * Link a sync to its display and return the handle of the link.
  * The handle can be passed to client directly.
  */
 static INLINE EGLSyncKHR
-_eglLinkSync(_EGLSync *sync, _EGLDisplay *dpy)
+_eglLinkSync(_EGLSync *sync)
 {
-   _eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC, dpy);
+   _eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC);
    return (EGLSyncKHR) sync;
 }
 




More information about the mesa-commit mailing list