Create NativeImageQueue with the number of queue 23/303523/4
authorEunki Hong <eunkiki.hong@samsung.com>
Sat, 30 Dec 2023 14:31:47 +0000 (23:31 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 2 Jan 2024 04:25:45 +0000 (13:25 +0900)
Add new API that user can control the tbm_queue queue count.
It will be useful when we don't want to create 3 size of tbm_queue.

Change-Id: I4e1e5cbcb303411da5e45ffc5b1f42d26df90275
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
20 files changed:
dali/devel-api/adaptor-framework/native-image-source-queue.cpp
dali/devel-api/adaptor-framework/native-image-source-queue.h
dali/internal/imaging/android/native-image-source-factory-android.cpp
dali/internal/imaging/android/native-image-source-factory-android.h
dali/internal/imaging/android/native-image-source-queue-impl-android.cpp
dali/internal/imaging/android/native-image-source-queue-impl-android.h
dali/internal/imaging/common/native-image-source-factory.h
dali/internal/imaging/common/native-image-source-queue-impl.h
dali/internal/imaging/macos/native-image-source-factory-mac.cpp
dali/internal/imaging/macos/native-image-source-factory-mac.h
dali/internal/imaging/tizen/native-image-source-factory-tizen.cpp
dali/internal/imaging/tizen/native-image-source-factory-tizen.h
dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp
dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h
dali/internal/imaging/ubuntu-x11/native-image-source-factory-x.cpp
dali/internal/imaging/ubuntu-x11/native-image-source-factory-x.h
dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp
dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h
dali/internal/imaging/windows/native-image-source-factory-win.cpp
dali/internal/imaging/windows/native-image-source-factory-win.h

index e0e7acc..2ac179b 100644 (file)
@@ -27,7 +27,18 @@ namespace Dali
 NativeImageSourceQueuePtr NativeImageSourceQueue::New(uint32_t width, uint32_t height, ColorFormat colorFormat)
 {
   Any                       empty;
-  NativeImageSourceQueuePtr image = new NativeImageSourceQueue(width, height, colorFormat, empty);
+  NativeImageSourceQueuePtr image = new NativeImageSourceQueue(0, width, height, colorFormat, empty);
+  if(image->mImpl)
+  {
+    return image;
+  }
+  return nullptr;
+}
+
+NativeImageSourceQueuePtr NativeImageSourceQueue::New(uint32_t queueCount, uint32_t width, uint32_t height, ColorFormat colorFormat)
+{
+  Any                       empty;
+  NativeImageSourceQueuePtr image = new NativeImageSourceQueue(queueCount, width, height, colorFormat, empty);
   if(image->mImpl)
   {
     return image;
@@ -38,7 +49,7 @@ NativeImageSourceQueuePtr NativeImageSourceQueue::New(uint32_t width, uint32_t h
 NativeImageSourceQueuePtr NativeImageSourceQueue::New(Any nativeImageSourceQueue)
 {
   //ColorFormat will be ignored.
-  NativeImageSourceQueuePtr image = new NativeImageSourceQueue(0, 0, ColorFormat::BGRA8888, nativeImageSourceQueue);
+  NativeImageSourceQueuePtr image = new NativeImageSourceQueue(0, 0, 0, ColorFormat::BGRA8888, nativeImageSourceQueue);
   if(image->mImpl)
   {
     return image;
@@ -101,6 +112,11 @@ void NativeImageSourceQueue::PrepareTexture()
   mImpl->PrepareTexture();
 }
 
+uint32_t NativeImageSourceQueue::GetQueueCount() const
+{
+  return mImpl->GetQueueCount();
+}
+
 uint32_t NativeImageSourceQueue::GetWidth() const
 {
   return mImpl->GetWidth();
@@ -151,10 +167,10 @@ NativeImageInterface::Extension* NativeImageSourceQueue::GetExtension()
   return mImpl->GetNativeImageInterfaceExtension();
 }
 
-NativeImageSourceQueue::NativeImageSourceQueue(uint32_t width, uint32_t height, ColorFormat colorFormat, Any nativeImageSourceQueue)
+NativeImageSourceQueue::NativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
   auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory();
-  mImpl        = factory->CreateNativeImageSourceQueue(width, height, colorFormat, nativeImageSourceQueue);
+  mImpl        = factory->CreateNativeImageSourceQueue(queueCount, width, height, colorFormat, nativeImageSourceQueue);
 }
 
 NativeImageSourceQueue::~NativeImageSourceQueue()
index 4f8c5bc..610dce6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_NATIVE_IMAGE_SOURCE_QUEUE_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -76,6 +76,7 @@ public:
   /**
    * @brief Creates a new NativeImageSourceQueue.
    *        Depending on hardware, the width and height may have to be a power of two.
+   *        It will use 3, or defined by DALI_TBM_SURFACE_QUEUE_SIZE as default.
    * @param[in] width The width of the image
    * @param[in] height The height of the image
    * @param[in] colorFormat The color format of the image
@@ -84,6 +85,18 @@ public:
   static NativeImageSourceQueuePtr New(uint32_t width, uint32_t height, ColorFormat colorFormat);
 
   /**
+   * @brief Creates a new NativeImageSourceQueue with the queue size.
+   *        Depending on hardware, the width and height may have to be a power of two.
+   * @note Since queueCount can increase the memory usage, we recommened queueCount value is less or equal than 3.
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
+   * @param[in] width The width of the image
+   * @param[in] height The height of the image
+   * @param[in] colorFormat The color format of the image
+   * @return A smart-pointer to a newly allocated image
+   */
+  static NativeImageSourceQueuePtr New(uint32_t queueCount, uint32_t width, uint32_t height, ColorFormat colorFormat);
+
+  /**
    * @brief Creates a new NativeImageSourceQueue from an existing native image source.
    *
    * @param[in] nativeImageSourceQueue NativeImageSourceQueue must be a any handle with native image source
@@ -164,6 +177,13 @@ public:
    */
   const char* GetCustomSamplerTypename() const override;
 
+  /**
+   * @brief Get the number of queue count for this image.
+   *
+   * @return The number of queue count.
+   */
+  uint32_t GetQueueCount() const;
+
 private: // native image
   /**
    * @copydoc Dali::NativeImageInterface::CreateResource()
@@ -224,12 +244,13 @@ private:
   /// @cond internal
   /**
    * @brief Private constructor.
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image
    * @param[in] height The height of the image
    * @param[in] colorFormat The color format of the image
    * @param[in] nativeImageSourceQueue contains either: native image source or is empty
    */
-  DALI_INTERNAL NativeImageSourceQueue(uint32_t width, uint32_t height, ColorFormat colorFormat, Any nativeImageSourceQueue);
+  DALI_INTERNAL NativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   /**
    * @brief A reference counted object may only be deleted by calling Unreference().
index f85ed87..f653a00 100644 (file)
@@ -33,9 +33,9 @@ std::unique_ptr<NativeImageSource> NativeImageSourceFactoryAndroid::CreateNative
   return std::unique_ptr<NativeImageSource>(NativeImageSourceAndroid::New(width, height, depth, nativeImageSource));
 }
 
-std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryAndroid::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryAndroid::CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueAndroid::New(width, height, colorFormat, nativeImageSourceQueue));
+  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueAndroid::New(queueCount, width, height, colorFormat, nativeImageSourceQueue));
 }
 
 // this should be created from somewhere
index df404d6..ab1bd7c 100644 (file)
@@ -32,7 +32,7 @@ class NativeImageSourceFactoryAndroid : public NativeImageSourceFactory
 public:
   std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
 
-  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
+  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
 };
 
 } // namespace Adaptor
index 5a9528f..c9f3285 100644 (file)
@@ -33,14 +33,15 @@ namespace Internal
 {
 namespace Adaptor
 {
-NativeImageSourceQueueAndroid* NativeImageSourceQueueAndroid::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+NativeImageSourceQueueAndroid* NativeImageSourceQueueAndroid::New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  NativeImageSourceQueueAndroid* image = new NativeImageSourceQueueAndroid(width, height, colorFormat, nativeImageSourceQueue);
+  NativeImageSourceQueueAndroid* image = new NativeImageSourceQueueAndroid(queueCount, width, height, colorFormat, nativeImageSourceQueue);
   return image;
 }
 
-NativeImageSourceQueueAndroid::NativeImageSourceQueueAndroid(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
-: mWidth(width),
+NativeImageSourceQueueAndroid::NativeImageSourceQueueAndroid(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+: mQueueCount(queueCount),
+  mWidth(width),
   mHeight(height)
 {
   DALI_LOG_ERROR("NativeImageSourceQueueAndroid::NativeImageSourceQueueAndroid: Not supported\n");
index 010780d..0ecbe51 100644 (file)
@@ -41,13 +41,14 @@ public:
   /**
    * Create a new NativeImageSourceQueueAndroid internally.
    * Depending on hardware the width and height may have to be a power of two.
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The color format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    * @return A smart-pointer to a newly allocated image.
    */
-  static NativeImageSourceQueueAndroid* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  static NativeImageSourceQueueAndroid* New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   /**
    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
@@ -110,6 +111,14 @@ public:
   void PrepareTexture() override;
 
   /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount()
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
+  /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
   uint32_t GetWidth() const override
@@ -177,16 +186,18 @@ public:
 private:
   /**
    * Private constructor; @see NativeImageSourceQueue::New()
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The color format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    */
-  NativeImageSourceQueueAndroid(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  NativeImageSourceQueueAndroid(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
 private:
-  uint32_t mWidth;  ///< image width
-  uint32_t mHeight; ///< image height
+  uint32_t mQueueCount; ///< queue count
+  uint32_t mWidth;      ///< image width
+  uint32_t mHeight;     ///< image height
 };
 
 } // namespace Adaptor
index 806c030..1103533 100644 (file)
@@ -42,7 +42,7 @@ public:
 
   virtual std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) = 0;
 
-  virtual std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) = 0;
+  virtual std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) = 0;
 };
 
 extern std::unique_ptr<NativeImageSourceFactory> GetNativeImageSourceFactory();
