diff options
author | Maheshwar Ajja <majja@codeaurora.org> | 2013-11-14 21:21:25 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-11-25 00:23:09 -0800 |
commit | bda6ee2fa2c2b8b11affe499dad2c3419c5297cd (patch) | |
tree | 7a4c8e8a0915c5db26bb8c3fe5cd3b276a31f007 /mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp | |
parent | 12217df2742e60c900a220bcdedd5abb94fc19fe (diff) | |
download | android_hardware_qcom_media-bda6ee2fa2c2b8b11affe499dad2c3419c5297cd.tar.gz android_hardware_qcom_media-bda6ee2fa2c2b8b11affe499dad2c3419c5297cd.tar.bz2 android_hardware_qcom_media-bda6ee2fa2c2b8b11affe499dad2c3419c5297cd.zip |
mm-video: vdec: Switch to hevc fullDSP on unsupported devices
This change will switch the hevc role to full DSP mode
if the device does not support hevc HYBRID solution.
Change-Id: I57f26c571730fc1d7b5f4125dd25ff7435a7abed
Diffstat (limited to 'mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp')
-rw-r--r-- | mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp index 73ac9985..77e257e5 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp @@ -1693,12 +1693,43 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) m_decoder_capability.max_width = 1920; m_decoder_capability.max_height = 1080; + OMX_STRING device_name = (OMX_STRING)"/dev/video/q6_dec"; + drv_ctx.video_driver_fd = open(device_name, O_RDWR); + if(drv_ctx.video_driver_fd == 0){ + drv_ctx.video_driver_fd = open(device_name, O_RDWR); + } + if(drv_ctx.video_driver_fd < 0) + { + DEBUG_PRINT_ERROR("Omx_vdec::Comp Init Returning failure, errno %d", errno); + return OMX_ErrorInsufficientResources; + } + DEBUG_PRINT_HIGH("omx_vdec::component_init(%s): Open device %s returned fd %d", + role, device_name, drv_ctx.video_driver_fd); + // Copy the role information which provides the decoder kind strlcpy(drv_ctx.kind,role,128); strlcpy((char *)m_cRole, "video_decoder.hevc",OMX_MAX_STRINGNAME_SIZE); if(!strncmp(drv_ctx.kind, "OMX.qcom.video.decoder.hevchybrid", OMX_MAX_STRINGNAME_SIZE)) { + fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + fmt.fmt.pix_mp.width = 320; + fmt.fmt.pix_mp.height = 240; + fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_HEVC_HYBRID; + ret = ioctl(drv_ctx.video_driver_fd, VIDIOC_S_FMT, &fmt); + if (ret) { + DEBUG_PRINT_HIGH("Failed to set format(V4L2_PIX_FMT_HEVC_HYBRID)"); + DEBUG_PRINT_HIGH("Switch to HEVC fullDSP as HYBRID is not supported"); + strlcpy(drv_ctx.kind, "OMX.qcom.video.decoder.hevc", 128); + } + else { + DEBUG_PRINT_HIGH("HEVC HYBRID is supported"); + } + } + + if(!strncmp(drv_ctx.kind, "OMX.qcom.video.decoder.hevchybrid", + OMX_MAX_STRINGNAME_SIZE)) + { m_swvdec_mode = SWVDEC_MODE_DECODE_ONLY; } else if(!strncmp(drv_ctx.kind, "OMX.qcom.video.decoder.hevcswvdec", @@ -1783,22 +1814,6 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role) if (!m_pSwVdec || m_swvdec_mode == SWVDEC_MODE_DECODE_ONLY) { - OMX_STRING device_name = (OMX_STRING)"/dev/video/q6_dec"; - drv_ctx.video_driver_fd = open(device_name, O_RDWR); - - DEBUG_PRINT_HIGH("omx_vdec::component_init(): Open device %s returned fd %d, errno %d", - device_name, drv_ctx.video_driver_fd, errno); - - if(drv_ctx.video_driver_fd == 0){ - drv_ctx.video_driver_fd = open(device_name, O_RDWR); - } - - if(drv_ctx.video_driver_fd < 0) - { - DEBUG_PRINT_ERROR("Omx_vdec::Comp Init Returning failure, errno %d", errno); - return OMX_ErrorInsufficientResources; - } - ret = pthread_create(&async_thread_id,0,async_message_thread,this); if(ret < 0) { close(drv_ctx.video_driver_fd); |