From b4345da8762e18af16c52465d636021115c041cf Mon Sep 17 00:00:00 2001 From: Harish Krupo Date: Mon, 12 Aug 2019 12:07:04 +0200 Subject: [PATCH] egl/android: Delete set_damage_region from egl dri vtbl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The intension of the KHR_partial_update was not to send the damage back to the platform but to send the damage to the driver to ensure that the following rendering could be restricted to those regions. This patch removes the set_damage_region from the egl_dri vtbl and all the platfrom_*.c files. Then upcomming patches add a new dri2 interface for the drivers to implement Signed-off-by: Harish Krupo Reviewed-by: Daniel Stone Signed-off-by: Boris Brezillon Acked-by: Alyssa Rosenzweig Reviewed-by: Qiang Yu Tested-by: Qiang Yu Reviewed-by: Marek Olšák --- src/egl/drivers/dri2/egl_dri2.c | 3 +- src/egl/drivers/dri2/egl_dri2.h | 4 -- src/egl/drivers/dri2/egl_dri2_fallbacks.h | 9 ----- src/egl/drivers/dri2/platform_android.c | 45 --------------------- src/egl/drivers/dri2/platform_device.c | 1 - src/egl/drivers/dri2/platform_drm.c | 1 - src/egl/drivers/dri2/platform_surfaceless.c | 1 - src/egl/drivers/dri2/platform_wayland.c | 1 - src/egl/drivers/dri2/platform_x11.c | 2 - src/egl/drivers/dri2/platform_x11_dri3.c | 1 - 10 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index a2f8a38bebf..59397ed62b2 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1694,8 +1694,7 @@ static EGLBoolean dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint *rects, EGLint n_rects) { - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - return dri2_dpy->vtbl->set_damage_region(drv, disp, surf, rects, n_rects); + return false; } static EGLBoolean diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 3206d00c1ca..5246b77e64d 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -122,10 +122,6 @@ struct dri2_egl_display_vtbl { _EGLSurface *surface, const EGLint *rects, EGLint n_rects); - EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, - const EGLint *rects, EGLint n_rects); - EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *disp, _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 6c2c4bbe595..d975b7a8b13 100644 --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -62,7 +62,6 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *rects, EGLint n_rects) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - dri2_dpy->vtbl->set_damage_region(drv, disp, surf, rects, n_rects); return dri2_dpy->vtbl->swap_buffers(drv, disp, surf); } @@ -90,14 +89,6 @@ dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, return _eglError(EGL_BAD_NATIVE_PIXMAP, "no support for native pixmaps"); } -static inline EGLBoolean -dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surf, - const EGLint *rects, EGLint n_rects) -{ - return EGL_FALSE; -} - static inline EGLint dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index d37f6b8e447..dda38d67265 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -761,43 +761,6 @@ 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) - return _eglError(EGL_BAD_ALLOC, "eglSetDamageRegionKHR"); - - 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_fds_yuv(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf, @@ -1262,11 +1225,6 @@ static const struct dri2_egl_display_vtbl droid_display_vtbl = { .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, /* Android implements the function */ .swap_buffers_region = dri2_fallback_swap_buffers_region, .swap_interval = droid_swap_interval, -#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, @@ -1649,9 +1607,6 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp) disp->Extensions.ANDROID_image_native_buffer = EGL_TRUE; disp->Extensions.ANDROID_recordable = EGL_TRUE; disp->Extensions.EXT_buffer_age = EGL_TRUE; -#if ANDROID_API_LEVEL >= 23 - disp->Extensions.KHR_partial_update = EGL_TRUE; -#endif disp->Extensions.KHR_image = EGL_TRUE; #if ANDROID_API_LEVEL >= 24 if (dri2_dpy->mutable_render_buffer && diff --git a/src/egl/drivers/dri2/platform_device.c b/src/egl/drivers/dri2/platform_device.c index 6b80a3869b3..e7ae3a3aa2a 100644 --- a/src/egl/drivers/dri2/platform_device.c +++ b/src/egl/drivers/dri2/platform_device.c @@ -229,7 +229,6 @@ static const struct dri2_egl_display_vtbl dri2_device_display_vtbl = { .destroy_surface = device_destroy_surface, .create_image = dri2_create_image_khr, .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_drm.c b/src/egl/drivers/dri2/platform_drm.c index b0a2af6bf3d..648bc86ade7 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -668,7 +668,6 @@ 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 fd6ec6e602d..142165807c3 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -223,7 +223,6 @@ static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = { .destroy_surface = surfaceless_destroy_surface, .create_image = dri2_create_image_khr, .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 4c9046446a7..70a7bef9b11 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1313,7 +1313,6 @@ 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 7e6aad66a43..7a58e718492 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1263,7 +1263,6 @@ static const struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = { .destroy_surface = dri2_x11_destroy_surface, .create_image = dri2_create_image_khr, .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, /* XXX: should really implement this since X11 has pixmaps */ @@ -1286,7 +1285,6 @@ 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 c2228b08b00..ab137195a97 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -501,7 +501,6 @@ 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, -- 2.30.2