[Tizen] Create NativeImageQueue with the number of queue 40/303540/2
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:28:42 +0000 (13:28 +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 e0e7acc1ecf2285629973478faed0951a58a50fd..2ac179bb9bb4116e50605386fa06c977bbf255b8 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 4f8c5bc98791677aa76c3565f56e1db8bea43ef0..610dce6449f08ba6ca1f11f822093fc93b216395 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
@@ -83,6 +84,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.
    *
@@ -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 f85ed8701cc303c41f8d8ce480005ed98f6041cc..f653a007a662ad825add11f9977db6cfd98c298f 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 df404d6c6dd23f46ab9c7d7a13566812a83063b9..ab1bd7c7d6c13f7bbe8bc355d22523b9d9d0e352 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 5a9528f354247ee7e340b17f45377b0c9b6cb737..c9f32850e3eb46cb4b9c1d13d18878e8c22afcd2 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 010780d91848376cd2ab3b630a537e791372bd20..0ecbe51489ff1188bb51e30ee3392e14a7dcc161 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()
@@ -109,6 +110,14 @@ public:
    */
   void PrepareTexture() override;
 
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount()
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
   /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
@@ -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 806c03066297c2f77af50700a1835eb511318740..1103533104b3bf5280fd2ad12b3a7f77c3ae9a38 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 04c8604082af8359f754d9d71893655d9043aa43..5d6b3a381a1bc61a82efab96b1d78ba248c295a2 100644 (file)
@@ -36,13 +36,18 @@ 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()
    */
   virtual Any GetNativeImageSourceQueue() const = 0;
 
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount
+   */
+  virtual uint32_t GetQueueCount() const = 0;
+
   /**
    * @copydoc Dali::NativeImageSourceQueue::SetSize
    */
index 6584e98abed7725c8a04be656f2e7584467b1373..ce14f70922c6b9278f6a005c84214a599f816c9a 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 d78de43e13573945c45a33e955f6bca51e81c86f..b494a2610462dc4cb68257fec668384b78be63ad 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 adbb7d3dc0747a3ae3394e0d97f56efd02dbd596..94ef4271454600d248952de4a36b6414cb99b4ec 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 4654f366c281c38d5f01a58631718f6a9f4401d9..3e0e74aa4629cb86ea4236af955d8ad65cd9bb4b 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 3cf8ff81e24faa33ecdc4e36d1968c4227a8c1c3..6b394bd6cc039d2a67f278c33e97901e84cd18bb 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 cbd5aa7f55a47d2e08cc31592169c73bb34b66d1..a24f7547cc6c9a17b11eeb8cf5ced332dd08b0fa 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()
@@ -113,6 +114,14 @@ public:
    */
   void PrepareTexture() override;
 
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount()
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
   /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
@@ -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 dee7b8a4aa324ee905b7d6023de4a30c454e6238..35fb3aae3a69057c5c756d67a6ab050c6836cbba 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 dde52012e78c36c892e873f2a3ec017036210c38..767a75efb23dee20893605cacb8be0efc5191c64 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 b6c4722ac1538b477a61841450559becc42e5745..ff24893c3b9b8002596d8ce7cc22760e0280c465 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 6fe065d37ca16498bc08c236c8ac06562bb49607..0fc8887dc7ff19b21aef0f348ed4eb85f35e78ca 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()
@@ -109,6 +110,14 @@ public:
    */
   void PrepareTexture() override;
 
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::GetQueueCount
+   */
+  uint32_t GetQueueCount() const override
+  {
+    return mQueueCount;
+  }
+
   /**
    * @copydoc Dali::NativeImageInterface::GetWidth()
    */
@@ -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 9cd362d4ee6703ff0ef57bd937409a7078f452a5..36572e9f16245240feb64d14aa977efaf35b03cb 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 acae63bd6e007a3e98aa8a56864828e927db1f51..2299768d7d8143ae6484c309386658fbf7d5eea1 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