summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Zhang <xiazhang@codeaurora.org>2016-04-28 17:08:00 +0800
committerKim Zhang <xiazhang@codeaurora.org>2016-04-28 17:08:00 +0800
commitd39458f689fa6e7fd5a236afc231a87272affbbd (patch)
treecbd84f667d38986fd594562f3cca63e667ce7efe
parent9f9ad5ab4f5f94318cbf51f40d80084bca6e304e (diff)
downloadandroid_hardware_qcom_media-d39458f689fa6e7fd5a236afc231a87272affbbd.tar.gz
android_hardware_qcom_media-d39458f689fa6e7fd5a236afc231a87272affbbd.tar.bz2
android_hardware_qcom_media-d39458f689fa6e7fd5a236afc231a87272affbbd.zip
mm-video-v4l2: vidc: Restore pixel format on capture plane
Capture plane's pixel format may be changed during different DPB-OPB modes switching in real-time, which will lead to a wrong buffer size returned from driver/fw. For example, dynamic changing resolution clip with VPP feature enabled. Change-Id: I12dbed62e87d3934f6630cb1ced9a09ef2a33159
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp25
1 files changed, 21 insertions, 4 deletions
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 0c8996a5..df6bfd4b 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -970,13 +970,15 @@ OMX_ERRORTYPE omx_vdec::set_dpb(bool is_split_mode, int dpb_color_format)
OMX_ERRORTYPE omx_vdec::decide_dpb_buffer_mode(bool force_split_mode)
{
OMX_ERRORTYPE eRet = OMX_ErrorNone;
+ struct v4l2_format fmt;
+ int rc = 0;
bool cpu_access = capture_capability != V4L2_PIX_FMT_NV12_UBWC;
bool is_res_above_1080p = (drv_ctx.video_resolution.frame_width > 1920 &&
drv_ctx.video_resolution.frame_height > 1088) ||
- (drv_ctx.video_resolution.frame_height > 1088 &&
- drv_ctx.video_resolution.frame_width > 1920);
+ (drv_ctx.video_resolution.frame_width > 1088 &&
+ drv_ctx.video_resolution.frame_height > 1920);
if (cpu_access) {
if (dpb_bit_depth == MSM_VIDC_BIT_DEPTH_8) {
@@ -1016,6 +1018,21 @@ OMX_ERRORTYPE omx_vdec::decide_dpb_buffer_mode(bool force_split_mode)
if (eRet) {
DEBUG_PRINT_HIGH("Failed to set DPB buffer mode: %d", eRet);
}
+
+ //Restore the capture format again here, because
+ //in switching between different DPB-OPB modes, the pixelformat
+ //on capture port may be changed.
+ memset(&fmt, 0x0, sizeof(struct v4l2_format));
+ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ fmt.fmt.pix_mp.height = drv_ctx.video_resolution.frame_height;
+ fmt.fmt.pix_mp.width = drv_ctx.video_resolution.frame_width;
+ fmt.fmt.pix_mp.pixelformat = capture_capability;
+ rc = ioctl(drv_ctx.video_driver_fd, VIDIOC_S_FMT, &fmt);
+ if (rc) {
+ DEBUG_PRINT_ERROR("%s: Failed set format on capture mplane", __func__);
+ return OMX_ErrorUnsupportedSetting;
+ }
+
return eRet;
}
@@ -9462,8 +9479,8 @@ OMX_ERRORTYPE omx_vdec::get_buffer_req(vdec_allocatorproperty *buffer_prop)
} else {
bool is_res_1080p_or_below = (drv_ctx.video_resolution.frame_width <= 1920 &&
drv_ctx.video_resolution.frame_height <= 1088) ||
- (drv_ctx.video_resolution.frame_height <= 1088 &&
- drv_ctx.video_resolution.frame_width <= 1920);
+ (drv_ctx.video_resolution.frame_width <= 1088 &&
+ drv_ctx.video_resolution.frame_height <= 1920);
int fps = drv_ctx.frame_rate.fps_numerator / (float)drv_ctx.frame_rate.fps_denominator;
bool fps_above_180 = (fps >= 180 || operating_frame_rate >= 180) ? true : false;