DeviceReference(&pq->device, dev);
pq->drawable = pqt->drawable;
- pipe_mutex_lock(dev->mutex);
+ mtx_lock(&dev->mutex);
if (!vl_compositor_init_state(&pq->cstate, dev->context)) {
- pipe_mutex_unlock(dev->mutex);
+ mtx_unlock(&dev->mutex);
ret = VDP_STATUS_ERROR;
goto no_compositor;
}
- pipe_mutex_unlock(dev->mutex);
+ mtx_unlock(&dev->mutex);
*presentation_queue = vlAddDataHTAB(pq);
if (*presentation_queue == 0) {
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
vl_compositor_cleanup_state(&pq->cstate);
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
vlRemoveDataHTAB(presentation_queue);
DeviceReference(&pq->device, NULL);
color.f[2] = background_color->blue;
color.f[3] = background_color->alpha;
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
vl_compositor_set_clear_color(&pq->cstate, &color);
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
return VDP_STATUS_OK;
}
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
vl_compositor_get_clear_color(&pq->cstate, &color);
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
background_color->red = color.f[0];
background_color->green = color.f[1];
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
*current_time = pq->device->vscreen->get_timestamp(pq->device->vscreen,
(void *)pq->drawable);
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
return VDP_STATUS_OK;
}
struct pipe_context *pipe;
struct pipe_resource *tex;
- struct pipe_surface surf_templ, *surf_draw;
+ struct pipe_surface surf_templ, *surf_draw = NULL;
struct u_rect src_rect, dst_clip, *dirty_area;
struct vl_compositor *compositor;
cstate = &pq->cstate;
vscreen = pq->device->vscreen;
- pipe_mutex_lock(pq->device->mutex);
+ 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) {
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
return VDP_STATUS_INVALID_HANDLE;
}
- dirty_area = vscreen->get_dirty_area(vscreen);
+ 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);
+ 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;
-
- if (pq->device->delayed_rendering.surface == surface &&
- dst_clip.x1 == surf_draw->width && dst_clip.y1 == surf_draw->height) {
-
- // TODO: we correctly support the clipping here, but not the pq background color in the clipped area....
- cstate = pq->device->delayed_rendering.cstate;
- vl_compositor_set_dst_clip(cstate, &dst_clip);
- vlVdpResolveDelayedRendering(pq->device, surf_draw, dirty_area);
-
- } else {
- vlVdpResolveDelayedRendering(pq->device, NULL, NULL);
+ 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;
}
vscreen->set_next_timestamp(vscreen, earliest_presentation_time);
- pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0,
- vscreen->get_private(vscreen), NULL);
+ // flush before calling flush_frontbuffer so that rendering is flushed
+ // to back buffer so the texture can be copied in flush_frontbuffer
pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL);
pipe->flush(pipe, &surf->fence, 0);
+ pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0,
+ vscreen->get_private(vscreen), NULL);
+
pq->last_surf = surf;
if (dump_window == -1) {
framenum++;
}
- pipe_resource_reference(&tex, NULL);
- pipe_surface_reference(&surf_draw, NULL);
- pipe_mutex_unlock(pq->device->mutex);
+ if (!vscreen->set_back_texture_from_output || !surf->send_to_X) {
+ pipe_resource_reference(&tex, NULL);
+ pipe_surface_reference(&surf_draw, NULL);
+ }
+ mtx_unlock(&pq->device->mutex);
return VDP_STATUS_OK;
}
if (!surf)
return VDP_STATUS_INVALID_HANDLE;
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
if (surf->fence) {
screen = pq->device->vscreen->pscreen;
- screen->fence_finish(screen, surf->fence, PIPE_TIMEOUT_INFINITE);
+ screen->fence_finish(screen, NULL, surf->fence, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &surf->fence, NULL);
}
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
return vlVdpPresentationQueueGetTime(presentation_queue, first_presentation_time);
}
else
*status = VDP_PRESENTATION_QUEUE_STATUS_IDLE;
} else {
- pipe_mutex_lock(pq->device->mutex);
+ mtx_lock(&pq->device->mutex);
screen = pq->device->vscreen->pscreen;
- if (screen->fence_finish(screen, surf->fence, 0)) {
+ if (screen->fence_finish(screen, NULL, surf->fence, 0)) {
screen->fence_reference(screen, &surf->fence, NULL);
*status = VDP_PRESENTATION_QUEUE_STATUS_VISIBLE;
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
// We actually need to query the timestamp of the last VSYNC event from the hardware
vlVdpPresentationQueueGetTime(presentation_queue, first_presentation_time);
*first_presentation_time += 1;
} else {
*status = VDP_PRESENTATION_QUEUE_STATUS_QUEUED;
- pipe_mutex_unlock(pq->device->mutex);
+ mtx_unlock(&pq->device->mutex);
}
}