X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fimaging%2Ftizen%2Fnative-image-source-impl-tizen.cpp;h=bbc14a7aa43bd9f1127f6ea997b9524f9cc285b8;hb=adeaef29df5f659913abf12fd331af8a4464f0f7;hp=1e455d589e38c69399da5f95745114dd23158cbb;hpb=3a63fe1a2fd7d1e6e17e1900fd1be412f0f5909b;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git 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 1e455d5..bbc14a7 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -38,6 +38,7 @@ namespace Adaptor { namespace { +const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; const char* SAMPLER_TYPE = "samplerExternalOES"; // clang-format off @@ -74,8 +75,7 @@ NativeImageSourceTizen* NativeImageSourceTizen::New(uint32_t width, uint32_t hei } NativeImageSourceTizen::NativeImageSourceTizen(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) -: mCustomFragmentPrefix(), - mWidth(width), +: mWidth(width), mHeight(height), mOwnTbmSurface(false), mTbmSurface(NULL), @@ -94,8 +94,6 @@ NativeImageSourceTizen::NativeImageSourceTizen(uint32_t width, uint32_t height, GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface()); mEglGraphics = static_cast(graphics); - mCustomFragmentPrefix = mEglGraphics->GetEglImageExtensionString(); - mTbmSurface = GetSurfaceFromAny(nativeImageSource); if(mTbmSurface != NULL) @@ -403,6 +401,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); @@ -445,22 +449,23 @@ 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; } } const char* NativeImageSourceTizen::GetCustomFragmentPrefix() const { - return mCustomFragmentPrefix; + return FRAGMENT_PREFIX; } const char* NativeImageSourceTizen::GetCustomSamplerTypename() const @@ -508,7 +513,7 @@ uint8_t* NativeImageSourceTizen::AcquireBuffer(uint16_t& width, uint16_t& height { tbm_surface_info_s info; - if(tbm_surface_map(mTbmSurface, TBM_SURF_OPTION_READ, &info) != TBM_SURFACE_ERROR_NONE) + if(tbm_surface_map(mTbmSurface, TBM_SURF_OPTION_READ | TBM_SURF_OPTION_WRITE, &info) != TBM_SURFACE_ERROR_NONE) { DALI_LOG_ERROR("Fail to map tbm_surface\n");