Commit Graph

23669 Commits

Author SHA1 Message Date
Ray Strode
7f4f9b122e wip! native: release dumb fb after flip for EGLStreams
fixme probably need to recreate the dumb fb any time doing
an explicit modeset
2018-11-30 14:34:10 -05:00
Ray Strode
82f03c51ac wip! renderer/native: start to add stream copy mode
At the moment, mutter only supports using GBM for
doing GPU blits to secondary video cards.

This commit starts to sketch out using eglstreams
for doing the copy.

FIXME: in order to get memcpy fastpath we get
inverted colors and have to fix it up in the shader.

FIXME: need to move some of the globals to be in
a more structured place

Closes https://gitlab.gnome.org/GNOME/mutter/issues/205
2018-11-30 14:34:10 -05:00
Ray Strode
8f538671d6 wip! renderer/native: only flip secondary crtc if using GBM
It's possible that the secondary gpu isn't using GBM for
renderering. if that's the case we shouldn't try to flip using
drm apis.

This commit checks, and only does the flip when expected.
2018-11-30 14:34:10 -05:00
Ray Strode
0540e4dc45 wip! renderer/native: generalize flip_egl_stream
We're going to need to be able to flip secondary egl streams,
so this commit parameterizes the stream and related objects.

A new wrapper function, `flip_primary_egl_stream`, takes over the
previous role of `flip_egl_stream`

fixme no_egl_output_drm_flip_event needs to be handled for secondary
streams
2018-11-30 14:34:10 -05:00
Ray Strode
5d8248d65b renderer/native: initialize egldevice on secondary cards
If possible initialize the egldevice renderer on secondary
cards.
2018-11-30 14:34:10 -05:00
Ray Strode
b61c2f2120 wip! renderer/native: separate renderer gpu data initialization from creation
We're going to need to initialize both gbm and egldevice based rendering
on some machines for one renderer data, so this commit splits
initialization out from construction.
2018-11-30 14:34:10 -05:00
Ray Strode
3dacd0f6f5 wip! renderer/native: generalize meta_renderer_native_create_surface_egl_device
Eventually we want to use meta_renderer_native_create_surface_egl_device
for secondary displays, but it currently implicitly uses the primary
display and egl context.

This commit changes the function to take a display and a context
as arguments.
2018-11-30 14:34:10 -05:00
Ray Strode
336cb36d3c wip! renderer/native: pass MetaMonitor instead of MetaLogicalMonitor to meta_renderer_native_create_surface_egl_device 2018-11-30 14:34:10 -05:00
Ray Strode
bb33dad473 wip! renderer-native: use proper surface type for egldevice 2018-11-30 14:34:09 -05:00
Ray Strode
88a7b6e1da renderer/native: use GBM_FORMAT_ARGB8888 for primary rendering format
At the moment we use GBM_FORMAT_XRGB8888 which unfortunately triggers
slow read pixels code in mesa.

This commit changes it to ARGB8888 instead, which copies with memcpy.
2018-11-30 14:34:09 -05:00
Pekka Paalanen
008a12a637 cogl: pick glReadPixels format by target, not source
Presumably glReadPixels itself can be more performant with pixel format
conversions than doing a fix-up conversion on the CPU afterwards. Hence,
pick required_format based on the destination rather than the source, so
that it has a better chance to avoid the fix-up conversion.

With CoglOnscreen objects, CoglFramebuffer::internal_format (the source
format) is also wrong. It is left to a default value and never set to
reflect the reality. In other words, read-pixels had an arbitrary
intermediate pixel format that was used in glReadPixels and then fix-up
conversion made it work for the destination.

The render buffers (GBM surface) are allocated as DRM_FORMAT_XRGB8888.
If the destination buffer is allocated as the same format, the Cogl
read-pixels first converts with glReadPixels XRGB -> ABGR because of the
above default format, and then the fix-up conversion does ABGR -> XRGB.
This case was observed with DisplayLink outputs, where the native
renderer must use the CPU copy path to fill the "secondary GPU"
framebuffers.

This patch stops using internal_format and uses the desired destination
format instead.

