1
0
Fork 0
Commit graph

1324 commits

Author SHA1 Message Date
Jonas Ådahl
2f4a68c8c3 Clean up include macros mess
The order and way include macros were structured was chaotic, with no
real common thread between files. Try to tidy up the mess with some
common scheme, to make things look less messy.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
8a03f1ad02 Always generate meta-default-modes.h
This adds a hard requirement on having cvt installed, which in the past
was soft, where the generated file was added to the repository.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
530861b24d cogl: Remove left-over WebGL paths 2018-11-06 17:17:36 +01:00
Jonas Ådahl
7b2eaa76a4 cogl: Remove support for GLESv1
We have no need for it in mutters cogl variant.
2018-11-06 17:17:36 +01:00
Pekka Paalanen
4282067e24 gpu-kms: assert on invalid flip attempts
drmModePageFlip() is guaranteed to fail for the invalid FB id 0.
Therefore it never makes sense to call this function with such argument.
Disabling a CRTC must be done with SetCrtc instead, for example.

Trying to flip to FB 0 not only fails, but it also causes Mutter to
never try page flip on this output again, using drmModeSetCrtc()
instead.
2018-10-25 09:57:39 +00:00
Pekka Paalanen
85e9784a22 renderer/native: fix next_fb_id race on CPU copy path
There was a race in setting next_fb_id when a secondary GPU was using
the CPU copy path. Losing this race caused the attempt to
drmModePageFlip () to FB ID 0 which is invalid and always fails. Failing
to flip causes Mutter to fall back to drmModeSetCrtc () permanently.

In meta_onscreen_native_swap_buffers_with_damage ():
- update_secondary_gpu_state_pre_swap_buffers ()
  - copy_shared_framebuffer_cpu () but only on the CPU copy path
    - secondary_gpu_state->gbm.next_fb_id is set
- wait_for_pending_flips ()
  - Waits for any remaining page flip events and executes and destroys
    the related page flip closures.
    - on_crtc_flipped ()
      - meta_onscreen_native_swap_drm_fb ()
        - swap_secondary_drm_fb ()
	  - secondary_gpu_state->gbm.next_fb_id = 0;
- meta_onscreen_native_flip_crtcs ()
  - meta_onscreen_native_flip_crtc ()
    - meta_gpu_kms_flip_crtc () gets called with fb_id = 0

This race was observed lost when running 'mutter --wayland' on a machine
with two outputs on Intel and one output on DisplayLink USB dock, and
wiggling around a weston-terminal window between the Intel and
DisplayLink outputs. It took from a second to a minute to trigger. For
testing with DisplayLink outputs Mutter also needed a patch to take the
DisplayLink output into use, as it would have otherwise been ignored
being a platform device rather than a PCI device.

Fix this race by first waiting for pending flips and only then
proceeding with the swap operations. This should be safe, because the
pending flips could have completed already before entering
meta_onscreen_native_swap_buffers_with_damage ().
2018-10-25 09:57:39 +00:00
Daniel Drake
6267732bec monitor-manager: use MonitorsConfig to track switch_config
When constructing MetaMonitorsConfig objects, store which type
of switch_config they are for (or UNKNOWN if it is not such
type of config).

Stop unconditionally setting current_switch_config to UNKNOWN when
handling monitors changed events. Instead, set it to the switch_config
type stored in the MonitorsConfig in the codepath that updates logical
state. In addition to being called in the hotplug case along the same
code flow that generates monitors changed events, this is also called
in the coldplug case where a secondary monitor was connected before
mutter was started.

When creating the default linear display config, create it as a
switch_config so that internal state gets updated to represent
linear mode when this config is used.

The previous behaviour of unconditionally resetting current_switch_config
to UNKNOWN was breaking the internal state machine for display config
switching, causing misbehaviour in gnome-shell's switchMonitor UI when
using display switch hotkeys. The lack of internal tracking when the
displays are already in the default "Join Displays" linear mode was
then causing the first display switch hotkey press to do nothing
(it would attempt to select "Join Displays" mode, but that was already
active).

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/281
https://gitlab.gnome.org/GNOME/mutter/merge_requests/213
2018-10-08 15:53:45 +08:00
Pekka Paalanen
a3d826c54b renderer/native: honour dumb buffer stride
meta_renderer_native_gles3_read_pixels() was assuming that the target
buffer stride == width * 4. This is not generally true. When a DRM
driver allocates a dumb buffer, it is free to choose a stride so that
the buffer can actually work on the hardware.

Record the driver chosen stride in MetaDumbBuffer, and use it in the CPU
copy path. This should fix any possible stride issues in
meta_renderer_native_gles3_read_pixels().
2018-10-04 11:57:35 +03:00
Pekka Paalanen
72e236106f renderer/native: assert dumb buffer size on CPU copy
Track the allocated dumb buffer size in MetaDumbBuffer. Assert that the
size is as expected in copy_shared_framebuffer_cpu().

This is just to ensure that Cogl and the real size match. The size from
Cogl was used in the copy, so getting that wrong might have written
beyond the allocation.

This is a safety measure and has not been observed to happen yet.
2018-10-04 11:57:35 +03:00
Pekka Paalanen
3e1ca62782 renderer/native: check format for drmModeAddFB fallback
If drmModeAddFB2() does not work, the fallback to drmModeAddFB() can
only handle a single specific format. Make sure the requested format is
that one format, and fail the operation otherwise.

This should at least makes the failure mode obvious on such old systems
where the kernel does not support AddFB2, rather than producing wrong
colors.
2018-10-04 11:57:35 +03:00
Tony Novak
8685de9607 input-settings: detect trackball using udev ID_INPUT_TRACKBALL
Previously, trackballs were detected based on the presence of the
substring "trackball" in the device name. This had the downside of
missing devices, such as the Kensington Expert Mouse, which don't have
"trackball" in their names.

Rather than depending on the device name, use the ID_INPUT_TRACKBALL
property from udev to determine whether or not to treat a device as a
trackball.

This adds a new function, `is_trackball_device`, to MetaInputEvents, and
eliminates the `meta_input_device_is_trackball` function.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/258
2018-09-19 08:48:27 +00:00
Florian Müllner
a3d9f987c8 input-settings-x11: Push error trap
Pops are lonely without push, so add one for a happy error trap.

https://gitlab.gnome.org/GNOME/mutter/issues/294
2018-09-07 19:42:37 +02:00
Jonas Ådahl
ebafc256a0 renderer/native: Check calculated transform when creating view
The "backends: Move MetaOutput::crtc field into private struct"
accidentally changed the view transform calculation code to assume that
"MetaCrtc::transform" corresponds to the transform of the CRTC; so is
not the case yet; one must calculate the transform from the logical
monitor, and check whether it is supported by the CRTC using
meta_monitor_manager_is_transform_handled(). This commit restores the
old behaviour that doesn't use MetaCrtc::transform when calculating the
view transform.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/216
2018-08-24 11:51:36 +00:00
Iain Lane
deb541ef5a monitor-manager-kms: Check if GPUs can have outputs
We need a way for mutter to exit if no available GPUs are going to work.
For example if gdm starts gnome-shell and we're using a DRM driver that
doesn't work with KMS then we should exit so that GDM can try with Xorg,
rather than operating in headless mode.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/223
2018-08-21 13:16:22 +00:00
Iain Lane
29cc526e2e gpu-kms: Handle drmModeGetResources() failing
Avoid dereferencing the NULL return value if it fails. We still create
the MetaGpu, but we treat it as if it has no outputs.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/223
2018-08-21 13:16:21 +00:00
Jonas Ådahl
7c06e21e5a idle-monitor: Store either 1 or 0 in the inhibited gboolean
Wrap the flag checking in !!(..) to make sure we always either store
TRUE or FALSE in the gboolean.
2018-08-14 15:14:05 +00:00
Jeff Smith
1bfa20929b backends/x11: Improve grab-device clock updates
meta_backend_x11_grab_device is performing X server clock comparison
using the MAX macro, which comes down to a simple greater-than.

Use XSERVER_TIME_IS_BEFORE, which is a better macro for X server
clock comparisons, as it accounts for 32-bit wrap-around.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/174
2018-08-13 21:00:33 +02:00
Jonas Ådahl
37eeda0320 Revert "gpu-kms: Handle drmModeGetResources() failing"
This reverts commit acf70a3561
2018-08-10 16:31:03 +00:00
Iain Lane
acf70a3561 gpu-kms: Handle drmModeGetResources() failing
Avoid dereferencing the NULL return value if it fails. We still create
the MetaGpu, but we treat it as if it has no outputs.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/223
2018-08-10 16:35:17 +01:00
Alex Villacís Lasso
f7af32a3ea renderer/native: Fallback to non-planar API if gbm_bo_get_handle_for_plane fails
Commit c0d9b08ef9 replaced the old GBM API calls
with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane
fails for some DRI drivers (in particular i915). Due to missing error checks,
the subsequent call to drmModeAddFB[2] fails and the screen output locks up.

This commit adds the missing error checks and falls back to the old GBM API
(non-planar) if necessary.

v5: test success of gbm_bo_get_handle_for_plane instead of errno

This commit adopts solution proposed by Daniel van Vugt to check the return
value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old
non-planar method if the call fails. This removes the errno check (for
ENOSYS) that could abort if mesa ever sets a different value.

Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127
2018-08-09 12:36:34 +00:00
Florian Müllner
7fdaf7721c Don't cast free function passed to g_clear_pointer
The function is intentionally provided as macro to not require a
cast. Recently the macro was improved to check that the passed in
pointer matches the free function, so the cast to GDestroyNotify
is now even harmful.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
2018-07-31 23:40:01 +02:00
Florian Müllner
c403785d36 Stop using g_type_class_add_private()
It is now deprecated in favor of the G_ADD_PRIVATE() macro (usually
called via G_DEFINE_WITH_PRIVATE()).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
2018-07-31 23:40:01 +02:00
Jonas Ådahl
4d465eac08 monitor: Use current monitor mode to check whether active
For historical reasons meta_monitor_is_active() checked whether it is
active by checking whether the main output have a CRTC assigned and
whether that CRTC has a current mode. At a later point, the MetaMonitor
got its own mode abstraction (MetaMonitorMode), but
meta_monitor_is_active() was never updated to use this.

An issue with checking the main output's CRTC state is that, if there is
some CRTC mode combination that for some reason isn't properly detected
by the MetaMonitorMode abstraction (e.g. some tiling configuration not
yet handled), meta_monitor_is_active() would return TRUE, even though no
(abstracted) mode was set. This would cause confusion here and there,
leading to NULL pointer dereferences due to the assumption that if a
monitor is active, it has an active mode.

Instead, change meta_monitor_is_active() to directly check the current
monitor mode, and log a warning if the main output still happen to have
a CRTC with a mode assigned to it. This way, when an not undrestood CRTC
mode combination is encountered, instead of dereferencing NULL pointers,
simply assume the monitor is not active, which means that it will not be
managed or rendered by mutter at all.

https://gitlab.gnome.org/GNOME/mutter/issues/130
2018-07-31 13:37:03 +02:00
Andrea Azzarone
649c26e05a monitor-manager: Filter out low screen resolutions
Avoid exporting through org.gnome.Mutter.DisplayConfig.GetCurrentState
excessively-low screen resolutions setting both a minimum width and a minimum
height. GetCurrentState is e.g. used by Gnome Control Center to build a list of
selectable resolutions.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=793223
2018-07-30 15:57:31 +02:00
Jonas Ådahl
6e953e2725 native/gpu: Handle drmModeSetCrtc() failing gracefully
If drmModeSetCrtc() is called with no fb, mode or connectors for some
CRTC it may still fail, and we should handle that gracefully instead of
assuming it failed to set a non-disabled state.

Closes https://gitlab.gnome.org/GNOME/mutter/issues/70
2018-07-25 07:49:52 +00:00
Jonas Ådahl
5f37369adb Add remote access controller API
Add API to let GNOME Shell have the ability to get notified about remote
access sessions (remote desktop, remote control and screen cast), and
with a way to close them.

This is done by adding an abstraction above the remote desktop and
screen cast session objects, to avoid exposing their objects to outside
of mutter. Doing that would result in external parts holding references
to the objects, complicating their lifetimes. By using separate wrapper
objects, we avoid this issue all together.
2018-07-20 16:49:49 +02:00
Bastien Nocera
fa9e330f2c backend: Remove direct upower-glib usage
Monitor whether UPower is running ourselves. That allows us to keep the
same value for "lid-is-closed" throughout the process of UPower
restarting, preventing unwanted monitor re-configuration through the process.

Fixes another screen black out when UPower restarts and the laptop lid
is closed.
2018-07-18 10:17:37 +00:00
Bastien Nocera
951219650f backend: Move lid-is-closed handling to MetaBackend
Rather than handle UpClient in both MetaBackend (to reset the idletime
when the lid is opened), and in MetaMonitorManager and
MetaMonitorConfigManager (to turn the screen under the lid on/off
depending on its status), move the ability to get the lid status from
UPower or mock it in one place, in MetaBackend.
2018-07-18 10:17:36 +00:00
Bastien Nocera
49b23c7490 monitor-manager: Cache the last known value of "lid-is-closed"
Restarting UPower will make every property of UpClient emit a "notify"
signal (as a GDBusProxy would). Avoid mutter reconfiguring the displays
when upower restarts by caching the last known value of "lid-is-closed"
and only reconfiguring the displays if it actually changed.

