Signed-off-by: Thomas Hellstrom <thellst...@vmware.com> Reviewed-by: Sinclair Yeh <s...@vmware.com> --- src/gallium/state_trackers/va/context.c | 21 ++++++++++++++------- src/gallium/state_trackers/va/postproc.c | 30 +++++++++++++++++------------- src/gallium/state_trackers/va/surface.c | 23 +++++++++++++---------- src/gallium/state_trackers/va/va_private.h | 6 +++--- 4 files changed, 47 insertions(+), 33 deletions(-)
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c index d749e65..d9d9210 100644 --- a/src/gallium/state_trackers/va/context.c +++ b/src/gallium/state_trackers/va/context.c @@ -33,6 +33,7 @@ #include "util/u_video.h" #include "vl/vl_deint_filter.h" #include "vl/vl_winsys.h" +#include "vl/vl_postproc.h" #include "va_private.h" @@ -155,14 +156,20 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx) if (!drv->htab) goto error_htab; - if (!vl_compositor_init(&drv->compositor, drv->pipe)) + drv->compositor = vl_pproc_create(drv->pipe, NULL); + if (!drv->compositor) goto error_compositor; - if (!vl_compositor_init_state(&drv->cstate, drv->pipe)) + + drv->cctx = drv->compositor->context_create(drv->compositor); + if (!drv->cctx) goto error_compositor_state; vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &drv->csc); - if (!vl_compositor_set_csc_matrix(&drv->cstate, (const vl_csc_matrix *)&drv->csc, 1.0f, 0.0f)) + if (!drv->cctx->set_csc_matrix + (drv->cctx, (const util_video_compositor_csc_matrix *)&drv->csc)) { goto error_csc_matrix; + } + pipe_mutex_init(drv->mutex); ctx->pDriverData = (void *)drv; @@ -181,10 +188,10 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx) return VA_STATUS_SUCCESS; error_csc_matrix: - vl_compositor_cleanup_state(&drv->cstate); + drv->cctx->destroy(drv->cctx); error_compositor_state: - vl_compositor_cleanup(&drv->compositor); + drv->compositor->destroy(drv->compositor); error_compositor: handle_table_destroy(drv->htab); @@ -346,8 +353,8 @@ vlVaTerminate(VADriverContextP ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; drv = ctx->pDriverData; - vl_compositor_cleanup_state(&drv->cstate); - vl_compositor_cleanup(&drv->compositor); + drv->cctx->destroy(drv->cctx); + drv->compositor->destroy(drv->compositor); drv->pipe->destroy(drv->pipe); drv->vscreen->destroy(drv->vscreen); handle_table_destroy(drv->htab); diff --git a/src/gallium/state_trackers/va/postproc.c b/src/gallium/state_trackers/va/postproc.c index 01e240f..fe35334 100644 --- a/src/gallium/state_trackers/va/postproc.c +++ b/src/gallium/state_trackers/va/postproc.c @@ -31,6 +31,8 @@ #include "vl/vl_video_buffer.h" #include "vl/vl_deint_filter.h" +#include "util/u_video_compositor.h" + #include "va_private.h" static const VARectangle * @@ -54,11 +56,12 @@ vlVaPostProcCompositor(vlVaDriver *drv, vlVaContext *context, const VARectangle *dst_region, struct pipe_video_buffer *src, struct pipe_video_buffer *dst, - enum vl_compositor_deinterlace deinterlace) + enum util_video_compositor_deinterlace deinterlace) { struct pipe_surface **surfaces; struct u_rect src_rect; struct u_rect dst_rect; + struct util_video_compositor_context *cctx = drv->cctx; surfaces = dst->get_surfaces(dst); if (!surfaces || !surfaces[0]) @@ -74,11 +77,10 @@ vlVaPostProcCompositor(vlVaDriver *drv, vlVaContext *context, dst_rect.x1 = dst_region->x + dst_region->width; dst_rect.y1 = dst_region->y + dst_region->height; - vl_compositor_clear_layers(&drv->cstate); - vl_compositor_set_buffer_layer(&drv->cstate, &drv->compositor, 0, src, - &src_rect, NULL, deinterlace); - vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dst_rect); - vl_compositor_render(&drv->cstate, &drv->compositor, surfaces[0], NULL, false); + cctx->clear_layers(cctx); + cctx->set_buffer_layer(cctx, 0, src, &src_rect, NULL, deinterlace); + cctx->set_layer_dst_area(cctx, 0, &dst_rect); + cctx->render(cctx, surfaces[0], NULL, false, NULL, NULL, 0, 0); drv->pipe->flush(drv->pipe, NULL, 0); return VA_STATUS_SUCCESS; @@ -111,7 +113,8 @@ static VAStatus vlVaPostProcBlit(vlVaDriver *drv, vlVaContext *context, const VARectangle *dst_region, struct pipe_video_buffer *src, struct pipe_video_buffer *dst, - enum vl_compositor_deinterlace deinterlace) + enum util_video_compositor_deinterlace + deinterlace) { struct pipe_surface **src_surfaces; struct pipe_surface **dst_surfaces; @@ -135,10 +138,10 @@ static VAStatus vlVaPostProcBlit(vlVaDriver *drv, vlVaContext *context, if (src->interlaced) { /* Not 100% accurate, but close enough */ switch (deinterlace) { - case VL_COMPOSITOR_BOB_TOP: + case UTIL_VIDEO_COMPOSITOR_BOB_TOP: from = src_surfaces[i & ~1]; break; - case VL_COMPOSITOR_BOB_BOTTOM: + case UTIL_VIDEO_COMPOSITOR_BOB_BOTTOM: from = src_surfaces[(i & ~1) + 1]; break; default: @@ -224,7 +227,8 @@ vlVaApplyDeint(vlVaDriver *drv, vlVaContext *context, VAStatus vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf) { - enum vl_compositor_deinterlace deinterlace = VL_COMPOSITOR_WEAVE; + enum util_video_compositor_deinterlace deinterlace = + UTIL_VIDEO_COMPOSITOR_WEAVE; VARectangle def_src_region, def_dst_region; const VARectangle *src_region, *dst_region; VAProcPipelineParameterBuffer *param; @@ -263,13 +267,13 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex switch (deint->algorithm) { case VAProcDeinterlacingBob: if (deint->flags & VA_DEINTERLACING_BOTTOM_FIELD) - deinterlace = VL_COMPOSITOR_BOB_BOTTOM; + deinterlace = UTIL_VIDEO_COMPOSITOR_BOB_BOTTOM; else - deinterlace = VL_COMPOSITOR_BOB_TOP; + deinterlace = UTIL_VIDEO_COMPOSITOR_BOB_TOP; break; case VAProcDeinterlacingWeave: - deinterlace = VL_COMPOSITOR_WEAVE; + deinterlace = UTIL_VIDEO_COMPOSITOR_WEAVE; break; case VAProcDeinterlacingMotionAdaptive: diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 0e1dbe0..e39af4e 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -186,6 +186,7 @@ vlVaPutSubpictures(vlVaSurface *surf, vlVaDriver *drv, { vlVaSubpicture *sub; int i; + struct util_video_compositor_context *cctx = drv->cctx; if (!(surf->subpics.data || surf->subpics.size)) return VA_STATUS_SUCCESS; @@ -254,14 +255,13 @@ vlVaPutSubpictures(vlVaSurface *surf, vlVaDriver *drv, blend.dither = 0; blend_state = drv->pipe->create_blend_state(drv->pipe, &blend); - vl_compositor_clear_layers(&drv->cstate); - vl_compositor_set_layer_blend(&drv->cstate, 0, blend_state, false); + cctx->clear_layers(cctx); + cctx->set_layer_blend(cctx, 0, blend_state, false); upload_sampler(drv->pipe, sub->sampler, &box, buf->data, sub->image->pitches[0], 0, 0); - vl_compositor_set_rgba_layer(&drv->cstate, &drv->compositor, 0, sub->sampler, - &sr, NULL, NULL); - vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dr); - vl_compositor_render(&drv->cstate, &drv->compositor, surf_draw, dirty_area, false); + cctx->set_rgba_layer(cctx, 0, sub->sampler, &sr, NULL, NULL); + cctx->set_layer_dst_area(cctx, 0, &dr); + cctx->render(cctx, surf_draw, dirty_area, false, NULL, NULL, 0, 0); drv->pipe->delete_blend_state(drv->pipe, blend_state); } @@ -283,11 +283,13 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s struct u_rect src_rect, *dirty_area; struct u_rect dst_rect = {destx, destx + destw, desty, desty + desth}; VAStatus status; + struct util_video_compositor_context *cctx; if (!ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; drv = VL_VA_DRIVER(ctx); + cctx = drv->cctx; pipe_mutex_lock(drv->mutex); surf = handle_table_get(drv->htab, surface_id); if (!surf) { @@ -320,10 +322,11 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s src_rect.x1 = srcw + srcx; src_rect.y1 = srch + srcy; - vl_compositor_clear_layers(&drv->cstate); - vl_compositor_set_buffer_layer(&drv->cstate, &drv->compositor, 0, surf->buffer, &src_rect, NULL, VL_COMPOSITOR_WEAVE); - vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dst_rect); - vl_compositor_render(&drv->cstate, &drv->compositor, surf_draw, dirty_area, true); + cctx->clear_layers(cctx); + cctx->set_buffer_layer(cctx, 0, surf->buffer, &src_rect, NULL, + UTIL_VIDEO_COMPOSITOR_WEAVE); + cctx->set_layer_dst_area(cctx, 0, &dst_rect); + cctx->render(cctx, surf_draw, dirty_area, true, NULL, NULL, 0, 0); status = vlVaPutSubpictures(surf, drv, surf_draw, dirty_area, &src_rect, &dst_rect); if (status) { diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index a744461..2f9accc 100644 --- a/src/gallium/state_trackers/va/va_private.h +++ b/src/gallium/state_trackers/va/va_private.h @@ -40,7 +40,7 @@ #include "pipe/p_video_codec.h" #include "pipe/p_video_state.h" -#include "vl/vl_compositor.h" +#include "util/u_video_compositor.h" #include "vl/vl_csc.h" #include "util/u_dynarray.h" @@ -206,8 +206,8 @@ typedef struct { struct vl_screen *vscreen; struct pipe_context *pipe; struct handle_table *htab; - struct vl_compositor compositor; - struct vl_compositor_state cstate; + struct util_video_compositor *compositor; + struct util_video_compositor_context *cctx; vl_csc_matrix csc; pipe_mutex mutex; } vlVaDriver; -- 2.4.11 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev