summaryrefslogtreecommitdiff
authorStark Li <stark.li@amlogic.com>2016-10-13 05:49:32 (GMT)
committer Stark Li <stark.li@amlogic.com>2016-10-20 07:58:05 (GMT)
commitd7340ec57cbed3655f1b248f111eb529d266353f (patch)
tree9c78ab5973b69b4a19164892ceb0434f8652948e
parent8e408cfe1a8090c8dcb75d8a74d1136778df9c8c (diff)
downloadhwcomposer-d7340ec57cbed3655f1b248f111eb529d266353f.zip
hwcomposer-d7340ec57cbed3655f1b248f111eb529d266353f.tar.gz
hwcomposer-d7340ec57cbed3655f1b248f111eb529d266353f.tar.bz2
PD#132769: close fence when power mode is off
Change-Id: I0bcfcd0dd469d8793ee73da7de0cb7c2bb143a4e
Diffstat
-rw-r--r--hwc2/common/base/HwcLayer.cpp7
-rw-r--r--hwc2/common/devices/PhysicalDevice.cpp38
-rw-r--r--hwc2/include/PhysicalDevice.h2
3 files changed, 34 insertions, 13 deletions
diff --git a/hwc2/common/base/HwcLayer.cpp b/hwc2/common/base/HwcLayer.cpp
index 248cddf..78bca07 100644
--- a/hwc2/common/base/HwcLayer.cpp
+++ b/hwc2/common/base/HwcLayer.cpp
@@ -8,6 +8,8 @@
#include <Hwcomposer.h>
#include <IDisplayDevice.h>
#include <cutils/properties.h>
+#include <sync/sync.h>
+
#include <Utils.h>
namespace android {
@@ -66,7 +68,10 @@ int32_t HwcLayer::setBuffer(buffer_handle_t buffer, int32_t acquireFence) {
DTRACE("Layer buffer is null! no need to update this layer.");
}
mBufferHnd = buffer;
- mAcquireFence =acquireFence ;
+ mAcquireFence = acquireFence;
+ if (mAcquireFence > -1) {
+ sync_wait(mAcquireFence, 4000);
+ }
return HWC2_ERROR_NONE;
}
diff --git a/hwc2/common/devices/PhysicalDevice.cpp b/hwc2/common/devices/PhysicalDevice.cpp
index e5af910..cf316da 100644
--- a/hwc2/common/devices/PhysicalDevice.cpp
+++ b/hwc2/common/devices/PhysicalDevice.cpp
@@ -5,6 +5,7 @@
#include <PhysicalDevice.h>
#include <Hwcomposer.h>
#include <sys/ioctl.h>
+#include <sync/sync.h>
#include <Utils.h>
#include <tvp/OmxUtil.h>
@@ -127,7 +128,6 @@ bool PhysicalDevice::createLayer(hwc2_layer_t* outLayer) {
}
bool PhysicalDevice::destroyLayer(hwc2_layer_t layerId) {
- //HwcLayer* layer = reinterpret_cast<HwcLayer*>(layerId);
HwcLayer* layer = mHwcLayers.valueFor(layerId);
if (layer == NULL) {
@@ -389,10 +389,15 @@ int32_t PhysicalDevice::getReleaseFences(
hwc2_layer_t layerId = mHwcLayers.keyAt(i);
layer = mHwcLayers.valueAt(i);
if (layer/* && layer->getAcquireFence() > -1*/) {
+ DTRACE("outFences: %d", layer->getAcquireFence());
outLayers[num_layer] = layerId;
+ if (layer->getAcquireFence() > -1) {
+ close(layer->getAcquireFence());
+ layer->resetAcquireFence();
+ }
+
outFences[num_layer++] = layer->getAcquireFence();
// TODO: ?
- layer->resetAcquireFence();
}
}
}
@@ -442,14 +447,20 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence) {
}
}
- if (!mClientTargetHnd) {
- ETRACE("target handle is null.");
- *outRetireFence = -1;
- return HWC2_ERROR_NONE;
- }
- if (private_handle_t::validate(mClientTargetHnd) < 0) {
+ if (!mClientTargetHnd || private_handle_t::validate(mClientTargetHnd) < 0 || mPowerMode == HWC2_POWER_MODE_OFF) {
+ DTRACE("mClientTargetHnd is null or Enter suspend state, mTargetAcquireFence: %d", mTargetAcquireFence);
+ if (mTargetAcquireFence > -1) {
+ sync_wait(mTargetAcquireFence, 5000);
+ close(mTargetAcquireFence);
+ mTargetAcquireFence = -1;
+ }
*outRetireFence = -1;
- return HWC2_ERROR_NOT_VALIDATED;
+ if (private_handle_t::validate(mClientTargetHnd) < 0) {
+ ETRACE("mClientTargetHnd is not validate!");
+ return HWC2_ERROR_NOT_VALIDATED;
+ } else {
+ return HWC2_ERROR_NONE;
+ }
}
*outRetireFence = fb_post_with_fence_locked(mFramebufferInfo, mClientTargetHnd, mTargetAcquireFence);
@@ -464,11 +475,11 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence) {
}
// finally we need to update cursor's blank status
- if (cbinfo->fd > 0 && (cursorShow != mCursorContext->getCursorStatus()) ) {
+ if (cbinfo->fd > 0 && cursorShow != mCursorContext->getCursorStatus()) {
mCursorContext->setCursorStatus(cursorShow);
- DTRACE("UPDATE FB1 status to %d ",cursorShow);
- ioctl(cbinfo->fd, FBIOBLANK, !mCursorContext->getCursorStatus());
+ DTRACE("UPDATE FB1 status to %d", !cursorShow);
+ ioctl(cbinfo->fd, FBIOBLANK, !cursorShow);
}
return err;
@@ -518,6 +529,7 @@ int32_t PhysicalDevice::setClientTarget(
mClientTargetDamageRegion = damage;
if (-1 != acquireFence) {
mTargetAcquireFence = acquireFence;
+ //sync_wait(mTargetAcquireFence, 3000);
}
// TODO: HWC2_ERROR_BAD_PARAMETER && dataspace && damage.
} else {
@@ -540,6 +552,8 @@ int32_t PhysicalDevice::setColorTransform(
int32_t PhysicalDevice::setPowerMode(
int32_t /*hwc2_power_mode_t*/ mode){
+
+ mPowerMode = mode;
return HWC2_ERROR_NONE;
}
diff --git a/hwc2/include/PhysicalDevice.h b/hwc2/include/PhysicalDevice.h
index 545ecd8..43c163b 100644
--- a/hwc2/include/PhysicalDevice.h
+++ b/hwc2/include/PhysicalDevice.h
@@ -143,6 +143,8 @@ private:
int32_t /*android_color_mode_t*/ mColorMode;
+ int32_t /*hwc2_power_mode_t*/ mPowerMode;
+
// client target layer.
buffer_handle_t mClientTargetHnd;
hwc_region_t mClientTargetDamageRegion;