overlay: Remove obsolete code from pipe config path
Remove obsolete / unused code from pipe config path like pipe crop
modification for rotator downscale, 3D, pipestate.
Change-Id: I34ec80dce8736f65069794f21fbd56922304cb8b
diff --git a/liboverlay/mdpWrapper.h b/liboverlay/mdpWrapper.h
index 1aada9e..e24ad6a 100644
--- a/liboverlay/mdpWrapper.h
+++ b/liboverlay/mdpWrapper.h
@@ -83,9 +83,6 @@
/* MSMFB_OVERLAY_PLAY */
bool play(int fd, msmfb_overlay_data& od);
-/* MSMFB_OVERLAY_3D */
-bool set3D(int fd, msmfb_overlay_3d& ov);
-
/* MSMFB_DISPLAY_COMMIT */
bool displayCommit(int fd);
@@ -231,16 +228,6 @@
return true;
}
-inline bool set3D(int fd, msmfb_overlay_3d& ov) {
- ATRACE_CALL();
- if (ioctl(fd, MSMFB_OVERLAY_3D, &ov) < 0) {
- ALOGE("Failed to call ioctl MSMFB_OVERLAY_3D err=%s",
- strerror(errno));
- return false;
- }
- return true;
-}
-
inline bool displayCommit(int fd, mdp_display_commit& info) {
ATRACE_CALL();
if(ioctl(fd, MSMFB_DISPLAY_COMMIT, &info) == -1) {
diff --git a/liboverlay/overlayCtrlData.h b/liboverlay/overlayCtrlData.h
index 5cadebd..2eec98c 100644
--- a/liboverlay/overlayCtrlData.h
+++ b/liboverlay/overlayCtrlData.h
@@ -77,8 +77,6 @@
/* retrieve crop data */
utils::Dim getCrop() const;
utils::Dim getPosition() const;
- /* Set downscale */
- void setDownscale(int dscale_factor);
/* Update the src format based on rotator's dest */
void updateSrcFormat(const uint32_t& rotDstFormat);
/* return pipe priority */
@@ -213,10 +211,6 @@
return mMdp->getDstRectDim();
}
-inline void Ctrl::setDownscale(int dscale_factor) {
- mMdp->setDownscale(dscale_factor);
-}
-
inline uint8_t Ctrl::getPriority() const {
return mMdp->getPriority();
}
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index 4bdefc5..7f9f136 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -54,7 +54,6 @@
utils::memset0(mOVInfo);
mOVInfo.id = MSMFB_NEW_REQUEST;
mOrientation = utils::OVERLAY_TRANSFORM_0;
- mDownscale = 0;
mDpy = 0;
#ifdef USES_POST_PROCESSING
memset(&mParams, 0, sizeof(struct compute_params));
@@ -147,13 +146,7 @@
}
void MdpCtrl::doDownscale() {
- int mdpVersion = MDPVersion::getInstance().getMDPVersion();
- if(mdpVersion < MDSS_V5) {
- mOVInfo.src_rect.x >>= mDownscale;
- mOVInfo.src_rect.y >>= mDownscale;
- mOVInfo.src_rect.w >>= mDownscale;
- mOVInfo.src_rect.h >>= mDownscale;
- } else if(MDPVersion::getInstance().supportsDecimation()) {
+ if(MDPVersion::getInstance().supportsDecimation()) {
utils::getDecimationFactor(mOVInfo.src_rect.w, mOVInfo.src_rect.h,
mOVInfo.dst_rect.w, mOVInfo.dst_rect.h, mOVInfo.horz_deci,
mOVInfo.vert_deci);
@@ -224,12 +217,6 @@
ovutils::getDump(buf, len, "Data", mOvData);
}
-void MdpCtrl3D::dump() const {
- ALOGE("== Dump MdpCtrl start ==");
- mFd.dump();
- ALOGE("== Dump MdpCtrl end ==");
-}
-
bool MdpCtrl::setVisualParams(const MetaData_t& data) {
ALOGD_IF(0, "In %s: data.operation = %d", __FUNCTION__, data.operation);
#ifdef USES_POST_PROCESSING
diff --git a/liboverlay/overlayMdp.h b/liboverlay/overlayMdp.h
index f7d64f0..cb8e057 100644
--- a/liboverlay/overlayMdp.h
+++ b/liboverlay/overlayMdp.h
@@ -64,8 +64,6 @@
void setPosition(const utils::Dim& dim);
/* using user_data, sets/unsets roationvalue in mdp flags */
void setRotationFlags();
- /* Performs downscale calculations */
- void setDownscale(int dscale_factor);
/* Update the src format with rotator's dest*/
void updateSrcFormat(const uint32_t& rotDstFormat);
/* dump state of the object */
@@ -125,7 +123,6 @@
mdp_overlay mOVInfo;
/* FD for the mdp fbnum */
OvFD mFd;
- int mDownscale;
int mDpy;
#ifdef USES_POST_PROCESSING
@@ -134,31 +131,6 @@
#endif
};
-
-/* MDP 3D related ctrl */
-class MdpCtrl3D {
-public:
- /* ctor reset data */
- MdpCtrl3D();
- /* calls MSMFB_OVERLAY_3D */
- bool close();
- /* set w/h. format is ignored*/
- void setWh(const utils::Whf& whf);
- /* set is_3d calls MSMFB_OVERLAY_3D */
- bool useVirtualFB();
- /* set fd to be used in ioctl */
- void setFd(int fd);
- /* dump */
- void dump() const;
-private:
- /* reset */
- void reset();
- /* actual MSM 3D info */
- msmfb_overlay_3d m3DOVInfo;
- /* FD for the mdp 3D */
- OvFD mFd;
-};
-
/* MDP data */
class MdpData {
public:
@@ -236,10 +208,6 @@
mOVInfo.is_fg = isFg;
}
-inline void MdpCtrl::setDownscale(int dscale) {
- mDownscale = dscale;
-}
-
inline void MdpCtrl::setPlaneAlpha(int planeAlpha) {
mOVInfo.alpha = planeAlpha;
}
@@ -312,46 +280,6 @@
return mOVInfo.priority;
}
-/////// MdpCtrl3D //////
-
-inline MdpCtrl3D::MdpCtrl3D() { reset(); }
-inline bool MdpCtrl3D::close() {
- if (m3DOVInfo.is_3d) {
- m3DOVInfo.is_3d = 0;
- if(!mdp_wrapper::set3D(mFd.getFD(), m3DOVInfo)) {
- ALOGE("MdpCtrl3D close failed set3D with 0");
- return false;
- }
- }
- reset();
- return true;
-}
-inline void MdpCtrl3D::reset() {
- utils::memset0(m3DOVInfo);
-}
-
-inline void MdpCtrl3D::setFd(int fd) {
- mFd.copy(fd);
- OVASSERT(mFd.valid(), "MdpCtrl3D setFd, FD should be valid");
-}
-
-inline void MdpCtrl3D::setWh(const utils::Whf& whf) {
- // ignore fmt. Needed for useVirtualFB callflow
- m3DOVInfo.width = whf.w;
- m3DOVInfo.height = whf.h;
-}
-
-inline bool MdpCtrl3D::useVirtualFB() {
- if(!m3DOVInfo.is_3d) {
- m3DOVInfo.is_3d = 1;
- if(!mdp_wrapper::set3D(mFd.getFD(), m3DOVInfo)) {
- ALOGE("MdpCtrl3D close failed set3D with 0");
- return false;
- }
- }
- return true;
-}
-
/////// MdpData //////
inline MdpData::MdpData(const int& dpy) {
diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp
index 312a6c6..0e063ab 100644
--- a/liboverlay/overlayUtils.cpp
+++ b/liboverlay/overlayUtils.cpp
@@ -74,12 +74,6 @@
//----------From class Res ------------------------------
const char* const Res::fbPath = "/dev/graphics/fb%u";
const char* const Res::rotPath = "/dev/msm_rotator";
-const char* const Res::format3DFile =
- "/sys/class/graphics/fb1/format_3d";
-const char* const Res::edid3dInfoFile =
- "/sys/class/graphics/fb1/3d_present";
-const char* const Res::barrierFile =
- "/sys/devices/platform/mipi_novatek.0/enable_3d_barrier";
//--------------------------------------------------------
@@ -340,86 +334,6 @@
}
}
-bool is3DTV() {
- char is3DTV = '0';
- IOFile fp(Res::edid3dInfoFile, "r");
- (void)fp.read(is3DTV, 1);
- ALOGI("3DTV EDID flag: %d", is3DTV);
- return (is3DTV == '0') ? false : true;
-}
-
-bool isPanel3D() {
- OvFD fd;
- if(!overlay::open(fd, 0 /*fb*/, Res::fbPath)){
- ALOGE("isPanel3D Can't open framebuffer 0");
- return false;
- }
- fb_fix_screeninfo finfo;
- if(!mdp_wrapper::getFScreenInfo(fd.getFD(), finfo)) {
- ALOGE("isPanel3D read fb0 failed");
- }
- fd.close();
- return (FB_TYPE_3D_PANEL == finfo.type) ? true : false;
-}
-
-bool usePanel3D() {
- if(!isPanel3D())
- return false;
- char value[PROPERTY_VALUE_MAX];
- property_get("persist.user.panel3D", value, "0");
- int usePanel3D = atoi(value);
- return usePanel3D ? true : false;
-}
-
-bool send3DInfoPacket (uint32_t format3D) {
- IOFile fp(Res::format3DFile, "wb");
- (void)fp.write("%d", format3D);
- if(!fp.valid()) {
- ALOGE("send3DInfoPacket: no sysfs entry for setting 3d mode");
- return false;
- }
- return true;
-}
-
-bool enableBarrier (uint32_t orientation) {
- IOFile fp(Res::barrierFile, "wb");
- (void)fp.write("%d", orientation);
- if(!fp.valid()) {
- ALOGE("enableBarrier no sysfs entry for "
- "enabling barriers on 3D panel");
- return false;
- }
- return true;
-}
-
-uint32_t getS3DFormat(uint32_t fmt) {
- // The S3D is part of the HAL_PIXEL_FORMAT_YV12 value. Add
- // an explicit check for the format
- if (fmt == HAL_PIXEL_FORMAT_YV12) {
- return 0;
- }
- uint32_t fmt3D = format3D(fmt);
- uint32_t fIn3D = format3DInput(fmt3D); // MSB 2 bytes - inp
- uint32_t fOut3D = format3DOutput(fmt3D); // LSB 2 bytes - out
- fmt3D = fIn3D | fOut3D;
- if (!fIn3D) {
- fmt3D |= fOut3D << SHIFT_TOT_3D; //Set the input format
- }
- if (!fOut3D) {
- switch (fIn3D) {
- case HAL_3D_IN_SIDE_BY_SIDE_L_R:
- case HAL_3D_IN_SIDE_BY_SIDE_R_L:
- // For all side by side formats, set the output
- // format as Side-by-Side i.e 0x1
- fmt3D |= HAL_3D_IN_SIDE_BY_SIDE_L_R >> SHIFT_TOT_3D;
- break;
- default:
- fmt3D |= fIn3D >> SHIFT_TOT_3D; //Set the output format
- }
- }
- return fmt3D;
-}
-
void getDump(char *buf, size_t len, const char *prefix,
const mdp_overlay& ov) {
char str[256] = {'\0'};
diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h
index 39507f2..2fcc4ef 100644
--- a/liboverlay/overlayUtils.h
+++ b/liboverlay/overlayUtils.h
@@ -120,40 +120,9 @@
const NoCopy& operator=(const NoCopy&);
};
-
-/* 3D related utils, defines etc...
- * The compound format passed to the overlay is
- * ABCCC where A is the input 3D format
- * B is the output 3D format
- * CCC is the color format e.g YCbCr420SP YCrCb420SP etc */
-enum { SHIFT_OUT_3D = 12,
- SHIFT_TOT_3D = 16 };
-enum { INPUT_3D_MASK = 0xFFFF0000,
- OUTPUT_3D_MASK = 0x0000FFFF };
-enum { BARRIER_LAND = 1,
- BARRIER_PORT = 2 };
-
-inline uint32_t format3D(uint32_t x) { return x & 0xFF000; }
-inline uint32_t format3DOutput(uint32_t x) {
- return (x & 0xF000) >> SHIFT_OUT_3D; }
-inline uint32_t format3DInput(uint32_t x) { return x & 0xF0000; }
-
-bool isHDMIConnected ();
-bool is3DTV();
-bool isPanel3D();
-bool usePanel3D();
-bool send3DInfoPacket (uint32_t fmt);
-bool enableBarrier (uint32_t orientation);
-uint32_t getS3DFormat(uint32_t fmt);
bool isMdssRotator();
void normalizeCrop(uint32_t& xy, uint32_t& wh);
-template <int CHAN>
-bool getPositionS3D(const Whf& whf, Dim& out);
-
-template <int CHAN>
-bool getCropS3D(const Dim& in, Dim& out, uint32_t fmt);
-
template <class Type>
void swapWidthHeight(Type& width, Type& height);
@@ -446,39 +415,6 @@
return a ? ((value + (a-1)) & ~(a-1)) : value;
}
-enum eRotOutFmt {
- ROT_OUT_FMT_DEFAULT,
- ROT_OUT_FMT_Y_CRCB_H2V2
-};
-
-template <int ROT_OUT_FMT> struct RotOutFmt;
-
-// FIXME, taken from gralloc_priv.h. Need to
-// put it back as soon as overlay takes place of the old one
-/* possible formats for 3D content*/
-enum {
- HAL_NO_3D = 0x0000,
- HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000,
- HAL_3D_IN_TOP_BOTTOM = 0x20000,
- HAL_3D_IN_INTERLEAVE = 0x40000,
- HAL_3D_IN_SIDE_BY_SIDE_R_L = 0x80000,
- HAL_3D_OUT_SIDE_BY_SIDE = 0x1000,
- HAL_3D_OUT_TOP_BOTTOM = 0x2000,
- HAL_3D_OUT_INTERLEAVE = 0x4000,
- HAL_3D_OUT_MONOSCOPIC = 0x8000
-};
-
-enum { HAL_3D_OUT_SBS_MASK =
- HAL_3D_OUT_SIDE_BY_SIDE >> overlay::utils::SHIFT_OUT_3D,
- HAL_3D_OUT_TOP_BOT_MASK =
- HAL_3D_OUT_TOP_BOTTOM >> overlay::utils::SHIFT_OUT_3D,
- HAL_3D_OUT_INTERL_MASK =
- HAL_3D_OUT_INTERLEAVE >> overlay::utils::SHIFT_OUT_3D,
- HAL_3D_OUT_MONOS_MASK =
- HAL_3D_OUT_MONOSCOPIC >> overlay::utils::SHIFT_OUT_3D
-};
-
-
inline bool isYuv(uint32_t format) {
switch(format){
case MDP_Y_CBCR_H2V1:
@@ -577,105 +513,6 @@
ALOGE("== Dump Dim x=%d y=%d w=%d h=%d start/end ==", x, y, w, h);
}
-// FB0
-template <int CHAN>
-inline Dim getPositionS3DImpl(const Whf& whf)
-{
- switch (whf.format & OUTPUT_3D_MASK)
- {
- case HAL_3D_OUT_SBS_MASK:
- // x, y, w, h
- return Dim(0, 0, whf.w/2, whf.h);
- case HAL_3D_OUT_TOP_BOT_MASK:
- return Dim(0, 0, whf.w, whf.h/2);
- case HAL_3D_OUT_MONOS_MASK:
- return Dim();
- case HAL_3D_OUT_INTERL_MASK:
- // FIXME error?
- ALOGE("%s HAL_3D_OUT_INTERLEAVE_MASK", __FUNCTION__);
- return Dim();
- default:
- ALOGE("%s Unsupported 3D output format %d", __FUNCTION__,
- whf.format);
- }
- return Dim();
-}
-
-template <>
-inline Dim getPositionS3DImpl<utils::OV_RIGHT_SPLIT>(const Whf& whf)
-{
- switch (whf.format & OUTPUT_3D_MASK)
- {
- case HAL_3D_OUT_SBS_MASK:
- return Dim(whf.w/2, 0, whf.w/2, whf.h);
- case HAL_3D_OUT_TOP_BOT_MASK:
- return Dim(0, whf.h/2, whf.w, whf.h/2);
- case HAL_3D_OUT_MONOS_MASK:
- return Dim(0, 0, whf.w, whf.h);
- case HAL_3D_OUT_INTERL_MASK:
- // FIXME error?
- ALOGE("%s HAL_3D_OUT_INTERLEAVE_MASK", __FUNCTION__);
- return Dim();
- default:
- ALOGE("%s Unsupported 3D output format %d", __FUNCTION__,
- whf.format);
- }
- return Dim();
-}
-
-template <int CHAN>
-inline bool getPositionS3D(const Whf& whf, Dim& out) {
- out = getPositionS3DImpl<CHAN>(whf);
- return (out != Dim());
-}
-
-template <int CHAN>
-inline Dim getCropS3DImpl(const Dim& in, uint32_t fmt) {
- switch (fmt & INPUT_3D_MASK)
- {
- case HAL_3D_IN_SIDE_BY_SIDE_L_R:
- return Dim(0, 0, in.w/2, in.h);
- case HAL_3D_IN_SIDE_BY_SIDE_R_L:
- return Dim(in.w/2, 0, in.w/2, in.h);
- case HAL_3D_IN_TOP_BOTTOM:
- return Dim(0, 0, in.w, in.h/2);
- case HAL_3D_IN_INTERLEAVE:
- ALOGE("%s HAL_3D_IN_INTERLEAVE", __FUNCTION__);
- break;
- default:
- ALOGE("%s Unsupported 3D format %d", __FUNCTION__, fmt);
- break;
- }
- return Dim();
-}
-
-template <>
-inline Dim getCropS3DImpl<utils::OV_RIGHT_SPLIT>(const Dim& in, uint32_t fmt) {
- switch (fmt & INPUT_3D_MASK)
- {
- case HAL_3D_IN_SIDE_BY_SIDE_L_R:
- return Dim(in.w/2, 0, in.w/2, in.h);
- case HAL_3D_IN_SIDE_BY_SIDE_R_L:
- return Dim(0, 0, in.w/2, in.h);
- case HAL_3D_IN_TOP_BOTTOM:
- return Dim(0, in.h/2, in.w, in.h/2);
- case HAL_3D_IN_INTERLEAVE:
- ALOGE("%s HAL_3D_IN_INTERLEAVE", __FUNCTION__);
- break;
- default:
- ALOGE("%s Unsupported 3D format %d", __FUNCTION__, fmt);
- break;
- }
- return Dim();
-}
-
-template <int CHAN>
-inline bool getCropS3D(const Dim& in, Dim& out, uint32_t fmt)
-{
- out = getCropS3DImpl<CHAN>(in, fmt);
- return (out != Dim());
-}
-
template <class Type>
void swapWidthHeight(Type& width, Type& height) {
Type tmp = width;
@@ -728,12 +565,6 @@
static const char* const fbPath;
// /dev/msm_rotator
static const char* const rotPath;
- // /sys/class/graphics/fb1/format_3d
- static const char* const format3DFile;
- // /sys/class/graphics/fb1/3d_present
- static const char* const edid3dInfoFile;
- // /sys/devices/platform/mipi_novatek.0/enable_3d_barrier
- static const char* const barrierFile;
};
diff --git a/liboverlay/pipes/overlay3DPipe.h b/liboverlay/pipes/overlay3DPipe.h
deleted file mode 100644
index 4e5630e..0000000
--- a/liboverlay/pipes/overlay3DPipe.h
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
-* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef OVERLAY_M3D_EXT_PIPE_H
-#define OVERLAY_M3D_EXT_PIPE_H
-
-#include "overlayGenPipe.h"
-#include "overlayUtils.h"
-
-namespace overlay {
-
-///////////// M3DExt Pipe ////////////////////////////
-/**
-* A specific impl of GenericPipe for 3D.
-* Whenever needed to have a pass through - we do it.
-* If there is a special need for special/diff behavior
-* do it here
-* PANEL is always EXTERNAL for this pipe.
-* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
-* 3D crop and position */
-template <int CHAN>
-class M3DExtPipe : utils::NoCopy {
-public:
- /* Please look at overlayGenPipe.h for info */
- explicit M3DExtPipe();
- ~M3DExtPipe();
- bool init(RotatorBase* rot);
- bool close();
- bool commit();
- bool queueBuffer(int fd, uint32_t offset);
- bool setCrop(const utils::Dim& d);
- bool setPosition(const utils::Dim& dim);
- bool setTransform(const utils::eTransform& param);
- bool setSource(const utils::PipeArgs& args);
- void dump() const;
-private:
- overlay::GenericPipe<utils::EXTERNAL> mM3d;
- // Cache the M3D format
- uint32_t mM3Dfmt;
-};
-
-///////////// M3DPrimary Pipe ////////////////////////////
-/**
-* A specific impl of GenericPipe for 3D.
-* Whenever needed to have a pass through - we do it.
-* If there is a special need for special/diff behavior
-* do it here
-* PANEL is always PRIMARY for this pipe.
-* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
-* 3D crop and position */
-template <int CHAN>
-class M3DPrimaryPipe : utils::NoCopy {
-public:
- /* Please look at overlayGenPipe.h for info */
- explicit M3DPrimaryPipe();
- ~M3DPrimaryPipe();
- bool init(RotatorBase* rot);
- bool close();
- bool commit();
- bool queueBuffer(int fd, uint32_t offset);
- bool setCrop(const utils::Dim& d);
- bool setPosition(const utils::Dim& dim);
- bool setTransform(const utils::eTransform& param);
- bool setSource(const utils::PipeArgs& args);
- void dump() const;
-private:
- overlay::GenericPipe<utils::PRIMARY> mM3d;
- // Cache the M3D format
- uint32_t mM3Dfmt;
-};
-
-///////////// S3DExt Pipe ////////////////////////////////
-/**
-* A specific impl of GenericPipe for 3D.
-* Whenever needed to have a pass through - we do it.
-* If there is a special need for special/diff behavior
-* do it here.
-* PANEL is always EXTERNAL for this pipe.
-* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
-* 3D crop and position */
-template <int CHAN>
-class S3DExtPipe : utils::NoCopy {
-public:
- /* Please look at overlayGenPipe.h for info */
- explicit S3DExtPipe();
- ~S3DExtPipe();
- bool init(RotatorBase* rot);
- bool close();
- bool commit();
- bool queueBuffer(int fd, uint32_t offset);
- bool setCrop(const utils::Dim& d);
- bool setPosition(const utils::Dim& dim);
- bool setTransform(const utils::eTransform& param);
- bool setSource(const utils::PipeArgs& args);
- void dump() const;
-private:
- overlay::GenericPipe<utils::EXTERNAL> mS3d;
- // Cache the 3D format
- uint32_t mS3Dfmt;
-};
-
-///////////// S3DPrimary Pipe ////////////////////////////
-/**
-* A specific impl of GenericPipe for 3D.
-* Whenever needed to have a pass through - we do it.
-* If there is a special need for special/diff behavior
-* do it here
-* PANEL is always PRIMARY for this pipe.
-* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
-* 3D crop and position */
-template <int CHAN>
-class S3DPrimaryPipe : utils::NoCopy {
-public:
- /* Please look at overlayGenPipe.h for info */
- explicit S3DPrimaryPipe();
- ~S3DPrimaryPipe();
- bool init(RotatorBase* rot);
- bool close();
- bool commit();
- bool queueBuffer(int fd, uint32_t offset);
- bool setCrop(const utils::Dim& d);
- bool setPosition(const utils::Dim& dim);
- bool setTransform(const utils::eTransform& param);
- bool setSource(const utils::PipeArgs& args);
- void dump() const;
-private:
- /* needed for 3D related IOCTL */
- MdpCtrl3D mCtrl3D;
- overlay::GenericPipe<utils::PRIMARY> mS3d;
- // Cache the 3D format
- uint32_t mS3Dfmt;
-};
-
-
-
-
-//------------------------Inlines and Templates--------------------------
-
-
-///////////// M3DExt Pipe ////////////////////////////
-template <int CHAN>
-inline M3DExtPipe<CHAN>::M3DExtPipe() : mM3Dfmt(0) {}
-template <int CHAN>
-inline M3DExtPipe<CHAN>::~M3DExtPipe() { close(); }
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::init(RotatorBase* rot) {
- ALOGE_IF(DEBUG_OVERLAY, "M3DExtPipe init");
- if(!mM3d.init(rot)) {
- ALOGE("3Dpipe failed to init");
- return false;
- }
- return true;
-}
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::close() {
- return mM3d.close();
-}
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::commit() { return mM3d.commit(); }
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
- return mM3d.queueBuffer(fd, offset);
-}
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
- utils::Dim _dim;
- if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
- ALOGE("M3DExtPipe setCrop failed to getCropS3D");
- _dim = d;
- }
- return mM3d.setCrop(_dim);
-}
-
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::setPosition(const utils::Dim& d) {
- utils::Dim _dim;
- // original setPositionHandleState has getPositionS3D(...,true)
- // which means format is HAL_3D_OUT_SBS_MASK
- // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
- // code suggets
- utils::Whf _whf(mM3d.getScreenInfo().mFBWidth,
- mM3d.getScreenInfo().mFBHeight,
- mM3Dfmt);
- if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
- ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
- _dim = d;
- }
- return mM3d.setPosition(_dim);
-}
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) {
- return mM3d.setTransform(param);
-}
-template <int CHAN>
-inline bool M3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args)
-{
- // extract 3D fmt
- mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
- utils::HAL_3D_OUT_MONOS_MASK;
- return mM3d.setSource(args);
-}
-template <int CHAN>
-inline void M3DExtPipe<CHAN>::dump() const {
- ALOGE("M3DExtPipe Pipe fmt=%d", mM3Dfmt);
- mM3d.dump();
-}
-
-
-///////////// M3DPrimary Pipe ////////////////////////////
-template <int CHAN>
-inline M3DPrimaryPipe<CHAN>::M3DPrimaryPipe() : mM3Dfmt(0) {}
-template <int CHAN>
-inline M3DPrimaryPipe<CHAN>::~M3DPrimaryPipe() { close(); }
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::init(RotatorBase* rot) {
- ALOGE_IF(DEBUG_OVERLAY, "M3DPrimaryPipe init");
- if(!mM3d.init(rot)) {
- ALOGE("3Dpipe failed to init");
- return false;
- }
- return true;
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::close() {
- return mM3d.close();
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::commit() { return mM3d.commit(); }
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
- return mM3d.queueBuffer(fd, offset);
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
- utils::Dim _dim;
- if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
- ALOGE("M3DPrimaryPipe setCrop failed to getCropS3D");
- _dim = d;
- }
- return mM3d.setCrop(_dim);
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d) {
- return mM3d.setPosition(d);
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) {
- return mM3d.setTransform(param);
-}
-template <int CHAN>
-inline bool M3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
-{
- // extract 3D fmt
- mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
- utils::HAL_3D_OUT_MONOS_MASK;
- return mM3d.setSource(args);
-}
-template <int CHAN>
-inline void M3DPrimaryPipe<CHAN>::dump() const {
- ALOGE("M3DPrimaryPipe Pipe fmt=%d", mM3Dfmt);
- mM3d.dump();
-}
-
-///////////// S3DExt Pipe ////////////////////////////////
-template <int CHAN>
-inline S3DExtPipe<CHAN>::S3DExtPipe() : mS3Dfmt(0) {}
-template <int CHAN>
-inline S3DExtPipe<CHAN>::~S3DExtPipe() { close(); }
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::init(RotatorBase* rot) {
- ALOGE_IF(DEBUG_OVERLAY, "S3DExtPipe init");
- if(!mS3d.init(rot)) {
- ALOGE("3Dpipe failed to init");
- return false;
- }
- return true;
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::close() {
- if(!utils::send3DInfoPacket(0)) {
- ALOGE("S3DExtPipe close failed send3D info packet");
- }
- return mS3d.close();
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::commit() { return mS3d.commit(); }
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
- return mS3d.queueBuffer(fd, offset);
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
- utils::Dim _dim;
- if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
- ALOGE("S3DExtPipe setCrop failed to getCropS3D");
- _dim = d;
- }
- return mS3d.setCrop(_dim);
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::setPosition(const utils::Dim& d)
-{
- utils::Dim _dim;
- utils::Whf _whf(mS3d.getScreenInfo().mFBWidth,
- mS3d.getScreenInfo().mFBHeight,
- mS3Dfmt);
- if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
- ALOGE("S3DExtPipe setPosition err in getPositionS3D");
- _dim = d;
- }
- return mS3d.setPosition(_dim);
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) {
- return mS3d.setTransform(param);
-}
-template <int CHAN>
-inline bool S3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args) {
- mS3Dfmt = utils::getS3DFormat(args.whf.format);
- return mS3d.setSource(args);
-}
-template <int CHAN>
-inline void S3DExtPipe<CHAN>::dump() const {
- ALOGE("S3DExtPipe Pipe fmt=%d", mS3Dfmt);
- mS3d.dump();
-}
-
-///////////// S3DPrimary Pipe ////////////////////////////
-template <int CHAN>
-inline S3DPrimaryPipe<CHAN>::S3DPrimaryPipe() : mS3Dfmt(0) {}
-template <int CHAN>
-inline S3DPrimaryPipe<CHAN>::~S3DPrimaryPipe() { close(); }
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::init(RotatorBase* rot) {
- ALOGE_IF(DEBUG_OVERLAY, "S3DPrimaryPipe init");
- if(!mS3d.init(rot)) {
- ALOGE("3Dpipe failed to init");
- return false;
- }
- // set the ctrl fd
- mCtrl3D.setFd(mS3d.getCtrlFd());
- return true;
-}
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::close() {
- if(!utils::enableBarrier(0)) {
- ALOGE("S3DExtPipe close failed enable barrier");
- }
- mCtrl3D.close();
- return mS3d.close();
-}
-
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::commit() {
- uint32_t fmt = mS3Dfmt & utils::OUTPUT_3D_MASK;
- if(!utils::send3DInfoPacket(fmt)){
- ALOGE("Error S3DExtPipe start error send3DInfoPacket %d", fmt);
- return false;
- }
- return mS3d.commit();
-}
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
- return mS3d.queueBuffer(fd, offset);
-}
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
- utils::Dim _dim;
- if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
- ALOGE("S3DPrimaryPipe setCrop failed to getCropS3D");
- _dim = d;
- }
- return mS3d.setCrop(_dim);
-}
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d)
-{
- utils::Whf fbwhf(mS3d.getScreenInfo().mFBWidth,
- mS3d.getScreenInfo().mFBHeight,
- 0 /* fmt dont care*/);
- mCtrl3D.setWh(fbwhf);
- if(!mCtrl3D.useVirtualFB()) {
- ALOGE("Failed to use VFB on %d (non fatal)", utils::FB0);
- return false;
- }
- utils::Dim _dim;
- // original setPositionHandleState has getPositionS3D(...,true)
- // which means format is HAL_3D_OUT_SBS_MASK
- // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
- // code suggets
- utils::Whf _whf(d.w, d.h, utils::HAL_3D_OUT_SBS_MASK);
- if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
- ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
- _dim = d;
- }
- return mS3d.setPosition(_dim);
-}
-
-/* for S3DPrimaryPipe, we need to have barriers once
-* So the easiest way to achieve it, is to make sure FB0 is having it before
-* setParam is running */
-template <>
-inline bool S3DPrimaryPipe<utils::OV_PIPE0>::setTransform(
- const utils::eTransform& param) {
- uint32_t barrier=0;
- switch(param) {
- case utils::OVERLAY_TRANSFORM_ROT_90:
- case utils::OVERLAY_TRANSFORM_ROT_270:
- barrier = utils::BARRIER_LAND;
- break;
- default:
- barrier = utils::BARRIER_PORT;
- break;
- }
- if(!utils::enableBarrier(barrier)) {
- ALOGE("S3DPrimaryPipe setTransform failed to enable barrier");
- }
- return mS3d.setTransform(param);
-}
-
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) {
- return mS3d.setTransform(param);
-}
-template <int CHAN>
-inline bool S3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
-{
- mS3Dfmt = utils::getS3DFormat(args.whf.format);
- return mS3d.setSource(args);
-}
-template <int CHAN>
-inline void S3DPrimaryPipe<CHAN>::dump() const {
- ALOGE("S3DPrimaryPipe Pipe fmt=%d", mS3Dfmt);
- mS3d.dump();
-}
-
-} // overlay
-
-#endif // OVERLAY_M3D_EXT_PIPE_H
diff --git a/liboverlay/pipes/overlayGenPipe.cpp b/liboverlay/pipes/overlayGenPipe.cpp
index 41cb271..aebaebf 100644
--- a/liboverlay/pipes/overlayGenPipe.cpp
+++ b/liboverlay/pipes/overlayGenPipe.cpp
@@ -32,18 +32,16 @@
namespace overlay {
-GenericPipe::GenericPipe(const int& dpy) : mDpy(dpy), mRotDownscaleOpt(false),
- pipeState(CLOSED), mCtrl(new Ctrl(dpy)), mData(new Data(dpy)) {
+GenericPipe::GenericPipe(const int& dpy) : mDpy(dpy),
+ mCtrl(new Ctrl(dpy)), mData(new Data(dpy)) {
}
GenericPipe::~GenericPipe() {
delete mCtrl;
delete mData;
- setClosed();
}
void GenericPipe::setSource(const utils::PipeArgs& args) {
- mRotDownscaleOpt = args.rotFlags & utils::ROT_DOWNSCALE_ENABLED;
mCtrl->setSource(args);
}
@@ -73,26 +71,10 @@
}
bool GenericPipe::commit() {
- bool ret = false;
- int downscale_factor = utils::ROT_DS_NONE;
-
- if(mRotDownscaleOpt) {
- ovutils::Dim src(mCtrl->getCrop());
- ovutils::Dim dst(mCtrl->getPosition());
- downscale_factor = ovutils::getDownscaleFactor(
- src.w, src.h, dst.w, dst.h);
- }
-
- mCtrl->setDownscale(downscale_factor);
- ret = mCtrl->commit();
-
- pipeState = ret ? OPEN : CLOSED;
- return ret;
+ return mCtrl->commit();
}
bool GenericPipe::queueBuffer(int fd, uint32_t offset) {
- //TODO Move pipe-id transfer to CtrlData class. Make ctrl and data private.
- OVASSERT(isOpen(), "State is closed, cannot queueBuffer");
int pipeId = mCtrl->getPipeId();
OVASSERT(-1 != pipeId, "Ctrl ID should not be -1");
// set pipe id from ctrl to data
@@ -101,10 +83,6 @@
return mData->queueBuffer(fd, offset);
}
-int GenericPipe::getCtrlFd() const {
- return mCtrl->getFd();
-}
-
utils::Dim GenericPipe::getCrop() const
{
return mCtrl->getCrop();
@@ -117,7 +95,6 @@
void GenericPipe::dump() const
{
ALOGE("== Dump Generic pipe start ==");
- ALOGE("pipe state = %d", (int)pipeState);
mCtrl->dump();
mData->dump();
ALOGE("== Dump Generic pipe end ==");
@@ -128,19 +105,6 @@
mData->getDump(buf, len);
}
-bool GenericPipe::isClosed() const {
- return (pipeState == CLOSED);
-}
-
-bool GenericPipe::isOpen() const {
- return (pipeState == OPEN);
-}
-
-bool GenericPipe::setClosed() {
- pipeState = CLOSED;
- return true;
-}
-
int GenericPipe::getPipeId() {
return mCtrl->getPipeId();
}
diff --git a/liboverlay/pipes/overlayGenPipe.h b/liboverlay/pipes/overlayGenPipe.h
index c7e16f3..0a2639a 100644
--- a/liboverlay/pipes/overlayGenPipe.h
+++ b/liboverlay/pipes/overlayGenPipe.h
@@ -65,12 +65,6 @@
const utils::PipeArgs& getArgs() const;
/* retrieve cached crop data */
utils::Dim getCrop() const;
- /* is closed */
- bool isClosed() const;
- /* is open */
- bool isOpen() const;
- /* return Ctrl fd. Used for S3D */
- int getCtrlFd() const;
/* return pipe priority */
uint8_t getPriority() const;
/* dump the state of the object */
@@ -82,19 +76,7 @@
static bool validateAndSet(GenericPipe* pipeArray[], const int& count,
const int& fbFd);
private:
- /* set Closed pipe */
- bool setClosed();
-
int mDpy;
- //Whether we will do downscale opt. This is just a request. If the frame is
- //not a candidate, we might not do it.
- bool mRotDownscaleOpt;
- /* Pipe open or closed */
- enum ePipeState {
- CLOSED,
- OPEN
- };
- ePipeState pipeState;
Ctrl *mCtrl;
Data *mData;
};