[Mesa-dev] [PATCH 1/2] swrast: Avoid creating front buffers with __DRI_SWRAST_LOADER < 3.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Thu Jun 6 11:10:47 UTC 2019

From: Mathias Fröhlich <mathias.froehlich at web.de>

Align classic swrast with galliums software renderer with respect
to front buffer creation.
In case of front buffers swrast uses the __DRI_SWRAST_LOADER extensions
getImage/putImage callbacks to keep the front buffer in sync between
the X server and the mesa software rendering. Gallium sofware rasterizers
only allocates front buffers if the __DRI_SWRAST_LOADER extension version
is >= 3. By that the getImage/putImage NULL pointers of the recent
EGL_platform_device, which announces __DRI_SWRAST_LOADER version 1, are
never called and thus this combination works fine.
The change makes classic swrast work together with EGL_platform_device
by using the same __DRI_SWRAST_LOADER version check than egl.
For reference see drisw_allocate_textures in

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
 src/mesa/drivers/dri/swrast/swrast.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 8e8d6bd628e..832a45f1d88 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -572,7 +572,10 @@ dri_create_buffer(__DRIscreen * sPriv,
     _mesa_initialize_window_framebuffer(fb, visual);

     /* add front renderbuffer */
-    frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
+    if (sPriv->swrast_loader->base.version >= 3)
+       frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
+    else
+       frontrb = swrast_new_renderbuffer(visual, dPriv, GL_FALSE);
     _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);

     /* add back renderbuffer */

More information about the mesa-dev mailing list