Commit Graph

82497 Commits

Author SHA1 Message Date
Benjamin Otte
847c7e2315 vulkan: Add support for D3D12 fences 2024-11-08 03:26:48 +01:00
Benjamin Otte
3e9b6abdec win32: Add (private) getters for fences and the HANDLE
We will need those when using them in Vulkan or GL.
2024-11-08 03:26:47 +01:00
Benjamin Otte
e48dc89daa gstreamer: Add support for D3D12 fences 2024-11-08 03:26:47 +01:00
Benjamin Otte
ac066e1807 win32: Add GdkD3D12TextureBuilder::fence
Add ::fence and ::fence-wait to set the fence and the value to wait for.

And wait for it before download()ing.
2024-11-08 03:26:47 +01:00
Benjamin Otte
b5c0dc1ced gstreamer/win32: Implement an allocation pool
We always use the default device, because that's what we do in GTK
proper and there's no API to query it anyway.
2024-11-08 03:26:47 +01:00
Benjamin Otte
ca4915962e win32: Support common DXGI video formats (incomplete) 2024-11-08 03:26:47 +01:00
Benjamin Otte
90d09a1180 win32: Import D3D12 resources into Vulkan renderer 2024-11-08 03:26:47 +01:00
Benjamin Otte
9ae76f6e69 vulkan: Change the allocator querying API
The old API was awkward in that it didn't allow access to the proper
memory type index and was prone to misuse in codepaths when importing
memory instead of allocating it.

Change that.

The old way now requires more code and a local variable, but importing
memory is a lot more straightforward.

And I don't have to spend days tracking down a leak on Windows.
2024-11-08 03:26:47 +01:00
Benjamin Otte
641b8c9cd0 vulkan: Add support for timeline semaphores
Unlike binary semaphores, timeline semaphores represent a (64bit
unsigned) value and the binary decision about whether they have signaled
or not is decided by comparing their value to a predefined value.
So this code adds the ability to pass that value.

In fact, it now requires this value, but that is not a problem because
Vulkan ignores the value for binary semaphores, so we can just pass
0 everywhere a binary sempahore is used.

There is no use of the code in those commit, but timeline semaphores
are used for explicit sync with dmabufs and D3D12 uses them exclusively.
2024-11-08 03:19:27 +01:00
Benjamin Otte
a6d30b1694 vulkan: Add GDK_VULKAN_FEATURE_WIN32
We will use this for import/export of Win32-specific resources.

So far it's set up for d3d12 texture import.
2024-11-08 03:16:39 +01:00
Benjamin Otte
9f9d8f59bd vulkan: Always include vulkan_win32.h on Windows
I am so totally not interested to think about this special header.

Also, I had to hunt it down because everything else includes
just vulkan.h and only Windows does the custom header.
2024-11-08 03:16:39 +01:00
Benjamin Otte
d22cfef06e win32: Replace glsinkbin with d3d12convert on Windows
On Windows, we don't want to use GL and let D3D12 do all the work.

But as long as we don't support all formats and implement all the
interfaces GstPlayer expects, we need to have a way to convert.

So we put a d3d12convert for that.

Related: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3956
2024-11-08 03:13:43 +01:00
Benjamin Otte
577176b0f2 gstreamer/win32: Add initial D3D12 support to GTK sink 2024-11-07 22:16:38 +01:00
Benjamin Otte
595294b8f4 gpu: Add D3D12 texture support to GL renderer
Add a gdk_d3d12_texture_import_gl() function to match the EGL import
behavior.

And then use it in the import code.

What makes this a bit awkward is that we need to not just shuffle a
tex_id but also a mem_id around, but oh well...
2024-11-07 22:16:37 +01:00
Benjamin Otte
80c04eb223 win32: Add gdk_d3d12_texture_get_handle()
Makes shared HANDLE handling part of the texture. This handle will be
needed when importing into GL or Vulkan or using elsewhere.
Its lifetime is bound to the texture and so is it's use,
so it's best to maintain it here instead of requiring renderers to
deal with HANDLEs.
2024-11-07 22:07:53 +01:00
Benjamin Otte
c9d58ee54e gpu: Add an optional memory_id to GL images
This implements initial support for GL_EXT_external_objects.
An external memory object is (unlike EGL images) represented by a
GLuint just like all other GL objects.
It needs to be kept alive for as long as the memory is used, which
means it needs to outlive the texture ID.

