hwc/overlay: Crop x, y, w and h should be even for MDSS Rotator.
MDSS driver requires Rotator crop x, y, w and h to be even for YUV formats. CRs-Fixed: 485216 Change-Id: I9a066970f8cedaed7ba18534bb99edd1bcf421dd
This commit is contained in:
@@ -754,12 +754,23 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline int configRotator(Rotator *rot, const Whf& whf,
|
inline int configRotator(Rotator *rot, const Whf& whf,
|
||||||
const hwc_rect_t& crop, const eMdpFlags& mdpFlags,
|
hwc_rect_t& crop, const eMdpFlags& mdpFlags,
|
||||||
const eTransform& orient, 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);
|
|
||||||
|
if (qdutils::MDPVersion::getInstance().getMDPVersion() >=
|
||||||
|
qdutils::MDSS_V5) {
|
||||||
|
uint32_t crop_w = (crop.right - crop.left);
|
||||||
|
uint32_t crop_h = (crop.bottom - crop.top);
|
||||||
|
ovutils::normalizeCrop((uint32_t&)crop.left, crop_w);
|
||||||
|
ovutils::normalizeCrop((uint32_t&)crop.top, crop_h);
|
||||||
|
crop.right = crop.left + crop_w;
|
||||||
|
crop.bottom = crop.top + crop_h;
|
||||||
|
Dim rotCrop(crop.left, crop.top, crop_w, crop_h);
|
||||||
|
rot->setCrop(rotCrop);
|
||||||
|
}
|
||||||
|
|
||||||
rot->setFlags(mdpFlags);
|
rot->setFlags(mdpFlags);
|
||||||
rot->setTransform(orient);
|
rot->setTransform(orient);
|
||||||
rot->setDownscale(downscale);
|
rot->setDownscale(downscale);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
|||||||
int rotDownscale = 0, int transform = 0);
|
int rotDownscale = 0, int transform = 0);
|
||||||
|
|
||||||
int configRotator(overlay::Rotator *rot, const ovutils::Whf& whf,
|
int configRotator(overlay::Rotator *rot, const ovutils::Whf& whf,
|
||||||
const hwc_rect_t& crop, const ovutils::eMdpFlags& mdpFlags,
|
hwc_rect_t& crop, const ovutils::eMdpFlags& mdpFlags,
|
||||||
const ovutils::eTransform& orient, const int& downscale);
|
const ovutils::eTransform& orient, const int& downscale);
|
||||||
|
|
||||||
int configMdp(overlay::Overlay *ov, const ovutils::PipeArgs& parg,
|
int configMdp(overlay::Overlay *ov, const ovutils::PipeArgs& parg,
|
||||||
|
|||||||
@@ -37,20 +37,6 @@ static inline float log2f(const float& x) {
|
|||||||
namespace ovutils = overlay::utils;
|
namespace ovutils = overlay::utils;
|
||||||
namespace overlay {
|
namespace overlay {
|
||||||
|
|
||||||
//Helper to even out x,w and y,h pairs
|
|
||||||
//x,y are always evened to ceil and w,h are evened to floor
|
|
||||||
static void normalizeCrop(uint32_t& xy, uint32_t& wh) {
|
|
||||||
if(xy & 1) {
|
|
||||||
utils::even_ceil(xy);
|
|
||||||
if(wh & 1)
|
|
||||||
utils::even_floor(wh);
|
|
||||||
else
|
|
||||||
wh -= 2;
|
|
||||||
} else {
|
|
||||||
utils::even_floor(wh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MdpCtrl::init(uint32_t fbnum) {
|
bool MdpCtrl::init(uint32_t fbnum) {
|
||||||
// FD init
|
// FD init
|
||||||
if(!utils::openDev(mFd, fbnum,
|
if(!utils::openDev(mFd, fbnum,
|
||||||
@@ -189,8 +175,8 @@ bool MdpCtrl::set() {
|
|||||||
doDownscale();
|
doDownscale();
|
||||||
utils::Whf whf = getSrcWhf();
|
utils::Whf whf = getSrcWhf();
|
||||||
if(utils::isYuv(whf.format)) {
|
if(utils::isYuv(whf.format)) {
|
||||||
normalizeCrop(mOVInfo.src_rect.x, mOVInfo.src_rect.w);
|
utils::normalizeCrop(mOVInfo.src_rect.x, mOVInfo.src_rect.w);
|
||||||
normalizeCrop(mOVInfo.src_rect.y, mOVInfo.src_rect.h);
|
utils::normalizeCrop(mOVInfo.src_rect.y, mOVInfo.src_rect.h);
|
||||||
if(mdpVersion < MDSS_V5) {
|
if(mdpVersion < MDSS_V5) {
|
||||||
utils::even_floor(mOVInfo.dst_rect.w);
|
utils::even_floor(mOVInfo.dst_rect.w);
|
||||||
utils::even_floor(mOVInfo.dst_rect.h);
|
utils::even_floor(mOVInfo.dst_rect.h);
|
||||||
|
|||||||
@@ -428,6 +428,20 @@ void getDump(char *buf, size_t len, const char *prefix,
|
|||||||
getDump(buf, len, "\tdst", rot.dst);
|
getDump(buf, len, "\tdst", rot.dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Helper to even out x,w and y,h pairs
|
||||||
|
//x,y are always evened to ceil and w,h are evened to floor
|
||||||
|
void normalizeCrop(uint32_t& xy, uint32_t& wh) {
|
||||||
|
if(xy & 1) {
|
||||||
|
even_ceil(xy);
|
||||||
|
if(wh & 1)
|
||||||
|
even_floor(wh);
|
||||||
|
else
|
||||||
|
wh -= 2;
|
||||||
|
} else {
|
||||||
|
even_floor(wh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // utils
|
} // utils
|
||||||
|
|
||||||
} // overlay
|
} // overlay
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ bool send3DInfoPacket (uint32_t fmt);
|
|||||||
bool enableBarrier (uint32_t orientation);
|
bool enableBarrier (uint32_t orientation);
|
||||||
uint32_t getS3DFormat(uint32_t fmt);
|
uint32_t getS3DFormat(uint32_t fmt);
|
||||||
bool isMdssRotator();
|
bool isMdssRotator();
|
||||||
|
void normalizeCrop(uint32_t& xy, uint32_t& wh);
|
||||||
|
|
||||||
template <int CHAN>
|
template <int CHAN>
|
||||||
bool getPositionS3D(const Whf& whf, Dim& out);
|
bool getPositionS3D(const Whf& whf, Dim& out);
|
||||||
|
|||||||
Reference in New Issue
Block a user