diff options
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r-- | src/gallium/state_trackers/vdpau/mixer.c | 35 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 24 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/presentation.c | 18 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 5 |
4 files changed, 48 insertions, 34 deletions
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index 082860888af..ac0ce86beeb 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -62,11 +62,11 @@ vlVdpVideoMixerCreate(VdpDevice device, return VDP_STATUS_RESOURCES; vmixer->device = dev; - vl_compositor_init(&vmixer->compositor, dev->context); + vl_compositor_init_state(&vmixer->cstate, dev->context); vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, vmixer->csc); if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE)) - vl_compositor_set_csc_matrix(&vmixer->compositor, vmixer->csc); + vl_compositor_set_csc_matrix(&vmixer->cstate, vmixer->csc); *mixer = vlAddDataHTAB(vmixer); if (*mixer == 0) { @@ -148,8 +148,9 @@ vlVdpVideoMixerCreate(VdpDevice device, no_params: vlRemoveDataHTAB(*mixer); + no_handle: - vl_compositor_cleanup(&vmixer->compositor); + vl_compositor_cleanup_state(&vmixer->cstate); FREE(vmixer); return ret; } @@ -167,7 +168,7 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer) return VDP_STATUS_INVALID_HANDLE; vlRemoveDataHTAB(mixer); - vl_compositor_cleanup(&vmixer->compositor); + vl_compositor_cleanup_state(&vmixer->cstate); if (vmixer->noise_reduction.filter) { vl_median_filter_cleanup(vmixer->noise_reduction.filter); @@ -211,10 +212,14 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, vlVdpSurface *surf; vlVdpOutputSurface *dst; + struct vl_compositor *compositor; + vmixer = vlGetDataHTAB(mixer); if (!vmixer) return VDP_STATUS_INVALID_HANDLE; + compositor = &vmixer->device->compositor; + surf = vlGetDataHTAB(video_surface_current); if (!surf) return VDP_STATUS_INVALID_HANDLE; @@ -238,11 +243,11 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, vlVdpOutputSurface *bg = vlGetDataHTAB(background_surface); if (!bg) return VDP_STATUS_INVALID_HANDLE; - vl_compositor_set_rgba_layer(&vmixer->compositor, layer++, bg->sampler_view, + vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view, RectToPipe(background_source_rect, &src_rect), NULL); } - vl_compositor_clear_layers(&vmixer->compositor); + vl_compositor_clear_layers(&vmixer->cstate); switch (current_picture_structure) { case VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD: @@ -260,13 +265,11 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, default: return VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE; }; - vl_compositor_set_buffer_layer(&vmixer->compositor, layer++, surf->video_buffer, - RectToPipe(video_source_rect, &src_rect), NULL, - deinterlace); - vl_compositor_render(&vmixer->compositor, dst->surface, - RectToPipe(destination_video_rect, &dst_rect), - RectToPipe(destination_rect, &dst_clip), - &dst->dirty_area); + vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer++, surf->video_buffer, + RectToPipe(video_source_rect, &src_rect), NULL, deinterlace); + vl_compositor_set_dst_area(&vmixer->cstate, RectToPipe(destination_video_rect, &dst_rect)); + vl_compositor_set_dst_clip(&vmixer->cstate, RectToPipe(destination_rect, &dst_clip)); + vl_compositor_render(&vmixer->cstate, compositor, dst->surface, &dst->dirty_area); /* applying the noise reduction after scaling is actually not very clever, but currently we should avoid to copy around the image @@ -544,7 +547,7 @@ vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer, color.f[1] = background_color->green; color.f[2] = background_color->blue; color.f[3] = background_color->alpha; - vl_compositor_set_clear_color(&vmixer->compositor, &color); + vl_compositor_set_clear_color(&vmixer->cstate, &color); break; case VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX: vdp_csc = attribute_values[i]; @@ -554,7 +557,7 @@ vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer, else memcpy(vmixer->csc, vdp_csc, sizeof(float)*12); if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE)) - vl_compositor_set_csc_matrix(&vmixer->compositor, vmixer->csc); + vl_compositor_set_csc_matrix(&vmixer->cstate, vmixer->csc); break; case VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL: @@ -664,7 +667,7 @@ vlVdpVideoMixerGetAttributeValues(VdpVideoMixer mixer, for (i = 0; i < attribute_count; ++i) { switch (attributes[i]) { case VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR: - vl_compositor_get_clear_color(&vmixer->compositor, attribute_values[i]); + vl_compositor_get_clear_color(&vmixer->cstate, attribute_values[i]); break; case VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX: vdp_csc = attribute_values[i]; diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 5ccb153fabd..0583c52fe82 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -113,6 +113,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device, pipe_resource_reference(&res, NULL); + vl_compositor_init_state(&vlsurface->cstate, pipe); vl_compositor_reset_dirty_area(&vlsurface->dirty_area); return VDP_STATUS_OK; @@ -132,6 +133,7 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface) pipe_surface_reference(&vlsurface->surface, NULL); pipe_sampler_view_reference(&vlsurface->sampler_view, NULL); + vl_compositor_cleanup_state(&vlsurface->cstate); vlRemoveDataHTAB(surface); FREE(vlsurface); @@ -202,6 +204,7 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, vlVdpOutputSurface *vlsurface; struct pipe_context *context; struct vl_compositor *compositor; + struct vl_compositor_state *cstate; enum pipe_format index_format; enum pipe_format colortbl_format; @@ -219,6 +222,7 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, context = vlsurface->device->context; compositor = &vlsurface->device->compositor; + cstate = &vlsurface->cstate; index_format = FormatIndexedToPipe(source_indexed_format); if (index_format == PIPE_FORMAT_NONE) @@ -304,10 +308,10 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, if (!sv_tbl) goto error_resource; - vl_compositor_clear_layers(compositor); - vl_compositor_set_palette_layer(compositor, 0, sv_idx, sv_tbl, NULL, NULL, false); - vl_compositor_render(compositor, vlsurface->surface, - RectToPipe(destination_rect, &dst_rect), NULL, NULL); + vl_compositor_clear_layers(cstate); + vl_compositor_set_palette_layer(cstate, compositor, 0, sv_idx, sv_tbl, NULL, NULL, false); + vl_compositor_set_dst_area(cstate, RectToPipe(destination_rect, &dst_rect)); + vl_compositor_render(cstate, compositor, vlsurface->surface, NULL); pipe_sampler_view_reference(&sv_idx, NULL); pipe_sampler_view_reference(&sv_tbl, NULL); @@ -442,6 +446,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface, struct pipe_context *context; struct vl_compositor *compositor; + struct vl_compositor_state *cstate; struct pipe_video_rect src_rect; struct pipe_video_rect dst_rect; @@ -461,15 +466,16 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface, context = dst_vlsurface->device->context; compositor = &dst_vlsurface->device->compositor; + cstate = &dst_vlsurface->cstate; blend = BlenderToPipe(context, blend_state); - vl_compositor_clear_layers(compositor); - vl_compositor_set_layer_blend(compositor, 0, blend, false); - vl_compositor_set_rgba_layer(compositor, 0, src_vlsurface->sampler_view, + vl_compositor_clear_layers(cstate); + vl_compositor_set_layer_blend(cstate, 0, blend, false); + vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view, RectToPipe(source_rect, &src_rect), NULL); - vl_compositor_render(compositor, dst_vlsurface->surface, - RectToPipe(destination_rect, &dst_rect), NULL, false); + vl_compositor_set_dst_area(cstate, RectToPipe(destination_rect, &dst_rect)); + vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL); context->delete_blend_state(context, blend); diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 37c5c695e4d..71447793f58 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -68,7 +68,7 @@ vlVdpPresentationQueueCreate(VdpDevice device, pq->device = dev; pq->drawable = pqt->drawable; - if (!vl_compositor_init(&pq->compositor, dev->context)) { + if (!vl_compositor_init_state(&pq->cstate, dev->context)) { ret = VDP_STATUS_ERROR; goto no_compositor; } @@ -99,7 +99,7 @@ vlVdpPresentationQueueDestroy(VdpPresentationQueue presentation_queue) if (!pq) return VDP_STATUS_INVALID_HANDLE; - vl_compositor_cleanup(&pq->compositor); + vl_compositor_cleanup_state(&pq->cstate); vlRemoveDataHTAB(presentation_queue); FREE(pq); @@ -129,7 +129,7 @@ vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue color.f[2] = background_color->blue; color.f[3] = background_color->alpha; - vl_compositor_set_clear_color(&pq->compositor, &color); + vl_compositor_set_clear_color(&pq->cstate, &color); return VDP_STATUS_OK; } @@ -151,7 +151,7 @@ vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue presentation_queue if (!pq) return VDP_STATUS_INVALID_HANDLE; - vl_compositor_get_clear_color(&pq->compositor, &color); + vl_compositor_get_clear_color(&pq->cstate, &color); background_color->red = color.f[0]; background_color->green = color.f[1]; @@ -205,11 +205,14 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, struct pipe_video_rect src_rect, dst_clip; struct u_rect *dirty_area; + struct vl_compositor *compositor; + pq = vlGetDataHTAB(presentation_queue); if (!pq) return VDP_STATUS_INVALID_HANDLE; pipe = pq->device->context; + compositor = &pq->device->compositor; tex = vl_screen_texture_from_drawable(pq->device->vscreen, pq->drawable); if (!tex) @@ -238,9 +241,10 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, dst_clip.w = clip_width ? clip_width : surf_draw->width; dst_clip.h = clip_height ? clip_height : surf_draw->height; - vl_compositor_clear_layers(&pq->compositor); - vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, &src_rect, NULL); - vl_compositor_render(&pq->compositor, surf_draw, NULL, &dst_clip, dirty_area); + vl_compositor_clear_layers(&pq->cstate); + vl_compositor_set_rgba_layer(&pq->cstate, compositor, 0, surf->sampler_view, &src_rect, NULL); + vl_compositor_set_dst_clip(&pq->cstate, &dst_clip); + vl_compositor_render(&pq->cstate, compositor, surf_draw, dirty_area); pipe->screen->flush_frontbuffer ( diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 1645362444e..e74c68187d2 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -300,13 +300,13 @@ typedef struct { vlVdpDevice *device; Drawable drawable; - struct vl_compositor compositor; + struct vl_compositor_state cstate; } vlVdpPresentationQueue; typedef struct { vlVdpDevice *device; - struct vl_compositor compositor; + struct vl_compositor_state cstate; struct { bool supported, enabled; @@ -342,6 +342,7 @@ typedef struct struct pipe_surface *surface; struct pipe_sampler_view *sampler_view; struct pipe_fence_handle *fence; + struct vl_compositor_state cstate; struct u_rect dirty_area; } vlVdpOutputSurface; |