author | sky zhou <sky.zhou@amlogic.com> | 2020-02-20 03:50:40 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 12:03:00 (GMT) |
commit | 26743b41e37f1ac33144068c801b7a10627fb756 (patch) | |
tree | 19a0e80f603f70bb8836f642e2057d4efc384a1b | |
parent | 9288fb90c35bfda32c456f0aecee31622e75c1f6 (diff) | |
download | hwcomposer-26743b41e37f1ac33144068c801b7a10627fb756.zip hwcomposer-26743b41e37f1ac33144068c801b7a10627fb756.tar.gz hwcomposer-26743b41e37f1ac33144068c801b7a10627fb756.tar.bz2 |
hwc/service: fix release cache error. [1/1]
PD#SWPL-20627
Problem:
when video type changed, hwc will release
caches which also released current buffer,
so we got blank screen.
Solution:
releasecache before update new buffer
to cache.
Verify:
Verify on newton.
Change-Id: Ic1bf4bbdf5014650a5c2550d2112b50ab9af0cb7
Signed-off-by: sky zhou <sky.zhou@amlogic.com>
-rwxr-xr-x[-rw-r--r--] | common/base/include/DrmTypes.h | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | hwc2/Hwc2Layer.cpp | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | service/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h | 15 |
3 files changed, 14 insertions, 10 deletions
diff --git a/common/base/include/DrmTypes.h b/common/base/include/DrmTypes.h index 6787e63..8a3888a 100644..100755 --- a/common/base/include/DrmTypes.h +++ b/common/base/include/DrmTypes.h @@ -62,9 +62,10 @@ typedef enum drm_fb_type { DRM_FB_VIDEO_OMX_PTS_SECOND, /*no image data, but with pts.*/ DRM_FB_VIDEO_OMX_V4L, - DRM_FB_VIDEO_DMABUF, /*no image data, but with vf.*/ DRM_FB_VIDEO_OMX2_V4L2, + /*real image data, and is contiguous buf*/ + DRM_FB_VIDEO_DMABUF, } drm_fb_type_t; #define DRM_DISPLAY_MODE_LEN (64) diff --git a/hwc2/Hwc2Layer.cpp b/hwc2/Hwc2Layer.cpp index 99da841..4babadf 100644..100755 --- a/hwc2/Hwc2Layer.cpp +++ b/hwc2/Hwc2Layer.cpp @@ -107,6 +107,12 @@ hwc2_error_t Hwc2Layer::setBuffer(buffer_handle_t buffer, int32_t acquireFence) clearBufferInfo(); setBufferInfo(buffer, acquireFence); + if (buffer == NULL) { + MESON_LOGE("Receive null buffer, it is impossible."); + mFbType = DRM_FB_UNDEFINED; + return HWC2_ERROR_NONE; + } + /*set mFbType by usage of GraphicBuffer.*/ if (mHwcCompositionType == HWC2_COMPOSITION_CURSOR) { mFbType = DRM_FB_CURSOR; diff --git a/service/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h b/service/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h index aab7d59..8c22ebc 100644..100755 --- a/service/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h +++ b/service/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h @@ -302,22 +302,19 @@ class ComposerHandleCache { // when fromCache is true, look up in the cache; otherwise, update the cache Error getHandle(uint32_t slot, bool fromCache, const native_handle_t* inHandle, const native_handle_t** outHandle, const native_handle** outReplacedHandle) { - Error error = Error::NONE; + if (fromCache) { *outReplacedHandle = nullptr; error = lookupCache(slot, outHandle); } else { - *outHandle = inHandle; - error = updateCache(slot, inHandle, outReplacedHandle); - } - - if (mHandleType == HandleType::BUFFER) { - bool changed = isChangedFromeVideoToUi(*outHandle); - if (changed) { - ALOGD("FB type changed from video to UI, release cache"); + if (mHandleType == HandleType::BUFFER && isChangedFromeVideoToUi(inHandle)) { + ALOGD("FB type changed from video to UI, fromcache(%d):slot(%d)", fromCache, slot); releaseCache(0); } + + *outHandle = inHandle; + error = updateCache(slot, inHandle, outReplacedHandle); } return error; |