1
0
Fork 0
Commit graph

2651 commits

Author SHA1 Message Date
Jonas Ådahl
c6c3f340ec monitor: Add API to get GAMMA LUT size
Will be used to generate look up tables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
8446cd9f4f monitor: Add getter for EDID MD5 checksum
Will be used for colord device matching.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
15bbded86b monitor-manager/native: Bail if gamma LUT size differs
Don't attempt to set a CRTC GAMMA LUT with a different size than what is
already there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
b6aea1318d util: Add 'color' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
20a91aa4e9 backend: Add color manager skeleton
Create a color manager type that eventually will be the high level
manager of color related behavior, such as ICC profiles and
color "temperature" a.k.a. night light.

For now, it's only an empty shell. It's also constructed by the actual
backend, as at a later point, the X11 and native color management
implementations will differ.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Mario Limonciello
96aa0fb853 output/kms: Add more heuristics to decide when to offer fallback modes
If the panel is connected via eDP and supports more than one mode
at different resolutions don't try to add more.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
2022-08-31 08:15:57 +00:00
Daniel van Vugt
8e2085dad9 backends/native: Add xlnx to the atomic deny list
Although its atomic KMS support seems to work at first, mode sets to
anything other than the Xilinx preferred max resolution of 2048x1280
would result in a hang. The xlnx kernel driver is given:
`DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_PAGE_FLIP_EVENT`
and it does complete the mode set without error, but page flip events
never arrive and so you're frozen on the first frame.

Revert to legacy KMS which has no such problem with non-default modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2596>
2022-08-26 18:39:12 +08:00
Jonas Dreßler
84396baafb stage: Mark stage as active on wayland when it has key-focus
The "activate" and "deactivate" signals on ClutterStage are used by
Cally to track the key-focus when the user is interacting with shell UI.
key-focus only gets tracked while the stage is activated.

Wayland has no concept of the stage receiving focus or not, so right now
the activation state is bound to whether there's a focus_window in
meta_display_sync_wayland_input_focus(). Since display->focus_window is
set pretty much all the time, this effectively binds activation state to
whether the stage holds a grab or not. This is almost good enough, but
it misses cases where key-focus is on the stage without a grab, for
example when keyboard-navigating the panel after using Ctrl+Alt+Tab.

It seems to make more sense to bind the activation state to whether
key-focus is set to an actor or to NULL, so let's do that instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2329>
2022-08-24 10:00:22 +00:00
Daniel van Vugt
03336788fb monitor-config-store: Add parsing support for "maxbpc" in monitors.xml
For example:

  <monitor>
    ...
    <maxbpc>8</maxbpc>
  </monitor>

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
d39137c631 monitor-manager-xrandr: Changing "max bpc" changes output assignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
99d84ae1cc output-xrandr: Add support for the "max bpc" KMS connector property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
978cbe2da4 onscreen-native: Set max_bpc with mode sets
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f19b350c94 output-kms: Add max_bpc support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
4eef54f80a monitor-config-manager: Add a max_bpc field to MetaMonitorConfig
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
a907cef905 monitor: Add function meta_monitor_get_max_bpc()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
6ff0d600c3 output: Add max_bpc support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
e0e10c29d9 monitor-manager-private: Add max_bpc to MetaOutputAssignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
b6dbb686e2 kms-impl-device-simple: Apply META_KMS_CONNECTOR_PROP_MAX_BPC
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
0cc4815837 kms-impl-device-atomic: Apply META_KMS_CONNECTOR_PROP_MAX_BPC
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
2b561a369c kms-update: Add function meta_kms_update_set_max_bpc
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
33ee155630 kms-connector: Add "max bpc" property
This limits the bits-per-channel colour depth of the signal that
the connector is allowed to output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f765437410 kms-types: Add type MetaKmsRange
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f760b47a3c kms-impl-device: Remember the min/max values for a DRM_MODE_PROP_RANGE
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Simon McVittie
64a67aa00b backend/native: Don't warn on EACCES if headless
Since commit 1bf70334 "tests/runner: Make test runner use the headless
backend", tests are run with the native backend in headless mode, which
will attempt to open each GPU and show a warning (fatal during tests)
if it cannot.

However, in headless mode we might not be logged in on any seat (for
example we might be logged in via ssh instead), which means we might
legitimately not have permission to use any GPUs, even if they exist.
Downgrade the warning to a debug message in this case.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/2381
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2584>
2022-08-19 16:07:23 +00:00
Daniel van Vugt
8711d44991 monitor-config-store: Only save 3 decimal places of <rate>
Because elsewhere we already ignore precision beyond that. It's also
easier to read rounded to 3 places than 15 decimal places.

  59.996623992919922  ->  59.997

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
8e5f5fbe54 monitor-config-manager: Only report Hz to 3 decimal places
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
b5169f2567 output-kms: Change SYNC_TOLERANCE from 1% to 0.001Hz
1% of 60Hz is 0.6Hz so it was losing the usual two decimal places
precision you would expect as a minimum. Now we use three to be sure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
f6e24c6293 monitor: Generate mode IDs with 3 decimal places for Hz
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Steev Klimaszewski
642791673c Update meta connector types enum
This adds the 4 new connector types that mutter didn't know about from
drm_mode.h in the kernel.

