Benjamin Otte
cd7e1c1387
dmabuf: Modify gdk_gl_context_import_dmabuf()
...
Move a bunch of code - namely the target selection - into the function.
I want to use the same code in the NGL renderer, so no need to duplicate
it.
2023-11-07 05:12:57 +01:00
Benjamin Otte
61207f81c3
dmabuf: Set same YUV colorspace as elsewhere
...
We use ITU.601 full range everywhere, so ensure it's used here, too.
2023-11-07 05:12:57 +01:00
Matthias Clasen
1914adc344
dmabuf: Don't check for image storage
...
I was wrong about this extension, and it isn't even a GL extension
to begin with, so revert all this.
2023-10-29 14:45:20 -04:00
Matthias Clasen
6e236b9459
Revert "gl context: Check for more GL extensions"
...
This reverts commit b8b5835fc6
.
2023-10-29 14:44:46 -04:00
Matthias Clasen
11715760f9
Revert "glcontext: Better debug spew"
...
This reverts commit 30e14f73fa
.
2023-10-29 14:44:29 -04:00
Matthias Clasen
06dda4e12b
Merge branch 'memory-format-swizzle-check' into 'main'
...
gl: Check all swizzle values
See merge request GNOME/gtk!6524
2023-10-26 02:38:35 +00:00
Matthias Clasen
4a749aee6e
Fix swizzle values for some memory formats
...
For opaque formats with 3 channels, we should use the default
GL_ALPHA, but for opaque formats with an ignored 4th channel,
we must use GL_ONE.
2023-10-25 21:39:52 -04:00
Matthias Clasen
bb2b8bf2c3
dmabuf: Refine the handling of implicit modifiers
...
If all formats with a given fourcc are external, treat the
fourcc with implicit modifiers as external too, following a
sugestion by Benjamin Otte.
2023-10-24 22:33:45 -04:00
Matthias Clasen
eb048c91be
dmabuf: Allow implicit modifiers
...
Remove all the roadblocks we've put up to keep implicit modifiers
out. Our importing code already handles them as a signal that says
'No modifiers, please!'. Now we just hope for the best and pass
things along.
This is necessary since some drivers won't produce any explicit
modifiers.
2023-10-24 22:33:45 -04:00
Matthias Clasen
8f90ddb906
dmabuf: Cache egl formats
...
Only call eglQueryDmaBufModifiersEXT once, and reuse the results.
2023-10-24 21:53:09 -04:00
Matthias Clasen
a90ffb117f
docs: Some additions
...
Add a link to the kernel docs about dmabufs.
2023-10-24 10:50:46 -04:00
Matthias Clasen
29681717ed
Fix annotations
...
It is always org.gtk.Property, even if we are in gdk.
2023-10-24 07:16:42 -04:00
Benjamin Otte
51a181af7a
Merge branch 'wip/otte/for-main' into 'main'
...
dmabuf: Seek back to the start
See merge request GNOME/gtk!6526
2023-10-23 19:57:21 +00:00
Benjamin Otte
e2edf693f5
gdk: Make float32 report its true depth
...
I have no idea how this is the only value that is wrong.
2023-10-23 21:22:17 +02:00
Benjamin Otte
323300e92a
dmabuf: Seek back to the start
...
https://docs.kernel.org/driver-api/dma-buf.html recommends doing that,
so we do that.
2023-10-23 17:57:57 +02:00
Benjamin Otte
e688be1cff
gdk: Add some debug messages around dmabuf initialization
2023-10-23 17:57:57 +02:00
Matthias Clasen
625eb508e8
dmabuftexturebuilder: Fix doc formatting
2023-10-22 23:24:46 -04:00
Matthias Clasen
2718e1715d
display: Add details to the docs
2023-10-22 23:24:27 -04:00
Matthias Clasen
6ddcad6b33
dmabuf: Update a comment
2023-10-22 23:14:07 -04:00
Matthias Clasen
30e14f73fa
glcontext: Better debug spew
...
Print out all the extensions we checked.
2023-10-22 22:41:53 -04:00
Matthias Clasen
39e205aa78
dmabuf: Don't print unsupported formats
...
We were confusingly printing "supported format" for dmabuf formats
that we end up not adding to our list of supported formats. Don't
do that, it is confusing. At the same time, we shuold print out
the linear formats we support via mmap.
2023-10-22 22:29:44 -04:00
Matthias Clasen
79f98f3a13
Cosmetics
...
Typo fix.
2023-10-22 22:18:30 -04:00
Benjamin Otte
a579e3bc6d
build: Fix up header includes
...
These weren't fixed in the merge request in
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6489
to the change from
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6514
2023-10-23 03:12:09 +02:00
Benjamin Otte
8f70f4b85e
dmabuf: Add support for 3 plane YUV formats
2023-10-23 02:54:23 +02:00
Benjamin Otte
911198cddd
dmabuf: Add NV16, NV61, NV24 and NV42
...
and sanitize them and NV21.
2023-10-23 02:54:23 +02:00
Matthias Clasen
a4d0a5bda5
dmabuf: We don't support external formats on GL
...
Filter out external-only formats unless we are on GLES.
2023-10-22 17:54:18 -04:00
Matthias Clasen
494154beb6
dmabuf: Add an EGL downloader
...
Add an implementation of GdkDmabufDownloader that uses
gsk_renderer_render_texture + GL texture download.
Since gsk isn't threadsafe, we do the download in the main thread,
taking care to not disturb the current GL context of whatever is
going on there at the time.
And since gsk renderers are expensive to create, we cache it
in the display.
Note that gsk does not yet have any special support for
dmabuf textures, so for now, they will always get downloaded
and then reuploaded as GL textures.
2023-10-22 16:42:17 -04:00
Matthias Clasen
8fb0ab2b43
gl context: Add private dmabuf API
...
Add API to import a dmabuf into a texture,
and to export a texture to a dmabuf.
All this is implemented using the relevant
EGL and GL extensions.
2023-10-22 16:39:24 -04:00
Matthias Clasen
b8b5835fc6
gl context: Check for more GL extensions
...
These will be used in future commits.
2023-10-22 16:39:24 -04:00
Matthias Clasen
463307655c
display: Check for more EGL extensions
...
We are going to rely on this in future commits.
2023-10-22 16:39:24 -04:00
Benjamin Otte
e05764806a
build: Change where we get drm_fourcc.h from
...
The canonical source for userspace is libdrm, not kernel headers.
Fixes compilation on Arch Linux.
2023-10-22 20:40:20 +02:00
Benjamin Otte
32ba1e389c
build: Check for drm/drm_fourcc.h too
...
It's part of the kernel headers package so I did not check for libdrm.
As a side effect I checked the #define to HAVE_DMABUF.
2023-10-22 17:27:11 +02:00
Benjamin Otte
beb9e0c906
dmabuf: Add gdk_dmabuf_is_disjoint()
...
No users yet, but Vulkan will use this later. So have it available
already.
2023-10-22 17:03:15 +02:00
Benjamin Otte
98f02f6221
dmabuf: Reject the INVALID modifier
...
Trying to use it is a programming error, applications should have code
that uses real modifiers.
Also add a check to the formatsbuilder so our code doesn't include the
invalid modifier by accident.
We don't really know how to deal with it, so better force applications
to figure out what to do.
2023-10-22 17:03:15 +02:00
Benjamin Otte
13848969f4
dmabuf: Allow downloaders to fail initialization
...
When adding the formats of a downloader, allow them to return FALSE to
mean "This method is not supported", which is a useful way to opt out
when checking GL or Vulkan extensions and finding out that the desired
one isn't supported.
2023-10-22 17:03:13 +02:00
Matthias Clasen
9e3f537a15
dmabuf: Give downloaders a name
...
Add name to the downloader struct, and add it
to the debug spew for newly created dmabuf
textures.
2023-10-21 19:19:21 -04:00
Matthias Clasen
410240fe7b
Merge branch 'matthiasc/for-main' into 'main'
...
Cosmetics
See merge request GNOME/gtk!6509
2023-10-21 20:34:36 +00:00
Matthias Clasen
73cf3a92f9
cosmetics
2023-10-21 16:10:09 -04:00
Matthias Clasen
dd15122ccb
dmabuf: Add some debug spew
2023-10-21 14:44:28 -04:00
Benjamin Otte
cbfd8542c6
dmabuf: Require valid fds for all planes
...
This seems to be what everyone does, so we should do it, too.
Previously it was assumed that an fd of -1 would mean reusing the
previous fd with a different offset, but that seems to be uncommon.
2023-10-21 16:42:15 +02:00
Matthias Clasen
59ce7ab222
dmabuf: Improve the debug message
...
Printing the format can only help.
2023-10-20 20:03:27 -04:00
Matthias Clasen
0992837b08
dmabuf: Fix the mmap logic
...
We want to unmap the buffers we mapped in
the first loop, so pass the right pointers
here.
2023-10-20 20:03:11 -04:00
Matthias Clasen
aca02916ad
dmabuf: Fix NV12 import
...
We were not seeking in the right fd,
so our sizes were wrong, and crashes
happened.
2023-10-20 19:53:33 -04:00
Matthias Clasen
8843c0d504
dmabuf: Fix format mapping for RGB formats
...
The channel order was reversed.
2023-10-20 19:22:00 -04:00
Matthias Clasen
a1c5c20e2c
dmabuf: Add xrgb formats
2023-10-20 18:14:45 -04:00
Matthias Clasen
10250a0a6a
Add XRGB memory formats
...
These are not uncommon in dmabufs,
and supporting them is easy.
Fixes : #6172
2023-10-20 17:58:06 -04:00
Matthias Clasen
bd974b08b3
Add GDK_MEMORY_A8B8G8R8_PREMULTIPLIED
...
We did have 4 ordering variations of ARGB straight,
but only 3 premultiplied. Add the missing one.
Update all the places where we switch over memory formats.
2023-10-20 16:42:40 -04:00
Benjamin Otte
008d9e5327
vulkan: Actually check for GDK_DEBUG=vulkan-disable
...
The dmabuf code would happily init Vulkan even if it was told we don't
want it.
2023-10-20 14:26:59 +02:00
Benjamin Otte
09723d79c6
dmabuf: Support YUYV and friends
...
Same as the NV12 support, but necessary for the poor people stuck on
Intel laptops.
2023-10-20 14:26:59 +02:00
Benjamin Otte
4586af5876
dmabuf: Add support for NV12 and NV21
...
This is as-good-as-necessary and doesn't do any fancy colorspace magic
or chroma whatevering.
That's a task for the future.
2023-10-20 14:26:59 +02:00