Skip to content

Commit

Permalink
[NUI] Support NativeImageQueue creation with queue count
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Eunki Hong authored and hinohie committed Jan 3, 2024
1 parent 76b7cb7 commit 2be302f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ internal static partial class NativeImageQueue
[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);

Expand All @@ -41,6 +44,9 @@ internal static partial class NativeImageQueue
[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);
}
Expand Down
29 changes: 28 additions & 1 deletion src/Tizen.NUI/src/public/Images/NativeImageQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,22 @@ public enum ColorFormat
/// <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();
}
Expand All @@ -97,6 +112,18 @@ internal NativeImageQueue(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeIma
handle = cPtr;
}

/// <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>
Expand Down

0 comments on commit 2be302f

Please sign in to comment.