1
0
Fork 0
Commit graph

1266 commits

Author SHA1 Message Date
Niels De Graef
4de892b02a cursor-tracker: Don't use g_cclosure_marshal_VOID__VOID
Similar to gtk commit f507a790, this ensures that the valist variant of
the marshaller is used. From that commit's message:

```
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
```

https://gitlab.gnome.org/GNOME/mutter/merge_requests/697
2019-07-31 09:34:17 +00:00
Niels De Graef
efe6c13d93 cursor-tracker: Use our own marshal for cursor-moved
By putting `NULL` as the C marshaller in `g_signal_new`, you
automatically get `g_cclosure_marshaller_generic`, which will try to
process its arguments and return value with the help of libffi and
GValue.

Using `glib-genmarshal` and valist_marshallers, we can prevent this so
that we need less instructions for each signal emission.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/697
2019-07-31 09:34:17 +00:00
Jonas Ådahl
61e51cdef6 dma-buf: Mark DMA-BUF textures as paint-only
Reading pixels directly from a texture imported from a DMA-BUF EGLImage
may result compressed textures to be transferred into non-compressed
texture. This may have side effects causing it to be rendered
incorrectly in subsequent paints.

Avoid this by passing the no-get-data flag to the texture creator
function, eventually causing mutter to use an intermediate offscreen
framebuffer when reading pixels from such textures.

https://bugs.freedesktop.org/show_bug.cgi?id=111140
https://gitlab.freedesktop.org/xorg/xserver/issues/545

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
Jonas Ådahl
7868ab761f cogl/texture: Add EGLImage texture import flags
The flags are 'none', and 'no-get-data' meaning get_data() is not
supported.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
Florian Müllner
4259cfd4c6 cleanup: Don't use G_TYPE_INSTANCE_GET_PRIVATE()
It has been deprecated in favor of the get_instance_private() function
generated by the G_ADD_PRIVATE() macro.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Jonas Dreßler
a2a8f0cdaa wayland/pointer: Set focus to NULL when the cursor is hidden
This is important when using a touchscreen or stylus instead of a mouse
or touchpad. If the cursor only gets hidden and the focus stays the
same, the window will still send hover events to the UI element under
the cursor causing unexpected distractions while interacting with the
touchscreen.

Fix this by emitting a visibility-changed signal from the cursor tracker
which then triggers a focus surface sync and always set the focus
surface to NULL when it's synced while the cursor is hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Jonas Dreßler
faa7b2d4e5 cursor-tracker: Add API to get whether the pointer is visible
Allow checking whether the pointer is visible without accessing the
trackers internal is_showing property. While we don't need this just yet
for reading the visibility inside meta-wayland-pointer, it's useful when
implementing the logic to remove Clutter's focus when the cursor goes
hidden later.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Pekka Paalanen
a95644dbdc renderer/native: Debug for primary copy mode
COPY_MODE_PRIMARY has two paths, automatically chosen. For debugging purposes,
e.g. why is my DisplayLink screen slowing down the whole desktop, it will be
useful to know which copy path is taken. Debug prints are added to both when
the primary GPU copy succeeds the first time and when it fails the first time.

This is not the full truth, because theoretically the success/failure could
change every frame, but we don't want to spam the logs (even in debug mode)
every frame. In practise, it should be rare for the success or failure to ever
change. Hence, saying what happened on the first time is enough. This does
indicate if it ever changes even once, too, so we know if that unexpected thing
happens.

The debug prints are per secondary GPU since there could be several.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
720f363241 renderer/native: Add tracing for 2nd GPU copies
These traces allow seeing how long the copy operations stall in libmutter, and
which copy operations actually get used.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
3794df608c renderer/native: Use primary GPU to copy
When the preferred path META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU cannot
be used, as is the case for e.g. DisplayLink devices which do not actually have
a GPU, try to use the primary GPU for the copying before falling back to
read-pixels which is a CPU copy.

When the primary GPU copy works, it should be a significant performance win
over the CPU copy by avoiding stalling libmutter for the duration.

This also renames META_SHARED_FRAMEBUFFER_COPY_MODE_* because the new names are
more accurate. While the secondary GPU copy is always a GPU copy, the primary
copy might be either a CPU or a GPU copy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
2c893beff1 renderer/native: Add meta_dumb_buffer_ensure_dmabuf_fd
Follow-up work will use this in an attempt to use the primary GPU to
copy into secondary GPU dumb buffers.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
9cd3b07472 egl: Introduce meta_egl_create_dmabuf_image
This bit of code was more or less duplicated in meta-renderer-native-gles3.c
and meta-wayland-dma-buf.c. Start consolidating the two implementations by
moving the *-gles3.c function into meta-egl.c and generalizing it so it could
also accommodate the meta-wayland-dma-buf.c usage.

The workaround in the *-gles3.c implementation is moved to the caller. It is
the caller's responsibility to check for the existence of the appropriate EGL
extensions.

