[Mesa-dev] [PATCH 1/3] egl/sl: split out swrast probe into separate function

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 19 13:15:45 UTC 2019


On Mon, 18 Feb 2019 at 16:07, Eric Engestrom <eric.engestrom at intel.com> wrote:
>
> On Tuesday, 2019-02-05 15:31:06 +0000, Emil Velikov wrote:
> > From: Emil Velikov <emil.velikov at collabora.com>
> >
> > Make the code a bit easier to read.
> >
> > As a bonus point this makes it obvious that we forgot to call
> > _eglAddDevice() for the device - do so.
> >
> > Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> > ---
> >  src/egl/drivers/dri2/platform_surfaceless.c | 46 ++++++++++++---------
> >  1 file changed, 27 insertions(+), 19 deletions(-)
> >
> > diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
> > index f9809561611..d6e48ba11b2 100644
> > --- a/src/egl/drivers/dri2/platform_surfaceless.c
> > +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> > @@ -322,25 +322,27 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
> >        dri2_dpy->loader_extensions = NULL;
> >     }
> >
> > -   /* No DRM device, so attempt to fall back to software path w/o DRM. */
> > -   if (swrast) {
> > -      _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without DRM.");
> > -      dri2_dpy->fd = -1;
> > -      dri2_dpy->driver_name = strdup("swrast");
> > -      if (!dri2_dpy->driver_name) {
> > -         return false;
> > -      }
> > +   return false;
> > +}
> >
> > -      if (dri2_load_driver_swrast(dpy)) {
> > -         dri2_dpy->loader_extensions = swrast_loader_extensions;
> > -         return true;
> > -      }
> > +static bool
> > +surfaceless_probe_device_sw(_EGLDisplay *dpy)
>
> Don't forget to rename s/dpy/disp/ :)
>
Fixed.

> > +{
> > +   struct dri2_egl_display *dri2_dpy = dpy->DriverData;
> >
> > -      free(dri2_dpy->driver_name);
> > -      dri2_dpy->driver_name = NULL;
> > -   }
> > +   dri2_dpy->fd = -1;
> > +   dpy->Device = _eglAddDevice(dri2_dpy->fd, true);
> > +   assert(dpy->Device);
> >
> > -   return false;
> > +   dri2_dpy->driver_name = strdup("swrast");
> > +   if (!dri2_dpy->driver_name)
> > +      return false;
> > +
> > +   if (!dri2_load_driver_swrast(dpy))
>
> free(dri2_dpy->driver_name);
>
Ditto.

> With that:
> Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
>
Thank you!

Emil


More information about the mesa-dev mailing list