Module: Mesa
Branch: main
Commit: eebea558b7b598359e6364f7a965216fea0fe9b2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eebea558b7b598359e6364f7a965216fea0fe9b2

Author: Yonggang Luo <[email protected]>
Date:   Sat Jul 30 17:28:54 2022 +0800

egl: wire up ANGLE_sync_control_rate

Add eglGetMscRateANGLE prototype into generate file

Signed-off-by: KJ Liew <[email protected]>
Signed-off-by: Térence Clastres <[email protected]>
Signed-off-by: Satadru Pramanik <[email protected]>
Signed-off-by: Yonggang Luo <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17815>

---

 src/egl/generate/eglFunctionList.py |  3 +++
 src/egl/generate/egl_other.xml      |  9 +++++++++
 src/egl/main/eglapi.c               | 23 +++++++++++++++++++++++
 src/egl/main/egldisplay.h           |  1 +
 src/egl/main/egldriver.h            |  3 +++
 src/egl/main/eglentrypoint.h        |  1 +
 6 files changed, 40 insertions(+)

diff --git a/src/egl/generate/eglFunctionList.py 
b/src/egl/generate/eglFunctionList.py
index 6a0bd1696a0..c1777eb7592 100644
--- a/src/egl/generate/eglFunctionList.py
+++ b/src/egl/generate/eglFunctionList.py
@@ -216,6 +216,9 @@ EGL_FUNCTIONS = (
     # EGL_CHROMIUM_get_sync_values
     _eglFunc("eglGetSyncValuesCHROMIUM",             "display"),
 
+    # EGL_ANGLE_sync_control_rate
+    _eglFunc("eglGetMscRateANGLE",                   "display"),
+
     # EGL_ANDROID_native_fence_sync
     _eglFunc("eglDupNativeFenceFDANDROID",           "display"),
 
diff --git a/src/egl/generate/egl_other.xml b/src/egl/generate/egl_other.xml
index fd1be9394f7..74c70ccdbef 100644
--- a/src/egl/generate/egl_other.xml
+++ b/src/egl/generate/egl_other.xml
@@ -68,6 +68,15 @@
             <param><ptype>EGLuint64KHR *</ptype> <name>msc</name></param>
             <param><ptype>EGLuint64KHR *</ptype> <name>sbc</name></param>
         </command>
+
+        <!-- EGL_ANGLE_sync_control_rate -->
+        <command>
+            <proto>EGLBoolean <name>eglGetMscRateANGLE</name></proto>
+            <param><ptype>EGLDisplay</ptype> <name>display</name></param>
+            <param><ptype>EGLSurface</ptype> <name>surface</name></param>
+            <param><ptype>EGLint *</ptype> <name>numerator</name></param>
+            <param><ptype>EGLint *</ptype> <name>denominator</name></param>
+        </command>
     </commands>
 </registry>
 
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 008bc055b64..eb3adf19e14 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -490,6 +490,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
    _EGL_CHECK_EXTENSION(ANDROID_recordable);
 
    _EGL_CHECK_EXTENSION(CHROMIUM_sync_control);
+   _EGL_CHECK_EXTENSION(ANGLE_sync_control_rate);
 
    _EGL_CHECK_EXTENSION(EXT_buffer_age);
    _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
@@ -2369,6 +2370,28 @@ eglGetSyncValuesCHROMIUM(EGLDisplay dpy, EGLSurface 
surface,
    RETURN_EGL_EVAL(disp, ret);
 }
 
+static EGLBoolean EGLAPIENTRY
+eglGetMscRateANGLE(EGLDisplay dpy, EGLSurface surface,
+                    EGLint *numerator, EGLint *denominator)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLSurface *surf = _eglLookupSurface(surface, disp);
+   EGLBoolean ret;
+
+   _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE);
+
+   _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+   if (!disp->Extensions.ANGLE_sync_control_rate)
+      RETURN_EGL_EVAL(disp, EGL_FALSE);
+
+   if (!numerator || !denominator)
+      RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+
+   ret = disp->Driver->GetMscRateANGLE(disp, surf, numerator, denominator);
+
+   RETURN_EGL_EVAL(disp, ret);
+}
+
 static EGLBoolean EGLAPIENTRY
 eglExportDMABUFImageQueryMESA(EGLDisplay dpy, EGLImage image,
                               EGLint *fourcc, EGLint *nplanes,
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index aee9f86a699..3d065f58d04 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -100,6 +100,7 @@ struct _egl_extensions
    EGLBoolean ANDROID_native_fence_sync;
    EGLBoolean ANDROID_recordable;
 
+   EGLBoolean ANGLE_sync_control_rate;
    EGLBoolean CHROMIUM_sync_control;
 
    EGLBoolean EXT_buffer_age;
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 7af0f3ce0cf..242c0f83320 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -181,6 +181,9 @@ struct _egl_driver
                                        EGLuint64KHR *ust, EGLuint64KHR *msc,
                                        EGLuint64KHR *sbc);
 
+   EGLBoolean (*GetMscRateANGLE)(_EGLDisplay *disp, _EGLSurface *surface,
+                                 EGLint *numerator, EGLint *denominator);
+
    /* for EGL_MESA_image_dma_buf_export */
    EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDisplay *disp, _EGLImage *img,
                                             EGLint *fourcc, EGLint *nplanes,
diff --git a/src/egl/main/eglentrypoint.h b/src/egl/main/eglentrypoint.h
index 44e971e023a..dc67301914e 100644
--- a/src/egl/main/eglentrypoint.h
+++ b/src/egl/main/eglentrypoint.h
@@ -45,6 +45,7 @@ EGL_ENTRYPOINT(eglGetDisplay)
 EGL_ENTRYPOINT(eglGetDisplayDriverConfig)
 EGL_ENTRYPOINT(eglGetDisplayDriverName)
 EGL_ENTRYPOINT(eglGetError)
+EGL_ENTRYPOINT(eglGetMscRateANGLE)
 EGL_ENTRYPOINT(eglGetPlatformDisplay)
 EGL_ENTRYPOINT(eglGetPlatformDisplayEXT)
 EGL_ENTRYPOINT(eglGetProcAddress)

Reply via email to