overlay: upgrade
p#1: Remove WAIT and CHANNEL enums and usage. Replace BypassPipe with GenericPipe. Client expected to set alignments and parameters. Add transform combination enums. p#2: Allow APIs to be called in any order. Do transform calcs in commit. Move ext type setter and getter functions. p#3: Add calculations for 180 transform. p#4: Add secure session support in rotator p#5: Implement all rotations in terms of H flip, V flip and 90 rotation. Change-Id: I34a9a2a0f1255b3467a0abbaa254d0b584e901ce
This commit is contained in:
parent
35a18b165b
commit
399667e7c4
@ -277,7 +277,6 @@ static void *hdmi_ui_loop(void *ptr)
|
||||
ovutils::PipeArgs parg(mdpFlags,
|
||||
ovutils::OVERLAY_TRANSFORM_0,
|
||||
whf,
|
||||
ovutils::WAIT,
|
||||
ovutils::ZORDER_0,
|
||||
ovutils::IS_FG_OFF,
|
||||
ovutils::ROT_FLAG_ENABLED);
|
||||
|
@ -93,8 +93,6 @@ static int hwc_set(hwc_composer_device_t *dev,
|
||||
hwc_context_t* ctx = (hwc_context_t*)(dev);
|
||||
if (LIKELY(list)) {
|
||||
VideoOverlay::draw(ctx, list);
|
||||
//XXX: Handle vsync with FBIO_WAITFORVSYNC ioctl
|
||||
//All other operations (including pan display) should be NOWAIT
|
||||
EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur);
|
||||
} else {
|
||||
ctx->mOverlay->setState(ovutils::OV_CLOSED);
|
||||
|
@ -107,8 +107,6 @@ bool VideoOverlay::configure(hwc_context_t *ctx, hwc_layer_t *layer)
|
||||
ovutils::OV_MDP_SECURE_OVERLAY_SESSION);
|
||||
}
|
||||
|
||||
ovutils::eWait waitFlag = ovutils::NO_WAIT;
|
||||
|
||||
ovutils::eIsFg isFgFlag = ovutils::IS_FG_OFF;
|
||||
if (ctx->numHwLayers == 1) {
|
||||
isFgFlag = ovutils::IS_FG_SET;
|
||||
@ -116,7 +114,6 @@ bool VideoOverlay::configure(hwc_context_t *ctx, hwc_layer_t *layer)
|
||||
|
||||
ovutils::PipeArgs parg(mdpFlags,
|
||||
info,
|
||||
waitFlag,
|
||||
ovutils::ZORDER_0,
|
||||
isFgFlag,
|
||||
ovutils::ROT_FLAG_DISABLED);
|
||||
|
@ -247,25 +247,15 @@ bool Overlay::setSource(const utils::PipeArgs args[utils::MAX_PIPES],
|
||||
case utils::OV_BYPASS_1_LAYER:
|
||||
case utils::OV_BYPASS_2_LAYER:
|
||||
case utils::OV_BYPASS_3_LAYER:
|
||||
// no tweaking
|
||||
break;
|
||||
case utils::OV_3D_VIDEO_ON_3D_PANEL:
|
||||
case utils::OV_3D_VIDEO_ON_3D_TV:
|
||||
margs[utils::CHANNEL_1].zorder = utils::ZORDER_1;
|
||||
break;
|
||||
//TODO set zorder for channel 1 as 1 in 3D pipe
|
||||
case utils::OV_2D_VIDEO_ON_PANEL_TV:
|
||||
case utils::OV_3D_VIDEO_ON_2D_PANEL_2D_TV:
|
||||
// If displaying on both, external VG pipe set to be no wait
|
||||
margs[utils::CHANNEL_1].wait = utils::NO_WAIT;
|
||||
break;
|
||||
case utils::OV_2D_TRUE_UI_MIRROR:
|
||||
// Set zorder, external VG pipe (video) gets 0, RGB pipe (UI) gets 1
|
||||
margs[utils::CHANNEL_1].zorder = utils::ZORDER_0;
|
||||
margs[utils::CHANNEL_2].zorder = utils::ZORDER_1;
|
||||
// External VG (video) and RGB (UI) pipe set to be no wait
|
||||
margs[utils::CHANNEL_0].wait = utils::WAIT;
|
||||
margs[utils::CHANNEL_1].wait = utils::NO_WAIT;
|
||||
margs[utils::CHANNEL_2].wait = utils::NO_WAIT;
|
||||
// TODO Set zorder, external VG pipe (video) gets 0, RGB pipe (UI) gets 1
|
||||
break;
|
||||
default:
|
||||
OVASSERT(false, "%s Unknown state %d", __FUNCTION__, st);
|
||||
|
@ -38,6 +38,8 @@ void MdpCtrl::reset() {
|
||||
utils::memset0(mLkgo);
|
||||
mOVInfo.id = MSMFB_NEW_REQUEST;
|
||||
mLkgo.id = MSMFB_NEW_REQUEST;
|
||||
mOrientation = utils::OVERLAY_TRANSFORM_0;
|
||||
mRotUsed = false;
|
||||
}
|
||||
|
||||
bool MdpCtrl::close() {
|
||||
@ -54,6 +56,86 @@ bool MdpCtrl::close() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setSource(const utils::PipeArgs& args) {
|
||||
|
||||
setSrcWhf(args.whf);
|
||||
|
||||
//TODO These are hardcoded. Can be moved out of setSource.
|
||||
mOVInfo.alpha = 0xff;
|
||||
mOVInfo.transp_mask = 0xffffffff;
|
||||
|
||||
//TODO These calls should ideally be a part of setPipeParams API
|
||||
setFlags(args.mdpFlags);
|
||||
setZ(args.zorder);
|
||||
setIsFg(args.isFg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setCrop(const utils::Dim& d) {
|
||||
setSrcRectDim(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setPosition(const overlay::utils::Dim& d,
|
||||
int fbw, int fbh)
|
||||
{
|
||||
ovutils::Dim dim(d);
|
||||
ovutils::Dim ovsrcdim = getSrcRectDim();
|
||||
// Scaling of upto a max of 20 times supported
|
||||
if(dim.w >(ovsrcdim.w * ovutils::HW_OV_MAGNIFICATION_LIMIT)){
|
||||
dim.w = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.w;
|
||||
dim.x = (fbw - dim.w) / 2;
|
||||
}
|
||||
if(dim.h >(ovsrcdim.h * ovutils::HW_OV_MAGNIFICATION_LIMIT)) {
|
||||
dim.h = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.h;
|
||||
dim.y = (fbh - dim.h) / 2;
|
||||
}
|
||||
|
||||
setDstRectDim(dim);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setTransform(const utils::eTransform& orient,
|
||||
const bool& rotUsed) {
|
||||
mOrientation = orient;
|
||||
int rot = utils::getMdpOrient(orient);
|
||||
setUserData(rot);
|
||||
//Rotator can be requested by client even if layer has 0 orientation.
|
||||
mRotUsed = rotUsed;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MdpCtrl::doTransform() {
|
||||
adjustSrcWhf(mRotUsed);
|
||||
setRotationFlags();
|
||||
//180 will be H + V
|
||||
//270 will be H + V + 90
|
||||
if(mOrientation & utils::OVERLAY_TRANSFORM_FLIP_H) {
|
||||
overlayTransFlipH();
|
||||
}
|
||||
if(mOrientation & utils::OVERLAY_TRANSFORM_FLIP_V) {
|
||||
overlayTransFlipV();
|
||||
}
|
||||
if(mOrientation & utils::OVERLAY_TRANSFORM_ROT_90) {
|
||||
overlayTransRot90();
|
||||
}
|
||||
}
|
||||
|
||||
bool MdpCtrl::set() {
|
||||
//deferred calcs, so APIs could be called in any order.
|
||||
doTransform();
|
||||
if(!mdp_wrapper::setOverlay(mFd.getFD(), mOVInfo)) {
|
||||
ALOGE("MdpCtrl failed to setOverlay, restoring last known "
|
||||
"good ov info");
|
||||
mdp_wrapper::dump("== Bad OVInfo is: ", mOVInfo);
|
||||
mdp_wrapper::dump("== Last good known OVInfo is: ", mLkgo);
|
||||
this->restore();
|
||||
return false;
|
||||
}
|
||||
this->save();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::getScreenInfo(overlay::utils::ScreenInfo& info) {
|
||||
fb_fix_screeninfo finfo;
|
||||
if (!mdp_wrapper::getFScreenInfo(mFd.getFD(), finfo)) {
|
||||
@ -98,123 +180,6 @@ void MdpCtrl::adjustSrcWhf(const bool& rotUsed) {
|
||||
}
|
||||
}
|
||||
|
||||
bool MdpCtrl::set() {
|
||||
if(!mdp_wrapper::setOverlay(mFd.getFD(), mOVInfo)) {
|
||||
ALOGE("MdpCtrl failed to setOverlay, restoring last known "
|
||||
"good ov info");
|
||||
mdp_wrapper::dump("== Bad OVInfo is: ", mOVInfo);
|
||||
mdp_wrapper::dump("== Last good known OVInfo is: ", mLkgo);
|
||||
this->restore();
|
||||
return false;
|
||||
}
|
||||
this->save();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setSource(const utils::PipeArgs& args) {
|
||||
|
||||
setSrcWhf(args.whf);
|
||||
|
||||
//TODO These are hardcoded. Can be moved out of setSource.
|
||||
mOVInfo.alpha = 0xff;
|
||||
mOVInfo.transp_mask = 0xffffffff;
|
||||
|
||||
//TODO These calls should ideally be a part of setPipeParams API
|
||||
setFlags(args.mdpFlags);
|
||||
setZ(args.zorder);
|
||||
setWait(args.wait);
|
||||
setIsFg(args.isFg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setCrop(const utils::Dim& d) {
|
||||
setSrcRectDim(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MdpCtrl::setTransform(const utils::eTransform& orient,
|
||||
const bool& rotUsed) {
|
||||
|
||||
int rot = utils::getMdpOrient(orient);
|
||||
setUserData(rot);
|
||||
adjustSrcWhf(rotUsed);
|
||||
setRotationFlags();
|
||||
|
||||
switch(static_cast<int>(orient)) {
|
||||
case utils::OVERLAY_TRANSFORM_0:
|
||||
case utils::OVERLAY_TRANSFORM_FLIP_H:
|
||||
case utils::OVERLAY_TRANSFORM_FLIP_V:
|
||||
case utils::OVERLAY_TRANSFORM_ROT_180:
|
||||
//No calculations required
|
||||
break;
|
||||
case utils::OVERLAY_TRANSFORM_ROT_90:
|
||||
case (utils::OVERLAY_TRANSFORM_ROT_90|utils::OVERLAY_TRANSFORM_FLIP_H):
|
||||
case (utils::OVERLAY_TRANSFORM_ROT_90|utils::OVERLAY_TRANSFORM_FLIP_V):
|
||||
overlayTransFlipRot90();
|
||||
break;
|
||||
case utils::OVERLAY_TRANSFORM_ROT_270:
|
||||
overlayTransFlipRot270();
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Error due to unknown rot value", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MdpCtrl::overlayTransFlipRot90()
|
||||
{
|
||||
utils::Dim d = getSrcRectDim();
|
||||
utils::Whf whf = getSrcWhf();
|
||||
int tmp = d.x;
|
||||
d.x = compute(whf.h,
|
||||
d.y,
|
||||
d.h);
|
||||
d.y = tmp;
|
||||
setSrcRectDim(d);
|
||||
swapSrcWH();
|
||||
swapSrcRectWH();
|
||||
}
|
||||
|
||||
void MdpCtrl::overlayTransFlipRot270()
|
||||
{
|
||||
utils::Dim d = getSrcRectDim();
|
||||
utils::Whf whf = getSrcWhf();
|
||||
int tmp = d.y;
|
||||
d.y = compute(whf.w,
|
||||
d.x,
|
||||
d.w);
|
||||
d.x = tmp;
|
||||
setSrcRectDim(d);
|
||||
swapSrcWH();
|
||||
swapSrcRectWH();
|
||||
}
|
||||
|
||||
bool MdpCtrl::setPosition(const overlay::utils::Dim& d,
|
||||
int fbw, int fbh)
|
||||
{
|
||||
// Validatee against FB size
|
||||
if(!d.check(fbw, fbh)) {
|
||||
ALOGE("MdpCtrl setPosition failed dest dim violate screen limits");
|
||||
return false;
|
||||
}
|
||||
|
||||
ovutils::Dim dim(d);
|
||||
ovutils::Dim ovsrcdim = getSrcRectDim();
|
||||
// Scaling of upto a max of 20 times supported
|
||||
if(dim.w >(ovsrcdim.w * ovutils::HW_OV_MAGNIFICATION_LIMIT)){
|
||||
dim.w = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.w;
|
||||
dim.x = (fbw - dim.w) / 2;
|
||||
}
|
||||
if(dim.h >(ovsrcdim.h * ovutils::HW_OV_MAGNIFICATION_LIMIT)) {
|
||||
dim.h = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.h;
|
||||
dim.y = (fbh - dim.h) / 2;
|
||||
}
|
||||
|
||||
setDstRectDim(dim);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MdpCtrl::dump() const {
|
||||
ALOGE("== Dump MdpCtrl start ==");
|
||||
mFd.dump();
|
||||
|
@ -61,8 +61,7 @@ public:
|
||||
/* overlay get */
|
||||
bool get();
|
||||
|
||||
/* returns flags from mdp structure.
|
||||
* Flags are WAIT/NOWAIT/PIPE SHARED*/
|
||||
/* returns flags from mdp structure */
|
||||
int getFlags() const;
|
||||
|
||||
/* set flags to mdp structure */
|
||||
@ -71,9 +70,6 @@ public:
|
||||
/* set z order */
|
||||
void setZ(utils::eZorder z);
|
||||
|
||||
/* set Wait/nowait */
|
||||
void setWait(utils::eWait wait);
|
||||
|
||||
/* set isFg flag */
|
||||
void setIsFg(utils::eIsFg isFg);
|
||||
|
||||
@ -148,8 +144,14 @@ public:
|
||||
private:
|
||||
|
||||
/* helper functions for overlayTransform */
|
||||
void overlayTransFlipRot90();
|
||||
void overlayTransFlipRot270();
|
||||
void doTransform();
|
||||
void overlayTransFlipH();
|
||||
void overlayTransFlipV();
|
||||
void overlayTransRot90();
|
||||
|
||||
utils::eTransform mOrientation; //Holds requested orientation
|
||||
bool mRotUsed; //whether rotator should be used even if requested
|
||||
//orientation is 0.
|
||||
|
||||
/* last good known ov info */
|
||||
mdp_overlay mLkgo;
|
||||
@ -282,10 +284,6 @@ inline void MdpCtrl::setZ(overlay::utils::eZorder z) {
|
||||
mOVInfo.z_order = z;
|
||||
}
|
||||
|
||||
inline void MdpCtrl::setWait(overlay::utils::eWait wait) {
|
||||
mOVInfo.flags = utils::setWait(wait, mOVInfo.flags);
|
||||
}
|
||||
|
||||
inline void MdpCtrl::setIsFg(overlay::utils::eIsFg isFg) {
|
||||
mOVInfo.is_fg = isFg;
|
||||
}
|
||||
@ -376,6 +374,37 @@ inline void MdpCtrl::swapSrcRectWH() {
|
||||
mOVInfo.src_rect.h);
|
||||
}
|
||||
|
||||
inline void MdpCtrl::overlayTransFlipH()
|
||||
{
|
||||
utils::Dim d = getSrcRectDim();
|
||||
utils::Whf whf = getSrcWhf();
|
||||
d.x = compute(whf.w, d.x, d.w);
|
||||
setSrcRectDim(d);
|
||||
}
|
||||
|
||||
inline void MdpCtrl::overlayTransFlipV()
|
||||
{
|
||||
utils::Dim d = getSrcRectDim();
|
||||
utils::Whf whf = getSrcWhf();
|
||||
d.y = compute(whf.h, d.y, d.h);
|
||||
setSrcRectDim(d);
|
||||
}
|
||||
|
||||
inline void MdpCtrl::overlayTransRot90()
|
||||
{
|
||||
utils::Dim d = getSrcRectDim();
|
||||
utils::Whf whf = getSrcWhf();
|
||||
int tmp = d.x;
|
||||
d.x = compute(whf.h,
|
||||
d.y,
|
||||
d.h);
|
||||
d.y = tmp;
|
||||
setSrcRectDim(d);
|
||||
swapSrcWH();
|
||||
swapSrcRectWH();
|
||||
}
|
||||
|
||||
|
||||
/////// MdpCtrl3D //////
|
||||
|
||||
inline MdpCtrl3D::MdpCtrl3D() { reset(); }
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
/* Use libgralloc to retrieve fd, base addr, alloc type */
|
||||
bool open(uint32_t numbufs,
|
||||
uint32_t bufSz, int flags = O_RDWR);
|
||||
uint32_t bufSz, bool isSecure);
|
||||
|
||||
/* close fd. assign base address to invalid*/
|
||||
bool close();
|
||||
@ -115,12 +115,16 @@ inline OvMem::OvMem() {
|
||||
inline OvMem::~OvMem() { }
|
||||
|
||||
inline bool OvMem::open(uint32_t numbufs,
|
||||
uint32_t bufSz, int flags)
|
||||
uint32_t bufSz, bool isSecure)
|
||||
{
|
||||
alloc_data data;
|
||||
int allocFlags = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP;
|
||||
int err = 0;
|
||||
if(isSecure) {
|
||||
allocFlags |= GRALLOC_USAGE_PRIVATE_MM_HEAP;
|
||||
allocFlags |= GRALLOC_USAGE_PRIVATE_DO_NOT_MAP;
|
||||
}
|
||||
|
||||
int err = 0;
|
||||
OVASSERT(numbufs && bufSz, "numbufs=%d bufSz=%d", numbufs, bufSz);
|
||||
|
||||
mBufSz = bufSz;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "overlayRotator.h"
|
||||
#include "overlayUtils.h"
|
||||
#include "overlayMdp.h"
|
||||
|
||||
namespace ovutils = overlay::utils;
|
||||
|
||||
@ -73,19 +72,29 @@ void MdpRot::setSource(const overlay::utils::Whf& awhf) {
|
||||
mBufSize = awhf.size;
|
||||
}
|
||||
|
||||
void MdpRot::setFlags(const utils::eMdpFlags& flags) {
|
||||
mRotImgInfo.secure = 0;
|
||||
if(flags & utils::OV_MDP_SECURE_OVERLAY_SESSION)
|
||||
mRotImgInfo.secure = 1;
|
||||
}
|
||||
|
||||
void MdpRot::setTransform(const utils::eTransform& rot, const bool& rotUsed)
|
||||
{
|
||||
mOrientation = rot;
|
||||
int r = utils::getMdpOrient(rot);
|
||||
ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r);
|
||||
this->setRotations(r);
|
||||
this->setDisable();
|
||||
setRotations(r);
|
||||
setDisable();
|
||||
if(rotUsed) {
|
||||
this->setEnable();
|
||||
setEnable();
|
||||
}
|
||||
switch(static_cast<int>(rot)) {
|
||||
}
|
||||
|
||||
void MdpRot::doTransform() {
|
||||
switch(mOrientation) {
|
||||
case utils::OVERLAY_TRANSFORM_ROT_90:
|
||||
case (utils::OVERLAY_TRANSFORM_ROT_90|utils::OVERLAY_TRANSFORM_FLIP_H):
|
||||
case (utils::OVERLAY_TRANSFORM_ROT_90|utils::OVERLAY_TRANSFORM_FLIP_V):
|
||||
case utils::OVERLAY_TRANSFORM_ROT_90_FLIP_H:
|
||||
case utils::OVERLAY_TRANSFORM_ROT_90_FLIP_V:
|
||||
case utils::OVERLAY_TRANSFORM_ROT_270:
|
||||
utils::swap(mRotImgInfo.dst.width, mRotImgInfo.dst.height);
|
||||
break;
|
||||
@ -95,6 +104,7 @@ void MdpRot::setTransform(const utils::eTransform& rot, const bool& rotUsed)
|
||||
}
|
||||
|
||||
bool MdpRot::commit() {
|
||||
doTransform();
|
||||
if(!overlay::mdp_wrapper::startRotator(mFd.getFD(), mRotImgInfo)) {
|
||||
ALOGE("MdpRot commit failed");
|
||||
dump();
|
||||
@ -110,7 +120,7 @@ bool MdpRot::open_i(uint32_t numbufs, uint32_t bufsz)
|
||||
|
||||
OVASSERT(MAP_FAILED == mem.addr(), "MAP failed in open_i");
|
||||
|
||||
if(!mem.open(numbufs, bufsz)){
|
||||
if(!mem.open(numbufs, bufsz, mRotImgInfo.secure)){
|
||||
ALOGE("%s: Failed to open", __func__);
|
||||
mem.close();
|
||||
return false;
|
||||
@ -176,6 +186,7 @@ void MdpRot::reset() {
|
||||
mMem.curr().mCurrOffset = 0;
|
||||
mMem.prev().mCurrOffset = 0;
|
||||
mBufSize = 0;
|
||||
mOrientation = utils::OVERLAY_TRANSFORM_0;
|
||||
}
|
||||
|
||||
bool MdpRot::queueBuffer(int fd, uint32_t offset) {
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
virtual bool init() = 0;
|
||||
virtual bool close() = 0;
|
||||
virtual void setSource(const utils::Whf& wfh) = 0;
|
||||
virtual void setFlags(const utils::eMdpFlags& flags) = 0;
|
||||
virtual void setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed) = 0;
|
||||
virtual bool commit() = 0;
|
||||
@ -58,7 +59,7 @@ public:
|
||||
virtual void setEnable() = 0;
|
||||
virtual void setDisable() = 0;
|
||||
virtual void setRotations(uint32_t r) = 0;
|
||||
virtual void setSrcFB(bool) = 0;
|
||||
virtual void setSrcFB() = 0;
|
||||
|
||||
virtual bool enabled() const = 0;
|
||||
virtual int getSessId() const = 0;
|
||||
@ -85,6 +86,8 @@ public:
|
||||
virtual bool close() = 0;
|
||||
/* set src */
|
||||
virtual void setSource(const utils::Whf& wfh) = 0;
|
||||
/* set mdp flags, will use only stuff necessary for rotator */
|
||||
virtual void setFlags(const utils::eMdpFlags& flags) = 0;
|
||||
/* Set rotation and calculate */
|
||||
virtual void setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed) = 0;
|
||||
@ -98,7 +101,7 @@ public:
|
||||
/* set rotator flag*/
|
||||
virtual void setRotations(uint32_t r) = 0;
|
||||
/* Mark src as FB (non-ION) */
|
||||
virtual void setSrcFB(bool) = 0;
|
||||
virtual void setSrcFB() = 0;
|
||||
/* Retusn true if rotator enabled */
|
||||
virtual bool enabled() const = 0;
|
||||
/* returns rotator session id */
|
||||
@ -125,11 +128,12 @@ public:
|
||||
virtual bool init();
|
||||
virtual bool close();
|
||||
virtual void setSource(const utils::Whf& wfh);
|
||||
virtual void setFlags(const utils::eMdpFlags& flags);
|
||||
virtual void setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed);
|
||||
virtual bool commit();
|
||||
virtual void setRotations(uint32_t r);
|
||||
virtual void setSrcFB(bool);
|
||||
virtual void setSrcFB();
|
||||
virtual int getDstMemId() const;
|
||||
virtual uint32_t getDstOffset() const;
|
||||
virtual void setEnable();
|
||||
@ -150,6 +154,7 @@ public:
|
||||
virtual bool init();
|
||||
virtual bool close();
|
||||
virtual void setSource(const utils::Whf& wfh);
|
||||
virtual void setFlags(const utils::eMdpFlags& flags);
|
||||
virtual void setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed);
|
||||
virtual bool commit();
|
||||
@ -158,7 +163,7 @@ public:
|
||||
virtual void setEnable();
|
||||
virtual void setDisable();
|
||||
virtual bool enabled () const;
|
||||
virtual void setSrcFB(bool);
|
||||
virtual void setSrcFB();
|
||||
virtual int getSessId() const;
|
||||
virtual int getDstMemId() const;
|
||||
virtual uint32_t getDstOffset() const;
|
||||
@ -211,6 +216,7 @@ public:
|
||||
bool init();
|
||||
bool close();
|
||||
void setSource(const utils::Whf& whf);
|
||||
virtual void setFlags(const utils::eMdpFlags& flags);
|
||||
void setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed);
|
||||
bool commit();
|
||||
@ -218,7 +224,7 @@ public:
|
||||
void setEnable();
|
||||
void setDisable();
|
||||
void setRotations(uint32_t r);
|
||||
void setSrcFB(bool);
|
||||
void setSrcFB();
|
||||
bool enabled() const;
|
||||
int getSessId() const;
|
||||
int getDstMemId() const;
|
||||
@ -229,6 +235,8 @@ private:
|
||||
/* remap rot buffers */
|
||||
bool remap(uint32_t numbufs);
|
||||
bool open_i(uint32_t numbufs, uint32_t bufsz);
|
||||
/* Deferred transform calculations */
|
||||
void doTransform();
|
||||
/* reset underlying data, basically memset 0 */
|
||||
void reset();
|
||||
|
||||
@ -236,6 +244,8 @@ private:
|
||||
msm_rotator_img_info mRotImgInfo;
|
||||
/* rot data */
|
||||
msm_rotator_data_info mRotDataInfo;
|
||||
/* Orientation */
|
||||
utils::eTransform mOrientation;
|
||||
/* rotator fd */
|
||||
OvFD mFd;
|
||||
/* Rotator memory manager */
|
||||
@ -274,6 +284,9 @@ inline bool Rotator::close() {
|
||||
inline void Rotator::setSource(const utils::Whf& whf) {
|
||||
mRot->setSource(whf);
|
||||
}
|
||||
inline void Rotator::setFlags(const utils::eMdpFlags& flags) {
|
||||
mRot->setFlags(flags);
|
||||
}
|
||||
inline void Rotator::setTransform(const utils::eTransform& rot,
|
||||
const bool& rotUsed)
|
||||
{
|
||||
@ -285,7 +298,7 @@ inline bool Rotator::commit() {
|
||||
inline void Rotator::setEnable(){ mRot->setEnable(); }
|
||||
inline void Rotator::setDisable(){ mRot->setDisable(); }
|
||||
inline bool Rotator::enabled() const { return mRot->enabled(); }
|
||||
inline void Rotator::setSrcFB(bool mark) { mRot->setSrcFB(mark); }
|
||||
inline void Rotator::setSrcFB() { mRot->setSrcFB(); }
|
||||
inline int Rotator::getDstMemId() const {
|
||||
return mRot->getDstMemId();
|
||||
}
|
||||
@ -314,6 +327,7 @@ inline bool NullRotator::init() { return true; }
|
||||
inline bool NullRotator::close() { return true; }
|
||||
inline bool NullRotator::commit() { return true; }
|
||||
inline void NullRotator::setSource(const utils::Whf& wfh) {}
|
||||
inline void NullRotator::setFlags(const utils::eMdpFlags& flags) {}
|
||||
inline void NullRotator::setTransform(const utils::eTransform& rot, const bool&)
|
||||
{}
|
||||
inline void NullRotator::setRotations(uint32_t) {}
|
||||
@ -322,7 +336,7 @@ inline void NullRotator::setDisable() {}
|
||||
inline bool NullRotator::enabled() const { return false; }
|
||||
inline int NullRotator::getSessId() const { return -1; }
|
||||
inline bool NullRotator::queueBuffer(int fd, uint32_t offset) { return true; }
|
||||
inline void NullRotator::setSrcFB(bool) {}
|
||||
inline void NullRotator::setSrcFB() {}
|
||||
inline int NullRotator::getDstMemId() const { return -1; }
|
||||
inline uint32_t NullRotator::getDstOffset() const { return 0;}
|
||||
inline void NullRotator::dump() const {
|
||||
@ -344,12 +358,10 @@ inline uint32_t MdpRot::getDstOffset() const {
|
||||
return mRotDataInfo.dst.offset;
|
||||
}
|
||||
inline int MdpRot::getSessId() const { return mRotImgInfo.session_id; }
|
||||
inline void MdpRot::setSrcFB(bool set) {
|
||||
if(set)
|
||||
mRotDataInfo.src.flags |= MDP_MEMORY_ID_TYPE_FB;
|
||||
inline void MdpRot::setSrcFB() {
|
||||
mRotDataInfo.src.flags |= MDP_MEMORY_ID_TYPE_FB;
|
||||
}
|
||||
|
||||
|
||||
} // overlay
|
||||
|
||||
#endif // OVERlAY_ROTATOR_H
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "overlayImpl.h"
|
||||
#include "overlayRotator.h"
|
||||
#include "pipes/overlayGenPipe.h"
|
||||
#include "pipes/overlayBypassPipe.h"
|
||||
#include "pipes/overlayVideoExtPipe.h"
|
||||
#include "pipes/overlayUIMirrorPipe.h"
|
||||
#include "pipes/overlay3DPipe.h"
|
||||
@ -238,7 +237,7 @@ template <> struct StateTraits<utils::OV_2D_TRUE_UI_MIRROR>
|
||||
|
||||
template <> struct StateTraits<utils::OV_BYPASS_1_LAYER>
|
||||
{
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::WAIT, utils::ZORDER_0> pipe0;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
|
||||
typedef overlay::NullPipe pipe1; // place holder
|
||||
typedef overlay::NullPipe pipe2; // place holder
|
||||
|
||||
@ -251,8 +250,8 @@ template <> struct StateTraits<utils::OV_BYPASS_1_LAYER>
|
||||
|
||||
template <> struct StateTraits<utils::OV_BYPASS_2_LAYER>
|
||||
{
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::NO_WAIT, utils::ZORDER_0> pipe0;
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_OFF, utils::WAIT, utils::ZORDER_1> pipe1;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe1;
|
||||
typedef overlay::NullPipe pipe2; // place holder
|
||||
|
||||
typedef NullRotator rot0;
|
||||
@ -264,9 +263,9 @@ template <> struct StateTraits<utils::OV_BYPASS_2_LAYER>
|
||||
|
||||
template <> struct StateTraits<utils::OV_BYPASS_3_LAYER>
|
||||
{
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_SET, utils::NO_WAIT, utils::ZORDER_0> pipe0;
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_VG, utils::IS_FG_OFF, utils::NO_WAIT, utils::ZORDER_1> pipe1;
|
||||
typedef overlay::BypassPipe<utils::OV_MDP_PIPE_RGB, utils::IS_FG_OFF, utils::WAIT, utils::ZORDER_2> pipe2;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe0;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe1;
|
||||
typedef overlay::GenericPipe<utils::PRIMARY> pipe2;
|
||||
|
||||
typedef NullRotator rot0;
|
||||
typedef NullRotator rot1;
|
||||
|
@ -177,11 +177,18 @@ int getMdpFormat(int format) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool isHDMIConnected () {
|
||||
char value[PROPERTY_VALUE_MAX] = {0};
|
||||
property_get("hw.hdmiON", value, "0");
|
||||
int isHDMI = atoi(value);
|
||||
return isHDMI ? true : false;
|
||||
//Set by client as HDMI/WFD
|
||||
void setExtType(const int& type) {
|
||||
if(type != HDMI && type != WFD) {
|
||||
ALOGE("%s: Unrecognized type %d", __func__, type);
|
||||
return;
|
||||
}
|
||||
sExtType = type;
|
||||
}
|
||||
|
||||
//Return External panel type set by client.
|
||||
int getExtType() {
|
||||
return sExtType;
|
||||
}
|
||||
|
||||
bool is3DTV() {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <fcntl.h> // open, O_RDWR, etc
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h> // buffer_handle_t
|
||||
#include <linux/msm_mdp.h> // MDP_OV_PLAY_NOWAIT etc ...
|
||||
#include <linux/msm_mdp.h> // flags
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -250,15 +250,6 @@ enum eRotFlags {
|
||||
ROT_FLAG_ENABLED = 1 // needed in rot
|
||||
};
|
||||
|
||||
/* Wait/No wait for waiting for vsync
|
||||
* WAIT - wait for vsync, ignore fb (no need to compose w/ fb)
|
||||
* NO_WAIT - do not wait for vsync and return immediatly since
|
||||
* we need to run composition code */
|
||||
enum eWait {
|
||||
WAIT,
|
||||
NO_WAIT
|
||||
};
|
||||
|
||||
/* The values for is_fg flag for control alpha and transp
|
||||
* IS_FG_OFF means is_fg = 0
|
||||
* IS_FG_SET means is_fg = 1
|
||||
@ -277,7 +268,7 @@ enum eMdpFlags {
|
||||
OV_MDP_FLAGS_NONE = 0,
|
||||
OV_MDP_PIPE_SHARE = MDP_OV_PIPE_SHARE,
|
||||
OV_MDP_DEINTERLACE = MDP_DEINTERLACE,
|
||||
OV_MDP_PLAY_NOWAIT = MDP_OV_PLAY_NOWAIT,
|
||||
OV_MDP_PLAY_NOWAIT = MDP_OV_PLAY_NOWAIT, //deprecated
|
||||
OV_MDP_SECURE_OVERLAY_SESSION = MDP_SECURE_OVERLAY_SESSION,
|
||||
OV_MDP_SOURCE_ROTATED_90 = MDP_SOURCE_ROTATED_90,
|
||||
OV_MDP_MEMORY_ID_TYPE_FB = MDP_MEMORY_ID_TYPE_FB,
|
||||
@ -308,24 +299,12 @@ enum eMdpPipeType {
|
||||
OV_MDP_PIPE_VG
|
||||
};
|
||||
|
||||
/* Corresponds to pipes in eDest */
|
||||
enum eChannel {
|
||||
CHANNEL_0,
|
||||
CHANNEL_1,
|
||||
CHANNEL_2
|
||||
};
|
||||
|
||||
// Max pipes via overlay (VG0, VG1, RGB1)
|
||||
enum { MAX_PIPES = 3 };
|
||||
|
||||
/* Used to identify destination channels and
|
||||
* also 3D channels e.g. when in 3D mode with 2
|
||||
* pipes opened and it is used in get crop/pos 3D
|
||||
*
|
||||
* PLEASE NOTE : DO NOT USE eDest FOR ARRAYS
|
||||
* i.e. args[OV_PIPE1] since it is a BIT MASK
|
||||
* use CHANNELS enum instead. Each OV_PIPEX is
|
||||
* not specific to a display (primary/external).
|
||||
* */
|
||||
enum eDest {
|
||||
OV_PIPE0 = 1 << 0,
|
||||
@ -337,61 +316,51 @@ enum eDest {
|
||||
/* values for copybit_set_parameter(OVERLAY_TRANSFORM) */
|
||||
enum eTransform {
|
||||
/* No rot */
|
||||
OVERLAY_TRANSFORM_0 = 0x0,
|
||||
/* flip source image horizontally */
|
||||
OVERLAY_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
|
||||
/* flip source image vertically */
|
||||
OVERLAY_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
|
||||
/* rotate source image 90 degrees */
|
||||
OVERLAY_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
|
||||
OVERLAY_TRANSFORM_0 = 0x0,
|
||||
/* flip source image horizontally 0x1 */
|
||||
OVERLAY_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
|
||||
/* flip source image vertically 0x2 */
|
||||
OVERLAY_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
|
||||
/* rotate source image 180 degrees
|
||||
* It is basically bit-or-ed H | V == 0x3 */
|
||||
OVERLAY_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
|
||||
OVERLAY_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
|
||||
/* rotate source image 90 degrees 0x4 */
|
||||
OVERLAY_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
|
||||
/* rotate source image 90 degrees and flip horizontally 0x5 */
|
||||
OVERLAY_TRANSFORM_ROT_90_FLIP_H = HAL_TRANSFORM_ROT_90 |
|
||||
HAL_TRANSFORM_FLIP_H,
|
||||
/* rotate source image 90 degrees and flip vertically 0x6 */
|
||||
OVERLAY_TRANSFORM_ROT_90_FLIP_V = HAL_TRANSFORM_ROT_90 |
|
||||
HAL_TRANSFORM_FLIP_V,
|
||||
/* rotate source image 270 degrees
|
||||
* Basically 180 | 90 == 0x7 */
|
||||
OVERLAY_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
|
||||
OVERLAY_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
|
||||
/* rotate invalid like in Transform.h */
|
||||
OVERLAY_TRANSFORM_INV = 0x80
|
||||
};
|
||||
|
||||
/* offset and fd are play info */
|
||||
struct PlayInfo {
|
||||
PlayInfo() : fd(-1), offset(0) {}
|
||||
PlayInfo(int _fd, uint32_t _offset) :
|
||||
fd(_fd), offset(_offset) {}
|
||||
bool operator==(const PlayInfo& p) {
|
||||
return (fd == p.fd && offset == p.offset);
|
||||
}
|
||||
int fd;
|
||||
uint32_t offset;
|
||||
OVERLAY_TRANSFORM_INV = 0x80
|
||||
};
|
||||
|
||||
// Used to consolidate pipe params
|
||||
struct PipeArgs {
|
||||
PipeArgs() : mdpFlags(OV_MDP_FLAGS_NONE),
|
||||
wait(NO_WAIT),
|
||||
zorder(Z_SYSTEM_ALLOC),
|
||||
isFg(IS_FG_OFF),
|
||||
rotFlags(ROT_FLAG_DISABLED){
|
||||
}
|
||||
|
||||
PipeArgs(eMdpFlags f, Whf _whf, eWait w,
|
||||
PipeArgs(eMdpFlags f, Whf _whf,
|
||||
eZorder z, eIsFg fg, eRotFlags r) :
|
||||
mdpFlags(f),
|
||||
whf(_whf),
|
||||
wait(w),
|
||||
zorder(z),
|
||||
isFg(fg),
|
||||
rotFlags(r) {
|
||||
}
|
||||
|
||||
eMdpFlags mdpFlags; // for mdp_overlay flags PIPE_SHARE, NO_WAIT, etc
|
||||
eMdpFlags mdpFlags; // for mdp_overlay flags
|
||||
Whf whf;
|
||||
eWait wait; // flags WAIT/NO_WAIT
|
||||
eZorder zorder; // stage number
|
||||
eIsFg isFg; // control alpha & transp
|
||||
eRotFlags rotFlags;
|
||||
PlayInfo play;
|
||||
};
|
||||
|
||||
enum eOverlayState{
|
||||
@ -441,21 +410,13 @@ enum {
|
||||
WFD = 2
|
||||
};
|
||||
|
||||
//TODO Make this a part of some appropriate class
|
||||
static int sExtType = HDMI; //HDMI or WFD
|
||||
|
||||
//Set by client as HDMI/WFD
|
||||
static inline void setExtType(const int& type) {
|
||||
if(type != HDMI || type != WFD) {
|
||||
ALOGE("%s: Unrecognized type %d", __func__, type);
|
||||
return;
|
||||
}
|
||||
sExtType = type;
|
||||
}
|
||||
|
||||
void setExtType(const int& type);
|
||||
//Return External panel type set by client.
|
||||
static inline int getExtType() {
|
||||
return sExtType;
|
||||
}
|
||||
int getExtType();
|
||||
|
||||
|
||||
//Gets the FB number for the external type.
|
||||
//As of now, HDMI always has fb1, WFD could use fb1 or fb2
|
||||
@ -480,6 +441,7 @@ static int getFBForPanel(int panel) { // PRIMARY OR EXTERNAL
|
||||
}
|
||||
|
||||
// number of rgb pipes bufs (max)
|
||||
|
||||
// 2 for rgb0/1 double bufs
|
||||
enum { RGB_PIPE_NUM_BUFS = 2 };
|
||||
|
||||
@ -504,12 +466,6 @@ int getMdpOrient(eTransform rotation);
|
||||
const char* getFormatString(uint32_t format);
|
||||
const char* getStateString(eOverlayState state);
|
||||
|
||||
inline int setWait(eWait wait, int flags) {
|
||||
return (wait == WAIT) ?
|
||||
flags &= ~MDP_OV_PLAY_NOWAIT :
|
||||
flags |= MDP_OV_PLAY_NOWAIT;
|
||||
}
|
||||
|
||||
// Cannot use HW_OVERLAY_MAGNIFICATION_LIMIT, since at the time
|
||||
// of integration, HW_OVERLAY_MAGNIFICATION_LIMIT was a define
|
||||
enum { HW_OV_MAGNIFICATION_LIMIT = 20,
|
||||
@ -685,18 +641,18 @@ inline void Dim::dump() const {
|
||||
|
||||
inline int getMdpOrient(eTransform rotation) {
|
||||
ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, rotation);
|
||||
switch(static_cast<int>(rotation))
|
||||
switch(rotation)
|
||||
{
|
||||
case OVERLAY_TRANSFORM_0 : return 0;
|
||||
case HAL_TRANSFORM_FLIP_V: return MDP_FLIP_UD;
|
||||
case HAL_TRANSFORM_FLIP_H: return MDP_FLIP_LR;
|
||||
case HAL_TRANSFORM_ROT_90: return MDP_ROT_90;
|
||||
case HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_V:
|
||||
return MDP_ROT_90|MDP_FLIP_LR;
|
||||
case HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_H:
|
||||
return MDP_ROT_90|MDP_FLIP_UD;
|
||||
case HAL_TRANSFORM_ROT_180: return MDP_ROT_180;
|
||||
case HAL_TRANSFORM_ROT_270: return MDP_ROT_270;
|
||||
case OVERLAY_TRANSFORM_FLIP_V: return MDP_FLIP_UD;
|
||||
case OVERLAY_TRANSFORM_FLIP_H: return MDP_FLIP_LR;
|
||||
case OVERLAY_TRANSFORM_ROT_90: return MDP_ROT_90;
|
||||
case OVERLAY_TRANSFORM_ROT_90_FLIP_V:
|
||||
return MDP_ROT_90 | MDP_FLIP_UD;
|
||||
case OVERLAY_TRANSFORM_ROT_90_FLIP_H:
|
||||
return MDP_ROT_90 | MDP_FLIP_LR;
|
||||
case OVERLAY_TRANSFORM_ROT_180: return MDP_ROT_180;
|
||||
case OVERLAY_TRANSFORM_ROT_270: return MDP_ROT_270;
|
||||
default:
|
||||
ALOGE("%s: invalid rotation value (value = 0x%x",
|
||||
__FUNCTION__, rotation);
|
||||
|
@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Code Aurora Forum. 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 Code Aurora Forum, Inc. 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_BYPASS_PIPE_H
|
||||
#define OVERLAY_BYPASS_PIPE_H
|
||||
|
||||
#include "overlayGenPipe.h"
|
||||
#include "overlayUtils.h"
|
||||
#include "overlayCtrlData.h"
|
||||
#include "overlayMdp.h"
|
||||
#include "overlayRotator.h"
|
||||
|
||||
namespace overlay {
|
||||
|
||||
/* A specific impl of GenericPipe
|
||||
* Whenever needed to have a pass through - we do it.
|
||||
* If there is a special need for a different behavior - do it here
|
||||
* PipeType = 0 (RGB), 1 (VG) */
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
class BypassPipe : utils::NoCopy {
|
||||
public:
|
||||
/* Please look at overlayGenPipe.h for info */
|
||||
explicit BypassPipe();
|
||||
~BypassPipe();
|
||||
bool init(RotatorBase* rot);
|
||||
bool close();
|
||||
bool commit();
|
||||
bool queueBuffer(int fd, uint32_t offset);
|
||||
bool waitForVsync();
|
||||
bool setCrop(const utils::Dim& dim);
|
||||
bool setPosition(const utils::Dim& dim);
|
||||
bool setTransform(const utils::eTransform& param);
|
||||
bool setSource(const utils::PipeArgs& args);
|
||||
utils::eOverlayPipeType getOvPipeType() const;
|
||||
void dump() const;
|
||||
private:
|
||||
overlay::GenericPipe<ovutils::PRIMARY> mBypass;
|
||||
};
|
||||
|
||||
//------------------Inlines and Templates---------------------
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline BypassPipe<PipeType, IsFg, Wait, Zorder>::BypassPipe() {}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline BypassPipe<PipeType, IsFg, Wait, Zorder>::~BypassPipe() {
|
||||
close();
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::init(RotatorBase* rot) {
|
||||
ALOGE_IF(DEBUG_OVERLAY, "BypassPipe init");
|
||||
return mBypass.init(rot);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::close() {
|
||||
return mBypass.close();
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::commit() {
|
||||
return mBypass.commit();
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::queueBuffer(int fd,
|
||||
uint32_t offset) {
|
||||
return mBypass.queueBuffer(fd, offset);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::waitForVsync() {
|
||||
return mBypass.waitForVsync();
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setCrop(
|
||||
const utils::Dim& dim) {
|
||||
return mBypass.setCrop(dim);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setPosition(
|
||||
const utils::Dim& dim) {
|
||||
return mBypass.setPosition(dim);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setTransform(
|
||||
const utils::eTransform& param) {
|
||||
return mBypass.setTransform(param);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline bool BypassPipe<PipeType, IsFg, Wait, Zorder>::setSource(
|
||||
const utils::PipeArgs& args) {
|
||||
utils::PipeArgs arg(args);
|
||||
|
||||
// Stride aligned to 32
|
||||
arg.whf.w = utils::align(arg.whf.w, 32);
|
||||
arg.whf.h = utils::align(arg.whf.h, 32);
|
||||
|
||||
// VG or RG pipe
|
||||
if (PipeType == utils::OV_MDP_PIPE_VG) {
|
||||
setMdpFlags(arg.mdpFlags, utils::OV_MDP_PIPE_SHARE);
|
||||
}
|
||||
|
||||
// Set is_fg flag
|
||||
arg.isFg = IsFg;
|
||||
|
||||
// Wait or no wait
|
||||
arg.wait = Wait;
|
||||
|
||||
// Z-order
|
||||
arg.zorder = Zorder;
|
||||
|
||||
return mBypass.setSource(arg);
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline utils::eOverlayPipeType BypassPipe<PipeType, IsFg, Wait,
|
||||
Zorder>::getOvPipeType() const {
|
||||
return utils::OV_PIPE_TYPE_BYPASS;
|
||||
}
|
||||
|
||||
template <utils::eMdpPipeType PipeType, utils::eIsFg IsFg, utils::eWait Wait,
|
||||
utils::eZorder Zorder>
|
||||
inline void BypassPipe<PipeType, IsFg, Wait, Zorder>::dump() const {
|
||||
ALOGE("Bypass VG Pipe");
|
||||
mBypass.dump();
|
||||
}
|
||||
|
||||
} // overlay
|
||||
|
||||
#endif // OVERLAY_BYPASS_PIPE_H
|
@ -102,12 +102,6 @@ private:
|
||||
/* Ctrl/Data aggregator */
|
||||
CtrlData mCtrlData;
|
||||
|
||||
/* caching startup params. useful when need
|
||||
* to have the exact copy of that pipe.
|
||||
* For example when HDMI is connected, and we would
|
||||
* like to open/start the pipe with the args */
|
||||
utils::PipeArgs mArgs;
|
||||
|
||||
/* rotator mdp base
|
||||
* Can point to NullRotator or to Rotator*/
|
||||
RotatorBase* mRot;
|
||||
@ -207,6 +201,7 @@ inline bool GenericPipe<PANEL>::setSource(
|
||||
//Cache if user wants 0-rotation
|
||||
mRotUsed = newargs.rotFlags & utils::ROT_FLAG_ENABLED;
|
||||
mRot->setSource(newargs.whf);
|
||||
mRot->setFlags(newargs.mdpFlags);
|
||||
return mCtrlData.ctrl.setSource(newargs);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ inline bool UIMirrorPipe::init(RotatorBase* rot) {
|
||||
bool ret = mUI.init(rot);
|
||||
//If source to rotator is FB, which is the case with UI Mirror pipe,
|
||||
//we need to inform driver during playback, since FB does not use ION.
|
||||
rot->setSrcFB(true);
|
||||
rot->setSrcFB();
|
||||
return ret;
|
||||
}
|
||||
inline bool UIMirrorPipe::close() { return mUI.close(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user