summaryrefslogtreecommitdiff
path: root/ips
diff options
context:
space:
mode:
authorJackie Li <yaodong.li@intel.com>2013-07-30 21:54:23 +0800
committercactus <cactus@intel.com>2013-09-17 19:30:41 -0700
commitd191dc7a785f312ede10d711720d8ca32a71b44c (patch)
tree43979048415a0192e3e67ac87eb1898109e9e029 /ips
parent5af61d09ea46d3e24e2badf2dbfbf81b39c2fc36 (diff)
downloadhwcomposer-d191dc7a785f312ede10d711720d8ca32a71b44c.tar.gz
hwc: optimized plane allocation
BZ: 127803 patch 2/2 of z order setting and plane allocation optimization. optimized plane allocation algorithm to try to achieve following goals: 1) attach display planes to large layers which need more GPU power to do composition. 2) attach display planes to layers which contain protected content as much as possible 3) scalability to support different z order configure restrictions of different hardware platforms 4) allocate as much display planes as possible remain issues: 1) flickering was observed rarely when doing manual stress tests, which root caused by turning on sw layer support. will fix it in another RGX patch. 2) found an issue that buffer crop may be incorrect, which can be fixed by patch http://android.intel.com:8080/#/c/124022/ Conflicts: common/base/HwcLayerList.cpp Change-Id: I0fbef3b8cda227ed3aaf75775330ae136c2b5298 Signed-off-by: Jackie Li <yaodong.li@intel.com> Signed-off-by: Austin Hu <austin.hu@intel.com> Signed-off-by: Jackie Li <yaodong.li@intel.com> Signed-off-by: Austin Hu <austin.hu@intel.com> Signed-off-by: Jackie Li <yaodong.li@intel.com> Reviewed-on: http://android.intel.com:8080/122669 Reviewed-by: Qiu, Junhai <junhai.qiu@intel.com> Reviewed-by: Dai, Yu <yu.dai@intel.com> Tested-by: Dai, Yu <yu.dai@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: cactus <cactus@intel.com>
Diffstat (limited to 'ips')
-rw-r--r--ips/common/OverlayPlaneBase.cpp5
-rw-r--r--ips/common/OverlayPlaneBase.h2
-rw-r--r--ips/common/SpritePlaneBase.cpp42
-rw-r--r--ips/common/SpritePlaneBase.h1
-rw-r--r--ips/tangier/TngDisplayContext.cpp10
-rw-r--r--ips/tangier/TngPrimaryPlane.cpp34
-rw-r--r--ips/tangier/TngPrimaryPlane.h1
-rw-r--r--ips/tangier/TngSpritePlane.cpp36
-rw-r--r--ips/tangier/TngSpritePlane.h2
9 files changed, 80 insertions, 53 deletions
diff --git a/ips/common/OverlayPlaneBase.cpp b/ips/common/OverlayPlaneBase.cpp
index a0c08d3..dcdb868 100644
--- a/ips/common/OverlayPlaneBase.cpp
+++ b/ips/common/OverlayPlaneBase.cpp
@@ -155,7 +155,8 @@ bool OverlayPlaneBase::assignToDevice(int disp)
return true;
}
-void OverlayPlaneBase::setZOrderConfig(ZOrderConfig& zorderConfig)
+void OverlayPlaneBase::setZOrderConfig(ZOrderConfig& zorderConfig,
+ void *nativeConfig)
{
CTRACE();
@@ -178,7 +179,7 @@ void OverlayPlaneBase::setZOrderConfig(ZOrderConfig& zorderConfig)
}
// force overlay c above overlay a
- if (ovaZOrder < ovcZOrder) {
+ if ((ovaZOrder >= 0) && (ovaZOrder < ovcZOrder)) {
backBuffer->OCONFIG |= (1 << 15);
} else {
backBuffer->OCONFIG &= ~(1 << 15);
diff --git a/ips/common/OverlayPlaneBase.h b/ips/common/OverlayPlaneBase.h
index 09b8575..46084b2 100644
--- a/ips/common/OverlayPlaneBase.h
+++ b/ips/common/OverlayPlaneBase.h
@@ -54,7 +54,7 @@ public:
virtual bool assignToDevice(int disp);
- virtual void setZOrderConfig(ZOrderConfig& config);
+ virtual void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
// plane operations
virtual bool flip(void *ctx) = 0;
diff --git a/ips/common/SpritePlaneBase.cpp b/ips/common/SpritePlaneBase.cpp
index 52e8851..5f25205 100644
--- a/ips/common/SpritePlaneBase.cpp
+++ b/ips/common/SpritePlaneBase.cpp
@@ -26,8 +26,6 @@
*
*/
#include <HwcTrace.h>
-#include <Hwcomposer.h>
-#include <BufferManager.h>
#include <common/SpritePlaneBase.h>
#include <common/PixelFormat.h>
@@ -63,45 +61,5 @@ bool SpritePlaneBase::disable()
return enablePlane(false);
}
-void SpritePlaneBase::setZOrderConfig(ZOrderConfig& zorderConfig)
-{
- mForceBottom = true;
- mAbovePrimary = true;
-
- if (mType == PLANE_PRIMARY) {
- bool hasOverlayPlane = false;
- // only consider force bottom when overlay is active
- for (size_t i = 0; i < zorderConfig.size(); i++) {
- DisplayPlane *plane = zorderConfig.itemAt(i);
- if (plane->getType() == DisplayPlane::PLANE_PRIMARY)
- break;
- if (plane->getType() == DisplayPlane::PLANE_OVERLAY) {
- hasOverlayPlane = true;
- }
- }
-
- // if has overlay plane which is below primary plane
- if (hasOverlayPlane) {
- mForceBottom = false;
- }
- } else if (mType == DisplayPlane::PLANE_SPRITE) {
- bool hasPrimaryPlane = false;
- for (size_t i = 0; i < zorderConfig.size(); i++) {
- DisplayPlane *plane = zorderConfig.itemAt(i);
- if (plane->getType() == DisplayPlane::PLANE_SPRITE)
- break;
- if (plane->getType() == DisplayPlane::PLANE_PRIMARY) {
- hasPrimaryPlane = true;
- }
- }
-
- if (!hasPrimaryPlane) {
- mAbovePrimary = false;
- }
- } else {
- WTRACE("Invalid sprite plane type %d", mType);
- }
-}
-
} // namespace intel
} // namespace android
diff --git a/ips/common/SpritePlaneBase.h b/ips/common/SpritePlaneBase.h
index aeea1a8..370046c 100644
--- a/ips/common/SpritePlaneBase.h
+++ b/ips/common/SpritePlaneBase.h
@@ -46,7 +46,6 @@ public:
virtual bool enable();
virtual bool disable();
- virtual void setZOrderConfig(ZOrderConfig& config);
// display device
virtual void* getContext() const = 0;
protected:
diff --git a/ips/tangier/TngDisplayContext.cpp b/ips/tangier/TngDisplayContext.cpp
index fb6f464..45f79ab 100644
--- a/ips/tangier/TngDisplayContext.cpp
+++ b/ips/tangier/TngDisplayContext.cpp
@@ -26,11 +26,14 @@
*
*/
#include <HwcTrace.h>
+#include <Hwcomposer.h>
#include <DisplayPlane.h>
#include <IDisplayDevice.h>
#include <HwcLayerList.h>
#include <tangier/TngDisplayContext.h>
+#include <displayclass_interface.h>
+
namespace android {
namespace intel {
@@ -81,6 +84,7 @@ bool TngDisplayContext::commitBegin(size_t numDisplays, hwc_display_contents_1_t
bool TngDisplayContext::commitContents(hwc_display_contents_1_t *display, HwcLayerList *layerList)
{
bool ret;
+
RETURN_FALSE_IF_NOT_INIT();
if (!display || !layerList) {
@@ -114,6 +118,12 @@ bool TngDisplayContext::commitContents(hwc_display_contents_1_t *display, HwcLay
// update IMG layer
imgLayer->psLayer = &display->hwLayers[i];
imgLayer->custom = (uint32_t)plane->getContext();
+ struct intel_dc_plane_ctx *ctx =
+ (struct intel_dc_plane_ctx *)imgLayer->custom;
+ // update z order
+ Hwcomposer& hwc = Hwcomposer::getInstance();
+ DisplayPlaneManager *pm = hwc.getPlaneManager();
+ memcpy(&ctx->zorder, pm->getZOrderConfig(), sizeof(ctx->zorder));
VTRACE("count %d, handle %#x, trans %#x, blending %#x"
" sourceCrop %d,%d - %dx%d, dst %d,%d - %dx%d, custom %#x",
diff --git a/ips/tangier/TngPrimaryPlane.cpp b/ips/tangier/TngPrimaryPlane.cpp
index c705af0..b69ad30 100644
--- a/ips/tangier/TngPrimaryPlane.cpp
+++ b/ips/tangier/TngPrimaryPlane.cpp
@@ -76,8 +76,6 @@ void TngPrimaryPlane::setFramebufferTarget(uint32_t handle)
mContext.ctx.prim_ctx.cntr = PixelFormat::PLANE_PIXEL_FORMAT_BGRA8888;
mContext.ctx.prim_ctx.cntr |= 0x80000000;
- if (mForceBottom)
- mContext.ctx.prim_ctx.cntr |= 0x00000004;
mCurrentDataBuffer = handle;
}
@@ -112,6 +110,38 @@ bool TngPrimaryPlane::setDataBuffer(uint32_t handle)
return true;
}
+void TngPrimaryPlane::setZOrderConfig(ZOrderConfig& zorderConfig,
+ void *nativeConfig)
+{
+ if (!nativeConfig) {
+ ETRACE("Invalid parameter, no native config");
+ return;
+ }
+
+ mForceBottom = false;
+
+ int primaryIndex = -1;
+ int overlayIndex = -1;
+ // only consider force bottom when overlay is active
+ for (size_t i = 0; i < zorderConfig.size(); i++) {
+ DisplayPlane *plane = zorderConfig.itemAt(i);
+ if (plane->getType() == DisplayPlane::PLANE_PRIMARY)
+ primaryIndex = i;
+ if (plane->getType() == DisplayPlane::PLANE_OVERLAY) {
+ overlayIndex = i;
+ }
+ }
+
+ // if has overlay plane which is below primary plane
+ if (overlayIndex > primaryIndex) {
+ mForceBottom = true;
+ }
+
+ struct intel_dc_plane_zorder *zorder =
+ (struct intel_dc_plane_zorder *)nativeConfig;
+ zorder->forceBottom[mIndex] = mForceBottom ? 1 : 0;
+}
+
bool TngPrimaryPlane::assignToDevice(int disp)
{
return true;
diff --git a/ips/tangier/TngPrimaryPlane.h b/ips/tangier/TngPrimaryPlane.h
index 6ea6708..552bf21 100644
--- a/ips/tangier/TngPrimaryPlane.h
+++ b/ips/tangier/TngPrimaryPlane.h
@@ -40,6 +40,7 @@ public:
virtual ~TngPrimaryPlane();
public:
bool setDataBuffer(uint32_t handle);
+ void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
bool assignToDevice(int disp);
bool disable();
private:
diff --git a/ips/tangier/TngSpritePlane.cpp b/ips/tangier/TngSpritePlane.cpp
index 476caaf..9b225be 100644
--- a/ips/tangier/TngSpritePlane.cpp
+++ b/ips/tangier/TngSpritePlane.cpp
@@ -97,11 +97,6 @@ bool TngSpritePlane::setDataBuffer(BufferMapper& mapper)
((dstH - 1) & 0xfff) << 16 | ((dstW - 1) & 0xfff);
mContext.ctx.sp_ctx.update_mask = SPRITE_UPDATE_ALL;
- if (mForceBottom)
- mContext.ctx.sp_ctx.cntr |= 0x00000004;
- if (mAbovePrimary)
- mContext.ctx.sp_ctx.cntr |= 0x00000002;
-
VTRACE("cntr = %#x, linoff = %#x, stride = %#x,"
"surf = %#x, pos = %#x, size = %#x",
mContext.ctx.sp_ctx.cntr,
@@ -146,6 +141,37 @@ bool TngSpritePlane::enablePlane(bool enabled)
}
+void TngSpritePlane::setZOrderConfig(ZOrderConfig& zorderConfig,
+ void *nativeConfig)
+{
+ if (!nativeConfig) {
+ ETRACE("invalid parameter, no native config");
+ return;
+ }
+
+ mAbovePrimary = true;
+
+ bool hasPrimaryPlane = false;
+ for (size_t i = 0; i < zorderConfig.size(); i++) {
+ DisplayPlane *plane = zorderConfig.itemAt(i);
+ // found sprite first, sprite is below primary
+ if (plane->getType() == DisplayPlane::PLANE_SPRITE)
+ break;
+ // found primary first, primary is below sprite
+ if (plane->getType() == DisplayPlane::PLANE_PRIMARY) {
+ hasPrimaryPlane = true;
+ break;
+ }
+ }
+
+ if (!hasPrimaryPlane) {
+ mAbovePrimary = false;
+ }
+
+ struct intel_dc_plane_zorder *zorder =
+ (struct intel_dc_plane_zorder *)nativeConfig;
+ zorder->abovePrimary = mAbovePrimary ? 1 : 0;
+}
} // namespace intel
} // namespace android
diff --git a/ips/tangier/TngSpritePlane.h b/ips/tangier/TngSpritePlane.h
index cb0130d..adfe95b 100644
--- a/ips/tangier/TngSpritePlane.h
+++ b/ips/tangier/TngSpritePlane.h
@@ -30,6 +30,7 @@
#include <utils/KeyedVector.h>
#include <hal_public.h>
+#include <Hwcomposer.h>
#include <BufferCache.h>
#include <DisplayPlane.h>
@@ -45,6 +46,7 @@ public:
virtual ~TngSpritePlane();
public:
virtual void* getContext() const;
+ virtual void setZOrderConfig(ZOrderConfig& config, void *nativeConfig);
protected:
virtual bool setDataBuffer(BufferMapper& mapper);
virtual bool enablePlane(bool enabled);