author | Tellen Yu <tellen.yu@amlogic.com> | 2016-10-26 03:02:23 (GMT) |
---|---|---|
committer | Gerrit Code Review <gituser@scgit.amlogic.com> | 2016-10-26 03:02:23 (GMT) |
commit | 173d7e036c7230e78df78dca94f0f8b7a2adc61e (patch) | |
tree | 3803e27f3634f104f6058023ae8b29bbc197bc6b | |
parent | 255e66e08aef67ea099c7b3c7c589bddc86b253c (diff) | |
parent | ff899eb334552e6f584c972ed228fea078a1d340 (diff) | |
download | hwcomposer-173d7e036c7230e78df78dca94f0f8b7a2adc61e.zip hwcomposer-173d7e036c7230e78df78dca94f0f8b7a2adc61e.tar.gz hwcomposer-173d7e036c7230e78df78dca94f0f8b7a2adc61e.tar.bz2 |
Merge changes I163490fc,I0bcfcd0d into n-amlogic
* changes:
PD#132792: fix Riptide GP 2 black screen
PD#132769: close fence when power mode is off
-rw-r--r-- | hwc2/common/base/HwcLayer.cpp | 7 | ||||
-rw-r--r-- | hwc2/common/devices/PhysicalDevice.cpp | 39 | ||||
-rw-r--r-- | hwc2/include/PhysicalDevice.h | 2 |
3 files changed, 35 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..4b78120 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); @@ -462,13 +473,14 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence) { if (*outRetireFence < -1) err = HWC2_ERROR_NOT_VALIDATED; *outRetireFence -1; } + mTargetAcquireFence = -1; // 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 +530,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 +553,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; |