diff options
author | Emil Velikov <[email protected]> | 2016-08-25 00:51:05 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-10-14 12:46:03 +0100 |
commit | 3948ad82cec3c04d9cb3e06de5456254d644071e (patch) | |
tree | 249607df96e7d6472c0f6df89f45a96d905779ce /src/egl/drivers | |
parent | d5342c6ff241419e287700e4c4e7c1043fd48ffc (diff) |
egl/dri2: use dri2_bind_extensions to manage the optional extensions
v2: dri2_bind_extensions() now takes optional as an argument.
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 4b7baafb496..203517fbc9d 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -395,6 +395,15 @@ static struct dri2_extension_match swrast_core_extensions[] = { { NULL, 0, 0 } }; +static struct dri2_extension_match optional_core_extensions[] = { + { __DRI2_ROBUSTNESS, 1, offsetof(struct dri2_egl_display, robustness) }, + { __DRI2_CONFIG_QUERY, 1, offsetof(struct dri2_egl_display, config) }, + { __DRI2_FENCE, 1, offsetof(struct dri2_egl_display, fence) }, + { __DRI2_RENDERER_QUERY, 1, offsetof(struct dri2_egl_display, rendererQuery) }, + { __DRI2_INTEROP, 1, offsetof(struct dri2_egl_display, interop) }, + { NULL, 0, 0 } +}; + static EGLBoolean dri2_bind_extensions(struct dri2_egl_display *dri2_dpy, struct dri2_extension_match *matches, @@ -686,7 +695,6 @@ dri2_create_screen(_EGLDisplay *disp) { const __DRIextension **extensions; struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - unsigned i; if (dri2_dpy->image_driver) { dri2_dpy->dri_screen = @@ -740,23 +748,7 @@ dri2_create_screen(_EGLDisplay *disp) goto cleanup_dri_screen; } - for (i = 0; extensions[i]; i++) { - if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) { - dri2_dpy->robustness = (__DRIrobustnessExtension *) extensions[i]; - } - if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) { - dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i]; - } - if (strcmp(extensions[i]->name, __DRI2_FENCE) == 0) { - dri2_dpy->fence = (__DRI2fenceExtension *) extensions[i]; - } - if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) { - dri2_dpy->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i]; - } - if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0) - dri2_dpy->interop = (__DRI2interopExtension *) extensions[i]; - } - + dri2_bind_extensions(dri2_dpy, optional_core_extensions, extensions, true); dri2_setup_screen(disp); return EGL_TRUE; |