Lines Matching refs:scrn
81 vl_dri2_handle_stamps(struct vl_dri_screen *scrn,
88 if (scrn->last_ust && (ust > scrn->last_ust) &&
89 scrn->last_msc && (msc > scrn->last_msc))
90 scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
92 scrn->last_ust = ust;
93 scrn->last_msc = msc;
97 vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
101 assert(scrn);
103 if (!scrn->flushed)
106 scrn->flushed = false;
108 free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
110 wait_sbc_reply = xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL);
113 vl_dri2_handle_stamps(scrn, wait_sbc_reply->ust_hi, wait_sbc_reply->ust_lo,
117 return xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL);
126 struct vl_dri_screen *scrn = (struct vl_dri_screen *)context_private;
133 free(vl_dri2_get_flush_reply(scrn));
135 msc_hi = scrn->next_msc >> 32;
136 msc_lo = scrn->next_msc & 0xFFFFFFFF;
138 scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable,
140 scrn->wait_cookie = xcb_dri2_wait_sbc_unchecked(scrn->conn, scrn->drawable, 0, 0);
141 scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable,
144 scrn->flushed = true;
145 scrn->current_buffer = !scrn->current_buffer;
149 vl_dri2_destroy_drawable(struct vl_dri_screen *scrn)
152 if (scrn->drawable) {
153 free(vl_dri2_get_flush_reply(scrn));
154 destroy_cookie = xcb_dri2_destroy_drawable_checked(scrn->conn, scrn->drawable);
156 free(xcb_request_check(scrn->conn, destroy_cookie));
161 vl_dri2_set_drawable(struct vl_dri_screen *scrn, Drawable drawable)
163 assert(scrn);
166 if (scrn->drawable == drawable)
169 vl_dri2_destroy_drawable(scrn);
171 xcb_dri2_create_drawable(scrn->conn, drawable);
172 scrn->current_buffer = false;
173 vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
174 vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
175 scrn->drawable = drawable;
181 struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
191 assert(scrn);
193 vl_dri2_set_drawable(scrn, (Drawable)drawable);
194 reply = vl_dri2_get_flush_reply(scrn);
197 cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, (Drawable)drawable,
199 reply = xcb_dri2_get_buffers_reply(scrn->conn, cookie, NULL);
222 if (reply->width != scrn->width || reply->height != scrn->height) {
223 vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
224 vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
225 scrn->width = reply->width;
226 scrn->height = reply->height;
228 } else if (back_left->name != scrn->buffer_names[scrn->current_buffer]) {
229 vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->current_buffer]);
230 scrn->buffer_names[scrn->current_buffer] = back_left->name;
250 tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &templ,
261 struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
262 assert(scrn);
263 return &scrn->dirty_areas[scrn->current_buffer];
269 struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
273 assert(scrn);
275 vl_dri2_set_drawable(scrn, (Drawable)drawable);
276 if (!scrn->last_ust) {
277 cookie = xcb_dri2_get_msc_unchecked(scrn->conn, (Drawable)drawable);
278 reply = xcb_dri2_get_msc_reply(scrn->conn, cookie, NULL);
281 vl_dri2_handle_stamps(scrn, reply->ust_hi, reply->ust_lo,
286 return scrn->last_ust;
292 struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
293 assert(scrn);
294 if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
295 scrn->next_msc = ((int64_t)stamp - scrn->last_ust + scrn->ns_frame/2) /
296 scrn->ns_frame + scrn->last_msc;
298 scrn->next_msc = 0;
320 struct vl_dri_screen *scrn;
339 scrn = CALLOC_STRUCT(vl_dri_screen);
340 if (!scrn)
343 scrn->conn = XGetXCBConnection(display);
344 if (!scrn->conn)
347 xcb_prefetch_extension_data(scrn->conn, &xcb_dri2_id);
349 extension = xcb_get_extension_data(scrn->conn, &xcb_dri2_id);
353 dri2_query_cookie = xcb_dri2_query_version (scrn->conn,
356 dri2_query = xcb_dri2_query_version_reply (scrn->conn, dri2_query_cookie, &error);
360 s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn));
378 connect_cookie = xcb_dri2_connect_unchecked(scrn->conn,
381 connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
400 authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn,
403 authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL);
408 if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
409 scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
411 if (!scrn->base.pscreen)
414 scrn->base.destroy = vl_dri2_screen_destroy;
415 scrn->base.texture_from_drawable = vl_dri2_screen_texture_from_drawable;
416 scrn->base.get_dirty_area = vl_dri2_screen_get_dirty_area;
417 scrn->base.get_timestamp = vl_dri2_screen_get_timestamp;
418 scrn->base.set_next_timestamp = vl_dri2_screen_set_next_timestamp;
419 scrn->base.get_private = vl_dri2_screen_get_private;
420 scrn->base.pscreen->flush_frontbuffer = vl_dri2_flush_frontbuffer;
421 vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
422 vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
429 return &scrn->base;
432 if (scrn->base.dev) {
433 pipe_loader_release(&scrn->base.dev, 1);
448 FREE(scrn);
455 struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
459 if (scrn->flushed) {
460 free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
461 free(xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL));
462 free(xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL));
465 vl_dri2_destroy_drawable(scrn);
466 scrn->base.pscreen->destroy(scrn->base.pscreen);
467 pipe_loader_release(&scrn->base.dev, 1);
468 FREE(scrn);