Noticed because mutter kept crashing when plugging in a USB-C adapter to
use an external monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2577>
2022-08-17 08:37:35 +00:00
Salman Malik
e2d4da8562 screen-cast-stream: Embed the wayland output name to streams
If a screencast session is screencasting from multiple monitors,
it is not possible to distinguish which stream (or PipeWire stream
node id) belongs to which connected monitor (such information may be useful
to the caller e.g. caller might want to embed the stream in a window
and name it after the monitor connector, for example). This change adds
optional metadata for monitor streams to also return the wayland output
name with the stream.

Ideally, this metadata should equip the caller to get more information about
display from the following Wayland interfaces:

https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output
https://wayland.app/protocols/xdg-output-unstable-v1

Related:
- https://github.com/flatpak/xdg-desktop-portal/pull/832
- https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/48

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2540>
2022-08-15 17:01:27 +00:00
Florian Müllner
dcd3bccae5 monitor-manager: Expose :night-light-supported property
We currently only expose this information over D-Bus, but now
gnome-shell needs it as well for the corresponding quick settings
toggle.

We don't want to talk D-Bus to ourselves, so make the information
available as a property as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5752

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2576>
2022-08-15 12:50:32 +00:00
Jonas Ådahl
6de2e0a320 tests: Add test for remembering configured monitor scales
Tests that switching using the same API used by the key binding
remembers the monitor scale from previous configurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
3dca01a06c monitor-config-manager: Use scale from past configs when generating
When we e.g. generate switch configs (i.e. the ones from pressing the
Super+P or the switch-config key on laptops), try a bit harder to find a
"good" monitor scale.

With "good", it means pick a scale that was used in a previous
configuration. In practice, this means that if you for example have
configured your external monitor to use a specific scale, then pressed
e.g. "built in only", and then switched back to e.g. "external only" or
"linear", the generated configuration will use the scale that was
previously configured.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
4580bca664 monitor: Add mode spec helper checking resolution similarness
If two modes are roughly the same, they should probably use the same UI
scaling factor. I.e. for the same monitor, if a 4K mode was configured to
have a certain scaling factor, and we generate a new configuration with
a similar sized 4K mode, we should re-use the scale previously
configured; however if we e.g. go from a 4K mode to a FHD mode, we
shouldn't.

This allows implementing better hueristics when using the switch-config
feature, where we'd be less likely to loose the for a certain monitor
mode combination previously configured scaling factor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
71bf31da83 monitor-config-manager: Use helper to calculate mirroring scale
This will eventually help with better hueristics for finding a good
scale. It currently doesn't change much, but the helper will later gain
more functionality that will also help when coming up with mirroring
configs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
8698b4a493 monitor-config-manager: Mark the mirroring logical monitor as primary
The resulting logical monitor was eventually marked as primary anyway,
but without the config being marked as such, various primary properties
was not set e.g. the one on the MetaOutput. Also, tests would fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
5fb4a2c286 monitor-config-manager: Fix layout size with scaled mirroring
The dimension of the logical monitor layout was not scaled according to
the scale, meaning generated mirror monitor configurations were broken.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
b2ba653dd9 monitor-config-manager: Put logical monitor size scaling into helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
5c26d786f5 tests/runner: Add 'resize_monitor' metatest command
This will allow tests to change monitor resolution. The first argument
is the monitor ID; there is always one monitor added by default, and it
has the id 0. It's currently not possible to add more monitors, so
passing '0' is the only valid way to resize monitors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
2022-08-11 11:32:42 +00:00
Daniel van Vugt
2a725f0bd9 cursor-renderer-native: Don't retry forever after GBM cursor functions fail
This avoids flooding the log with every cursor change:
```
(gnome-shell:19923): libmutter-WARNING **: 10:15:23.404: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument

(gnome-shell:19923): libmutter-WARNING **: 10:15:23.450: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument

(gnome-shell:19923): libmutter-WARNING **: 10:15:23.451: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument
```

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2520>
2022-08-10 15:35:55 +00:00
Daniel van Vugt
c430731436 output-xrandr: Less line wrapping
To silence CI warnings from check-code-style.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2511>
2022-08-10 14:41:46 +00:00
Daniel van Vugt
9d7cebd8e6 monitor-manager: Remove struct member indentation
To silence CI warnings from check-code-style.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2511>
2022-08-10 14:41:46 +00:00
Daniel van Vugt
5476feeaf2 monitor-config-store: Parentheses for correct indentation
To silence check-code-style complaints in CI, but also for consistency
(other cases already have parentheses).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2511>
2022-08-10 14:41:46 +00:00
Daniel van Vugt
3d044c351e monitor-config-store: Remove whitespace to silence check-code-style warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2511>
2022-08-10 14:41:46 +00:00
Jonas Ådahl
c61dc682a2 monitor-manager: Don't include generated header in header
This tends to result in build system race conditions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Robert Mader
22b9a4219a screencast: Implement buffer-transform support
So all cursor renderers support the feature.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
f804fe3a82 stage: Implement buffer-transform support in MetaOverlay
This allows the GL fallback path to correctly paint the cursor
if clients pre-rotated the buffer using
`wl_surface::set_buffer_transform`, visually matching the
hardware cursor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
df27017ba3 monitor-transform: Add helper to transform matrices
Moved from `MetaShapedTexture` - it will be useful
in several other places as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
550f09a5e7 clutter/stage-view: Defer and accumulate redraw-clip on scanout
When taking the scanout path we still want to clear the
redraw-clip from the stage-view in order to ensure we skip
frames in `handle_frame_clock_frame()` if no new redraw-clip
was recorded.
This was not done previously as the accumulated redraw-clip was
needed for the next repaint, likely under the assumption that
scheduling a scanout repeatedly would be computationally cost-free.
This assumption does not hold in a VRR world.