index 04c8604..5d6b3a3 100644 (file)
@@ -36,7 +36,7 @@ public:
   /**
    * @copydoc Dali::NativeImageSourceQueue::New()
    */
-  static NativeImageSourceQueue* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  static NativeImageSourceQueue* New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   /**
    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
@@ -44,6 +44,11 @@ public:
   virtual Any GetNativeImageSourceQueue() const = 0;
 
   /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount
+   */
+  virtual uint32_t GetQueueCount() const = 0;
+
+  /**
    * @copydoc Dali::NativeImageSourceQueue::SetSize
    */
   virtual void SetSize(uint32_t width, uint32_t height) = 0;
index 6584e98..ce14f70 100644 (file)
@@ -40,6 +40,7 @@ NativeImageSourceFactoryCocoa::CreateNativeImageSource(
 
 std::unique_ptr<NativeImageSourceQueue>
 NativeImageSourceFactoryCocoa::CreateNativeImageSourceQueue(
+  uint32_t                                  queueCount,
   uint32_t                                  width,
   uint32_t                                  height,
   Dali::NativeImageSourceQueue::ColorFormat colorFormat,
index d78de43..b494a26 100644 (file)
@@ -32,6 +32,7 @@ public:
     Any                                 nativeImageSource) override;
 
   std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(
+    uint32_t                                  queueCount,
     uint32_t                                  width,
     uint32_t                                  height,
     Dali::NativeImageSourceQueue::ColorFormat colorFormat,
index adbb7d3..94ef427 100644 (file)
@@ -33,9 +33,9 @@ std::unique_ptr<NativeImageSource> NativeImageSourceFactoryTizen::CreateNativeIm
   return std::unique_ptr<NativeImageSource>(NativeImageSourceTizen::New(width, height, depth, nativeImageSource));
 }
 
-std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryTizen::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryTizen::CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueTizen::New(width, height, colorFormat, nativeImageSourceQueue));
+  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueTizen::New(queueCount, width, height, colorFormat, nativeImageSourceQueue));
 }
 
 // this should be created from somewhere
