diff options
author | Christian König <[email protected]> | 2012-02-25 23:34:31 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:21 +0100 |
commit | f8ac7e034803a1c873bf156c012fede6d2640097 (patch) | |
tree | 2f396c39f3b69b96987ce27a04ab5b8c89b1b55b /src/gallium/state_trackers/vdpau/presentation.c | |
parent | 14766f820069ca987543918bce96410c481e5d20 (diff) |
st/vdpau: avoid an unnessasary copy
Delay the actual mixer rendering until we really
know which surface is the real destination.
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/presentation.c')
-rw-r--r-- | src/gallium/state_trackers/vdpau/presentation.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 55437d7c4bd..397bd372577 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -205,13 +205,16 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, struct u_rect src_rect, dst_clip, *dirty_area; struct vl_compositor *compositor; + struct vl_compositor_state *cstate; pq = vlGetDataHTAB(presentation_queue); if (!pq) return VDP_STATUS_INVALID_HANDLE; + pipe = pq->device->context; compositor = &pq->device->compositor; + cstate = &pq->cstate; tex = vl_screen_texture_from_drawable(pq->device->vscreen, pq->drawable); if (!tex) @@ -230,20 +233,32 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, surf->timestamp = (vlVdpTime)earliest_presentation_time; - src_rect.x0 = 0; - src_rect.y0 = 0; - src_rect.x1 = surf_draw->width; - src_rect.y1 = surf_draw->height; - 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; - vl_compositor_clear_layers(&pq->cstate); - vl_compositor_set_rgba_layer(&pq->cstate, compositor, 0, surf->sampler_view, &src_rect, NULL, NULL); - vl_compositor_set_dst_clip(&pq->cstate, &dst_clip); - vl_compositor_render(&pq->cstate, compositor, surf_draw, dirty_area); + 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); + + src_rect.x0 = 0; + src_rect.y0 = 0; + src_rect.x1 = surf_draw->width; + src_rect.y1 = surf_draw->height; + + vl_compositor_clear_layers(cstate); + vl_compositor_set_rgba_layer(cstate, compositor, 0, surf->sampler_view, &src_rect, NULL, NULL); + vl_compositor_set_dst_clip(cstate, &dst_clip); + vl_compositor_render(cstate, compositor, surf_draw, dirty_area); + } pipe->screen->flush_frontbuffer ( |