liboverlay: Set mdp src format as rotator output format.
* Set mdp source format as rotator output format
rather than determine it from a fixed mapping of
input/output formats.
* This is needed since for the same input format
to rotator, fastyuv mode if enabled may result in
a different output format than the one if the mode
is not enabled.
* Do the inline optimization for rotator where possible
CRs-fixed: 451064
Change-Id: If0bb2f3a44df10968383ab3f5c3625257518934d
diff --git a/liboverlay/overlayCtrlData.h b/liboverlay/overlayCtrlData.h
index c0d4c6d..0c49bdd 100644
--- a/liboverlay/overlayCtrlData.h
+++ b/liboverlay/overlayCtrlData.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2012-2013, 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
@@ -93,6 +93,8 @@
/* Get downscale factor */
int getDownscalefactor();
+ /* Update the src format */
+ void updateSrcformat(const uint32_t& inputsrcFormat);
private:
/* Retrieve screen info from underlying mdp */
@@ -187,6 +189,10 @@
return mMdp.getFd();
}
+inline void Ctrl::updateSrcformat(const uint32_t& inputsrcFormat) {
+ mMdp.updateSrcformat(inputsrcFormat);
+}
+
inline utils::ScreenInfo Ctrl::getScreenInfo() const {
return mInfo;
}
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index ee1aae7..8bca85f 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
-* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include <mdp_version.h>
#include "overlayUtils.h"
#include "overlayMdp.h"
@@ -249,10 +250,24 @@
whf.w = utils::alignup(whf.w, 64);
whf.h = utils::alignup(whf.h, 32);
}
- //For example: If original format is tiled, rotator outputs non-tiled,
- //so update mdp's src fmt to that.
+ /*For example: If original format is tiled, rotator outputs non-tiled,
+ *so update mdp's src fmt to that.
+ */
whf.format = utils::getRotOutFmt(whf.format);
setSrcWhf(whf);
+ /* The above format will be overwritten in function updateSrcformat
+ * after doing rotator start. Format is then set depending on
+ * whether the fastyuv mode is used by the rotator.
+ */
+ }
+}
+
+void MdpCtrl::updateSrcformat(const uint32_t& inputformat) {
+ int version = qdutils::MDPVersion::getInstance().getMDPVersion();
+ if ((version >= qdutils::MDP_V4_2) && (version < qdutils::MDSS_V5)) {
+ utils::Whf whf = getSrcWhf();
+ whf.format = inputformat;
+ setSrcWhf(whf);
}
}
diff --git a/liboverlay/overlayMdp.h b/liboverlay/overlayMdp.h
index 9df1a04..c1684fc 100644
--- a/liboverlay/overlayMdp.h
+++ b/liboverlay/overlayMdp.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
-* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -153,6 +153,9 @@
/* Get downscale factor */
int getDownscalefactor();
+ /* Update the src format */
+ void updateSrcformat(const uint32_t& inputsrcFormat);
+
private:
/* helper functions for overlayTransform */
diff --git a/liboverlay/overlayMdpRot.cpp b/liboverlay/overlayMdpRot.cpp
index 5052bc8..d0242d6 100644
--- a/liboverlay/overlayMdpRot.cpp
+++ b/liboverlay/overlayMdpRot.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
* Not a Contribution, Apache license notifications and license are retained
* for attribution purposes only.
*
@@ -31,25 +31,29 @@
MdpRot::~MdpRot() { close(); }
-void MdpRot::setEnable() { mRotImgInfo.enable = 1; }
+inline void MdpRot::setEnable() { mRotImgInfo.enable = 1; }
-void MdpRot::setDisable() { mRotImgInfo.enable = 0; }
+inline void MdpRot::setDisable() { mRotImgInfo.enable = 0; }
-bool MdpRot::enabled() const { return mRotImgInfo.enable; }
+inline bool MdpRot::enabled() const { return mRotImgInfo.enable; }
-void MdpRot::setRotations(uint32_t r) { mRotImgInfo.rotations = r; }
+inline void MdpRot::setRotations(uint32_t r) { mRotImgInfo.rotations = r; }
-int MdpRot::getDstMemId() const {
+inline int MdpRot::getDstMemId() const {
return mRotDataInfo.dst.memory_id;
}
-uint32_t MdpRot::getDstOffset() const {
+inline uint32_t MdpRot::getDstOffset() const {
return mRotDataInfo.dst.offset;
}
-uint32_t MdpRot::getSessId() const { return mRotImgInfo.session_id; }
+inline uint32_t MdpRot::getDstFormat() const {
+ return mRotImgInfo.dst.format;
+}
-void MdpRot::setSrcFB() {
+inline uint32_t MdpRot::getSessId() const { return mRotImgInfo.session_id; }
+
+inline void MdpRot::setSrcFB() {
mRotDataInfo.src.flags |= MDP_MEMORY_ID_TYPE_FB;
}
@@ -67,11 +71,11 @@
mRotImgInfo.downscale_ratio = ds;
}
-void MdpRot::save() {
+inline void MdpRot::save() {
mLSRotImgInfo = mRotImgInfo;
}
-bool MdpRot::rotConfChanged() const {
+inline bool MdpRot::rotConfChanged() const {
// 0 means same
if(0 == ::memcmp(&mRotImgInfo, &mLSRotImgInfo,
sizeof (msm_rotator_img_info))) {
@@ -111,13 +115,13 @@
mBufSize = awhf.size;
}
-void MdpRot::setFlags(const utils::eMdpFlags& flags) {
+inline 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)
+inline void MdpRot::setTransform(const utils::eTransform& rot)
{
int r = utils::getMdpOrient(rot);
setRotations(r);
@@ -127,14 +131,14 @@
ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r);
}
-void MdpRot::setRotatorUsed(const bool& rotUsed) {
+inline void MdpRot::setRotatorUsed(const bool& rotUsed) {
setDisable();
if(rotUsed) {
setEnable();
}
}
-void MdpRot::doTransform() {
+inline void MdpRot::doTransform() {
if(mOrientation & utils::OVERLAY_TRANSFORM_ROT_90)
utils::swap(mRotImgInfo.dst.width, mRotImgInfo.dst.height);
}
diff --git a/liboverlay/overlayMdssRot.cpp b/liboverlay/overlayMdssRot.cpp
index c00e732..6ee9e4b 100644
--- a/liboverlay/overlayMdssRot.cpp
+++ b/liboverlay/overlayMdssRot.cpp
@@ -43,29 +43,34 @@
MdssRot::~MdssRot() { close(); }
-void MdssRot::setEnable() { mEnabled = true; }
+inline void MdssRot::setEnable() { mEnabled = true; }
-void MdssRot::setDisable() { mEnabled = false; }
+inline void MdssRot::setDisable() { mEnabled = false; }
-bool MdssRot::enabled() const { return mEnabled; }
+inline bool MdssRot::enabled() const { return mEnabled; }
-void MdssRot::setRotations(uint32_t flags) { mRotInfo.flags |= flags; }
+inline void MdssRot::setRotations(uint32_t flags) { mRotInfo.flags |= flags; }
-int MdssRot::getDstMemId() const {
+inline int MdssRot::getDstMemId() const {
return mRotData.dst_data.memory_id;
}
-uint32_t MdssRot::getDstOffset() const {
+inline uint32_t MdssRot::getDstOffset() const {
return mRotData.dst_data.offset;
}
-uint32_t MdssRot::getSessId() const { return mRotInfo.id; }
+inline uint32_t MdssRot::getDstFormat() const {
+ //For mdss src and dst formats are same
+ return mRotInfo.src.format;
+}
-void MdssRot::setSrcFB() {
+inline uint32_t MdssRot::getSessId() const { return mRotInfo.id; }
+
+inline void MdssRot::setSrcFB() {
mRotData.data.flags |= MDP_MEMORY_ID_TYPE_FB;
}
-bool MdssRot::init() {
+inline bool MdssRot::init() {
if(!utils::openDev(mFd, 0, Res::fbPath, O_RDWR)) {
ALOGE("MdssRot failed to init fb0");
return false;
@@ -95,14 +100,13 @@
mBufSize = awhf.size;
}
-void MdssRot::setDownscale(int ds) {
-}
+inline void MdssRot::setDownscale(int ds) {}
-void MdssRot::setFlags(const utils::eMdpFlags& flags) {
+inline void MdssRot::setFlags(const utils::eMdpFlags& flags) {
mRotInfo.flags |= flags;
}
-void MdssRot::setTransform(const utils::eTransform& rot)
+inline void MdssRot::setTransform(const utils::eTransform& rot)
{
int flags = utils::getMdpOrient(rot);
if (flags != -1)
@@ -113,14 +117,14 @@
ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, flags);
}
-void MdssRot::setRotatorUsed(const bool& rotUsed) {
+inline void MdssRot::setRotatorUsed(const bool& rotUsed) {
setDisable();
if(rotUsed) {
setEnable();
}
}
-void MdssRot::doTransform() {
+inline void MdssRot::doTransform() {
if(mOrientation & utils::OVERLAY_TRANSFORM_ROT_90)
utils::swap(mRotInfo.dst_rect.w, mRotInfo.dst_rect.h);
}
diff --git a/liboverlay/overlayRotator.h b/liboverlay/overlayRotator.h
index 118f71f..f1a60e1 100644
--- a/liboverlay/overlayRotator.h
+++ b/liboverlay/overlayRotator.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011, The Linux Foundation. All rights reserved.
+* Copyright (c) 2011,2013 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
@@ -55,6 +55,7 @@
virtual void setDownscale(int ds) = 0;
virtual int getDstMemId() const = 0;
virtual uint32_t getDstOffset() const = 0;
+ virtual uint32_t getDstFormat() const = 0;
virtual void setEnable() = 0;
virtual void setDisable() = 0;
virtual bool enabled () const = 0;
@@ -125,6 +126,7 @@
virtual void setDownscale(int ds);
virtual int getDstMemId() const;
virtual uint32_t getDstOffset() const;
+ virtual uint32_t getDstFormat() const;
virtual void setEnable();
virtual void setDisable();
virtual bool enabled () const;
@@ -186,6 +188,7 @@
virtual void setDownscale(int ds);
virtual int getDstMemId() const;
virtual uint32_t getDstOffset() const;
+ virtual uint32_t getDstFormat() const;
virtual void setEnable();
virtual void setDisable();
virtual bool enabled () const;
diff --git a/liboverlay/pipes/overlayGenPipe.cpp b/liboverlay/pipes/overlayGenPipe.cpp
index aaaa0f1..0b864df 100644
--- a/liboverlay/pipes/overlayGenPipe.cpp
+++ b/liboverlay/pipes/overlayGenPipe.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2012-2013, 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
@@ -166,6 +166,11 @@
pipeState = CLOSED;
return false;
}
+ /* Set the mdp src format to the output format of the rotator.
+ * The output format of the rotator might be different depending on
+ * whether fastyuv mode is enabled in the rotator.
+ */
+ mCtrlData.ctrl.updateSrcformat(mRot->getDstFormat());
}
ret = mCtrlData.ctrl.commit();