From b27fb3eacab906ec06cd61b7d01e3425c3b3cbfc Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Thu, 10 Jan 2019 16:45:53 +0000 Subject: [PATCH] egl: move fallback calls to eglapi.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eric Engestrom Reviewed-by: Tapani Pälli Reviewed-by: Emil Velikov --- src/egl/main/eglapi.c | 48 +++++++++++++++++++++++++++++-------- src/egl/main/eglfallbacks.c | 12 ---------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 93c1da9aac0..60f59bb165a 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -725,7 +725,10 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, if (!num_config) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); + if (drv->API.GetConfigs) + ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); + else + ret = _eglGetConfigs(drv, disp, configs, config_size, num_config); RETURN_EGL_EVAL(disp, ret); } @@ -746,8 +749,12 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, if (!num_config) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, - config_size, num_config); + if (drv->API.ChooseConfig) + ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, + config_size, num_config); + else + ret = _eglChooseConfig(drv, disp, attrib_list, configs, + config_size, num_config); RETURN_EGL_EVAL(disp, ret); } @@ -765,7 +772,11 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); - ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value); + + if (drv->API.GetConfigAttrib) + ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value); + else + ret = _eglGetConfigAttrib(drv, disp, conf, attribute, value); RETURN_EGL_EVAL(disp, ret); } @@ -889,7 +900,11 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx, _EGL_FUNC_START(disp, EGL_OBJECT_CONTEXT_KHR, context, EGL_FALSE); _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); - ret = drv->API.QueryContext(drv, disp, context, attribute, value); + + if (drv->API.QueryContext) + ret = drv->API.QueryContext(drv, disp, context, attribute, value); + else + ret = _eglQueryContext(drv, disp, context, attribute, value); RETURN_EGL_EVAL(disp, ret); } @@ -1193,7 +1208,11 @@ eglQuerySurface(EGLDisplay dpy, EGLSurface surface, _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - ret = drv->API.QuerySurface(drv, disp, surf, attribute, value); + + if (drv->API.QuerySurface) + ret = drv->API.QuerySurface(drv, disp, surf, attribute, value); + else + ret = _eglQuerySurface(drv, disp, surf, attribute, value); RETURN_EGL_EVAL(disp, ret); } @@ -1209,7 +1228,11 @@ eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value); + + if (drv->API.SurfaceAttrib) + ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value); + else + ret = _eglSurfaceAttrib(drv, disp, surf, attribute, value); RETURN_EGL_EVAL(disp, ret); } @@ -1273,10 +1296,15 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval) surf->Config->MinSwapInterval, surf->Config->MaxSwapInterval); - if (surf->SwapInterval != interval) - ret = drv->API.SwapInterval(drv, disp, surf, interval); - else + if (surf->SwapInterval != interval) { + if (drv->API.SwapInterval) + ret = drv->API.SwapInterval(drv, disp, surf, interval); + else + ret = _eglSwapInterval(drv, disp, surf, interval); + } + else { ret = EGL_TRUE; + } if (ret) surf->SwapInterval = interval; diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c index 08ffab3072c..7dca5f6bdf8 100644 --- a/src/egl/main/eglfallbacks.c +++ b/src/egl/main/eglfallbacks.c @@ -42,16 +42,4 @@ void _eglInitDriverFallbacks(_EGLDriver *drv) { - drv->API.GetConfigs = _eglGetConfigs; - drv->API.ChooseConfig = _eglChooseConfig; - drv->API.GetConfigAttrib = _eglGetConfigAttrib; - - drv->API.QueryContext = _eglQueryContext; - - drv->API.QuerySurface = _eglQuerySurface; - drv->API.SurfaceAttrib = _eglSurfaceAttrib; - - drv->API.SwapInterval = _eglSwapInterval; - - drv->API.GetSyncAttrib = _eglGetSyncAttrib; } -- 2.30.2