1
0
Fork 0
Commit graph

6205 commits

Author SHA1 Message Date
Miguel A. Vico
4fdc551209 MetaRendererNative: Properly handle EGLOutput acquire errors
Whenever an EGLOutput consumer is temporary unable to handle
eglStreamConsumerAcquire() operations (e.g. during a VT-switch),
an EGL_RESOURCE_BUSY_EXT error is generated.

This change adds the appropriate error handling to flip_egl_stream() in
order to recover from such errors.

https://bugzilla.gnome.org/show_bug.cgi?id=779112
2017-03-04 18:34:17 +08:00
Miguel A. Vico
58043cbc8b egl: Add EGL_RESOURCE_BUSY_EXT error
This change adds both the error code and description for
EGL_RESOURCE_BUSY_EXT, recently added to the EGL_EXT_stream_acquire_mode
extension:

  https://github.com/aritger/eglstreams-kms-example/blob/master/proposed-extensions/EGL_EXT_stream_acquire_mode.txt

https://bugzilla.gnome.org/show_bug.cgi?id=779112
2017-03-04 18:34:17 +08:00
Miguel A. Vico
09fa27cd09 egl: Add stream-related error descriptions
This change adds descriptions for the following errors to
get_egl_error_str():

  - EGL_BAD_STREAM_KHR
  - EGL_BAD_STATE_KHR
  - EGL_BAD_DEVICE_EXT
  - EGL_BAD_OUTPUT_LAYER_EXT

https://bugzilla.gnome.org/show_bug.cgi?id=779112
2017-03-04 18:34:17 +08:00
Jonas Ådahl
d8ee96c6cb egl: Pass EGL errors via custom error domain
Introduce META_EGL_ERROR and have the error code be EGL error codes.

https://bugzilla.gnome.org/show_bug.cgi?id=779112
2017-03-04 18:34:17 +08:00
Rui Matos
1f20e82a96 ui/frames: Simplify client area control computation
Ungrabbed pointer motion events over a client window area don't even
reach mutter in X compositor mode, but as a wayland compositor we
process those events which ends up in a call stack like:

- meta_window_handle_ungrabbed_event
 - meta_ui_frame_handle_event
  - handle_motion_notify_event
   - get_control
    - meta_ui_frame_calc_geometry

Computing frame geometry is a relatively CPU expensive operation and
doing it on every motion event over a client window is pointless work
since we aren't going to change the cursor or prelight any frame
widget.

This commit special cases the determination of
META_FRAME_CONTROL_CLIENT_AREA using a much faster method. When
continuously moving the pointer over an X (client) window, it results
in a ~40% decrease in mutter cpu usage.

https://bugzilla.gnome.org/show_bug.cgi?id=779436
2017-03-02 19:40:27 +01:00
Owen W. Taylor
383ba566bd Call cogl_xlib_renderer_set_threaded_swap_wait_enabled()
Set up things so that if the INTEL_swap_event extension is not present,
but the driver is known to have good thread support, we use an extra
thread and call glXWaitVideoSync() in the thread. This allows idles
to work properly, even when Mutter is constantly redrawing new frames;
otherwise, without INTEL_swap_event, we'll just block in glXSwapBuffers().

https://bugzilla.gnome.org/show_bug.cgi?id=779039
2017-02-21 16:25:02 -05:00
Rui Matos
5ba38a4ab6 x11/xprops: Plug a few memory leaks
Commits 6dbec6f8, 734402e1 and f041b35b introduced memory leaks by
switching to returning copies instead of the original buffers but
forgetting to free those original buffers.

Some error cases were also not freeing the ->prop buffer as they
should.