That's why the object is handed over to the texture code and the
finalizer will then free the memory object.

This is just plumbing, users will follow in future commits.
2024-11-06 23:44:20 +01:00
Benjamin Otte
768fcfb718 gl: Add features for EXT_external_objects(_win32) 2024-11-06 23:44:20 +01:00
Benjamin Otte
35904b793a tests: Add testd3d12
This is a hacked up testdmabuf, but it's good enough to create a
resource and check that GdkD3D12Texture actually works.
2024-11-06 23:44:20 +01:00
Benjamin Otte
8b99f14706 win32: Add GdkD3d12Texture and builder
This is a simple implementation of a GdkTexture that is backed by
a ID3D12Resource.

The only functionality implemented so far is GdkTexture::download(),
but that is enough to make it work - albeit slowly - in all renderers.

It also doesn't support any fancy formats yet; in particular: no YUV.
2024-11-06 23:44:20 +01:00
Benjamin Otte
b5af96c21f win32: Add gdkdxgiformat.[ch]
These contain utility functions for mapping DXGI formats to the
formats GTK uses in various places.

For now, only the straightforward formats are mapped.
2024-11-06 17:59:21 +01:00
Benjamin Otte
d1e903203b win32: link against Direct3D 12
This prepares the build system for adding D3D12 support.

No actual code changes yet.
2024-11-06 17:59:20 +01:00
Benjamin Otte
d859b8a8e4 meson: Update GStreamer wrap to main
It's needed for D3D12 elements to have ranks and be picked for
autoplugging.

Related: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7045
2024-11-06 17:59:20 +01:00
Benjamin Otte
c3eb4ff025 build: Add wrap file for DirectX headers
Fixes CI for MSVC build
2024-11-06 17:59:20 +01:00
Benjamin Otte
2a411b895a CI: Install DirectX headers 2024-11-06 17:59:20 +01:00
Benjamin Otte
fe6b9d61f5 gdk: Add GDK_DEBUG=d3d12
This is meant to mirror GDK_DEBUG=dmabuf on Linux.
2024-11-06 17:59:20 +01:00
Benjamin Otte
7b6a7671cf memoryformat: Add DXGI format mappings
This mirrors the Vulkan code pretty much.
The 2 APIs are reasonably similar.
2024-11-06 17:59:20 +01:00
Matthias Clasen
d4afacc217 Merge branch 'ci-meson-junit' into 'main'
ci: Try to use llvm-symbolizer

See merge request GNOME/gtk!7900
2024-11-05 20:23:18 +00:00
Matthias Clasen
ed6f2a9693 Merge branch 'fix-demo-expander' into 'main'
demo: Fix "Expander" demonstration

See merge request GNOME/gtk!7887
2024-11-05 18:37:11 +00:00
Matthias Clasen
fc22b0862c Merge branch 'macos-modifier-keys' into 'main'
gtktext/gtktextview: Use correct modifier keys for macOS shortcuts

See merge request GNOME/gtk!7837
2024-11-05 18:34:18 +00:00
Matthias Clasen
6a02caf216 Merge branch 'fix-demo-dnd' into 'main'
demo: Fix drag and drop demo critical

See merge request GNOME/gtk!7892
2024-11-05 18:32:43 +00:00
Matthias Clasen
8802af1868 Merge branch 'appstream_xmlns' into 'main'
demos: Add xmlns to appstream metainfo files

See merge request GNOME/gtk!7894
2024-11-05 18:32:13 +00:00
Matthias Clasen
6f59f1f5a4 ci: Use meson junit output
Just use the junit xml that is produced by meson, it works now.
2024-11-05 13:18:36 -05:00
Matthias Clasen
af87994115 ci: Try to use llvm-symbolizer
It might help get some stacktraces out of crashes in asan.
2024-11-05 13:18:36 -05:00
Matthias Clasen
059b7d516e Merge branch 'fix-7141' into 'main'
application: NULL-check appid before using it

Closes #7141

