From c9dc72167b3be301f0de85d8339175d69c67120b Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Wed, 28 May 2014 17:44:22 +0100 Subject: [PATCH] Hacky patch to show the MADI colourspace bug --- src/i965_post_processing.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c index 0f3ddab..58998f3 100755 --- a/src/i965_post_processing.c +++ b/src/i965_post_processing.c @@ -5428,7 +5428,7 @@ i965_proc_picture(VADriverContextP ctx, VARectangle src_rect, dst_rect; VAStatus status; int i; - VASurfaceID tmp_surfaces[VAProcFilterCount + 4]; + VASurfaceID tmp_surfaces[VAProcFilterCount + 5]; int num_tmp_surfaces = 0; unsigned int tiling = 0, swizzle = 0; int in_width, in_height; @@ -5550,6 +5550,66 @@ i965_proc_picture(VADriverContextP ctx, filter_type = filter_param->type; kernel_index = procfilter_to_pp_flag[filter_type]; + // EVIL HACK + if (filter_type == VAProcFilterDeinterlacing) { + VAProcFilterParameterBufferDeinterlacing *di_filter_param = (VAProcFilterParameterBufferDeinterlacing *)filter_param; + struct pp_dndi_context *pp_dndi_context = (struct pp_dndi_context *)&proc_context->pp_context.pp_dndi_context; + if (di_filter_param->algorithm == VAProcDeinterlacingMotionAdaptive) { + if (pp_dndi_context->frame_order == 0) { + VAProcPipelineParameterBuffer *pipeline_param = proc_context->pp_context.pipeline_param; + if (!pipeline_param || + !pipeline_param->num_forward_references || + pipeline_param->forward_references[0] == VA_INVALID_ID) { + } else { + struct object_surface *previous_in_obj_surface; + previous_in_obj_surface = SURFACE(pipeline_param->forward_references[0]); + if (previous_in_obj_surface->fourcc != VA_FOURCC_NV12) { + struct i965_surface src_surface, dst_surface; + src_surface.base = (struct object_base *)previous_in_obj_surface; + src_surface.type = I965_SURFACE_TYPE_SURFACE; + src_surface.flags = I965_SURFACE_FLAG_FRAME; + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = in_width; + src_rect.height = in_height; + + status = i965_CreateSurfaces(ctx, + in_width, + in_height, + VA_RT_FORMAT_YUV420, + 1, + &out_surface_id); + assert(status == VA_STATUS_SUCCESS); + tmp_surfaces[num_tmp_surfaces++] = out_surface_id; + previous_in_obj_surface = SURFACE(out_surface_id); + assert(previous_in_obj_surface); + i965_check_alloc_surface_bo(ctx, previous_in_obj_surface, !!tiling, VA_FOURCC_NV12, SUBSAMPLE_YUV420); + + dst_surface.base = (struct object_base *)previous_in_obj_surface; + dst_surface.type = I965_SURFACE_TYPE_SURFACE; + dst_surface.flags = I965_SURFACE_FLAG_FRAME; + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = in_width; + dst_rect.height = in_height; + + status = i965_image_processing(ctx, + &src_surface, + &src_rect, + &dst_surface, + &dst_rect); + assert(status == VA_STATUS_SUCCESS); + + src_surface.base = (struct object_base *)previous_in_obj_surface; + src_surface.type = I965_SURFACE_TYPE_SURFACE; + src_surface.flags = proc_frame_to_pp_frame[pipeline_param->filter_flags & 0x3]; + pipeline_param->forward_references[0] = previous_in_obj_surface->base.id; + } + } + } + } + } + if (kernel_index != PP_NULL && proc_context->pp_context.pp_modules[kernel_index].kernel.bo != NULL) { status = i965_CreateSurfaces(ctx, -- 1.9.0