Commit Graph

11462 Commits

Author SHA1 Message Date
Matthias Clasen
726d5b25e8 Merge branch 'bilelmoussaoui/add-missing-annotations' into 'main'
gi: Add missing Since annotations

See merge request GNOME/gtk!6701
2024-01-03 13:35:44 +00:00
Bilal Elmoussaoui
2cd550cdbc gi: Add missing Since annotations 2024-01-03 08:49:39 +01:00
Benjamin Otte
3e4d0b69d4 gdkpng: Make the png loader safer against overflows
Load images that result in a texture >4GB in size.

And now let me keep playing with my 60k x 60k image, thanks.
I'm trying to OOM my GPU.
2024-01-03 04:11:35 +01:00
Luca Bacci
e4e0c27f58 Merge branch 'fix-wgl-leak' into 'main'
GdkWin32: Do not create multiple WGL contexts for the dummy window

Closes #6285

See merge request GNOME/gtk!6688
2023-12-27 15:43:54 +00:00
Luca Bacci
4e5456c8c3 GdkWin32: Do not create multiple WGL contexts for the dummy window
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6285
2023-12-27 16:26:06 +01:00
Maximiliano Sandoval R.
e857f0a3af Add Since annotations to enums
Doing this in a way that is picked up by gobject-introspection
requires splitting off new enum members into separate doc
comments, which is a bit unfortunate.
2023-12-22 08:47:47 -05:00
Benjamin Otte
c21ca4811e vulkan: Require Vulkan 1.3
Some dmabuf formats were added in Vulkan 1.3.

Note that this does not require the Vulkan drivers to be version 1.3 -
it just means compilation against libvulkan 1.3
2023-12-21 17:21:54 +01:00
Benjamin Otte
96152303a6 dmabuf: Let the EGL code initialize GL
The EGL downloader initialization already calls prepare_gl(), so no need
to call it in init_dmabuf_formats(), too.
2023-12-21 17:21:52 +01:00
Benjamin Otte
d2a85abf79 Merge branch 'wip/otte/dmabuf-refactoring' into 'main'
dmabuf refactoring

See merge request GNOME/gtk!6678
2023-12-20 10:25:29 +00:00
Benjamin Otte
74620ffc46 dmabufdownloader: Add a close() function
We need to unrealize renderers before unreffing them. This vfunc takes
care of that.
2023-12-20 10:59:25 +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
26060b1be2 dmabuf: move DmabufTexture typedef
Preparation work.
2023-12-20 01:51:46 +01:00
Benjamin Otte
210c71b856 egl: Split out a function
This makes no sense by itself, but we want to create the EGLImage at
DmabufTexture construction so that we can actually reject dmabufs that
we can't create EGLImages for.

This will make it possible to bail when the stride limitation for AMD
GPUs hits.
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
Matthias Clasen
31cd2b19cd Merge branch 'macos-pre-10.13' into 'main'
gdk/macos: fix builds on macOS before 10.13

Closes #5738

See merge request GNOME/gtk!5813
2023-12-19 01:20:18 +00:00
Benjamin Otte
738b48c660 dmabufegl: Remove unsued argument from function 2023-12-18 23:34:47 +01:00
Benjamin Otte
66b992c3c0 dmabuf: Change the way downloaders work
Instead of having an add_formats() function, make the get_downloader()
function add the formats.

This allows putting the actual downloader in a different place from the
initialization code.
2023-12-16 21:36:21 +01:00
Benjamin Otte
b19f71dd24 dmabuf: Add Vulkan formats to the large table
This is done without testing, just doing my best to map all the DRM
formats to VkFormats.

Once people start using them, they'll figure it out when it's wrong.
(Somebody needs to write a testsuite.)
2023-12-16 19:16:50 +01:00
Benjamin Otte
cccec91b66 memoryformat: Put dmabuf fourccs into the big format table
I'm concentrating the data about memory formats, and this part was
missing.
2023-12-16 17:01:42 +01:00
Benjamin Otte
00566261b2 dmabuf: Explode the DmabufFormatInfo array
it's growing more and mroe, and it gets too wide and unreadable
otherwise.
2023-12-16 09:21:20 +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
ff082a7758 memoryformat: Add Vulkan format information
This is not used yet, but I want to add it, so that it exists.

That way, when we add new formats, people don't forget to add the Vulkan
formats.
2023-12-16 09:20:36 +01:00
Benjamin Otte
f357623170 memoryformat: Fix broken swizzle values
I can't copy/paste.
2023-12-16 09:20:29 +01:00
Matthias Clasen
c48a3152f0 memoryformat: Expand docs
This captures some irc exchanges about the intended use of
the new memory format apis.
2023-12-13 12:44:20 -05:00
Benjamin Otte
81adf6be22 dmabuf: Add gdk_dmabuf_fourcc_is_yuv()
In the future, we want to be using GdkColorState instead, but for now,
let's use this.

Also remove a duplicate entry in the list of formats.
2023-12-13 05:54:06 +01:00
Benjamin Otte
6ad9db0bf0 Merge branch 'texture-diff-against-distant-ancestors' into 'main'
texture: Enable texture diff against arbitrarily distant ancestors

See merge request GNOME/gtk!6644
2023-12-12 01:46:05 +00:00
Benjamin Otte
486157f6bf Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add a test for opacity + color-matrix nodes

See merge request GNOME/gtk!6659
2023-12-12 01:05:00 +00:00
Benjamin Otte
5ca4ab3aaa dmabuf: Add gdk_dmabuf_import/export_sync_fd()
Vulkan needs this.

