Commit Graph

883 Commits

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