This fixes a black out of the screen when UPower restarts.
2018-07-18 10:17:35 +00:00
Bastien Nocera
644a618fb1 monitor-manager: Don't throw an error if UPower isn't running
Don't try to connect to a UpClient signal if creating the client failed,
because UPower isn't running for example.
2018-07-18 10:17:34 +00:00
Bastien Nocera
1e3ac3cf2c backends/native: Remove unused upower-glib header
Wasn't removed in 657417a.
2018-07-18 10:17:34 +00:00
Jonas Ådahl
041be7c565 screen-cast-src: Allow negotiating the framerate
The framerate for screen cast sources was set to variable within 1 FPS
and the framerate of the monitor being screen casted. This meant that if
the sink didn't match the framerate (e.g. had a lower max framerate),
the formats would not match and a stream would not be established.

Allow letting the sink clamp the framerate range by setting it as
'unset', allowing it to be negotiated.
2018-07-13 08:59:14 +00:00
Jonas Ådahl
0407a8b33d screen-cast-src: Port to pipewire master
The PipeWire master branch saw some backports from the work branch,
including API changes making the 0.1 series more aligned with future
plans. Make mutter use the new API. This is needed to avoid dead locks
that existed in the older version.
2018-07-12 20:25:40 +00:00
Iain Lane
89162a90aa launcher: First check if we are in a login session
For mutter developers we still want to support running from a VT, which
will be in a different login session.

Fixes #218
2018-07-10 08:43:35 +00:00
Iain Lane
4837ea3434 meta-launcher: Find the current user's graphical session, not the pid's
If we're started by systemd --user, we might not be in the same session,
but this is nevertheless the one we are interested in.
2018-07-07 14:12:29 +01:00
Jonas Ådahl
3fbeeb9072 backends/x11: Force-update cursor when theme or size changed
Force update the cursor renderer after theme or size changes; otherwise
we'll be stuck with the old theme and/or size until something else
triggers resetting of the cursor.
2018-07-06 19:54:46 +02:00
Armin Krezović
390314adfb Rename errors.[ch] to meta-x11-errors.[ch]
Also rename meta_error_trap_* to meta_x11_error_trap_* and
move meta-x11-errors.c to src/x11

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:17 +02:00
Jonas Ådahl
2ac7afe8a9 remote-desktop: Remove unnecessary include
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:17 +02:00
Armin Krezović
43f9cd537e Fix XDND handling to work without GDK and MetaX11Display
This fixes mutter --nested --wayland without X11

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
8e7e1eeef5 Prepare for making MetaX11Display conditional
- Stop using CurrentTime, introduce META_CURRENT_TIME
- Use g_get_monotonic_time () instead of relying on an
  X server running and making roundtrip to it

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
1d5e37050d Stop using MetaScreen where it is unnecessary
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
e1c67a1824 Move monitor management API to MetaDisplay
This includes changing various users to use MetaDisplay directly, who
used MetaScreen only for this before.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
722c975aca Move alarm and xids management to MetaX11Display
https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
c64d5ad8af Move X11 extension queries to MetaX11Display
Also split extension queries into their own functions

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
dacc041d0c Switch meta_error_trap functions to MetaX11Display
They are X11 specific functions, used for X11 code. They have been
improved per jadahl's suggestion to use gdk_x11_lookup_xdisplay and
gdk_x11_display_error_trap_* functions, instead of current code.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Armin Krezović
18779109de Start populating MetaX11Display
- Moved xdisplay, name and various atoms from MetaDisplay
- Moved xroot, screen_name, default_depth and default_xvisual
  from MetaScreen

- Moved some X11 specific functions from screen.c and display.c
  to meta-x11-display.c

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:47:16 +02:00
Jonas Ådahl
768ec15ea0 backends: Add logical monitor -> monitor -> output -> crtc ref chain
Make it so that each logical monitor has a reference to all the
monitors that are assigned to it.

All monitors has a reference to each output that belongs to it.

Each output has a reference to any CRTC it has been assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=786929
2018-06-28 13:42:15 +02:00
Jonas Ådahl
1200182d70 backends: Move MetaOutput::crtc field into private struct
No functional changes. This is only done so that changes to reference
counting can done more reliably.

https://bugzilla.gnome.org/show_bug.cgi?id=786929
2018-06-28 13:42:15 +02:00
Jonas Ådahl
d9c18fd5bb monitor-manager: Add back warning messages
For some reason "backends: Remove X11 idle-monitor backend" removed
unrelated warning messages for when generated monitor configurations
that should work didn't, which also made the unit tests fail.

This commit adds them back, which also makes the tests pass again.
2018-06-28 11:23:39 +00:00
Miguel A. Vico
1bf2eb95b5 renderer/native: Choose first EGL config for non-GBM backends
Commit 712ec30cd9 added the logic to only
choose EGL configs that match the GBM_FORMAT_XRGB8888 pixel format.
However, there won't be any EGL config satisfying such criteria for
non-GBM backends, such as EGLDevice.

This change will let us choose the first EGL config for the EGLDevice
backend, while still forcing GBM_FORMAT_XRGB8888 configs for the GBM
one.

Related to: https://gitlab.gnome.org/GNOME/mutter/issues/2
2018-06-15 19:43:04 +00:00
Jonas Ådahl
516fb524cb cursor-render/native: Realize hw cursor lazilly
Where to realize a hardware cursor depends on where on the screen it
will be displayed. For example it only needs buffers for the cursor
plane on a certain GPU if it overlaps with a monitor that is connected
said GPU.

Previously, we were too eager with uploading the cursor plane buffers,
which in effect resulted in the secondary GPU always being woken up
when changing the cursor, even though the cursor plane would actually
never be set unless the pointer cursor was moved to a monitor connected
to the secondary GPU. These wake-ups caused noticable stuttering; thus
by uploading the buffers more lazilly, the stuttering is avoided.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:56 +00:00
Jonas Ådahl
596b30096d cursor-renderer/native: Don't trigger redraw when cursor hidden
When a cursor is hidden, the native backend will properly hide the HW
cursor sprite as well, but it would communicate this as if the cursor
was not handled by the backend, while in fact it still was. This caused
the generic cursor rendering layer to queue a redraw.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:56 +00:00
Jonas Ådahl
7412794c66 cursor-renderer/native: Update hw state via generic update path
When force-updating the HW state we might end up with a situation where
the HW cursor is no longer usable. If this would happen, we'd before
this commit not trigger the fallback paths using a GL texture.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:55 +00:00
Jonas Ådahl
ad22b3f098 backend/native: Remove unnecessary cursor renderer update
It is already handled by the monitor-updated-internal signal handler in
meta-cursor-renderer-native.c, which will always be called indirectly
by resuming the monitor manager.

While at it, remove a useless comment.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:55 +00:00
Jonas Ådahl
206634e0ed cursor-renderer: Rename update_cursor function
Call it meta_cursor_renderer_update_cursor. This avoids confusing it
with the update_cursor MetaCursorRendererClass vfunc when navigating
the file.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:55 +00:00
Jonas Ådahl
ea05d2af49 cursor-renderer/native: Let the backend realize cursor sprite itself
It knows better when it's needed. For now, just do it just as before,
before drawing. Eventually, we can conditionalize where to realize
depending on the cursor sprite position.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:55 +00:00
Jonas Ådahl
6c7c566c6c cursor-renderer/native: Fix Xcursor image loading error handling
Check the return value whether there was an error, and change to
g_warning to warn while at it.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:54 +00:00
Jonas Ådahl
b596cf97ee cursor-renderer/native: Rename frame scheduling helper function
The function conditionally schedules a cursor animation frame, so
rename it to make that clearer.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:54 +00:00
Jonas Ådahl
9dcf9782b6 cursor-renderer: Centralize hw cursor realization paths
Use a common entry point into the cursor renderer implementations HW
cursor realization paths for all cursor sprite types. This is in
preparation for realizing at more strategic times.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:53 +00:00
Jonas Ådahl
0f519ffb05 cursor-renderer/native: Various whitespace fixes
https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:53 +00:00
Jonas Ådahl
42c78bd41f cursor-renderer/native: Fetch instead of pass wl_buffer when realizing
This is the next step in centralizing the cursor sprite hw sprite
realization paths.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:53 +00:00
Jonas Ådahl
b702c0fa5c cursor-renderer/native: Shorten some helper function names
Purely a cosmetic change, making a couple of unnecessarily long function
name shorter.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:53 +00:00
Jonas Ådahl
c80fd487f1 cursor-renderer: Fetch instead of pass Xcursor image when realizing
The end goal here is to being able to realize at any point in time
through a single API, so start by moving state into the cursor sprite
implementation.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:52 +00:00
Jonas Ådahl
817c8e568c wayland: Add wl_surface backed cursor sprite implementation
This removes the last use of the non-abstract form of MetaCursorSprite
usage.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:52 +00:00
Jonas Ådahl
b8336633a7 cursor-tracker: Split out XFIXES cursor code into cursor sprite type
Remove some X11 compositing manager specific code from the general
purpose cursor tracker into a new MetaCursorSprite based special
purpose XFIXES cursor sprite.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:51 +00:00
Jonas Ådahl
3c538d4a92 backends/cursor: Move out Xcursor functionality into own type
Introduce a new type MetaCursorSpriteXcursor that is a MetaCursorSprite
implementation backed by Xcursor images. A plain MetaCursorSprite can
still be created "bare bone", but must be manually provided with a
texture. These usages will eventually be wrapped into new
MetaCursorSprite types while turning MetaCursorSprite into an abstract
type.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:51 +00:00
Jonas Ådahl
2fc978ca9d backends/cursor: Rename X11 cursor creation function
It was prefixed with meta_cursor_, but it took a X11 Display, so update
the naming. Eventually it should be duplicated depending if it's a
frontend X11 connection call or a backend X11 connection call and moved
to the corresponding layers, but let's just do this minor cleanup for
now.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:51 +00:00
Jonas Ådahl
10dfc67dad backends/cursor: Minor whitespace cleanup
https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:50 +00:00
Jonas Ådahl
9ebcb719a1 backends/cursor: Clean up includes
Some were unnecessary, some were added even though not strictly needed.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:50 +00:00
Jonas Ådahl
2a20df0c50 backends/cursor: Make MetaCursorSprite derivable
This makes it possible to move out backing store specific code (such as
Xcursor handling) to separate units, while also making it easier to add
more types).

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:50 +00:00
Jonas Ådahl
d3441f7577 backends/cursor: Remove 'meta_' prefix from variable name
https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:49 +00:00
Jonas Ådahl
65c02e26db backends/cursor: Change variable name from 'self' to 'sprite'
This makes it somewhat more descriptive.

https://gitlab.gnome.org/GNOME/mutter/issues/77
2018-06-15 19:09:49 +00:00
Jonas Ådahl
a3269dde95 idle-monitor: NULL check cached InhibitedActions property variant
We might not have a cached "InhibitedActions" property available for us,
so do as elsewhere in this file and NULL check before processing it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/130
2018-06-14 17:52:11 +02:00
Daniel Stone
f2dea5d139 renderer-native: Remove no_add_fb2
drmModeAddFB2 allows userspace to specify a real format enum on
non-ancient kernels, as an improvement over the legacy drmModeAddFB
which derives format from a fixed depth/bpp mapping.

As an optimisation, Weston used to decide at the first failure of
drmModeAddFB2 that the ioctl was unavailable: as non-existent DRM
ioctls return -EINVAL rather than -ENOSYS or similar, bad parameters are
not distinguishable from the ioctl not being present.

Mutter has also implemented the same optimisation for dumb framebuffers,
which potentially papers over errors for the gain of avoiding one ioctl
which will rapidly fail on ancient kernels. Remove the optimisation and
always use AddFB2 where possible.

Closes: #14
2018-06-14 15:25:31 +00:00
Jonas Ådahl
8ee14a7cb7 renderer/native: Also wrap flip closures for EGLStreams
When using the EGLStream backend, the MetaRendererNative passed a
GClosure to KMS when using EGLStreams, but KMS flip callback event
handler in meta-gpu-kms.c expected a closure wrapped in a closure
container, meaning it'd instead crash when using EGLStreams. Make the
flip handler get what it expects also when using EGLStreams by wrapping
the flip closure in the container before handing it over to EGL.

https://bugzilla.gnome.org/show_bug.cgi?id=790316
2018-06-07 22:14:05 +02:00
Jonas Ådahl
909dbafd67 settings: Remove confused comment
It got lost, lets help it find the way out.
2018-06-07 12:57:52 +00:00
Jonas Ådahl
d5203f170e Make screen cast and remote desktop non-experimental
It's time to make this feature more accessible by not requiring editing
an array in gsettings.
2018-06-07 12:57:51 +00:00
Marco Trevisan (Treviño)
0332b7394e renderer-native: Don't crash if the FB surface can't be locked 2018-05-29 22:13:03 +00:00
Florian Müllner
7655e09d00 build: Introspect some more types
While MetaStage, MetaWindowGroup and MetaDBusDisplayConfigSkeleton don't
appear explicitly in the public API, their gtypes are still exposed via
meta_get_stage_for_screen(), meta_get_*window_group_for_screen() and
MetaMonitorManager's parent type. Newer versions of gjs will warn about
undefined properties if it encounters a gtype without introspection
information, so expose those types to shut up the warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2018-05-07 21:44:47 +02:00
Jonas Ådahl
0f9c6aef99 screen-cast: Handle PipeWire errors more gracefully
Various code assumed PipeWire function calls would never fail. Some can
actually fail for real reasons, and some currently can only fail due to
OOM situations, but we should still not assume that will always be the
case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/102
2018-05-07 19:24:47 +00:00
Florian Müllner
2319cd9c40 idle-monitor: Don't try to auto-start SessionManager
The interface is provided by gnome-session and not activatable.

