Commit Graph

79215 Commits

Author SHA1 Message Date
Benjamin Otte
30afac9a6b offload: No need to pass the offload to the diff
We can just check if the subsurfaces contain content - and if they do,
they will be offloading and we can ignore the diff.

This essentially reverts 48740de71a
2024-02-11 20:24:28 -05:00
Benjamin Otte
dac56dd757 offload: Change the way we compute damage regions
Instead of relying on diffing subsurface nodes, we track damage
generated by offloaded contents inside GskOffload.

There are 3 stages a subsurface node can be in:

1. not offloaded
   Drawing is done by the renderer
2. offloaded above
   The renderer draws nothing
3. offloaded below
   The renderer needs to punch a hole.

Whenever the stage changes, we need to repaint.
And that can happen without the subsurface's contents changing, like
when a widget is put above the subsurface and it needs to to go from
offloaded above to below.

So we now recruit GskOffload for tracking these changes, instead of
relying on the subsurface diffing.

But we still need the subsurface diffing code to work for the
non-offloaded case, because then the offloading code is not used.
So we keep using it whenever that happens.

Not that when a subsurface transitions between being offloaded and not
being offloaded, we may diff it twice - once in the offload code and
once in the node diffing - but that shouldn't matter.
2024-02-11 20:24:28 -05:00
Benjamin Otte
e4ca3a285e gsk: Split out a function
I want to use it elsewhere.

I didn't come up with a better name, if anyone knows one, please
rename.
2024-02-11 20:24:28 -05:00
Benjamin Otte
30b5a33444 rendernode: Fix subsurface diff code 2024-02-11 20:24:28 -05:00
Benjamin Otte
e647ebae87 rendernode: Do full diff when starting/stopping offload
When a subsurface goes from not offloaded to offloaded (or vice versa),
we need to add the whole node to the diff region, because we switch from
whatever contents were drawn to a punched hole.
2024-02-11 20:24:28 -05:00
Matthias Clasen
a9949a102b Merge branch 'matthiasc/for-main' into 'main'
gsk: Make matrix transforms roundtrip better

See merge request GNOME/gtk!6886
2024-02-12 01:18:34 +00:00
Matthias Clasen
90296dab76 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Make init_dmabuf() restore the previous GL context

Closes #6398

See merge request GNOME/gtk!6887
2024-02-12 01:04:14 +00:00
Matthias Clasen
9bd6d431af ci: Capture generated node files for gsk tests
For some of the compare render variations (mask, clip, etc), it
can be quite useful to have the generated node file around to
reproduce the problem.
2024-02-11 19:41:21 -05:00
Benjamin Otte
f126986c2b dmabuf: Make init_dmabuf() restore the previous GL context
Random code can call that function and cause unexpected GL context
changes. This is especially bad because it can happen nested.

Fixes the NGL renderer breaking in the inspector when importing a dmabuf
initializes the dmabuf backend which creates a GL renderer which creates
a GL context and makes it current causing the NGL renderer to break when
it continues rendering.

Fixes #6398
2024-02-12 01:39:32 +01:00
Matthias Clasen
865564b32f gsk: Make matrix transforms roundtrip better
When we parse a 2D matrix, we produce a 2D transform, and we
can easily regenerate a 2D matrix from it.

Tests included.
2024-02-11 19:39:19 -05:00
Benjamin Otte
3ae6da10b1 Merge branch 'wip/otte/for-main' into 'main'
Fix pixel alignment on fractional scales

See merge request GNOME/gtk!6885
2024-02-11 20:10:33 +00:00
Benjamin Otte
1b9002afd3 ngl: Check for GL 3.3
The default check is still for GL 3.0 and we don't support that.
2024-02-11 20:04:54 +01:00
Benjamin Otte
9e72260c3b testsuite: Add a compare test for non-integer repeat children
This encodes the problems from the harmless looking example from
  https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/
in a form that we can test.

Unsurprisingly it doesn't work on GL and Cairo.
2024-02-11 20:04:54 +01:00
Benjamin Otte
9d52b4e269 testsuite: Add another test for pixel alignment
Tests the rounding fixes from the previous commit.

