diff options
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 9 | ||||
-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 | 47 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_surfaceless.c | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 2 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11_dri3.c | 1 |
9 files changed, 74 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 7175e827c9f..020a0bc6394 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1512,6 +1512,14 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, } static EGLBoolean +dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint *rects, EGLint n_rects) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + return dri2_dpy->vtbl->set_damage_region(drv, dpy, surf, rects, n_rects); +} + +static EGLBoolean dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint x, EGLint y, EGLint width, EGLint height) { @@ -3140,6 +3148,7 @@ _eglBuiltInDriverDRI2(const char *args) dri2_drv->base.API.SwapBuffers = dri2_swap_buffers; dri2_drv->base.API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage; dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region; + dri2_drv->base.API.SetDamageRegion = dri2_set_damage_region; dri2_drv->base.API.PostSubBufferNV = dri2_post_sub_buffer; dri2_drv->base.API.CopyBuffers = dri2_copy_buffers, dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age; diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index a71b4489cde..f8c26a9d45e 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl { _EGLSurface *surface, const EGLint *rects, EGLint n_rects); + EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surface, + const EGLint *rects, EGLint n_rects); + EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint numRects, const EGLint *rects); diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h index 67a9c5034a2..d8363c9bdd7 100644 --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -95,6 +95,14 @@ dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, return EGL_FALSE; } +static inline EGLBoolean +dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLSurface *surf, + const EGLint *rects, EGLint n_rects) +{ + return EGL_FALSE; +} + static inline EGLint dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 4c979351192..7a73419d148 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -656,6 +656,45 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) return EGL_TRUE; } +#if ANDROID_API_LEVEL >= 23 +static EGLBoolean +droid_set_damage_region(_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); + android_native_rect_t* droid_rects = NULL; + int ret; + + if (n_rects == 0) + return EGL_TRUE; + + droid_rects = malloc(n_rects * sizeof(android_native_rect_t)); + if (droid_rects == NULL) { + _eglError(EGL_BAD_ALLOC, "eglSetDamageRegionKHR"); + return EGL_FALSE; + } + + for (EGLint num_drects = 0; num_drects < n_rects; num_drects++) { + EGLint i = num_drects * 4; + droid_rects[num_drects].left = rects[i]; + droid_rects[num_drects].bottom = rects[i + 1]; + droid_rects[num_drects].right = rects[i] + rects[i + 2]; + droid_rects[num_drects].top = rects[i + 1] + rects[i + 3]; + } + + /* + * XXX/TODO: Need to check for other return values + */ + + ret = native_window_set_surface_damage(dri2_surf->window, droid_rects, n_rects); + free(droid_rects); + + return ret == 0 ? EGL_TRUE : EGL_FALSE; +} +#endif + static _EGLImage * droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf, int fd) @@ -1066,6 +1105,11 @@ static const struct dri2_egl_display_vtbl droid_display_vtbl = { .swap_buffers = droid_swap_buffers, .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, .swap_buffers_region = dri2_fallback_swap_buffers_region, +#if ANDROID_API_LEVEL >= 23 + .set_damage_region = droid_set_damage_region, +#else + .set_damage_region = dri2_fallback_set_damage_region, +#endif .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri2_fallback_copy_buffers, .query_buffer_age = droid_query_buffer_age, @@ -1176,6 +1220,9 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE; dpy->Extensions.ANDROID_recordable = EGL_TRUE; dpy->Extensions.EXT_buffer_age = EGL_TRUE; +#if ANDROID_API_LEVEL >= 23 + dpy->Extensions.KHR_partial_update = EGL_TRUE; +#endif /* Fill vtbl last to prevent accidentally calling virtual function during * initialization. diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 36c89fc832b..8b0562c75d2 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -658,6 +658,7 @@ static const struct dri2_egl_display_vtbl dri2_drm_display_vtbl = { .swap_buffers = dri2_drm_swap_buffers, .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, .swap_buffers_region = dri2_fallback_swap_buffers_region, + .set_damage_region = dri2_fallback_set_damage_region, .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri2_fallback_copy_buffers, .query_buffer_age = dri2_drm_query_buffer_age, diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index 6563e466c09..0eb3fb7505c 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -237,6 +237,7 @@ static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = { .swap_buffers = surfaceless_swap_buffers, .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, .swap_buffers_region = dri2_fallback_swap_buffers_region, + .set_damage_region = dri2_fallback_set_damage_region, .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri2_fallback_copy_buffers, .query_buffer_age = dri2_fallback_query_buffer_age, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 15cc597111e..f746f0bfd1c 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1080,6 +1080,7 @@ static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = { .swap_buffers = dri2_wl_swap_buffers, .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage, .swap_buffers_region = dri2_fallback_swap_buffers_region, + .set_damage_region = dri2_fallback_set_damage_region, .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri2_fallback_copy_buffers, .query_buffer_age = dri2_wl_query_buffer_age, diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 8d8c7cb4905..74d3a164b6a 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1140,6 +1140,7 @@ static const struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = { .create_image = dri2_fallback_create_image_khr, .swap_interval = dri2_fallback_swap_interval, .swap_buffers = dri2_x11_swap_buffers, + .set_damage_region = dri2_fallback_set_damage_region, .swap_buffers_region = dri2_fallback_swap_buffers_region, .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri2_x11_copy_buffers, @@ -1161,6 +1162,7 @@ static const struct dri2_egl_display_vtbl dri2_x11_display_vtbl = { .swap_buffers = dri2_x11_swap_buffers, .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, .swap_buffers_region = dri2_x11_swap_buffers_region, + .set_damage_region = dri2_fallback_set_damage_region, .post_sub_buffer = dri2_x11_post_sub_buffer, .copy_buffers = dri2_x11_copy_buffers, .query_buffer_age = dri2_fallback_query_buffer_age, diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index 041da3208de..3148f4904e5 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -458,6 +458,7 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = { .swap_buffers = dri3_swap_buffers, .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, .swap_buffers_region = dri2_fallback_swap_buffers_region, + .set_damage_region = dri2_fallback_set_damage_region, .post_sub_buffer = dri2_fallback_post_sub_buffer, .copy_buffers = dri3_copy_buffers, .query_buffer_age = dri3_query_buffer_age, |