https://gitlab.gnome.org/GNOME/mutter/issues/134
2018-04-30 13:55:41 +00:00
Jonas Ådahl
ae26cd0774 native: Restore previous EGL state after blitting onto secondary GPU
Before we just set it to "none", but this was not enough since various
calls will depend on not just the context being active, but the main
rendering surface.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/21
2018-04-25 17:22:24 +02:00
Jonas Ådahl
0b3a1c9c31 monitor-manager: Find active monitor when deriving global scale
When deriving the global scale directly from the current hardware state
(as done when using the X11 backend) we are inspecting the logical
state they had prior to the most recent hot plug. That means that a
primary monitor might have been disabled, and a new primary monitor may
not have been assigned yet.

Stop assuming a primary monitor has an active mode before having
reconstructed the logical state by finding some active monitor if the
old primary monitor was disabled. This avoids a crash when trying to
derive the global scale from a disabled monitor.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/130
2018-04-25 10:50:50 +02:00
Mario Sanchez Prada
3bbff94878 backend: Don't center the pointers on monitor changes
As a follow up to the patch from a95cbd0a, we need to make sure
that the pointer is out of the way as well when monitors changed,
since that's the event that will prevail in some cases. Besides,
this is also consistent with what the code before a95cbd0a was,
which initialized the pointer position in the same way both in
this case and in the real_post_init() function.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/157
2018-04-24 21:58:38 +01:00
Mario Sanchez Prada
a95cbd0aca backends: Don't center the pointer on initialization
Centering the pointer at startup causes undesired behaviour if
it ends up hovering over reactive elements, that might react
to that positioning, causing confusion. This is the case of
the login dialog when a list of different users is shown, as
centering the pointer at startup in that case will get the
user in the center of the screen pre-selected, which is not
the expected behaviour (i.e. pre-selecting the first one).

Fix this by simply moving the pointer out of the way, close
to the bottom-right corner, during initialization.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/157
2018-04-18 19:14:26 +00:00
Georges Basile Stavracas Neto
bc05e49eba gpu-kms: Return NULL, not FALSE
Another small mistake spotted while working on #77. This
function returns a pointer, thus we should return NULL,
not FALSE.

Issue: #77
2018-04-16 16:30:21 +02:00
Georges Basile Stavracas Neto
773b8384fa monitor-manager-kms: Don't add GPU if it fails
This is a small mistake spotted while working on a solution
for #77. When a GPU fails to initialize, we're adding them
anyway, which might have pretty bad consequences when trying
to use these NULL GPUs.

Issue: #77
2018-04-16 16:30:21 +02:00
Georges Basile Stavracas Neto
7fdac6d310 monitor-manager-kms: Use g_autoptr for error
A minor code cleanup.
2018-04-16 16:30:21 +02:00
Jonas Ådahl
f6cd87734d native: Disable the use of KMS modifiers by default
Make it re-enable:able by a hidden "experimental feature". To enable, add
"kms-modifiers" to the org.gnome.mutter.experimental-features GSettings entry.
2018-04-16 16:29:38 +02:00
Bastien Nocera
01a0fa9437 idle-monitor: Add ResetIdletime API, for testing purposes
The ResetIdletime API can be used instead of an "XTest" binary to
programmatically reset the idle time, as if the user pressed a button on
a keyboard.

This is necessary since we stopped using the XSync extension to monitor
idletimes, as it didn't consider inhibitors as busy, and mutter's
clutter code ignores "Core Events" as generated by XTest.

This patch will require minimal changes to gnome-settings-daemon's power
test suite so that "key press" idletime resets are triggered through
this D-Bus interface rather than through XTest and a roundtrip through
the X server.

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Bastien Nocera
657417a578 backend: Reset idle when lid is opened or resuming from suspend
There's no particular reason for this code to only ever be triggered on
Wayland, and allows removing X11-specific work-arounds from
gnome-settings-daemon.

See https://bugs.freedesktop.org/show_bug.cgi?id=59576

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Bastien Nocera
4af00ae296 idle-monitor: Take idle inhibition into account
Take idle inhibitions into account for when to fire idle watches as
requested by OS components.

This should stop gnome-session and gnome-settings-daemon considering
the session idle when they have been inhibited for longer than their
timeout, for example to avoid the screensaver activating, or the
computer suspending after watching a film.

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Bastien Nocera
84e575be77 x11: Allow XTest and core events to reset idletime
Now that we've removed the X11 specific backend of the idle monitor,
add back a cut-down version of it for the explicit purpose of being
told about idle time resets when XTest events are used.

XTest events are usually used by test suites and remote display software
to inject events into an X11 session. We should consider somebody moving
the mouse remotely to be just as "active" as somebody moving it locally.

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Bastien Nocera
7945ee5beb backends: Remove X11 idle-monitor backend
And use the old "native" backend for both X11 and Wayland. This will
allow us to share fixes between implementations without having to delve
into the XSync X11 extension code.

https://bugzilla.gnome.org/show_bug.cgi?id=705942
2018-04-16 13:28:03 +02:00
Aleksandr Mezin
5ad34e0efb monitor-manager: fix output ids returned by GetResources
Output ID is set equal to 'i' later in the loop. But 'i' was never
incremented, so all outputs were getting the same ID (equal to
the number of CRTCs, because 'i' was reused from the previous loop).


(cherry picked from commit 23c3f8bb18db499d196f1024732ef3234b44f59c)
2018-04-11 17:57:25 +00:00
Benjamin Otte
98dfd5b887 screen-cast: Fix compile error
Credit goes to gcc for finding this typo.
2018-04-10 13:02:51 +02:00
Daniel Stone
e6109cfc22 renderer-native: Fall back to non-modifier GBM surfaces
If we attempt GBM surface allocation with a set of modifiers but the
allocation fails, fall back to non-modifier allocations. This fixes
startup on Pineview-based Atom systems, where KMS provides us a set of
modifiers but the GBM implementation doesn't support modifier use.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/84
2018-04-03 18:17:04 +00:00
Alberts Muktupāvels
31b5059068 input-settings: Fix a typo in tap-and-drag setting 2018-03-29 09:51:32 -05:00
Olivier Fourdan
ebff7fd7f4 cursor-renderer-native: take rotation into account
Rotating an output would show duplicate cursors when the pointer is
located over an area which would be within the output if not rotated.

Make sure to swap the width/height of the output when rotated.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/85
2018-03-29 06:34:37 +00:00
Daniel van Vugt
6e415353e3 renderer-native: Swap then await earlier flips.
Rendering the next frame (which mostly happens as part of the flush done
in swap buffers) is a task that the GPU can complete independently of
the CPU having to wait for previous page flips. So reverse their order
to get the GPU started earlier, with the aim of greater GPU-CPU
parallelism.
2018-03-29 13:35:59 +08:00
Olivier Fourdan
67917db45f wayland: Use cursor position in logical monitor
When using two monitors size by side with different scales, once the
cursor moves from one output to another one, its size changes based on
the scale of the given output.

Changing the size of the cursor can cause the cursor area to change
output again if the hotspot is not exactly at the top left corner of the
area, causing the texture of the cursor to change, which will trigger
another output change, so on and so forth causing continuous surface
enter/leave event which flood the clients and eventually kill them.

Change the logic to use only the actual cursor position to determine if
its on the given logical monitor, so that it remains immune to scale
changes induced by output scale differences.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/83
2018-03-23 15:12:37 +01:00
Jonas Ådahl
712ec30cd9 renderer/native: Force EGL config pixel format
We just arbitrarily chose the first EGL config matching the passed
attributes, but we then assumed we always got GBM_FORMAT_XRGB8888. That
was not a correct assumption. Instead, make sure we always pick the
format we expect.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/2
2018-03-05 15:42:27 +00:00
Jonas Ådahl
7a41483ea0 egl: Fail first config choosing when no results
If there was no matching config, fail to find the first one.

https://gitlab.gnome.org/GNOME/mutter/issues/2
2018-03-05 15:42:27 +00:00
Jonas Ådahl
b4d642be52 egl: Rename EGL simple config chooser
It just picked the first config, so name it accordingly.

https://gitlab.gnome.org/GNOME/mutter/issues/2
2018-03-05 15:42:26 +00:00
Carlos Garnacho
33c070cdd5 backends/x11: Plug a leak 2018-02-27 14:10:04 +01:00
Jonas Ådahl
e502adfa04 remote-desktop, screen-cast: Add version number to D-Bus APIs
In order to let applications gracefully handle version mismatches, add
a version property to the APIs. Also add a warning on the APIs that
these are not meant for public consumption.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
8dd377da38 remote-desktop: Add support for discovering supported device types
This is so that application will not try to send touch events when
touch is not supported.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
03a12f9458 remote-desktop: Add touch screen event support 2018-02-23 19:33:31 +08:00
Jonas Ådahl
061f69f2a2 remote-desktop: Fix absolute pointer motion coordinates
If the coordinates was for a stream not at the stage position (0, 0),
they'd be incorrect. Fix this by correctly translating the coordinates
according to the stream position.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
4d5e1f690d screen-cast-stream: Add API to transform relative coordinates
Will be used to translate stream local coordinates to stage coordinates.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
f3203f0330 screen-cast-session: Add API to get stream from object path
Will be needed by the remote desktop session to translate stream local
input coordinates.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
d27e6921d6 remote-desktop: Add relative pointer motion event support
Relative pointer motions are assumed to be pre-accelerated.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
c459ad7932 remote-desktop: Add smooth scroll event support 2018-02-23 19:33:31 +08:00
Jonas Ådahl
5ee825c081 remote-desktop: Add keyboard keycode event support
Keyboard keycode events will act as a physical keyboard thus depend on
the active keyboard layout.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
1ead513b66 remote-desktop: Support multiple axis steps at once
Just call the corresponding clutter API once for each step.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
9ed236bd67 remote-desktop: Fix notify axis input validity check
The check was inverted; allowed axis are 0 and 1, not the other way
around.
2018-02-23 19:33:31 +08:00
Louis-Francis Ratté-Boulianne
6f59e4858e renderer/native: Don't use modifiers to import linear DMA buffer
When the buffer modifier is DRM_FORMAT_MOD_LINEAR, we can use the
old code path. That means not specifying any modifier parameter.

It was an issue when the primary GPU was creating a linear GBM surface
and that a secondary GPU (not supporting modifiers) was trying to
import it. It was failing because the driver could not use the
import_modifiers extension even though it could in theory easily
import the buffer.

https://gitlab.gnome.org/GNOME/mutter/issues/18
2018-02-22 14:01:48 +08:00
Louis-Francis Ratté-Boulianne
aec85281ba native/renderer: Retrieve the right modifiers set for each GPU
We were retrieving the supported KMS modifiers for all GPUs even
though what we really need to intersect between these sets of
modifiers:

1) KMS supported modifiers for primary GPU if the GPU is used for
   scanout;

2) EGL supported modifiers for secondary GPUs (different than the
   primary GPU used for rendering);

3) GBM supported modifiers when creating the surface (already
   taken care of by gbm_surface_create_with_modifiers());

https://gitlab.gnome.org/GNOME/mutter/issues/18
2018-02-22 14:01:48 +08:00
Louis-Francis Ratté-Boulianne
b22875aae9 renderer/native: Use the right EGL image parameters for extra planes
There was a typo for modifier parameter of planes 1 & 2.

https://gitlab.gnome.org/GNOME/mutter/issues/18
2018-02-22 14:01:48 +08:00
Carlos Garnacho
54dcff3aa2 backends: Monitor changes in active tools' settings
So the changes can be instantly applied while the tool is in proximity.
Before we would just do it on proximity-in, which doesn't provide a
good look&feel while modifying the tool settings in g-c-c.

https://gitlab.gnome.org/GNOME/mutter/issues/38

Closes: #38
2018-02-19 17:15:26 +01:00
Peter Hutterer
ac502c921d backends/x11: wacom pressure curve is a 32-bit property
The property has been 32 bits since around 2011 and has not changed, mutter
expects it to be 8 bits. The mismatch causes change_property to never
actually change the property.

https://gitlab.gnome.org/GNOME/mutter/issues/26

Closes: #26
2018-02-09 12:28:56 +01:00
Jonas Ådahl
86ab3878e7 renderer/x11: Enable GPU memory purge error extension if available
This was done by the clutter X11 backend before prior to introducing
MetaRenderer, but during that work, enabling of said extension was lost.
Let's turn it on again.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2018-02-07 11:04:07 +08:00
Jonas Ådahl
d092e913d6 gpu-kms: Don't add outputs without modes
There seems to be a kernel race when one disconnects an external
monitor connected to a DisplayPort via a USB-C adapter. The race
results in a connector being reported as connected, but without any
modes supported.

This had the side effect that we tried to set a preferred mode to
the first listed mode, but as no modes were available, we instead tried
to dereference the first element of a NULL array, causing a
segmentation fault.

Mitigate this by skipping adding output if no supported modes are
advertised and the output doesn't support scaling, while moving the
fallback path for calculating a preferred output mode to after possibly
adding the common modes, to avoid the unvolentary NULL dereference.

https://bugzilla.gnome.org/show_bug.cgi?id=789501
2018-02-05 10:38:54 +08:00
Carlos Garnacho
57f55d486d backends/x11: Preserve XI1 XDevice throughout ClutterInputDevice lifetime
Opening and closing the device may result into XI2 grabs being cut short,
resulting into pad buttons being rendered ineffective, and other possible
misbehaviors. This is an XInput flaw that fell in the gap between XI1 and
XI2, and has no easy fix. It pays us for mixing both versions, I guess...

Work this around by keeping the XI1 XDevice attached to the
ClutterInputDevice, this way it will live long enough that this is not
a concern.