I'm not disabling it on GL because it succeeds - but that is somewhat by
accident I guess.
2024-02-11 20:04:54 +01:00
Benjamin Otte
6ed4eece04 gpu: debug-print the used shader clip
When using GSK_DEBUG=verbose, print the clip mode used in the shader.

Use cute little unicode indicators to not overload the debug output.
2024-02-11 20:04:54 +01:00
Benjamin Otte
cfaddb5d47 gpu: Use nodprocessor infrastructure for offscreening
The just copied over function can just use the same infrastructure as
the other functions we already have that create slightly adjusted
offscreens.
2024-02-11 20:04:54 +01:00
Benjamin Otte
7c861d8b59 gpu: Don't clip again after already clipping
The 2 callers of gsk_gpu_get_node_as_image() were already computing the
minimum clip region and in particular aligning it to the pixel grid, so
intersecting with node bounds again was causing that alignment to be
busted.
2024-02-11 20:04:54 +01:00
Benjamin Otte
1c3457adfb gpu: Fix sizing of fractionally scaled backbuffer
When using a window size and scale that don't multiply to an integer, we
were using the wrong method to adjust it.

The Wayland fractional scaling spec just says:

> For toplevel surfaces, the size is rounded halfway away from zero.

This is meant to be interpreted as "create a large enough buffer to hold
partial pixels) and the compositor will blend it mapping to the pixel
grid" even if that means the buffer slightly overhangs.

Example:
A 11 units wide window at 150% will need a 11 * 1.5 = 16.5 pixel wide
buffer. This should be rounded to 17 pixels but rendered as if only 16.5
pixels are occupied by the window, not as if all 17 pixels are occupied.
2024-02-11 20:04:54 +01:00
Benjamin Otte
a2e46c4d39 gpu: Move function
It is only used by the nodeprocessor, so put it where it belongs.
2024-02-11 20:04:54 +01:00
Benjamin Otte
df1d024059 Revert "gpu: Fix scale fluctuation"
This commit is wrong.
It does achieve what it sets out to do, but the method doesn't work.

It confused multiple things in one commit, the commit message only
describes the symptoms it tries to fix and not why the fix is correct,
it includes no tests and it wsn't properly reviewed.

Related: !6871
2024-02-11 20:04:54 +01:00
Carlos Garnacho
e492dac7fe Merge branch 'gtk4_crash_tablet_pad_remove' into 'main'
gdk/wayland: Clear current_tablet on pad leave

See merge request GNOME/gtk!6883
2024-02-11 17:07:14 +00:00
Colin Kinloch
fabe0516fa gdk/wayland: Clear current_tablet on pad leave
Fixes crash when handling tablet pad removal event after the
current_tablet has already been freed.
2024-02-11 14:52:30 +00:00
Matthias Clasen
84971b9076 Merge branch 'gtkcalendar-issue-2440' into 'main'
GtkCalendar: Add missing accessors

See merge request GNOME/gtk!6849
2024-02-11 14:40:30 +00:00
Ahmed Baïzid
5efc33fe65 GtkCalendar: Add missing accessors 2024-02-11 14:40:30 +00:00
Matthias Clasen
52c228fd9e Merge branch 'macos-dmabuf-tests' into 'main'
macos: skip dmabuf tests

See merge request GNOME/gtk!6874
2024-02-11 13:48:33 +00:00
Matthias Clasen
674b5b808e Merge branch 'gtkcalendar-doc-mentions-gdate' into 'main'
GtkCalendar: Remove a mention of GDate from the doc

See merge request GNOME/gtk!6876
2024-02-11 12:39:04 +00:00
Matthias Clasen
af62aa4497 Apply 1 suggestion(s) to 1 file(s) 2024-02-11 12:04:21 +00:00
Matthias Clasen
137a7096c3 Merge branch 'announcement-priority-docs-fix' into 'main'
Fix docs for GtkAccessibleAnnouncementPriority

See merge request GNOME/gtk!6881
2024-02-11 12:01:46 +00:00
Arjan Molenaar
703e5ab9a8 dmabuf: Skip dmabuf tests for macOS
Dmabuf is not supported for macOS.
2024-02-11 11:27:13 +01:00
Sebastian Dröge
e2dc94d0e8 Fix docs for GtkAccessibleAnnouncementPriority 2024-02-11 11:19:56 +02:00
Matthias Clasen
b821103d1e Merge branch 'sonny/fix-gtkimage.file-desc' into 'main'
gtk: Fix GtkImage.file description

