Skip to content

Commit 795a5f0

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "Add (support for) EGL_NV_system_time extension."
2 parents ab6d77a + 1b1d73f commit 795a5f0

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

opengl/include/EGL/eglext.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,20 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay
242242
#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */
243243
#endif
244244

245+
/* EGL_NV_system_time
246+
*/
247+
#ifndef EGL_NV_system_time
248+
#define EGL_NV_system_time 1
249+
typedef khronos_int64_t EGLint64NV;
250+
typedef khronos_uint64_t EGLuint64NV;
251+
#ifdef EGL_EGLEXT_PROTOTYPES
252+
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
253+
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
254+
#endif
255+
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)(void);
256+
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
257+
#endif
258+
245259
#ifdef __cplusplus
246260
}
247261
#endif

opengl/libs/EGL/eglApi.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static char const * const sExtensionString =
6262
"EGL_KHR_fence_sync "
6363
"EGL_ANDROID_image_native_buffer "
6464
"EGL_ANDROID_swap_rectangle "
65+
"EGL_NV_system_time "
6566
;
6667

6768
struct extention_map_t {
@@ -80,6 +81,10 @@ static const extention_map_t sExtentionMap[] = {
8081
(__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
8182
{ "eglSetSwapRectangleANDROID",
8283
(__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
84+
{ "eglGetSystemTimeFrequencyNV",
85+
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
86+
{ "eglGetSystemTimeNV",
87+
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
8388
};
8489

8590
// accesses protected by sExtensionMapMutex
@@ -1454,3 +1459,46 @@ EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
14541459
}
14551460
return setError(EGL_BAD_DISPLAY, NULL);
14561461
}
1462+
1463+
// ----------------------------------------------------------------------------
1464+
// NVIDIA extensions
1465+
// ----------------------------------------------------------------------------
1466+
EGLuint64NV eglGetSystemTimeFrequencyNV()
1467+
{
1468+
clearError();
1469+
1470+
if (egl_init_drivers() == EGL_FALSE) {
1471+
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
1472+
}
1473+
1474+
EGLuint64NV ret = 0;
1475+
egl_connection_t* const cnx = &gEGLImpl[IMPL_HARDWARE];
1476+
1477+
if (cnx->dso) {
1478+
if (cnx->egl.eglGetSystemTimeFrequencyNV) {
1479+
return cnx->egl.eglGetSystemTimeFrequencyNV();
1480+
}
1481+
}
1482+
1483+
return setError(EGL_BAD_DISPLAY, 0);;
1484+
}
1485+
1486+
EGLuint64NV eglGetSystemTimeNV()
1487+
{
1488+
clearError();
1489+
1490+
if (egl_init_drivers() == EGL_FALSE) {
1491+
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
1492+
}
1493+
1494+
EGLuint64NV ret = 0;
1495+
egl_connection_t* const cnx = &gEGLImpl[IMPL_HARDWARE];
1496+
1497+
if (cnx->dso) {
1498+
if (cnx->egl.eglGetSystemTimeNV) {
1499+
return cnx->egl.eglGetSystemTimeNV();
1500+
}
1501+
}
1502+
1503+
return setError(EGL_BAD_DISPLAY, 0);;
1504+
}

opengl/libs/EGL/egl_entries.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint,
6262

6363
EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint)
6464
EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface)
65+
66+
/* NVIDIA extensions */
67+
68+
EGL_ENTRY(EGLuint64NV, eglGetSystemTimeFrequencyNV, void)
69+
EGL_ENTRY(EGLuint64NV, eglGetSystemTimeNV, void)

0 commit comments

Comments
 (0)