Investigation of this bug was mostly carried by Peter Hutterer, I'm just
the executing hand.

https://gitlab.gnome.org/GNOME/mutter/issues/7

Closes: #7
2018-02-01 11:02:01 +01:00
Jeff Smith
6be56de140 backends/x11: Fix time-comparison bug causing hang
A comparison in translate_device_event() does not account for the fact
that X's clock wraps about every 49.7 days.  When triggered, this causes
an unresponsive GUI.

Replace simple less-than comparison with XSERVER_TIME_IS_BEFORE macro,
which accounts for the wrapping of X's clock.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/12
2018-02-01 15:34:12 +08:00
Jason Gerecke
f8f1bcfa9e backends: Add support for Wacom stylus tertiary-button-action
The tertiary-button-action (see bug 790028) is a place for g-c-c to store
the action which should be performed when a stylus' third button is pressed.
Pressing this button is signaled as a BTN_STYLUS3 event from the kernel or
X11 button 8.

https://bugzilla.gnome.org/show_bug.cgi?id=790033
2018-01-30 19:28:02 +01:00
Jonas Ådahl
dbd053020a settings: Avoid warning when clearing xwayland grab access lists
On the first run, they are NULL, so don't try to free them.

https://bugzilla.gnome.org/show_bug.cgi?id=792853
2018-01-25 11:40:03 +08:00
Jonas Ådahl
c063d43be8 screen-cast: Update to pipewire 0.1.8 API
Remove per micro version code, the API changed too much to keep both in
place.

https://bugzilla.gnome.org/show_bug.cgi?id=792854
2018-01-25 11:40:03 +08:00
Jonas Ådahl
371e5df568 remote-desktop-session: Don't always warn about axis steps
The condition for warning was wrong, causing it to always warn no
matter the input.

https://bugzilla.gnome.org/show_bug.cgi?id=792062
2018-01-24 12:15:27 +08:00
Daniel Stone
cc4e007148 renderer/native: Create GBM surfaces with modifiers
Now that we have the list of supported modifiers from the monitor
manager (via the CRTCs to the primary planes), we can use this to inform
EGL it can use those modifiers to allocate the GBM surface with. Doing
so allows us to use tiling and compression for our scanout surfaces.

This requires the Mesa commit in:
Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
Mesa 10.2.7 (55d28925e6109a4afd61f109e845a8a51bd17652).
Otherwise Mesa closes the fd behind our back and re-importing will fail.
See FDO bug #76188 for details.

https://bugzilla.gnome.org/show_bug.cgi?id=785779
2018-01-24 11:42:30 +08:00
Daniel Stone
c0d9b08ef9 renderer/native: Use modifier-aware GBM API
Newer versions of GBM support buffer modifiers, including multi-plane
buffers. Use this new API to explicitly pull the information from GBM,
and feed it to drmModeAddFB2WithModifiers.

https://bugzilla.gnome.org/show_bug.cgi?id=785779
2018-01-24 11:39:01 +08:00
Daniel Stone
d99cd279d2 renderer/native: Use drmModeAddFB2 where available
drmModeAddFB2 allows specifying multiple planes, as well as directly
specifying the format, rather than relying on a depth/bpp -> format
mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=785779
2018-01-24 11:35:07 +08:00
Daniel Stone
d670a1aa78 crtc/kms: Add parsing for IN_FORMATS property
The KMS IN_FORMATS blob property contains a structure defining which
format/modifier combinations are supported for each plane. Use this to
extract a list of acceptable modifiers to use for the primary plane for
XRGB8888, so we can ask EGL to allocate tiled/compressed buffers for
scanout when available.

https://bugzilla.gnome.org/show_bug.cgi?id=785779
2018-01-24 11:33:40 +08:00
Hans de Goede
76b396846d monitor: Set MINIMUM_LOGICAL_HEIGHT to 480
Using 800x600 as minimum logical size is very 4:3 thinking, while a lot of
modern devices are 16:9. The specific reason for this commit is to allow
1.5 scaling at mini-laptops (clamshell devices) with e.g. a 5.5"
1280x720 screen. Given that this device has a keyboard, one obviously
is not holding it very close to ones eyes and at 220 dpi that means the text
is too small at scale 1.0. For one real world example of such a device see:
https://en.wikipedia.org/wiki/GPD_Win

https://bugzilla.gnome.org/show_bug.cgi?id=792765
2018-01-23 11:07:04 +08:00
Jonas Ådahl
01e27a4366 input-settings/x11: Fix tap-and-drag libinput property name
It's "libinput Tapping Drag Enabled", not "libinput TappingDrag
Enabled".

https://bugzilla.gnome.org/show_bug.cgi?id=775755
2018-01-12 18:57:57 +08:00
Hans de Goede
f12e6ad4f1 monitor-config-manager: Adjust accelerometer rotation for panel-orientation
The device orientation coming out of iio-sensor-proxy defines upright/normal
as the direction in which the picture is displayed on the LCD panel without
any rotation. This is necessary for accelerometer rotation to work properly
in desktop environments which are not aware of panel-orientation issues.

This means that we need to correct the logical-monitor-config / user-visible
rotation for the panel-orientation when we get rotation info from
iio-sensor-proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
0bbda3ad87 monitor-manager: Take panel-orientation into account for physical size
Just like we swap the x and y resolution of the monitor modes when
the panel-orientation requires 90 or 270 degree rotation to compensate,
we should do the same for the width and height in mm of the monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
dd43d04d42 monitor-manager: Add portrait modes to portrait displays
If a monitor's max resolution is a portrait resolution, then assume it is
a native portrait monitor and add portrait versions of the common modes.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
383ac76d00 cursor-renderer-native: Take panel-orientation into account
Even if the logical_monitor config does not have an active transform,
we might still be doing a transform under the hood to compensate for
panel-orientation. Check for this and fall back to the sw cursor if this
is the case.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
e59ca14f6c monitor-manager: Take panel orientation into account when getting input matrix
If a LCD panel has a non normal orientation (mounted upside-down or 90
degrees rotated) then the kernel will report touchscreen coordinates with
the origin matching the native (e.g. upside down) coordinates of the panel.

Since we transparently rotate the image on the panel to correct for the
non normal panel-orientation, we must apply the same transform to input
coordinates to keep the aligned.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
7917b083cb monitor-manager: Take drm-connector panel-orientation property into account
Some x86 clamshell design devices use portrait tablet LCD panels while
they should use a landscape panel, resoluting in a 90 degree rotated
picture.

Newer kernels detect this and rotate the fb console in software to
compensate. These kernels also export their knowledge of the LCD panel
orientation vs the casing in a "panel orientation" drm_connector property.

This commit adds support to mutter for reading the "panel orientation"
and transparently (from a mutter consumer's pov) fixing this by applying
a (hidden) rotation transform to compensate for the panel orientation.

Related: https://bugs.freedesktop.org/show_bug.cgi?id=94894

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
2b3040d04f monitor: s/meta_monitor_derived_derive_layout/meta_monitor_tiled_derive_layout/
Fix meta_monitor_derived_derive_layout typo.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Olivier Fourdan
519a0fd93d settings: Add xwayland grab settings
Add new settings to control which X11 windows are allowed to
issue Xwayland grabs.

https://bugzilla.gnome.org/show_bug.cgi?id=783342
2017-12-18 13:15:17 +01:00
Philip Withnall
93e450f37c backends: Fix ClutterRect initialisations
With Clang, these initialisations were warning about missing brackets.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791022
2017-11-30 13:06:13 +00:00
Jonas Ådahl
b7518c8651 monitor-manager: Compare keys when checking whether a config is complete
We only counted configured monitors and whether the config was
applicable (could be assigned), howeverwe didn't include disabled
monitors when comparing. This could caused incorrect configurations to
be applied when trying to use the previous configuration.

One scenario where this happened was one a system with one laptop
screen and one external monitor that was hot plugged some point after
start up. When the laptop lid was closed, the 'previous configuration'
being the configuration where only the laptop panel was enabled, passed
'is-complete' check as the number of configured monitors were correct,
and the configuration was applicable.

Avoid this issue by simply comparing the configuration key of the
previous configuration and the configuration key of the current state.
This correctly identifies a laptop panel with the lid closed as
inaccessible, thus doesn't incorrectly revert to the previous
configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Jonas Ådahl
62dedfbef3 monitor-config-manager: Don't include closed laptop panel in config key
When deriving the list of disabled monitors when creating new monitors
configs, don't include the laptop panel if the lid is currently closed,
as we consider the laptop panel nonexistent when the laptop lid is
closed when it comes to configuration.

The laptop panel connector(s) will either way be appropriately disabled
anyway, as the field listing disabled monitors in the configuration do
not affect actual CRTC/connector assignments.

https://bugzilla.gnome.org/show_bug.cgi?id=788915
2017-11-30 11:48:44 +08:00
Rui Matos
28a9439209 monitor-manager: Refuse to activate closed laptop panels
There's no good reason to allow this and it allows g-c-c to properly
show that such a configuration doesn't work.

https://bugzilla.gnome.org/show_bug.cgi?id=790336
2017-11-22 15:07:11 +01:00
Carlos Garnacho
cf4b5efdd1 backends: Do NULL checks before disconnecting/connecting signals
The displayed cursor may be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-20 13:29:22 +01:00
Carlos Garnacho
3067dab84c backends: Do not set up the root cursor on invisible window pointers
Commit b1a0bf891 broke the previous logic that we would only fallback
to the root cursor if 1) windows are not interactable or 2) no window
cursor is currently set (i.e. not hovering over any window). Now it
will set up the root cursor if it's NULL, which breaks clients
explicitly setting an invisible cursor. This commit restaurates the
previous behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-20 13:29:22 +01:00
Carlos Garnacho
1790320ba3 backends: Protect from reentrancy in meta_cursor_sprite_load_from_theme
This function is supposedly not failable, so just move the theme_dirty
flag clearing to the beginning of the function. Protects against cases
where requesting a cursor image may result in it being loaded and set
as a texture, which emits ::texture-changed, which may end up requesting
the cursor image again.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-17 17:22:18 +01:00
Carlos Garnacho
f45df4265d backends: Trigger MetaCursorTracker::cursor-changed on texture changes
So we allow gnome-shell's magnifier to update fake cursors while it's
turned on.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-17 17:22:18 +01:00
Carlos Garnacho
bcbcd6a68c backends: Add MetaCursorSprite::texture-changed signal
As wayland implements the cursor role, it consists of a persistent
MetaCursorSprite that gets the backing texture changed. This is
inconvenient for the places using MetaCursorTracker to track cursor
changes, as they actually track MetaCursorSprites.

This signal will be used to trigger emission of
MetaCursorTracker::cursor-changed, which will make users able to
update accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-17 17:22:18 +01:00
Carlos Garnacho
b1a0bf8916 backends: Dissociate visibility from current cursor sprite
Just like X11/XFixes behaves, the current cursor is not affected
by its visibility, so it can be queried while invisible (possibly
to be replaced).

For this, keep an extra effective_cursor pointer that will be
either equal to displayed_cursor (maybe a bit of a misnomer now)
or NULL if the cursor is invisible. The MetaCursorRenderer
management is tied to the former, and the ::cursor-changed signal
emission to the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=754806
2017-11-17 17:22:18 +01:00
Carlos Garnacho
d0531966eb compositor: End MetaDnd grab on plugin grab end
We must emit ::dnd-leave to pair the ::dnd-enter that shall be
emitted whenever the plugin grab begins, otherwise we leave
listeners unable to clean up if the plugin begins and ends a
grab while there is an ongoing DnD operation.

https://bugzilla.gnome.org/show_bug.cgi?id=784545
2017-11-17 14:43:50 +01:00
Olivier Fourdan
333b5d12a0 backends: configure keyboard accessibility
Set the relevant flags and values for keyboard accessibility from
gsettings.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
dc0fc65229 backend/native: implement bell-notify
https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
428af6d213 backend/x11: implement bell-notify
https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
memeka
049418cd03 renderer/native: Also allow EGL_KHR_platform_gbm extension string
Proprietary drivers such as ARM Mali export EGL_KHR_platform_gbm instead
of EGL_MESA_platform_gbm. As such, GBM platform check should be done for
both MESA and non-MESA drivers.

https://bugzilla.gnome.org/show_bug.cgi?id=780668
2017-11-09 18:16:27 +08:00
Benoit Gschwind
3ee1999c70 backend: Reset current device id when current device removed
Bluetooth mouse usually goes in sleep state after a timeout, when that
happen the mouse is disconnected and on_device_removed function is
called. Before the patch if a touch device is available the
on_device_removed function hide the cursor. The issue is that the cursor
does not reappear once the bluetooth mouse is reconnected because
MetaBackend::current_device_id is not invalidated when on_device_removed
was called.

The patch set MetaBackend::current_device_id to 0 if the current device
is removed. This will make update_last_device to be triggered as soon as
another input device is used or the bluetooth mouse reconnect, as
consequence that the cursor reappear. The id 0 is never given to devices
and can safely used as undefine id.

https://bugzilla.gnome.org/show_bug.cgi?id=761067
2017-11-09 17:42:45 +08:00
Carlos Garnacho
eb236649fc backends: Plug leaks
The DRM properties container must be destroyed with
drmModeFreeObjectProperties, and the connectors must be freed on every
caller. Also make it sure that gbm_device structs are destroyed with the
MetaRendererNativeGpuData that owns them.

https://bugzilla.gnome.org/show_bug.cgi?id=789984
2017-11-07 11:02:00 +01:00
Jonas Ådahl
626621a53a renderer-native-gles3: Add cpp error if gl.h was included
On some architectures, including both GLES3/gl3.h GL/gl.h will cause
compilation issues due to incompatible type definitions. To avoid
running into that issue while building on other architectures, make
sure we haven't included GL/gl.h by accident.

