<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Hi,<br>
<br>
The GstVulkanImageMemory has field that specify the latest memory
barrier required by the next processing. Have a look at what any of
the other vulkan element do with the incoming GstVulkanImageMemory.
They only do memory barrier operations as currently everything
occurs on the same Vulkan queue. Multiple Vulkan queue processing
is a TODO item for where that may make sense and there semaphores or
events would be required.<br>
<br>
If you need semaphores for whatever you are doing, you need to
implement that yourself. Semaphores aren't needed for every use
case, especially when running on the same vulkan queue.
Pre-creating VkImage's is also limiting for other scenarios and in
general for GStreamer usage.<br>
<br>
VkImage's area created as needed and you could either get a
completely new VkImage each frame, or go through a small number of
them. The exact details depend on the upstream elements and e.g.
whether they use a buffer pool or not.<br>
<br>
You need to insert the relevant barrier operation to ensure writes
have finished before you read from the VkImage as required by the
Vulkan specification. If you are accessing the Vulkan image from
another queue, then you also need to perform a queue transfer.<br>
<br>
You can keep a reference to the GstBuffer for as long as you like,
however that may cause more VKImage's to be created to accomodate
your processing.<br>
<br>
Cheers<br>
-Matt<br>
<br>
<div class="moz-cite-prefix">On 3/3/22 13:10, Joel Winarske wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABKMkPK_qW25BeEY9HMfL2-2_t10N0wYRisJpXS3i=B97BrqzQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>I am now able to get GstVulkanImageMemory/vkImage from a
sample: <a
href="https://gist.github.com/jwinarske/dda0f7154a0bf34c3e7b6606907ad0f7"
moz-do-not-send="true" class="moz-txt-link-freetext">https://gist.github.com/jwinarske/dda0f7154a0bf34c3e7b6606907ad0f7</a></div>
<div><br>
</div>
<div>What is the state of the vkImage when I read it from the
sample? Ready to use and safe until the next incoming sample?</div>
<div>Do I need to do anything with the barrier?<br>
</div>
<div>How many vkImages are created, and in use?</div>
<div><br>
</div>
<div>It might be good to have an API where one can pass in an
array of pre-created vkImages for use by the pipeline. Then
semaphores can be used externally for optimal threading and
the presentation logic.<br>
</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Joel<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Joel<br>
</div>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Mar 2, 2022 at 12:12
AM Matthew Waters <<a href="mailto:ystreet00@gmail.com"
moz-do-not-send="true" class="moz-txt-link-freetext">ystreet00@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> appsink is your friend and you can retrieve the
VkImage's from upstream and you can do what you like with
them.<br>
<br>
There's no requirement to use vulkansink however you would
need to make sure to interop with the relevant Vulkan
objects between the application and GStreamer which may
require some API additions in GStreamer for that case. The
design is similar to OpenGL integration but there are some
differences with how Vulkan itself works that need to be
accounted for when writing your own glue code.<br>
<br>
Cheers<br>
-Matt<br>
<br>
<div>On 2/3/22 10:02, Joel Winarske wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>I'm looking to use GST with an external swap
chain. Is there currently a way to get a callback or
signaled semaphore (common) when a VkImage is ready
for external use? I'm thinking I may need to
implement a variant of vulkansink.</div>
<div><br>
</div>
<div>The external swap chain is running multiple
pipelines, and handling display presentation logic.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Feb 7, 2022 at
6:40 PM Matthew Waters <<a
href="mailto:ystreet00@gmail.com" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">ystreet00@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Apart from running
with vulkan elements with gst-launch-1.0, yes. That's<br>
the only application example for Vulkan. Note that
Vulkan does work on<br>
macOS/iOS through the MoltenVK layer.<br>
<br>
On 8/2/22 12:38, Joel Winarske via gstreamer-devel
wrote:<br>
> Is this the only Vulkan example?<br>
><br>
> <a
href="https://gitlab.freedesktop.org/gstreamer/gst-examples/-/tree/master/vulkan"
rel="noreferrer" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">https://gitlab.freedesktop.org/gstreamer/gst-examples/-/tree/master/vulkan</a><br>
><br>
> Thanks,<br>
> Joel<br>
<br>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>