Commit Graph

2883 Commits

Author SHA1 Message Date
Matthias Clasen
4961241f26 gsk: Use gdk_rgba_print when suitable 2024-05-31 21:39:04 -04:00
Matthias Clasen
90e1ce0906 Merge branch 'new-docstrings' into 'main'
Add missing docstrings

See merge request GNOME/gtk!7321
2024-05-31 19:57:53 +00:00
Maximiliano Sandoval
3d1f914271
gskglrenderer: Document GL renderers 2024-05-31 11:47:30 +02:00
Maximiliano Sandoval
7bb0639a75
gskrendernode: Document serialization error quark 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval
f8f38aab63
gskpathpoint: Document copy and free 2024-05-31 11:47:29 +02:00
gayathri.berli@ibm.com
ba92ce342e Merge branch 'main' into memoryfix 2024-05-30 18:21:06 +05:30
Chun-wei Fan
9dbdbaca43 gskvulkandevice.c: Put Vk[Pipeline|RenderPass] in structures
This way, we can simply duplicate the keys as separate pointers to store
the corresponding Vulkan handles so that we can safely hash them, as
Vulkan handles may or may not be pointers depending on the target
platform.

This will fix builds on 32-bit Windows at least.
2024-05-29 18:16:22 +08:00
Chun-wei Fan
4c677e4dcd gskvulkanmemory.c: Use VK_NULL_HANDLE for VkDeviceMemory
...rather than NULL, so that things will build fine on non-LLP, non-64-bit
systems.
2024-05-29 12:57:07 +08:00
Chun-wei Fan
be2ff60787 gsk: Call glDeleteSync() directly
This function does not use the standard __cdecl calling convention on
Windows, meaning using g_clear_pointer() on it directly will cause
crashes on 32-bit Windows.  Just call it directly if the GLsync it uses
exists.
2024-05-25 11:07:37 +08:00
Alejandro Piñeiro
130a6fe0cf gsk: use the correct memory type index
https://gitlab.gnome.org/GNOME/gtk/-/issues/6726
2024-05-22 19:43:03 +02:00
Matthias Clasen
690c06109e gsk: Speed up mask nodes with cairo
Switch symbolc icon drawing from color-matrix to mask nodes
make the performance of the iconscroll demo crater (from 60fps
to 10fps).

Apply the same optimization we already have for color-matrix
nodes when drawing mask nodes. This gets us back to 60fps.

Fixes: #6700
2024-05-10 07:24:25 -04:00
Matthias Clasen
76b0687467 Put newlines before base64 blobs
This makes things look a bit cleaner in the node editor, since
the first line no longer sticks out.
2024-05-05 10:16:01 -04:00
Georges Basile Stavracas Neto
c45a6ad52d gsk/gpu: Use G_GSIZE_FORMAT for printing gsizes
On Windows, gsize is a long long unsigned. The compiler complains about
that.

Use G_GSIZE_FORMAT which translates to %llu on Windows, %lu on most
platforms, and sometimes just %u on rare cases.
2024-05-03 12:30:39 -03:00
Matthias Clasen
9904259661 gsk: Serialize hint metrics too
We need this to ensure that we properly roundtrip text nodes
without any changes.
2024-05-01 14:00:18 -04:00
Matthias Clasen
ef1ff8313f gsk: Improve logging
Log the shader compilation with sufficient detail.
2024-04-30 07:36:42 -04:00
Matthias Clasen
744016e768 Merge branch 'matthiasc/for-main' into 'main'
gsk: Drop statistics from GSK_DEBUG=renderer

See merge request GNOME/gtk!7203
2024-04-29 18:30:59 +00:00
Matthias Clasen
c23d3c4406 gsk: Add debug spew to renderer selection
Reshuffle things a bit and make GSK_DEBUG=renderer print out
more information about why renderers were skipped or selected.
2024-04-29 12:28:15 -04:00
Matthias Clasen
1e2eae4ddf gsk: More detailed debug spew
Include information about why a renderer was selected in
GSK_DEBUG=renderer.
2024-04-29 12:12:22 -04:00
Matthias Clasen
77eb3df7c0 gsk: Drop statistics from GSK_DEBUG=renderer
This only works with the old gl renderer, and it interferes with
the setup information that is printed by that category.
2024-04-29 12:12:22 -04:00
Benjamin Otte
e6700405c9 dmabuf: Use narrow range instead of full range
It's way more common, and Mutter uses it, too.

