[waffle] [PATCH 10/12] egl: implement platform-specific information

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 24 20:35:27 UTC 2016


On 24 April 2016 at 20:52, Frank Henigman <fjhenigman at google.com> wrote:
> On Sat, Apr 23, 2016 at 2:51 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 21 April 2016 at 21:27, Frank Henigman <fjhenigman at google.com> wrote:
>>> On Fri, Jan 8, 2016 at 7:50 AM, Emil Velikov <emil.l.velikov at gmail.com>
>>> wrote:
>>>> On 6 January 2016 at 21:56, Frank Henigman <fjhenigman at google.com> wrote:
>>>>> Implement the platform hook of waffle_display_info_json() so it can
>>>>> pick up egl-specific information.
>>>>>
>>>>> Signed-off-by: Frank Henigman <fjhenigman at google.com>
>>>>> ---
>>>>>  src/waffle/egl/wegl_display.c  | 32 ++++++++++++++++++++++++++++++--
>>>>>  src/waffle/egl/wegl_display.h  |  4 ++++
>>>>>  src/waffle/egl/wegl_platform.h |  3 +++
>>>>>  3 files changed, 37 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/src/waffle/egl/wegl_display.c
>>>>> b/src/waffle/egl/wegl_display.c
>>>>> index 88fce7a..dcfe934 100644
>>>>> --- a/src/waffle/egl/wegl_display.c
>>>>> +++ b/src/waffle/egl/wegl_display.c
>>>>> @@ -25,6 +25,8 @@
>>>>>
>>>>>  #include <assert.h>
>>>>>
>>>>> +#include "json.h"
>>>>> +
>>>>>  #include "wcore_error.h"
>>>>>  #include "wcore_platform.h"
>>>>>
>>>>> @@ -63,7 +65,6 @@ wegl_display_init(struct wegl_display *dpy,
>>>>>  {
>>>>>      struct wegl_platform *plat = wegl_platform(wc_plat);
>>>>>      bool ok;
>>>>> -    EGLint major, minor;
>>>>>
>>>>>      ok = wcore_display_init(&dpy->wcore, wc_plat);
>>>>>      if (!ok)
>>>>> @@ -75,7 +76,7 @@ wegl_display_init(struct wegl_display *dpy,
>>>>>          goto fail;
>>>>>      }
>>>>>
>>>>> -    ok = plat->eglInitialize(dpy->egl, &major, &minor);
>>>>> +    ok = plat->eglInitialize(dpy->egl, &plat->major, &plat->minor);
>>>>>      if (!ok) {
>>>>>          wegl_emit_error(plat, "eglInitialize");
>>>>>          goto fail;
>>>>> @@ -139,3 +140,30 @@ wegl_display_supports_context_api(struct
>>>>> wcore_display *wc_dpy,
>>>>>
>>>>>      return wc_plat->vtbl->dl_can_open(wc_plat, waffle_dl);
>>>>>  }
>>>>> +
>>>>> +void
>>>>> +wegl_display_info_json(struct wcore_display *wc_dpy, struct json *jj)
>>>>> +{
>>>>> +    struct wegl_display *dpy = wegl_display(wc_dpy);
>>>>> +    struct wegl_platform *plat = wegl_platform(dpy->wcore.platform);
>>>>> +
>>>>> +    const char *version = plat->eglQueryString(dpy->egl, EGL_VERSION);
>>>>> +    const char *vendor = plat->eglQueryString(dpy->egl, EGL_VENDOR);
>>>>> +#ifdef EGL_VERSION_1_2
>>>>> +    const char *apis = plat->eglQueryString(dpy->egl, EGL_CLIENT_APIS);
>>>>> +#endif
>>>> I would suggesting adding the define on top ifndef EGL_VERSION_1_2,
>>>> and dropping the checks here and below.
>>>
>>> Sorry, not sure what you mean by this.  It sounds like skipping the
>>> whole thing ifndef EGL_VERSION_1_2 ?  And that's ok because no one
>>> uses <= 1.2 anymore?
>>
>> Was talking about adding the following at the top:
>>
>> #ifndef EGL_VERSION_1_2
>> #define EGL_CLIENT_APIS XXX
>> #endif
>>
>> Then again, I have to fully agree with you here. I doubt that there are
>> (m)any pre 1.2 EGL implementations let alone testing those with waffle.
>> I would just drop the guard.
>
> I'm feeling exceptionally slow.  I still don't see (if we care about
> egl <= 1.2) how to avoid a guard around eglQueryString(dpy,
> EGL_CLIENT_APIS).  What is XXX?
XXX is the numerical value that the macro should hold. I was lazy
enough to grep it.

The thing I'm talking about is a common practise for dEQP and piglit
(to a point) amongst others. Here is an example:

$ cat fancy_app.c

#include ...
#include <EGL/egl.h>

#ifndef EGL_VERSION_1_2 // or you can check EGL_CLIENT_APIS
#define EGL_CLIENT_APIS                   0x308D
#endif

/* some code */

  // Just use the pname. If it's invalid (old implementation) we'll
get EGL_BAD_PARAMETER.
  // Otherwise we are restricting our runtime, based on a compile time
decision (outdated header).
  bar = eglQueryString(dpy, EGL_CLIENT_APIS);

/* rest of the file */

Regards,
Emil


More information about the waffle mailing list