This patch adds support for the EGL_KHR_partial_update extension for
android platform. It passes 36/37 tests in dEQP for
EGL_KHR_partial_update.
1 test not supported.
v2: add fallback for eglSetDamageRegionKHR (Tapani)
v3: The native_window_set_surface_damage call is available only from
Android version 6.0. Reintroduce the ANDROID_VERSION guard and
advertise extension only if version is >= 6.0. (Emil Velikov)
v4: use newly introduced ANDROID_API_LEVEL guard rather than
ANDROID_VERSION guard to advertise the extension.The extension
is advertised only if ANDROID_API_LEVEL >= 23 (Android 6.0 or
greater). Add fallback function for platforms other than Android.
Fix possible math overflow. (Emil Velikov)
Return immediately when n_rects is 0. Place function's entrypoint
in alphabetical order. (Eric Engestrom)
Signed-off-by: Harish Krupo <harish.krupo....@intel.com>
---
src/egl/drivers/dri2/egl_dri2.c | 9 ++++
src/egl/drivers/dri2/egl_dri2.h | 4 ++
src/egl/drivers/dri2/egl_dri2_fallbacks.h | 8 +++
src/egl/drivers/dri2/platform_android.c | 41 ++++++++++++++
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 +
src/egl/main/eglapi.c | 83
+++++++++++++++++++++++++++++
src/egl/main/eglapi.h | 2 +
src/egl/main/egldisplay.h | 1 +
src/egl/main/eglentrypoint.h | 1 +
src/egl/main/eglfallbacks.c | 1 +
src/egl/main/eglsurface.c | 9 ++++
src/egl/main/eglsurface.h | 12 +++++
16 files changed, 177 insertions(+)
diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
index d31a0bf8e0..a1d72166df 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)
{
@@ -3141,6 +3149,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 449016093a..ba7a7be57b 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 67a9c5034a..d8363c9bdd 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 055dc0f996..303e19052f 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -656,6 +656,39 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay
*disp, _EGLSurface *draw)
return EGL_TRUE;
}
+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;
+
+ if (n_rects == 0)
+ return EGL_TRUE;
+
+ droid_rects = calloc(n_rects, sizeof(android_native_rect_t));