Commit Graph

883 Commits

Author SHA1 Message Date
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