From 4a6a6e6e131e6f7cca8849a6320ab474fa8f3111 Mon Sep 17 00:00:00 2001 From: Umesh Pandey Date: Thu, 19 Oct 2017 00:07:58 -0700 Subject: mm-video-v4l2: vdec: Unify multiple reconfig events Combine reconfig event due to crop_change, color aspects change and hdr info changed into single reconfig event as mandated by the OMX client. CRs-Fixed: 2127099 Change-Id: I61898f3a4f3cdec8e3509e52b742e4c2595b6909 --- mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp | 40 +++++++++++++++------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'mm-video-v4l2/vidc/vdec/src') diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp index df898d3c..2b1ace9d 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -8098,6 +8098,7 @@ int omx_vdec::async_message_process (void *context, void* message) struct v4l2_plane *plane = NULL; struct vdec_output_frameinfo *output_respbuf = NULL; int rc=1; + bool reconfig_event_sent = false; if (context == NULL || message == NULL) { DEBUG_PRINT_ERROR("FATAL ERROR in omx_vdec::async_message_process NULL Check"); return -1; @@ -8206,7 +8207,6 @@ int omx_vdec::async_message_process (void *context, void* message) break; case VDEC_MSG_RESP_OUTPUT_FLUSHED: case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE: - v4l2_buf_ptr = (v4l2_buffer*)vdec_msg->msgdata.output_frame.client_data; if (v4l2_buf_ptr == NULL || omx->m_out_mem_ptr == NULL || v4l2_buf_ptr->index >= omx->drv_ctx.op_buf.actualcount) { @@ -8280,7 +8280,7 @@ int omx_vdec::async_message_process (void *context, void* message) if (vdec_msg->msgdata.output_frame.len) { DEBUG_PRINT_LOW("Processing extradata"); - omx->handle_extradata(omxhdr); + reconfig_event_sent = omx->handle_extradata(omxhdr); if (omx->m_extradata_info.output_crop_updated) { DEBUG_PRINT_LOW("Read FBD crop from output extra data"); @@ -8376,9 +8376,12 @@ int omx_vdec::async_message_process (void *context, void* message) VENUS_Y_SCANLINES(COLOR_FMT_NV12_BPP10_UBWC, omx->drv_ctx.video_resolution.frame_height); } - omx->post_event(OMX_CORE_OUTPUT_PORT_INDEX, - OMX_IndexConfigCommonOutputCrop, - OMX_COMPONENT_GENERATE_PORT_RECONFIG); + if(!reconfig_event_sent) { + omx->post_event(OMX_CORE_OUTPUT_PORT_INDEX, + OMX_IndexConfigCommonOutputCrop, + OMX_COMPONENT_GENERATE_PORT_RECONFIG); + reconfig_event_sent = true; + } } if (omxhdr->nFilledLen) @@ -9675,7 +9678,7 @@ void omx_vdec::get_preferred_hdr_info(HDRStaticInfo& finalHDRInfo) finalHDRInfo.sType1.mMaxFrameAverageLightLevel = (preferredHDRInfo.sType1.mMaxFrameAverageLightLevel != 0) ? preferredHDRInfo.sType1.mMaxFrameAverageLightLevel : defaultHDRInfo.sType1.mMaxFrameAverageLightLevel; } -void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) +bool omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) { OMX_OTHER_EXTRADATATYPE *p_extra = NULL, *p_sei = NULL, *p_vui = NULL, *p_client_extra = NULL; OMX_U8 *pBuffer = NULL; @@ -9687,36 +9690,36 @@ void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) OMX_U32 recovery_sei_flags = 1; int enable = OMX_InterlaceFrameProgressive; bool internal_hdr_info_changed_flag = false; - bool color_event = false; + bool reconfig_event_sent = false; int buf_index = p_buf_hdr - m_out_mem_ptr; if (buf_index >= drv_ctx.extradata_info.count) { DEBUG_PRINT_ERROR("handle_extradata: invalid index(%d) max(%d)", buf_index, drv_ctx.extradata_info.count); - return; + return reconfig_event_sent; } struct msm_vidc_panscan_window_payload *panscan_payload = NULL; if (drv_ctx.ptr_outputbuffer[buf_index].bufferaddr == NULL) { DEBUG_PRINT_ERROR("handle_extradata: Error: Mapped output buffer address is NULL"); - return; + return reconfig_event_sent; } if (!drv_ctx.extradata_info.uaddr) { DEBUG_PRINT_HIGH("NULL drv_ctx.extradata_info.uaddr"); - return; + return reconfig_event_sent; } if (!secure_mode && (drv_ctx.extradata_info.buffer_size > (p_buf_hdr->nAllocLen - p_buf_hdr->nFilledLen)) ) { DEBUG_PRINT_ERROR("Error: Insufficient size allocated for extra-data"); p_extra = NULL; - return; + return reconfig_event_sent; } if (!secure_mode) { pBuffer = (OMX_U8*)mmap(0, drv_ctx.ptr_outputbuffer[buf_index].buffer_len, PROT_READ|PROT_WRITE, MAP_SHARED, drv_ctx.ptr_outputbuffer[buf_index].pmem_fd, 0); if (pBuffer == MAP_FAILED) { DEBUG_PRINT_ERROR("handle_extradata output buffer mmap failed - errno: %d", errno); - return; + return reconfig_event_sent; } p_extra = (OMX_OTHER_EXTRADATATYPE *) ((unsigned long)(pBuffer + p_buf_hdr->nOffset + p_buf_hdr->nFilledLen + 3)&(~3)); @@ -9734,7 +9737,7 @@ void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) if (!secure_mode && ((OMX_U8*)p_extra > (pBuffer + p_buf_hdr->nAllocLen))) { p_extra = NULL; DEBUG_PRINT_ERROR("Error: out of bound memory access by p_extra"); - return; + return reconfig_event_sent; } m_extradata_info.output_crop_updated = OMX_FALSE; OMX_OTHER_EXTRADATATYPE *data = (struct OMX_OTHER_EXTRADATATYPE *)p_extradata; @@ -9749,7 +9752,7 @@ void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) if (!secure_mode && ((OMX_U8*)p_extra > (pBuffer + p_buf_hdr->nAllocLen))) { p_extra = NULL; DEBUG_PRINT_ERROR("Error: out of bound memory access by p_extra"); - return; + return reconfig_event_sent; } DEBUG_PRINT_LOW("handle_extradata: eType = 0x%x", data->eType); @@ -9885,13 +9888,13 @@ void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) DEBUG_PRINT_ERROR("Panscan windows are more than supported\n"); DEBUG_PRINT_ERROR("Max supported = %d FW returned = %d\n", MAX_PAN_SCAN_WINDOWS, panscan_payload->num_panscan_windows); - return; + return reconfig_event_sent; } break; case MSM_VIDC_EXTRADATA_MPEG2_SEQDISP: case MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO: case MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO: - color_event = handle_color_space_info((void *)data->data); + reconfig_event_sent |= handle_color_space_info((void *)data->data); break; case MSM_VIDC_EXTRADATA_S3D_FRAME_PACKING: struct msm_vidc_s3d_frame_packing_payload *s3d_frame_packing_payload; @@ -10054,11 +10057,12 @@ void omx_vdec::handle_extradata(OMX_BUFFERHEADERTYPE *p_buf_hdr) if(internal_hdr_info_changed_flag) { print_debug_hdr_color_info(&(m_internal_hdr_info.sInfo), "Internal"); print_debug_hdr_color_info(&(m_client_hdr_info.sInfo), "Client"); - if(!color_event) { + if(!reconfig_event_sent) { DEBUG_PRINT_HIGH("Initiating PORT Reconfig due to HDR Info Change"); post_event(OMX_CORE_OUTPUT_PORT_INDEX, OMX_QTIIndexConfigDescribeHDRColorInfo, OMX_COMPONENT_GENERATE_PORT_RECONFIG); + reconfig_event_sent = true; } } @@ -10096,7 +10100,7 @@ unrecognized_extradata: ptr_extradatabuff->metadata_info.offset = buf_index * drv_ctx.extradata_info.buffer_size; ptr_extradatabuff->metadata_info.buffer_size = drv_ctx.extradata_info.size; } - return; + return reconfig_event_sent; } OMX_ERRORTYPE omx_vdec::enable_extradata(OMX_U64 requested_extradata, -- cgit v1.2.3