On 22 February 2018 at 14:33, Chuck Atkins <chuck.atk...@kitware.com> wrote: > This fixes a segfault exposed by a29d63ecf7 which occurs when swr is > used on an unsupported architecture. > > v2: re-work to place logic in xmesa_init_display > > Signed-off-by: Chuck Atkins <chuck.atk...@kitware.com> > Cc: mesa-sta...@lists.freedesktop.org > Cc: George Kyriazis <george.kyria...@intel.com> > Cc: Bruce Cherniak <bruce.chern...@intel.com> FWIW Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>
> --- > src/gallium/state_trackers/glx/xlib/glx_api.c | 5 ++- > src/gallium/state_trackers/glx/xlib/xm_api.c | 56 > +++++++++++++-------------- > src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +- > 3 files changed, 33 insertions(+), 30 deletions(-) > > diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c > b/src/gallium/state_trackers/glx/xlib/glx_api.c > index 1994e6823a..6ec3a31d5f 100644 > --- a/src/gallium/state_trackers/glx/xlib/glx_api.c > +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c > @@ -743,7 +743,10 @@ choose_visual( Display *dpy, int screen, const int > *list, GLboolean fbConfig ) > int numAux = 0; > GLint num_samples = 0; > > - xmesa_init( dpy ); > + if (xmesa_init( dpy ) != 0) { > + _mesa_warning(NULL, "Failed to initialize display"); > + return NULL; > + } > > parselist = list; > > diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c > b/src/gallium/state_trackers/glx/xlib/xm_api.c > index 934c0aba11..e8cbb618ce 100644 > --- a/src/gallium/state_trackers/glx/xlib/xm_api.c > +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c > @@ -142,8 +142,11 @@ xmesa_close_display(Display *display) > { > XMesaExtDisplayInfo *info, *prev; > > + /* These assertions are not valid since screen creation can fail and > result > + * in an empty list > assert(MesaExtInfo.ndisplays > 0); > assert(MesaExtInfo.head); > + */ > Gut feeling suggests that this and perhaps the choose_visual() hunks are signs of other preexisting bugs. If you decide to stick around with xlib-glx it is worth nuking the XMesa abstraction/API. It hasn't been used in ages, it will help you simplify the whole thing and squash a lot more lurking bugs. HTH Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev