[Libva] [PATCH] vpp: use single path conversion if no scaling is required
Sean V Kelley
sean.v.kelley at intel.com
Fri Mar 20 10:14:43 PDT 2015
Let's hold off on this for now in light of Gwenole's low-power fast path
patch.
Thaniks,
Sean
On Fri, Mar 20, 2015 at 8:07 AM, Lionel Landwerlin <
lionel.g.landwerlin at intel.com> wrote:
> The VPP API can be used to do pixel format conversion and scaling. The
> current implementation uses a 2 pass process where the first pass does
> scaling and the second pass does pixel format conversion.
>
> In the case where we just need pixel format conversion, we can get rid
> of the first pass. This patch implements a fast path for this case.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
> src/i965_post_processing.c | 71
> +++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 67 insertions(+), 4 deletions(-)
>
> diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c
> index 3ee3f07..3a6ad55 100755
> --- a/src/i965_post_processing.c
> +++ b/src/i965_post_processing.c
> @@ -5372,9 +5372,35 @@ static const int proc_frame_to_pp_frame[3] = {
> I965_SURFACE_FLAG_BOTTOME_FIELD_FIRST
> };
>
> -VAStatus
> -i965_proc_picture(VADriverContextP ctx,
> - VAProfile profile,
> +static bool
> +_va_rectangles_equal(VARectangle *rect1, VARectangle *rect2)
> +{
> + return (rect1->x == rect2->x &&
> + rect1->y == rect2->y &&
> + rect1->width == rect2->width &&
> + rect1->height == rect2->height);
> +}
> +
> +static bool
> +_fourcc_is_rgbx(unsigned int fourcc)
> +{
> + return (fourcc == VA_FOURCC_RGBX ||
> + fourcc == VA_FOURCC_BGRX ||
> + fourcc == VA_FOURCC_BGRA ||
> + fourcc == VA_FOURCC_RGBA);
> +}
> +
> +static bool
> +_filter_is_noop(VAProcPipelineParameterBuffer *pipeline_param)
> +{
> + return (pipeline_param->num_filters == 0 &&
> + pipeline_param->filters == NULL &&
> + (pipeline_param->filter_flags & ~VA_FILTER_SCALING_FAST) ==
> 0);
> +}
> +
> +VAStatus
> +i965_proc_picture(VADriverContextP ctx,
> + VAProfile profile,
> union codec_state *codec_state,
> struct hw_context *hw_context)
> {
> @@ -5382,7 +5408,7 @@ i965_proc_picture(VADriverContextP ctx,
> struct i965_proc_context *proc_context = (struct i965_proc_context
> *)hw_context;
> struct proc_state *proc_state = &codec_state->proc;
> VAProcPipelineParameterBuffer *pipeline_param =
> (VAProcPipelineParameterBuffer *)proc_state->pipeline_param->buffer;
> - struct object_surface *obj_surface;
> + struct object_surface *obj_surface, *dst_obj_surface;
> struct i965_surface src_surface, dst_surface;
> VARectangle src_rect, dst_rect;
> VAStatus status;
> @@ -5415,6 +5441,43 @@ i965_proc_picture(VADriverContextP ctx,
> goto error;
> }
>
> + dst_obj_surface = SURFACE(proc_state->current_render_target);
> +
> + if (_filter_is_noop(pipeline_param) &&
> + _va_rectangles_equal(pipeline_param->surface_region,
> + pipeline_param->output_region) &&
> + obj_surface->fourcc == VA_FOURCC_NV12 &&
> + _fourcc_is_rgbx(dst_obj_surface->fourcc)) {
> + i965_vpp_clear_surface(ctx,
> + &proc_context->pp_context,
> + dst_obj_surface,
> + pipeline_param->output_background_color);
> +
> + src_surface.base = (struct object_base *)obj_surface;
> + src_surface.type = I965_SURFACE_TYPE_SURFACE;
> + src_surface.flags = 0;
> + src_rect.x = pipeline_param->surface_region->x;
> + src_rect.y = pipeline_param->surface_region->y;
> + src_rect.width = pipeline_param->surface_region->width;
> + src_rect.height = pipeline_param->surface_region->height;
> +
> + dst_surface.base = (struct object_base *)dst_obj_surface;
> + dst_surface.type = I965_SURFACE_TYPE_SURFACE;
> + dst_surface.flags = 0;
> + dst_rect.x = pipeline_param->output_region->x;
> + dst_rect.y = pipeline_param->output_region->y;
> + dst_rect.width = pipeline_param->output_region->width;
> + dst_rect.height = pipeline_param->output_region->height;
> +
> + i965_post_processing_internal(ctx, &proc_context->pp_context,
> + &src_surface,
> + &src_rect,
> + &dst_surface,
> + &dst_rect,
> + PP_NV12_LOAD_SAVE_RGBX,
> + NULL);
> + return VA_STATUS_SUCCESS;
> + }
> in_width = obj_surface->orig_width;
> in_height = obj_surface->orig_height;
> dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
> --
> 2.1.4
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva
>
--
Sean V. Kelley <sean.v.kelley at intel.com>
Open Source Technology Center / SSG
Intel Corp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libva/attachments/20150320/a994aa1f/attachment.html>
More information about the Libva
mailing list