https://bugzilla.gnome.org/show_bug.cgi?id=788695
2017-10-30 19:52:42 +08:00
Jonas Ådahl
fb3a64491e renderer-native-gles3: Remove unnecessary includes
They caused conflicts on i686 as GL/gl.h was included by cogl.

https://bugzilla.gnome.org/show_bug.cgi?id=788695
2017-10-30 19:52:42 +08:00
Jonas Ådahl
294f9419f7 renderer-native-gles3: Don't pass GPU when rendering
It wasn't used for anything, so don't pass it.

https://bugzilla.gnome.org/show_bug.cgi?id=788695
2017-10-30 19:52:42 +08:00
Carlos Garnacho
89f5ca3301 backends: Unref variants obtained from g_variant_iter_get_next_value()
Those are being leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=789553
2017-10-27 13:22:12 +02:00
Carlos Garnacho
c71faffb71 backends/native: Fix handling of trackball settings
The org.gnome.desktop.peripherals.trackball.scroll-wheel-emulation-button
setting contains buttons X11-style. Work out the BTN evcode that applies
to it when applying the setting on the libinput device.

https://bugzilla.gnome.org/show_bug.cgi?id=787804
2017-10-26 12:48:15 +02:00
Marco Trevisan (Treviño)
fa37496ffb MetaLogicalMonitor: free the monitors list on finalize
https://bugzilla.gnome.org/show_bug.cgi?id=789227
2017-10-20 16:10:18 +08:00
Jonas Ådahl
12381d57d1 monitor-unit-tests: Check non-first preferred modes
Check that if there are multiple modes with the same ID (resolution,
refresh rate and handled flags) we correctly add the preferred mode to
the list of monitor modes.

https://bugzilla.gnome.org/show_bug.cgi?id=789153
2017-10-19 10:17:14 +08:00
Jonas Ådahl
4ad8c4b86b monitor/normal: Prefer modes with same flags as preferred mode
When generating MetaMonitorMode's, prefer CRTC modes that has the same
set of flags as the preferred mode. This not only is probably a better
set of configurable modes, but it'll guarantee that the preferred mode
is added.

This fixes a crash when the preferred mode was not the first mode with
the same resolution, refresh rate and set of handled modes.

https://bugzilla.gnome.org/show_bug.cgi?id=789153
2017-10-19 10:16:50 +08:00
Jonas Ådahl
1a78557e0b monitor-manager/xrandr: Use a single supported scales list for all
Under X11 we can only ever have the same scale configured on all
monitors. In order to use e.g. scale 2 when there is a HiDPI monitor
connected, we must not disallow it because there is a monitor that does
not support scale 2. Thus we must show the same scale for every monitor
and monitor mode, even though it might result in a bad experience.

Do this by iterating through all the monitors adding all supported
scales by the preferred mode, combining all the supported scales. This
supported scales list is then used for all monitor and modes no matter
what.

https://bugzilla.gnome.org/show_bug.cgi?id=788901
2017-10-17 15:21:12 +08:00
Jonas Ådahl
a17b343c21 monitor-manager/xrandr: Chain up constructed vfunc
'monitor-manager: Keep pointer to backend' added a
GObjectClass::constructed implementation, but didn't chain it up to the
parent. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=788921
2017-10-16 17:13:55 +08:00
Marco Trevisan (Treviño)
a8c80ccece backend: move the cursor render update on screen changes here
https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 00:46:51 -05:00
Marco Trevisan (Treviño)
f044511037 monitor-manager: use g_return_val_if_fail if trying to fetch an invalid monitor
https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 13:43:03 +08:00
Marco Trevisan (Treviño)
b31e545c9d backends: add 'monitors-updated-internal' signal to only update internal state
Adding an internal signal and use it to update the internal state before
emitting "monitors-changed" which will be repeated by the screen to the world.

https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 00:42:50 -05:00
Jonas Ådahl
fad5657eda DisplayConfig: Add 'legacy-ui-scaling-factor' property
We have this value in mutter; lets share it so that for example
gnome-settings-daemon doesn't have to calculate it itself.

https://bugzilla.gnome.org/show_bug.cgi?id=788820
2017-10-12 17:42:52 +08:00
Jonas Ådahl
eaf9ccde39 settings: Get UI scaling factor from primary logical monitor
Don't use MAX(logical monitor scales) to determine the UI scaling
factor, just use the primary logical monitor. That's where the shell UI
will most likely be.

https://bugzilla.gnome.org/show_bug.cgi?id=788820
2017-10-12 17:42:52 +08:00
Carlos Garnacho
c85f322b20 backends/native: Move functions out of HAVE_EGL_DEVICE
Those are now used in common code, so should be taken out of
the ifdef. Fixes compilation without EGL streams.
2017-10-09 13:39:50 +02:00
Jonas Ådahl
7928b25ebf renderer/native: Use g_initable_new() to create renderer
No need to do g_object_new then g_initable_init while tracking the
lifetime when g_initable_new() can do it for us.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-06 13:18:12 -04:00
Jonas Ådahl
78e6258b44 cursor-renderer-native: Support HW cursors on multiple GPUs
On hybrid GPU systems, hardware cursors needs to be realized on all the
GPUs, as scanout cursor planes cannot be shared. Do this by moving gbm
buffer and drm buffer ID management to a per GPU struct, realizing a
cursor on each GPU when previously only realized on the primary GPU.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-06 13:18:12 -04:00
Jonas Ådahl
c9259c2b15 renderer-native: Add hybrid GPU system support
A hybrid GPU system is a system where more than one GPU is connected to
connectors. A common configuration is having a integrated GPU (iGPU)
connected to a laptop panel, and a dedicated GPU (dGPU) connected to
one or more external connector (such as HDMI).

This commit adds support for rendering the compositor stage using the
iGPU, then copying the framebuffer content onto a secondary framebuffer
that will be page flipped on the CRTC of the dGPU.

This can work in two different ways: GPU accelerated using Open GL ES
3, or CPU unaccelerated.

When supported, GPU accelerated copying works by exporting the iGPU
onscreen framebuffer as a DMA-BUF, importing it as a texture on a
separate dGPU EGL context, then using glBlitFramebuffer(), blitting it
onto a framebuffer on the dGPU that can then be page flipped on the dGPU
CRTC.

When GPU acceleration is not available, copying works by creating two
dumb buffers, and each frame glReadPixels() from the iGPU EGL render
context directly into the dumb buffer. The dumb buffer is then page
flipped on the dGPU CRTC.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-06 13:18:12 -04:00
Jonas Ådahl
492d2eb573 renderer-native: Move some error reporting up the call stack
Pass GErrors to functions that can fail, and report the error att the
call site.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
376dcd3b92 gpu-kms: Pass GPU on page flip callbacks
https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
60781bc6c2 backends: Add OpenGL ES 3 abstraction layer
Add helper functions and macros for managing and drawing OpenGL ES 3.
It will be used for blitting framebuffers between multiple GPUs in
hybrid GPU systems.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
2d8827cb0c egl: Add more API used when rendering
Eventually, we'll render buffers without using Cogl, and for this we
need to be able to do things like creating, destroying and changing the
context, as well as swapping buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
802f7dcd30 monitor: Add meta_monitor_get_gpu()
Add API to get what GPU drives this monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
e62cfd9043 egl: Expose eglGetProcAddress
It will be needed for OpenGL ES extension function symbol loading.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
cbcf6a4f23 monitor-manager-kms: Add all GPUs with connectors
First find the primary GPU and open it. Then go through all other
discovered GPUs with connectors and add those too. MetaRendererNative
still fails to initialize when multiple added GPUs and
MetaCursorRendererNative still always falls back on OpenGL based cursor
rendering when there are multiple GPUs.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:26 -04:00
Jonas Ådahl
b0e42d3f6e renderer-native: Always use MetaEgl when interacting with EGL
Partly for consistency, partly for error handling functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:17:25 -04:00
Jonas Ådahl
18eb66de06 cogl: Add way to pass user data when setting custom renderer winsys
When creating a renderer with a custom winsys (which is always how
mutter uses cogl) make it possible to pass a user data with the winsys.
Still unused.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:10:30 -04:00
Jonas Ådahl
b32cccddf9 egl: Expose .._has_extensions_..() function
It will be used by e.g. a future GLES helper unit needing similar
functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:10:30 -04:00
Jonas Ådahl
362e26b3e2 renderer-native: Add MetaEgl getter from renderer
https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:10:30 -04:00
Jonas Ådahl
5c53284bde renderer-native: Turn dumb buffer into a simple type
Make dumb buffer creation/destruction reusable by introducing a
MetaDumbBuffer type (private to meta-renderer-native.c). This will
later be used for software based fallback paths for copying render GPU
buffers onto secondary GPUs.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:10:27 -04:00
Jonas Ådahl
e45d7f70e8 crtc-kms: Don't set normal transform when no transforms are supported
On a CRTC that doesn't report any transforms at all, setting the normal
transform will fail. Avoid failing by checking if any transforms are
supported before applying it, and early out if no transforms are
supported.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:09 -04:00
Jonas Ådahl
70edc7dda4 backends/native: Stop supporting stage views being disabled
Get rid of some technical dept by removing the support in the native
backend for drawing the the whole stage to one large framebuffer.
Previously the only way to disable stage views was to set the
MUTTER_STAGE_VIEWS environment variable to 0; doing that now will cause
the native backend to fail to initialize.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:09 -04:00
Jonas Ådahl
3244ed37a9 cursor-rendere-native: Don't declare HW cursors broken on EACCES
Don't permanently fall back to OpenGL based cursor rendering when
setting the HW cursor fails with EACCES as that may happen on VT
switching and other things temporarily revoking fd access.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:09 -04:00
Jonas Ådahl
406359bba1 gpu-kms: poll() on KMS fd on EAGAIN
When drmHandleEvent() returns an error and errno is set to EAGAIN,
instead of ending up in a busy loop, poll() the fd until there is
anything to read.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:09 -04:00
Jonas Ådahl
8b23dd915f cursor-renderer-native: Don't leak cursor gbm buffers
We tried to free all three cursors by looping, but only ever tried to
free the first buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:09 -04:00
Jonas Ådahl
7e1f65405f native/renderer: More naming cleanups
The prefix, if any, of a variable name often contains information about
the namespace (such as clutter_backend is the ClutterBackend, while
backend is a MetaBackend). Clean up some more inconsistencies in
meta-renderer-native.c where various variable names were egl_ prefixed
but in fact was Cogl types.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:08:08 -04:00
Jonas Ådahl
c1683073f1 backends: Split out CRTC/output management to MetaGpu
In order to eventually support multilpe GPUs with their own connectors,
split out related meta data management (i.e. outputs, CRTCs and CRTC
modes) into a new MetaGpu GObject.

The Xrandr backend always assumes there is always only a single "GPU" as
the GPU is abstracted by the X server; only the native backend (aside
from the test backend) will eventually see more than one GPU.

The Xrandr backend still moves some management to MetaGpuXrandr, in
order to behave more similarly to the KMS counterparts.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 18:05:20 -04:00
Jonas Ådahl
18ec86bd90 Remove meta_monitor_manager_get_monitor_for_output() API
This function is replaced by an equivalent that takes a connector
string.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
315a6f43d7 monitor-manager: Keep pointer to backend
Instead of accessing the global singleton, keep a pointer to the
backend in the MetaMonitorManager struct.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
7603bb5fd5 monitor-manager-dummy: Use GObject type declaration macro
Use G_DECLARE_FINAL_TYPE instead of old multiple macro definitions way.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
d53b79f8c3 native/cursor-renderer: Cleanup construction
Pass the backend to a new factory function, and keep a pointer to the
monitor manager, which is accessed elsewhere in the same file instead of
fetching the singleton. The HW cursor initialization part is also made
more obvious, without depending on seemingly irrelevant clutter
features.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
f534452c6a cursor-renderer-native: Remove unused functions and declarations
https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
0f6b83e7df cursor-renderer-native: Cleanup type declaration
Use G_DECLARE_FINAL_TYPE instead of the old macros.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
16a6aef5a7 backends/native: Move KMS fd management to monitor manager
Move finding, opening and managment of the KMS file descriptor to
MetaMonitorManagerKms. This means that the monitor manager creation can
now fail, both if more than one GPU with connectors is discovered, or
if finding or opening the primary GPU fails.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
518fb9fb5e backends: Split monitor manager creation into create and setup
The monitor manager instance was created and setup in one step; at
construction. This is problematic if, in the future, the monitor manager
creation can fail, as the monitor manager is created quite late.

