Commit Graph

78394 Commits

Author SHA1 Message Date
Benjamin Otte
f357623170 memoryformat: Fix broken swizzle values
I can't copy/paste.
2023-12-16 09:20:29 +01: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
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
c414889cfa testsuite: Make memorytexture test work with GLES < 3.1
Previously, the code was skipping various tests and not skipping others
that it should.

Fix both of these cases.
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
cf4b0a27f8 glcontext: Only swizzle when we can
Don't use the recently added swizzle optimization if we're using a GL
version that is too old to support swizzling (GLES 2).
2023-12-12 01:49:41 +01:00
Benjamin Otte
393ee574b6 gl: Print debug for CPU conversions of textures
When the GL renderer cannot upload a given format, print a FALLBACK
debug message with the failed format and the alternative that was
picked, for example:

Unsupported format b8g8r8a8, converting on CPU to b8g8r8a8-premultiplied

Makes it easier to figure out what's happening, especially when using
old GLES versions that don't support all formats.
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
Luca Bacci
df1802f756 Merge branch 'gdkwin32_support_debug_default-settings' into 'main'
gdk/win32: support default-settings debug flag

See merge request GNOME/gtk!6658
2023-12-11 23:15:38 +00: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
cb5a8a76da Merge branch '6261-gtkstringlist-lacks-item-type-and-n-items' into 'main'
stringlist: Introduce :item-type and :n-items

Closes #6261

See merge request GNOME/gtk!6662
2023-12-11 18:18:49 +00:00
António Fernandes
26c35c00e1 stringlist: Introduce :item-type and :n-items
While not required by the GListModel interface, they are a useful
convention which is already implemented by other GListModel public
implementation in GTK, particularly for use in expressions and
bindings.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/6261
2023-12-11 17:36:52 +00:00
Emmanuele Bassi
5d4879aae7 Merge branch 'wip/typo' into 'main'
gtk-demo: Fix typo

See merge request GNOME/gtk!6661
2023-12-11 13:58:27 +00:00
Carlos Garnacho
39b08b82ca gtk-demo: Fix typo
Close the quotes in alert dialog message.
2023-12-11 14:22:30 +01:00
Benjamin Otte
2b6e7147d6 build: Sort alphabetically 2023-12-11 07:33:26 +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
6e7c499408 testsuite: Don't create nodes with negative size
If width or height are too small, only create one mask node.

The previous math would create the 2nd node with negative width/height.
2023-12-11 07:33:26 +01:00
Benjamin Otte
c341da32aa gsk: Set correct blur radius for cairo shadows 2023-12-11 07:33:26 +01:00
Benjamin Otte
d39ec8c09e gsk: Quality of life improvements for Cairo rendering
1. Check for an empty clip region before push/pop_group() calls

2. Remove save/restore() pairs as the vfunc invocation does so already.
2023-12-11 07:33:26 +01:00
Benjamin Otte
e3299e38df cairo: Handle clipped blur content
This is the result of experimenting with corner cases when blurring.

The result is a test that tests when the child of a blur node is
clipped out but the blurred child is not, the blurred parts are still
visible.

This immediately broke the cairo renderer, so the fix is included.
2023-12-11 07:33:24 +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
19171c7a89 testsuite: Add a test for opacity + color-matrix nodes
These are 2x2 combinations that:
1. Use a texture child node vs a color child node
   This should force an offscreen vs straight up use a texture.
2. Switch opacity and color-matrix
   Either put the color matrix into the opacity node or put the opacity
   into the color matrix.

This is worth testing because renderers often combine opacity into the
color matrix to avoid offscreens.

And they do that because applications often create faded out symbolic
images, which end up as a combination of these nodes.
2023-12-09 19:32:39 +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
Matthias Clasen
0b0a5a52af Merge branch 'docs_clarify_gtk_drop_down_get_selected_item' into 'main'
docs: Clarify how to obtain strings from GtkDropDown

See merge request GNOME/gtk!6647
2023-12-08 10:20:12 +00:00
Matthias Clasen
75d259eedf Merge branch 'fix-label-docs' into 'main'
Docs: Fix unfenced HTML tag in GtkLabel docs

See merge request GNOME/gtk!6650
2023-12-08 10:17:59 +00:00
FeRD (Frank Dana)
6fec018cbd Docs: Fix unfenced HTML tag in GtkLabel docs 2023-12-08 02:29:10 -05:00
Matthias Clasen
6d9c950b82 Merge branch 'ebassi/inhibit-reason-fallback' into 'main'
Add fallback string for empty inhibit reason

See merge request GNOME/gtk!6648
2023-12-08 04:06:11 +00:00
Emmanuele Bassi
0933ea63c5 Add fallback string for empty inhibit reason
The public gtk_application_inhibit() API allows a NULL reason argument,
and we have a fallback in place when going through the session manager
proxy; when using the inhibit D-Bus API directly, though, we're just
passing a potentially NULL value to g_variant_new_string(), which will
rightfully complain.
2023-12-07 11:55:20 +00:00
Logan Rathbone
8cb594696e docs: Clarify how to obtain strings from GtkDropDown 2023-12-07 00:03:04 -05:00
Matthias Clasen
9d7389aea7 Merge branch 'emoji-15.1' into 'main'
emoji: Update data to CLDR v44

See merge request GNOME/gtk!6642
2023-12-06 11:26:05 +00:00
Jeremy Bícha
76a1f1714d emoji: Update data to CLDR v44
Based on emojibase v15.3.0

Contains the changes in Unicode 15.1

https://unicode.org/versions/Unicode15.1.0/
https://cldr.unicode.org/index/downloads/cldr-44
https://github.com/milesj/emojibase/blob/emojibase-data%4015.3.0/packages/data/CHANGELOG.md
2023-12-03 16:32:42 -05:00
Yaron Shahrabani
9af08e17e0 Update Hebrew translation 2023-12-03 13:32:37 +00:00
Boyuan Yang
276afbca92 Update Chinese (China) translation 2023-12-03 01:40:50 +00:00
Yaron Shahrabani
0342d23dbe Update Hebrew translation
(cherry picked from commit cde309d9fa)
2023-12-02 22:12:14 +00:00
Matthias Clasen
1c10837b21 Merge branch 'matthiasc/for-main' into 'main'
Revert "Merge branch 'rgba-new-from-string' into 'main'"

See merge request GNOME/gtk!6640
2023-12-02 05:43:12 +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
Matthias Clasen
6a59326dbf Merge branch 'emoji-15' into 'main'
emoji: Update data to CLDR v43

See merge request GNOME/gtk!6639
2023-12-02 02:12:17 +00:00
Yaron Shahrabani
1968f331d9 Update Hebrew translation 2023-12-01 21:02:25 +00:00
Jeremy Bícha
bf35836350 emoji: Update data to CLDR v43
Based on emojibase v15.2.0

Contains the changes in Unicode 15.0

https://unicode.org/versions/Unicode15.0.0/
https://cldr.unicode.org/index/downloads/cldr-43
https://github.com/milesj/emojibase/blob/emojibase-data%4015.2.0/packages/data/CHANGELOG.md
2023-12-01 15:57:02 -05:00
Daniel Rusek
036629a491 Update Czech translation 2023-11-30 18:26:58 +00:00
Arjan Molenaar
8cabf59cf3 Merge branch 'macos-secure-restore' into 'main'
macos: Add method that denotes secure restorable state

See merge request GNOME/gtk!6632
2023-11-30 15:17:04 +00:00