Avoid visual glitches when going in/out of offload.

Fixes #6672
2024-04-29 14:30:56 +02:00
Matthias Clasen
8b59771cd1 Merge branch 'matthiasc/for-main' into 'main'
inspector: Cosmetics

See merge request GNOME/gtk!7199
2024-04-29 10:27:26 +00:00
Matthias Clasen
a3bd0a3e17 gsk: Cosmetics
Tweak a profiler counter name.
2024-04-28 23:54:55 -04:00
Joshua Lee
d069eb173a path builder: Fix doc typo 2024-04-28 22:24:38 +01:00
Benjamin Otte
719021e1f4 gpu: Handle tiny offscreens
Due to rounding errors, it is possible after intersecting a lot of
rectangles to end up with a tiny size for an offscreen. And because we
allow an epsilon before ceil()ing to an integer (see commit afc7b46264
for details) it is now possible that we end up with a size of 0.

Avoid that by always enforcing a minimum size of 1px.

Test included

The test uses a different codepath to arrive at the same problem - it
specifies the small size instead of triggering it via rounding errors
and clipping like the original bug (and most likely the more common case
to encounter this problem.

Fixes #6656
2024-04-28 13:51:42 +02:00
Benjamin Otte
4856e115a9 path: document enum 2024-04-28 08:33:03 +02:00
Matthias Clasen
c45199e388 gsk: Fix a profiler mark
I messed this up in f26efd9adf.
2024-04-27 10:23:45 -04:00
Matthias Clasen
a1fdf06d80 gsk: Add a warning for inefficient texture import
With GSK_DEBUG=fallback, warn if a non-memory texture has to be
downloaded for importing it into Vulkan or GL.
2024-04-26 11:04:47 -04:00
Matthias Clasen
3fc9de7539 offload: Make logging more compact
Use a format of

[XXX] SYMBOL DETAILS

where SYMBOL indicates the offloading status:
 🗙 - no offload
 ▲ - offload above, with background
 △ - offload above, no background
 ▼ - offload below, with background
 ▽ - offload below, no background
2024-04-24 22:01:56 -04:00
Matthias Clasen
1c9a55d185 Merge branch 'vulkan-msvc' into 'main'
gskvulkandescriptors.c: Don't return value from void-rettype function

See merge request GNOME/gtk!7175
2024-04-25 01:37:49 +00:00
Georges Basile Stavracas Neto
3aa6c27c26 vulkan/image: Use GENERAL for initial layout of DMA-BUF textures
The VK_IMAGE_LAYOUT_UNDEFINED layout means that the data hold by the
texture can be discarded, and we don't want to discard it. Because the
Vulkan spec is unclear (see [1] for a discussion), err on the side of
caution and use VK_IMAGE_LAYOUT_GENERAL.

Fixes import failures with WebKit.

[1] https://github.com/ValveSoftware/gamescope/issues/356
2024-04-24 17:21:51 -03:00
Chun-wei Fan
016354b6dd gskvulkandescriptors.c: Don't return value from void-rettype function
Fixes builds on Visual Studio with Vulkan enabled, as later GLib releases
consider this as an error on Visual Studio builds.
2024-04-24 16:19:43 +08:00
Matthias Clasen
f26efd9adf gsk: Add a profiler mark for pipeline creation
This is the Vulkan equivalent of shader compilation, it could be
expensive, so lets add a mark around it.
2024-04-22 20:47:25 -04:00
Matthias Clasen
b21708c5e4 offload: Consolidate logging a bit
Spew a bit less per-frame. Unfortunately, we still spew for
every frame, and fixing that would require more extensive
refactoring to centralize all logging in gskoffload.c
2024-04-21 20:18:38 -04:00
Matthias Clasen
c9c29d8bde gsk: Only prefer Vulkan on Wayland
Make Vulkan the default on Vulkan-friendly platforms.
For now, that list only includes Wayland.
2024-04-20 18:10:21 -04:00
Matthias Clasen
582ad79088 gsk: Change the default renderer
The intent of this change to get wider testing and verify that the
Vulkan drivers we get to use in the wild are good enough for our
needs. If significant problems show up, we will revert this change
for 4.16.

The new preference order is vulkan > ngl > gl > cairo.

The gl renderer is still there because we need it to support gles2.

If you need to override the default renderer choice, you can
still use the GSK_RENDERER environment variable.

Fixes: #6537
2024-04-19 13:50:40 -04:00
gayathri.berli@ibm.com
06351844bb changes to fix the memorytexture regression 2024-04-18 17:13:41 +05:30
Matthias Clasen
ec9cdb74ef gsk: Actually punch transparent holes
In a57f7e3935 I accidentally replaced { 0, 0, 0, 0 } with
GDK_RGBA_BLACK instead of GDK_RGBA_TRANSPARENT. Oops.

Fixes: #6634
2024-04-17 20:09:13 -04:00
Matthias Clasen
0a5a720fe1 Use gdkrgbaprivate.h in more places
This gets inline functions used where it matters.
2024-04-15 22:57:01 -04:00
Matthias Clasen
e583e823b5 Use our defines for color
We have GDK_RGBA_WHITE, GDK_RGBA_BLACK and GDK_RGBA_TRANSPARENT,
lets use it instead of open-coding it.
2024-04-15 22:57:01 -04:00
Matthias Clasen
4aac64edf0 offload: Some renaming
Rename things to be more in line with the subsurface api.
2024-04-15 19:53:46 -04:00
Matthias Clasen
c97bbfdfb1 offload: Use subsurface bounds for diffing
When adding the whole subsurface to the diff, use the subsurface
bounds, which takes both the texture and the background into
account.
2024-04-15 19:53:46 -04:00
Matthias Clasen
933a0e5a98 subsurface: Some api revision and documentation
Rename things so they make more sense. The dest/source naming got
a bit unclear when we added background into the mix. Now we're going
for:

source_rect - the texture region to display
texture_rect - dimensions of the subsurface showing the texture
background_rect - dimensions of the background subsurface
bounds - union of texture_rect and background_rect

Also use this opportunity to add some api docs.
2024-04-15 19:53:46 -04:00
Matthias Clasen
0108a5f56d offload: Use subsurface background optimization
Detect a black color node below the texture node and pass that
information to the subsurface, to take advange of the single-pixel
buffer optimization.

To make this work, we need to stop using the bounds of the subsurface
node for sizing the offload, and instead use either the clip or
the texture node for that.
2024-04-15 19:53:46 -04:00
Matthias Clasen
3f9bdaa4c8 Add background to subsurfaces
Make it possible for subsurfaces to have a black background on a
secondary subsurface below the actual subsurface. Using a single-pixel
buffer for that background increases the changes that the compositor
will use direct scanout for the actual subsurface.

This changes the private subsurface API. All callers have been
updated to pass an empty background rect.
2024-04-15 19:53:46 -04:00
Matthias Clasen
ce030b1b36 gsk: Fix a minor type mismatch
Use the same types in the declaration of gsk_standard_contour_init.

Fixes: #6628
2024-04-13 22:28:48 -04:00
Philip Withnall
707e492f0d
gsk: Fix a maybe-uninitialized warning
The compiler (gcc 13.2) thinks that `t` could be used uninitialised.
That’s obviously not the case, because there’s always going to be at
least one loop iteration due to the initial values of `t1` and `t2`.

Change the loop to a `do…while` to make that a bit clearer to the
compiler without making any functional changes to the code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 12:08:03 +01:00
Matthias Clasen
cc8db1805d gsk: Be safer against bad font options
Some combinations of hint-style and hint-metrics lead to bad glyph
placement in the glyph cache, so avoid them.
2024-04-09 19:12:49 -04:00
Benjamin Otte
3080e2974d gpu: ceil() offscreen size before generating offscreen
The goal is to generate an offscreen at 1x scale.
When not ceil()ing the numbers the offscreen code would do it *and*
adjust the scale accordingly, so we'd end up with something like a
1.01x scale.

And that would cause the code to reenter this codepath with the goal to
generate an offscreen at 1x scale.
And indeed, this would lead to infinite recursion.

Tests included.

Fixes #6553
2024-04-09 17:39:32 +02:00
Benjamin Otte
9fe9ea34fd vulkan: Handle generating mipmaps for 1x1 images
Testcase included.
2024-04-08 21:06:54 +02:00
Matthias Clasen
704ee6a9d0 offload: Determine output transforms
When we look for the texture to attach to the subsurface, keep
track of transforms we see along the way, and look at their scale
component to determine if the texture needs to be flipped.
We currently don't allow rotations here.

This fixes glarea rendering being upside-down when offloaded.
2024-04-07 11:12:06 -04:00