Skip to content

Commit

Permalink
Merge "mm-video-v4l2: vdec: Use global setprop to disable UBWC mode"
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux Build Service Account authored and Gerrit - the friendly Code Review server committed Jun 12, 2015
2 parents 346be44 + 274bd37 commit 4e65548
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.
42 changes: 24 additions & 18 deletions mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ class omx_vdec: public qc_omx_component
OMX_ERRORTYPE enable_smoothstreaming();
OMX_ERRORTYPE enable_adaptive_playback(unsigned long width, unsigned long height);
bool is_thulium_v1;
static bool m_disable_ubwc_mode;

unsigned int m_fill_output_msg;
bool client_set_fps;
Expand Down Expand Up @@ -1080,24 +1081,29 @@ class omx_vdec: public qc_omx_component

static OMX_COLOR_FORMATTYPE getPreferredColorFormatDefaultMode(OMX_U32 index) {
//for surface mode (normal playback), advertise native/accelerated formats first
#if _UBWC_
OMX_COLOR_FORMATTYPE formatsDefault[] = {
[0] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed,
[1] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
[2] = OMX_COLOR_FormatYUV420Planar,
[3] = OMX_COLOR_FormatYUV420SemiPlanar,
[4] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
};
#else
OMX_COLOR_FORMATTYPE formatsDefault[] = {
[0] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
[1] = OMX_COLOR_FormatYUV420Planar,
[2] = OMX_COLOR_FormatYUV420SemiPlanar,
[3] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
};
#endif
return (index < sizeof(formatsDefault) / sizeof(OMX_COLOR_FORMATTYPE)) ?
formatsDefault[index] : OMX_COLOR_FormatMax;
OMX_COLOR_FORMATTYPE format = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;

if (!omx_vdec::m_disable_ubwc_mode) {
OMX_COLOR_FORMATTYPE formatsDefault[] = {
[0] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed,
[1] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
[2] = OMX_COLOR_FormatYUV420Planar,
[3] = OMX_COLOR_FormatYUV420SemiPlanar,
[4] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
};
format = (index < sizeof(formatsDefault) / sizeof(OMX_COLOR_FORMATTYPE)) ?
formatsDefault[index] : OMX_COLOR_FormatMax;
} else {
OMX_COLOR_FORMATTYPE formatsDefault[] = {
[0] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
[1] = OMX_COLOR_FormatYUV420Planar,
[2] = OMX_COLOR_FormatYUV420SemiPlanar,
[3] = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
};
format = (index < sizeof(formatsDefault) / sizeof(OMX_COLOR_FORMATTYPE)) ?
formatsDefault[index] : OMX_COLOR_FormatMax;
}
return format;
}

static OMX_ERRORTYPE describeColorFormat(OMX_PTR params);
Expand Down
31 changes: 21 additions & 10 deletions mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ extern "C" {
static OMX_U32 maxSmoothStreamingWidth = 1920;
static OMX_U32 maxSmoothStreamingHeight = 1088;

bool omx_vdec::m_disable_ubwc_mode;

void* async_message_thread (void *input)
{
OMX_BUFFERHEADERTYPE *buffer;
Expand Down Expand Up @@ -685,6 +687,14 @@ omx_vdec::omx_vdec(): m_error_propogated(false),
m_disable_dynamic_buf_mode = atoi(property_value);
DEBUG_PRINT_HIGH("vidc.dec.debug.dyn.disabled value is %d",m_disable_dynamic_buf_mode);

#ifdef _UBWC_
property_value[0] = '\0';
property_get("debug.gralloc.gfx_ubwc_disable", property_value, "0");
m_disable_ubwc_mode = atoi(property_value);
DEBUG_PRINT_HIGH("UBWC mode is %s", m_disable_ubwc_mode ? "disabled" : "enabled");
#else
m_disable_ubwc_mode = true;
#endif
#endif
memset(&m_cmp,0,sizeof(m_cmp));
memset(&m_cb,0,sizeof(m_cb));
Expand Down Expand Up @@ -1983,11 +1993,11 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)

if (eRet == OMX_ErrorNone) {
OMX_COLOR_FORMATTYPE dest_color_format;
#ifdef _UBWC_
drv_ctx.output_format = VDEC_YUV_FORMAT_NV12_UBWC;
#else
drv_ctx.output_format = VDEC_YUV_FORMAT_NV12;
#endif
if (m_disable_ubwc_mode) {
drv_ctx.output_format = VDEC_YUV_FORMAT_NV12;
} else {
drv_ctx.output_format = VDEC_YUV_FORMAT_NV12_UBWC;
}
if (eCompressionFormat == (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingMVC)
dest_color_format = (OMX_COLOR_FORMATTYPE)
QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView;
Expand All @@ -2001,11 +2011,12 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)

dpb_bit_depth = MSM_VIDC_BIT_DEPTH_8;

#ifdef _UBWC_
capture_capability = V4L2_PIX_FMT_NV12_UBWC;
#else
capture_capability = V4L2_PIX_FMT_NV12;
#endif
if (m_disable_ubwc_mode) {
capture_capability = V4L2_PIX_FMT_NV12;
} else {
capture_capability = V4L2_PIX_FMT_NV12_UBWC;
}

struct v4l2_capability cap;
ret = ioctl(drv_ctx.video_driver_fd, VIDIOC_QUERYCAP, &cap);
if (ret) {
Expand Down

0 comments on commit 4e65548

Please sign in to comment.