[Mesa-dev] [PATCH] egl/dri: de-duplicate dri2_load_driver*
Frank Binns
frank.binns at imgtec.com
Tue Feb 5 15:32:20 UTC 2019
Emil Velikov <emil.l.velikov at gmail.com> writes:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> The difference between the tree functions is the list of mandatory
s/tree/three/
With that fixed:
Reviewed-by: Frank Binns <frank.binns at imgtec.com>
> driver extensions. Pass that as an argument to the common helper.
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/egl/drivers/dri2/egl_dri2.c | 45 ++++++++-------------------------
> 1 file changed, 11 insertions(+), 34 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index c98b9a5d18a..e5613ad0286 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -499,8 +499,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;
> @@ -509,7 +510,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;
> }
> @@ -523,43 +524,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
More information about the mesa-dev
mailing list