From 2987491ac850dc2aa5878bd202e33c24484ad3cb Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Wed, 7 Dec 2011 12:47:14 -0800 Subject: [PATCH] liboverlay: Add support for interlaced content in updateOverlaySource. UpdateOverlay source didn't have any support for interlaced content. Add the required support. Create a new function to check if the content is interlaced. Change-Id: Ie47b7669461f773b55c71cad6978fc1c8cf4e91b --- liboverlay/overlayLib.cpp | 25 ++++++++++++++++++++----- liboverlay/overlayLib.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/liboverlay/overlayLib.cpp b/liboverlay/overlayLib.cpp index 5245fc2..6f2c604 100755 --- a/liboverlay/overlayLib.cpp +++ b/liboverlay/overlayLib.cpp @@ -256,8 +256,21 @@ bool overlay::enableBarrier (unsigned int orientation) { int overlay::getColorFormat(int format) { - return (format == HAL_PIXEL_FORMAT_YV12) ? - format : COLOR_FORMAT(format); + if (format == HAL_PIXEL_FORMAT_YV12) + return format; + else if (format & INTERLACE_MASK) + return format ^ HAL_PIXEL_FORMAT_INTERLACE; + else + return COLOR_FORMAT(format); +} + +bool overlay::isInterlacedContent(int format) +{ + if ((format != HAL_PIXEL_FORMAT_YV12) && + (format & INTERLACE_MASK)) + return true; + + return false; } unsigned int overlay::getOverlayConfig (unsigned int format3D, bool poll, @@ -970,8 +983,8 @@ bool OverlayControlChannel::setOverlayInformation(const overlay_buffer_info& inf mOVInfo.z_order = zorder; mOVInfo.alpha = 0xff; mOVInfo.transp_mask = 0xffffffff; - mOVInfo.flags = flags; } + mOVInfo.flags = flags; if (!ignoreFB) mOVInfo.flags |= MDP_OV_PLAY_NOWAIT; else @@ -1051,7 +1064,9 @@ bool OverlayControlChannel::updateOverlaySource(const overlay_buffer_info& info, ovBufInfo.height = info.height; ovBufInfo.format = hw_format; - if (!setOverlayInformation(ovBufInfo, 0, orientation, 0, waitForVsync, UPDATE_REQUEST)) + int flags = isInterlacedContent(info.format) ? MDP_DEINTERLACE : 0; + if (!setOverlayInformation(ovBufInfo, flags, orientation, 0, waitForVsync, + UPDATE_REQUEST)) return false; return startOVRotatorSessions(ovBufInfo, orientation, UPDATE_REQUEST); @@ -1072,7 +1087,7 @@ bool OverlayControlChannel::startControlChannel(int w, int h, int colorFormat = format; // 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)) { + if (isInterlacedContent(format)) { flags |= MDP_DEINTERLACE; // Get the actual format diff --git a/liboverlay/overlayLib.h b/liboverlay/overlayLib.h index 0a502ea..1448f83 100755 --- a/liboverlay/overlayLib.h +++ b/liboverlay/overlayLib.h @@ -144,6 +144,7 @@ bool enableBarrier(unsigned int orientation); unsigned int getOverlayConfig (unsigned int format3D, bool poll = true, bool isHDMI = false); int getColorFormat(int format); +bool isInterlacedContent(int format); int get_mdp_format(int format); int get_size(int format, int w, int h); int get_rot_output_format(int format);