index 4654f36..3e0e74a 100644 (file)
@@ -32,7 +32,7 @@ class NativeImageSourceFactoryTizen : public NativeImageSourceFactory
 public:
   std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
 
-  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
+  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
 };
 
 } // namespace Adaptor
index 3cf8ff8..6b394bd 100644 (file)
@@ -67,9 +67,9 @@ int32_t GetTbmSurfaceQueueSize()
 
 } // namespace
 
-NativeImageSourceQueueTizen* NativeImageSourceQueueTizen::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+NativeImageSourceQueueTizen* NativeImageSourceQueueTizen::New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  NativeImageSourceQueueTizen* image = new NativeImageSourceQueueTizen(width, height, colorFormat, nativeImageSourceQueue);
+  NativeImageSourceQueueTizen* image = new NativeImageSourceQueueTizen(queueCount, width, height, colorFormat, nativeImageSourceQueue);
   DALI_ASSERT_DEBUG(image && "NativeImageSourceQueueTizen allocation failed.");
 
   if(image)
@@ -80,8 +80,9 @@ NativeImageSourceQueueTizen* NativeImageSourceQueueTizen::New(uint32_t width, ui
   return image;
 }
 
-NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 : mMutex(),
+  mQueueCount(queueCount),
   mWidth(width),
   mHeight(height),
   mTbmQueue(NULL),