In order to archive both, an accumulated redraw-clip for the next
paint and frame-skipping during scanout, introduce new API to defer
and accumulate redraw-clips until the next repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2480>
2022-08-02 12:54:18 +02:00
Jonas Ådahl
50396fc00e kms/device: Differentiate between lack of AddFb2() and udev rule
We disable modifiers for two reasons: an udev rule saying so, or the
lack of a working drmModeAddFB2(). However, to the users, this is not
granular enough. While the current user, whether to enable modifiers in
MetaRendererNative, doesn't need more granularity, we want to send
modifiers to Wayland clients even if the onscreen framebuffers should
still be allocated without modifiers.

Prepare for differentiating between how Wayland DMA buffers work and how
onscreen buffer allocation work by separating the relevant device flags.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Daniel van Vugt
7c8ffe7efe renderer-native: Fall back to ARGB if XRGB is not supported
This fixes mutter failing to start on some ARM/Mali boards.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2519>
2022-07-29 08:48:57 +00:00
Jonas Ådahl
9966c8717b tests/kms: Run tests both using simple and atomic KMS
Two sanity checks to make sure the debug env vars still work are added
too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2456>
2022-07-28 23:59:24 +00:00
Jonas Ådahl
5823d2d1ae kms/impl-device/simple: Ensure buffer fb_id on test update too
This ensures the fb_id will be there when we actually apply the update,
and will also make scanout test case pass if we run it with the
non-atomic KMS API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2456>
2022-07-28 23:59:24 +00:00
Jonas Ådahl
4095c2431c barrier: Get rid of private instance struct
The struct is private to begin with, so no need for it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
3c6c1af0a0 barrier: Add GInitable based constructor method
This one does proper error reporting. Via Javascript, barriers are
constructed directly via GObject construction, which currently can't
handle error reporting, but when calling from C we can. However, if we
initialize using GInitable, and use that in our constructor method, once
gjs gains support for construction using GInitable, including the error
reporting, we'll automatically get proper error reporting to Javascript.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
27b75d3c96 barrier: Modernize type implementation
This means using G_DECLARE*() to declare the type, using
`_get_private_instance()` everywhere, and other smaller cleanups.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
0debb24e12 barriers: Make barriers fully part of the backend
Prior to this commit, barriers were created with a MetaDisplay pointer,
despite being entities related and owned by the backend. In the X11
case, it was also not hooked up to the backend X11 connection, but the
clutter one, meaning for example that the logic was active (but dormant)
also for the Xwayland connection.

Fix this by moving X11 barrier management and event processing fully to
the backend. Also replace passing a display pointer with passing a
backend pointer. Keep the display pointer around for a release, but mark
it as deprecated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Robert Mader
0c12903352 renderer-view: Drop bogus meta_monitor_transform_invert()
It papered over wrong `meta_rectangle_transform()` behaviour for
non-flipped output transforms. Also there is no obvious reason
why we would need inverted values here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
0c34908132 cursor-renderer/native: Various fixes for rotated cursors
- Drop bogus `meta_monitor_transform_invert()`. It papered over
  wrong `meta_rectangle_transform()` behaviour for non-flipped
  output transforms.
- Update `scale_and_transform_cursor_sprite_cpu` to match the GL
  pipeline matrix in `MetaShapedTexture`, fixing several of the
  flipped cases. Note: the rotation applied is the one a client would
  need to apply to the buffer for a given monitor transform.
- While on it, drop a redundant `return`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
29cafe6f6c monitor-transform: Fix transform() and drop relative_transform()
The following implicit definition for `transform()` did not
correctly apply:
```
a * b = c
c * invert(b) = a
```

Crucially the following did not apply for `FLIPPED-90`
and `FLIPPED-270`:
```
a * invert(a) = identity
```

Fix this by applying the operations, first the flip, then the
rotation, in this order and add tests to ensure correct results
for the requirement above.

Also drop `relative_transform()` as it only had a single user and
can be replaced by `transform()`:
```
invert(a) * b = c
a * c = b
```