Commit 6f59e4858e worked around the lack of
EGL_EXT_image_dma_buf_import_modifiers with the assumption that if the modifier
is linear, there is no need to pass it into EGL. The problem is that not
passing a modifier explicitly to EGL invokes implementation-defined behaviour,
so we should not have that workaround in meta-egl.c.

This patch intends to be pure refactoring, no behavioral changes. The one
change is the addition of g_assert to catch overwriting arbitrary memory.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Georges Basile Stavracas Neto
4a184d74d5
monitor-manager: Don't notify unchanged power save mode
Since 4cae9b5b11, and indirectly before that as well, the
MetaMonitorManager::power-save-mode-changed is emitted even
when the power save mode didn't actually change.

On Wayland, this causes a mode set and therefore a stuttering.
It became more proeminent with the transactional KMS code.

Only emit 'power-save-mode-changed' when the power save mode
actually changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/674
2019-07-06 20:23:57 -03:00
Carlos Garnacho
1f133b3ed2 compositor: Add MetaDnD private function to initialize XDND
We need to set XdndAware and XdndProxy on the stage window if running
a X11 compositor, this is not necessary on wayland.

Takes over gnome-shell code doing this initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/667
2019-07-04 12:24:57 +00:00
Jonas Ådahl
5cb6286436 kms-impl-device: Fail up front if we can't retrieve DRM resources
If we can't retrieve the drm resources, instead of segfaulting later on,
treat it as an error, and let the error handler up the stack handle it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:56:08 +02:00
Jonas Ådahl
1c25b75571 kms-impl-device: Fail if we can't enable universal planes
We currently don't handle the lack of DRM_CLIENT_CAP_UNIVERSAL_PLANES
KMS capability. Fail constructing a device that can't handle this up
front, so later made assumptions, such as presence of a primary plane,
are actually valid.

If we want to support lack of said capability, the required planes need
to be emulated by a dummy MetaKmsPlane object.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:55:47 +02:00
Georges Basile Stavracas Neto
1206879a20 kms-plane: Include <drm_fourcc.h>
Instead of including <drm/drm_fourcc.h>. This is the
only file that includes the drm_fourcc.h header like
this, and it happened to break the build locally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/663
2019-06-28 13:25:15 -03:00
Jonas Ådahl
dc5925b7d1 kms-plane: Restore adding format fallbacks
There were fallbacks in place in case IN_FORMATS didn't yield any usable
formats: the formats in the drmModePlane struct, and a hard coded array.
The lack of these fallbacks in place could result in a segfault as code
using the supported plane formats assumed there were at least something
in there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/662
2019-06-28 14:21:11 +00:00
Olivier Fourdan
bca08c2c4e monitor-manager: Use meta_monitor_get_display_name() API
Use the new monitor's `meta_monitor_get_display_name()` instead of
rebuilding the display name for each DBUS request.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Olivier Fourdan
6541d49fe7 monitor: Add display name
The display name is being used by the monitor manager to expose to name
to the DBUS API.

It is being rebuilt each time, so instead build the displa yname once
for the monitor and keep it around, with an API to retrieve it, so that
we can reuse it in preparation of xdg-output v2 support.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Olivier Fourdan
c3c6668343 monitor-manager: Add get_vendor_name API
The monitor manager keeps the list of PnP Ids, add a new API to get the
vendor name from a given PnP ID.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Jonas Ådahl
70de90ebce renderer/native: Discard page flip retries when rebuilding views
Rebuilding views means we don't care to retry page flip attempts for
previous views, especially since connectors may have been disconnected,
making a page flip retry hit an assert a flipped CRTC has connectors
associated with it.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/619

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
Jonas Ådahl
0756fd4636 renderer/native: Queue mode reset from new rebuild_views vfunc
Simplify the call site a bit and make the native renderer know it should
queue mode reset itself when views have been rebuilt. This is done
partly due to more things needing to be dealt with after views have been
rebuilt.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
Jonas Ådahl
8c339dac3e renderer/native: Remove left-over function declarations
There are no callers and no definitions of these.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:07:57 +02:00
Florian Müllner
ca88826ce9 remote-desktop-session: Remove unnecessary include
The class doesn't actually use the native backend, so remove it
to avoid build errors when the backend is disabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/637
2019-06-27 15:50:11 +00:00
Olivier Fourdan
85f4772a4f backend/native: Fix compiler warning w/out EGL device
When building without EGL device support, the following compiler warning
is seen:

```
  src/backends/native/meta-renderer-native.c:2637:20: warning: unused
  variable ‘cogl_renderer_egl’ [-Wunused-variable]
```

Fix the warning by placing the relevant variable declarations within the
`#ifdef HAVE_EGL_DEVICE/#endif` statement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/656
2019-06-27 10:21:26 +02:00
Carlos Garnacho
2b519cba36 backends: Move numlock persistence handling here
We used to have wayland-specific paths for this in src/wayland, now we
have ClutterKeymap that we can rely on in order to do state tracking,
and can do this all on src/backend domain.