To make it possible to in the future fail creating a monitor manager,
create the instance very early when initiating the backend, then on
post init backend setup, "setup" the monitor manager state, i.e. read
the current state and setup the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
547ace3cf8 backend/native: Propogate error when creating renderer
The error was printed, then dropped, eventually resulting in another
generic error being printed. Lets just propogate the error all the way
up instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
a4ba38ee78 backends/x11: Move CRTC code to its own file
Move code dealing with Xrandr MetaCrtcs and related functionality to its
own file. Eventually, MetaCrtcCrtc should be introduced, based on
MetaCrtc, and this commit is in preparation for that.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
e32d52b9b8 backends/x11: Move output code to its own file
Move code dealing with X11 MetaOutputs and related functionality to its
own file. Eventually, a MetaOutputXrandr should be introduced, based on
MetaOutput, and this commit is in preparation for that.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
de40ced8b4 backends/native: Move CRTC code to its own file
Move code dealing with MetaCrtcKms and related functionality to its
own file. Eventually, MetaCrtcKms should become a GObject based on
MetaCrtc, and this commit is in preparation for that.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
cfee58798e backends/crtc: Keep a pointer to the monitor manager
Instead of passing it around or fetching the singleton, keep a pointer
to the monitor manager that owns the CRTC. This will eventually be
replaced with a per GPU/graphics card object.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
7ea01693a7 backends/native: Move output code to its own file
Move code dealing with MetaOutputKms and related functionality to its
own file. Eventually, MetaOutputKms should become a GObject based on
MetaOutput, and this commit is in preparation for that.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
e0d839aea2 backends/output: Keep a pointer to the monitor manager
Instead of passing it around or fetching the singleton, keep a pointer
to the monitor manager that owns the output. This will eventually be
replaced with a per GPU/graphics card object.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
d3efd73429 monitor-manager-kms: Use G_DECLARE_FINAL_TYPE macro
Declare the MetaMonitorManagerKms type using the helper macro, instead
of manually.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
2db5505216 monitor-manager: Turn MetaCrtcMode into a GObject
Convert MetaCrtcMode from a plain struct to a GObject. This changes the
storage format, and also the API, as the API was dependent on the
storage format.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
f44b6c772a monitor-manager/kms: Some naming fixes
Prefix external types (e.g mode -> drm_mode) and rename a search
function to not refer to a local type as ".._meta_..".

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
f64fab1d2d monitor-manager: Make MetaCrtc a GObject
Turn MetaCrtc into a GObject and move it to a separate file. This
changes the storage format, resulting in changing the API for accessing
MetaCrtcs from using an array, to using a GList.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
39bc2e0333 monitor-manager/dummy: Define tile count instead of using array length
Explicitly define the tile count (2) and use this instead of the
crtc_decl array length.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
5bb6f0ad8b renderer/native: Use helper to iterate over logical monitor CRTCs
Don't iterate over all the CRTCs and check the CRTC logical monitor
state, but use the new MetaLogicalMonitor helper instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
903537a2a0 logical-monitor: Add helper for iterating over active CRTCs
Add meta_logical_monitor_foreach_crtc() helper to iterate over all the
active CRTCs driving the monitors associated with the specified logical
monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
1db937826c monitor-manager/xrandr: Fix crtc variable naming
The variable name of the local type (MetaCrtc) should not be prefixed,
while the external one should be.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
a62e9f99a2 backends: Remave unused meta_monitor_manager_get_resources() API 2017-10-05 16:18:43 -04:00
Jonas Ådahl
9817a6aa47 Make MetaOutput a GObject
Turn MetaOutput into a GObject and move it to a separate file. This
changes the storage format, resulting in changing the API for accessing
MetaOutputs from using an array, to using a GList.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
2017-10-05 16:18:43 -04:00
Jonas Ådahl
8185373bd4 screen-cast-stream-src: Only clean up pipewire remote/core if they exist
They can could fail to create, so lets deal better with that
possibility.

https://bugzilla.gnome.org/show_bug.cgi?id=788569
2017-10-05 16:15:48 -04:00
Jonas Ådahl
43eeb009ce monitor-config-migration: Discard if configured mode is missing
If a configuration key matched a current system state, but no monitor
mode was found (for example because of an incorrect refresh rate),
discard it while logging a warning.

https://bugzilla.gnome.org/show_bug.cgi?id=787668
2017-10-04 09:45:02 -04:00
Carlos Garnacho
9000eef49d backends: Add envvar to disable wacom configuration
People that relied on xsetwacom to configure their tablets used to get
away with this by disabling the wacom g-s-d plugin prior to running
their scripts. This is not possible anymore with mutter managing device
configuration.

Given that X11 shall not go away soon and there's a core of stubbornly
accustomed users, provide a MUTTER_DISABLE_WACOM_CONFIGURATION envvar
to provide *some* way to do this.
2017-10-04 01:03:49 +02:00
Jonas Ådahl
20749e5dbd renderer-native: Unset mode on disabled CRTCs
Make sure we properly unset the CRTC mode when a monitor is disabled.

https://bugzilla.gnome.org/show_bug.cgi?id=787629
2017-10-02 15:34:41 -04:00
Jonas Ådahl
ea4dbd14bc monitor-config: Keep track of disabled monitors for stored configs
When saving and restoring monitor configurations, we must take disabled
monitors into account, as otherwise one cannot store/restore a
configuration where one or more monitors are explicitly disabled. Make
this possible by adding a <disabled> element to the <configure> element
which lists the monitors that are explicitly disabled. These ones are
included when generating the configuration key, meaning they'll be
picked up correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=787629
2017-10-02 15:34:24 -04:00
Jonas Ådahl
838df4b00b monitor-config-store: Make monitor spec parsing/writing reusable
Another use of <monitorspec> will be added, so make the code dealing
with parsing and writing the reusable.

https://bugzilla.gnome.org/show_bug.cgi?id=787629
2017-10-02 15:32:35 -04:00
Jason Gerecke
8493777961 backends/x11: Prevent segfault when querying list of devices
The XIQueryDevice function used by device_query_area can return a NULL
pointer and set n_devices to a negative number in some cases. We add
additional checks to prevent a segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=787649
2017-09-28 09:58:17 -04:00
Hans de Goede
5d2b0bc0cc meta-input-settings: Fix strv memleak in find_logical_monitor()
The return value from g_settings_get_strv must be g_strfreev-ed.

https://bugzilla.gnome.org/show_bug.cgi?id=787836
2017-09-22 20:09:04 +02:00
Hans de Goede
7e3a780dcd monitor-config-manager-kms: Fix is_transform_handled
meta_monitor_manager_kms_is_transform_handled should checked the
transform passed as function argument, not the current crtc transform.

https://bugzilla.gnome.org/show_bug.cgi?id=787836
2017-09-22 20:09:04 +02:00
Hans de Goede
1035200f26 monitor-config-manager: Fix 90/270 degree rotation not working
When rotating 90/270 degrees we need to swap width and height. This fixes
the screen going black and the following errors showing in the journal:

gnome-shell[1097]: Failed to set CRTC mode 800x1280: No space left on device
gnome-shell[1097]: Failed to flip: Device or resource busy
gnome-shell[1097]: Failed to set CRTC mode 800x1280: No space left on device
gnome-shell[1097]: Failed to set CRTC mode 800x1280: No space left on device

When rotating a tablet with accelerometer 90/270 degrees.

https://bugzilla.gnome.org/show_bug.cgi?id=787836
2017-09-22 20:09:04 +02:00
Florian Müllner
f0c6c4eb1f screen-cast-stream-src: Adjust to pipewire API break
https://bugzilla.gnome.org/show_bug.cgi?id=787953
2017-09-21 18:14:26 +02:00
Jonas Ådahl
a35274ddb7 screen-cast-stream: Add stream parameters
For monitor streams, add position and size (in compositor coordinate
space) parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=787715
2017-09-20 18:27:57 +08:00
Rui Matos
ab541e3e0f monitor-config-migration: Fix a minor leak when parsing fails
https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:32 +08:00
Jonas Ådahl
67ce04993e monitor: Add scale 1 if no other supported scale was added
We currently have a hard coded limit on logical monitor sizes, meant
for filtering out monitor scales that would result in awkward desktop
sizes. This has the side effect of also disqualifying scale 1 for
resolutions that themself are lower than the mentioned limit. To avoid
listing no supported scales, always add the fallback scale 1 if no
other was added.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:32 +08:00
Jonas Ådahl
22cdc8f414 monitor-manager: Pass config to derive from when updating state
When we update state, we might not have set the current config yet (for
example if the Xrandr assignment didn't change), so pass the monitors
config we should derive from instead of fetching it from the monitor
config manager.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:32 +08:00
Jonas Ådahl
8b022a5595 monitor-config-store: Maybe force save configuration on tear down
If there is a pending config file content replacement in progress on
tear down, cancel it and save it synchronously to avoid any data loss.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:32 +08:00
Jonas Ådahl
7a1393ba26 monitor-config-store: Don't leak when saving synchronously
We currently only save synchronously when running the test suite, but
should still not leak the generated config buffer. We also created the
cancellable but never used it if we saved synchronously, so lets stop
doing that too.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:26:20 +08:00
Jonas Ådahl
5ed954e6de monitor-config-store: Don't clear cancellable when cancelled
The cancellable should only be cleared if we weren't cancelled, as if
we were cancelled, the path cancelling have already cleared the
cancellable.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:25:00 +08:00
Jonas Ådahl
96572fbe6a monitor-config-migration: Don't destroy autoptr:ed hash table
It'll be destroyed automatically, so don't do it manually as well.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 17:25:00 +08:00
Jonas Ådahl
4ab47e72e5 monitor-config-migration: Clean up properly when deriving
We cleaned up an unused monitor config list, but what we should do is
clear up the logical monitor config list. This commit does that, as
well as removes the unused monitor config list.
2017-09-20 17:24:49 +08:00
Jonas Ådahl
70e0fd0b45 backends: Chain up some GObjectClass vfuncs
Various vfunc implementations was not chained up properly. This commit
fixes that.

https://bugzilla.gnome.org/show_bug.cgi?id=787477
2017-09-20 11:14:27 +08:00
Carlos Garnacho
743e8cc249 backends: Add some wiggle room for refresh rate comparisons
We have not enough control over the sources of the refresh rate
float variable to make == comparisons reliable, add some room
when comparing these.

https://bugzilla.gnome.org/show_bug.cgi?id=787668
2017-09-14 13:31:25 +02:00
Florian Müllner
aa30e11c8b screen-cast-stream-src: Remove malformed include
The mutter prefix is wrong - as the include isn't actually needed in
the header, just remove it altogether.
2017-09-08 17:54:44 +02:00
Jonas Ådahl
dd4ad4efc4 Revert "renderer-native: Destroy monitor framebuffers when suspending"
The reverted commit seems to cause
https://bugzilla.gnome.org/show_bug.cgi?id=787240 for some reason. Lets
be safe and revert it for now, as the code freeze is just around the
corner.

This partly (it doesn't reintroduce a whitespace issue) reverts commit
dbc63430d8.
2017-09-04 22:37:16 +08:00
Bastien Nocera
361bf847af build: Require libgudev >= 232
And remove the g_autoptr implementations in mutter itself.

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2017-09-01 11:19:50 +02:00
Jonas Ådahl
522eec00cd monitor: Add foreach output helper and fix foreach crtc helper
The foreach CRTC monitor mode helper incorrectly iterated over outputs
without CRTC when non-tiled modes were set on tiled monitors. This was
not expected by callers, so fix the helper to only iterate over active
outputs (that has or should have a CRTC).

The test cases uses the incorrect behaviour of the foreach CRTC helper
to check that the disabled outputs mode are set to NULL, so add a
foreach output helper and change the tests to use that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
0aa7405a2a monitor-manager: Fall back to minimum screen size of 640 x 480
When headless, we don't have any logical monitors to derive a screen
size from, but we can't set it to empty as that will cause issues with
the clutter stage, UI widget layout and other things. To avoid such
issues, just fall back to a 640 x 480 screen size when headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
a119e58773 backend: Only try to center pointer when there not headless
Don't attempt to center the pointer when there is nothing to center on.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
8a32b42172 renderer/native: Round calculated framebuffer size before casting to int
Due to rounding issues, we can't assume a floating point calculation
will end up on an integer, even if we got the factor from the reverse
calculation. Thus, to avoid casting away values like N.999... to N,
when they should really be N+1, round the resulting floating point
calculation before casting it to int.

This fixes an issue where using the scale ~1.739 on a 1920x1080 mode
resulted in error when setting the mode, as the calculated size of the
framebuffer was only 1919x1080.

https://bugzilla.gnome.org/show_bug.cgi?id=786918
2017-08-30 13:07:11 +08:00
Jonas Ådahl
6e46ad9f3a remote-desktop, screen-cast: Fail session method calls from other peers
Only accept method calls on the session objects from the same peer that
created the session.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
921b18f713 screen-cast-session: Allow stand alone screen cast sessions
When a screen cast session is stand-alone, i.e. not created given a
remote desktop session managing it, allow calling the Start/Stop
methods to start and stop it.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
53175e8788 ScreenCast: Pass PipeWire stream node ID directly
As of commit 5f5ef3de2cdc816dab82cb7eb5d7171bee0ad2c5 in pipewire the
stream creator can find out the node ID of the stream it created.

So instead of using a special purpose entry to the info property box to
let the application discover stream by monitoring added nodes searching
for the given special purpose entry, just pass the node directly.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
920541fa26 screen-cast-stream-src: Only try to record frames when streaming
Only when the PipeWire stream state is 'PW_STREAM_STATE STREAMING'
should the signal be connected causing the src to maybe record a frame.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
9d8922764c screen-cast: Handle PipeWire errors
When the PipeWire context or stream ends up in an error state, signal
that the source has closed. This then triggers the stream and finally
the session to be closed too.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
97f2c7c161 Add remote desktop and screen cast functionality
This commit adds basic screen casting and remote desktoping
functionalty. This works by exposing two D-Bus API services:
org.gnome.Mutter.ScreenCast and org.gnome.Mutter.RemoteDesktop.

The remote desktop API is used to create remote desktop sessions. For
each session, a D-Bus object is created, and an application can manage
the session by sending messages to the session object. A remote desktop
session the user to emit input events using the D-Bus methods on the
session object. To get framebuffer content, the application should
create an associated screen cast session.

The screen cast API is used to create screen cast sessions. One can so
far either create stand-alone screen cast sessions, or a screen cast
session associated with a remote desktop session. A remote desktop
associated screen cast session is managed by the remote desktop session.

So far only remote desktop managed screen cast sessions are implemented.

Each screen cast session may have one or more streams. A screen cast
stream is a stream of buffers of some part of the compositor content.
So far API exists for creating streams of monitors and windows, but
only monitor streams are implemented.

When a screen cast session is started, the one PipeWire stream is
created for each screen cast stream created for the session. When this
has happened, a PipeWireStreamAdded signal is emitted on the stream
object, passing a unique identifier. The application may use this
identifier to find the associated stream being advertised by the
PipeWire daemon.

The remote desktop and screen cast functionality must be explicitly be
enabled at ./configure time by passing --enable-remote-desktop to
./configure. Doing this will build both screen cast and remote desktop
support.

To actually enable the screen casting and remote desktop, the user must
enable the experimental feature. See
org.gnome.mutter.experimental-features.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
3ce3a5a952 monitor: Add API to compare with old instance
When monitors changed, previous monitor instances are defunct, and any
reference holder should drop its reference. Sometimes they will want to
continue having a reference to the same monitor, so add this function
to make it possible to find it.

Currently the output and crtc references are invalid, as they are not
yet reference counted, so this can only look at cached fields.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:38:20 +08:00
Jonas Ådahl
3005a400ca monitor-manager: Add helper for getting monitor from connector
This will be used later.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Mario Sanchez Prada
e075242801 egl: Don't require eglGetPlatformDisplayEXT
Trying to unilaterally require eglGetPlatformDisplayEXT causes problems in
scenarios where this method is not available. Besides, this should only be
required on Wayland, so we can stop requiring it always and simply let the
eglGetPlatformDisplay() function error accordingly when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=786619
2017-08-22 18:33:13 +02:00
Jonas Ådahl
14fe6e9c95 cursor-renderer-native: Don't use HW cursor on transformed logical monitor
The HW cursor plane can't do any transformations, and as we still don't
pre-transform any buffer before uploading to the cursor plane, we must
disable the HW cursor when a logical monitor is transformed.

This worked previously because the transform of a MetaCrtc did not
correspond to the transform of a CRTC, but the transform of the logical
monitor the CRTC was assigned to.

https://bugzilla.gnome.org/show_bug.cgi?id=786023
2017-08-21 21:20:19 +08:00
Jonas Ådahl
6584d06bb5 monitor-manager: Don't cancel confirm dialog on verifying
When another D-Bus call that just tries to verify a configuration is
made, don't cancel any active monitor configuration dialog, as doing so
would effectively confirm queried configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=786023
2017-08-21 21:20:19 +08:00
Jonas Ådahl
a81d4aed7a backend/x11: Notify whenever the layout group changes
Will be used to trigger keyboard binding rebuild.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
517488ef67 backends/native: Only emit layout group changed event when changed
Check that the layout group changed before emitting a changed event.
2017-08-21 21:19:18 +08:00
Jonas Ådahl
33f1706634 backend: Add API to get layout group
Add API to get the layout group (layout index) currently active. In the
native backend this is done by fetching the state directly from the
evdev backend; on X11 this works by listening for XkbStateNotify
events, caching the layout group value.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
a6d67b164a x11: Open backend X11 connection ourself
Don't wait for clutter to initialize for connecting to X11; do it when
constructing the backend instance. This way we can later depend on
having an X11 connection earlier during initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
f950380202 monitor-manager-xrandr: Use G_DECLARE_FINAL_TYPE macro
Declare the MetaMonitorManagerXrandr type using the helper macro,
instead of manually.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
35c9280fb6 monitor-manager: Try to restore previous config before regenerating
When opening a laptop lid, one will likely want to restore the
configuration one had prior to closing it, so when ensuring monitor
configuration, first try to see if the previously set configuration is
both complete (all connected monitors are configured) and applicable
(it is a valid configuration) and only try to generate a new from
scratch if that failed.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
b140e7fbeb monitor-config-manager: Keep short history of configurations
In order to go back in monitor configurations, save them to a history.
The history is implemented as a max 3 element long queue, where newly
set configurations are pushed to the head, and old are popped from the
tail.

The difference between using a single previous config reference and a
queue is that we can now remember the configuration used prior to a
D-Bus triggered configuration when the user discarded the configuration.

This will later be used to restore a previous configuration when a
laptop lid is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
bc3162460f Migrate old monitor configuration files to new system
This commit changes the new configuration system to use monitors.xml
instead of monitors-experimental.xml. When starting up and the
monitors.xml file is loaded, if a legacy monitors.xml file is
discovered (it has the version number 1), an attempt is made to migrate
the stored configuration onto the new system.

This is done in two steps:

1) Parsing and translation of the old configuration. This works by
parsing file using the mostly the old parser, but then translating the
resulting configuration structs into the new configuration system. As
the legacy configuration system doesn't carry over some state (such as
tiling and scale used), some things are not available. For tiling, the
migration paths makes an attempt to discover tiled monitors by
comparing EDID data, and guessing what the main tile is. Determination
of the scale of a migrated configuration is postponed until the
configuration is actually applied. This works by flagging the
configuration as 'migrated'.

