summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonbum Ko <joonbum.ko@samsung.com>2022-05-09 13:36:25 +0900
committerXuelian Bai <xuelian.bai@samsung.com>2024-01-18 09:31:56 +0800
commitdf52dd1510f24dcc2fb5186de69a0e8a9156cb9a (patch)
tree51a5d8d85601d05e102c23ff9fe52b0395bae64d
parentebe282f610dcfd8b33b1a8e9624eac101a11d834 (diff)
downloadmesa-df52dd1510f24dcc2fb5186de69a0e8a9156cb9a.tar.gz
mesa-df52dd1510f24dcc2fb5186de69a0e8a9156cb9a.tar.bz2
mesa-df52dd1510f24dcc2fb5186de69a0e8a9156cb9a.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.h4
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c26
-rwxr-xr-xsrc/egl/drivers/dri2/platform_tizen.c1
-rw-r--r--src/egl/main/eglapi.c10
-rw-r--r--src/egl/main/eglsync.c25
5 files changed, 5 insertions, 61 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 717fb843529..50809ac0ddc 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -3466,17 +3466,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;
}
@@ -3564,19 +3557,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(
@@ -3589,7 +3569,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);
@@ -3721,11 +3701,7 @@ dri2_client_wait_sync(_EGLDisplay *disp, _EGLSync *sync, EGLint flags,
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,
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index 0f679f813e2..287d897fbc7 100755
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -1737,6 +1737,7 @@ dri2_initialize_tizen(_EGLDisplay *disp)
dri2_dpy->fence->get_capabilities(dri2_dpy->dri_screen);
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 8cd93f3351e..a050f47128d 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1948,8 +1948,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))
@@ -1968,17 +1967,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 8699eddccf0..554077650bc 100644
--- a/src/egl/main/eglsync.c
+++ b/src/egl/main/eglsync.c
@@ -57,16 +57,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(): */
@@ -75,7 +65,6 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLAttrib *attrib_list)
err = EGL_BAD_ATTRIBUTE;
}
break;
-#endif
default:
err = EGL_BAD_ATTRIBUTE;
break;
@@ -107,18 +96,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;
}
@@ -146,11 +129,7 @@ _eglGetSyncAttrib(_EGLDisplay *disp, _EGLSync *sync, EGLint attribute,
(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;
@@ -158,11 +137,7 @@ _eglGetSyncAttrib(_EGLDisplay *disp, _EGLSync *sync, EGLint attribute,
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;