diff options
author | Joonbum Ko <joonbum.ko@samsung.com> | 2022-05-09 13:36:25 +0900 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2023-08-15 14:02:15 +0800 |
commit | 8519da45e51dfea4f9605434bd74f4d41bb94faa (patch) | |
tree | 04e362241f6865f3ef3a1cb1adb120c57754f787 | |
parent | cd4afc41f06085b543a249e106e1ca12cf3aea88 (diff) | |
download | mesa-8519da45e51dfea4f9605434bd74f4d41bb94faa.tar.gz mesa-8519da45e51dfea4f9605434bd74f4d41bb94faa.tar.bz2 mesa-8519da45e51dfea4f9605434bd74f4d41bb94faa.zip |
Fix to support EGL_SYNC_NATIVE_FENCE_ANDROID on TIZEN
- EGL_SYNC_NATIVE_FENCE_TIZEN is not an official extension.
So we need to support official extensions about egl sync.
EGL_SYNC_NATIVE_FENCE_TIZEN will be deprecated.
Change-Id: I53c4ea248d4ffaf0190619b861633eda450b44c4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
-rw-r--r-- | include/EGL/eglext.h | 4 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 27 | ||||
-rwxr-xr-x | src/egl/drivers/dri2/platform_tizen.c | 1 | ||||
-rw-r--r-- | src/egl/main/eglapi.c | 10 | ||||
-rw-r--r-- | src/egl/main/eglsync.c | 25 |
5 files changed, 5 insertions, 62 deletions
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index f30d27476ad..9d5915ae9d1 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -1488,8 +1488,8 @@ EGLAPI EGLBoolean EGLAPIENTRY eglImageInvalidateExternalEXT (EGLDisplay dpy, EGL #ifndef EGL_TIZEN_native_fence_sync #define EGL_TIZEN_native_fence_sync 1 -#define EGL_SYNC_NATIVE_FENCE_TIZEN 0x3144 -#define EGL_SYNC_NATIVE_FENCE_FD_TIZEN 0x3145 +#define EGL_SYNC_NATIVE_FENCE_TIZEN EGL_SYNC_NATIVE_FENCE_ANDROID +#define EGL_SYNC_NATIVE_FENCE_FD_TIZEN EGL_SYNC_NATIVE_FENCE_FD_ANDROID #define EGL_NO_NATIVE_FENCE_FD_TIZEN -1 typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDTIZENPROC) (EGLDisplay dpy, EGLSyncKHR sync); #ifdef EGL_EGLEXT_PROTOTYPES diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 55e22ca3501..7c52f16812a 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -3413,17 +3413,10 @@ dri2_egl_unref_sync(struct dri2_egl_display *dri2_dpy, case EGL_SYNC_REUSABLE_KHR: cnd_destroy(&dri2_sync->cond); break; -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_TIZEN: - if (dri2_sync->base.SyncFd != EGL_NO_NATIVE_FENCE_FD_TIZEN) - close(dri2_sync->base.SyncFd); - break; -#else case EGL_SYNC_NATIVE_FENCE_ANDROID: if (dri2_sync->base.SyncFd != EGL_NO_NATIVE_FENCE_FD_ANDROID) close(dri2_sync->base.SyncFd); break; -#endif default: break; } @@ -3511,20 +3504,6 @@ dri2_create_sync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list) dri2_sync->base.SyncStatus = EGL_UNSIGNALED_KHR; break; -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_TIZEN: - if (dri2_dpy->fence->create_fence_fd) { - dri2_sync->fence = dri2_dpy->fence->create_fence_fd( - dri2_ctx->dri_context, - dri2_sync->base.SyncFd); - } - if (!dri2_sync->fence) { - _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR"); - goto fail; - } - break; - } -#else case EGL_SYNC_NATIVE_FENCE_ANDROID: if (dri2_dpy->fence->create_fence_fd) { dri2_sync->fence = dri2_dpy->fence->create_fence_fd( @@ -3537,7 +3516,7 @@ dri2_create_sync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list) return NULL; } break; -#endif + } p_atomic_set(&dri2_sync->refcount, 1); mtx_unlock(&dri2_dpy->lock); @@ -3670,11 +3649,7 @@ dri2_client_wait_sync(_EGLDisplay *disp, _EGLSync *sync, switch (sync->Type) { case EGL_SYNC_FENCE_KHR: -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_TIZEN: -#else case EGL_SYNC_NATIVE_FENCE_ANDROID: -#endif case EGL_SYNC_CL_EVENT_KHR: if (dri2_dpy->fence->client_wait_sync(dri2_ctx ? dri2_ctx->dri_context : NULL, dri2_sync->fence, wait_flags, diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c index cad50afa715..3b0c8bdc029 100755 --- a/src/egl/drivers/dri2/platform_tizen.c +++ b/src/egl/drivers/dri2/platform_tizen.c @@ -1738,6 +1738,7 @@ dri2_initialize_tizen(_EGLDisplay *disp) dri2_dpy->fence->get_capabilities(dri2_dpy->dri_screen_render_gpu); disp->Extensions.TIZEN_native_fence_sync = (capabilities & __DRI_FENCE_CAP_NATIVE_FD) != 0; + disp->Extensions.ANDROID_native_fence_sync = disp->Extensions.TIZEN_native_fence_sync; } return EGL_TRUE; diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 0f12295fd4d..a2476ac39c1 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1988,8 +1988,7 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list, * error is generated. */ if (!ctx && - (type == EGL_SYNC_FENCE_KHR || type == EGL_SYNC_NATIVE_FENCE_ANDROID - || type == EGL_SYNC_NATIVE_FENCE_TIZEN)) + (type == EGL_SYNC_FENCE_KHR || type == EGL_SYNC_NATIVE_FENCE_ANDROID)) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR); if (ctx && (ctx->Resource.Display != disp)) @@ -2008,17 +2007,10 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list, if (!disp->Extensions.KHR_cl_event2) RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR); break; -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_TIZEN: - if (!disp->Extensions.TIZEN_native_fence_sync) - RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR); - break; -#else case EGL_SYNC_NATIVE_FENCE_ANDROID: if (!disp->Extensions.ANDROID_native_fence_sync) RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR); break; -#endif default: RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR); } diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index df62d8d5a95..ccad83bb241 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -59,16 +59,6 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLAttrib *attrib_list) err = EGL_BAD_ATTRIBUTE; } break; -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_FD_TIZEN: - if (sync->Type == EGL_SYNC_NATIVE_FENCE_TIZEN) { - /* we take ownership of the native fd, so no dup(): */ - sync->SyncFd = val; - } else { - err = EGL_BAD_ATTRIBUTE; - } - break; -#else case EGL_SYNC_NATIVE_FENCE_FD_ANDROID: if (sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID) { /* we take ownership of the native fd, so no dup(): */ @@ -77,7 +67,6 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLAttrib *attrib_list) err = EGL_BAD_ATTRIBUTE; } break; -#endif default: err = EGL_BAD_ATTRIBUTE; break; @@ -110,18 +99,12 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *disp, EGLenum type, case EGL_SYNC_CL_EVENT_KHR: sync->SyncCondition = EGL_SYNC_CL_EVENT_COMPLETE_KHR; break; -#ifdef HAVE_TIZEN_PLATFORM - case EGL_SYNC_NATIVE_FENCE_TIZEN: - sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; - break; -#else case EGL_SYNC_NATIVE_FENCE_ANDROID: if (sync->SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; else sync->SyncCondition = EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID; break; -#endif default: sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; } @@ -150,11 +133,7 @@ _eglGetSyncAttrib(_EGLDisplay *disp, _EGLSync *sync, (sync->Type == EGL_SYNC_FENCE_KHR || sync->Type == EGL_SYNC_CL_EVENT_KHR || sync->Type == EGL_SYNC_REUSABLE_KHR || -#ifdef HAVE_TIZEN_PLATFORM - sync->Type == EGL_SYNC_NATIVE_FENCE_TIZEN)) -#else sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID)) -#endif disp->Driver->ClientWaitSyncKHR(disp, sync, 0, 0); *value = sync->SyncStatus; @@ -162,11 +141,7 @@ _eglGetSyncAttrib(_EGLDisplay *disp, _EGLSync *sync, case EGL_SYNC_CONDITION_KHR: if (sync->Type != EGL_SYNC_FENCE_KHR && sync->Type != EGL_SYNC_CL_EVENT_KHR && -#ifdef HAVE_TIZEN_PLATFORM - sync->Type != EGL_SYNC_NATIVE_FENCE_TIZEN) -#else sync->Type != EGL_SYNC_NATIVE_FENCE_ANDROID) -#endif return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); *value = sync->SyncCondition; break; |