[NUI] Support NativeImageQueue creation with queue count
authorEunki Hong <eunkiki.hong@samsung.com>
Sun, 31 Dec 2023 01:35:16 +0000 (10:35 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 3 Jan 2024 03:31:51 +0000 (12:31 +0900)
Let we allow to create NativeImageQueue with queue count.
Previously, we only allow to create the NativeImageQueue based on the environment value "DALI_TBM_SURFACE_QUEUE_SIZE".
(This value is 3 as default)

It will be useful if some user want to reduce the queue count for some cases, not for whole queue.

relative DALi patches :

https://review.tizen.org/gerrit/c/platform/core/uifw/dali-adaptor/+/303523
https://review.tizen.org/gerrit/c/platform/core/uifw/dali-csharp-binder/+/303524

Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.NativeImageQueue.cs
src/Tizen.NUI/src/public/Images/NativeImageQueue.cs

index 0ded636..a8f7866 100644 (file)
@@ -25,6 +25,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_NativeImageQueuePtr")]
             public static extern IntPtr NewHandle(uint width, uint height, int colorFormat);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_NativeImageQueuePtr_2")]
+            public static extern IntPtr NewHandle(uint queueCount, uint width, uint height, int colorFormat);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GetPtr")]
             public static extern IntPtr Get(IntPtr queue);
 
@@ -41,6 +44,9 @@ namespace Tizen.NUI
             [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
             public static extern bool EnqueueBuffer(IntPtr queue, IntPtr buffer);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GetQueueCount")]
+            public static extern uint GetQueueCount(IntPtr queue);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GenerateUrl")]
             public static extern IntPtr GenerateUrl(IntPtr queue);
         }
index 4057e45..94c3df4 100644 (file)
@@ -87,7 +87,22 @@ namespace Tizen.NUI
         /// <param name="colorFormat">A color format of queue.</param>
         /// <returns>A NativeImageQueue.</returns>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public NativeImageQueue(uint width, uint height, ColorFormat colorFormat) : this(Interop.NativeImageQueue.NewHandle(width, height, (int)colorFormat), true)
+        public NativeImageQueue(uint width, uint height, ColorFormat colorFormat) : this(0, width, height, colorFormat)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Creates an initialized NativeImageQueue with queue count and size and color format.
+        /// </summary>
+        /// <remarks>Since queueCount can increase the memory usage, we recommened queueCount value is less or equal than 3.</remarks>
+        /// <param name="queueCount">The number of queue count. Use system default value if it is 0.</param>
+        /// <param name="width">A Width of queue.</param>
+        /// <param name="height">A Height of queue.</param>
+        /// <param name="colorFormat">A color format of queue.</param>
+        /// <returns>A NativeImageQueue.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NativeImageQueue(uint queueCount, uint width, uint height, ColorFormat colorFormat) : this(Interop.NativeImageQueue.NewHandle(queueCount, width, height, (int)colorFormat), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -98,6 +113,18 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// The number of queue.
+        /// </summary>
+        /// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public uint GetQueueCount()
+        {
+            uint ret = Interop.NativeImageQueue.GetQueueCount(this.SwigCPtr.Handle);
+            NDalicPINVOKE.ThrowExceptionIfExists();
+            return ret;
+        }
+
+        /// <summary>
         /// Generate Url from native image queue.
         /// </summary>
         /// <remarks>