This accomodates the feature in common code, so will work on both
Wayland and X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 18:24:57 +02:00
Carlos Garnacho
832fc798d5 backends: Add missing code to restore NumLock state on X11
It's not be called to any practical effect yet in this backend, but will
do soon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 17:12:14 +02:00
Jonas Ådahl
20731887f2 monitor-manager/dummy: Fix name of mode debug env var
It provides ways to configure the modes, not the actual monitors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Jonas Ådahl
980d9b1042 monitor-manager/dummy: Make modes env var override the defaults
So that one can effectively change the default resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Jonas Ådahl
68f18f1fe9 monitor-manager/kms: Use KMS abstraction to get and set CRTC gamma
Still doesn't synchronize with frame drawing, but no point in doing that
until gamma is managed by mutter itself and not gnome-settings-daemon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
Jonas Ådahl
c655166398 kms-impl/simple: Removing extra semi colon
https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
Niels De Graef
70bacb9402 cogl: Remove CoglError wrapper
CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/631
2019-06-20 18:25:04 +02:00
Jonas Ådahl
57dfe4696d kms-update: Seal updates when posting them
This makes sure that we won't accidentally change KMS transaction
updates after they have been posted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
22a91f23ad backends/native: Add some KMS debug logging
Using the g_debug() macro. Set G_DEBUG_MESSAGES to "mutter" to activate
log.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
6aa1026600 kms: Add high level code documentation
Document the high level components of the KMS abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
75dff3e7c9 backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.

The API consists of various buliding blocks:

 * MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
 * MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.

This also means various high level changes:

State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.

From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.

EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.

Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.

While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
bea7600471 logical-monitor: Pass output when iterating over CRTCs
While not currently used by any users, it'll be useful in future
commits.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
8932388dda backend/native: Move some KMS utilities to its own file
They are not strictly related to any of the KMS objects, and should be
reusable without adding a dependency on the non-meta-kms-* files in
meta-kms-*.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
2238c9f180 kms: Add API to register impl file descriptors
To let the MetaKmsImpl implementation register file descriptor GSource
where the invoke function is ensured to be executed in the impl context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
ca21ca6745 kms: Add API to add a GSource that'll be invoked in the impl context
The MetaKmsImpl implementation may need to add a GSource that should be
invoked in the right context; e.g. a idle callback, timeout etc. It
cannot just add it itself, since it's the responsibility of MetaKms to
determine what is the impl context and what is the main context, so add
API to MetaKms to ensure the callback is invoked correctly.

It's the responsibility of the caller to eventually remove and destroy
the GSource.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
2bbd2e5563 kms: Add API to post callbacks out of the impl context
While the current impl context is in the same thread as the main
context, the separation still exists, and to post callbacks from the
impl context, it must pass MetaKms to make sure the callback is invoked
in the right context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
691d58e69b gpu/kms: Remove unused typedef
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
d84c7269b2 crtc/kms: Use MetaKmsPlane to check supported rotations and formats
Instead of manually retrieving supported transforms and formats from the
primary plane of the CRTC, use the MetaKmsPlane abstraction to find the
primary plane of the CRTC and check compatibility using the
MetaKmsPlane API. This removes the last user of direct KMS API usage
except for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
aba689312f gpu/kms: Init global mode list from MetaKmsConnectors
Instead of iterating over the available drmModeConnector objects to
construct a GPU wide mode list, use the state managed by
MetaKmsConnector. This also removes the last user of drmModeRes from
MetaGpuKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
f2d9a11013 output/kms: Outsource connector state fetching to MetaKmsConnector
As with CRTC state, variable connector state is now fetched via the
MetaKmsConnector. The existance of a connector state is equivalent of
the connector being connected. MetaOutputKms is changed to fetch
variable connector state via MetaKmsConnector intsead of KMS directly.
The drmModeConnector is still used for constructing the MetaOutputKms to
find properties used for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
596376c408 crtc/kms: Outsource CRTC state fetching to MetaKmsCrtc
Move reading state into a struct for MetaCrtcKms to use instead of
querying KMS itself. The state is fetched in the impl context, but
consists of only simple data types, so is made accessible publicly. As
of this, MetaCrtcKms construction does not involve any manual KMS
interaction outside of the MetaKms abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
1f62a8dbd9 crtc/kms: Don't redefine META_MONITOR_N_TRANSFORMS
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
f59d62bc8f kms: Add connector representation
Represents drmModeConnector; both connected and disconnected. Currently
only provides non-changing meta data. MetaOutputKms is changed to use
MetaKmsConnector to get basic metadata, but variable metadata, those
changing depending on what is connected (e.g. physical dimension, EDID,
etc), are still manually retrieved by MetaOutputKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
5d5d296551 gpu/kms: Fix connector id type in helper
It's a uint32_t, not a long.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00