This code is following the code that compositors with Wayland support -
like wlroots - are doing.

The code was introduced to Linux in
https://lore.kernel.org/dri-devel/20220506180216.2095060-1-jason@jlekstrand.net/
2023-12-12 01:49:41 +01:00
Benjamin Otte
a37b3fb691 dmabuf: Add gdk_dmabuf_ioctl()
The function is a copy of libdrm's drmIoctl() and handles EINTR and
EAGAIN error.s

Use it for the sync ioctls in the dmabuf mmaping calls.
2023-12-12 01:49:41 +01:00
Benjamin Otte
4dfc07ef57 memoryformat: Fix variable types
Use the same types that GL uses.
2023-12-12 01:49:41 +01:00
Benjamin Otte
e3c85be53f memoryformat: Add gdk_memory_format_get_fallbacks()
Track fallback formats to use in the memoryformat directly instead of
using in the GL uploading code.

First of all, this allows sharing the code and ensuring all our
renderers use the same fallback mechanism.

But also, this allows tracking fallbacks per-format which is useful
because the fallback formats aren't really a tree. We want to make
FLOAT16 fall back to FLOAT32 when not available, but we also want
FLOAT32 fall back to FLOAT16.
By tracking the fallbacks per-format, we can achieve that.
2023-12-12 01:49:40 +01:00
Benjamin Otte
0f5fda2277 memoryformat: Introduce new (private) API
Add gdk_memory_format_get_premultiplied() and
gdk_memory_format_get_straight() which return the matching
premultiplied/straight format.

Use this to pick the premultiplied format when uploading GL textures.

And remove the duplication in the dmabuf code, where we can now use
these functions instead of tracking both the premultiplied and straight
alpha versions.
2023-12-12 01:49:40 +01:00
Benjamin Otte
0889037959 gltexture: Use the right format to download
When the format is set correctly, which it should be, we should just use
it.

So do that.
2023-12-12 01:49:40 +01:00
Benjamin Otte
ee56ad792c memoryformat: Fix 2 broken formats
They are straight alpha, and the GL renderer isn't using them yet, so
existing code is not affected.
2023-12-12 01:49:40 +01:00
Benjamin Otte
5688b7b4bb gl: Add a new alternative format
Add an "RGBA" format that just maps to the swizzled version of the
default format.

This way, BGR gets mapped to RGB + swizzling first before trying to map
it to the default format for the depth.

The benefit here is that this format has the same memory width, so
uploading/downloading code can treat it equivalent to the original
format and there's no conversion neccessary later.
2023-12-12 01:49:40 +01:00
Benjamin Otte
84de90756d memoryformat: Make the big array more readable
Prefix the struct members with their name, similar to how our Vulkan
code looks.
2023-12-11 22:11:28 +01:00
Benjamin Otte
3a1349e8ef gl: Make gdk_memory_format_gl_format() no longer check support
Now that we have gdk_gl_context_get_memory_flags() and code can use that
function, make the code do that.

Remove support checks from gdk_memory_format_gl_format().

This is an initial naive port that doesn't try to make use of the finer-grained
flags yet.
2023-12-11 07:33:26 +01:00
Benjamin Otte
5485d806c5 glcontext: Add gdk_gl_context_get_memory_flags()
Checks which features of a given memory format are supported by
the current GL implementation.

We check:
 * usable: Can be used as a texture with NEAREST filter
 * renderable: Can be used as a render target
 * filterable: Can be used with GL_LINEAR

In normal GL, all formats are all of these things, but GLES is a lot
more picky.

So far nobody uses this.
2023-12-11 07:33:26 +01:00
Benjamin Otte
8fd02f6fa2 subsurface: Do not punch holes for subsurfaces that are above
If a subsurface is not below, it is visible no matter what the opaque
region is.

Also, we don't need to care about transparency in the subsurface if we
ignore it anyway. So this is a win-win.
2023-12-11 07:32:06 +01:00
Benjamin Otte
9bc0ad9a13 gdk: Handle subsurface opaque region with transparency
We accept transparent subsurfaces for passthrough now, when they are
above the surface.
But we did not unset the opaque region to empty when the texture is
transprent.
2023-12-11 07:32:06 +01:00
Benjamin Otte
abf942efe5 dmabuf: Don't leak the display 2023-12-09 19:32:39 +01:00
g.willems
dfe7afdb04 gdk/win32: support default-settings debug flag 2023-12-09 17:59:24 +01:00
Ben Mather
1629b072fe texture: Enable texture diff against arbitrarily distant ancestors 2023-12-08 11:29:56 +00:00
Matthias Clasen
7cc5d5c7a5 Revert "Merge branch 'rgba-new-from-string' into 'main'"
This reverts commit 77f40d7508, reversing
changes made to b969f4649d.

It turns out we did not have agreement on this after all.
2023-12-02 10:55:35 +05:45
Arjan Molenaar
6948a74d72 Fix function signature warning
No arguments -> void
2023-11-28 21:24:10 +01:00
Matthias Clasen
77f40d7508 Merge branch 'rgba-new-from-string' into 'main'
Add convenience function gdk_rgba_new_from_string()

See merge request GNOME/gtk!6599
2023-11-28 17:56:21 +00:00
FeRD (Frank Dana)
f4f25e584c Fix docs function reference 2023-11-27 21:16:44 -05:00
FeRD (Frank Dana)
b049a3501a Additional review fixes 2023-11-27 19:44:24 -05:00