See merge request GNOME/gtk!6878
2024-02-10 21:54:21 +00:00
Sonny Piers
b40c9d8dcd gtk: Fix GtkImage.file description 2024-02-10 22:01:51 +01:00
Matthias Clasen
87b66de109 Merge branch 'mip_size' into 'main'
gsk: Fix blit sizes while generating mipmaps on vk

See merge request GNOME/gtk!6875
2024-02-10 19:13:36 +00:00
Ahmed Baizid
e934a8984d GtkCalendar: Remove a mention of GDate from the doc 2024-02-10 19:15:40 +01:00
M Henning
d08412aaa4 gsk: Fix blit sizes while generating mipmaps on vk
A few lines later we already had the correct equation for the size.
See vulkan 1.3 spec section 12.3.2 "Image Mip Level Sizing"
2024-02-10 10:59:44 -05:00
Matthias Clasen
56e7c4ab50 Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Make overlay more challenging

See merge request GNOME/gtk!6873
2024-02-10 12:42:21 +00:00
Matthias Clasen
3be03ea56f testdmabuf: Make overlay more challenging
Put both changing and unchanging widgets in the overlay, to
test our offloading code harder.
2024-02-10 07:09:28 -05:00
Matthias Clasen
ac65495434 Merge branch 'fix-scale-fluctuation' into 'main'
gpu: Fix scale fluctuation

See merge request GNOME/gtk!6871
2024-02-10 12:08:52 +00:00
Matthias Clasen
3a26e29795 Merge branch 'drop-ffmpeg' into 'main'
Drop ffmpeg support

Closes #5581

See merge request GNOME/gtk!6872
2024-02-10 11:53:41 +00:00
Sabri Ünal
21f64b987a Update Turkish translation 2024-02-10 09:47:13 +00:00
Matthias Clasen
da227386ad Drop ffmpeg support
The experimental ffmpeg media backend  hasn't been building for a
year, and nobody showed up with a patch to make it build again.

Fixes: #5581
2024-02-09 22:32:58 -05:00
Matthias Clasen
1ac82528d9 gpu: Fix scale fluctuation
We want to use a viewport that gives us the right scale back.
This fixes problems where glyph lookups were inefficient because
the scale part of the key would fluctuate ever so slightly.
2024-02-09 19:49:54 -05:00
Matthias Clasen
50fb19b10d Merge branch 'matthiasc/for-main' into 'main'
offload: Small optimization

See merge request GNOME/gtk!6868
2024-02-09 22:53:26 +00:00
Matthias Clasen
7c38945abf Merge branch 'testsuite_fix_recentmanager_win32' into 'main'
testsuite: fix recentmanager failure on win32

See merge request GNOME/gtk!6656
2024-02-09 22:46:51 +00:00
Matthias Clasen
be2dcdd897 offload: Fix our tree walk
We were not finding an overlaid spinner, since it is implemented
as a texture in a (most of the time) non-affine transform, and
we were aborting our treewalk when we see such transforms.

Instead, don't abort the walk on any transforms, but check if we
are in an affine context before deciding to offload a subsurface.
2024-02-09 12:43:38 -05:00
Matthias Clasen
16f91fc5d2 Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Use a spinner as overlay

See merge request GNOME/gtk!6867
2024-02-09 17:24:32 +00:00
Matthias Clasen
46cb0c5fc8 offload: Small optimization
Don't transform bounds more often than necessary.
2024-02-09 12:19:16 -05:00
Matthias Clasen
49e0ae8742 testdmabuf: Use a spinner as overlay
Thats a bigger challenge, and it breaks.
2024-02-09 11:50:51 -05:00
Matthias Clasen
933ce71ec6 Merge branch 'matthiasc/for-main' into 'main'
testsuite: Plug a memory leak

See merge request GNOME/gtk!6866
2024-02-09 12:35:41 +00:00
Matthias Clasen
149e884658 NEWS: Updates 2024-02-09 00:13:21 -05:00