diff options
author | Emil Velikov <[email protected]> | 2016-08-25 00:16:01 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-10-14 12:45:24 +0100 |
commit | 38526bd4688a10385df1963458e8c6aded552653 (patch) | |
tree | 8c4fa857d049cf453da4852115dbc6692a00b3af /src | |
parent | ebc68e38491b7bea61e964521d41ba6b2a127546 (diff) |
egl/dri2: add support for optional extensions in dri2_bind_extensions()
Will allow us to reuse the function for optional extensions and fold a
bit of code.
v2: Make dri2_bind_extensions::optional flag an argument to
dri2_bind_extensions (Kristian).
Cc: Rob Clark <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 1de62db2861..4b7baafb496 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -398,7 +398,8 @@ static struct dri2_extension_match swrast_core_extensions[] = { static EGLBoolean dri2_bind_extensions(struct dri2_egl_display *dri2_dpy, struct dri2_extension_match *matches, - const __DRIextension **extensions) + const __DRIextension **extensions, + bool optional) { int i, j, ret = EGL_TRUE; void *field; @@ -419,9 +420,14 @@ dri2_bind_extensions(struct dri2_egl_display *dri2_dpy, for (j = 0; matches[j].name; j++) { field = ((char *) dri2_dpy + matches[j].offset); if (*(const __DRIextension **) field == NULL) { - _eglLog(_EGL_WARNING, "did not find extension %s version %d", - matches[j].name, matches[j].version); - ret = EGL_FALSE; + if (optional) { + _eglLog(_EGL_DEBUG, "did not find optional extension %s version %d", + matches[j].name, matches[j].version); + } else { + _eglLog(_EGL_WARNING, "did not find extension %s version %d", + matches[j].name, matches[j].version); + ret = EGL_FALSE; + } } } @@ -522,7 +528,7 @@ dri2_load_driver_dri3(_EGLDisplay *disp) if (!extensions) return EGL_FALSE; - if (!dri2_bind_extensions(dri2_dpy, dri3_driver_extensions, extensions)) { + if (!dri2_bind_extensions(dri2_dpy, dri3_driver_extensions, extensions, false)) { dlclose(dri2_dpy->driver); return EGL_FALSE; } @@ -541,7 +547,7 @@ dri2_load_driver(_EGLDisplay *disp) if (!extensions) return EGL_FALSE; - if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) { + if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions, false)) { dlclose(dri2_dpy->driver); return EGL_FALSE; } @@ -560,7 +566,7 @@ dri2_load_driver_swrast(_EGLDisplay *disp) if (!extensions) return EGL_FALSE; - if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) { + if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions, false)) { dlclose(dri2_dpy->driver); return EGL_FALSE; } @@ -726,11 +732,11 @@ dri2_create_screen(_EGLDisplay *disp) extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen); if (dri2_dpy->image_driver || dri2_dpy->dri2) { - if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions)) + if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions, false)) goto cleanup_dri_screen; } else { assert(dri2_dpy->swrast); - if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions)) + if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions, false)) goto cleanup_dri_screen; } |