Commit Graph

81059 Commits

Author SHA1 Message Date
Benjamin Otte
23081d2bc4 gpu: Use GskGpuShaderImage for texture ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
b1e441d18a gpu: Introduce GskGpuShaderImage
It's a struct collecting all relevant info for a texture passed to a
shader.

The ultimate goal is to get rid of the descriptors and let ops
manage them on thir own.
2024-07-22 18:37:07 +02:00
Benjamin Otte
a118cbb3ff Merge branch 'wip/otte/for-main' into 'main'
gpu: Move code around

See merge request GNOME/gtk!7477
2024-07-22 16:30:45 +00:00
Benjamin Otte
4639b3bc4c gpu: Make cache keep track of time
If GskGpuCache has an idea of what time it is, cached items can use that
time to update their last-use time instead of having to carry it around
throught function calls everywhere.
2024-07-22 17:10:37 +02:00
Benjamin Otte
821eb92dfb gpu: Handle corner-case
Port an optimization of the GL renderer where it fast-paths crossfades
with progress <= 0 and >=1 - which should really never happen because
nobody should emit them in the first place, but oh well.
2024-07-22 17:10:37 +02:00
Benjamin Otte
0370043775 gpu: Add missing string
This made debug output kinda not so good.
2024-07-22 17:10:37 +02:00
Benjamin Otte
82bcc05ca1 gpu: Move code around
Move the atlas code to the top of the file, so that other code can use
it.

No functional changes.
2024-07-22 17:10:37 +02:00
Benjamin Otte
527852e1b8 Merge branch 'wip/otte/colorstates-are-as-fun-as-dmabufs' into 'main'
dmabuf: Make NULL the default colorstate in the builder

See merge request GNOME/gtk!7474
2024-07-22 13:09:56 +00:00
Benjamin Otte
2e1686091f dmabuf: Make NULL the default colorstate in the builder
YUV dmabufs are not sRGB.

So instead of making the dmabuf builder have sRGB as the default
colorstate, add a NULL default option that makes the builder choose
the colorstate based on fourcc when build() is called.

If that happens, we pick sRGB usually, but for YUV we pick narrow range
BT601, like we did in versions before colorstates.
2024-07-22 14:54:05 +02:00
Artur S0
5353e28dca Update Russian translation 2024-07-22 12:23:52 +00:00
Benjamin Otte
b58e89f380 Merge branch 'wip/otte/for-main' into 'main'
vulkan: dmabufs require ycbcr

See merge request GNOME/gtk!7476
2024-07-22 00:50:07 +00:00
Benjamin Otte
c1e008fa86 gpu: Improve cache stats printing
We no longer hardcode the few different classes we have, but generically
walk over all classes.

As a side effect we now get new classes added to stats automatically.

The content itself did not change.
2024-07-22 02:03:00 +02:00
Benjamin Otte
c47a3c54fd vulkan: Make images track the device
Now that the cache is a separate object, there are no longer cyclic
uncollectable references, so images can use the device like everyone
else.
2024-07-22 01:28:40 +02:00
Benjamin Otte
3bc1e0534f gpu: Clean up headers
After the device/cache split, this was forgotten.
2024-07-22 01:28:40 +02:00
Benjamin Otte
7fb11dfeb0 gpu: Print filename in exceptions
I want to know which shader I screwed up.
2024-07-22 01:28:40 +02:00
Benjamin Otte
6d09eed90e gpu: Remove unused argument
It's always passing NULL.
2024-07-22 01:28:40 +02:00
Benjamin Otte
496211727d vulkan: dmabufs require ycbcr
So make sure that GDK_VULKAN_DISABLE=ycbcr also disables dmabufs.
2024-07-22 01:28:39 +02:00
Benjamin Otte
ee5e3b5927 Merge branch 'fix-urilauncher-uaf' into 'main'
urilauncher: Fix use-after-free on GCC < 12