_cogl_framebuffer_gl_read_pixels_into_bitmap() will still use
internal_format to determine alpha premultiplication state and multiply
or un-multiply as needed. Luckily all the formats involved in the
DisplayLink use case are always _PRE and so is the default
internal_format too, so things work in practise.

Furthermore, the GL texture_swizzle extension can never apply to
glReadPixels. Not even with FBOs, as found in this discussion:
https://gitlab.gnome.org/GNOME/mutter/issues/72
Therefore the target_format argument is hardcoded to something that can
never match anything, which will prevent the swizzle from being assumed.
2018-11-30 14:34:09 -05:00
Pekka Paalanen
c8112a1dbc cogl: remove mesa_46631_slow_read_pixels_workaround
This function gets hit even today on relatively modern Intel systems (I
have a Haswell Desktop with Mesa 18.2.4) if the pixel format is right.
Presumably it makes things slower for no longer a reason.

According to cb146dc515, this
functionality was refactored into a workaround path in 2012. The commit
message mentions the problem existing before Mesa 8.0.2. The number
refers to https://bugs.freedesktop.org/show_bug.cgi?id=46631 .

The use case where I hit this is when improving support for DisplayLink
video outputs. These are used through a "secondary GPU", and since
DisplayLink does not have a GPU, Mutter uses the CPU copy path with Cogl
read-pixels[1]. If the DisplayLink framebuffer was allocated as
DRM_FORMAT_XRGB8888 (the only format it currently handles correctly),
mesa_46631_slow_read_pixels_workaround would get hit. The render buffer is
the same format as the framebuffer, yet doing the copy XRGB -> XRGB ends
up being slower than XRGB -> XBGR which makes no sense.

This patch is not sufficient to fix the XRGB -> XRGB copy performance,
but it is required.

This patch reverts CoglGpuInfoDriverBug into what it was before
cb146dc515.

[1] This is not actually true until
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/278 is
    merged.
2018-11-30 14:34:09 -05:00
Daniel van Vugt
f6f188dad4 renderer-native: Advertise COGL_FEATURE_ID_PRESENTATION_TIME
Since it's now implemented (e9e4b2b72e). Fortunately forgetting to
advertise it didn't matter because there isn't any code yet that
checks for it.
2018-11-30 14:31:03 +00:00
Carlos Garnacho
262a3ecbd6 backends/x11: Flush connection after ungrab
Modal ungrabs may be followed by other clients trying to grab themselves,
flush the connection so we ensure the right order of events on the Xserver
side.

An example of this is js/ui/modalDialog.js in gnome-shell, as the alt-F2
dialog may launch X11 clients trying to grab themselves, commit a40daa3c22
in gnome-shell handled the case and added a gdk_display_sync() call to
ensure no grab existed at the time of executing.

This commit aims to achieve the same built in MetaBackend. A full sync
seems excessive though, as we just need to make sure the server got the
messages queued before the other side tries to grab, a XFlush seems
sufficient for this.
2018-11-30 13:58:36 +00:00
Daniel van Vugt
231aadd3f0 tools: Remove obsolete ppa-magic.py 2018-11-30 11:12:12 +08:00
Jonas Ådahl
c8db8bbe22 backend/x11/nested: Always claim the lid is open
The nested backend used the value from udev, meaning that one couldn't
configure the fake monitor if the laptop panel of the host was closed.
Avoid this annoyance by always having the nested backend claiming the
lid is open.
2018-11-29 11:37:45 +01:00
Jonas Ådahl
f67e1a55ee meta: Silence a couple of introspection warnings
We could just avoid introspecting `meta-startup-notification.h`, but
that'd mean splitting up the header list. Just silence the warning
instead.
2018-11-27 17:13:48 +01:00
Carlos Garnacho
169022cbb0 meson: Add mutter_built_sources to libmutter declared dependency
If meson tries to get ahead and generate object files for tests
at the same time than building libmutter, those may randomly fail
if meson did not create the libmutter generated headers yet.

