Commit Graph

28 Commits

Author SHA1 Message Date
Maximiliano Sandoval
ee4a817121
gdk: docs: Document error quarks 2024-05-31 11:47:30 +02:00
Matthias Clasen
ed072b4b5d dmabuf texture: Survive multiple disposes
dispose can be called more than once, so be safe for that.
2024-04-11 12:45:24 -04:00
Matthias Clasen
91b98bc9e2 Add a private header
Just cosmetic reshuffling.
2024-04-07 11:12:13 -04:00
Matthias Clasen
9a2ba3053b Cosmetics 2024-02-07 14:41:28 +00:00
Bilal Elmoussaoui
2cd550cdbc gi: Add missing Since annotations 2024-01-03 08:49:39 +01:00
Benjamin Otte
568eed9477 dmabuf: Turn the downloader into an interface
This way, we can move the actual downloader code into GSK - by just
implementing the interface in the GskGLRenderer.
2023-12-20 10:59:25 +01:00
Benjamin Otte
26561ab2e7 dmabuf: Refactor downloader vfuncs
This is in preparation for future commits. It also makes the API
clearer.
2023-12-20 01:51:46 +01:00
Benjamin Otte
7206060450 dmabuf: Move thread marshalling into DmabufTexture
All downloaders are going to need this, it would make no sense if they
all need to duplicate that code.
2023-12-20 01:51:46 +01:00
Benjamin Otte
888b9ee352 dmabuf: Don't use a downloader for builtin downloads
When we use the builtin downloads via mmap(), it's a special case where
we don't need to initialize subsystems and query them for support. We
know what we can and can't do.

Also, we want to use these formats with the lowest priority but pick the
downloader first for supported formats, and queueing it in the
downloaders list doesn't reflect that. So don't do it.
2023-12-16 09:21:19 +01:00
Benjamin Otte
f0eceb4aa3 dmabuf: Remove out argument
The format is the same everywhere, so instead of letting every
implementation do the same thing, do it in a central place instead.
2023-12-16 09:20:36 +01:00
Benjamin Otte
abf942efe5 dmabuf: Don't leak the display 2023-12-09 19:32:39 +01:00
Benjamin Otte
d7bc4c719b dmabuf: Remove unused headers 2023-11-25 01:44:34 +01:00
Benjamin Otte
725857e15b dmabuf: Add a fallback list of fourccs
That way, we can work with older libdrm versions.

The list was generated via a bit of sed and grep from the current
dmabuf-fourcc.h, which is why I put it into its own file and included
all the formats, no matter how old they are.
2023-11-25 01:44:34 +01:00
Matthias Clasen
b24ae31716 dmabuf: Improve consistency of debug messages
Make sure all our dmabuf debug messages are display-scoped so the
inspector doesn't trigger them, use the same formatting throughout,
and improve consistency of wording here and there.
2023-11-12 13:02:58 +01: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
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
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
dd8c6e9f51 dmabuf: Add gdk_dmabuf_sanitize()
Tries to sanitize the dmabuf to conform to the values expected
by Vulkan/EGL which should also be the values expected by
Wayland compositors

We put these sanitized values into the GdkDmabufTexture, by
sanitizing the input from GdkDmabufTextureBuilder, which are
controlled by the callers.

Things we do here:

1. Disallow any dmabuf format that we do not know.

1. Treat the INVALID modifier the same as LINEAR.

2. Ignore all other modifiers.

3. Try and fix various inconsistencies between V4L and Mesa,
   like NV12.

*** WARNING ***

This function is not absolutely perfect, you do not have a
perfect dmabuf afterwards.

In particular, it doesn't check sizes.
2023-10-20 13:58:22 +02:00
Benjamin Otte
612b5416af dmabuf: Init the dmabuf subsystem before creating texture
We did not do that, so when the dmabuf building looked at the list of
downloaders, it was empty and the result was an error. That's not good.
2023-10-19 19:12:46 +02:00
Matthias Clasen
4417509515 dmabuf: Add a display getter
Add private api to get the display of
a dmabuf texture. We will need it in
the following commit.
2023-10-16 22:29:20 -04:00
Benjamin Otte
570e80a9ff dmabuf: Split out GdkDmabuf and GdkDmabufDownloader
GdkDmabuf is a struct encapsulating all the values of a dmabuf, so
nothing to see here.

GdkDmabufDownloader is a vtable for a thing that can download dmabufs.
For now only one implementation exists, so this just looks like a ton
of work for no benefit.

The only neat thing is that gdkdmabuftexture.c got a whole lot tidier.
2023-10-16 18:56:52 -04:00
Matthias Clasen
2f842b087c dmabuf: Cosmetics 2023-10-15 12:00:23 -04:00
Matthias Clasen
699f6a7993 Add a dmabuf debug flag
Add a new debug flag for dmabuf-related information,
and use it in gdkdmabuftexture.c.

This will let us separate out dmabuf debug spew from
opengl debug spew.
2023-10-15 11:05:32 -04:00
Benjamin Otte
1ca067a478 dmabuf: Add a GError to gdk_dmabuf_texture_builder_build() 2023-10-14 22:30:17 +02:00
Benjamin Otte
d101e17608 dmabuf: Use the new FormatsBuilder to initialize formats 2023-10-14 22:30:17 +02:00
Matthias Clasen
c93efe85dd Add GdkDmabufTexture
Add an implementation of GdkDmabufTexture.

For now, this implementation is rather minimal,
since we need a roundtrip through GL to convert
most nottrivial formats.
2023-10-11 15:43:01 -04:00