diff options
author | Andy Qiu <junhai.qiu@intel.com> | 2013-09-26 12:17:52 -0700 |
---|---|---|
committer | cactus <cactus@intel.com> | 2013-10-02 12:44:54 -0700 |
commit | eaded89a58db5526b0fc32a4c8b267755512c216 (patch) | |
tree | e7a92109cc7de1d19c38fc1c2f0a863ca5923613 /ips | |
parent | 51779bcebdb675fefc8a23f17e4e1070590f85a0 (diff) | |
download | hwcomposer-eaded89a58db5526b0fc32a4c8b267755512c216.tar.gz |
support NV12 pixel format
BZ: 134278
Use overlay to preview camera if output is in NV12 pixel format.
Change-Id: I8dd173bea2b675836c226b8b04ec365419a72b6d
Signed-off-by: Andy Qiu <junhai.qiu@intel.com>
Reviewed-on: http://android.intel.com:8080/134712
Reviewed-by: Jin, Fu <fu.jin@intel.com>
Reviewed-by: Hu, Austin <austin.hu@intel.com>
Reviewed-by: Patel, Hitesh K <hitesh.k.patel@intel.com>
Tested-by: Patel, Hitesh K <hitesh.k.patel@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
Diffstat (limited to 'ips')
-rw-r--r-- | ips/common/GrallocBufferBase.cpp | 6 | ||||
-rw-r--r-- | ips/common/OverlayPlaneBase.cpp | 13 | ||||
-rw-r--r-- | ips/common/PlaneCapabilities.cpp | 11 |
3 files changed, 27 insertions, 3 deletions
diff --git a/ips/common/GrallocBufferBase.cpp b/ips/common/GrallocBufferBase.cpp index 1be9257..a5adc95 100644 --- a/ips/common/GrallocBufferBase.cpp +++ b/ips/common/GrallocBufferBase.cpp @@ -73,6 +73,12 @@ void GrallocBufferBase::initStride() mStride.yuv.yStride = yStride; mStride.yuv.uvStride = uvStride; break; + case HAL_PIXEL_FORMAT_NV12: + yStride = align_to(align_to(mWidth, 32), 64); + uvStride = yStride; + mStride.yuv.yStride = yStride; + mStride.yuv.uvStride = uvStride; + break; case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled: yStride = align_to(align_to(mWidth, 32), 64); diff --git a/ips/common/OverlayPlaneBase.cpp b/ips/common/OverlayPlaneBase.cpp index b9e2695..bea8faf 100644 --- a/ips/common/OverlayPlaneBase.cpp +++ b/ips/common/OverlayPlaneBase.cpp @@ -444,6 +444,12 @@ BufferMapper* OverlayPlaneBase::getTTMMapper(BufferMapper& grallocMapper) stride.yuv.yStride = yStride; stride.yuv.uvStride = uvStride; break; + case HAL_PIXEL_FORMAT_NV12: + yStride = align_to(align_to(w, 32), 64); + uvStride = yStride; + stride.yuv.yStride = yStride; + stride.yuv.uvStride = uvStride; + break; case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled: yStride = align_to(align_to(w, 32), 64); @@ -686,6 +692,12 @@ bool OverlayPlaneBase::bufferOffsetSetup(BufferMapper& mapper) backBuffer->OBUF_0V = backBuffer->OBUF_0U + (uvStride * (h / 2)); backBuffer->OCMD |= OVERLAY_FORMAT_PLANAR_YUV420; break; + case HAL_PIXEL_FORMAT_NV12: // NV12 + backBuffer->OBUF_0Y = 0; + backBuffer->OBUF_0U = yStride * align_to(h, 32); + backBuffer->OBUF_0V = 0; + backBuffer->OCMD |= OVERLAY_FORMAT_PLANAR_NV12_2; + break; // NOTE: this is the decoded video format, align the height to 32B //as it's defined by video driver case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: // NV12 @@ -779,6 +791,7 @@ bool OverlayPlaneBase::coordinateSetup(BufferMapper& mapper) switch (format) { case HAL_PIXEL_FORMAT_YV12: // YV12 case HAL_PIXEL_FORMAT_I420: // I420 + case HAL_PIXEL_FORMAT_NV12: // NV12 case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: // NV12 case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled: // NV12_tiled break; diff --git a/ips/common/PlaneCapabilities.cpp b/ips/common/PlaneCapabilities.cpp index 4c90a51..5e4fbd2 100644 --- a/ips/common/PlaneCapabilities.cpp +++ b/ips/common/PlaneCapabilities.cpp @@ -52,12 +52,17 @@ bool PlaneCapabilities::isFormatSupported(int planeType, uint32_t format, uint32 } else if (planeType == DisplayPlane::PLANE_OVERLAY) { switch (format) { case HAL_PIXEL_FORMAT_YV12: - return trans ? false : true; case HAL_PIXEL_FORMAT_I420: - case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: - case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled: + case HAL_PIXEL_FORMAT_NV12: case HAL_PIXEL_FORMAT_YUY2: case HAL_PIXEL_FORMAT_UYVY: + // TODO: overlay supports 180 degree rotation + if (trans == HAL_TRANSFORM_ROT_180) { + WTRACE("180 degree rotation is not supported yet"); + } + return trans ? false : true; + case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar: + case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled: return true; default: VTRACE("unsupported format %#x", format); |