egl/dri2: Dispatch eglCreatePbufferSurface by display, not driver
authorChad Versace <chad.versace@linux.intel.com>
Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Mon, 17 Mar 2014 22:36:04 +0000 (15:36 -0700)
Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePbufferSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/egl_dri2_fallbacks.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index 0c8b4ff45ebcc3e962f1a4a284a16da2b6f68942..18b1c7139821e029668d47f8327805681a9d2b13 100644 (file)
@@ -1033,6 +1033,14 @@ dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
                                                 attrib_list);
 }
 
+static _EGLSurface*
+dri2_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+                           _EGLConfig *conf, const EGLint *attrib_list)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->create_pbuffer_surface(drv, dpy, conf, attrib_list);
+}
+
 static EGLBoolean
 dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
                    EGLint interval)
@@ -2078,6 +2086,7 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.MakeCurrent = dri2_make_current;
    dri2_drv->base.API.CreateWindowSurface = dri2_create_window_surface;
    dri2_drv->base.API.CreatePixmapSurface = dri2_create_pixmap_surface;
+   dri2_drv->base.API.CreatePbufferSurface = dri2_create_pbuffer_surface;
    dri2_drv->base.API.GetProcAddress = dri2_get_proc_address;
    dri2_drv->base.API.WaitClient = dri2_wait_client;
    dri2_drv->base.API.WaitNative = dri2_wait_native;
index 7ab0ef44922de354dcbecd7ff85dc3cd438ffc1f..0b0841488da4c059ae4930a410442eff56e2dc8b 100644 (file)
@@ -97,6 +97,10 @@ struct dri2_egl_display_vtbl {
                                          EGLNativePixmapType pixmap,
                                          const EGLint *attrib_list);
 
+   _EGLSurface* (*create_pbuffer_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
+                                          _EGLConfig *config,
+                                          const EGLint *attrib_list);
+
    EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy,
                                _EGLSurface *surf, EGLint interval);
 
index 80dd4ace3bfd56c9d2f7addea0de82d9d29d3359..a4161575e3578a354b24d5254f03b00715575a1a 100644 (file)
@@ -35,6 +35,14 @@ dri2_fallback_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
    return NULL;
 }
 
+static inline _EGLSurface *
+dri2_fallback_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
+                                     _EGLConfig *conf,
+                                     const EGLint *attrib_list)
+{
+   return NULL;
+}
+
 static inline EGLBoolean
 dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy,
                             _EGLSurface *surf, EGLint interval)
index d8f56b4a6f67aa42301501526581291b4499c2cf..f2c8f6195d50d7b23558327d2532c18e9dbde05f 100644 (file)
@@ -423,7 +423,6 @@ droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
 static void
 droid_init_driver_functions(_EGLDriver *drv)
 {
-   drv->API.CreatePbufferSurface = droid_create_pbuffer_surface;
    drv->API.DestroySurface = droid_destroy_surface;
 
    drv->API.CreateImageKHR = droid_create_image_khr;
@@ -646,6 +645,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .authenticate = NULL,
    .create_window_surface = droid_create_window_surface,
    .create_pixmap_surface = dri2_fallback_pixmap_surface,
+   .create_pbuffer_surface = droid_create_pbuffer_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = droid_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
index 571f016002dd7942c1850a086e3802267614be3f..4761bbffc23123af38e4f464c797338192cdf8f9 100644 (file)
@@ -445,6 +445,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .authenticate = dri2_drm_authenticate,
    .create_window_surface = dri2_drm_create_window_surface,
    .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
+   .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_drm_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
index 2ea61edbabf5ae297247ae91c361876f2c7eaaac..42a01f780a7c2633bf9a78a0164864aa973062ec 100644 (file)
@@ -961,6 +961,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
    .authenticate = dri2_wl_authenticate,
    .create_window_surface = dri2_wl_create_window_surface,
    .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
+   .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
    .swap_interval = dri2_wl_swap_interval,
    .swap_buffers = dri2_wl_swap_buffers,
    .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
index 6be99130479b11e6384f9f6c217b3f994031b973..1ef7b02ac190a0621a283b640509502ee66e50e6 100644 (file)
@@ -996,6 +996,7 @@ static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .authenticate = NULL,
    .create_window_surface = dri2_x11_create_window_surface,
    .create_pixmap_surface = dri2_x11_create_pixmap_surface,
+   .create_pbuffer_surface = dri2_x11_create_pbuffer_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
 };
@@ -1004,6 +1005,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .authenticate = dri2_x11_authenticate,
    .create_window_surface = dri2_x11_create_window_surface,
    .create_pixmap_surface = dri2_x11_create_pixmap_surface,
+   .create_pbuffer_surface = dri2_x11_create_pbuffer_surface,
    .swap_interval = dri2_x11_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
@@ -1014,7 +1016,6 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
 
-   drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
    drv->API.DestroySurface = dri2_x11_destroy_surface;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
 
@@ -1137,7 +1138,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
 
-   drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
    drv->API.DestroySurface = dri2_x11_destroy_surface;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
    drv->API.CreateImageKHR = dri2_x11_create_image_khr;