@@ -105,6 +106,7 @@ NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t width, uint32_
   if(mTbmQueue != NULL)
   {
     mBlendingRequired = CheckBlending(tbm_surface_queue_get_format(mTbmQueue));
+    mQueueCount       = tbm_surface_queue_get_size(mTbmQueue);
     mWidth            = tbm_surface_queue_get_width(mTbmQueue);
     mHeight           = tbm_surface_queue_get_height(mTbmQueue);
   }
@@ -162,7 +164,12 @@ void NativeImageSourceQueueTizen::Initialize(Dali::NativeImageSourceQueue::Color
       }
     }
 
-    mTbmQueue = tbm_surface_queue_create(GetTbmSurfaceQueueSize(), mWidth, mHeight, tbmFormat, 0);
+    if(mQueueCount == 0)
+    {
+      mQueueCount = GetTbmSurfaceQueueSize();
+    }
+
+    mTbmQueue = tbm_surface_queue_create(mQueueCount, mWidth, mHeight, tbmFormat, 0);
     if(!mTbmQueue)
     {
       DALI_LOG_ERROR("NativeImageSourceQueueTizen::Initialize: tbm_surface_queue_create is failed! [%p]\n", mTbmQueue);
index cbd5aa7..a24f754 100644 (file)
@@ -45,13 +45,14 @@ public:
   /**
    * Create a new NativeImageSourceQueueTizen internally.
    * Depending on hardware the width and height may have to be a power of two.
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The color format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    * @return A smart-pointer to a newly allocated image.
    */
-  static NativeImageSourceQueueTizen* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  static NativeImageSourceQueueTizen* New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   /**
    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
@@ -114,6 +115,14 @@ public:
   void PrepareTexture() override;
 
   /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount()
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
+  /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
   uint32_t GetWidth() const override
@@ -181,12 +190,13 @@ public:
 private:
   /**
    * Private constructor; @see NativeImageSourceQueue::New()
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    */
-  NativeImageSourceQueueTizen(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  NativeImageSourceQueueTizen(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   void Initialize(Dali::NativeImageSourceQueue::ColorFormat colorFormat);
 
@@ -201,6 +211,7 @@ private:
   typedef std::pair<tbm_surface_h, uint8_t*> BufferPair;
 
   Dali::Mutex               mMutex;              ///< Mutex
+  uint32_t                  mQueueCount;         ///< queue count
   uint32_t                  mWidth;              ///< image width
   uint32_t                  mHeight;             ///< image height
   tbm_surface_queue_h       mTbmQueue;           ///< Tbm surface queue handle
index dee7b8a..35fb3aa 100644 (file)
@@ -33,9 +33,9 @@ std::unique_ptr<NativeImageSource> NativeImageSourceFactoryX::CreateNativeImageS
   return std::unique_ptr<NativeImageSource>(NativeImageSourceX::New(width, height, depth, nativeImageSource));
 }
 
-std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryX::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryX::CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueX::New(width, height, colorFormat, nativeImageSourceQueue));
+  return std::unique_ptr<NativeImageSourceQueue>(NativeImageSourceQueueX::New(queueCount, width, height, colorFormat, nativeImageSourceQueue));
 }
 
 // this should be created from somewhere
