Commit graph

365 commits

Author SHA1 Message Date
Stefan Agner 0bfebebbdb compositor-drm: use DRM constants
The GBM and DRM constants have the same meaning. In preparation
to make the DRM backend compile without libgbm, prefer the DRM
constants where GBM is not needed.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-07-08 00:30:44 +02:00
Tomohito Esaki 29beeafde9 backend-drm: make linear modifier to default
Make the linear modifier to the default of DRM format modifiers if
supported modifiers isn't get from kernel driver.
2019-07-01 10:57:25 +09:00
Daniel Stone e404b72fd5 compositor-drm: Split assign_planes() into separate file
drm_assign_planes() is called to separate views out and decide what will
be taken out for plane composition and what will be left for the
renderer to compose.

It calls drm_output_propose_state() in order to find a good
configuration, which itself has a number of helpers that it calls. Break
these out into a separate file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone 6b466f25af compositor-drm: Move state helpers to separate file
Most of the state helpers (create, destroy, duplicate, etc) state, are
relatively straightforward and can live in a separate file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone 7580b3c09e compositor-drm: Move FB handling to a separate file
Move everything to do with creation, destruction, and reference handling
of drm_fbs to a new file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone 4c2fc7058a compositor-drm: Move KMS API use to separate file
Create a new file which handles most of the actual KMS API use. This
covers the property handling (in which we map between KMS properties and
our internal representations), as well as actually applying state
through atomic modesetting or the legacy SetCrtc/PageFlip/DPMS APIs.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone fbe6c1db7b compositor-drm: Move mode handling to separate file
Create a new file for the DRM backend's handling of output modes, e.g.
resolution, aspect ratio, preferred mode selection, EDID parsing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone 3448cfce0f compositor-drm: Pull EDID extraction into helper
Create a helper function which populates a drm_head with the information
extracted from its connector's EDID and any other properties we can
find, such as physical size and connection status.

This is currently quite small, but may become more complex in future as
we parse EDID better. It also prepares to move this function into
another file in the next commit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone dd1bc50ba2 compositor-drm: Create header for backend internals
Create a new header called drm-internal.h, and move many of drm.c's
declarations and helpers to it.

This will allow us to split the DRM backend into multiple files.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Marius Vlad a2dace23ae libweston: Fix/clean-up doxygen warnings
This fixes warnings for weston-debug, input, compositor, log and
linux-explicit-sync. Warnings range from swapping '[in]', '[out]' with
the function arguments to wrong parameter names.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Daniel Stone 31838bf17e compositor-drm: Remove legacy plane and vblank usage
As of the previous commit, we never create state which uses overlay
planes on non-atomic drivers. We can thus remove the calls to
drmModeSetPlane.

The only time we ever waited for vblank events was when we had called
drmModeSetPlane and needed to make sure we waited until it was active.
We can thus also remove all the vblank event machinery.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
Daniel Stone 87fab1ca4e compositor-drm: Only assign planes with atomic
Without atomic modesetting, we have no way to know whether or not our
desired configuration is usable. It might fail for a number of reasons:
scaling limits, bandwidth limits, global resource (e.g. decompression)
unit contention, or really just anything.

Not only this, but there is no good way to ensure that our configuration
actually lands together in the same refresh cycle - hence the 'atomic'
in atomic modesetting. Some drivers implement a synchronously blocking
drmModeSetPlane, whereas others return immediately. Using overlay planes
can thus decimate your framerate.

The pre-atomic API is not extensible either, so we need numerous out
clauses: fail if we're cropping or scaling (sometimes), or changing
formats, or fencing, or ...

Now we've had atomic support stable for a couple of releases, just
remove support for doing anything more fancy than displaying our
composited output and a cursor with drivers which don't support atomic
modesetting.

Support for using overlay planes was already disabled by default when
using the legacy API, and required a debug key combination to toggle it
on by flipping the sprites_are_broken variable. We can ensure that we
never try to use it on legacy by simply ignoring the hotkey when in
legacy mode.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
Robert Beckett 8d23ab78bd backend-drm: handle multiple drm nodes with logind
When using logind launcher, we receive a PauseDevice "gone" message
from logind session management for each device we close while looking
for KMS devices.

Make logind notify the backend of the device add/remove so that the
backend can decide what to do, instead of assuming that if it is a
DRM_MAJOR device the session should be (de)activated. The backend can
then react to its specific device.

Fixes #251

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
2019-06-13 18:40:56 +01:00
Tomohito Esaki 68d49d772c compositor-drm: run finish_frame when dpms is turned off in update_complete
A output repaint loop isn't scheduled beacuse the output repaint_status
is AWAITING_COMPLETION when dmps is turned off in update_complete().
Therefore, the display attached to the output is remain inactive even if
weston wakes up. By going through finish_frame, the output
repaint_status is fixed to correct status.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2019-06-13 10:13:59 +00:00
Pekka Paalanen f0f37bcaa1 backend-drm: move into new subdir
Move the DRM-backend into a new sub-directory to make it stand out from
libweston core. This facilitates splitting drm.c into more files later.

vaapi-recorder is used only by DRM-backend, move that too.

libbacklight is used only by DRM-backend and a manual test program, and is
moved as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00