From 7e2db6e3d075c55e00a03209d54c28634f35223c Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Tue, 28 Jun 2011 11:58:56 -0700 Subject: [PATCH] liboverlay: Add YV12 support Add support in the overlay for the YV12 color format. (cherry picked from commit 0f9a27cc39b6d4202b54059bc7c64eea9efcf3f1) Change-Id: I4b57eb383ca8f728243bd7e397696932e26c8889 --- libgralloc-qsd8k/gpu.cpp | 2 +- liboverlay/overlayLib.cpp | 11 ++++++++++- liboverlay/overlayLib.h | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index b4e00ca..a4234ab 100755 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -259,7 +259,7 @@ void gpu_context_t::getGrallocInformationFromFormat(int inputFormat, int *colorF *colorFormat = inputFormat; if (inputFormat == HAL_PIXEL_FORMAT_YV12) { - *bufferType = BUFFER_TYPE_UI; // There is no overlay support for this format yet. + *bufferType = BUFFER_TYPE_VIDEO; } else if (inputFormat & S3D_FORMAT_MASK) { // S3D format *colorFormat = COLOR_FORMAT(inputFormat); diff --git a/liboverlay/overlayLib.cpp b/liboverlay/overlayLib.cpp index 90fa9bf..cd2d43c 100644 --- a/liboverlay/overlayLib.cpp +++ b/liboverlay/overlayLib.cpp @@ -42,6 +42,8 @@ int overlay::get_mdp_format(int format) { return MDP_Y_CBCR_H2V2; case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED: return MDP_Y_CRCB_H2V2_TILE; + case HAL_PIXEL_FORMAT_YV12: + return MDP_Y_CR_CB_H2V2; } return -1; } @@ -320,6 +322,11 @@ int Overlay::hasHDMIStatusChanged() { } int Overlay::getS3DFormat(int format) { + // The S3D is part of the HAL_PIXEL_FORMAT_YV12 value. Add + // an explicit check for the format + if (format == HAL_PIXEL_FORMAT_YV12) { + return 0; + } int format3D = FORMAT_3D(format); int fIn3D = FORMAT_3D_INPUT(format3D); // MSB 2 bytes are input format int fOut3D = FORMAT_3D_OUTPUT(format3D); // LSB 2 bytes are output format @@ -773,7 +780,9 @@ bool OverlayControlChannel::startControlChannel(int w, int h, int hw_format; int flags = 0; int colorFormat = format; - if (format & INTERLACE_MASK) { + // The interlace mask is part of the HAL_PIXEL_FORMAT_YV12 value. Add + // an explicit check for the format + if ((format != HAL_PIXEL_FORMAT_YV12) && (format & INTERLACE_MASK)) { flags |= MDP_DEINTERLACE; // Get the actual format diff --git a/liboverlay/overlayLib.h b/liboverlay/overlayLib.h index a4bff39..d4709c0 100644 --- a/liboverlay/overlayLib.h +++ b/liboverlay/overlayLib.h @@ -265,7 +265,8 @@ private: bool setChannelCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h, int channel); bool queueBuffer(int fd, uint32_t offset, int channel); int hasHDMIStatusChanged(); - int getColorFormat(int format) { return COLOR_FORMAT(format); } + int getColorFormat(int format) { return (format == HAL_PIXEL_FORMAT_YV12) ? + format : COLOR_FORMAT(format); } int getS3DFormat(int format); };