index dde5201..767a75e 100644 (file)
@@ -32,7 +32,7 @@ class NativeImageSourceFactoryX : public NativeImageSourceFactory
 public:
   std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
 
-  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
+  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
 };
 
 } // namespace Adaptor
index b6c4722..ff24893 100644 (file)
@@ -38,14 +38,15 @@ namespace
 #define TBM_SURFACE_QUEUE_SIZE 3
 } // namespace
 
-NativeImageSourceQueueX* NativeImageSourceQueueX::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+NativeImageSourceQueueX* NativeImageSourceQueueX::New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
-  NativeImageSourceQueueX* image = new NativeImageSourceQueueX(width, height, colorFormat, nativeImageSourceQueue);
+  NativeImageSourceQueueX* image = new NativeImageSourceQueueX(queueCount, width, height, colorFormat, nativeImageSourceQueue);
   return image;
 }
 
-NativeImageSourceQueueX::NativeImageSourceQueueX(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
-: mWidth(width),
+NativeImageSourceQueueX::NativeImageSourceQueueX(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+: mQueueCount(queueCount),
+  mWidth(width),
   mHeight(height)
 {
   DALI_LOG_ERROR("NativeImageSourceQueueX::NativeImageSourceQueueX: Not supported\n");
index 6fe065d..0fc8887 100644 (file)
@@ -41,13 +41,14 @@ public:
   /**
    * Create a new NativeImageSourceQueueX internally.
    * Depending on hardware the width and height may have to be a power of two.
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The color format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    * @return A smart-pointer to a newly allocated image.
    */
-  static NativeImageSourceQueueX* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  static NativeImageSourceQueueX* New(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
   /**
    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
@@ -110,6 +111,14 @@ public:
   void PrepareTexture() override;
 
   /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
+  /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
   uint32_t GetWidth() const override
@@ -177,16 +186,18 @@ public:
 private:
   /**
    * Private constructor; @see NativeImageSourceQueue::New()
+   * @param[in] queueCount The number of queue of the image. If it is 0, will use default.
    * @param[in] width The width of the image.
    * @param[in] height The height of the image.
    * @param[in] colorFormat The color format of the image.
    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
    */
-  NativeImageSourceQueueX(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
+  NativeImageSourceQueueX(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
 
 private:
-  uint32_t mWidth;  ///< image width
-  uint32_t mHeight; ///< image height
+  uint32_t mQueueCount; ///< queue count
+  uint32_t mWidth;      ///< image width
+  uint32_t mHeight;     ///< image height
 };
 
 } // namespace Adaptor
index 9cd362d..36572e9 100644 (file)
@@ -33,7 +33,7 @@ std::unique_ptr<NativeImageSource> NativeImageSourceFactoryWin::CreateNativeImag
   return std::unique_ptr<NativeImageSource>(NativeImageSourceWin::New(width, height, depth, nativeImageSource));
 }
 
-std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
 {
   return std::unique_ptr<NativeImageSourceQueue>(nullptr);
 }
index acae63b..2299768 100644 (file)
@@ -32,7 +32,7 @@ class NativeImageSourceFactoryWin : public NativeImageSourceFactory
 public:
   std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
 
-  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
+  std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t queueCount, uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
 };
 
 } // namespace Adaptor