hwc/overlay: Set crop rectangle for MDSS Rotator.
Since MDSS rotator will crop, the crop rectangle for overlay will always start from (0,0). CRs-Fixed: 476494 Change-Id: I1ccece8eab7d1a97ccec561a4d0df4558b5e33c4
This commit is contained in:
@@ -652,9 +652,12 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int configRotator(Rotator *rot, const Whf& whf,
|
static inline int configRotator(Rotator *rot, const Whf& whf,
|
||||||
const eMdpFlags& mdpFlags, const eTransform& orient,
|
const hwc_rect_t& crop, const eMdpFlags& mdpFlags,
|
||||||
const int& downscale) {
|
const eTransform& orient, const int& downscale) {
|
||||||
|
Dim rotCrop(crop.left, crop.top, (crop.right - crop.left),
|
||||||
|
(crop.bottom - crop.top));
|
||||||
rot->setSource(whf);
|
rot->setSource(whf);
|
||||||
|
rot->setCrop(rotCrop);
|
||||||
rot->setFlags(mdpFlags);
|
rot->setFlags(mdpFlags);
|
||||||
rot->setTransform(orient);
|
rot->setTransform(orient);
|
||||||
rot->setDownscale(downscale);
|
rot->setDownscale(downscale);
|
||||||
@@ -695,11 +698,23 @@ static inline void updateSource(eTransform& orient, Whf& whf,
|
|||||||
crop.bottom - crop.top);
|
crop.bottom - crop.top);
|
||||||
orient = static_cast<eTransform>(ovutils::getMdpOrient(orient));
|
orient = static_cast<eTransform>(ovutils::getMdpOrient(orient));
|
||||||
preRotateSource(orient, whf, srcCrop);
|
preRotateSource(orient, whf, srcCrop);
|
||||||
|
if (qdutils::MDPVersion::getInstance().getMDPVersion() >=
|
||||||
|
qdutils::MDSS_V5) {
|
||||||
|
// Source for overlay will be the cropped (and rotated)
|
||||||
|
crop.left = 0;
|
||||||
|
crop.top = 0;
|
||||||
|
crop.right = srcCrop.w;
|
||||||
|
crop.bottom = srcCrop.h;
|
||||||
|
// Set width & height equal to sourceCrop w & h
|
||||||
|
whf.w = srcCrop.w;
|
||||||
|
whf.h = srcCrop.h;
|
||||||
|
} else {
|
||||||
crop.left = srcCrop.x;
|
crop.left = srcCrop.x;
|
||||||
crop.top = srcCrop.y;
|
crop.top = srcCrop.y;
|
||||||
crop.right = srcCrop.x + srcCrop.w;
|
crop.right = srcCrop.x + srcCrop.w;
|
||||||
crop.bottom = srcCrop.y + srcCrop.h;
|
crop.bottom = srcCrop.y + srcCrop.h;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||||
const int& dpy, eMdpFlags& mdpFlags, const eZorder& z,
|
const int& dpy, eMdpFlags& mdpFlags, const eZorder& z,
|
||||||
@@ -742,8 +757,10 @@ int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
*rot = ctx->mRotMgr->getNext();
|
*rot = ctx->mRotMgr->getNext();
|
||||||
if(*rot == NULL) return -1;
|
if(*rot == NULL) return -1;
|
||||||
//Configure rotator for pre-rotation
|
//Configure rotator for pre-rotation
|
||||||
if(configRotator(*rot, whf, mdpFlags, orient, downscale) < 0)
|
if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) {
|
||||||
|
ALOGE("%s: configRotator failed!", __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
whf.format = (*rot)->getDstFormat();
|
whf.format = (*rot)->getDstFormat();
|
||||||
updateSource(orient, whf, crop);
|
updateSource(orient, whf, crop);
|
||||||
rotFlags |= ovutils::ROT_PREROTATED;
|
rotFlags |= ovutils::ROT_PREROTATED;
|
||||||
@@ -792,8 +809,10 @@ int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
(*rot) = ctx->mRotMgr->getNext();
|
(*rot) = ctx->mRotMgr->getNext();
|
||||||
if((*rot) == NULL) return -1;
|
if((*rot) == NULL) return -1;
|
||||||
//Configure rotator for pre-rotation
|
//Configure rotator for pre-rotation
|
||||||
if(configRotator(*rot, whf, mdpFlagsL, orient, downscale) < 0)
|
if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) {
|
||||||
|
ALOGE("%s: configRotator failed!", __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
whf.format = (*rot)->getDstFormat();
|
whf.format = (*rot)->getDstFormat();
|
||||||
updateSource(orient, whf, crop);
|
updateSource(orient, whf, crop);
|
||||||
rotFlags |= ROT_PREROTATED;
|
rotFlags |= ROT_PREROTATED;
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ void MdpRot::setSource(const overlay::utils::Whf& awhf) {
|
|||||||
mRotImgInfo.dst.height = whf.h;
|
mRotImgInfo.dst.height = whf.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MdpRot::setCrop(const utils::Dim& crop) {
|
||||||
|
// NO-OP for non-mdss rotator due to possible h/w limitations
|
||||||
|
}
|
||||||
|
|
||||||
void MdpRot::setFlags(const utils::eMdpFlags& flags) {
|
void MdpRot::setFlags(const utils::eMdpFlags& flags) {
|
||||||
mRotImgInfo.secure = 0;
|
mRotImgInfo.secure = 0;
|
||||||
if(flags & utils::OV_MDP_SECURE_OVERLAY_SESSION)
|
if(flags & utils::OV_MDP_SECURE_OVERLAY_SESSION)
|
||||||
|
|||||||
@@ -74,15 +74,21 @@ void MdssRot::setSource(const overlay::utils::Whf& awhf) {
|
|||||||
utils::Whf whf(awhf);
|
utils::Whf whf(awhf);
|
||||||
|
|
||||||
mRotInfo.src.format = whf.format;
|
mRotInfo.src.format = whf.format;
|
||||||
|
|
||||||
mRotInfo.src.width = whf.w;
|
mRotInfo.src.width = whf.w;
|
||||||
mRotInfo.src.height = whf.h;
|
mRotInfo.src.height = whf.h;
|
||||||
|
}
|
||||||
|
|
||||||
mRotInfo.src_rect.w = whf.w;
|
void MdssRot::setCrop(const utils::Dim& crop) {
|
||||||
mRotInfo.src_rect.h = whf.h;
|
|
||||||
|
|
||||||
mRotInfo.dst_rect.w = whf.w;
|
mRotInfo.src_rect.x = crop.x;
|
||||||
mRotInfo.dst_rect.h = whf.h;
|
mRotInfo.src_rect.y = crop.y;
|
||||||
|
mRotInfo.src_rect.w = crop.w;
|
||||||
|
mRotInfo.src_rect.h = crop.h;
|
||||||
|
|
||||||
|
mRotInfo.dst_rect.x = 0;
|
||||||
|
mRotInfo.dst_rect.y = 0;
|
||||||
|
mRotInfo.dst_rect.w = crop.w;
|
||||||
|
mRotInfo.dst_rect.h = crop.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MdssRot::setDownscale(int ds) {}
|
void MdssRot::setDownscale(int ds) {}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
enum { TYPE_MDP, TYPE_MDSS };
|
enum { TYPE_MDP, TYPE_MDSS };
|
||||||
virtual ~Rotator();
|
virtual ~Rotator();
|
||||||
virtual void setSource(const utils::Whf& wfh) = 0;
|
virtual void setSource(const utils::Whf& wfh) = 0;
|
||||||
|
virtual void setCrop(const utils::Dim& crop) = 0;
|
||||||
virtual void setFlags(const utils::eMdpFlags& flags) = 0;
|
virtual void setFlags(const utils::eMdpFlags& flags) = 0;
|
||||||
virtual void setTransform(const utils::eTransform& rot) = 0;
|
virtual void setTransform(const utils::eTransform& rot) = 0;
|
||||||
virtual bool commit() = 0;
|
virtual bool commit() = 0;
|
||||||
@@ -109,6 +110,7 @@ class MdpRot : public Rotator {
|
|||||||
public:
|
public:
|
||||||
virtual ~MdpRot();
|
virtual ~MdpRot();
|
||||||
virtual void setSource(const utils::Whf& wfh);
|
virtual void setSource(const utils::Whf& wfh);
|
||||||
|
virtual void setCrop(const utils::Dim& crop);
|
||||||
virtual void setFlags(const utils::eMdpFlags& flags);
|
virtual void setFlags(const utils::eMdpFlags& flags);
|
||||||
virtual void setTransform(const utils::eTransform& rot);
|
virtual void setTransform(const utils::eTransform& rot);
|
||||||
virtual bool commit();
|
virtual bool commit();
|
||||||
@@ -167,6 +169,7 @@ class MdssRot : public Rotator {
|
|||||||
public:
|
public:
|
||||||
virtual ~MdssRot();
|
virtual ~MdssRot();
|
||||||
virtual void setSource(const utils::Whf& wfh);
|
virtual void setSource(const utils::Whf& wfh);
|
||||||
|
virtual void setCrop(const utils::Dim& crop);
|
||||||
virtual void setFlags(const utils::eMdpFlags& flags);
|
virtual void setFlags(const utils::eMdpFlags& flags);
|
||||||
virtual void setTransform(const utils::eTransform& rot);
|
virtual void setTransform(const utils::eTransform& rot);
|
||||||
virtual bool commit();
|
virtual bool commit();
|
||||||
|
|||||||
Reference in New Issue
Block a user