[Libva] [PATCH V2][libva-intel-driver] Move the sharpening into the whole virtual VEBOX process
Xiang, Haihao
haihao.xiang at intel.com
Thu Sep 29 08:42:46 UTC 2016
Thanks for the patch, tested and applied.
> V2: add vpp_sharpness_filtering() in
> gen75&gen8_vebox_process_picture()
>
> It fixes below issues:
> https://bugs.freedesktop.org/show_bug.cgi?id=96987
> https://bugs.freedesktop.org/show_bug.cgi?id=96988
>
> Signed-off-by: peng.chen <peng.c.chen at intel.com>
> ---
> src/gen75_picture_process.c | 34 +---------------------------------
> src/gen75_picture_process.h | 2 --
> src/gen75_vpp_vebox.c | 40
> +++++++++++++++++++++++++++++++++++++---
> src/gen75_vpp_vebox.h | 5 +++++
> 4 files changed, 43 insertions(+), 38 deletions(-)
>
> diff --git a/src/gen75_picture_process.c
> b/src/gen75_picture_process.c
> index 802452b..0b681f1 100644
> --- a/src/gen75_picture_process.c
> +++ b/src/gen75_picture_process.c
> @@ -91,25 +91,6 @@ gen75_vpp_vebox(VADriverContextP ctx,
> return va_status;
> }
>
> -static VAStatus
> -gen75_vpp_gpe(VADriverContextP ctx,
> - struct intel_video_process_context* proc_ctx)
> -{
> - VAStatus va_status = VA_STATUS_SUCCESS;
> -
> - if(proc_ctx->vpp_gpe_ctx == NULL){
> - proc_ctx->vpp_gpe_ctx = vpp_gpe_context_init(ctx);
> - }
> -
> - proc_ctx->vpp_gpe_ctx->pipeline_param = proc_ctx-
> >pipeline_param;
> - proc_ctx->vpp_gpe_ctx->surface_pipeline_input_object =
> proc_ctx->surface_pipeline_input_object;
> - proc_ctx->vpp_gpe_ctx->surface_output_object = proc_ctx-
> >surface_render_output_object;
> -
> - va_status = vpp_gpe_process_picture(ctx, proc_ctx-
> >vpp_gpe_ctx);
> -
> - return va_status;
> -}
> -
> VAStatus
> gen75_proc_picture(VADriverContextP ctx,
> VAProfile profile,
> @@ -324,16 +305,9 @@ gen75_proc_picture(VADriverContextP ctx,
> if (filter->type == VAProcFilterNoiseReduction ||
> filter->type == VAProcFilterDeinterlacing ||
> filter->type == VAProcFilterSkinToneEnhancement ||
> + filter->type == VAProcFilterSharpening ||
> filter->type == VAProcFilterColorBalance){
> gen75_vpp_vebox(ctx, proc_ctx);
> - }else if(filter->type == VAProcFilterSharpening){
> - if (proc_ctx->surface_pipeline_input_object->fourcc
> != VA_FOURCC_NV12 ||
> - proc_ctx->surface_render_output_object->fourcc !=
> VA_FOURCC_NV12) {
> - status = VA_STATUS_ERROR_UNIMPLEMENTED;
> - goto error;
> - }
> -
> - gen75_vpp_gpe(ctx, proc_ctx);
> }
> }else if (pipeline_param->num_filters >= 2) {
> unsigned int i = 0;
> @@ -413,11 +387,6 @@ gen75_proc_context_destroy(void *hw_context)
> proc_ctx->vpp_vebox_ctx = NULL;
> }
>
> - if(proc_ctx->vpp_gpe_ctx){
> - vpp_gpe_context_destroy(ctx,proc_ctx->vpp_gpe_ctx);
> - proc_ctx->vpp_gpe_ctx = NULL;
> - }
> -
> free(proc_ctx);
> }
>
> @@ -433,7 +402,6 @@ gen75_proc_context_init(VADriverContextP ctx,
> proc_context->base.run = gen75_proc_picture;
>
> proc_context->vpp_vebox_ctx = NULL;
> - proc_context->vpp_gpe_ctx = NULL;
> proc_context->vpp_fmt_cvt_ctx = NULL;
>
> proc_context->driver_context = ctx;
> diff --git a/src/gen75_picture_process.h
> b/src/gen75_picture_process.h
> index b0f9750..2ac9d4e 100644
> --- a/src/gen75_picture_process.h
> +++ b/src/gen75_picture_process.h
> @@ -31,7 +31,6 @@
> #include <va/va_vpp.h>
> #include "i965_drv_video.h"
> #include "gen75_vpp_vebox.h"
> -#include "gen75_vpp_gpe.h"
>
> struct intel_video_process_context
> {
> @@ -40,7 +39,6 @@ struct intel_video_process_context
>
> struct intel_vebox_context *vpp_vebox_ctx;
> struct hw_context *vpp_fmt_cvt_ctx;
> - struct vpp_gpe_context *vpp_gpe_ctx;
>
> VAProcPipelineParameterBuffer* pipeline_param;
>
> diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c
> index d88a454..8232530 100644
> --- a/src/gen75_vpp_vebox.c
> +++ b/src/gen75_vpp_vebox.c
> @@ -115,6 +115,25 @@ vpp_surface_scaling(VADriverContextP ctx, struct
> object_surface *src_obj_surf,
> return va_status;
> }
>
> +static VAStatus
> +vpp_sharpness_filtering(VADriverContextP ctx,
> + struct intel_vebox_context *proc_ctx)
> +{
> + VAStatus va_status = VA_STATUS_SUCCESS;
> +
> + if(proc_ctx->vpp_gpe_ctx == NULL){
> + proc_ctx->vpp_gpe_ctx = vpp_gpe_context_init(ctx);
> + }
> +
> + proc_ctx->vpp_gpe_ctx->pipeline_param = proc_ctx-
> >pipeline_param;
> + proc_ctx->vpp_gpe_ctx->surface_pipeline_input_object =
> proc_ctx->frame_store[FRAME_IN_CURRENT].obj_surface;
> + proc_ctx->vpp_gpe_ctx->surface_output_object = proc_ctx-
> >frame_store[FRAME_OUT_CURRENT].obj_surface;
> +
> + va_status = vpp_gpe_process_picture(ctx, proc_ctx-
> >vpp_gpe_ctx);
> +
> + return va_status;
> +}
> +
> void hsw_veb_dndi_table(VADriverContextP ctx, struct
> intel_vebox_context *proc_ctx)
> {
> struct i965_driver_data *i965 = i965_driver_data(ctx);
> @@ -1610,6 +1629,9 @@ gen75_vebox_init_pipe_params(VADriverContextP
> ctx,
> proc_ctx->filters_mask |= VPP_IECP_STD_STE;
> proc_ctx->filter_iecp_std = filter;
> break;
> + case VAProcFilterSharpening:
> + proc_ctx->filters_mask |= VPP_SHARP;
> + break;
> default:
> WARN_ONCE("unsupported filter (type: %d)\n", filter-
> >type);
> return VA_STATUS_ERROR_UNSUPPORTED_FILTER;
> @@ -1725,7 +1747,9 @@ gen75_vebox_process_picture(VADriverContextP
> ctx,
> if (status != VA_STATUS_SUCCESS)
> return status;
>
> - if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> + if (proc_ctx->filters_mask & VPP_SHARP_MASK) {
> + vpp_sharpness_filtering(ctx, proc_ctx);
> + } else if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> assert(proc_ctx->is_second_field);
> /* directly copy the saved frame in the second call */
> } else {
> @@ -1750,6 +1774,11 @@ void
> gen75_vebox_context_destroy(VADriverContextP ctx,
> {
> int i;
>
> + if(proc_ctx->vpp_gpe_ctx){
> + vpp_gpe_context_destroy(ctx,proc_ctx->vpp_gpe_ctx);
> + proc_ctx->vpp_gpe_ctx = NULL;
> + }
> +
> if(proc_ctx->surface_input_vebox != VA_INVALID_ID){
> i965_DestroySurfaces(ctx, &proc_ctx->surface_input_vebox, 1);
> proc_ctx->surface_input_vebox = VA_INVALID_ID;
> @@ -1815,6 +1844,7 @@ struct intel_vebox_context *
> gen75_vebox_context_init(VADriverContextP ctx)
> proc_context->surface_output_scaled_object = NULL;
> proc_context->filters_mask = 0;
> proc_context->format_convert_flags = 0;
> + proc_context->vpp_gpe_ctx = NULL;
>
> return proc_context;
> }
> @@ -1957,7 +1987,9 @@ gen8_vebox_process_picture(VADriverContextP
> ctx,
> if (status != VA_STATUS_SUCCESS)
> return status;
>
> - if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> + if (proc_ctx->filters_mask & VPP_SHARP_MASK) {
> + vpp_sharpness_filtering(ctx, proc_ctx);
> + } else if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> assert(proc_ctx->is_second_field);
> /* directly copy the saved frame in the second call */
> } else {
> @@ -2428,7 +2460,9 @@ gen9_vebox_process_picture(VADriverContextP
> ctx,
> if (status != VA_STATUS_SUCCESS)
> return status;
>
> - if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> + if (proc_ctx->filters_mask & VPP_SHARP_MASK) {
> + vpp_sharpness_filtering(ctx, proc_ctx);
> + } else if (proc_ctx->format_convert_flags & POST_COPY_CONVERT) {
> assert(proc_ctx->is_second_field);
> /* directly copy the saved frame in the second call */
> } else {
> diff --git a/src/gen75_vpp_vebox.h b/src/gen75_vpp_vebox.h
> index 31c5c4e..0b01a5c 100644
> --- a/src/gen75_vpp_vebox.h
> +++ b/src/gen75_vpp_vebox.h
> @@ -37,6 +37,7 @@
> #include "i965_drv_video.h"
>
> #include "i965_post_processing.h"
> +#include "gen75_vpp_gpe.h"
>
> #define INPUT_SURFACE 0
> #define OUTPUT_SURFACE 1
> @@ -52,6 +53,8 @@
> #define VPP_IECP_AOI 0x00002000
> #define VPP_IECP_CSC_TRANSFORM 0x00004000
> #define VPP_IECP_MASK 0x0000ff00
> +#define VPP_SHARP 0x00010000
> +#define VPP_SHARP_MASK 0x000f0000
> #define MAX_FILTER_SUM 8
>
> #define PRE_FORMAT_CONVERT 0x01
> @@ -152,6 +155,8 @@ struct intel_vebox_context
> unsigned int is_di_adv_enabled : 1;
> unsigned int is_first_frame : 1;
> unsigned int is_second_field : 1;
> +
> + struct vpp_gpe_context *vpp_gpe_ctx;
> };
>
> VAStatus gen75_vebox_process_picture(VADriverContextP ctx,
More information about the Libva
mailing list