- vl_compositor_clear_layers(&pq->compositor);
- vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, NULL, NULL);
- vl_compositor_render(&pq->compositor, drawable_surface, NULL, NULL, true);
+ pipe = pq->device->context;
+ compositor = &pq->device->compositor;
+ cstate = &pq->cstate;
+ vscreen = pq->device->vscreen;
+
+ mtx_lock(&pq->device->mutex);
+ if (vscreen->set_back_texture_from_output && surf->send_to_X)
+ vscreen->set_back_texture_from_output(vscreen, surf->surface->texture, clip_width, clip_height);
+ tex = vscreen->texture_from_drawable(vscreen, (void *)pq->drawable);
+ if (!tex) {
+ mtx_unlock(&pq->device->mutex);
+ return VDP_STATUS_INVALID_HANDLE;
+ }
+
+ if (!vscreen->set_back_texture_from_output || !surf->send_to_X) {
+ dirty_area = vscreen->get_dirty_area(vscreen);
+
+ memset(&surf_templ, 0, sizeof(surf_templ));
+ surf_templ.format = tex->format;
+ surf_draw = pipe->create_surface(pipe, tex, &surf_templ);
+
+ dst_clip.x0 = 0;
+ dst_clip.y0 = 0;
+ dst_clip.x1 = clip_width ? clip_width : surf_draw->width;
+ dst_clip.y1 = clip_height ? clip_height : surf_draw->height;
+
+ src_rect.x0 = 0;
+ src_rect.y0 = 0;
+ src_rect.x1 = surf_draw->width;
+ src_rect.y1 = surf_draw->height;