1
0
Fork 0
Commit graph

43 commits

Author SHA1 Message Date
Jonas Ådahl
074d4f3418 output/kms: Make EDID be read via MetaOutputNative object
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
fd4ea67b27 native: Add abstract MetaOutputNative object
MetaOutputKms is made to inherit from this, but it doesn't do anything
special yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
dce906a4d1 output/kms: Remove redundant typedef
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1689>
2021-01-28 20:05:23 +00:00
Jonas Ådahl
5f6aee3419 kms/update: Make power saving an update wide change
This makes "power save" (i.e. when you make a monitor go into power save
mode, or make it come out of power save mode), a per device action when
turning on power saving (power save being set to 'off'), and implicitly
handled when turning off power saving (power save being set to 'on')
when doing a mode set.

This is needed as with atomic mode setting, the configuration of DPMS
(Display Power Management Signaling), is replaced by directly turning on
or off CRTCs, and via the CRTC drm properties. Thus in order to handle
both with a common API, make that API high level enough for both cases
being covered.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
ec7667fc31 kms/connector: Set DPMS and underscanning directly on the update
Instead of telling MetaKmsConnector fill a MetaKmsUpdate with connector
property changes, make the update itself aware of the changes, making
the impl side translate that to property changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
abac217617 crtc-mode-kms: Wrap MetaKmsMode instead of drmModeModeInfo
We'll need to use the MetaKmsMode later on for state keeping.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
d3abaf46a1 output-kms: Hand over fallback mode management to MetaKms
Eventually we need MetaKmsMode for more than carrying the
drmModeModeInfo, so prepare for that by having the KMS layer create
MetaKmsMode for those as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
f0d3201dab kms: Add MetaKmsMode abstraction
This contains a copy of a drmModeModeInfo, describing a mode. It also
has an unused pointer to the impl device it is associated with. It'll
later be used to get a blob ID for the mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
e089e53b24 crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode
It carries the drmModeModeInfo copy in it's instance struct, instead of
the `driver_private` it was using before.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287

This version of the commit includes fixes from:

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1305
2020-06-11 09:20:16 +00:00
Georges Basile Stavracas Neto
49408e8f9f Revert "crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode"
This reverts commit 09078762a, which breaks Mutter.
2020-06-10 23:11:21 -03:00
Jonas Ådahl
09078762ac crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode
It carries the drmModeModeInfo copy in it's instance struct, instead of
the `driver_private` it was using before.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
352c2ec7b8 output-kms: Remove old FIXME
Trying to figure out what this comment was actually about, it turns out
that MSC means Media Stream Counter, and as mentioned in an article[0]
is related to DRI3 and the X11 Present extension. Anyway, the comment
has been there raising questions for some years now, I think we can
remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
4b37c2e446 crtc-mode: Move away fields from public MetaCrtcMode struct
The ID and name are just moved into the instance private, while the rest
is moved to a `MetaCrtcModeInfo` struct which is used during
construction and retrieved via a getter. Opens up the possibility to
add actual sub types.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
1ce9e379d9 crtc: Make implementations inherit MetaCrtc
Just as with MetaOutput, instead of the home baked "inheritance" system,
using a gpointer and a GDestroyNotify function to keep the what
effectively is sub type details, make MetaCrtc an abstract derivable
type, and make the implementations inherit it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
4a4f2d8264 output: Make implementations inherit MetaOutput
Instead of the home baked "inheritance" system, using a gpointer and a
GDestroyNotify function to keep the what effectively is sub type
details, make MetaOutput an abstract derivable type, and make the
implementations inherit it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
092c5304a9 crtc: Move MetaCrtcConfig field to instance private
Last piece before MetCrtc can be made a derivable type.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
1406348be4 output: Move output info to MetaOutputInfo struct
The output info is established during construction and will stay the
same for the lifetime of the MetaOutput object. Moving it out of the
main struct enables us to eventually clean up the MetaOutput type
inheritence to use proper GObject types.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
b69111d8e6 monitor-manager: Rename *Info structs to *Assignment
MetaCrtcInfo and MetaOutputInfo did not represent information about
MetaCrtc and MetaOutput, but the result of the monitor configuration
assignment algorithm, thus rename it to MetaCrtcAssignment and
MetaOutputAssignment.

The purpose for this is to be able to introduce a struct that actually
carries information about the CRTCs and outputs, as retrieved from the
backend implementations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
f71316c850 output: Move configureable state to instance private
That is is_presentation, is_primary, is_underscanning and backlight.

