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