summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanthosh Behara <santhoshbehara@codeaurora.org>2018-06-12 16:34:02 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-06-20 03:22:30 -0700
commit2c95a9bae90649d4001b0efc6bb1fe971bec5b5a (patch)
tree9242e86ceeae5905f216b17c173ff410c397dee6
parentd94ea7b281616693f83b353eda06aafa04de5cf4 (diff)
downloadmedia-2c95a9bae90649d4001b0efc6bb1fe971bec5b5a.tar.gz
media: Set the tile dimensions to the driver only if Grid is enabled
Set the capture port dimensions to the driver before calling start streaming when grid is set to true. Change-Id: Ia8291b04ae8cc8886116bd6f1697f7f0dfa37515
-rw-r--r--mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h2
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp32
2 files changed, 27 insertions, 7 deletions
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index 1d2fc5ae..c22006a5 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -591,6 +591,8 @@ class venc_dev
BatchInfo mBatchInfo;
bool mUseAVTimerTimestamps;
bool venc_set_hdr_info(const MasteringDisplay&, const ContentLightLevel&);
+ bool mIsGridset;
+ OMX_U32 mTileDimension;
};
enum instance_state {
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index b4559b7e..fda9bad5 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -191,6 +191,8 @@ venc_dev::venc_dev(class omx_venc *venc_class)
strlcpy(m_debug.log_loc, property_value, PROPERTY_VALUE_MAX);
mUseAVTimerTimestamps = false;
+ mIsGridset = false;
+ mTileDimension = 0;
profile_level_converter::init();
}
@@ -2013,13 +2015,6 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
} else if (portDefn->nPortIndex == PORT_INDEX_OUT) {
unsigned long codectype = venc_get_codectype(portDefn->format.video.eCompressionFormat);
- if (portDefn->format.video.eCompressionFormat == OMX_VIDEO_CodingImageHEIC) {
- portDefn->format.video.nFrameWidth = DEFAULT_TILE_DIMENSION;
- portDefn->format.video.nFrameHeight = DEFAULT_TILE_DIMENSION;
- DEBUG_PRINT_HIGH("set_parameter: OMX_IndexParamPortDefinition: port %d, wxh (for HEIC coding type) %dx%d",
- portDefn->nPortIndex, portDefn->format.video.nFrameWidth,
- portDefn->format.video.nFrameHeight);
- }
//Don't worry about width/height if downscalar is enabled.
if (((m_sVenc_cfg.dvs_height != portDefn->format.video.nFrameHeight ||
m_sVenc_cfg.dvs_width != portDefn->format.video.nFrameWidth) && !downscalar_enabled) ||
@@ -3446,6 +3441,27 @@ unsigned venc_dev::venc_start(void)
return 1;
}
+ if(m_codec == OMX_VIDEO_CodingImageHEIC && mIsGridset) {
+ struct v4l2_format fmt;
+ memset(&fmt, 0, sizeof(fmt));
+ fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ fmt.fmt.pix_mp.height = mTileDimension;
+ fmt.fmt.pix_mp.width = mTileDimension;
+ fmt.fmt.pix_mp.pixelformat = m_sVenc_cfg.codectype;
+ DEBUG_PRINT_INFO("set format type %d, wxh %dx%d, pixelformat %#x",
+ fmt.type, fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
+ fmt.fmt.pix_mp.pixelformat);
+ if (ioctl(m_nDriver_fd, VIDIOC_S_FMT, &fmt)) {
+ DEBUG_PRINT_ERROR("set format failed, type %d, wxh %dx%d, pixelformat %#x",
+ fmt.type, fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
+ fmt.fmt.pix_mp.pixelformat);
+ hw_overload = errno == EBUSY;
+ return false;
+ }
+
+
+ }
+
buf_type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Executing");
ret=ioctl(m_nDriver_fd, VIDIOC_STREAMON,&buf_type);
@@ -5150,6 +5166,8 @@ bool venc_dev::venc_set_tile_dimension(OMX_U32 nTileDimension)
}
DEBUG_PRINT_LOW("Success IOCTL set control for id=%d, value=%d", control.id, control.value);
+ mIsGridset = true;
+ mTileDimension = nTileDimension;
return true;
}