From eeb73608d81a49a04a0dc94ae2b9ef6059e6c1b8 Mon Sep 17 00:00:00 2001 From: Sunghyun Kim Date: Tue, 8 Jun 2021 14:29:59 +0900 Subject: [PATCH] Fix related to eglImage memory 1. Create only when there is no eglImage 2. When new eglImage is prepared, the existing eglImage need to update Change-Id: I8a292c5744b1605b464c45ef12c2b871624c0e5e --- .../imaging/tizen/native-image-source-impl-tizen.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp index 75417e4..16a5720 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -403,6 +403,12 @@ bool NativeImageSourceTizen::IsColorDepthSupported(Dali::NativeImageSource::Colo bool NativeImageSourceTizen::CreateResource() { + // If an EGL image exists, use it as it is without creating it. + if(mEglImageKHR != NULL) + { + return true; + } + // casting from an unsigned int to a void *, which should then be cast back // to an unsigned int in the driver. EGLClientBuffer eglBuffer = reinterpret_cast(mTbmSurface); @@ -414,9 +420,6 @@ bool NativeImageSourceTizen::CreateResource() mEglImageExtensions = mEglGraphics->GetImageExtensions(); DALI_ASSERT_DEBUG(mEglImageExtensions); - // if resource of egl was not destroyed, destroy it first - DestroyResource(); - mEglImageKHR = mEglImageExtensions->CreateImageKHR(eglBuffer); return mEglImageKHR != NULL; @@ -445,15 +448,16 @@ void NativeImageSourceTizen::PrepareTexture() Dali::Mutex::ScopedLock lock(mMutex); if(mSetSource) { - void* eglImage = mEglImageKHR; + // Destroy previous eglImage because use for new one. + // if mEglImageKHR is not to be NULL here, it will not be updated with a new eglImage. + mEglImageExtensions->DestroyImageKHR(mEglImageKHR); + mEglImageKHR = NULL; if(CreateResource()) { TargetTexture(); } - mEglImageExtensions->DestroyImageKHR(eglImage); - mSetSource = false; } } -- 2.7.4