From 2998394a129aae003a95e91d43de920bd052c540 Mon Sep 17 00:00:00 2001 From: Maheshwar Ajja Date: Fri, 22 Jun 2012 12:27:04 +0530 Subject: [PATCH] vidc:vdec: Clean extradata portion and invalidate whole buffer This commit will ensure to clean the extradata portion in output buffer changed by the CPU before sending the buffer to Video hardware and invalidate the output buffer changed by Video hardware before CPU access the buffer. Change-Id: I05ea24fb381a164f6cfd520bd9071a94349ed2df CRs-fixed: 366446 Signed-off-by: Maheshwar Ajja --- .../video/msm/vidc/1080p/ddl/vcd_ddl_helper.c | 22 +++++++++++++++++++ drivers/video/msm/vidc/common/dec/vdec.c | 7 +++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c index 6fd5656071ba..d7ebd54593ac 100644 --- a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c +++ b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c @@ -168,6 +168,28 @@ u32 ddl_decoder_dpb_transact(struct ddl_decoder_data *decoder, } else if (operation == DDL_DPB_OP_MARK_FREE) { dpb_mask->client_mask |= (0x1 << loopc); *found_frame = *in_out_frame; + if ((decoder->meta_data_enable_flag) && + (in_out_frame->vcd_frm.buff_ion_handle)) { + struct ddl_context *ddl_context = + ddl_get_context(); + unsigned long *vaddr = + (unsigned long *)((u32) + in_out_frame->vcd_frm.virtual + + decoder->meta_data_offset); + DDL_MSG_LOW("%s: Cache clean: vaddr"\ + " (%p), offset %u, size %u", + __func__, + in_out_frame->vcd_frm.virtual, + decoder->meta_data_offset, + decoder->suffix); + msm_ion_do_cache_op( + ddl_context->video_ion_client, + in_out_frame->vcd_frm.\ + buff_ion_handle, + vaddr, + (unsigned long)decoder->suffix, + ION_IOC_CLEAN_CACHES); + } } } else { in_out_frame->vcd_frm.physical = NULL; diff --git a/drivers/video/msm/vidc/common/dec/vdec.c b/drivers/video/msm/vidc/common/dec/vdec.c index 3076aa1afe2d..ed8b452f0754 100644 --- a/drivers/video/msm/vidc/common/dec/vdec.c +++ b/drivers/video/msm/vidc/common/dec/vdec.c @@ -348,10 +348,15 @@ static void vid_dec_output_frame_done(struct video_client_ctx *client_ctx, pmem_fd, kernel_vaddr, buffer_index, &buff_handle); if (ion_flag == CACHED && buff_handle) { + DBG("%s: Cache invalidate: vaddr (%p), "\ + "size %u\n", __func__, + (void *)kernel_vaddr, + vcd_frame_data->alloc_len); msm_ion_do_cache_op(client_ctx->user_ion_client, buff_handle, (unsigned long *) kernel_vaddr, - (unsigned long)vcd_frame_data->data_len, + (unsigned long)vcd_frame_data->\ + alloc_len, ION_IOC_INV_CACHES); } }