See merge request GNOME/gtk!7471
2024-07-21 12:57:36 +00:00
Benjamin Otte
2087595747 Merge branch 'wip/otte/for-main' into 'main'
ngl: Fix crash at startup

See merge request GNOME/gtk!7472
2024-07-19 20:17:14 +00:00
Benjamin Otte
25268c2086 gstsink: Don't use g_autoptr 2024-07-19 21:37:48 +02:00
Benjamin Otte
2a9056b49e ngl: Fix crash at startup
Commit 1580490670 included a reordering of
acquiring the frame before making the context current.

Sometimes (like at startup) new frames need to be created.

Setting up a new frame assumed the GL context was current.

Change it so that we delay the one GL setup we do in frames until later.
2024-07-19 21:37:48 +02:00
Sergey Bugaev
46363b617e urilauncher: Fix use-after-free on GCC < 12
Building GTK with GCC 8 results in the following warning:

  gtk/gtkurilauncher.c: In function ‘gtk_uri_launcher_launch’:
  gtk/gtkurilauncher.c:315:3: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     else
     ^~~~
  gtk/gtkurilauncher.c:317:1: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   ^~~

In the compiled code, gtk_show_uri_full () is invoked whether the portal
branch is taken or not, leading to use-after-free of the task.

It looks like GCC in versions older than 12 treats the _Pragma(s) that
G_GNUC_BEGIN_IGNORE_DEPRECATIONS expands to as C-level statements, and
therefore the pragma takes up the 'else' statement slot.

See https://godbolt.org/z/e5zqbaqxo for a simple reproducer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-07-19 20:36:45 +03:00
Yaron Shahrabani
adb3baa7d2 Update Hebrew translation 2024-07-19 12:58:41 +00:00
Carlos Garnacho
31a79fbd9f Merge branch 'main' into 'main'
Ignore grabbing tablet devices without pads or tools

See merge request GNOME/gtk!7470
2024-07-18 12:10:36 +00:00
Jie Liu
d8919311b1 Ignore grabbing tablet devices without pads or tools
Signed-off-by: Jie Liu <liujie01@kylinos.cn>
2024-07-18 18:19:26 +08:00
Benjamin Otte
0e0158a825 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Do a naive implementation of P010, P012 and P016

See merge request GNOME/gtk!7469
2024-07-18 03:13:32 +00:00
Benjamin Otte
619926ec83 dmabuf: fix mmap() calls
* We cannot map with offset, because offsets need to be page-size
  aligned. And our code doesn't expect an offset anyway.
* The error return value from mmap() is MAP_FAILED aka -1, not NULL aka
  0.
2024-07-18 04:33:14 +02:00
Benjamin Otte
1afb832ff0 dmabuf: Do a naive implementation of P010, P012 and P016
These are the common HDR formats, so we better have the baseline of
those.
2024-07-18 04:33:14 +02:00
Benjamin Otte
823b529f89 gstsink: Remove unused member variable 2024-07-18 04:33:14 +02:00
Benjamin Otte
4707784755 gstsink: Use GdkMemoryTextureBuilder 2024-07-18 04:33:14 +02:00
Benjamin Otte
1ebcd27605 Merge branch 'wip/otte/for-main' into 'main'
Various Vulkan fixes

See merge request GNOME/gtk!7468
2024-07-17 21:19:02 +00:00
Benjamin Otte
300639e537 vulkan: Use right check for waiting on external image semaphore
Commit 3aa6c27c26 changed the initial layout of imported dmabuf images,
but did not adapt this check.
2024-07-17 22:59:23 +02:00
Benjamin Otte
ad218f0786 gpu: Pass the pass to frame_submit()
We will need that in the next commit.
2024-07-17 22:59:23 +02:00
Benjamin Otte
4966f8cdf8 vulkan: Add an acquire semaphore to frames
Vulkan requires us waiting on the image acquired from
vkAcquireNextImageKHR() before we start rendering to it, as that
function is allowed to return images that are still in use by the
compositor.
Because of that requirement, vkAcquireNextImageKHR() requires a
semaphore or fence to be passed that it can signal once it's done.

