diff options
author | Chad Versace <[email protected]> | 2014-01-28 16:26:44 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2014-03-17 15:36:03 -0700 |
commit | d03948a76634392455ae53fbf975d09c58bfc7aa (patch) | |
tree | c7fb6a277bf2054bbd8fc3396aa65574e811ca49 | |
parent | ad173bcfdbeaa52d6a024cd7ef6c068c5a999ba2 (diff) |
egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver
Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT to that.
This prepares for the EGL platform extensions.
Reviewed-by: Ian Romanick <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 11 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 4 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2_fallbacks.h | 8 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_android.c | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 2 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 1 |
7 files changed, 27 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 0b56c12d50c..de6453c4731 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1029,6 +1029,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) } static EGLBoolean +dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surf, + const EGLint *rects, EGLint n_rects) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + return dri2_dpy->vtbl->swap_buffers_with_damage(drv, dpy, surf, + rects, n_rects); +} + +static EGLBoolean dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); @@ -2053,6 +2063,7 @@ _eglBuiltInDriverDRI2(const char *args) dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image; dri2_drv->base.API.SwapInterval = dri2_swap_interval; dri2_drv->base.API.SwapBuffers = dri2_swap_buffers; + dri2_drv->base.API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage; 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 e4555621f6e..519aab06d88 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -92,6 +92,10 @@ struct dri2_egl_display_vtbl { EGLBoolean (*swap_buffers)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf); + + EGLBoolean (*swap_buffers_with_damage)(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surface, + const EGLint *rects, EGLint n_rects); }; struct dri2_egl_display diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h index e09a3b8c999..51c0a99aaa6 100644 --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -32,3 +32,11 @@ dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, { return EGL_FALSE; } + +static inline EGLBoolean +dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surf, + const EGLint *rects, EGLint n_rects) +{ + return EGL_FALSE; +} diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index e1963f51c08..c14e62e0d5f 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -656,6 +656,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = { .authenticate = NULL, .swap_interval = dri2_fallback_swap_interval, .swap_buffers = droid_swap_buffers, + .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, }; EGLBoolean diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index c0999dc73dd..b8d5f5eced0 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -445,6 +445,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = { .authenticate = dri2_drm_authenticate, .swap_interval = dri2_fallback_swap_interval, .swap_buffers = dri2_drm_swap_buffers, + .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, }; EGLBoolean diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 92cc5a3efcb..8d79dbbb4f4 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -961,6 +961,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = { .authenticate = dri2_wl_authenticate, .swap_interval = dri2_wl_swap_interval, .swap_buffers = dri2_wl_swap_buffers, + .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage, }; EGLBoolean @@ -979,7 +980,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) drv->API.CreateWindowSurface = dri2_wl_create_window_surface; drv->API.DestroySurface = dri2_wl_destroy_surface; - drv->API.SwapBuffersWithDamageEXT = dri2_wl_swap_buffers_with_damage; 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 38e86698072..28bfc82f626 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1002,6 +1002,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = { .authenticate = dri2_x11_authenticate, .swap_interval = dri2_x11_swap_interval, .swap_buffers = dri2_x11_swap_buffers, + .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, }; static EGLBoolean |