Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 128118ab authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "Add (support for) EGL_NV_system_time extension."

parents 58d8fec4 1c3d72a2
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -242,6 +242,20 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay
#define EGL_RECORDABLE_ANDROID                  0x3142  /* EGLConfig attribute */
#define EGL_RECORDABLE_ANDROID                  0x3142  /* EGLConfig attribute */
#endif
#endif


/* EGL_NV_system_time
 */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
typedef khronos_int64_t EGLint64NV;
typedef khronos_uint64_t EGLuint64NV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
#endif
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)(void);
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
#endif

#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
+48 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ static char const * const sExtensionString =
        "EGL_KHR_fence_sync "
        "EGL_KHR_fence_sync "
        "EGL_ANDROID_image_native_buffer "
        "EGL_ANDROID_image_native_buffer "
        "EGL_ANDROID_swap_rectangle "
        "EGL_ANDROID_swap_rectangle "
        "EGL_NV_system_time "
        ;
        ;


struct extention_map_t {
struct extention_map_t {
@@ -80,6 +81,10 @@ static const extention_map_t sExtentionMap[] = {
            (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
            (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
    { "eglSetSwapRectangleANDROID",
    { "eglSetSwapRectangleANDROID",
            (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
            (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
    { "eglGetSystemTimeFrequencyNV",
            (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
    { "eglGetSystemTimeNV",
            (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
};
};


// accesses protected by sExtensionMapMutex
// accesses protected by sExtensionMapMutex
@@ -1454,3 +1459,46 @@ EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
    }
    }
    return setError(EGL_BAD_DISPLAY, NULL);
    return setError(EGL_BAD_DISPLAY, NULL);
}
}

// ----------------------------------------------------------------------------
// NVIDIA extensions
// ----------------------------------------------------------------------------
EGLuint64NV eglGetSystemTimeFrequencyNV()
{
    clearError();

    if (egl_init_drivers() == EGL_FALSE) {
        return setError(EGL_BAD_PARAMETER, EGL_FALSE);
    }

    EGLuint64NV ret = 0;
    egl_connection_t* const cnx = &gEGLImpl[IMPL_HARDWARE];

    if (cnx->dso) {
        if (cnx->egl.eglGetSystemTimeFrequencyNV) {
            return cnx->egl.eglGetSystemTimeFrequencyNV();
        }
    }

    return setError(EGL_BAD_DISPLAY, 0);;
}

EGLuint64NV eglGetSystemTimeNV()
{
    clearError();

    if (egl_init_drivers() == EGL_FALSE) {
        return setError(EGL_BAD_PARAMETER, EGL_FALSE);
    }

    EGLuint64NV ret = 0;
    egl_connection_t* const cnx = &gEGLImpl[IMPL_HARDWARE];

    if (cnx->dso) {
        if (cnx->egl.eglGetSystemTimeNV) {
            return cnx->egl.eglGetSystemTimeNV();
        }
    }

    return setError(EGL_BAD_DISPLAY, 0);;
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -62,3 +62,8 @@ EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint,


EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint)
EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint)
EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface)
EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface)

/* NVIDIA extensions */

EGL_ENTRY(EGLuint64NV, eglGetSystemTimeFrequencyNV, void)
EGL_ENTRY(EGLuint64NV, eglGetSystemTimeNV, void)