summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca020400@lineageos.org>2017-07-15 12:45:39 +0200
committerLuca Stefani <luca020400@lineageos.org>2017-07-15 12:45:39 +0200
commit0273a6407668fc207e667f98d58ee003b800f46e (patch)
tree1dcc1fc05fef17b697226f82d129b803b00c49f3
parent87965a028b9255eb03728591fe24673aefc972f6 (diff)
parentc62bab11873cb4eb7d98b38f50fa7710dc7e0dd5 (diff)
downloadandroid_hardware_qcom_media-cm-14.1-caf-8996-20170913.tar.gz
android_hardware_qcom_media-cm-14.1-caf-8996-20170913.tar.bz2
android_hardware_qcom_media-cm-14.1-caf-8996-20170913.zip
Merge tag 'LA.UM.5.5.r1-05300-8x96.0' into HEADcm-14.1-caf-8996-20170913
"LA.UM.5.5.r1-05300-8x96.0"
-rw-r--r--mm-video-v4l2/vidc/vdec/inc/omx_vdec.h2
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp44
2 files changed, 37 insertions, 9 deletions
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
index 6660a22c..74ccf0e1 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -1091,6 +1091,8 @@ class omx_vdec: public qc_omx_component
unsigned int buffer_alignment_req;
OMX_U32 m_c2d_width;
OMX_U32 m_c2d_height;
+ OMX_U32 m_c2d_output_format;
+ bool m_c2d_init_success;
OMX_QCOM_PLATFORM_PRIVATE_LIST m_platform_list_client[MAX_COUNT];
OMX_QCOM_PLATFORM_PRIVATE_ENTRY m_platform_entry_client[MAX_COUNT];
OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO m_pmem_info_client[MAX_COUNT];
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 94dbbb2f..4170d768 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -11964,6 +11964,8 @@ omx_vdec::allocate_color_convert_buf::allocate_color_convert_buf()
dest_format = YCbCr420P;
m_c2d_width = 0;
m_c2d_height = 0;
+ m_c2d_output_format = 0;
+ m_c2d_init_success = false;
}
void omx_vdec::allocate_color_convert_buf::set_vdec_client(void *client)
@@ -11976,7 +11978,7 @@ void omx_vdec::allocate_color_convert_buf::init_members()
allocated_count = 0;
buffer_size_req = 0;
buffer_alignment_req = 0;
- m_c2d_width = m_c2d_height = 0;
+ m_c2d_width = m_c2d_height = m_c2d_output_format = 0;
memset(m_platform_list_client,0,sizeof(m_platform_list_client));
memset(m_platform_entry_client,0,sizeof(m_platform_entry_client));
memset(m_pmem_info_client,0,sizeof(m_pmem_info_client));
@@ -11986,6 +11988,16 @@ void omx_vdec::allocate_color_convert_buf::init_members()
#endif
for (int i = 0; i < MAX_COUNT; i++)
pmem_fd[i] = -1;
+
+ if (m_c2d_init_success)
+ return;
+
+ if (!c2d.init()) {
+ DEBUG_PRINT_ERROR("c2d init failed");
+ } else {
+ DEBUG_PRINT_HIGH("c2d init success ");
+ m_c2d_init_success = true;
+ }
}
omx_vdec::allocate_color_convert_buf::~allocate_color_convert_buf()
@@ -12006,6 +12018,15 @@ bool omx_vdec::allocate_color_convert_buf::update_buffer_req()
DEBUG_PRINT_HIGH("No color conversion required");
return status;
}
+
+ bool skip_get_buffersize = (omx->drv_ctx.video_resolution.frame_height == m_c2d_height &&
+ omx->drv_ctx.video_resolution.frame_width == m_c2d_width && m_c2d_output_format == dest_format);
+
+ if (skip_get_buffersize) {
+ DEBUG_PRINT_HIGH("Skip querying c2d buffer size as resolution and format not changed");
+ return status;
+ }
+
pthread_mutex_lock(&omx->c_lock);
bool resolution_upgrade = (omx->drv_ctx.video_resolution.frame_height > m_c2d_height ||
@@ -12052,6 +12073,7 @@ bool omx_vdec::allocate_color_convert_buf::update_buffer_req()
buffer_size_req = destination_size;
m_c2d_height = omx->drv_ctx.video_resolution.frame_height;
m_c2d_width = omx->drv_ctx.video_resolution.frame_width;
+ m_c2d_output_format = dest_format;
}
}
fail_update_buf_req:
@@ -12068,6 +12090,10 @@ bool omx_vdec::allocate_color_convert_buf::set_color_format(
DEBUG_PRINT_ERROR("Invalid client in color convert");
return false;
}
+ if (!m_c2d_init_success) {
+ DEBUG_PRINT_HIGH("c2d is not initialized");
+ return status;
+ }
pthread_mutex_lock(&omx->c_lock);
if (omx->drv_ctx.output_format == VDEC_YUV_FORMAT_NV12)
if (omx->drv_ctx.decoder_format == VDEC_CODECTYPE_MVC)
@@ -12100,18 +12126,18 @@ bool omx_vdec::allocate_color_convert_buf::set_color_format(
ColorFormat = dest_color_format;
dest_format = (dest_color_format == OMX_COLOR_FormatYUV420Planar) ?
YCbCr420P : YCbCr420SP;
- if (enabled)
- c2d.destroy();
- enabled = false;
- if (!c2d.init()) {
- DEBUG_PRINT_ERROR("open failed for c2d");
- status = false;
- } else
+ c2d.close();
+ status = c2d.open(omx->drv_ctx.video_resolution.frame_height,
+ omx->drv_ctx.video_resolution.frame_width,
+ NV12_128m,dest_format);
+ if (status)
enabled = true;
+ else
+ DEBUG_PRINT_ERROR("C2D open failed ");
}
} else {
if (enabled)
- c2d.destroy();
+ c2d.close();
enabled = false;
}
pthread_mutex_unlock(&omx->c_lock);