Exclusively use VA-API defined video processing flags, instead of yet redefining another set with limited use. This means that we can use scaling, colorspace and picture structure flags as is, without an extra layer of conversion.
Drop I965_PP_FLAG_MCDI (motion compensated deinterlacing), which was never set. Dropped the associated dead code, which was never used. And, anyway, advanced deinterlacing modes shall go through the explcit VPP interfaces. Signed-off-by: Gwenole Beauchesne <gwenole.beauche...@intel.com> --- src/gen75_vpp_vebox.c | 10 +++++----- src/gen8_render.c | 6 +++--- src/i965_output_dri.c | 18 +++-------------- src/i965_post_processing.c | 50 +++++++--------------------------------------- src/i965_post_processing.h | 9 ++------- src/i965_render.c | 12 +++++------ src/i965_vpp_avs.h | 7 +++++++ 7 files changed, 33 insertions(+), 79 deletions(-) diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c index 1113c90..b7c2ea0 100644 --- a/src/gen75_vpp_vebox.c +++ b/src/gen75_vpp_vebox.c @@ -86,12 +86,11 @@ VAStatus vpp_surface_convert(VADriverContextP ctx, return va_status; } -VAStatus vpp_surface_scaling(VADriverContextP ctx, - struct object_surface *dst_obj_surf, - struct object_surface *src_obj_surf) +static VAStatus +vpp_surface_scaling(VADriverContextP ctx, struct object_surface *dst_obj_surf, + struct object_surface *src_obj_surf, uint32_t flags) { VAStatus va_status = VA_STATUS_SUCCESS; - int flags = I965_PP_FLAG_AVS; assert(src_obj_surf->fourcc == VA_FOURCC_NV12); assert(dst_obj_surf->fourcc == VA_FOURCC_NV12); @@ -1266,7 +1265,8 @@ int hsw_veb_post_format_convert(VADriverContextP ctx, assert(obj_surface->fourcc == VA_FOURCC_NV12); /* first step :surface scaling */ - vpp_surface_scaling(ctx,proc_ctx->surface_output_scaled_object, obj_surface); + vpp_surface_scaling(ctx, proc_ctx->surface_output_scaled_object, + obj_surface, 0); /* second step: color format convert and copy to output */ obj_surface = proc_ctx->surface_output_object; diff --git a/src/gen8_render.c b/src/gen8_render.c index 9c49cbc..b7494a1 100644 --- a/src/gen8_render.c +++ b/src/gen8_render.c @@ -189,11 +189,11 @@ gen8_render_set_surface_state( memset(ss, 0, sizeof(*ss)); - switch (flags & (I965_PP_FLAG_TOP_FIELD|I965_PP_FLAG_BOTTOM_FIELD)) { - case I965_PP_FLAG_BOTTOM_FIELD: + switch (flags & (VA_TOP_FIELD|VA_BOTTOM_FIELD)) { + case VA_BOTTOM_FIELD: ss->ss0.vert_line_stride_ofs = 1; /* fall-through */ - case I965_PP_FLAG_TOP_FIELD: + case VA_TOP_FIELD: ss->ss0.vert_line_stride = 1; height /= 2; break; diff --git a/src/i965_output_dri.c b/src/i965_output_dri.c index 6f8ea31..2579526 100644 --- a/src/i965_output_dri.c +++ b/src/i965_output_dri.c @@ -123,7 +123,6 @@ i965_put_surface_dri( union dri_buffer *buffer; struct intel_region *dest_region; struct object_surface *obj_surface; - unsigned int pp_flag = 0; bool new_region = false; uint32_t name; int i, ret; @@ -179,21 +178,10 @@ i965_put_surface_dri( assert(ret == 0); } - color_flag = flags & VA_SRC_COLOR_MASK; - if (color_flag == 0) - color_flag = VA_SRC_BT601; + if (!(flags & VA_SRC_COLOR_MASK)) + flags |= VA_SRC_BT601; - pp_flag = color_flag; - - if ((flags & VA_FILTER_SCALING_MASK) == VA_FILTER_SCALING_NL_ANAMORPHIC) - pp_flag |= I965_PP_FLAG_AVS; - - if (flags & VA_TOP_FIELD) - pp_flag |= I965_PP_FLAG_TOP_FIELD; - else if (flags & VA_BOTTOM_FIELD) - pp_flag |= I965_PP_FLAG_BOTTOM_FIELD; - - intel_render_put_surface(ctx, obj_surface, src_rect, dst_rect, pp_flag); + intel_render_put_surface(ctx, obj_surface, src_rect, dst_rect, flags); for (i = 0; i < I965_MAX_SUBPIC_SUM; i++) { if (obj_surface->obj_subpic[i] != NULL) { diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c index 1e932fd..6642bbd 100755 --- a/src/i965_post_processing.c +++ b/src/i965_post_processing.c @@ -4799,7 +4799,7 @@ i965_scaling_processing( const VARectangle *src_rect, struct object_surface *dst_surface_obj, const VARectangle *dst_rect, - unsigned int flags) + unsigned int va_flags) { VAStatus va_status = VA_STATUS_SUCCESS; struct i965_driver_data *i965 = i965_driver_data(ctx); @@ -4807,7 +4807,7 @@ i965_scaling_processing( assert(src_surface_obj->fourcc == VA_FOURCC_NV12); assert(dst_surface_obj->fourcc == VA_FOURCC_NV12); - if (HAS_VPP(i965) && (flags & I965_PP_FLAG_AVS)) { + if (HAS_VPP(i965)) { struct i965_surface src_surface; struct i965_surface dst_surface; @@ -4821,12 +4821,8 @@ i965_scaling_processing( dst_surface.flags = I965_SURFACE_FLAG_FRAME; va_status = i965_post_processing_internal(ctx, i965->pp_context, - &src_surface, - src_rect, - &dst_surface, - dst_rect, - PP_NV12_AVS, - NULL); + &src_surface, src_rect, &dst_surface, dst_rect, + avs_is_needed(va_flags) ? PP_NV12_AVS : PP_NV12_SCALING, NULL); _i965UnlockMutex(&i965->pp_mutex); } @@ -4840,7 +4836,7 @@ i965_post_processing( struct object_surface *obj_surface, const VARectangle *src_rect, const VARectangle *dst_rect, - unsigned int flags, + unsigned int va_flags, int *has_done_scaling ) { @@ -4861,38 +4857,7 @@ i965_post_processing( _i965LockMutex(&i965->pp_mutex); - if (flags & I965_PP_FLAG_MCDI) { - src_surface.base = (struct object_base *)obj_surface; - src_surface.type = I965_SURFACE_TYPE_SURFACE; - src_surface.flags = (flags & I965_PP_FLAG_TOP_FIELD) ? - I965_SURFACE_FLAG_TOP_FIELD_FIRST : I965_SURFACE_FLAG_BOTTOME_FIELD_FIRST; - - status = i965_CreateSurfaces(ctx, - obj_surface->orig_width, - obj_surface->orig_height, - VA_RT_FORMAT_YUV420, - 1, - &out_surface_id); - assert(status == VA_STATUS_SUCCESS); - obj_surface = SURFACE(out_surface_id); - assert(obj_surface); - i965_check_alloc_surface_bo(ctx, obj_surface, 0, VA_FOURCC_NV12, SUBSAMPLE_YUV420); - i965_vpp_clear_surface(ctx, i965->pp_context, obj_surface, 0); - - dst_surface.base = (struct object_base *)obj_surface; - dst_surface.type = I965_SURFACE_TYPE_SURFACE; - dst_surface.flags = I965_SURFACE_FLAG_FRAME; - - i965_post_processing_internal(ctx, i965->pp_context, - &src_surface, - src_rect, - &dst_surface, - dst_rect, - PP_NV12_DNDI, - NULL); - } - - if (flags & I965_PP_FLAG_AVS) { + if (avs_is_needed(va_flags)) { struct i965_render_state *render_state = &i965->render_state; struct intel_region *dest_region = render_state->draw_region; @@ -5693,8 +5658,7 @@ i965_proc_picture(VADriverContextP ctx, &src_rect, &dst_surface, &dst_rect, - (pipeline_param->filter_flags & VA_FILTER_SCALING_MASK) == VA_FILTER_SCALING_NL_ANAMORPHIC ? - PP_NV12_AVS : PP_NV12_SCALING, + avs_is_needed(pipeline_param->filter_flags) ? PP_NV12_AVS : PP_NV12_SCALING, NULL); } diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h index 1350401..a567527 100755 --- a/src/i965_post_processing.h +++ b/src/i965_post_processing.h @@ -33,11 +33,6 @@ #define MAX_PP_SURFACES 48 -#define I965_PP_FLAG_TOP_FIELD 1 -#define I965_PP_FLAG_BOTTOM_FIELD 2 -#define I965_PP_FLAG_MCDI 4 -#define I965_PP_FLAG_AVS 8 - enum { PP_NULL = 0, @@ -553,7 +548,7 @@ i965_post_processing( struct object_surface *obj_surface, const VARectangle *src_rect, const VARectangle *dst_rect, - unsigned int flags, + unsigned int va_flags, int *has_done_scaling ); @@ -564,7 +559,7 @@ i965_scaling_processing( const VARectangle *src_rect, struct object_surface *dst_surface_obj, const VARectangle *dst_rect, - unsigned int flags + unsigned int va_flags ); VAStatus diff --git a/src/i965_render.c b/src/i965_render.c index 38f70eb..f34a54a 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -708,11 +708,11 @@ i965_render_set_surface_state( memset(ss, 0, sizeof(*ss)); - switch (flags & (I965_PP_FLAG_TOP_FIELD|I965_PP_FLAG_BOTTOM_FIELD)) { - case I965_PP_FLAG_BOTTOM_FIELD: + switch (flags & (VA_TOP_FIELD|VA_BOTTOM_FIELD)) { + case VA_BOTTOM_FIELD: ss->ss0.vert_line_stride_ofs = 1; /* fall-through */ - case I965_PP_FLAG_TOP_FIELD: + case VA_TOP_FIELD: ss->ss0.vert_line_stride = 1; height /= 2; break; @@ -779,11 +779,11 @@ gen7_render_set_surface_state( memset(ss, 0, sizeof(*ss)); - switch (flags & (I965_PP_FLAG_TOP_FIELD|I965_PP_FLAG_BOTTOM_FIELD)) { - case I965_PP_FLAG_BOTTOM_FIELD: + switch (flags & (VA_TOP_FIELD|VA_BOTTOM_FIELD)) { + case VA_BOTTOM_FIELD: ss->ss0.vert_line_stride_ofs = 1; /* fall-through */ - case I965_PP_FLAG_TOP_FIELD: + case VA_TOP_FIELD: ss->ss0.vert_line_stride = 1; height /= 2; break; diff --git a/src/i965_vpp_avs.h b/src/i965_vpp_avs.h index ead4261..0b01c8f 100644 --- a/src/i965_vpp_avs.h +++ b/src/i965_vpp_avs.h @@ -99,4 +99,11 @@ avs_init_state(AVSState *avs, const AVSConfig *config); bool avs_update_coefficients(AVSState *avs, float sx, float sy, uint32_t flags); +/** Checks whether AVS is needed, e.g. if high-quality scaling is requested */ +static inline bool +avs_is_needed(uint32_t flags) +{ + return ((flags & VA_FILTER_SCALING_MASK) >= VA_FILTER_SCALING_HQ); +} + #endif /* I965_VPP_AVS_H */ -- 1.9.1 _______________________________________________ Libva mailing list Libva@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libva