1
0
Fork 0
Commit graph

6645 commits

Author SHA1 Message Date
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
Jonas Ådahl
07745b3082 wayland/surface: Disconnect actor handlers before unassigning role
The handlers depend on a role being assigned. Destroying the window
causes it to become unmapped, which would sometimes trigger one of the
handlers, resulting in an is-assigned assert hitting in one of the
handlers. Avoid this by disconnecting the handlers earlier, so that
there is no risk that any them being triggered before the role is
assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=789552
2017-10-27 19:08:38 +08:00
Daniel van Vugt
054c25f693 wayland: Allow Xwayland to leave core dumps
For historical Xorg-reasons, Xwayland would disable its own core dumps by
default. This is a problem because Xwayland crashing is the biggest cause of
gnome-shell crashes [1][2], and we still have no idea why due to there being
no dumps from Xwayland. So enable core dumping from Xwayland.

https://bugzilla.gnome.org/show_bug.cgi?id=789086

[1] https://bugs.launchpad.net/bugs/1505409
[2] https://bugs.launchpad.net/bugs/1556601
2017-10-26 19:50:40 -05:00
Carlos Garnacho
01de04d8c9 wayland: Update pointer confinement on surface actor relocations
In the unlikely case that a surface is moved by the compositor while
holding a pointer confinement, we also need to update the pointer
position when the surface actor gets moved.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-10-26 12:53:20 +02:00
Carlos Garnacho
08e4cb54a8 wayland: Trigger wl_output updates on actor position changes
Both notify::position on the surface actor and position-changed on
MetaWindow are listened to, in order to trigger wl_output updates for
wl_surfaces whenever the surfaces move across them.

Both signals are necessary in order to cater for toplevel and subsurface
relocations (Because it's the parent window actor what changes position
in this last case).

Also, shuffle signal disconnection, so each signal goes away with
the object reference held by MetaWaylandSurface.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-10-26 12:51:44 +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)
91e3a0b3a9 MetaWindowActor: assert that we have plugin manager on simple effect
It looks that there are some extensions that run a Mainloop on startup,
causing to dispatch a clutter paint before the compositor is even available.
In such scenario a MetaWindow could try to start a simple effect
using a compositor plugin which is not there yet.

Then in order to catch these bugs we can now assert that the expected
conditions are valid, so that gnome-shell will provide a dumpstack to
debug the real offending JS code.

https://bugzilla.gnome.org/show_bug.cgi?id=789223
2017-10-24 04:42:54 -05:00
Marco Trevisan (Treviño)
ab5ac21104 window: rename get_flatpack_id into get_sandboxed_app_id
This function can be more generic now.

https://bugzilla.gnome.org/show_bug.cgi?id=789277
2017-10-21 13:36:16 -05:00
Marco Trevisan (Treviño)
0ebea2be9c Revert "MetaWindowActor: don't start any effect when no compositor is available"
This reverts commit 35fcf4a4ae.
2017-10-20 03:25:31 -05:00
Marco Trevisan (Treviño)
6f54bab0a8 Revert "MetaPluginManager: don't try to deference a NULL pointer when processing events"
This reverts commit 74565380aa.
2017-10-20 03:23:28 -05:00
Marco Trevisan (Treviño)
5d7deab6da Revert "display: trap X errors in get_current_time_roundtrip"
This reverts commit cc772ddd61.
2017-10-20 03:22:59 -05:00
Marco Trevisan (Treviño)
35fcf4a4ae MetaWindowActor: don't start any effect when no compositor is available
There are cases when no compositor is available (yet) but a MetaWindow tries
to start a simple effect using a compositor plugin which is not available.
In that case we should just ignore any request and protect ourselves from
crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=789223
2017-10-20 16:10:18 +08:00
Marco Trevisan (Treviño)
74565380aa MetaPluginManager: don't try to deference a NULL pointer when processing events
This function might be called by components with invalid plugin manager
(as it might happen to MetaWindow when the compositor isn't initialized
properly), so we need to protect ourselves from crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=789223
2017-10-20 16:10:18 +08: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
Marco Trevisan (Treviño)
cc772ddd61 display: trap X errors in get_current_time_roundtrip
Only return the actual timestamp if we get one.

https://bugzilla.gnome.org/show_bug.cgi?id=788971
2017-10-20 16:10:18 +08:00
Rui Matos
3caefd8fda compositor: Avoid a crash if the top window actor is finalized
Since we're not holding a reference, the top window actor might be
finalized when we paint resulting in a use after free crash.