We now use a side channel to begin_frame() - calling
set_draw_semaphore() - to pass that semaphore so that the
vkAcquireNextImageKHR() call inside begin_frame() can use it, and then
we can wait on it later when we submit.

And yes, this is insanely convoluted, the Vulkan developers should
totally have thought about GTK's internal designs before coming up
with that idea.
2024-07-17 22:59:23 +02:00
Benjamin Otte
1580490670 gpu: add gsk_gpu_frame_begin/end()
These are just factoring out gdk_draw_context_begin/end_frame() so I can
add one tiny thing there later.

And I did both even though I only need one, because it felt wrong to
just do one.
2024-07-17 22:59:23 +02:00
Benjamin Otte
3cf5e8cf4e gpu: Move gc calls further to the edges of the function
Make the function look like that:

1. handle special case
2. maybe GC
3. draw
4. queue next gc
5. cleanup

This seems like the sanest approach to avoid gc() collecting things
necessary for drawing in the future.

And I need to refactor stuff, so having it out of the way is a good
idea.
2024-07-17 22:59:23 +02:00
Benjamin Otte
d21ac80178 gpu: Simplify a function
Now that we only ever use 2 images max per shader due to the removal of
the ubershader, we can just hardcode it in the function.
2024-07-17 22:59:23 +02:00
Martin
effbaa7770 Update Slovenian translation 2024-07-17 07:07:05 +00:00
Quentin PAGÈS
a9a61abc81 Update Occitan translation 2024-07-17 07:02:10 +00:00
Ekaterine Papava
e5b05424c8 Update Georgian translation 2024-07-16 21:45:51 +00:00
Matthias Clasen
8f920101f3 Merge branch 'wip/otte/texture-colorstate-api' into 'main'
Add support for color states to texture constructors/downloader

See merge request GNOME/gtk!7461
2024-07-16 21:09:48 +00:00
Matthias Clasen
1c59474f45 Merge branch 'inspector-crash' into 'main'
inspector: Fix a crash

See merge request GNOME/gtk!7467
2024-07-16 20:58:37 +00:00
Benjamin Otte
9be7104b71 testsuite: Add a save=>load cycle test for PNGs with colorstates 2024-07-16 22:04:11 +02:00
Benjamin Otte
31e0ec71f2 png: Add color state support
When loading or saving png files, encode the CICP flags of the color
state into the PNG.

When loading, decode the CICP flags if available and detect the
colorstate they use.
If we do not support the cicp tags, we do not load the image.

So far, we ignore the ICC profiles.

Includes regeneration of nodeparse test *reference* output to include
the new tags we write to PNGs.
The original tests do not include those tags, so we implicitly test that
we read untagged files correctly.
2024-07-16 22:04:10 +02:00
Benjamin Otte
6c33afc13c png: Move texture data download further down
We only download the data when we actually need it for writing into the
PNG stream.

This allows modifying the download parameters (in particular color state
in the next commit) while writing out their settings, so the code for
selecting the right colorstate liives in only one place.

We have to be careful though, because the download now happens after the
setjmp(), so we need to make sure the error path handles both cases
without leaking: Where the download has happened and where it hasn't.
2024-07-16 22:03:48 +02:00
Benjamin Otte
03daf42fb5 png: Port to MemoryTextureBuilder 2024-07-16 22:03:46 +02:00
Matthias Clasen
b33b68ef75 dmabuf texture: color state support 2024-07-16 21:23:44 +02:00
Matthias Clasen
0ee8ca43d1 gl texture: color state support 2024-07-16 21:23:44 +02:00
Benjamin Otte
77da45a173 testsuite: Update colorstate test 2024-07-16 21:23:44 +02:00
Benjamin Otte
5e1c3c5d69 gdk: Add GdkMemoryTexture::color-state
This allows setting the color state of textures.
2024-07-16 21:23:44 +02:00