https://bugzilla.gnome.org/show_bug.cgi?id=642652
2017-02-21 19:51:46 +01:00
Rui Matos
8f5a0ec83d constraints: Make zero sized windows be placed in the correct monitor
Wayland windows can be zero sized until clients attach a buffer, but
our rectangle code doesn't deal with this case well, in particular,
meta_screen_get_monitor_for_rect() might end up choosing the wrong
monitor for a zero sized rectangle since
meta_rectangle_contains_rect() considers a zero sized rectangle at the
right or bottom edges of another rectangle (the monitor's) to be
contained there.

Since out size limits constraint will enforce a minimum size of 1x1,
we might as well enforce that when setting up the constraint info so
that the correct monitor gets chosen and the single monitor constraint
doesn't move these windows to the wrong one.

https://bugzilla.gnome.org/show_bug.cgi?id=772525
2017-02-21 19:51:34 +01:00
Rui Matos
bb2e8ff09a window: Make move_to_monitor work for zero sized and offscreen windows
Wayland windows are initially zero sized until clients commit the
first buffer. Despite being invisible, clients are allowed to request
such windows to be fullscreened on a specific output before they
attach the first buffer which means we need to be able to move them.

meta_window_move_to_monitor() doesn't handle this case because these
windows' initial monitor is a placeholder since their initial
coordinates are 0,0+0+0, which results in us using a rectangle as
old_area for meta_window_move_between_rects() that might be to the "right"
of the window causing the move to go further out of the visible
screen's coordinates. This is later "corrected" by the constraints
system but the window might end up in the wrong monitor.

To fix this, we can make meta_window_move_between_rects() accept a
NULL old_area, meaning that we move the window to the new_area without
trying to keep a relative position.

https://bugzilla.gnome.org/show_bug.cgi?id=772525
2017-02-21 19:51:32 +01:00
Rui Matos
1fe10f09d7 wayland-xdg-shell: Handle the wl_output on the set_fullscreen request
This makes us fullscreen wayland windows on the requested monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=772525
2017-02-21 19:51:16 +01:00
Florian Müllner
e1ffe15d94 display: Check we have a screen before freeing it
The reason for the display to be closed may be meta_screen_new()
returning NULL, in which case we don't have a screen to free.
Avoid a segfault on exit by adding a proper check.

https://bugzilla.gnome.org/show_bug.cgi?id=778831
2017-02-19 20:56:25 +01:00
Rui Matos
36ee6f656a wayland/keyboard: Avoid a division by zero
We don't further sanitize the values since the protocol allows for
everything as long as it's non-negative.

https://bugzilla.gnome.org/show_bug.cgi?id=776919
2017-02-16 16:49:44 +01:00
Rui Matos
966725fcb4 meta-input-settings: Avoid setting key repeat delay or interval to 0
Since doing so causes either errors or misbehavior.

https://bugzilla.gnome.org/show_bug.cgi?id=776919
2017-02-16 16:49:44 +01:00
Rui Matos
90923903ae MetaInputSettings: allow edge scrolling without 2fg capable devices
We should only force edge scrolling off if two finger is enabled *and*
we actually have two finger capable devices.

https://bugzilla.gnome.org/show_bug.cgi?id=778554
2017-02-16 16:49:44 +01:00
Carlos Garnacho
2d18b18fe5 backends: Allow opening /sys/ files on MetaLauncher
libinput may want to access those for fetching LED status, as those are
requested readonly, just forward the request to plain open().

https://bugzilla.gnome.org/show_bug.cgi?id=778472
2017-02-16 13:48:55 +01:00
Piotr Drąg
ead62f1901 Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772218
2017-02-16 02:44:16 +01:00
Florian Müllner
827db6f7c7 build: Clean up .pc files 2017-02-15 23:54:07 +01:00
Juraj Fiala
91c6a144da Update shadows to match Adwaita better
This should make Mutter shadows almost indifferentiable to the ones made
by Adwaita. Based on an initial patch from Maxim <dead.555@bk.ru>.

https://bugzilla.gnome.org/show_bug.cgi?id=744667
2017-02-15 23:54:07 +01:00
Florian Müllner
cb86745245 window-actor: Special-case COMBO window's shadow class
We currently don't have any shadow class for combo box popups,
which means the default shadow of normal windows is used. That's
clearly odd given that the two are very different, and isn't
consistent with GTK+-3's client-side shadows for popups. While
we could add a dedicated shadow class, the designers are fine
with reusing the existing shadow for dropdown-menus, so let's
do that.

https://bugzilla.gnome.org/show_bug.cgi?id=744667
2017-02-15 23:54:07 +01:00
Carlos Garnacho
6b384dc8d1 wayland: Update tool cursor scale when crossing monitors
This makes tool cursors properly scaled on hidpi.

https://bugzilla.gnome.org/show_bug.cgi?id=778474
2017-02-15 23:33:44 +01:00
Carlos Garnacho
a25915f4f9 wayland: Keep pointer to cursor sprite on MetaWaylandTabletTool
https://bugzilla.gnome.org/show_bug.cgi?id=778474
2017-02-15 23:33:44 +01:00
Jeremy Bicha
92a7690e19 build: Update src/Makefile.am
https://bugzilla.gnome.org/show_bug.cgi?id=778699
2017-02-15 12:56:13 -05:00
Jonas Ådahl
bd2ca79a48 backends/x11: Only apply keymap when not running nested
https://bugzilla.gnome.org/show_bug.cgi?id=777800
2017-02-15 14:04:16 +08:00
Jonas Ådahl
6d64123849 backends/x11: Split up X11 backend into Cm and Nested
Split up the X11 backend into two parts, one for running as a
Compositing Manager, and one for running as a nested Wayland
compositor.

This commit also cleans up the compositor configuration calculation,
attempting to make it more approachable.

https://bugzilla.gnome.org/show_bug.cgi?id=777800
2017-02-15 14:04:16 +08:00
Jonas Ådahl
4ebc55f2b3 Make libmutter and friends parallel installable
In order to minimize the amount of breakage, while at the same time
making it easier to make backward incompatible changes needed to
continue turning libmutter into a capable Wayland compositor, make the
libmutter and friends (libmutter-clutter, libmutter-cogl*) parallel
installable by adding a version number to the name. This changes
various filenames, for example what previously was libmutter.so is now
libmutter-0.so (assuming the version for now is 0), and
libmutter-clutter-1.0.so is now libmutter-clutter-0.so. The pkg-config
filenames and GObject introspection has been renamed to reflect this as
well.

This enables a downstream compositor rely on a specific version of the
libmutter API, while gracefully handling API/ABI changes by having to
update to the new version at their own pace.

https://bugzilla.gnome.org/show_bug.cgi?id=777317
2017-02-14 11:16:45 +08:00
Carlos Garnacho
9950b4de75 core: Add MetaDisplay::pad-mode-switch signal
This signal provides the necessary information to let gnome-shell trigger
updates of pad leds/oleds whenever a pad group switches mode, and the
actions associated to buttons do too.

https://bugzilla.gnome.org/show_bug.cgi?id=776543
2017-02-10 20:11:19 +01:00
Carlos Garnacho
7e3fbfbdd2 wayland: Notify tablet mode switches
This will show a fancy OSD so the change is immediately visible.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
ff453c1143 backends: Notify tablet mapping changes in the UI
This takes over the older code in g-s-d.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
efd9d467f2 backends: Add action label to mode switch buttons
https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
07ce981cb0 core: Add MetaDisplay::show-osd signal
And add specific private methods to notify about tablet mapping and mode
switches. The signal allows the mutter side to trigger OSDs in a generic
way.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
5af848d991 wayland: Clean up MetaWaylandTabletPadGroup
Using the clutter counterparts, some backend-specific code can be removed
from here.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
fff7da2a96 backends: Have meta_input_settings_handle_pad_button() take an event
As all the relevant backends are expected to provide
ClutterPadButtonEvents, it makes no sense to split the information,
plus all other event fields are now available and might be needed
in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
45c9786434 backends/native: Implement keep-aspect
Using ClutterInputDeviceEvdev::output-aspect-ratio. This only applies
to devices which are not calibratable, so again we need to implement
this at the toolkit level.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
cfbc4fe4d0 backends/native: Use libinput calibration matrix for calibration
We couldn't properly merge output-mapping matrix and calibration into
one. Now that libinput calibration matrix is free to use, we can
actually implement tablet calibration with it.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
dae5f06069 backends/native: Use ClutterInputDeviceEvdev::device-matrix for map-to-output
The libinput calibration matrix should only be used for calibration purposes,
this ClutterInputDeviceEvdev property has been added in place.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Jose Marino
9a123847e0 keybindings: fix erratic raise_or_lower behavior
Function "handle_raise_or_lower (src/core/keybindings.c)" is called
when running 'raise-or-lower' on a window. This function iterates
through all the windows in the stack to determine if our window is
already on top or obscured. The problem is that the window stack
includes windows in another workspaces and also windows that are
minimized.

https://bugzilla.gnome.org/show_bug.cgi?id=705200
2017-02-07 14:30:38 +01:00
Peter Hutterer
4f31b53521 wayland: fix copy/pasto sending tool removed on rings/strips
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

https://bugzilla.gnome.org/show_bug.cgi?id=778262
2017-02-07 14:04:52 +01:00
Jonas Ådahl
962e1d5a69 MetaCursorRendererNative: Always force set hw cursor the first time
The initial state of the hardware cursor is not known, so always force
update it the first time we update the cursor. Do this by changing the
'force' flag of update_hw_cursor() to an 'invalidated' hw cursor state.

https://bugzilla.gnome.org/show_bug.cgi?id=771056
2017-02-07 11:19:52 +08:00
Carlos Garnacho
9c79a1631d backends: Pass seat ID to evdev ClutterDeviceManager
Clutter assumed seat0 which is most usually, but not always correct.
Add an evdev-backend specific function to allow passing the seat
that will be used for ClutterDeviceManager construction, which we
already obtain in MetaLauncher.

https://bugzilla.gnome.org/show_bug.cgi?id=778092
2017-02-02 23:39:02 +01:00
Piotr Drąg
c7853730ed Fix a translator comment
They need to be exactly one line above a string to show up in .po files.
2017-01-28 01:38:29 +01:00
Carlos Garnacho
2cd78bffd9 compositor: Avoid thaw on inconsistent effect_completed calls
If the meta_window_actor_effect_completed() triggers inconsistent
accounting, there's also high chances that the thaw call will be
unexpected at this time too, which will lead to a g_error().

This makes mutter more lenient to effect_completed() calls of the
right type (i.e. those triggering freeze/thaw) being performed more
times than necessary in the upper parts. A warning will be issued,
but the process won't abort.

https://bugzilla.gnome.org/show_bug.cgi?id=777691
2017-01-26 12:31:47 +01:00
Jonas Ådahl
6fa8238ebf monitor-unit-tests: Check monitor <-> logical monitor relationships
Make sure that each logical monitor owns the expected actual monitors.
This currently needs special care when dealing with laptop lid the
configuration, as the MetaMonitorConfigManager path still deosn't
handle restoring the previous configuration, meaning the logical
monitor with the external monitor will continue being primary.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:57 +08:00
Jonas Ådahl
1c6eef48f1 monitor-unit-tests: Move logical monitor checking into separate function
Split the big check function, makes things easier to read.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:57 +08:00
Jonas Ådahl
1fdf2ac746 monitor-unit-tests: Check that each CRTC mode is correct
This is partly redundant given that the current monitor mode is checked
against the CRTC mode, but this also checks the disabled CRTCs. Later
the configured mode position and transform will be checked.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
3ae9feef0c monitor-unit-tests: Check monitor mode CRTC mode positions
Check that the crtc mode has the correct intra-monitor position. In
effect, this tests that the CRTCs in a tiled monitor are configured with
the correct mode on the correct position.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
e9a8208607 tests: Add monitor store and config test for output underscanning
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
e357b4a46a monitor-store: Add support for monitor underscanning
Add a <monitor> subelement <underscanning> for configuring
output underscanning.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
097ca01411 legacy-monitor-config: Init is_underscanning config field from output
Don't loose the is_underscanning field when creating a new configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
e8197e8e05 monitor-config-manager: Add underscanning to MetaMonitorConfig
Set the underscanning state via the monitor config struct so that it
can be configured.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
7fc6b8a746 legacy-monitor-config: Fix primary output state
The MetaOutput::is_primary state was not correctly managed in two cases:

 * for tiled monitors, the primary state got overridden when setting
   the preferred resolution
 * for laptop lid, it was not set if the laptop panel happened to be
   the first output

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
0fd9c00580 tests: Add monitor and monitor store test for custom primary
Test that having a custom primary logical monitor is configured as
expected.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
4a51a1dfe5 monitor-unit-tests: Check handling of the primary presentation flags
The main output of the main (first) monitor of a primary logical
monitor should have the MetaOutput::is_primary field set; all other
outputs should have it not set.

All outputs associated with a logical monitor with presentation set
should have MetaOutput::is_presentation set. No other outputs should
have it set.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
9fb8abf840 monitor-store-unit-tests: Check the primary and presentation flags
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
449320cd23 monitor-unit-tests: Check that a stored config is preferred
Check that the stored config (where the logical monitors are placed
vertically) is preferred to the otherwise generated linear config.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
12b69dbabb monitor-unit-tests: Make hotplug_mode_update optional
Add a flag to the test setup creation function enabling the caller to
specify whether a stored config should be used. This is done by
changing the value of the hotplug_mode_update MetaOutput field,
normally used by VMs to do the same.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
4652bde3d7 tests: Move monitor test helpers to a helper file
Both the monitor unit tests and monitor store unit tests will want to
check whether the config manager is used and set custom configuration
files.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
9b4e1903e1 monitor-config-manager: Prefer to use stored config
If not explicitly set by the backend, prefer to use the stored config
instead of creating a new one, if available.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
702facbc91 monitor-store-unit-tests: Add test for vertical placement
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
339340df34 tests: Add MetaMonitorConfigStore tests
Add tests that check that a XML configuration file results in correct
MetaMonitorsConfig objects.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
1ad386bc28 Introduce MetaMonitorConfigStore
MetaMonitorConfigStore provides an XML storage mechanism for
MetaMonitorConfigManager. It stores configuration files defined in the
same level as the MetaMonitorsConfig format, i.e. refers to high level
"monitors" and "monitor modes" instead of connectors and CRTCs.

Only reading custom files are implemented and so far unused.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
28a8c714ea unit-tests: Pass argc/argv directly to g_test_init
Don't let a dummy option context consume the arguments; just let the
GLib test suite do it. It'll handle the basic command line arguments
and allow doing things such as specifying what test to run.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
c9f18bfef3 monitor-unit-tests: Test headless mode
This tests only the monitor configuration and basic functionality. It
does not test anything related to window management and Wayland client
interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
20cd885443 backend: Only center pointer when not headless
When we are headless, there is no logical monitor to try to center the
pointer on, so just skip it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
3f994646f2 monitor-config-manager: Handle headless setup gracefully
Handle headless setup gracefully by having no logical monitors. This
commit only makes the monitor management code deal with it; other areas
may still not be able to handle it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
f45e7703ba monitor-unit-tests: Add lid-closed with no external monitor test case
Test that when the laptop lid is closed, but no external monitors are
connected, that we still have a mode set on the laptop panel.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
1ee0412177 monitor-unit-tests: Use g_assert_cmp* macros when suitable
Use the g_assert_cmp(int|uint|...) macros when comparing integers and
unsigned integers. This means that the mismatched numbers are printed
in the test report.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:56 +08:00
Jonas Ådahl
4b33f05eda monitor-config-manager: Add MetaMonitorsConfig creation helper
Add a meta_monitors_config_new() helper. It's exposed outside of
meta-monitor-config-manager.c already, as it'll be used externally in a
later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
81923410f6 monitor-unit-tests: Test starting with lid closed
Add a test case that checks that configuration works when the lid is
initialy closed then later opened. This test case is disabled when the
legacy configuration is used as it does not handle that situation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
f19cb6a610 monitor-config-manager: Handle laptop lid being closed
Handle configuring when the laptop lid is closed. This is so far
handled by creating a linear configuration while ignoring the laptop
panel. Changing the current configuration will come later.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
cde1a730e8 monitor-unit-tests: Add laptop lid switch test case
Test that the laptop panel is disabled if the lid is closed.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
d6efdfab4b monitor-unit-tests: Mock laptop lid state
For now, always assume the laptop lid is open, as all test cases assume
this.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
f7b6271d86 monitor-manager: Move UpClient signal listening into monitor manager
Move the UpClients notify::lid-is-closed signal handling into
MetaMonitorManager, and put the getter behind a vfunc. This means
Placing it behind a vfunc allows custom backends to implement it
differently; for example the test backend can mock the state.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
8d1be7ffc0 monitor-unit-tests: Add test for handling too few CRTCs
Check that configuration when there are more outputs than CRTCs does
something sane.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
a0af7e94a6 monitor-config-manager: Add support for suggested configuration
Create a suggested configuration, if such configuration is provided.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
f607b03456 monitor: Add API to query suggested position
Adds an API to get the position suggested by the backend. This
translates to position advertised by some VM:s, used to hint at a
position making the position more natural (i.e. placed similarly to how
it may be placed on the host desktop).

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
644ee666f6 Introduce new monitor configuration system
The new monitor configuration system (MetaMonitorConfigManager) aims to
replace the current MetaMonitorConfig. The main difference between the
two is that MetaMonitorConfigManager works with higher level input
(MetaMonitor, MetaMonitorMode) instead of directly looking at the CRTC
and connector state. It still produces CRTC and connector configuration
later applied by the respective backends.

Other difference the new system aims to introduce is that the
configuration system doesn't manipulate the monitor manager state; that
responsibility is left for the monitor manager to handle (it only
manages configuration and creates CRTC/connector assignments, it
doesn't apply anything).

The new configuration system allows backends to not rely on deriving the
current configuration from the CRTC/connector state, as this may no longer be
possible (i.e. when using KMS and multiple framebuffers).

The MetaMonitorConfigManager system is so far disabled by default, as
it does not yet have all the features of the old system, but eventually
it will replace MetaMonitorConfig which will at that point be removed.
This will make it possible to remove old hacks introduced due to
limitations in the old system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
ee0677a021 monitor-manager: Let backend implementations handle inital config
How the initial configuration is done depends on the backend, so let
them do it themself.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
0b4d80d74f wayland/output: Operate on monitors instead of outputs
Operate on MetaMonitor's instead of MetaOutput's, as the latter may be
only a subset of an actual "monitor" when referring to the physical
computer equipment.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
1a2b493d17 tests/monitor-unit-tests: Check current monitor mode
Check both that current mode is up to date, and that deriving it again
won't change it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
9ceeddd952 monitor: Track current monitor mode
Track what monitor mode is the current. This is derived from the mode
of the corresponding CRTC's.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
e1849ccbfa monitor: Add getter for vendor and serial
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
6262b46928 wayland/output: Pass 'unknown' subpixel order when mismatch
When a logical monitor constains monitors with different subpixel
ordering, make the wl_output have the subpixel order 'unknown' so that
clients don't make assumptions given only a subset of the monitors of
the given region.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
8752f40792 monitor-manager-kms: Some harmless style fixes
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
8c5600e81b monitor-manager-kms: Handle EDID blob not being ready immediately
Sometimes we hit a race on hot-plug where we try to read the KMS
resources and the EDID blob is not yet ready. This would normally
result in a ENOENT when retrieving the blob. Handle this by retrying
after 50 milliseconds after a hot-plug event. Do this up to 10 times,
and after that give up trying to get the EDID blob and continue with
best effort.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
4c1b48d0cc monitor: Add API to get monitor mode from spec
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
536ae8430b monitor-manager: Add API to get monitor from monitor spec
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
aaddf44d45 monitor-manager: Add API to find primary monitor
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:55 +08:00
Jonas Ådahl
0c42faf34d monitor-manager: Some trivial style fixes
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
be13d0f8ee monitor: Allow monitor mode foreach crtc iterator failable
Allow the function used to iterate over the CRTC modes of a monitor
mode to fail, causing the iteration to fail as well.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
81438eebef monitor-unit-tests: Test suggested-x/y configuration
Test the suggested-x/y output state often set by virtual machines.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
b70187c2d9 monitor-manager: Move meta_monitor_manager_ function to right place
Move a meta_monitor_manager_ function to meta-monitor-manager.c where
it belongs.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
c041851fa5 monitor-manager: Rename read_current_config to read_current_state
The function meta_monitor_manager_read_current_config() was renamed to
meta_monitor_manager_read_current_state() as it does not read any
configuration, but reads the current state as described by the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
b59a8b1de3 monitor-manager: Move configuration paths behind 'legacy' functions
In preparation of replacing the configuration system with one working
with high level monitors instead of low level outputs etc, move
configuarion handling code into obviously named function (containing
the word 'legacy'.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
e3b9fe7e58 monitor-manager: Use MetaMonitor to check laptop panel status
Instead of looking at the current configuration, just find the
MetaMonitor of the laptop display panel and check the currest status
directly.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
0177ab45af MetaMonitor: Add _is_laptop_panel() helper
Add a helper to determine whether the monitor is the laptop panel or
not. To be used by the configuration system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
bc951557e8 monitor: Add monitor spec object
A monitor spec object is meant to be used to identify a certain monitor
on a certain output. The spec is unique per actual monitor and connector,
meaning that a monitor that changes from one connector from another
(e.g. HDMI1 to HDMI2) will not be identified as the same. It is meant
to associate for example a configuration entry with an actual monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
2c32d94e1d monitor: Determine preferred monitor mode
Determine the preferred monitor mode given what the preferred CRTC mode
is, and expose it via the API.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
5d9e2d8d2e MetaMonitor: Add mode spec concept
Add a "mode spec" concept, meaning to be used as a identifier for an
actual monitor mode. It consists of details making a mode unique, i.e.
the total resolution and refresh rate. This will later be used to get
the actual monitor mode (set of one or more CRTC modes).

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
0637537355 monitor-config: Modernize type declaration
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00
Jonas Ådahl
63ed134165 monitor-unit-tests: Check monitor modes
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:54 +08:00