st/mesa: don't flush the front buffer if it's a pbuffer
authorMarek Olšák <marek.olsak@amd.com>
Sat, 27 Apr 2019 02:51:33 +0000 (22:51 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 2 May 2019 01:15:33 +0000 (21:15 -0400)
This is the best guess I can make here.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/mesa/state_tracker/st_manager.c

index 5efbd1fa1d25c677e7501c75c85a5c18a5b96199..bee1f6b1366cf130326a0d9d927fee53505d7f82 100644 (file)
@@ -1130,9 +1130,19 @@ st_manager_flush_frontbuffer(struct st_context *st)
    struct st_framebuffer *stfb = st_ws_framebuffer(st->ctx->DrawBuffer);
    struct st_renderbuffer *strb = NULL;
 
-   if (stfb)
-      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].
-                             Renderbuffer);
+   if (!stfb)
+      return;
+
+   /* If the context uses a doublebuffered visual, but the buffer is
+    * single-buffered, guess that it's a pbuffer, which doesn't need
+    * flushing.
+    */
+   if (st->ctx->Visual.doubleBufferMode &&
+       !stfb->Base.Visual.doubleBufferMode)
+      return;
+
+   strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].
+                          Renderbuffer);
 
    /* Do we have a front color buffer and has it been drawn to since last
     * frontbuffer flush?