Commit Graph

11400 Commits

Author SHA1 Message Date
Benjamin Otte
50ee872978 dmabuf: Add gdk_dmabuf_get_fourcc()
Returns the fourcc for a given GdkMemoryFormat.

Not sure if this is the best name, but I didn't know a better one.
2023-11-25 01:44:34 +01:00
Benjamin Otte
b6c82c6b54 dmabuf: Add all formats
Add the matching GdkMemoryFormat for all dmabuf formats.

This way, we don't fall back to RGBA8 for 10- and 16-bit formats that we
don't support natively when EGL or Vulkan use them.

Also includes corrections for a few mixups.
2023-11-25 01:44:34 +01:00
Benjamin Otte
1bf94b045c dmabuf: Refactor function
1. Don't require passing in a GdkDisplay

2. return TRUE/FALSE if a format was found, so calling code can
   decide how to handle failure itself
2023-11-25 01:44:34 +01:00
Matthias Clasen
f21175b3d0 frameclock: Inline a few things
There is no need to call type-checking getters in a loop.
2023-11-24 17:53:34 -05:00
Maximiliano Sandoval R.
3a8834a437
gdk-enums: Add GDK_NO_MODIFIER_MASK 2023-11-24 18:04:56 +01:00
Matthias Clasen
b7a1b1d7ee Fix some static analysis warnings 2023-11-24 10:35:57 -05:00
Matthias Clasen
57e382b59c Merge branch 'sumibi-yakitori/fix-mouse-cursor-on-macos' into 'main'
macos: Change to send motion events to NSApp

Closes #6134

See merge request GNOME/gtk!6451
2023-11-24 13:06:53 +00:00
Matthias Clasen
a90a6c4517 Address various static analysis complaints
These were picked out of the scan_build logs in ci.
2023-11-22 00:07:47 -05:00
Matthias Clasen
c99c06f0da wayland: Careful offloading with fractional scales
Sadly, subsurface positioning is undefined in this case. We'll
trust the compositor to not mess up if the device coordinates
after applying the scale are integral, but otherwise, we'll
decline.
2023-11-21 13:47:10 -05:00
Matthias Clasen
bda8f5393d wayland: Allow attaching (some) non-opaque textures
Allow translucent textures when we are raising the subsurface.
2023-11-21 13:24:04 -05:00
Matthias Clasen
160fa969d4 subsurface: Replace place_above/below
Instead, do it all in attach(), which becomes more and more like
ConfigureWindow. This is good, because it will let us take the
above-ness into account when making decisions about attaching.
2023-11-21 13:24:04 -05:00
Benjamin Otte
edf33a6617 Merge branch 'wip/otte/for-main' into 'main'
subsurface: Don't marka failure as success

See merge request GNOME/gtk!6594
2023-11-21 17:01:54 +00:00
Benjamin Otte
86587a9328 subsurface: Don't marka failure as success
There was one branch in the success case that turned it into a failure,
yet we were still reporting a success (and discarding the buffer).

Don't do that.
2023-11-21 17:31:40 +01:00
Matthias Clasen
463b6dd1fd Merge branch 'egl-device-info' into 'main'
EGL: Print out the device info

See merge request GNOME/gtk!6590
2023-11-21 05:04:35 +00:00
Matthias Clasen
88e1f77f90 EGL: Print out the device info
This may become more relevant info, with dmabuf formats being
tied to specific devices.
2023-11-20 23:40:00 -05:00
Matthias Clasen
eae0e15b9d wayland: Move subsurface creation code
This belongs with all the other subsurface handling.
2023-11-20 18:01:09 -05:00
Matthias Clasen
2dcec44714 Drop the nograbs debug value
This was only used in the x11 backend, and I haven't seen it
actively recommended for debugging anything in ages.
2023-11-20 08:02:03 -05:00
Matthias Clasen
f04c819439 Drop the gl-legacy debug value
The consensus is that we can do without this.
2023-11-20 08:02:02 -05:00
Matthias Clasen
699c6d6159 Use GLES by default
With the advent of dmabuf support, using GLES has become more
attractive, since we can use its external texture support to
support more dmabuf formats.

You can go back to the previous preference order by setting

    GDK_DEBUG=gl-prefer-gl
2023-11-19 08:07:03 -05:00
Matthias Clasen
025b846fce Add a debug value to prefer desktop GL
This will be used in the next commit, when we change the default
preference to be GLES.
2023-11-19 08:07:02 -05:00
Matthias Clasen
fcdbab3f69 gl: Tweak debug values for GL api selection
Replace GDK_DEBUG=gl-gles with GDK_DEBUG=gl-disable-gl, and add
a GDK_DEBUG=gl-disable-gles to match.
2023-11-19 08:07:02 -05:00
Luca Bacci
0b853f62ed Merge branch '6203_gdk_win32_precalculate_keymap' into 'main'
GdkWin32: precalculate keymap at display opening

Closes #6203

See merge request GNOME/gtk!6566
2023-11-18 13:24:21 +00:00
Matthias Clasen
d4a569057f Cosmetics: Typo fix 2023-11-16 20:54:15 -05:00
Matthias Clasen
c5727df568 dmabuf: Add support for separate alpha formats
Support dmabuf formats with alpha in a separate plane.

Related: #6208
2023-11-16 20:53:52 -05:00
Benjamin Otte
7406cea257 Merge branch 'wip/otte/for-main' into 'main'
wayland: Don't create a new wl_buffer if the texture didn't change

