Selaa lähdekoodia

egl: Rework the synchronization primitives.

This adds error checking to the synchronization primitives.  And
eglWaitGL is now implemented by eglWaitClient.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
tags/mesa_7_7_rc1
Chia-I Wu 16 vuotta sitten
vanhempi
commit
6c21c8862b
5 muutettua tiedostoa jossa 48 lisäystä ja 31 poistoa
  1. 42
    24
      src/egl/main/eglapi.c
  2. 2
    4
      src/egl/main/eglapi.h
  3. 1
    1
      src/egl/main/egldriver.c
  4. 2
    1
      src/egl/main/eglmisc.c
  5. 1
    1
      src/egl/main/eglmisc.h

+ 42
- 24
src/egl/main/eglapi.c Näytä tiedosto

@@ -558,32 +558,66 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)


EGLBoolean EGLAPIENTRY
eglWaitGL(void)
eglWaitClient(void)
{
_EGLDisplay *disp = _eglGetCurrentDisplay();
_EGLContext *ctx = _eglGetCurrentContext();
_EGLDisplay *disp;
_EGLDriver *drv;

if (!disp)
if (!ctx)
return EGL_TRUE;
/* let bad current context imply bad current surface */
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);

/* a current display is always initialized */
/* a valid current context implies an initialized current display */
disp = ctx->Display;
drv = disp->Driver;
assert(drv);

return drv->API.WaitClient(drv, disp, ctx);
}


return drv->API.WaitGL(drv, disp);
EGLBoolean EGLAPIENTRY
eglWaitGL(void)
{
#ifdef EGL_VERSION_1_2
_EGLThreadInfo *t = _eglGetCurrentThread();
EGLint api_index = t->CurrentAPIIndex;
EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API);
EGLBoolean ret;

if (api_index != es_index && _eglIsCurrentThreadDummy())
return _eglError(EGL_BAD_ALLOC, "eglWaitGL");

t->CurrentAPIIndex = es_index;
ret = eglWaitClient();
t->CurrentAPIIndex = api_index;
return ret;
#else
return eglWaitClient();
#endif
}


EGLBoolean EGLAPIENTRY
eglWaitNative(EGLint engine)
{
_EGLDisplay *disp = _eglGetCurrentDisplay();
_EGLContext *ctx = _eglGetCurrentContext();
_EGLDisplay *disp;
_EGLDriver *drv;

if (!disp)
if (!ctx)
return EGL_TRUE;
/* let bad current context imply bad current surface */
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);

/* a current display is always initialized */
/* a valid current context implies an initialized current display */
disp = ctx->Display;
drv = disp->Driver;
assert(drv);

return drv->API.WaitNative(drv, disp, engine);
}
@@ -958,20 +992,4 @@ eglReleaseThread(void)
}


EGLBoolean
eglWaitClient(void)
{
_EGLDisplay *disp = _eglGetCurrentDisplay();
_EGLDriver *drv;

if (!disp)
return EGL_TRUE;

/* a current display is always initialized */
drv = disp->Driver;

return drv->API.WaitClient(drv, disp);
}


#endif /* EGL_VERSION_1_2 */

+ 2
- 4
src/egl/main/eglapi.h Näytä tiedosto

@@ -41,7 +41,7 @@ typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurfa

/* misc funcs */
typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, _EGLDisplay *dpy);
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine);

typedef _EGLProc (*GetProcAddress_t)(const char *procname);
@@ -65,7 +65,6 @@ typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy,


#ifdef EGL_VERSION_1_2
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy);
typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */

@@ -101,7 +100,7 @@ struct _egl_api
CopyBuffers_t CopyBuffers;

QueryString_t QueryString;
WaitGL_t WaitGL;
WaitClient_t WaitClient;
WaitNative_t WaitNative;
GetProcAddress_t GetProcAddress;

@@ -120,7 +119,6 @@ struct _egl_api
QueryModeStringMESA_t QueryModeStringMESA;

#ifdef EGL_VERSION_1_2
WaitClient_t WaitClient;
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
#endif
};

+ 1
- 1
src/egl/main/egldriver.c Näytä tiedosto

@@ -408,7 +408,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.CopyBuffers = _eglCopyBuffers;

drv->API.QueryString = _eglQueryString;
drv->API.WaitGL = _eglWaitGL;
drv->API.WaitClient = _eglWaitClient;
drv->API.WaitNative = _eglWaitNative;

#ifdef EGL_MESA_screen_surface

+ 2
- 1
src/egl/main/eglmisc.c Näytä tiedosto

@@ -108,11 +108,12 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name)


EGLBoolean
_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy)
_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
/* just a placeholder */
(void) drv;
(void) dpy;
(void) ctx;
return EGL_TRUE;
}


+ 1
- 1
src/egl/main/eglmisc.h Näytä tiedosto

@@ -37,7 +37,7 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);


extern EGLBoolean
_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy);
_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);


extern EGLBoolean

Loading…
Peruuta
Tallenna