summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2016-05-10 14:56:51 -0400
committerLeo Liu <[email protected]>2016-05-16 16:28:51 -0400
commit758b1bbaa77e5d8ecdea68067e91b4277b2b72fe (patch)
treed195572282c2fce5c3b25972e6efc939a879a6e3 /src/gallium/auxiliary/vl
parent672e8d5e7ee63ebb69ffdc635210f06f68cb4d8a (diff)
vl/dri3: register present events
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/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri3.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 980b3b60996..305bbc68e1a 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -46,6 +46,8 @@ struct vl_dri3_screen
xcb_drawable_t drawable;
uint32_t width, height, depth;
+
+ xcb_special_event_t *special_event;
};
static bool
@@ -53,6 +55,9 @@ dri3_set_drawable(struct vl_dri3_screen *scrn, Drawable drawable)
{
xcb_get_geometry_cookie_t geom_cookie;
xcb_get_geometry_reply_t *geom_reply;
+ xcb_void_cookie_t cookie;
+ xcb_generic_error_t *error;
+ xcb_present_event_t peid;
assert(drawable);
@@ -71,6 +76,26 @@ dri3_set_drawable(struct vl_dri3_screen *scrn, Drawable drawable)
scrn->depth = geom_reply->depth;
free(geom_reply);
+ if (scrn->special_event) {
+ xcb_unregister_for_special_event(scrn->conn, scrn->special_event);
+ scrn->special_event = NULL;
+ }
+
+ peid = xcb_generate_id(scrn->conn);
+ cookie =
+ xcb_present_select_input_checked(scrn->conn, peid, scrn->drawable,
+ XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY |
+ XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY |
+ XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY);
+
+ error = xcb_request_check(scrn->conn, cookie);
+ if (error) {
+ free(error);
+ return false;
+ } else
+ scrn->special_event =
+ xcb_register_for_special_xge(scrn->conn, &xcb_present_id, peid, 0);
+
return true;
}
@@ -132,6 +157,8 @@ vl_dri3_screen_destroy(struct vl_screen *vscreen)
assert(vscreen);
+ if (scrn->special_event)
+ xcb_unregister_for_special_event(scrn->conn, scrn->special_event);
scrn->base.pscreen->destroy(scrn->base.pscreen);
pipe_loader_release(&scrn->base.dev, 1);
FREE(scrn);