summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorRobert Bragg <[email protected]>2012-02-10 16:59:31 +0000
committerRobert Bragg <[email protected]>2013-05-07 17:07:50 +0100
commitf8c324268223611ce7d14c4109faed4ab0eb3798 (patch)
treeb93bb4a4c87e2dc7fec11e55ade3a7cf2952c0ce /src/egl
parent6425b14515e3124d6d1fe2d39fa192389aab9f85 (diff)
egl/wayland: Implement EGL_EXT_swap_buffers_with_damage
Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 8e4b3ce683d..b5523bed8f2 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -495,7 +495,11 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)
* Called via eglSwapBuffers(), drv->API.SwapBuffers().
*/
static EGLBoolean
-dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
+dri2_swap_buffers_with_damage(_EGLDriver *drv,
+ _EGLDisplay *disp,
+ _EGLSurface *draw,
+ const EGLint *rects,
+ EGLint n_rects)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -540,8 +544,18 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
dri2_surf->dx = 0;
dri2_surf->dy = 0;
- wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
- dri2_surf->base.Width, dri2_surf->base.Height);
+ if (n_rects == 0) {
+ wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
+ dri2_surf->base.Width, dri2_surf->base.Height);
+ } else {
+ for (i = 0; i < n_rects; i++) {
+ const int *rect = &rects[i * 4];
+ wl_surface_damage(dri2_surf->wl_win->surface,
+ rect[0],
+ dri2_surf->base.Height - rect[1] - rect[3],
+ rect[2], rect[3]);
+ }
+ }
wl_surface_commit(dri2_surf->wl_win->surface);
@@ -566,6 +580,12 @@ dri2_query_buffer_age(_EGLDriver *drv,
return dri2_surf->back->age;
}
+static EGLBoolean
+dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
+{
+ return dri2_swap_buffers_with_damage (drv, disp, draw, NULL, 0);
+}
+
static int
dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
{
@@ -713,6 +733,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
drv->API.CreateWindowSurface = dri2_create_window_surface;
drv->API.DestroySurface = dri2_destroy_surface;
drv->API.SwapBuffers = dri2_swap_buffers;
+ drv->API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage;
drv->API.Terminate = dri2_terminate;
drv->API.QueryBufferAge = dri2_query_buffer_age;
@@ -795,6 +816,8 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
disp->Extensions.EXT_buffer_age = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;
+ disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
+
/* we're supporting EGL 1.4 */
disp->VersionMajor = 1;
disp->VersionMinor = 4;