summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2016-04-25 14:37:57 -0400
committerLeo Liu <[email protected]>2016-05-16 16:28:51 -0400
commitb0bd908284d2b5e6d7c6e3967bedb62f04e1b206 (patch)
tree686d69351b04c3996f9691b0b08c055fde39a1c6 /src/gallium/auxiliary
parente1223282dbfbce82072ac6ae6de182ebd60cd1c4 (diff)
vl/dri3: implement function for flush frontbuffer
Request drawable content in pixmap by calling DRI3 PresentPixmap, and handle PresentIdleNotify event. Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri3.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 63bb408fdd2..afab85acad0 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -96,7 +96,15 @@ dri3_handle_present_event(struct vl_dri3_screen *scrn,
break;
}
case XCB_PRESENT_EVENT_IDLE_NOTIFY: {
- /* TODO */
+ xcb_present_idle_notify_event_t *ie = (void *) ge;
+ int b;
+ for (b = 0; b < BACK_BUFFER_NUM; b++) {
+ struct vl_dri3_buffer *buf = scrn->back_buffers[b];
+ if (buf && buf->pixmap == ie->pixmap) {
+ buf->busy = false;
+ break;
+ }
+ }
break;
}
}
@@ -310,7 +318,27 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box)
{
- /* TODO */
+ struct vl_dri3_screen *scrn = (struct vl_dri3_screen *)context_private;
+ uint32_t options = XCB_PRESENT_OPTION_NONE;
+ struct vl_dri3_buffer *back;
+
+ back = scrn->back_buffers[scrn->cur_back];
+ if (!back)
+ return;
+
+ xshmfence_reset(back->shm_fence);
+ back->busy = true;
+
+ xcb_present_pixmap(scrn->conn,
+ scrn->drawable,
+ back->pixmap,
+ 0, 0, 0, 0, 0,
+ None, None,
+ back->sync_fence,
+ options, 0, 0, 0, 0, NULL);
+
+ xcb_flush(scrn->conn);
+
return;
}