The first three are set during CRTC assignment as they are only valid
when active. The other is set separately, as it is untied to
monitor configuration.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
e063947a16 output: Move winsys_id into instance private and rename to id
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
a42eed0231 crtc: Move CRTC id field into instance private
Set during construction, retrieved using helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
f4fd92d8e8 output: Move MetaGpu field to instance private
Set during construction only, retrieved using helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
fe42d56db3 crtc: Move configured state to separate struct
To make it more reliable to distinguish between values that are read
from the backend implementation (which is likely to be irrelevant for
anything but the backend implementation), split out those values (e.g.
layout).

This changes the meaning of what was MetaCrtc::rect, to a
MetaCrtcConfig::layout which is the layout the CRTC has in the global
coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1042
2020-02-25 18:39:51 +01:00
Hans de Goede
a5f986259f output-kms: Fix "panel orientation" kms-prop being ignored on native outputs
Actually store the panel_orientation_transform in the meta_output, so
that it gets honored by the core code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/927
2019-11-13 10:53:50 +01:00
Daniel van Vugt
0863bd2408 output-kms: Use portable formatting for 64-bit integers
On 64-bit systems uint64_t is %lu but on 32-bit systems it is %llu.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:42 +02: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
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
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
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
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
065bf752f4 output/kms: Make drmModeEncoderPtr array local
It was only used within one function, where it was always created, but
still was kept around indefinitely for no reason. Lets get rid of it
from the MetaOutputKms struct.

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
5199c7834d backends/native: Move underscan setting to MetaOutputKms
The 'underscan' property is a drm connector property, not a CRTC
property, so we would never find it. We also didn't advertise support
for the feature, meaning even if it was on the CRTC, Settings wouldn't
know about it.

Fix this by moving the property to where it belongs: in MetaOutputKms,
and properly advertise support for it if the property is found.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/507
2019-04-02 09:38:45 +00:00
Emilio Pozuelo Monfort
fb8dc91893 output/kms: Make winsys_id unique
We were using the connector_id for the winsys_id, but different
devices could have connectors with the same id. Since we use
winsys_id to uniquely identify outputs, use both the connector
id and the device id to avoid having outputs with the same id.
2018-11-19 14:58:48 +00:00
Emilio Pozuelo Monfort
4bc6a64d47 backends/native: Use the connector_id rather than winsys_id
winsys_id needs to be a unique output identifier so it will have
to stop being the connector id.
2018-11-19 14:58:48 +00:00
Jonas Ådahl
8a03f1ad02 Always generate meta-default-modes.h
This adds a hard requirement on having cvt installed, which in the past
was soft, where the generated file was added to the repository.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
1200182d70 backends: Move MetaOutput::crtc field into private struct
No functional changes. This is only done so that changes to reference
counting can done more reliably.

https://bugzilla.gnome.org/show_bug.cgi?id=786929
2018-06-28 13:42:15 +02:00
Jonas Ådahl
d092e913d6 gpu-kms: Don't add outputs without modes
There seems to be a kernel race when one disconnects an external
monitor connected to a DisplayPort via a USB-C adapter. The race
results in a connector being reported as connected, but without any
modes supported.

This had the side effect that we tried to set a preferred mode to
the first listed mode, but as no modes were available, we instead tried
to dereference the first element of a NULL array, causing a
segmentation fault.

Mitigate this by skipping adding output if no supported modes are
advertised and the output doesn't support scaling, while moving the
fallback path for calculating a preferred output mode to after possibly
adding the common modes, to avoid the unvolentary NULL dereference.

https://bugzilla.gnome.org/show_bug.cgi?id=789501
2018-02-05 10:38:54 +08:00
Hans de Goede
0bbda3ad87 monitor-manager: Take panel-orientation into account for physical size
Just like we swap the x and y resolution of the monitor modes when
the panel-orientation requires 90 or 270 degree rotation to compensate,
we should do the same for the width and height in mm of the monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
dd43d04d42 monitor-manager: Add portrait modes to portrait displays
If a monitor's max resolution is a portrait resolution, then assume it is
a native portrait monitor and add portrait versions of the common modes.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08:00
Hans de Goede
7917b083cb monitor-manager: Take drm-connector panel-orientation property into account
Some x86 clamshell design devices use portrait tablet LCD panels while
they should use a landscape panel, resoluting in a 90 degree rotated
picture.

Newer kernels detect this and rotate the fb console in software to
compensate. These kernels also export their knowledge of the LCD panel
orientation vs the casing in a "panel orientation" drm_connector property.

This commit adds support to mutter for reading the "panel orientation"
and transparently (from a mutter consumer's pov) fixing this by applying
a (hidden) rotation transform to compensate for the panel orientation.

Related: https://bugs.freedesktop.org/show_bug.cgi?id=94894

https://bugzilla.gnome.org/show_bug.cgi?id=782294
2017-12-25 17:01:45 +08: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
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
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