[Mesa-dev] [PATCH 08/25] egl/dri2: Dispatch eglCreateWindowSurface by display, not driver
Chad Versace
chad.versace at linux.intel.com
Sun Feb 9 13:37:44 PST 2014
Add dri2_egl_display_vtbl::create_window_surface, set it for each
platform, and let egl_dri2 dispatch eglCreateWindowSurface to that.
This prepares for the EGL platform extensions.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
src/egl/drivers/dri2/egl_dri2.c | 11 +++++++++++
src/egl/drivers/dri2/egl_dri2.h | 5 +++++
src/egl/drivers/dri2/platform_android.c | 2 +-
src/egl/drivers/dri2/platform_drm.c | 3 ++-
src/egl/drivers/dri2/platform_wayland.c | 2 +-
src/egl/drivers/dri2/platform_x11.c | 4 ++--
6 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index b6b84bd..872c4e4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1012,6 +1012,16 @@ dri2_get_proc_address(_EGLDriver *drv, const char *procname)
return dri2_drv->get_proc_address(procname);
}
+static _EGLSurface*
+dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+ return dri2_dpy->vtbl->create_window_surface(drv, dpy, conf, window,
+ attrib_list);
+}
+
static EGLBoolean
dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint interval)
@@ -2055,6 +2065,7 @@ _eglBuiltInDriverDRI2(const char *args)
dri2_drv->base.API.CreateContext = dri2_create_context;
dri2_drv->base.API.DestroyContext = dri2_destroy_context;
dri2_drv->base.API.MakeCurrent = dri2_make_current;
+ dri2_drv->base.API.CreateWindowSurface = dri2_create_window_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;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 3ac8f28..0e1779f 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -88,6 +88,11 @@ struct dri2_egl_display_vtbl {
int
(*authenticate)(_EGLDisplay *disp, uint32_t id);
+ _EGLSurface*
+ (*create_window_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLConfig *config, EGLNativeWindowType window,
+ const EGLint *attrib_list);
+
EGLBoolean
(*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint interval);
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index d1e969d..e3ee3d6 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -431,7 +431,6 @@ droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
static void
droid_init_driver_functions(_EGLDriver *drv)
{
- drv->API.CreateWindowSurface = droid_create_window_surface;
drv->API.CreatePixmapSurface = droid_create_pixmap_surface;
drv->API.CreatePbufferSurface = droid_create_pbuffer_surface;
drv->API.DestroySurface = droid_destroy_surface;
@@ -654,6 +653,7 @@ droid_log(EGLint level, const char *msg)
static struct dri2_egl_display_vtbl droid_display_vtbl = {
.authenticate = NULL,
+ .create_window_surface = droid_create_window_surface,
.swap_interval = dri2_fallback_swap_interval,
.swap_buffers = droid_swap_buffers,
.swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index e39cb79..8dff369 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -443,8 +443,10 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
.authenticate = dri2_drm_authenticate,
+ .create_window_surface = dri2_drm_create_window_surface,
.swap_interval = dri2_fallback_swap_interval,
.swap_buffers = dri2_drm_swap_buffers,
+ .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
};
EGLBoolean
@@ -539,7 +541,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
i + 1, EGL_WINDOW_BIT, attr_list, NULL);
}
- drv->API.CreateWindowSurface = dri2_drm_create_window_surface;
drv->API.DestroySurface = dri2_drm_destroy_surface;
drv->API.CreateImageKHR = dri2_drm_create_image_khr;
drv->API.QueryBufferAge = dri2_drm_query_buffer_age;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 348a25d..8457813 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -958,6 +958,7 @@ dri2_wl_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
.authenticate = dri2_wl_authenticate,
+ .create_window_surface = dri2_wl_create_window_surface,
.swap_interval = dri2_wl_swap_interval,
.swap_buffers = dri2_wl_swap_buffers,
.swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
@@ -977,7 +978,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
loader_set_logger(_eglLog);
- drv->API.CreateWindowSurface = dri2_wl_create_window_surface;
drv->API.DestroySurface = dri2_wl_destroy_surface;
drv->API.Terminate = dri2_wl_terminate;
drv->API.QueryBufferAge = dri2_wl_query_buffer_age;
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 28bfc82..aa6e55a 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -994,12 +994,14 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
.authenticate = NULL,
+ .create_window_surface = dri2_x11_create_window_surface,
.swap_interval = dri2_fallback_swap_interval,
.swap_buffers = dri2_x11_swap_buffers,
};
static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
.authenticate = dri2_x11_authenticate,
+ .create_window_surface = dri2_x11_create_window_surface,
.swap_interval = dri2_x11_swap_interval,
.swap_buffers = dri2_x11_swap_buffers,
.swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
@@ -1010,7 +1012,6 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
- drv->API.CreateWindowSurface = dri2_x11_create_window_surface;
drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
drv->API.DestroySurface = dri2_x11_destroy_surface;
@@ -1135,7 +1136,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
- drv->API.CreateWindowSurface = dri2_x11_create_window_surface;
drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
drv->API.DestroySurface = dri2_x11_destroy_surface;
--
1.8.5.3
More information about the mesa-dev
mailing list