[Piglit] [PATCH 1/2] egl: Add sanity test for EGL_EXT_device_query (v2)

Emil Velikov emil.l.velikov at gmail.com
Fri Jul 22 16:00:41 UTC 2016


On 22 July 2016 at 16:17, Adam Jackson <ajax at redhat.com> wrote:

> +       EGLBoolean (*queryDisplayAttrib)(EGLDisplay dpy, EGLint name,
> +                                        EGLAttrib *value);
> +       const char *(*queryDeviceString)(EGLDisplay dpy, EGLint name);
> +       EGLBoolean (*queryDeviceAttrib)(EGLDeviceEXT dev, EGLint name,
> +                                       EGLAttrib *value);
> +
Since we already depend on 'new enough' headers for EGLDeviceEXT you
can use PFNEGLQUERYDEVICEATTRIBEXTPROC and friends. This has the added
benefit of being Windows friendly, if one is building/using libEGL for
the platform - iirc some versions of the Android emulator did.


> +       if (queryDisplayAttrib(EGL_NO_DISPLAY, EGL_DEVICE_EXT,
> +                              (EGLAttrib *)&device) == EGL_TRUE) {
Don't see the spec mentioning this, but I would make perfect sense.

> +               printf("Display query succeeded before EGL initialized\n");
s/before EGL initialized/with EGL_NO_DISPLAY/ ?

This one isn't covered in the spec either. From mesa POV we won't be
able to get the device if eglInitialize hasn't been called but it
might be worth checking with Khronos/the author(s) and tweak the spec
text ?

> +       dpy = eglGetDisplay(NULL);
> +       if (!dpy) {
> +               printf("failed to get EGLDisplay\n");
> +               piglit_report_result(PIGLIT_SKIP);
> +       }
> +
> +       if (!eglInitialize(dpy, &egl_major, &egl_minor)) {
> +               printf("eglInitialize failed\n");
> +               piglit_report_result(PIGLIT_FAIL);
> +       }
> +
> +       if (queryDisplayAttrib(dpy, 0xbad1dea, (EGLAttrib *)&device)
> +           == EGL_TRUE) {
Please drop the == EGL_{TRUE,FALSE} hunks

> +               printf("Successfully queried for a bogus attribute\n");
> +               piglit_report_result(PIGLIT_FAIL);
> +       } else {
> +               error = eglGetError();
Use piglit_check_egl_error over the direct eglGetError calls ?

Regards,
Emil


More information about the Piglit mailing list