diff options
author | Chad Versace <[email protected]> | 2014-01-28 12:34:19 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2014-03-17 15:36:03 -0700 |
commit | 8b9298af0a3bce1360cc2c020b31470b37b660fe (patch) | |
tree | ad14459299c53482fc68217f471d0280beabd9f3 /src | |
parent | a218765478e5207f4337406d98865c6b5cf3784e (diff) |
egl/dri2: Dispatch eglSwapInterval by display, not driver
Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and
let egl_dri2 dispatch eglSwapInterval to that.
This prepares for the EGL platform extensions.
Reviewed-by: Ian Romanick <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 9 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 3 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2_fallbacks.h | 34 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_android.c | 2 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 2 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 3 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 4 |
7 files changed, 55 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 7e5fdc0f9a9..e1a8e1e4490 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1014,6 +1014,14 @@ dri2_get_proc_address(_EGLDriver *drv, const char *procname) } static EGLBoolean +dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint interval) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + return dri2_dpy->vtbl->swap_interval(drv, dpy, surf, interval); +} + +static EGLBoolean dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); @@ -2036,6 +2044,7 @@ _eglBuiltInDriverDRI2(const char *args) dri2_drv->base.API.WaitNative = dri2_wait_native; dri2_drv->base.API.BindTexImage = dri2_bind_tex_image; dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image; + dri2_drv->base.API.SwapInterval = dri2_swap_interval; dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr; dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr; #ifdef HAVE_DRM_PLATFORM diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 4da0c5b3466..9f785c1c950 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -86,6 +86,9 @@ struct dri2_egl_driver struct dri2_egl_display_vtbl { int (*authenticate)(_EGLDisplay *disp, uint32_t id); + + EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surf, EGLint interval); }; struct dri2_egl_display diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h new file mode 100644 index 00000000000..e09a3b8c999 --- /dev/null +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -0,0 +1,34 @@ +/* + * Copyright 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +#include "egltypedefs.h" + +static inline EGLBoolean +dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surf, EGLint interval) +{ + return EGL_FALSE; +} diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 3a8f6bbe8d7..c2786b05617 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -36,6 +36,7 @@ #include "loader.h" #include "egl_dri2.h" +#include "egl_dri2_fallbacks.h" #include "gralloc_drm.h" static int @@ -654,6 +655,7 @@ droid_log(EGLint level, const char *msg) static struct dri2_egl_display_vtbl droid_display_vtbl = { .authenticate = NULL, + .swap_interval = dri2_fallback_swap_interval, }; EGLBoolean diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 9d3158ce72f..45f8ae6f630 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -36,6 +36,7 @@ #include <unistd.h> #include "egl_dri2.h" +#include "egl_dri2_fallbacks.h" #include "loader.h" static struct gbm_bo * @@ -442,6 +443,7 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id) static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = { .authenticate = dri2_drm_authenticate, + .swap_interval = dri2_fallback_swap_interval, }; EGLBoolean diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 6a75355b587..518d0232add 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -36,6 +36,7 @@ #include <xf86drm.h> #include "egl_dri2.h" +#include "egl_dri2_fallbacks.h" #include "loader.h" #include <wayland-client.h> @@ -958,6 +959,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, + .swap_interval = dri2_wl_swap_interval, }; EGLBoolean @@ -978,7 +980,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) drv->API.DestroySurface = dri2_wl_destroy_surface; drv->API.SwapBuffers = dri2_wl_swap_buffers; drv->API.SwapBuffersWithDamageEXT = dri2_wl_swap_buffers_with_damage; - drv->API.SwapInterval = dri2_wl_swap_interval; 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 ea871fd810c..9bc2afba830 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -40,6 +40,7 @@ #include <sys/stat.h> #include "egl_dri2.h" +#include "egl_dri2_fallbacks.h" static EGLBoolean dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, @@ -993,10 +994,12 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = { .authenticate = NULL, + .swap_interval = dri2_fallback_swap_interval, }; static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = { .authenticate = dri2_x11_authenticate, + .swap_interval = dri2_x11_swap_interval, }; static EGLBoolean @@ -1139,7 +1142,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) drv->API.CreateImageKHR = dri2_x11_create_image_khr; drv->API.SwapBuffersRegionNOK = dri2_x11_swap_buffers_region; drv->API.PostSubBufferNV = dri2_x11_post_sub_buffer; - drv->API.SwapInterval = dri2_x11_swap_interval; dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) |