[Mesa-dev] [RFC] st/mesa: Add both front and back buffers for double-buffer visuals

Boyan Ding boyan.j.ding at gmail.com
Tue Jan 17 13:44:48 UTC 2017


st will only add back buffer attachment to window framebuffer when
visual is in double-buffer mode. However, some applications may
render to front buffer even if they have chosen a double-buffer visual.
In this case, no color buffer will be attached when rendering. i965
handles this case correctly, in which it adds both front and back buffer
attachments. Do the same thing in st.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99116
Signed-off-by: Boyan Ding <boyan.j.ding at gmail.com>
---
 src/mesa/state_tracker/st_manager.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index c3d8286b5a..aa53edfecb 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -417,7 +417,6 @@ st_framebuffer_create(struct st_context *st,
 {
    struct st_framebuffer *stfb;
    struct gl_config mode;
-   gl_buffer_index idx;
 
    if (!stfbi)
       return NULL;
@@ -466,11 +465,12 @@ st_framebuffer_create(struct st_context *st,
    stfb->iface_stamp = p_atomic_read(&stfbi->stamp) - 1;
 
    /* add the color buffer */
-   idx = stfb->Base._ColorDrawBufferIndexes[0];
-   if (!st_framebuffer_add_renderbuffer(stfb, idx)) {
+   if (!st_framebuffer_add_renderbuffer(stfb, BUFFER_FRONT_LEFT)) {
       free(stfb);
       return NULL;
    }
+   if (mode.doubleBufferMode)
+      st_framebuffer_add_renderbuffer(stfb, BUFFER_BACK_LEFT);
 
    st_framebuffer_add_renderbuffer(stfb, BUFFER_DEPTH);
    st_framebuffer_add_renderbuffer(stfb, BUFFER_ACCUM);
-- 
2.11.0



More information about the mesa-dev mailing list