2) Finishing the migration when applying. When a configuration with the
'migrated' flag is retrieved from the configuration store, the final
step of the migration is taken place. This involves calculating the
preferred scale given the mode configured, while making sure this
doesn't result in any overlapping logical monitor regions etc.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
27a4f9f862 monitor-manager/kms: Use connector id to find old output
The zero-initialized winsys id was incorrectly used as the key to find
the old output to base active/primary state from, which would never
succeed unless the winsys id happened to be 0. Fix this by using the
winsys id that will be used, i.e. the connector id.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
88f2441330 monitor-manager: Fix output variable naming
Fix the last case of using the variable name "meta_output" for a
MetaOutput.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
ab04286c6b monitor-manager/x11: Don't complain about 'normal' transform
The 'normal' transform has the value 0, so the g_warn_if_fail()
expression failed. Correct it so that it doesn't complain when no
transform is checked.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
e8a62861c9 Remove old monitor configuration system
Remove the old MetaMonitorConfig system and mark the new one as
non-experimental. This also removes the D-Bus property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:53 +08:00
Jonas Ådahl
9ac87b36c1 monitor-manager/xrandr: Fix name inconsistencies
MetaOutputs should be "output" and external types should be named as
such, i.e. XRandr outputs are renamed to "xrandr_output".

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:30 +08:00
freeroot
12792f99a0 Add tag-and-drag setting from libinput into mutter
The problem is that libinput offers the possibility to not enabled
dragging when tap-to-click is enabled but mutter doesn't. For people who
have a sensitive touchpad and who like tap-to-click option, dragging is
launched even when you don't want it : for example, when you select a
folder, most of the time the folder is dragging whereas just selected or
when you want to select some lines of a text file, several lines are
moved as a cut-paste which is not expected and erase datas.

To fix it, you need to have the possibility to desactivate the drag
option when you use tap-to-click in mutter. Because it's already a
specification of libinput, it remains to add it to mutter.
Implementation with X11 is added too.

https://bugzilla.gnome.org/show_bug.cgi?id=775755
2017-08-20 09:27:28 +08:00
Rui Matos
420a712ad5 meta-monitor: Make supported scales determination saner
Scales below 1 and scales that result in a too small logical monitor
size don't make sense. We also don't need so many intermediate scales.

https://bugzilla.gnome.org/show_bug.cgi?id=786474
2017-08-18 18:41:01 +02:00
Jonas Ådahl
dbc63430d8 renderer-native: Destroy monitor framebuffers when suspending
When suspending (i.e. VT switching away, the GDM gnome-shell instance
gets hidden, or changing user), destroy the onscreen and offscreen
monitor framebuffers. When resuming, the stage views and framebuffers
will be recreated anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=786299
2017-08-16 13:17:43 +08:00
Daniel Stone
b7b5fb293d wayland: Add zwp_linux_dmabuf_v1 support
https://bugzilla.gnome.org/show_bug.cgi?id=785262
Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-08-01 19:05:50 +08:00
Cosimo Cecchi
1455c402b9 monitor-manager: add API to get the display configuration timeout
Instead of hardcoding this into two different places, add an API so that
gnome-shell can fetch it.

https://bugzilla.gnome.org/show_bug.cgi?id=767805
2017-07-31 15:41:15 +01:00
Rui Matos
3f9c5823cb backends: Add API to switch to predetermined monitor configurations
This will allows us to support the XF86Display key present on some
laptops, directly in mutter. This is also known, in evdev, as
KEY_SWITCHVIDEOMODE.

The common usage for this key is to alternate between a few well known
multi-monitor configurations though these aren't officially
standardized. As an example, Lenovo documents it as:

"Switches the display output location between the computer display
and an external monitor."

On this patch, we're just introducing the configurations that have been
implemented in g-s-d until now, which go a bit beyond the above
description.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-19 11:18:53 +02:00
Jonas Ådahl
32fd1e8c08 monitor-manager: Let the MetaMonitor derive the whole layout
Instead of letting MetaMonitor derive the logical monitor size, then
using the main monitor for the position, just let MetaMonitor derive
the whole layout including the position. This means it can deal with
tiled monitors better, for example when the main output (the output
always active when the monitor is active) is not the origin output (the
output with tile position (0, 0)).

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-07-19 17:06:17 +08:00
Carlos Garnacho
f852d2b0eb backends: Extend pad action label checks to rings/strips
This way the pad OSD can obtain the keycombos that are mapped to these
for labeling purposes.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-17 19:43:13 +02:00
Carlos Garnacho
ef13ee4488 backends: Map tablet pad rings/strips to action settings
Just like we do for buttons, with a few twists. These have 2 directions
mappable to different keycombos, and are affected by the current mode
in their group.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-14 22:30:49 +02:00
Florian Müllner
8b5d34b24a monitor-manager: Shut up a compiler warning
Add a default switch statement to make it clear that 'transform'
won't be used uninitialized.
2017-07-14 16:56:43 +02:00
Rui Matos
7360f51ee8 meta-monitor-manager: Add API to rotate the current configuration
This will allows us to support the XF86RotateWindows key present on
some laptops directly in mutter.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Rui Matos
6ae42f3845 monitor-manager: Hook MetaOrientationManager to change the config
On orientation changes we'll apply the appropriate monitor transform
to the current configuration if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Rui Matos
26b66826dc meta-monitor-config: Add API to rotate the current config
This will allow us to do automatic rotation of the builtin display if
that's the only active monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Rui Matos
6d082bf442 monitor-config-manager: Add API to rotate the current config
This will allow us to do automatic rotation of the builtin display if
that's the only active monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Rui Matos
aad2280309 backends: Add a MetaOrientationManager class
This basically moves g-s-d's orientation plugin into mutter so that
eventually g-s-d doesn't need to build monitor configurations by
itself anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Jonas Ådahl
777963eeb6 monitor-manager: Don't set current config if only verifying
When verifying if a configuration is applicable, don't set it as
current when applying succeeded, or else reverting to a previous
configuration doesn't work after having verified.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
49c5228655 DisplayConfig: Add support for interlaced modes
Differentiate between non-interlaced and interlaced modes. This is done
by appending an "i" after the resolution part of the mode ID, and
adding a 'is-interlaced' (b) property to the mode properties.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
a9c1c6d9fb Fix a couple of wrong indentations
https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
0a8e108f10 DisplayConfig: Replace mode 'u' flags with 'a{sv}' property bag
To be more flexible without having to change any D-Bus type signatures
in the future, replace the 'uint' flags value (currently determining
whether a mode is current and/or preferred) with a variant lookup table.

The keys 'is-current' (b) and 'is-preferred' (b) replace the existing
flags.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
859b01fc39 DisplayConfig: Specify mode ID string instead of mode spec
To be able to add more modes types that happen to have the same
resolution and refresh rate, change the API to specify modes using an
ID string. The ID string is temporary, and only works for associating a
mode for the monitor instance that it was part of.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
41eea5a942 monitor-config: Handle fractional scale precision loss
When calculating sizes given some size and a fractional logical monitor
scale with precision loss, round the result of the floating point
calculation to the closest integer, as otherwise we might end up with
result smaller by 1 if there was a loss of precision when calculating
the scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
197401fbf8 cursor-renderer: Track cursor position using floats
To be able to render the pointer cursor sprite at sub-(logical)-pixel
positions, track the pointer position using floats instead of ints.
This also requires users of the cursor sprite rect to deal with
floating points, when e.g. finding the logical monitor etc.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
aa5d8ac68c monitor-config-store: Don't discard scale < 1.0 configurations
It's not the task of the XML parser to decide this; let the code
listing allowed scales sort out configurations with invalid scales.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
67eb289a6a monitor-manager: Find the supported scales from one passed
When passing scales over D-Bus, we'll loose some precision. To set the
correct scale, use the configured scale and look up the one actually
supported by the monitor mode, and use that. To match the supported one
with the configured one, the difference must be within rounding error
range.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
5f2bb43061 backend/native: Don't double-scale pointer motions on scaled monitors
We manually scaled pointer motions when they travel over a scaled
monitor. When a stage view of a monitor is also scaled, in practice this
meant we scaled twice. Avoid this by only manually scaling the pointer
motion when stage views are not scaled.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Marco Trevisan (Treviño)
3e8d0204bd monitor: Dynamically calculate supported scales per resolution
When using logical sized monitors we are allowed to use fractional scaling
but only if the resulting scaled logical monitor size is in integer form.
So, in order to get this, we allow to scale the monitor to up to
8 fractional values per integer, doing some computation in order to
fetch the nearest values which are closer to the scaling factors we can
permit.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b2a530b326 DisplayConfig: Make supported scales per mode
This changes the API to pass supported scales per mode instead of
providing a global list. This allows for more flexible scaling
scenarious, where a scale compatible with one mode can still be made
available even though another mode is incompatible.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
10b0351a59 Add support for rudimentary fractional scaling
When the logical layout mode is used, allow configuring the scaling to
be non-integer. Supported scales are so far hard coded to include at
most 1, 1.5 and 2, and scales that doesn't result in non-fractional
logical monitor sizes are discarded.

