From: Heeyong Song Date: Tue, 29 Nov 2022 07:42:26 +0000 (+0900) Subject: [Tizen] Use environment variable for native image queue size X-Git-Tag: accepted/tizen/7.0/unified/20221212.015717~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=06a7e9a6b4f4b38cc71ee34aba1228fd531f20a2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [Tizen] Use environment variable for native image queue size Change-Id: I2c847fce5e829050f551ba44aa59bb4a33f5a737 --- diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp index 9cd7681..c47b775 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp @@ -24,6 +24,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -36,10 +37,6 @@ namespace Adaptor { namespace { -#define TBM_SURFACE_QUEUE_SIZE 3 - -const char* SAMPLER_TYPE = "samplerExternalOES"; - // clang-format off int FORMATS_BLENDING_REQUIRED[] = { TBM_FORMAT_ARGB4444, TBM_FORMAT_ABGR4444, @@ -54,7 +51,19 @@ int FORMATS_BLENDING_REQUIRED[] = { }; // clang-format on -const int NUM_FORMATS_BLENDING_REQUIRED = 18; +const char* SAMPLER_TYPE = "samplerExternalOES"; + +constexpr int32_t NUM_FORMATS_BLENDING_REQUIRED = 18; + +constexpr int32_t DEFAULT_TBM_SURFACE_QUEUE_SIZE = 3u; +constexpr auto TBM_SURFACE_QUEUE_SIZE = "DALI_TBM_SURFACE_QUEUE_SIZE"; + +int32_t GetTbmSurfaceQueueSize() +{ + static auto queueSizeString = EnvironmentVariable::GetEnvironmentVariable(TBM_SURFACE_QUEUE_SIZE); + static int32_t queueSize = queueSizeString ? std::atoi(queueSizeString) : DEFAULT_TBM_SURFACE_QUEUE_SIZE; + return queueSize; +} } // namespace @@ -152,7 +161,7 @@ void NativeImageSourceQueueTizen::Initialize(Dali::NativeImageSourceQueue::Color } } - mTbmQueue = tbm_surface_queue_create(TBM_SURFACE_QUEUE_SIZE, mWidth, mHeight, tbmFormat, 0); + mTbmQueue = tbm_surface_queue_create(GetTbmSurfaceQueueSize(), mWidth, mHeight, tbmFormat, 0); if(!mTbmQueue) { DALI_LOG_ERROR("NativeImageSourceQueueTizen::Initialize: tbm_surface_queue_create is failed! [%p]\n", mTbmQueue); @@ -418,7 +427,7 @@ void NativeImageSourceQueueTizen::ResetEglImageList(bool releaseConsumeSurface) bool NativeImageSourceQueueTizen::CheckBlending(int format) { - for(int i = 0; i < NUM_FORMATS_BLENDING_REQUIRED; ++i) + for(int32_t i = 0; i < NUM_FORMATS_BLENDING_REQUIRED; ++i) { if(format == FORMATS_BLENDING_REQUIRED[i]) {