[Mesa-dev] [PATCH mesa 1/6] egl_dri2: move glFlush out of struct dri2_egl_driver
Eric Engestrom
eric at engestrom.ch
Tue Sep 26 22:47:16 UTC 2017
There's no reason to store this there, it doesn't depend on the driver.
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
src/egl/drivers/dri2/egl_dri2.c | 44 ++++++++++++++++++-----------------------
src/egl/drivers/dri2/egl_dri2.h | 2 --
2 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f27e72505b..1f68bcdcbb 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -101,6 +101,23 @@ dri_set_background_context(void *loaderPrivate)
_eglBindContextToThread(ctx, t);
}
+static void
+dri2_gl_flush()
+{
+ static void (*glFlush)(void);
+
+ if (!glFlush)
+ glFlush = _glapi_get_proc_address("glFlush");
+
+ /* if glFlush is not available things are horribly broken */
+ if (!glFlush) {
+ _eglLog(_EGL_WARNING, "DRI2: failed to find glFlush entry point");
+ return;
+ }
+
+ glFlush();
+}
+
static GLboolean
dri_is_thread_safe(void *loaderPrivate)
{
@@ -1466,7 +1483,6 @@ static EGLBoolean
dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
_EGLSurface *rsurf, _EGLContext *ctx)
{
- struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
_EGLContext *old_ctx;
@@ -1487,7 +1503,7 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
/* flush before context switch */
if (old_ctx)
- dri2_drv->glFlush();
+ dri2_gl_flush();
ddraw = (dsurf) ? dri2_dpy->vtbl->get_dri_drawable(dsurf) : NULL;
rdraw = (rsurf) ? dri2_dpy->vtbl->get_dri_drawable(rsurf) : NULL;
@@ -3001,7 +3017,6 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLint flags, EGLTime timeout)
{
_EGLContext *ctx = _eglGetCurrentContext();
- struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
struct dri2_egl_sync *dri2_sync = dri2_egl_sync(sync);
@@ -3040,7 +3055,7 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
if (dri2_ctx && dri2_sync->base.SyncStatus == EGL_UNSIGNALED_KHR &&
(flags & EGL_SYNC_FLUSH_COMMANDS_BIT_KHR)) {
/* flush context if EGL_SYNC_FLUSH_COMMANDS_BIT_KHR is set */
- dri2_drv->glFlush();
+ dri2_gl_flush();
}
/* if timeout is EGL_FOREVER_KHR, it should wait without any timeout.*/
@@ -3161,23 +3176,6 @@ dri2_unload(_EGLDriver *drv)
free(dri2_drv);
}
-static EGLBoolean
-dri2_load(_EGLDriver *drv)
-{
- struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
-
- dri2_drv->glFlush = (void (*)(void))
- _glapi_get_proc_address("glFlush");
-
- /* if glFlush is not available things are horribly broken */
- if (!dri2_drv->glFlush) {
- _eglLog(_EGL_WARNING, "DRI2: failed to find glFlush entry point");
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
/**
* This is the main entrypoint into the driver, called by libEGL.
* Create a new _EGLDriver object and init its dispatch table.
@@ -3193,10 +3191,6 @@ _eglBuiltInDriverDRI2(const char *args)
if (!dri2_drv)
return NULL;
- if (!dri2_load(&dri2_drv->base)) {
- free(dri2_drv);
- return NULL;
- }
_eglInitDriverFallbacks(&dri2_drv->base);
dri2_drv->base.API.Initialize = dri2_initialize;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index c70a84bb91..eea459113a 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -82,8 +82,6 @@ struct wl_buffer;
struct dri2_egl_driver
{
_EGLDriver base;
-
- void (*glFlush)(void);
};
struct dri2_egl_display_vtbl {
--
Cheers,
Eric
More information about the mesa-dev
mailing list