Commit Graph

81099 Commits

Author SHA1 Message Date
Benjamin Otte
d32fd76b31 docs: Fix typo 2024-07-14 21:54:40 +02:00
Benjamin Otte
5f8e83d75d gpu: Fix memleak in texture-scale code 2024-07-14 21:54:40 +02:00
Benjamin Otte
b08a17064e vulkan: Remove draw semaphore
That's unused (or wrongly used) leftover code from 2017.

The validation layers also don't like it.
2024-07-14 21:54:40 +02:00
Benjamin Otte
3f39cb38c4 Merge branch 'wayland-color-states' into 'main'
Wayland color management

See merge request GNOME/gtk!7444
2024-07-14 19:46:56 +00:00
Matthias Clasen
2031ec1b57 inspector: Show the color management protocol 2024-07-14 14:58:00 -04:00
Matthias Clasen
533aaba5eb wayland: Support xx-color-management-v2
This is a still experimental protocol (thus the xx prefix).

We are using it go obtain information about the compositors
preferred color state, and pass that on to our rendering machinery.

The currently supported color states are srgb, srgb-linear, rec2100-pq
and rec2100-linear. We don't have any support for ICC profiles.

Unlike other protocols, keep the support code for this protocol
fairly isolated behind wrapper objects, since the protocol is
still subject to change.
2024-07-14 14:58:00 -04:00
Matthias Clasen
72c782af17 Merge branch 'matthiasc/for-main' into 'main'
colorstate: Add autoptr definitions

See merge request GNOME/gtk!7457
2024-07-14 18:12:34 +00:00
Matthias Clasen
af8a3eff10 Merge branch 'surface-color-state' into 'main'
surface: Add a color state

See merge request GNOME/gtk!7456
2024-07-14 17:21:51 +00:00
Matthias Clasen
ee7ba54a7f colorstate: Add autoptr definitions
A little convenience never hurts.
2024-07-14 12:52:56 -04:00
Matthias Clasen
53d99f5521 Use the surface colorstate in begin_frame
begin_frame is the place where we make decisions about the format,
depth and colorstate for our rendering. Make these calls take the
surface color state into account.

In particular, if the surface colorstate is suitable for GL_SRGB,
and we don't need high depth, set things up for that.
2024-07-14 12:51:05 -04:00
Matthias Clasen
52d2975af3 surface: Add a color state
This will be set by the backend, and it will be used to set up
the draw context properly. For now, this is always SRGB.
2024-07-14 12:46:20 -04:00
Matthias Clasen
926a651f12 Merge branch 'more-color-states' into 'main'
More color states

See merge request GNOME/gtk!7445
2024-07-13 19:37:54 +00:00
Matthias Clasen
7aeab7a63f Add a debug flag for hdr rendering
Set GDK_DEBUG=hdr to force the use of rec2100 as compositing
colorstate.
2024-07-13 15:11:07 -04:00
Matthias Clasen
a2389b3169 Cosmetics
Shift debug flags around so we can put hdr next to linear.
2024-07-13 15:11:07 -04:00
Matthias Clasen
54e5cc296f colorstate: Add rec2100-pq and rec2100-linear
These are wide-gamut, HDR colorstates that we will need for HDR support.
2024-07-13 15:11:07 -04:00
Matthias Clasen
457fd68168 gpu: Make color conversion extensible
Change the glsl convert_color function to proceed in stages:
- first unpremultiply
- then linearize
- then transform linearly
- then delinearize
- then premultiply
All the steps are only taken if needed.
2024-07-13 15:09:12 -04:00
Matthias Clasen
2d69f35e0e colorstate: More details in the docs
Add links to srgb definitions and references.
2024-07-13 15:09:12 -04:00
Benjamin Otte
648c780e91 gpu: Respect colorstate for offscreens
We want to render in at least the minimum required depth of the used
colorstate.
2024-07-13 14:51:49 -04:00
Benjamin Otte
f36618f02a Merge branch 'fix-columnviewcolumn-visibility' into 'main'
columnview: check column visibility when measuring

See merge request GNOME/gtk!7452
2024-07-13 17:47:49 +00:00
Christian Hergert
8548a1dd7f columnview: check column visibility when measuring
We only want to measure visible columns so that they may consume the
maximum width available to the widget. This fixes a situation where hidden
columns would cause less-than the whole width to be allocated. Additionally
that fixes warnings where some widgets expect more horizontal space than
they would ultimately be allocated.
2024-07-13 10:12:41 -07:00
Matthias Clasen
5e1d58c41c Merge branch 'matthiasc/for-main' into 'main'
vulkan: Remove GDK_DEBUG=vulkan-validate

See merge request GNOME/gtk!7451
2024-07-13 13:19:54 +00:00
Benjamin Otte
a61d7f3864 vulkan: Remove GDK_DEBUG=vulkan-validate
The modern incantation to get validation layers enabled is via

VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation

Vulkan has a bunch of environment variables to toggle stuff, let's use
those instead of doing our own.
2024-07-13 08:52:28 -04:00
Benjamin Otte
c7fcaaf443 Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix color convert path to not crash

See merge request GNOME/gtk!7450
2024-07-13 10:41:38 +00:00
Benjamin Otte
6d263f8680 gpu: Add GSK_GPU_BLEND_NONE
Allows writing without blending. This is useful when copying/converting
textures.

In particular, we use it for colorspace conversions.
2024-07-13 10:56:47 +02:00
Benjamin Otte
d9ab6495ef gpu: Fix color convert path to not crash
The occlusion culling reorganization messed up this branch.