See merge request GNOME/gtk!7899
2024-11-05 16:34:59 +00:00
Matthijs Velsink
a6ef6835ad application: NULL-check appid before using it
Fixes commit 3274a286cc.

Closes #7141
2024-11-05 15:08:28 +01:00
Benjamin Otte
14a19b423e Merge branch 'wip/otte/win32-fixes' into 'main'
various fixes

See merge request GNOME/gtk!7895
2024-11-05 13:01:56 +00:00
Benjamin Otte
b8d24d0259 win32: Require Windows 10
All versions older than Windows 10 are out of support and no longer
receive updates, so we do not want to support them.

We also want to move towards APIs that requires Windows 10 - like
Direct3D 12 - and not having them optional simplifies our code.

See the discussion in !7895 for more details.
2024-11-05 02:45:37 +01:00
Benjamin Otte
01453c733c testsuite: Rename "diff" test to "not-diff"
3 things you need to know about this change:

1. We use diff(1) in various tests to check generated text against
   reference output
2. Windows locates executables not just in $PATH, it also looks in
   $cwd and the directory of the current process' binary
3. Multiple tests live together in the same directory

Windows is fun.
2024-11-05 02:45:37 +01:00
Benjamin Otte
3d578e8db5 win32: Use gdk_win32_com_clear() where appropriate 2024-11-05 02:45:37 +01:00
Benjamin Otte
2ed6867084 win32: Define COBJMACROS via project argument
We use it everywhere, so it makes sense to enable it everywhere.

For anyone not in the know, defining COBJMACROS makes Micrsoft headers
for COM objects provide C macros so that instead of having to call
  foo->lpVtbl->Release();
to unref a COM object, one can call
  IFoo_Release (foo);

Note that thes macros are implemented with inheritance as Release()
is defined on the IUnknown base interface (MS' equivalent to GObject)
and would otherwise require
  IUnknown_Release ((IUnknown *) foo);
That line works, too - but it is not necessary.
2024-11-05 02:45:37 +01:00
Benjamin Otte
ef839e6505 win32: Add gdk_win32_com_clear()
Like g_clear_object(), but for COM objects.
2024-11-05 02:45:37 +01:00
Benjamin Otte
2a7beb75e8 testsuite: Make offload test do actual diffs
We have a testutils.c version for that.
2024-11-05 02:45:37 +01:00
Benjamin Otte
bfbc3e7484 testsuite: Clarify error
200% is not a fractional scale, but it's still forbidden.
2024-11-05 02:45:37 +01:00
Benjamin Otte
2e8fac7789 testsuite: Make nodeparser use shared diffing code
We have a testutils.c version, use that one.
2024-11-05 01:07:22 +01:00
Benjamin Otte
dd93aa9f50 testsuite: Rewrite diff_with_file()
use the modern version using GSubprocess that already exists in
node-parser.

Also change from one function to two - so tests can diff GBytes and
strings, depending on which they prefer.
2024-11-05 01:07:22 +01:00
Benjamin Otte
6cd98bae3b testsuite: Add --strip-trailing-cr to diff call
On Windows, git defaults to maintaining line endings, which means it
changed \n to \r\n on all files it identifies as text. And that includes
our test output.

Luckily diff(1) has an option to undo that. And since we do not care
about line endings in those tests, we can just use it.
2024-11-04 22:02:28 +01:00
Benjamin Otte
0a6c4711bc gstreamer: Fix small memleak 2024-11-04 21:50:26 +01:00
Benjamin Otte
7085a58f01 gstreamer: Identify GL memory by looking at the memory
Instead of looking at availability of a GL context, check the
memory's type.

That's what we do everywhere else and GL is not special.
2024-11-04 21:50:26 +01:00
Benjamin Otte
8b1dff5b94 gstsink: Do not advertise dmabufs with no formats
We return an empty format list when dmabufs aren't supported, not NULL.

And the sink was treating the empty format list by setting no fourccs
on the caps, which GStreamer conveniently interpreted as "any",
not as "none".
2024-11-04 21:50:26 +01:00
Benjamin Otte
566c484317 cicpparams: Guard with BEGIN/END_DECLS
I want to include this header from DirectX C++ code.
2024-11-04 21:50:26 +01:00