egl: move fallback calls to eglapi.c
authorEric Engestrom <eric.engestrom@intel.com>
Thu, 10 Jan 2019 16:45:53 +0000 (16:45 +0000)
committerEric Engestrom <eric@engestrom.ch>
Sat, 22 Jun 2019 15:17:42 +0000 (15:17 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/main/eglapi.c
src/egl/main/eglfallbacks.c

index 93c1da9aac0947205b3d60f0b4b9554655aba131..60f59bb165ad9283a4fffd3d900e95460eb8b709 100644 (file)
@@ -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;
index 08ffab3072c45f42742ad93989de2b4d78eb79d5..7dca5f6bdf8de6f202c563cf1c59493fd8bf3389 100644 (file)
 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;
 }