From 56ce833758be3e6d82d26f8646f07beb118686dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E7=A5=AD?= Date: Mon, 23 Sep 2024 07:23:54 +0000 Subject: [PATCH] =?UTF-8?q?graphic=5F2d=20ICSL=20=E4=B8=80=E8=88=AC?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 花祭 Change-Id: I15ecd8ea11c56c49dedb03c17e81677c28904c08 --- frameworks/surfaceimage/src/native_image.cpp | 3 ++- frameworks/surfaceimage/src/surface_image.cpp | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/surfaceimage/src/native_image.cpp b/frameworks/surfaceimage/src/native_image.cpp index 38e8755bef..5eecad7de2 100644 --- a/frameworks/surfaceimage/src/native_image.cpp +++ b/frameworks/surfaceimage/src/native_image.cpp @@ -130,12 +130,13 @@ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId) BLOGE("parameter error"); return SURFACE_ERROR_INVALID_PARAM; } - *surfaceId = image->consumer->GetUniqueId(); if (image->pSurface == nullptr) { image->pSurface = Surface::CreateSurfaceAsProducer(image->producer); } BLOGE_CHECK_AND_RETURN_RET(image->pSurface != nullptr, SURFACE_ERROR_UNKOWN, "pSurface is null"); + + *surfaceId = image->consumer->GetUniqueId(); return SURFACE_ERROR_OK; } diff --git a/frameworks/surfaceimage/src/surface_image.cpp b/frameworks/surfaceimage/src/surface_image.cpp index f57ddfa4e8..4d2ee2f5a4 100644 --- a/frameworks/surfaceimage/src/surface_image.cpp +++ b/frameworks/surfaceimage/src/surface_image.cpp @@ -90,7 +90,6 @@ void SurfaceImage::UpdateSurfaceInfo(uint32_t seqNum, sptr buffer int releaseFence = -1; auto iter = imageCacheSeqs_.find(currentSurfaceImage_); if (iter != imageCacheSeqs_.end() && iter->second.eglSync_ != EGL_NO_SYNC_KHR) { - // PLANNING: use eglDupNativeFenceFDOHOS in the future. releaseFence = eglDupNativeFenceFDANDROID(eglDisplay_, iter->second.eglSync_); } // There is no need to close this fd, because in function ReleaseBuffer it will be closed. @@ -126,7 +125,7 @@ SurfaceError SurfaceImage::UpdateSurfaceImage() // acquire buffer sptr buffer = nullptr; sptr acquireFence = SyncFence::InvalidFence(); - int64_t timestamp; + int64_t timestamp = 0; Rect damage; ret = AcquireBuffer(buffer, acquireFence, timestamp, damage); if (ret != SURFACE_ERROR_OK) { @@ -307,8 +306,8 @@ void SurfaceImage::DestroyEGLImageBySeq(uint32_t seqNum) auto iter = imageCacheSeqs_.find(seqNum); if (iter != imageCacheSeqs_.end()) { DestroyEGLImage(iter->second.eglImage_); + imageCacheSeqs_.erase(seqNum); } - imageCacheSeqs_.erase(seqNum); } void SurfaceImage::NewBufferDestroyEGLImage(bool isNewBuffer, uint32_t seqNum)