Wayland outputs are set to have scale ceil(actual_scale) meaning well
behaving Wayland clients will provide buffers with buffer scale 2, thus
being scaled down to the fractional scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b64c69e4bc logical-monitor: Make scale a float
To support fractional scaling, the logical monitor scale must be stored
as a float. No other functional changes is part of this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
c2e49f1bb5 clutter: Change stage view scale to be float
To support fractional scaling, change the stage view scale to be a
float instead of an int. Also change the places where it is retrieved
and used when scaling things.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
88cae8bd3d settings: Manage our own font DPI
Previously gnome-shell listened on the Xft Xsettings via GTK+s
GtkSettings to get the font DPI setting. The Xsetting might not
be what we want, and we should not rely on Xsettings when we don't need
to, so lets manage it ourself.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Carlos Garnacho
a6ec2b1d42 backends: Set error when opening /sys file fails
The caller in clutter really expects an error if fd==-1, so make
sure we set one here. Otherwise we get a nice crash in addition to
the failure to open the /sys file. Also, retry on EINTR.

https://bugzilla.gnome.org/show_bug.cgi?id=784881
2017-07-14 12:28:32 +02:00
Carlos Garnacho
4b8dd51c4d backends: Fix dangling callback not being disconnected
This fixes possible crashes if configuration is changed on a device that
was added and then removed.

https://bugzilla.gnome.org/show_bug.cgi?id=784881
2017-07-13 19:05:44 +02:00
Carlos Garnacho
10b30eaba5 backend: Set mapping-mode on X11 pen/eraser devices
And use it in the generic code for the checks about whether mapping to
an specific display applies or not.

https://bugzilla.gnome.org/show_bug.cgi?id=784402
2017-07-12 23:43:23 +02:00
Jonas Ådahl
1303c626b1 renderer-native: Fix compilation when EGLDevice renderer not enabled
When --enable-egl-device is not passed to ./configure, the
egl_device_error will not be declared; don't try to free it when its not
declared.
2017-07-07 17:59:20 +08:00
Miguel A. Vico
7eea82d3d7 MetaRendererNative: Give EGLDevice backend priority over GBM
With GLVND, whenever we have both Mesa's and NVIDIA's drives installed
in the system, initializing the GBM backend will always succeed,
regardless of what GPU you have on your system.

This is due to GBM's software rendering fallback.

It seems better to initialize the EGLDevice backend first, which will
fail to find a device match when given a non-NVIDIA GPU.

https://bugzilla.gnome.org/show_bug.cgi?id=784272
2017-07-07 11:55:18 +08:00
Carlos Garnacho
ce989976fa backends: Apply tablet settings on all tablet device types during startup
This skipped the device types that are in use on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=782027
2017-07-03 13:57:35 +02:00
Jason Gerecke
74882b2502 backends/x11: Account for non-zero device origin when setting tablet area
Wacom's display tablets typically do not have (0,0) coincident with the top
left corner of the screen. This "outbound" area must be taken into account
when setting the area or else an unexpected offset of the pointer will
occur.

https://bugzilla.gnome.org/show_bug.cgi?id=784009
2017-07-03 13:49:14 +02:00
Jason Gerecke
a4cef8586c backends/native: Interpret tablet padding as being input-centric
It is possible to interpret the ammount of padding provided to the
*_set_tablet_area functions in two different and incompatible ways. The X11
backend effectively treats them as being input-centric (i.e., the padding
defines the size of the "dead zone" on the tablet) while the native backend
has an output-centric viewpoint (i.e., the padding defines the size of the
"dead zone" on the display) viewpoint. This difference in opinion causes the
cursor offset to change when switching between Xorg and a Wayland sessions.

The calibration utility within g-c-c does its calculations with an input-
centric viewpoint, so this patch modifies the native backend to work
correctly with these values. To change viewpoints, we can simply invert
the scale and negate the offset. It should be noted that this function
also forgot to apply scaling to the offsets (as required by the matrix
transform done by libinput) which would have further compounded the
cursor offset issue under Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=784009
2017-06-20 23:42:38 +02:00
Carlos Garnacho
9b9bb9cf86 backends: Fix output cycling in non display-attached tablets
It would only allow to alternate between the logical monitors, we actually
want to return NULL here so it can cycle to the whole span of monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=782032
2017-06-20 22:02:04 +02:00
Carlos Garnacho
dc5b2e396c backends: Fix typo
Instead of checking all MetaMonitors in the monitor manager, we want to
look (as the function name says) in the MetaMonitors contained in the
given logical monitor.

Otherwise, it will return TRUE for every logical monitor, given we are
querying for an existing EDID.

https://bugzilla.gnome.org/show_bug.cgi?id=782032
2017-06-20 22:02:04 +02:00
Carlos Garnacho
d23275bc76 backends/x11: Handle left-handed mode on pen/eraser devices correctly
Due to the pen/eraser device separation in X11, CLUTTER_TABLET_DEVICE does
not apply there, this device type is only used in native/evdev. Checking
for CLUTTER_PEN/ERASER_DEVICE makes the left-handed mode correctly applied
on tablets.

https://bugzilla.gnome.org/show_bug.cgi?id=782027
2017-06-20 22:02:04 +02:00
Carlos Garnacho
48e820235e backends/x11: Fix c&p issue in tablet area calculation
instead of filling in the last array value, it overwrote the previous one.

https://bugzilla.gnome.org/show_bug.cgi?id=781703
2017-06-20 22:02:04 +02:00
Christian Kellner
7938f41c11 monitor: invert logic for 4k TV scaling
For devices connected via HDMI (supposedly TVs) we want have a
scale factor of 1 if we are *below* the smallest 4k resolution
width (not equal or above) and do the scaling factor computation
if we are above the limit. This check was apparently wrongly
ported from gnome-settings-daemon.

Based of a patch by Caolan McNamara <caolanm@redhat.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=777347
2017-06-07 14:03:03 +02:00
Ikey Doherty
e9c9ee844c backends/x11: Ensure reply is initialised to NULL 2017-05-31 19:15:39 -04:00
Bastien Nocera
f5f0ff0a2f monitor-manager: Fix crash when UPower is not available
Don't access the upower client if it doesn't exist

https://bugzilla.gnome.org/show_bug.cgi?id=780407
2017-05-31 16:11:24 +02:00
Jonas Ådahl
82325cbcfd monitor: Don't get the monitor manager from the backend
We will both create and destroy monitors during initialization (when
using the X11 backend), so don't try to access the monitor manager from
the backend, but store a pointer to it instead.

It's stored in MetaMonitor even though only MetaMonitorTiled uses it,
mostly because it makes more sense to store such a pointer there.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
c32e2d17d9 monitor: Handle tiled monitors where (0, 0) is not the main output
In some circumstances, the origin tile (0, 0) is not the one that
should be used to drive the monitor when using a non-tiled mode. Update
MetaMonitorTiled to support this case. It also seems to be so that the
preferred mode might be some low resolution or bogus mode on these
monitors, so also adapt MetaMonitorTiled to manage to ignore the
preferred mode of a tiled monitor if the preferred mode doesn't use
both tiles.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
2b05748d5c monitor: Move get_suggested() behind behind vfunc
Only support suggested monitor positioning if the monitor is non-tiled.
Normally this functionality is used by virtual machines to provide a
hint of how to place the virtual monitors, and they don't tend to use
tiled monitors anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
cd775929bf monitor: Move tiled CRTC mode identification into helper
It'll be used in more places later.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
7303a78b06 monitor: Generate spec struct earlier
By generating the spec struct earlier, code executed later can use the
fields in the spec.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
07b8cc0773 monitor: Fix naming of spec generation function
It was at one point referred to as 'id', but was changed to 'spec', but
the name of this function was not updated.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
1bb0e18042 monitor-manager/xrandr: Allow configuring scales on X11 too
This commit makes it possible to configure logical monitor scale also
when running on top of an X11 server using Xrandr. An extra property
'requires-globla-scale' is added to the D-Bus API is added to instruct
a configuration application to only allow setting a global logical
monitor scale.

This is needed to let gsd-xsettings use the configured state to set a
XSettings state that respects the explicit monitor configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
3b097c7e77 monitor-manager/kms: Move scale calculation to MetaMonitor
The scale calculation doesn't really have anything to do with KMS, and
eventually we'll want to have mutter calculate the monitor scale for
non-KMS backends too, so move the scale calculation to MetaMonitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
0bc312a54b monitor-manager/kms: Move global ui scaling setting to MetaSettings
It'll be used elsewhere, so shouldn't be in MetaMonitorManagerKms.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
2718699ccc backend: Move settings into a new MetaSettings object
Introduce MetaSettings and add the settings managed by MetaBackend into
the new object. These settings include: experimental-features and UI
scaling factor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
be175558c3 backend: Make X11 display opened function explicitly named
It didn't say anything about being the X11 display, so make it say so.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
df39a7d0fd monitor-manager/xrandr: Use xcb API to configure CRTC
Use xcb-randr instead of libXrandr to set the CRTC configuration. This
is needed because data from the reply will later be used.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
43cdf81f6b backend: Make the getter use the cached ui scale
The cached ui scale is kept up to date, so don't recalculate it
everytime meta_backend_get_ui_scaling() is called.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Marco Trevisan (Treviño)
183f4b0c13 MetaMonitorManager: ignore hotplug_mode_update at startup
hotplug_mode_update is used (mostly by VMs nowadays, and
VMware has implemented it) to inform that modes list (including
the preferred one) might change after an uevent.

However, when using MetaMonitorConfigManager we should
ignore this value at initialization level, or mutter
won't restore the configured values at startup.

https://bugzilla.gnome.org/show_bug.cgi?id=783073
2017-05-25 16:50:29 +08:00
Evan Welsh
76198e0b3b Implements disable-while-typing in mutter.
Disable-while-typing disables the touchpad while the user is typing.

This patch introduces the necessary backend code to implement the
org.gnome.desktop.peripherals.touchpad.disable-while-typing setting of
gsettings-desktop-schemas which was implemented in commit
4c5b1c1df399d6afaaccb237e299ccd1d5d29ddd and released as part of 3.24.
This is known as dwt in libinput.

This patch has been tested on X11 and Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=764852
2017-05-24 11:56:54 +08:00
Jonas Ådahl
efc190789f backend: Couple of whitespace fixes
https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +08:00
Jonas Ådahl
81e99c2680 input-settings: Minor structural cleanup
Let the backend implementations create their own input settings
backend, as is done with other backend specific special purpose
backends. Also use the macro for declaring the GType.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +08:00
Jonas Ådahl
755755a2f3 backend: Move out some code from post_init()
meta_backend_real_post_init() had some open coded initialization with
some unexpected interdependencies. Split these up and move them to their
own functions in order to make meta_backend_real_post_init() a bit more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:17:46 +08:00
Carlos Garnacho
f2309cdb55 backends: Store MUTTER_STAGE_VIEWS envvar content just once
No need to poke this regularly while drawing the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-09 11:53:46 +02:00
Carlos Garnacho
d0bfb94ff0 backends/native: Avoid generic closure marshaler for page flip handling
This turns out more expensive than necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-09 11:52:57 +02:00
Jonas Ådahl
0608ae2d4e monitor-config-store: Replace key when replacing config
g_hash_table_insert() doesn't replace the key. This was a problem
because the key was owned by the value inserted into the hash table, so
when a value was removed, the key was freed, meaning that the key in
the hash table was no pointing to freed memory. Fix this by using
g_hash_table_replace() instead, which work the same except that it
replaces the key with the one passed. This means that the key of a
value in the hash table is always the key owned by the value.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-17 13:26:40 +08:00
Jonas Ådahl
3f107da479 monitor-config-manager: Handle comparing different sized config keys
The guard for handling size differences between keys were broken, it
only checked if the key passed by the second argument ended up being
shorter.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-17 13:26:40 +08:00
Rui Matos
612432ac3e monitor-manager: Fix format-security gcc warnings 2017-04-12 16:53:30 +02:00
Jonas Ådahl
c214eb15bf monitor-manager: Check active monitors when looking for logical monitor
An inactive monitor will not be assigned to a logical monitor, so don't
try to match against those. This avoids a dereferencing a NULL when the
main output of an inactive monitor doesn't have an assigned CRTC.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 23:53:51 +08:00
Jonas Ådahl
e6eac46629 backend: Get the UI scaling factor from the logical monitors
Instead of looking at the GTK+ settings, check the logical monitor
state and determine the UI scaling factor given the maximum logical
monitor scale. This is only enabled when the monitor config manager
feature is enabled, as only then can a scale be explicitly configured.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
de61da16ae monitor-manager: Reconfigure when 'scale-monitor-framebuffer' is toggled
When the experimental feature 'scale-monitor-framebuffer' is enabled or
disabled, reconfigure the monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
bdcb395b33 DisplayConfig: Add 'supports-changing-layout-mode' property
This property may be used by a client to determine whether it is
allowed to change the layout mode.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
1caa7f7627 monitor-manager: Add public API to get logical monitor from connector
This adds a function to be used by gnome-shell to get the logical
monitor given a connector name. For now, use the same index integer
method to reference a logical monitor, but this should be revisited by
providing a better API later.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00