Add those to the declared dependency, so the files are ensured to
be created before anything gets to use it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/404
2018-11-27 15:51:38 +00:00
Jonas Ådahl
0d29609aec wayland/gtk-shell: Emit new capabilities event when changed
The capabilities may change during the compositors lifetime, so make
gtk-shell emit the capabilities event when capabilities change.

https://gitlab.gnome.org/GNOME/mutter/issues/276
2018-11-27 15:34:13 +01:00
Jonas Ådahl
00619f3a1c wayland: Add MetaWaylandGtkShell object
To be used to store state.

https://gitlab.gnome.org/GNOME/mutter/issues/276
2018-11-27 15:34:13 +01:00
Jonas Ådahl
bc5e76c76f wayland: Make MetaWaylandCompositor a GObject
This makes it possible to use GObject features such as data attachments.

https://gitlab.gnome.org/GNOME/mutter/issues/276
2018-11-27 15:17:00 +01:00
Daniel van Vugt
557b2a0e8c clutter: Remove erroneous "fixed point" comment
The function `clutter_actor_transform_stage_point` actually operates
almost entirely in floating point.
2018-11-26 15:57:41 +00:00
Niels De Graef
49cb691bb5 monitor-manager: remove get_edid_file() vfunc
It wasn't implemented by any subclass, it's not provided by DRM either.
And even if a subclass were to have only a file available, it could read
it into a GBytes as well and just use `read_edid()`.

Found this while working on !269.
2018-11-26 14:37:54 +01:00
Florian Müllner
6e1b14b26b x11: Remove hide-titlebar-when-maximized support
It's a UI pattern that has been superseded by client-side decorations,
apps that used to set the hint have generally moved on to headerbars.
Given that and the limitation to server-side decorated X11 windows,
GTK4 removed the client-side API for setting the hint, it's time to
follow suite and retire the feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/221
2018-11-26 13:12:18 +00:00
Niels De Graef
ca7c5c1223 meta/plugin: Use G_DECLARE_DERIVABLE_TYPE
It cuts out some of the GObject boilerplate, and gives us g_autoptr()
support for free.

Since this changes the ABI, we also need to bump the libmutter API
version.
2018-11-23 14:28:37 +00:00
Carlos Garnacho
e11ee44236 core: Refactor/simplify display startup sequence handling
Makes the caller function easier to read.
2018-11-23 12:27:13 +00:00
Carlos Garnacho
6b7bd91610 x11: Complete X11 startup sequence on SN_MONITOR_EVENT_COMPLETED 2018-11-23 12:27:13 +00:00
Carlos Garnacho
92349a4668 wayland: Complete the startup sequence as given from gtk-shell 2018-11-23 12:27:13 +00:00
Carlos Garnacho
7635d0631b core: Drop MetaDisplay startup sequence API
We now have MetaStartupNotification/Sequence in place
2018-11-23 12:27:13 +00:00
Carlos Garnacho
ec6a536d36 core: Use MetaStartupSequence internally
Replace code in MetaDisplay so it uses MetaStartupSequence
2018-11-23 12:27:13 +00:00
Carlos Garnacho
4d92979b43 core: Make MetaStartupSequence/Notification public
This will be preferred over SnStartupNotification, as exposed
through MetaDisplay.
2018-11-23 12:27:13 +00:00
Carlos Garnacho
4a69a0d7f7 core: Shuffle startup notification object creation
Hook properly to MetaDisplay, instead of having it be a singleton.
2018-11-23 12:27:13 +00:00
Carlos Garnacho
8a10196382 x11: Set all MetaStartupSequence properties for libsn sequences 2018-11-23 12:27:13 +00:00
Carlos Garnacho
91ce24d4b4 core: Add extra properties to MetaStartupSequence
Those that we use from SnStartupSequence over the place...
2018-11-23 12:27:13 +00:00
Carlos Garnacho
26fbd56a95 x11: Refactor the X11 startup notification bits into src/x11
Only one little bit left in MetaDisplay, because SnStartupSequence
is exposed in API there. These bits will be removed in future
commits.
2018-11-23 12:27:13 +00:00
Carlos Garnacho
576cd08088 core: Rename MetaStartupNotificationSequence to MetaStartupSequence
The name was excruciatingly long and not that much more descriptive.
2018-11-23 12:27:13 +00:00
Daniel van Vugt
e8c27603dd renderer-native: Advertise _FEATURE_SWAP_THROTTLE
Because it is implemented and always on. By advertising this fact
the master clock is able to sync to the native refresh rate instead
of always using the fallback of 60.00Hz.