See merge request GNOME/gtk!6577
2023-11-16 23:54:57 +00:00
Benjamin Otte
010ff81b2f wayland: Don't create a new wl_buffer if the texture didn't change
Avoids flickering in Mutter - which is probably a mutter bug.

But it also reduces traffic, so it's a good thing anyway.
2023-11-17 00:22:27 +01:00
Matthias Clasen
6eb6b0cb50 Cosmetics: typo fix 2023-11-15 06:45:52 -05:00
Matthias Clasen
c81954120a Merge branch 'fix-giodesktopappinfo-check' into 'main'
Revert "Conditional check for gdesktopappinfo header"

See merge request GNOME/gtk!6568
2023-11-15 05:13:08 +00:00
Matthias Clasen
4bdc44f4af Revert "Conditional check for gdesktopappinfo header"
This reverts commit 13b94dab10.

As pointed out in #6557, this commit is broken and causes
gio/gdesktopappinfo.h to never be found.
2023-11-14 23:45:17 -05:00
Matthias Clasen
429056c214 Merge branch 'wip/otte/for-mclasen' into 'main'
gl: Don't punch hole if the subsurface is above

See merge request GNOME/gtk!6567
2023-11-15 00:26:45 +00:00
Benjamin Otte
acecf519bc offload: Reject non-integer rectangles
We shouldn't just fudge with coordinates if we want accurate rendering.
2023-11-14 21:55:10 +01:00
Benjamin Otte
b2fbdcda41 subsurface: Report better error messages when rejecting textures 2023-11-14 21:54:38 +01:00
Luca Bacci
2803189afd Merge branch 'gdkwin32_modernize_clipboard' into 'main'
GdkWin32: switch to new clipboard API

Closes #442

See merge request GNOME/gtk!6560
2023-11-14 20:09:55 +00:00
g.willems
ad08c1444a win32: precalculate keymap at display opening
The default keymap and keymap layouts are calculated on request.
If done once a surface is setup and listening at win32 events,
we may then enter in a recursive loop.
To avoid this, precalculate the keymap as soon as displays are open.

Fixes #6203
Closes #6203
2023-11-14 20:26:05 +01:00
Benjamin Otte
46d4c70cd7 offload: Only print one debug message
... when failing to create the wl_buffer.
2023-11-14 15:04:38 +01:00
Benjamin Otte
4920ac4a57 offload: Move a debug message
If we fail to attach a buffer, we don't want to print this.
2023-11-14 15:04:38 +01:00
Benjamin Otte
190e7da317 wayland: Don't g_warning() on expected error
Print a GDK_DEBUG() message instead.
2023-11-14 13:06:05 +01:00
Matthias Clasen
00d7d4b17b wayland: Implement empty_frame in draw contexts 2023-11-13 22:17:35 +01:00
Matthias Clasen
9eef566b54 gdk: Introduce empty frames in GdkDrawContext
We need a way to commit pending subsurface changes, even when no
drawing happened for the frame. empty_frame() is that way.
2023-11-13 22:17:35 +01:00
Matthias Clasen
ca054bfdc9 wayland: Request frame callbacks on subsurfaces
We need this for the case when the subsurface completely covers
up the main surface. Without it, we just stop updating.
2023-11-13 22:17:35 +01:00
Matthias Clasen
59dbfb0843 wayland: Implement subsurface api
This is not used anywhere yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
223e27e7dc gdk: Add private subsurface api
Add api to allow creating subsurfaces, attaching textures to them,
and changing the stacking order.

This is just the api, there is no implementation yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
efe1415429 gdk: Add a debug flag for subsurfaces
You can now use GDK_DEBUG=offload to get debug spew about
subsurfaces and graphics offload.
2023-11-13 22:17:35 +01:00
Matthias Clasen
489723916d wayland: Get format info for dmabufs
For now, all we do with it is dump the formats if you
set GDK_DEBUG=misc. In the future, this will be used
when attaching dmabufs to subsurfaces.
2023-11-13 22:17:35 +01:00
g.willems
a58424588f win32: switch to new clipboard API
This is a backport of !1143 to gtk4.

SetClipboardViewer() API is obsolete is prone to clipboard chain breaks
from other applications.
Use recommended AddClipboardFormatListener() instead.

Fixes #442
2023-11-13 21:29:48 +01:00
Matthias Clasen
b24ae31716 dmabuf: Improve consistency of debug messages
Make sure all our dmabuf debug messages are display-scoped so the
inspector doesn't trigger them, use the same formatting throughout,
and improve consistency of wording here and there.
2023-11-12 13:02:58 +01:00
Matthias Clasen
7cf805c8b3 dmabuf: Add a debug message for format fallback
This may be helpful in pinpointing why a dmabuf format behaves
unexpectedly.
2023-11-12 11:24:37 +01:00
Matthias Clasen
6ae9cbfe0f dmabuf: NV12 is opaque
Getting this wrong matters, since we won't offload textures in
non-opaque formats. Found by Robert Mader. At the same time,
unify the two places we have for mapping from fourcc to memory
format.
2023-11-11 23:56:01 +01:00
Benjamin Otte
a9e4993184 Merge branch 'wip/otte/enable-debug' into 'main'
Remove G_ENABLE_DEBUG around debug checks

See merge request GNOME/gtk!6546
2023-11-07 15:12:11 +00:00
Benjamin Otte
cd7e1c1387 dmabuf: Modify gdk_gl_context_import_dmabuf()
Move a bunch of code - namely the target selection - into the function.

I want to use the same code in the NGL renderer, so no need to duplicate
it.
2023-11-07 05:12:57 +01:00