As this is not very intuitive, ensure in tests as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
c6cf4bd9c3 backends/native: Fix checks for 'reflect-x' and 'reflect-y' bits
Checking for both bits at once means only one matching bit is
sufficient - very likely in case of `rotate-0'.

This fixes crashes on hardware that does not support 'reflect-'
bits when setting a flipped output transform.

While on it, also update the check for `reflect-y` instead of
`reflect-x` + `rotate-180`. They are logically equivalent,
however some hardware may support `reflect-y` but not both
other bits.

Fixes commit 4e3f3842a1

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Jonas Ådahl
d985069542 kms/crtc: Don't report predicted gamma changes
We started to report resource changes using prediction when an update
had been successfully committed. While at it, gamma changes were
reported too, but this was problematic, as gsd-color will listen for the
MonitorsChanged D-Bus signal and naively set the gamma again, even if it
didn't change. There aren't currently any actual use cases for being
told when gamma changes from a prediction, so just ignore it and just
report privacy screen changes.

This avoids a feedback loop between mutter and gsd-color.

Fixes: 81b28a1d97
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2531>
2022-07-26 11:04:52 +02:00
Jonas Ådahl
81b28a1d97 kms: Notify about privacy screen changes via predictions
When we change the privacy screen, we added a result listener to the KMS
update object to notify the upper layer about the privacy screen state
change. This was slightly awkward as one might have changed the state
multiple times for a single update, thus it was necessary to remove any
old result listeners to an update before adding a new one.

Doing this will not be possible when updates are fully async and managed
by the KMS impl device.

To handle this, instead make the post-commit prediction notify about
changes that happens in response to a successfully committed update. We
already predicted the new privacy screen state, so the necessary change
was to plumb the actual change into a callback which emits the signal if
there actually was a privacy screen change.

This will then be communicated via the same signal listener that already
listens to the 'resources-changed' signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2340>
2022-07-25 11:02:35 +00:00
Jonas Ådahl
1b0aa0b3ad kms: Rename MetaKmsUpdateChanges to MetaKmsResourceChanges
The name had a bit conceptual conflicts with MetaKmsUpdate, as it shared
its namespace but had no relation to it. Fix this by renaming it
MetaKmsResourceChanges (and the corresponding META_KMS_UPDATE_CHANGE_*
to META_KMS_RESOURCE_CHANGE_*). The term "resource" is used since that's
already used in the signal, and the fact that the changes partly comes
from changes in the DRM resource as retrieved by drmModeGetResources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2340>
2022-07-25 11:02:35 +00:00
Carlos Garnacho
633635d608 backend: Fix cursor visibility on X11 with only tablets as input
Since tablets on X11 drive the Virtual Core Pointer as every other
pointing device, we should consider it as a pointer device when
determining whether the pointer cursor should be visible.

Fixes the cursor being hidden if there are only tablets for input.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2283
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2518>
2022-07-25 10:12:50 +00:00
columbarius
b17a510309 screen-cast-stream: Timestamp buffers
With spa_meta_header we can timestamp our buffers so clients can relate
and synchronize media from different sources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2516>
2022-07-21 22:29:45 +00:00
columbarius
30b5229e0e screen-cast-stream: Use SPA_META_Header
With this header we can set a flag to signal that the whole buffer is
corrupt and should be ignored. With this we can cater to all cases:
* Window buffer fine, but cursor broken:
  Use the spa_meta_cursor properties like id or offset accordingly
* Window buffer broken, but cursor fine:
  Use the chunk flags
* Both are broken / the dequeued buffer is not usable
  Use the spa_meta_header flag

Additionally clients can now check if a buffer contains spa_meta_header
data and can thus only check for the new or the old behaviour.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2516>
2022-07-21 22:29:45 +00:00
Michel Dänzer
10c7ab2dec cursor-renderer/native: Fix type in unset_crtc_cursor_renderer_privates
Since the commit below, meta_crtc_kms_get_cursor_renderer_private has
returned a CrtcCursorData pointer, but this code was still treating it
as a MetaDrmBuffer pointer.

Fixes: fea8ebcca9 ("cursor-renderer/native: Store struct in CRTC private")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2524>
2022-07-21 21:03:18 +00:00
columbarius
82fd5cbdbd screen-cast-stream: Use flag to signal failed recording
PipeWire supports flags to signal a corrupted buffer. We should use the
flag SPA_CHUNK_FLAG_CORRUPTED for `chunk->flags` instead of setting
`chunk->size = 0` since the size isn't well defined for arbitrary dmabufs
and should be set to 0.
Sadly clients like obs are using a chunk size of 0 to decide if a buffer
should be imported. Thus we should offer both until clients are using
the flag.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2323>
2022-07-15 02:03:44 +02:00
José Expósito
5171e5b795 backends/native: Migrate discrete scroll
Change meta_seat_impl_notify_discrete_scroll_in_impl to receive 120
based values and report high-resolution scroll values as smooth scroll.

Notify discrete scroll only when the accumulated value reach 120.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
a1c50194a9 backends/native: Migrate continuous scroll
In order to get the delta X/Y value of the
LIBINPUT_EVENT_POINTER_SCROLL_FINGER
or LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS events the new function
libinput_event_pointer_get_scroll_value should be used instead of
libinput_event_pointer_get_axis_value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
5d884d49b5 backends/native: Deprecate LIBINPUT_EVENT_POINTER_AXIS
Ignore deprecated LIBINPUT_EVENT_POINTER_AXIS events and handle
LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER and
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead.

The scroll source is now encoded in the event type making
libinput_event_pointer_get_axis_source and translate_scroll_source
redundant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
Pascal Nowack
ab3931fec8 backends/screen-cast-stream-src: Set correct stride when using dmabufs
Currently, mutter hardcodes the stride of all recorded images in a
screencast to width * 4.
While this stride is valid for general memory buffers, it is not
necessarily valid for dmabuf buffers, as the driver may need a specific
alignment of the stride.
This can currently result into import failures, e.g. when using the AMD
driver.

To fix this issue, retrieve the actual dmabuf stride, when using dmabuf
screencasts, and set it as the stride value in the PipeWire buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1913
Fixes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/101
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2513>
2022-07-14 20:09:07 +02:00
Sebastian Keller
fe0a383d6f pointer-constraints/native: Fix borders array memory leaks
The borders arrays were not (fully) freed when going out of scope.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2337
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2497>
2022-07-06 19:27:20 +00:00
Sebastian Wick
14b7da4292 tests/edid: Test EDID CTA-861 parsing code
Parses a real-world EDID blob with CTA-861 EDID extension and compares
it to edid-decode output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
64362fcd76 edid: Parse CTA-861 HDR Static Metadata Data Block
Extract the supported HDR metadata type, supported Transfer Functions,
and display luminance characteristics.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
80626edfea edid: Parse CTA-861 Colorimetry Data Block (CDB)
Parses the CTA-861 extensions data blocks to extract the supported
colorimetry which can be set with the KMS connectors `Colorspace`
property.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
d76f9e6c4a edid: Parse CTA-861 EDID extension
This adds support for E-EDID extensions. Tags are allocated by VESA and
the CTA has such an extension defined in CTA-861.

The switch in `decode_ext_cta` is empty in this commit because we don't
parse any CTA-861 data blocks, yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
97c0d17596 edid: Fix EDID parsing function signatures
Parsing functions return a boolean so change the return type to reflect
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Jonas Ådahl
de2443bc3e edid: Prepare types for wider exposure
The EDID code is copy from elsewhere, without adapting to conventions
regarding e.g. API and types. Clean this up a bit, as EDID information
will be kept around longer when possible, to be used e.g. by color
management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Jonas Ådahl
43860110ff output/kms: Replace common mode bandwidth check with clock check
The pixel clock determines how fast pixels can be processed. When adding
non-native common modes, avoid adding modes that exceed the max pixel
clock frequency of the native modes. Avoiding these avoids potential
mode setting failures where the GPU can't handle the modeline since the
configured pixel clock is too fast. This replaces the "bandwidth" check
which used the number of pixels and refresh rate, which wasn't enough to
avoid incompatible modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2492>
2022-07-01 16:13:18 +02:00
Jonas Ådahl
53b52e26f5 screen-cast/monitor: Always use clutter_stage_paint_to_framebuffer()
'screen-cast/monitor-src: Use clutter_stage_paint_to_buffer'
(6c818cd8d5) made the non-dma-buf path use
clutter_stage_paint_to_buffer() to avoid running into direct scanout
issues. At a glance, the dma-buf paths didn't have the same issue since
it explicitly handled dma-bufs by blitting them.

What it also did was move the recording to an idle callback, to avoid
paint reentry issues. A side effect of this, however, is that it also
broke the dma-buf paths, as they rely on the back buffer existing, and
the stage view direct scanout already being setup, which it isn't in an
idle callback.

Fix this by using the dma-buf variant of
clutter_stage_paint_to_buffer(): clutter_stage_paint_to_framebuffer().
This has some negative performance impact, but we can't use
cogl_blit_framebuffer() when using an idle callback for recording.

Potential performance improvements to make things work more as they did
before is to enhance 'cogl_blit_framebuffer()' a bit, making it a vfunc
that could be implemented by MetaOnscreenNative. A flag to say whether
to look at the back or front buffer would let MetaOnscreenNative know
whether to use the already committed-to-KMS buffer, or the current back
buffer.

Fixes: 6c818cd8d5
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2282
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2462>
2022-06-28 09:54:40 +00:00
Olivier Fourdan
1c16e1cb9c backends: Move MetaKeyboardA11yFlags to a public header
The MetaKeyboardA11yFlags are used by gnome-shell to show a dialog
whenever a keyboard accessibility feature is switched using the
keyboard.

Unfortunately, commit c3acaeb25 renamed the Clutter flag to Meta and
moved them to a private header. As a result, gnome-shell do not show any
dialog anymore when a keyboard accessibility feature is activated.

Move the MetaKeyboardA11yFlags definition to a public header so that
gnome-shell can use it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2306
Fixes: c3acaeb25 - backends: Move keyboard a11y into backends
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2463>
2022-06-14 18:04:05 +02:00
Jonas Ådahl
6d46ffccbc pointer-constraints: Move min edge distance from backend to Wayland
The min distance to the right/bottom edge depends on Wayland concepts
(wl_fixed_t) and eventually geometry scale. Move the logic the Wayland
side of the pointer constraints machinery to avoid the backend trying to
figure this out without the proper data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Jonas Ådahl
94aaa65bd2 pointer-constraints/native: Remove old clutter float math work around
There were some coordinate nudging to avoid running into Clutter
floating point math issues related to coordinate transformations. Over
the years these things have improved, especially with the move to
graphene, so remove the old work around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Sebastian Wick
a49c4e188a backends/native: Use the PropTable to look up KMS values
We already look up all the metadata and values in the
MetaKmsConnectorPropTable so we can just use them instead of looking it
all up again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
4e3f3842a1 backends/native: Use MetaKmsPlaneRotation in plane updates
The ImplDeviceAtomic converts the MetaKmsPlaneRotation back to the
concrete KMS value. The MetaMonitorTransform is always directly
converted to a MetaKmsPlaneRotation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
981524c268 backends/native: Update PropTable on hotplug and remove parse callback
Updating the PropTable has the side effect that the parse callback now
also gets called on hotplug but it is used to initialize data. The parse
callbacks are moved to the read_state functions which are aware if this
is an initializing call or just an update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
1e06b346cb backends/native: Store Enum and Bitmask information in MetaKmsProp
Add functions for converting between the values used by DRM and the
enums/bitmasks used by mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
9519a84967 backends/native: Define all KMS properties in PropTable we actually use
Currently those properties are looked up manually or fixed values are
used when they should be looked up. The following commits will actually
make use of this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Jonas Ådahl
3776f9df8c x11/clutter-backend: Remove unused XSynchronize() call
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Jonas Ådahl
fdde7e0f37 x11: Let X11 connection owners call XSynchronize() themselves
Only make the context carry the boolean state, but move the two libX11
calls into their corresponding connection handler objects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Dor Askayo
a0ff90a329 kms/page-flip: Add a debug print with page flip event timings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2439>
2022-06-03 06:55:28 +00:00
Jonas Ådahl
16af2e407b gpu/xrandr: Gracefully handle 0.0 refresh rate
We don't make use of the refresh rate in any useful way in the X11, and
in this case we just ended up with warnings since the refresh rate was
NaN. Fix this by making it 0.0 to mean "no refresh rate". This also is
what 'xrandr' itself reports.

Fixes warnings when launching 'mutter --x11' in Xvfb.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
f5887a6258 monitor-manager: Make warning message less confusing
It talked about KMS state, which was a bit unexpected when debugging the
X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
c9960850c8 tests/kms/render: Add direct scanout test case
This adds a minimalistic fullscreen direct scanout test case, that runs
on vkms. It doesn't use EGL, and it uses uninitialized memory, thus it
lacks any kind of implicit synchronization, but it does test that the
scanout selection paths are working.

What is tested is:

  * DMA buffer allocated using gbm on top of VKMS
  * Buffer passes a mode setting TEST_ONLY check
  * Paint is omitted
  * Correct buffer active in KMS after presentation

What isn't yet tested:

  * Implicit synchronization related behavior
  * Presented pixel content

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
a2ebd10f04 kms/crtc: Determine gamma support given the gamma length
The property doesn't necessarily exist when using drivers that doesn't
support atomic mode setting, and the way it worked will break night
light and other gamma related features. This makes things use the gamma
length; if it is higher than 0, it definitely supports it one way or the
other, i.e. GAMMA_LUT with the atomic backend, and drmModeCrtcSetGamma()
with the legacy/simple backend.

Fixes: 364572b95c
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2287
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Jonas Ådahl
9001fa9717 kms/crtc: Always read the gamma state
It doesn't depend on whether the CRTC is active or not, so always read
it. This is also useful to know whether a CRTC supports gamma, before it
is being turned on, without relying on the existance of properties.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Bilal Elmoussaoui
c861101ae6 backend: Check if the gsettings scheme exists
Mutter makes use of a gsettings scheme that comes from
gnome-settings-daemon to check for the screen orientation.
In use cases where gnome-settings-daemon is not available,
this would lead to a crash as the key doesn't exists

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2398>
2022-05-17 11:24:07 +02:00
Jonas Ådahl
8fdb80a718 monitor-manager: Add NightLightSupported property to DisplayConfig
This checks whether it's possible to set a CRTC GAMMA_LUT, which is what
is necessary to implement night light.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2310>
2022-05-17 08:42:25 +00:00
Marco Trevisan (Treviño)
c93e402a89 monitor-manager: Ensure monitors settings after backend has been updated
The monitors settings such as the privacy screen property is propagated
to the monitors via kms updates, however during initialization and
on monitors changes, we end up clearing the pending KMS updates because
such settings are added to the queue before the backend has fully
initialized the monitors, and this may lead to discarding all the
pending updates, including the one we've just planned.

To avoid this, move settings applications after we've both initialized
the backend and notified it about changes.

Also avoid to try set the settings during actual initialization, but
delay that after post-init.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2372>
2022-05-11 18:13:46 +00:00
Dor Askayo
61c9e344e4 screen-cast/src: Avoid undefined behavior with GSource
Follow the existing convention in Mutter and avoid downcasting
custom GSource structs.

This fixes the following warning:
    ../src/backends/meta-screen-cast-stream-src.c:1301:20: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
    /usr/include/glib-2.0/glib/glib-typeof.h:36:36: note: in definition of macro ‘glib_typeof’
       36 | #define glib_typeof(t) __typeof__ (t)
          |                                    ^
    ../src/backends/meta-screen-cast-stream-src.c:1301:3: note: in expansion of macro ‘g_clear_pointer’
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
          |   ^~~~~~~~~~~~~~~

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2406>
2022-05-11 15:01:31 +00:00
Jonas Ådahl
5404eb34f8 kms/impl/simple: Make sure cursor buffers have fb ids
'kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer'
changed how fb ids are generated, but it only made it fully work with
atomic mode setting. For legacy/simple mode setting, it only handled the
primary plane buffer, not the hardware cursor.

Fix this by making sure the fb id is generated also in the legacy mode
setting case.

Fixes: ea39142da2
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2250
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2397>
2022-05-03 21:45:19 +00:00
Jonas Ådahl
b1be1e86e9 screen-cast: Always wait for an update before sending cursor-only frames
With the unthrottled input emission, we ended up often getting the
cursor updates long before any damage had been posted, meaning that if
you moved around the mouse pointer where the mouse had a high enough
refresh rate, we'd effectively stall the screen cast stream by only
sending cursor updates and nothing else.

Fix this by scheduling an update when we get a cursor update, then
sending a cursor-only frame after any damage and relayout has been
processed, but only if there is no queued damage that will cause an
actual repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Jonas Ådahl
c5410b61d2 screen-cast/window/src: Fix signal handler types
Should be gulong, not unsigned long.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Jonas Ådahl
2cfd4f325b cursor-renderer/native: Support allocating dumb buffers
This makes it possible to allocate HW cursor without a gbm_device, e.g.
when using EGLStream/EGLDevice.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1980
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
42ed40ac52 cursor-renderer/native: Move buffer creation to helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
ea39142da2 kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer
This avoids buffer implementation specific code where it shouldn't
matter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
22d11eb9cb drm-buffer: Keep track of handle as well
This handle is used by the legacy KMS API; lets avoid having to have GBM
specific code where this is done by letting the MetaDrmBuffer API, that
already has this information, expose it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
b2eec49873 screen-cast: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
5da8e5a9d5 barrier: Remove _ prefix in various places
It's not a convention used anywhere else anymore, lets remove the
prefixes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
1a5647e00c barrier: Some coding style cleanup
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
358df1c569 screen-cast/src: Always allow MemFd buffer types to be selected
Just because the PipeWire client can handle DMA buffers, doesnt mean we
should not advertise support for MemFd.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Jonas Ådahl
2b4a24132b screen-cast: Test allocate DMA buffer with implicit API
DMA buffers might be allocatable, but it doesn't mean the driver doesn't
fail when we try to allocate a buffer with an implicit modifier. Using
the proprietary NVIDIA driver for example, it will fail. Lets catch this
up front and avoid advertising DMA buffer support when we know it won't
work.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Sebastian Wick
43ae37a93e backends/native: Update cursor also when scaled or transformed
MetaCursorRendererNative only updates the cursor state when the
underlying texture changes. The cursor scale and transform do not
trigger updates. This results in wrong cursor orientations on rotated
displays. Use both texture changes and scale and transformation changes
to figure out when to update the cursor state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2363>
2022-04-21 11:23:15 +00:00
Łukasz Spintzyk
ad838ec540 renderer/native: Restore EGL state after creating secondary GPU state
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2347>
2022-04-20 09:30:04 +00:00
Daniel van Vugt
af7e116b94 cursor-renderer/native: Remove unused DRM_CAP_CURSOR_{WIDTH,HEIGHT}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2361>
2022-04-20 08:28:06 +00:00
Daniel van Vugt
be9deeba09 crtc/kms: Don't add gamma to the update if unsupported by the CRTC
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2197
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
364572b95c kms/crtc: Add function meta_kms_crtc_has_gamma
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
cc20584032 kms/crtc: Add debug logging of supported vs unsupported properties
Unsupported properties are particularly common in an Nvidia/hybrid
setup so we don't want to make it a warning that's always visible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
e3cba9f2d8 kms/crtc: Fix typo s/proporties/properties/
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
14ab0238d0 stage/x11: Remove trailing whitespace
To avoid check-code-style warnings in other MRs that touch this file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2373>
2022-04-13 14:35:59 +08:00
Daniel van Vugt
dd94c448e9 kms/device: Disable modifiers when !DRM_CAP_ADDFB2_MODIFIERS
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2210
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Daniel van Vugt
11e6100226 kms/impl-device: Add addfb2_modifiers to MetaKmsDeviceCaps
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Corentin Noël
50c91bca75 cursor-tracker: Add missing annotation to meta_cursor_tracker_get_pointer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2362>
2022-04-05 14:05:22 +02:00
Daniel van Vugt
9a23ed98e7 onscreen/native: Fix typo in log message "the the"
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2357>
2022-04-04 17:36:37 +08:00
Daniel van Vugt
8354289650 onscreen/native: Fall back if COPY_MODE_SECONDARY_GPU fails to init
This can happen if we've got a GBM driver that is incomplete or
buggy for any reason. Currently this includes the Nvidia driver
when used as a secondary GPU, and as soon as they fix that it will
use the fast path instead.

Falling back means we can still use it as a KMS device with all rendering
done on the primary GPU instead. Just like a DisplayLink.

It's slow, but at least the screens all light up now and you get a
usable desktop. Surprisingly it's still a better experience than using
Xorg, maybe because we can flip the outputs independently with the
native backend.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2166,
       https://gitlab.gnome.org/GNOME/mutter/-/issues/2182,
       https://launchpad.net/bugs/1959888,
       https://launchpad.net/bugs/1964037

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Daniel van Vugt
41bfabad96 onscreen/native: Don't try rendering on a secondary GPU without EGL
We rather confusingly still call a secondary display card that is
GPU-less (DisplayLink or other basic KMS device) a "secondary GPU",
so just because secondary_gpu_state is non-NULL doesn't mean we
can use it for rendering. The clearest indication of this is when
there is no EGL surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Carlos Garnacho
286562ea53 backends: Update MetaInputSettings to apply settings based on capabilities
Since devices may be multiple things now, check all capabilities in order
to ensure all aspects of the device are correctly configured.

This change does the following observations:
- Devices that have TOUCHPAD | POINTER capabilities prefer the 'touchpad'
  settings path. The regular pointer settings path is left for all
  non-touchpads.
- Devices that are both a tablet and a touchscreen prefer the tablet
  relocatable schema. This works for both aspects as the touchscreen
  schema is a subset of the tablet one.

Other than that it's a rather boring, even if verbose search and replace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
1f3fb8441f backends/native: Assign capabilities to input devices
These are extracted from the individual libinput_devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
842295838f backends/native: Make function to determine ClutterInputDeviceType private
We do not need to open code the ClutterInputDeviceType fetching from a
libinput_device, since we already created a native ClutterInputDevice that
has the right type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Ivan Molodetskikh
690b8806dd backends/native: Change uint32_t modifiers to uint64_t
They were erroneously cast to uint32_t. In particular this prevented the
invalid modifier from working as it is equal to a 64-bit -1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2322>
2022-03-06 16:56:27 +03:00
Jonas Ådahl
46f81afb3b kms/impl-device/atomic: Fix function type signature
The property enum type was wrong.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
339c315ed9 input-settings/native: Fix switch fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
43870a5f55 input-settins/x11: Fix switch fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
79319a3a91 barrier/native: Fix warning about implicit enum conversion
Also add static asserts to make sure the values match so casting can be
done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
1e50ca0057 remote-desktop/virtual: Drop absolute events if not active
If the remote desktop service emits absolute input events (e.g. absolute
pointer events) before the stream has started streaming, we don't have a
virtual monitor, as the size has not been negotiated yet. When this
happens, just drop the event. Remote desktop services should probably
make sure not to send events before the streaming has started, but them
doing so anyway shouldn't trigger a crash, which would be the case
otherwise.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
4de740c7a3 screen-cast/virtual-src: Don't recreate the virtual monitor on resizes
Keep the virtual monitor around if it's being resized. This reduces the
number of unnecessary object rebuilding that happen during monitor
rebuilding.

This changes finalize() vfunc into a dispose() vfunc in the abstract
stream source object implementation, as it needs the abstract stream
source object to close the stream early, so that various signal
listeners get disconnected early.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1904
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
34d0e68aef virtual-monitor: Add way to change virtual monitor mode
This can be used to change the size of the virtual monitor without
recreating it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
a97b6560d7 virtual-monitor: Never reuse mode IDs
We'll change mode's on-demand so using IDs identical to the virtual
monitor ID would mean IDs didn't change when changing mode, and that is
rather unintuitive. IDs don't mean much anyhow, just make them grow
within the realm of a 63 bit unsigned integer, as the 64th bit means its
a virtual mode ID. Making sure the ID is in the virtual mode namespace
is handled by meta_crtc_mode_virtual_new().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
ee8de0dc83 backend/native: Remove unused ID namespace macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
46a4a080b7 virtual-monitor: Split out mode info into separate struct
Will help when changing virtual monitor modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
fadffe3fad wayland/xdg-shell: Add toplevel bounds support
This implements the new 'bounds' event that is part of the xdg_toplevel
interface in the xdg-shell protocol. It aims to let clients create
"good" default window sizes that depends on e.g. the resolution of the
monitor the window will be mapped on, whether there are panels taking up
space, and things like that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Carlos Garnacho
e736b04deb clutter: Remove "source" event union fields
These are no longer used, drop the last places that modify those
in event structs and remove them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Ivan Molodetskikh
bcf6ee5e55 Name unnamed sources
These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
2022-03-04 10:10:05 +03:00
Bilal Elmoussaoui
7717383deb meson: Allow to build without gnome-desktop
gnome-desktop is used to retrieve the monitor vendor name which in some
use cases is not needed  as it brings a bunch of gnome-desktop unwanted
dependencies.
The change makes mutter fallback to an "Undefined" vendor name if it is
built without gnome-desktop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2317>
2022-03-03 15:07:38 +00:00
Alfonso Sánchez-Beato
8ccbb32f71 egl: Fix number of configs returned in meta_egl_choose_all_configs
Return in meta_egl_choose_all_configs() the actual number of
configurations returned by eglChooseConfig(), which are not
necessarily the same number as those from eglGetConfigs().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2303>
2022-03-03 08:18:56 +00:00
Jonas Dreßler
672696f823 dnd: Notify about events during compositor grab from event filter
Since the introduction of ClutterGrabs, MetaDnd now no longer gets
notified about input events on the stage during grabs (for example while
the alt-tab popup is shown) and thus can't move the grab feedback actor
anymore.

To fix this, forward events to MetaDnD directly from
meta_display_handle_event() when a ClutterGrab is in effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Daniel van Vugt
b7f7b82b89 onscreen/native: Warn instead of crashing if the frame_info queue is empty
Some Ubuntu systems with mutter 40 and 41 report `maybe_update_frame_info`
crashes with SIGSEGV when `frame_info == NULL`.

The same was reported by @rmader as happening "after wakeup" in testing
(https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441#note_1301588)
although the Ubuntu reports show it's not related to that MR.

Fixes: https://launchpad.net/bugs/1960585
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2282>
2022-02-14 10:51:18 +00:00
Jonas Ådahl
ca5488c3d6 monitor-manager: Don't introspect "monitor-privacy-screen-changed"
It passes a MetaLogicalMonitor, which isn't introspected right now, so
skip it completely. The entry point to the UI is handled via
MetaDisplay, so it isn't needed.

This fixes the following warning:

<unknown>:: Warning: Meta: (Signal)monitor-privacy-screen-changed: argument object: Unresolved type: 'MetaLogicalMonitor'

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2287>
2022-02-14 10:01:54 +00:00