https://bugzilla.gnome.org/show_bug.cgi?id=781296
2018-11-23 11:01:30 +00:00
Daniel van Vugt
e9e4b2b72e renderer-native: Add hardware presentation timing
Add support for getting hardware presentation times from KMS (Wayland
sessions). Also implement cogl_get_clock_time which is required to compare
and judge the age of presentation timestamps.

For single monitor systems this is straightforward. For multi-monitor
systems though we have to choose a display to sync to. The compositor
already partially solves this for us in the case of only one display
updating because it will only use the subset of monitors that are
changing. In the case of multiple monitors consuming the same frame
concurrently however, we choose the fastest one (in use at the time).
Note however that we also need !73 to land in order to fully realize
multiple monitors running at full speed.
2018-11-23 11:01:30 +00:00
Niels De Graef
6834bedb95 cogl: remove COGL_GNUC_NULL_TERMINATED
This is already defined for us in GLib, so prefer that instead.
2018-11-23 08:55:43 +01:00
Niels De Graef
bf8a3b1c1c cogl: Remove unused macro COGL_GNUC_DEPRECATED
This is also already defined in GLib as G_GNUC_DEPRECATED.

(Note that it is also something different than COGL_DEPRECATED)
2018-11-23 08:55:43 +01:00
Niels De Graef
3a4a858ce3 cogl: use G_BEGIN_DECLS instead of COGL_BEGIN_DECLS
This macro was introduced so as to be able to be built without GLib.
However, this feature was long ago removed, and in Mutter we depend on
it anyway, so let's get rid of it in favor of more consistency.
2018-11-23 08:55:43 +01:00
Jonas Ådahl
0a178a01b3 xwayland: Invert running-as-gdm check
It was accidentally inverted previously. Lets change it back.
2018-11-22 17:37:32 +00:00
Jonas Ådahl
332360be7c gitlab-ci.yml: Increase test timeout multiplier further
Twice the time was not enough, so pass -t 10 instead.
2018-11-22 18:20:58 +01:00
Jonas Ådahl
718ddc9c96 gitlab-ci.yml: Stop creating meson-logs artifact
The logs were useless, as the complete test suite log was printed to
stdout.
2018-11-22 17:48:00 +01:00
Jonas Ådahl
f795725aaf gitlab-ci.yml: Allow for tests taking longer time
Test runners might be slow, so use the test time multiplier 2 to avoid
unnecessary pipeline failures.
2018-11-22 17:48:00 +01:00
Jonas Ådahl
70741a051b gitlab-ci.yml: Wrap tests with catchsegv
To be able to see why tests failed, if they crashed due to a SIGSEGV,
wrap the execution with catchsegv.
2018-11-22 17:48:00 +01:00
Emilio Pozuelo Monfort
ad7d6e4a37 backends/native: React to GPU hotplug
If a GPU is added at runtime, we should connect to it and manage
its outputs.
2018-11-21 14:33:00 +01:00
Emilio Pozuelo Monfort
a6178990cd monitor-manager/kms: Use non-pci secondary cards
We may have secondary non-PCI devices, and we should drive their
outputs.
2018-11-21 14:26:02 +01:00
Niels De Graef
081842bac6 cogl/object: add cogl_clear_object utility function
This is based on `g_clear_object`, so it will be a bit more consistent
to write (and prevents the headaches from accidentally forgetting a NULL
check).
2018-11-20 15:25:24 +01:00
Pekka Paalanen
63a6ead7d9 wayland-dma-buf: doc the odd format mapping
This format mapping looks wrong at first hand, so explain why it is like
it is.

See also https://gitlab.gnome.org/GNOME/mutter/issues/323
2018-11-19 22:53:13 +00:00