[Mesa-dev,10/15] egl: add eglWaitSync

Submitted by Marek Olšák on May 12, 2015, 10:54 p.m.

Details

Message ID 1431471290-7299-11-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák May 12, 2015, 10:54 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/egl/main/eglapi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 60df297..544f7e4 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1162,6 +1162,7 @@  eglGetProcAddress(const char *procname)
       { "eglDestroySync", (_EGLProc) eglDestroySync },
       { "eglClientWaitSync", (_EGLProc) eglClientWaitSync },
       { "eglDestroyImage", (_EGLProc) eglDestroyImage },
+      { "eglWaitSync", (_EGLProc) eglWaitSync },
 #endif /* _EGL_GET_CORE_ADDRESSES */
 #ifdef EGL_MESA_drm_display
       { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
@@ -1514,6 +1515,17 @@  eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
 
 
 EGLBoolean EGLAPIENTRY
+eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+   /* The KHR version returns EGLint, while the core version returns
+    * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
+    * EGL_TRUE.
+    */
+   return eglWaitSyncKHR(dpy, sync, flags);
+}
+
+
+EGLBoolean EGLAPIENTRY
 eglSignalSyncKHR(EGLDisplay dpy, EGLSync sync, EGLenum mode)
 {
    _EGLDisplay *disp = _eglLockDisplay(dpy);

Comments

On 12/05/15 22:54, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak@amd.com>
> 
> ---
>  src/egl/main/eglapi.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 60df297..544f7e4 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1162,6 +1162,7 @@ eglGetProcAddress(const char *procname)
>        { "eglDestroySync", (_EGLProc) eglDestroySync },
>        { "eglClientWaitSync", (_EGLProc) eglClientWaitSync },
>        { "eglDestroyImage", (_EGLProc) eglDestroyImage },
> +      { "eglWaitSync", (_EGLProc) eglWaitSync },
>  #endif /* _EGL_GET_CORE_ADDRESSES */
>  #ifdef EGL_MESA_drm_display
>        { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
> @@ -1514,6 +1515,17 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
>  
>  
>  EGLBoolean EGLAPIENTRY
> +eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
> +{
> +   /* The KHR version returns EGLint, while the core version returns
> +    * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
> +    * EGL_TRUE.
> +    */
> +   return eglWaitSyncKHR(dpy, sync, flags);
Maybe add the cast, considering that sizeof(EGLenum) != sizeof(EGLInt)
on 64 bit systems.

Thinking about the assembly - not sure if won't end up with pushing a
64bit value, while a 32bit one being popped. My x86 assembly days were
mostly before x86_64 became a thing so ^^ might sound a bit stupid :)

-Emil
On Fri, May 15, 2015 at 1:23 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> On 12/05/15 22:54, Marek Olšák wrote:
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> ---
>>  src/egl/main/eglapi.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
>> index 60df297..544f7e4 100644
>> --- a/src/egl/main/eglapi.c
>> +++ b/src/egl/main/eglapi.c
>> @@ -1162,6 +1162,7 @@ eglGetProcAddress(const char *procname)
>>        { "eglDestroySync", (_EGLProc) eglDestroySync },
>>        { "eglClientWaitSync", (_EGLProc) eglClientWaitSync },
>>        { "eglDestroyImage", (_EGLProc) eglDestroyImage },
>> +      { "eglWaitSync", (_EGLProc) eglWaitSync },
>>  #endif /* _EGL_GET_CORE_ADDRESSES */
>>  #ifdef EGL_MESA_drm_display
>>        { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
>> @@ -1514,6 +1515,17 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
>>
>>
>>  EGLBoolean EGLAPIENTRY
>> +eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
>> +{
>> +   /* The KHR version returns EGLint, while the core version returns
>> +    * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
>> +    * EGL_TRUE.
>> +    */
>> +   return eglWaitSyncKHR(dpy, sync, flags);
> Maybe add the cast, considering that sizeof(EGLenum) != sizeof(EGLInt)
> on 64 bit systems.
>
> Thinking about the assembly - not sure if won't end up with pushing a
> 64bit value, while a 32bit one being popped. My x86 assembly days were
> mostly before x86_64 became a thing so ^^ might sound a bit stupid :)

It's EGLBoolean, not EGLenum. Also, no cast is needed between basic types.

typedef int32_t khronos_int32_t;
typedef khronos_int32_t EGLint;
typedef unsigned int EGLBoolean;

The types are equivalent on 32-bit and 64-bit, so I could have just
made eglWaitSyncKHR be an alias of eglWaitSync and it would work, but
I wanted to document this in the code.

Marek
On 15/05/15 16:18, Marek Olšák wrote:
> On Fri, May 15, 2015 at 1:23 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> On 12/05/15 22:54, Marek Olšák wrote:
>>> From: Marek Olšák <marek.olsak@amd.com>
>>>
>>> ---
>>>  src/egl/main/eglapi.c | 12 ++++++++++++
>>>  1 file changed, 12 insertions(+)
>>>
>>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
>>> index 60df297..544f7e4 100644
>>> --- a/src/egl/main/eglapi.c
>>> +++ b/src/egl/main/eglapi.c
>>> @@ -1162,6 +1162,7 @@ eglGetProcAddress(const char *procname)
>>>        { "eglDestroySync", (_EGLProc) eglDestroySync },
>>>        { "eglClientWaitSync", (_EGLProc) eglClientWaitSync },
>>>        { "eglDestroyImage", (_EGLProc) eglDestroyImage },
>>> +      { "eglWaitSync", (_EGLProc) eglWaitSync },
>>>  #endif /* _EGL_GET_CORE_ADDRESSES */
>>>  #ifdef EGL_MESA_drm_display
>>>        { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
>>> @@ -1514,6 +1515,17 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
>>>
>>>
>>>  EGLBoolean EGLAPIENTRY
>>> +eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
>>> +{
>>> +   /* The KHR version returns EGLint, while the core version returns
>>> +    * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
>>> +    * EGL_TRUE.
>>> +    */
>>> +   return eglWaitSyncKHR(dpy, sync, flags);
>> Maybe add the cast, considering that sizeof(EGLenum) != sizeof(EGLInt)
>> on 64 bit systems.
>>
>> Thinking about the assembly - not sure if won't end up with pushing a
>> 64bit value, while a 32bit one being popped. My x86 assembly days were
>> mostly before x86_64 became a thing so ^^ might sound a bit stupid :)
> 
> It's EGLBoolean, not EGLenum. Also, no cast is needed between basic types.
> 
> typedef int32_t khronos_int32_t;
> typedef khronos_int32_t EGLint;
> typedef unsigned int EGLBoolean;
> 
> The types are equivalent on 32-bit and 64-bit, so I could have just
> made eglWaitSyncKHR be an alias of eglWaitSync and it would work, but
> I wanted to document this in the code.
> 
Had a bit of a brain fart. Pardon for the noise.

-Emil
On Fri 15 May 2015, Emil Velikov wrote:
> On 15/05/15 16:18, Marek Olšák wrote:
> > On Fri, May 15, 2015 at 1:23 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> >> On 12/05/15 22:54, Marek Olšák wrote:
> >>> From: Marek Olšák <marek.olsak@amd.com>
> >>>
> >>> ---
> >>>  src/egl/main/eglapi.c | 12 ++++++++++++
> >>>  1 file changed, 12 insertions(+)
> >>>
> >>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> >>> index 60df297..544f7e4 100644
> >>> --- a/src/egl/main/eglapi.c
> >>> +++ b/src/egl/main/eglapi.c
> >>> @@ -1162,6 +1162,7 @@ eglGetProcAddress(const char *procname)
> >>>        { "eglDestroySync", (_EGLProc) eglDestroySync },
> >>>        { "eglClientWaitSync", (_EGLProc) eglClientWaitSync },
> >>>        { "eglDestroyImage", (_EGLProc) eglDestroyImage },
> >>> +      { "eglWaitSync", (_EGLProc) eglWaitSync },
> >>>  #endif /* _EGL_GET_CORE_ADDRESSES */
> >>>  #ifdef EGL_MESA_drm_display
> >>>        { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
> >>> @@ -1514,6 +1515,17 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
> >>>
> >>>
> >>>  EGLBoolean EGLAPIENTRY
> >>> +eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
> >>> +{
> >>> +   /* The KHR version returns EGLint, while the core version returns
> >>> +    * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
> >>> +    * EGL_TRUE.
> >>> +    */
> >>> +   return eglWaitSyncKHR(dpy, sync, flags);
> >> Maybe add the cast, considering that sizeof(EGLenum) != sizeof(EGLInt)
> >> on 64 bit systems.
> >>
> >> Thinking about the assembly - not sure if won't end up with pushing a
> >> 64bit value, while a 32bit one being popped. My x86 assembly days were
> >> mostly before x86_64 became a thing so ^^ might sound a bit stupid :)
> > 
> > It's EGLBoolean, not EGLenum. Also, no cast is needed between basic types.
> > 
> > typedef int32_t khronos_int32_t;
> > typedef khronos_int32_t EGLint;
> > typedef unsigned int EGLBoolean;
> > 
> > The types are equivalent on 32-bit and 64-bit, so I could have just
> > made eglWaitSyncKHR be an alias of eglWaitSync and it would work, but
> > I wanted to document this in the code.
> > 
> Had a bit of a brain fart. Pardon for the noise.

Since eglWaitSyncKHR returns only EGL_TRUE or EGL_FALSE, this patch
looks good to me.
Reviewed-by: Chad Versace <chad.versace@intel.com>