diff options
author | Emil Velikov <[email protected]> | 2019-02-05 15:19:46 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2019-02-26 11:07:23 +0000 |
commit | 9d84a922b86e371e53b44baeb49cabfff28f2bc1 (patch) | |
tree | 4edc3e2b986760b92a87aaf3acf626204ccffb3a /src/egl/drivers/dri2 | |
parent | 4924dfc851e52c383380ae56be4d8606684ead7c (diff) |
egl/dri: de-duplicate dri2_load_driver*
The difference between the three functions is the list of mandatory
driver extensions. Pass that as an argument to the common helper.
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Frank Binns <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 0f417e571bb..8721e67afb3 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -513,8 +513,9 @@ dri2_open_driver(_EGLDisplay *disp) search_path_vars); } -EGLBoolean -dri2_load_driver_dri3(_EGLDisplay *disp) +static EGLBoolean +dri2_load_driver_common(_EGLDisplay *disp, + const struct dri2_extension_match *driver_extensions) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); const __DRIextension **extensions; @@ -523,7 +524,7 @@ dri2_load_driver_dri3(_EGLDisplay *disp) if (!extensions) return EGL_FALSE; - if (!dri2_bind_extensions(dri2_dpy, dri3_driver_extensions, extensions, false)) { + if (!dri2_bind_extensions(dri2_dpy, driver_extensions, extensions, false)) { dlclose(dri2_dpy->driver); return EGL_FALSE; } @@ -537,43 +538,19 @@ dri2_load_driver_dri3(_EGLDisplay *disp) EGLBoolean dri2_load_driver(_EGLDisplay *disp) { - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - const __DRIextension **extensions; - - extensions = dri2_open_driver(disp); - if (!extensions) - return EGL_FALSE; - - if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions, false)) { - dlclose(dri2_dpy->driver); - return EGL_FALSE; - } - dri2_dpy->driver_extensions = extensions; - - dri2_bind_extensions(dri2_dpy, optional_driver_extensions, extensions, true); + return dri2_load_driver_common(disp, dri2_driver_extensions); +} - return EGL_TRUE; +EGLBoolean +dri2_load_driver_dri3(_EGLDisplay *disp) +{ + return dri2_load_driver_common(disp, dri3_driver_extensions); } EGLBoolean dri2_load_driver_swrast(_EGLDisplay *disp) { - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - const __DRIextension **extensions; - - extensions = dri2_open_driver(disp); - if (!extensions) - return EGL_FALSE; - - if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions, false)) { - dlclose(dri2_dpy->driver); - return EGL_FALSE; - } - dri2_dpy->driver_extensions = extensions; - - dri2_bind_extensions(dri2_dpy, optional_driver_extensions, extensions, true); - - return EGL_TRUE; + return dri2_load_driver_common(disp, swrast_driver_extensions); } static unsigned |