[Mesa-dev] [PATCH] mesa: Prevent classic swrast crash on a surfaceless context v2.

Mathias Fröhlich Mathias.Froehlich at gmx.net
Tue May 28 06:32:00 UTC 2019


Pushed that.
Thanks!
best
Mathias

On Monday, 27 May 2019 17:34:29 CEST Marek Olšák wrote:
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
> 
> M.
> 
> On Mon, May 27, 2019, 4:17 AM <Mathias.Froehlich at gmx.net> wrote:
> 
> > From: Mathias Fröhlich <mathias.froehlich at web.de>
> >
> > Hi Emil,
> >
> > thanks for that hint to look at _mesa_get_incomplete_framebuffer.
> > That one seems definitely more appropriate!
> >
> > Though, I miss a bit the idea how I can create either a sensible
> > helper function for that task or how I can create something above
> > in the call stack to the MakeCurrent call that already catches
> > this case. Since that incomplete framebuffer is a mesa side thing I
> > cannot easily pull that above the __DriverAPIRec::MakeCurrent call.
> > But really putting those hand full lines of code into a helper does
> > as well not gain much. So I implemented that for the swrast case
> > directly.
> >
> > So, to mention, I sent that change including our egl device code
> > with some unrelated egl device fixes through intels CI and did not
> > get regressions.
> >
> > please review
> >
> > thanks and best
> > Mathias
> >
> >
> >
> >
> >
> > This fixes the egl_mesa_platform_surfaceless piglit test as well
> > as the new device egl extensions piglit test on classic swrast.
> >
> > v2: Fix swrast surfaceless contexts on the driver side.
> >
> > Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> > ---
> >  src/mesa/drivers/dri/swrast/swrast.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/drivers/dri/swrast/swrast.c
> > b/src/mesa/drivers/dri/swrast/swrast.c
> > index 36cf11334cb..4899fb2df95 100644
> > --- a/src/mesa/drivers/dri/swrast/swrast.c
> > +++ b/src/mesa/drivers/dri/swrast/swrast.c
> > @@ -36,6 +36,7 @@
> >  #include "main/api_exec.h"
> >  #include "main/context.h"
> >  #include "main/extensions.h"
> > +#include "main/fbobject.h"
> >  #include "main/formats.h"
> >  #include "main/framebuffer.h"
> >  #include "main/imports.h"
> > @@ -686,7 +687,7 @@ swrast_check_and_update_window_size( struct gl_context
> > *ctx, struct gl_framebuff
> >  {
> >      GLsizei width, height;
> >
> > -    if (!fb)
> > +    if (!fb || fb == _mesa_get_incomplete_framebuffer())
> >          return;
> >
> >      get_window_size(fb, &width, &height);
> > @@ -884,6 +885,12 @@ dri_make_current(__DRIcontext * cPriv,
> >             mesaDraw = &draw->Base;
> >             mesaRead = &read->Base;
> >          }
> > +        else {
> > +           struct gl_framebuffer *incomplete
> > +              = _mesa_get_incomplete_framebuffer();
> > +           mesaDraw = incomplete;
> > +           mesaRead = incomplete;
> > +        }
> >
> >          /* check for same context and buffer */
> >          if (mesaCtx == _mesa_get_current_context()
> > --
> > 2.21.0
> >
> >
> 






More information about the mesa-dev mailing list