summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2017-12-28 10:51:11 +0200
committerTapani Pälli <[email protected]>2018-02-07 14:45:34 +0200
commit6f5b57093b3462a54e9c7c6188db37e46993cee7 (patch)
treeb6a4f043b29a47dfbdf5a8c2e143843fe1c85369 /src/egl/main
parentcf4569da6be22bdf4f2414914a17732d730d4b93 (diff)
egl: add support for EGL_ANDROID_blob_cache
v2: cleanup, move callbacks to _egl_display struct (Emil Velikov) adapt to earlier ctx->screen changes v3: remove useless checking, add _eglSetFuncName (Emil Velikov) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Jordan Justen <[email protected]> (v2) Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglapi.c44
-rw-r--r--src/egl/main/eglapi.h4
-rw-r--r--src/egl/main/egldisplay.h4
-rw-r--r--src/egl/main/eglentrypoint.h1
4 files changed, 53 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 5110688f2d1..c1103491191 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -476,6 +476,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
char *exts = dpy->ExtensionsString;
/* Please keep these sorted alphabetically. */
+ _EGL_CHECK_EXTENSION(ANDROID_blob_cache);
_EGL_CHECK_EXTENSION(ANDROID_framebuffer_target);
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
_EGL_CHECK_EXTENSION(ANDROID_native_fence_sync);
@@ -2522,6 +2523,49 @@ eglQueryDmaBufModifiersEXT(EGLDisplay dpy, EGLint format, EGLint max_modifiers,
RETURN_EGL_EVAL(disp, ret);
}
+static void EGLAPIENTRY
+eglSetBlobCacheFuncsANDROID(EGLDisplay *dpy, EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get)
+{
+ /* This function does not return anything so we cannot
+ * utilize the helper macros _EGL_FUNC_START or _EGL_CHECK_DISPLAY.
+ */
+ _EGLDisplay *disp = _eglLockDisplay(dpy);
+ if (!_eglSetFuncName(__func__, disp, EGL_OBJECT_DISPLAY_KHR, NULL)) {
+ if (disp)
+ _eglUnlockDisplay(disp);
+ return;
+ }
+
+ _EGLDriver *drv = _eglCheckDisplay(disp, __func__);
+ if (!drv) {
+ if (disp)
+ _eglUnlockDisplay(disp);
+ return;
+ }
+
+ if (!set || !get) {
+ _eglError(EGL_BAD_PARAMETER,
+ "eglSetBlobCacheFuncsANDROID: NULL handler given");
+ _eglUnlockDisplay(disp);
+ return;
+ }
+
+ if (disp->BlobCacheSet) {
+ _eglError(EGL_BAD_PARAMETER,
+ "eglSetBlobCacheFuncsANDROID: functions already set");
+ _eglUnlockDisplay(disp);
+ return;
+ }
+
+ disp->BlobCacheSet = set;
+ disp->BlobCacheGet = get;
+
+ drv->API.SetBlobCacheFuncsANDROID(drv, disp, set, get);
+
+ _eglUnlockDisplay(disp);
+}
+
__eglMustCastToProperFunctionPointerType EGLAPIENTRY
eglGetProcAddress(const char *procname)
{
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 852a34584ea..3f70377cd74 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -209,6 +209,10 @@ struct _egl_api
EGLuint64KHR *modifiers,
EGLBoolean *external_only,
EGLint *num_modifiers);
+
+ void (*SetBlobCacheFuncsANDROID) (_EGLDriver *drv, _EGLDisplay *dpy,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get);
};
#ifdef __cplusplus
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 7eac96ed052..d7e51991a45 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -92,6 +92,7 @@ struct _egl_resource
struct _egl_extensions
{
/* Please keep these sorted alphabetically. */
+ EGLBoolean ANDROID_blob_cache;
EGLBoolean ANDROID_framebuffer_target;
EGLBoolean ANDROID_image_native_buffer;
EGLBoolean ANDROID_native_fence_sync;
@@ -181,6 +182,9 @@ struct _egl_display
_EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
EGLLabelKHR Label;
+
+ EGLSetBlobFuncANDROID BlobCacheSet;
+ EGLGetBlobFuncANDROID BlobCacheGet;
};
diff --git a/src/egl/main/eglentrypoint.h b/src/egl/main/eglentrypoint.h
index f7fe77410d5..06749f6353a 100644
--- a/src/egl/main/eglentrypoint.h
+++ b/src/egl/main/eglentrypoint.h
@@ -63,6 +63,7 @@ EGL_ENTRYPOINT(eglQuerySurface)
EGL_ENTRYPOINT(eglQueryWaylandBufferWL)
EGL_ENTRYPOINT(eglReleaseTexImage)
EGL_ENTRYPOINT(eglReleaseThread)
+EGL_ENTRYPOINT(eglSetBlobCacheFuncsANDROID)
EGL_ENTRYPOINT(eglSetDamageRegionKHR)
EGL_ENTRYPOINT(eglSignalSyncKHR)
EGL_ENTRYPOINT(eglSurfaceAttrib)