Skip to content

Commit

Permalink
Change default return value for eglDupNativeFenceFDANDROID
Browse files Browse the repository at this point in the history
According to EGL spec, eglDupNativeFenceFDANDROID should
return EGL_NO_NATIVE_FENCE_FD_ANDROID when there is error.
However, ANGLE just returns 0 as default value. Now overload
the default return value to EGL_NO_NATIVE_FENCE_FD_ANDROID.
Also, a end2end test is added.

Bug: angleproject:385190296
Change-Id: I214efdeb3ad583989fab5e2244c82cb7295f8b67
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6146195
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Roman Lavrov <[email protected]>
  • Loading branch information
yuxiangq7 authored and Angle LUCI CQ committed Jan 13, 2025
1 parent 2827060 commit 4c60a30
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libANGLE/validationEGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ GetDefaultReturnValue<angle::EntryPoint::EGLLabelObjectKHR, EGLint>(Thread *thre
return thread->getError();
}

template <>
ANGLE_INLINE EGLint
GetDefaultReturnValue<angle::EntryPoint::EGLDupNativeFenceFDANDROID, EGLint>(Thread *thread)
{
return EGL_NO_NATIVE_FENCE_FD_ANDROID;
}

template <angle::EntryPoint EP, typename ReturnType>
ANGLE_INLINE ReturnType GetDefaultReturnValue(Thread *thread)
{
Expand Down
15 changes: 15 additions & 0 deletions src/tests/egl_tests/EGLSyncTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,21 @@ TEST_P(EGLSyncTest, AndroidNativeFence_DupNativeFenceFD)
EXPECT_EGL_TRUE(eglDestroySyncKHR(display, syncWithGeneratedFD));
}

// Test the validation errors for bad parameters for eglDupNativeFenceFDANDROID
TEST_P(EGLSyncTest, AndroidNativeFence_DupNativeFenceFD_NegativeValidation)
{
ANGLE_SKIP_TEST_IF(!hasFenceSyncExtension());
ANGLE_SKIP_TEST_IF(!hasFenceSyncExtension() || !hasGLSyncExtension());
ANGLE_SKIP_TEST_IF(!hasAndroidNativeFenceSyncExtension());

EGLDisplay display = getEGLWindow()->getDisplay();

int fd;
fd = eglDupNativeFenceFDANDROID(display, EGL_NO_SYNC_KHR);
EXPECT_EGL_ERROR(EGL_BAD_PARAMETER);
EXPECT_EQ(fd, EGL_NO_NATIVE_FENCE_FD_ANDROID);
}

// Verify CreateSync and ClientWait for EGL_ANDROID_native_fence_sync
TEST_P(EGLSyncTest, AndroidNativeFence_ClientWait)
{
Expand Down

0 comments on commit 4c60a30

Please sign in to comment.