Make it work again.
2024-07-13 10:56:47 +02:00
Ekaterine Papava
ceac0ce9aa Update Georgian translation 2024-07-13 05:34:08 +00:00
Benjamin Otte
e975d6db17 Merge branch 'wip/otte/for-main' into 'main'
gpu: Remove unused macro

See merge request GNOME/gtk!7449
2024-07-13 01:25:35 +00:00
Benjamin Otte
d54b68b93c gpu: Convert values to float[4] from GdkRGBA
We need to make sure our clear values are in the right colorstate, not
in sRGB.

The occluision culling managed to sneak through the big transition for
that.
2024-07-13 02:07:15 +02:00
Benjamin Otte
761346ed5a gpu: Remove unused macro
This is a leftover from the pre-color-managed times
2024-07-13 02:07:15 +02:00
Matthias Clasen
6d71dd0025 Merge branch 'matthiasc/for-main' into 'main'
colorstate: Consistent naming

See merge request GNOME/gtk!7448
2024-07-12 23:58:28 +00:00
Matthias Clasen
d0e2d9e2f4 colorstate: Small reorg
Introduce a helper macro.
2024-07-12 18:15:28 -04:00
Matthias Clasen
b0effee9b3 colorstate: Add tests for conversions
Test roundtrip tests between color states.

For now, this just tests srgb<>srgb-linear.
2024-07-12 18:14:54 -04:00
Matthias Clasen
abb7e85260 colorstate: Consistent naming
Make the conversion functions use srgb_linear in their names, since
the name of the color state is srgb-linear.
2024-07-12 18:14:44 -04:00
Matthias Clasen
3ccd03e226 Updates 2024-07-12 16:55:49 -04:00
Benjamin Otte
2ae345aa8f Merge branch 'wip/otte/big-bigger-oom' into 'main'
Implement tiling for large textures

Closes #6324

See merge request GNOME/gtk!7447
2024-07-12 17:47:53 +00:00
Benjamin Otte
1c1b78aa1c gpu: Implement tiling for texture-scale nodes
This is actually the node Loupe is using, so having tiling work with it
is important.

Because of the previous commit, different filters are supported fine.

Fixes: #6324
2024-07-12 18:09:46 +02:00
Benjamin Otte
cdb2308ddd gpu: Add filter support to tiled images
This allows mipmapping if downscaled a lot, like we do for non-tiled
images.

A side effect is that due to the simpler caching for tiles, we can only
cache the mipmapped images in one colorstate. But we need to pick a
potentially non-default one, because we want to mipmap in a linear
colorstate.

So this is somewhat suboptimal. Patches with improvements accepted.
2024-07-12 17:31:36 +02:00
Benjamin Otte
c581f722bd gpu: Split out a function
We'll need mapping scaling filters to samplers elsewhere soon.
2024-07-12 17:31:36 +02:00
Benjamin Otte
340c98c6cd gpu: Split a function
Split drawing the tiles from setting up the offscreen for drawing the
tiles.
2024-07-12 17:31:36 +02:00
Benjamin Otte
39f5c5bf49 gpu: Implement tiling for texture nodes
Use the new cache feature to split oversized textures into tiles the
size given by the new device API.

Then number those tiles from left to right and top to bottom and use
that number as the tile id.
2024-07-12 17:31:36 +02:00
Benjamin Otte
392f6855ca gpu: Add gsk_gpu_device_get_tile_size()
This allows managing tiling of images. And I'd like this value to live
somewhere prominent instead of as a hardcoded number in the
nodeprocessor.
2024-07-12 17:31:36 +02:00
Benjamin Otte
1cae48ab93 gpu: Add a tile cache
Nobody is using it yet, but it's the API.

It's very simple and just allows adding tiles by an index. What that
index means is up to the caller.
2024-07-12 17:31:36 +02:00
Benjamin Otte
25f04f3c37 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Add DRM_FORMAT_INVALID to our formats

See merge request GNOME/gtk!7446
2024-07-12 15:29:40 +00:00
Benjamin Otte
d0f8ef09a0 gpu: Do a GC run after every tile of large images
When we draw large images, we absolutely do not want to keep memory that
we do not need. So do a GC run after every tile. That otentially slows
down things, but it also improves the chances of not running out of
memory.

Here's the node for the image I managed to create after I applied this
patch:

repeat {
  bounds: 0 0 50000 50000;
  child: text {
    font: "Noto Color Emoji 10000px";
    glyphs: 661 0 0 0 color;
    offset: 0 10000;
    hint-style: none;
  }
}
2024-07-12 16:57:23 +02:00
Benjamin Otte
0516dca116 vulkan: Don't try to use nonexisting formats
Handle the error that new rgba format exists.
2024-07-12 16:56:23 +02:00
Benjamin Otte
ebc6a043c9 gpu: Cleanups 2024-07-12 16:56:23 +02:00
Benjamin Otte
8e2ae79875 gpu: Change function to (transfer full)
Functions should behave as I expect, and I just spent an hour debugging
a refcount issue because I assumed our image creation functions return
refrences. Which is a very sane assumption.
2024-07-12 16:55:59 +02:00
Benjamin Otte
27ac764653 gpu: Don't multiply by 1/x, divide by x
This is less error-prone with floating point math, even though it is
somewhat slower.
2024-07-12 16:55:59 +02:00
Matthias Clasen
80df6e2b8d Merge branch 'matthiasc/for-main' into 'main'
wayland: Fix handling of the font-rendering setting

Closes #6855

See merge request GNOME/gtk!7443
2024-07-12 00:55:02 +00:00
Matthias Clasen
bfda8cf820 stylecontext: fix gtk_style_context_lookup_color
We need to ensure the value is computed.

Fixes: #6855
2024-07-11 19:58:55 -04:00