https://bugzilla.gnome.org/show_bug.cgi?id=788493
2017-10-19 18:37:34 +02: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
2e99963087 compositor: Ignore offscreen windows when unredirecting
When determining whether we should unredirect a window or not, ignore
offscreen windows, and just check the top most visible window.

Previously this was not an issue, but since 'stack-tracker: Keep
override redirect windows on top' we started sorting the UI frames
window, which is an offscreen override redirect window, on top, causing
the unredirect checking code to always check whether to unredirect the
UI frames window. This effectively disabled the compositor bypass
functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=788493
2017-10-17 14:50:18 +08:00
Rui Matos
4d763e1828 x11/window: Don't manage InputOnly windows
This was dropped by mistake in commit
f166240225.

https://bugzilla.gnome.org/show_bug.cgi?id=788493
2017-10-17 14:50:18 +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)
556136dacc workspace: ensure that workarea data is valid when fetching by monitor num
https://bugzilla.gnome.org/show_bug.cgi?id=788860
2017-10-13 00:46:51 -05: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
polygamma
f9c625924e x11: Protect XChangeProperty call with error traps
They may happen around the time a window is destroyed, thus could result
on BadWindow X errors.

https://bugzilla.gnome.org/show_bug.cgi?id=788666
2017-10-10 13:55:40 +02: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
76096a725b monitor-unit-tests: Check going headless -> headless
https://bugzilla.gnome.org/show_bug.cgi?id=788607
2017-10-07 00:36:03 -04:00
Jonas Ådahl
6eb7d13894 window: Handle updating from no to no monitor
When we received two hot plug events that both resulted in headless
configuration, we tried to find a new window monitor given the old.
That resulted in a null pointer dereference; avoid that by only trying
to find the same monitor if there was an old one.

https://bugzilla.gnome.org/show_bug.cgi?id=788607
2017-10-07 00:36:03 -04: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
c1fe1c5d6b window-actor: Use monitor API to get frame message refresh rate
Use the MetaMonitor API instead of accessing outputs directly to get
the refresh rate used when genaritng the frame message.

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
Daniel Stone
32917f1922 wayland-dma-buf: Don't send modifiers to old clients
The modifier event was only added in v3 of the client; sending it to
older clients (e.g. GStreamer waylandsink) causes them to disconnect
immediately.

Send the older 'format' event to all clients, and only send the newer
'modifier' event to resource versions 3 or above.

https://bugzilla.gnome.org/show_bug.cgi?id=788558
2017-10-05 10:51:06 -04:00
Jonas Ådahl
120db06c60 monitor-tests: Test config migration with refresh rate wiggle room
Check that we finish configurations within range, and discard the ones
out of range.

https://bugzilla.gnome.org/show_bug.cgi?id=787668
2017-10-04 09:45:52 -04:00
Jonas Ådahl
e76ab05d45 monitor-tests: Fix error message grammar mistake 2017-10-04 09:45:02 -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
Georges Basile Stavracas Neto
e198c8452b x11: Add support for _GTK_EDGE_CONSTRAINTS atom
To keep feature parity with the Wayland backend, and
to improve the overall tiling experience with GTK apps,
add the _GTK_EDGE_CONSTRAINTS X11 atom and update it
when necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
aea66ddff6 wayland: Send edge constraints
Following up the previous patch, this patch makes the
Wayland backend send the edge constraints through a
custom protocol extension internal to GTK.

As it mature, we can think of upstreaming the protocol
to Wayland itself.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
a5f4ffa58c window: Track edge constraints
GTK has the ability to handle client-decorated windows
in such a way that the behavior of these windows must
match the behavior of the current window manager.

In Mutter, windows can be tiled horizontally (and, in
the future, vertically as well), which comes with a few
requirements that the toolkit must supply. Tiled windows
have their borders' behavior changed depending on the
tiled position, and the toolkit must be aware of this
information in order to properly match the window manager
behavior.

In order to provide toolkits with more precise and general
data regarding resizable and constrained edges, this patch
makes MetaWindow track its own edge constraints.

This will later be used by the backends to send information
to the toolkit.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
a1c39e142d window: Also consider touching edges for matching tiled windows
When computing a potential match for a tiled window, there is a
chance we face the case where 2 windows really complement each
other's tile mode (i.e. left and right) but they have different
sizes, and their borders don't really touch each other.

