From d60856ad3589cda74b409f4a286610bcd708e0f2 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Sun, 31 Dec 2023 10:35:16 +0900 Subject: [PATCH] [NUI] Support NativeImageQueue creation with queue count 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 --- .../internal/Interop/Interop.NativeImageQueue.cs | 6 +++++ .../src/public/Images/NativeImageQueue.cs | 28 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageQueue.cs b/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageQueue.cs index 0ded636..a8f7866 100644 --- a/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageQueue.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageQueue.cs @@ -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); } diff --git a/src/Tizen.NUI/src/public/Images/NativeImageQueue.cs b/src/Tizen.NUI/src/public/Images/NativeImageQueue.cs index 4057e45..2146259 100644 --- a/src/Tizen.NUI/src/public/Images/NativeImageQueue.cs +++ b/src/Tizen.NUI/src/public/Images/NativeImageQueue.cs @@ -87,7 +87,21 @@ namespace Tizen.NUI /// A color format of queue. /// A NativeImageQueue. [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(); + } + + /// + /// Creates an initialized NativeImageQueue with queue count and size and color format. + /// + /// The number of queue count. Use system default value if it is 0. + /// A Width of queue. + /// A Height of queue. + /// A color format of queue. + /// A NativeImageQueue. + [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 +112,18 @@ namespace Tizen.NUI } /// + /// The number of queue. + /// + /// Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetQueueCount() + { + uint ret = Interop.NativeImageQueue.GetQueueCount(this.SwigCPtr.Handle); + NDalicPINVOKE.ThrowExceptionIfExists(); + return ret; + } + + /// /// Generate Url from native image queue. /// /// -- 2.7.4