In that case, the current code would mistakenly assume they're
tile matches, and would resize them with either a hole or an
overlapping area between windows. This is clearly a misbehavior
that is a consequence of the previous assumptions pre-resizable
tiles.

This patch adapts the tile match algorithm to also consider the
touching edges when computing the matching tile, unless:

 * the window is not currently tiled (for example when computing
   the tile preview)
 * the window is currently resized in tandem with an existing
   tile match

https://bugzilla.gnome.org/show_bug.cgi?id=645153

bar
2017-10-03 19:38:32 -03:00
Georges Basile Stavracas Neto
e76a0f564c window: Raise and lower tile match in tandem
When a pair of tiled windows are grouped together, they
are treated as parts of a whole and interacting with one
affects the other.

Following the idea that sibling tiled windows are treated
as part of the same group, they should also be raised and
lowered together.

It is still possible to break tiled windows grouping by
simply untiling the window with the keyboard or by grabbing
and resizing or moving the window with the cursor.

This patch makes sibling tiled windows be lowered and raised
in tandem. For future reference, this behavior is documented
in [1].

[1] https://wiki.gnome.org/GeorgesNeto/MinutesOfFeaneron/Tiling

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
8307d9c4de edge-resistance: Remove useless variable
There is a variable in meta_window_edge_resistance_for_resize
that isn't really helpful: it just assumes TRUE, and is passed
to apply_edge_resistance_to_each_side.

This patch removes that useless variable and simply pass TRUE
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
1dbf6b096b edge-resistance: Add snapping for tiled windows
When windows are tiled, it improves the interaction with
them when they have a set of snapping edges relative to
the monitor. For example, when there's a document editor
and a PDF file opened, I might want to rescale the former
to 2/3 of the screen and the latter to 1/3.

These snapping sections are not really tied to any other
window, and only depend on the current work area of the
window. Thus, it is not necessary to adapt the current
snapping edge detection algorithm.

This patch adds the necessary code in edge-resistance.c
to special-case tiled windows and allow them to cover
1/4, 1/3 and 1/2 (horizontally) of the screen. These
values are hardcoded.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
6fe71ecc01 window: Tile and resize considering the tile match
After the introduction of the possibility to resize tiled windows,
it is a sensible decision to make windows aware of their tiling
match. A tiling match is another window that is tiled in such a
way that is the complement of the current window.

The newly introduced behavior attepts to make tiling as smooth as
possible, with the following rules:

 * Windows now compute their tile match when tiling and, if there's
   a match, they automatically complement the sibling's width.
 * Resizing a window with a sibling automatically resizes the sibling
   too to be the complement of the window's width.
 * It is not possible to resize below windows' minimum widths.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Georges Basile Stavracas Neto
57e58eaf2a window: Maximize tiled windows when resizing to work area
Now that tiled windows are resizable, the user may grow a tiled
windows until it covers the entire work area. As this makes the
window state mostly indistinguishable from maximization, avoid
subtle differences by properly maximizing the window in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00
Florian Müllner
00a5db71cf window: Allow resizing of tiled windows
Currently tiled windows are not resizable and their size is fixed
to half the screen width. Adjust the code to work with fractions
other than half, and allow users to adjust the split by dragging
the window edge that is not constrained by a monitor edge.

Follow-up patches will improve on that by resizing neighboring
tiled windows by a shared edge, and making the functionality
available to client-side decorated windows implementing the
new edge constraints protocol.
2017-10-03 19:38:31 -03:00
Florian Müllner
c7fa57cd28 window: Pass mode as parameter to tile() operation
Now that the preview tile mode has been split from the window's
tile_mode property, it is much more natural to pass the requested
tile_mode to the tile() function instead of setting it externally
and calling the function to apply the state.
2017-10-03 19:38:31 -03:00
Florian Müllner
8f2c86d79e window: Split out preview_tile_mode
The existing semantics of the tile_mode property are terribly confusing,
as it depends on some other property whether it represents the requested
or current mode. Clear this up by just using separate variables for the
two. As it is unlikely that we will ever support more than one tile
preview, we can track the requested mode globally instead of adding
another per-window variable.

https://bugzilla.gnome.org/show_bug.cgi?id=645153
2017-10-03 19:38:31 -03:00