Head-based output configuration API a.k.a clone mode infrastructure

Submitted by Pekka Paalanen on Oct. 31, 2017, 11:48 a.m.

Details

Reviewer None
Submitted Oct. 31, 2017, 11:48 a.m.
Last Updated June 6, 2018, 11:30 a.m.
Revision 5

Cover Letter(s)

Revision 1
      From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Hi all,

this series introduces a head-based output configuration API, which is
a prerequisite for implementing shared-CRTC clone mode. Clone mode
implementation is not part of this series.

The previous posting of this series was the RFC at
https://lists.freedesktop.org/archives/wayland-devel/2017-August/034797.html
I am repeating the main points below.

Compared to the RFC the main changes are:

- All backends are now converted to the new API (DRM backend conversion
  is available in a branch, more on that below.)

- There is a solution to disappearing connectors.

- The design draft wiki document has sequence diagrams for the head-based API
  and has been updated to match the implementation.

- The frontend is now covering the whole API.


	Background

I started designing output configuration API changes earlier this year
to accommodate the addition of clone mode to Weston, and in particular a
very specific setup: sharing the DRM CRTC for more than one
encoder/connector. That setup is the cheapest clone mode possible, with
the caveat/feature that the cloned heads all have the exact same video
timings.

The Phabricator task tracking the whole effort is:
https://phabricator.freedesktop.org/T7727

and there is a design draft at:
https://phabricator.freedesktop.org/w/wayland/weston/atomic-output-config/


	The design overview

For a recap on what kind of clone modes are theoretically possible, I
recommend reading the email quote in T7727.

The new output configuration API has a new object: weston_head. A
weston_head represents a connector/monitor, while weston_output remains
for the CRTC, the active video mode, the framebuffers, the repaint
logic, etc. A libweston user creates a weston_output and attaches at
least one head to it. Additional heads will become clones by sharing the
CRTC.

If sharing the CRTC is not possible, attaching the head or enabling the
output will fail, in which case the user should create another
weston_output to drive the clone head and just specify the desktop area
to show accordingly. (The latter mode of cloning does not currently work
correctly in Weston due to the damage tracking design.)

Atomic configuration over all outputs will likely not be part of the
current effort, but I am keeping it in mind to avoid going the opposite
direction.


	Why not simpler?

Introducing weston_head causes quite a lot of churn and code motion, so
why did I not simply add a thing like

	weston_output_clone_output(output1, output2)

and hook it up by sharing the CRTC if possible and fall back to the
"heavy cloning" automatically?

I believe such design would be hard to maintain and use. It is not
obvious which weston_output should be responsible for the repaint
logic. It is possible for the responsible output to get hot-unplugged,
in which case the remaining output should take over the repaint logic.
It is also unclear what weston_output_enable/disable() etc. should do on
each. API-wise it would be possible to e.g. set differing output
scales, so there would need to be code to recognize bad attempts and
more error handling.

If one then sets out to factor out the common bits that are needed
per-CRTC instead of per-connector, you basically end up with the
head-based design but with a confusing API that does not differentiate
between master and slave outputs. The user could not know what actually
happens either, and I imagine in some use cases it would be important
to know if the CRTC-sharing works or not because it has a very big
impact on the performance and the timings (no gen-lock).

IOW, this "simpler" solution would not actually be simpler, even though
it might save a few lines of code in libweston users at first.


	The code

Here is the branch for this patch series:
https://gitlab.collabora.com/pq/weston/commits/clonemode-user-API-3

This patch series does not contain the full migration of the
DRM-backend, because that work was done on top of Daniel's atomic
modesetting series. OTOH, that should make this patch series landable
upstream already, without conflicting badly with the atomic series.

Patches 2-16 introduce the new head-based API while maintaining the old
functionality, allowing frontends and backends to be converted
individually.

Patches 17-24 convert the frontends to the new API.

Patches 25-26 clean up the frontend compatiblity code.

Patches 27-29 add sanity checks and fix a bug.

Patches 30-36 migrate the backends to the new API, except for the
DRM-backend.

The DRM-backend conversion is here:
https://gitlab.collabora.com/pq/weston/commits/clonemode-user-API-2

That branch consists of an arbitrary snapshot of the atomic modesetting
series, this posted series, the DRM-backend conversion, and the final
patch to clean up the remaining compatibility code:
https://gitlab.collabora.com/pq/weston/commit/8d63fd8c66204f2cf2c72b8abcb7bd05d55be1e1


	Regression testing

I have performed regression testing by running be below test procedures
before and after this whole posted series.

headless-backend testing:

$ make -j7 distcheck


x11-backend testing:

$ weston
$ weston --output-count=3
  - close x11 windows one by one
$ weston --fullscreen (equally broken before and after)


Wayland-backend testing:

parent: $ weston --output-count=2 --width=700
(outputs have different height)
tests:

weston --use-pixman
weston --use-pixman --fullscreen
weston --use-pixman --output-count=2
weston --use-pixman --sprawl
- close parent outputs one by one

parent: $ weston --output-count=2 --width=700 --shell=fullscreen-shell.so
tests:

weston --use-pixman
- close parent outputs one by one


RDP-backend testing:
- none


fbdev-backend testing:

$ weston -Bfbdev-backend.so


DRM-backend testing:

Two outputs plugged in, third unplugged.
1. start Weston, ensure both outputs work
2. unplug one output, ensure remaining output works
3. re-plug the output, ensure both outputs work
4. quit

One output plugged in, the rest unplugged. The plugged-in output is
configured to be off in weston.ini.
1. start Weston, zero outputs, check via remote login weston-info works
2. plug in an output, check it works
3. unplug the output, check weston-info via remote
4. quit blind


As you can see, I have not tested the RDP-backend as I did not know how
to set it up. Everything I did test did not crash or indicate anything
wrong in the logs either before nor after the patch series. There are no
regressions as I could see.

As a standard procedure, I have also ran every single commit through
'make distcheck' without failure.


Thanks,
pq

Pekka Paalanen (36):
  weston: arm SEGV handler earlier
  libweston: introduce weston_head
  libweston: move wl_output to weston_head
  libweston: use head in wl_output global
  libweston: make wl_output point to weston_head
  libweston: refactor weston_mode_switch_finish
  libweston: introduce weston_output::head_list
  libweston: strdup head make, model, serial_number
  cms-colord: find a good head
  libweston: add name to weston_head
  libweston: add weston_head::connected
  libweston: add compositor list of heads
  libweston: add heads_changed hook
  libweston: new head-based output management API
  libweston: add weston_head destroy signal
  libweston: add weston_head_is_device_changed() API
  weston: move weston_output_enable() into callers
  weston: migrate headless to head-based output API
  weston: migrate x11 to head-based output API
  weston: migrate wayland to head-based output API
  weston: migrate fbdev to head-based output API
  weston: migrate RDP to head-based output API
  weston: migrate DRM to head-based output API
  libweston: change windowed_output_api output_create to create_head
  libweston: remove output_pending_signal
  libweston: stop auto-adding the implicit head
  libweston: assert make/model in weston_output_enable()
  libweston: assert current_mode in weston_output_enable()
  libweston: cancel idle_repaint on output destroy
  compositor-headless: migrate to head-based output API
  compositor-rdp: migrate to head-based output API
  compositor-fbdev: make re-enable less drastic
  compositor-fbdev: migrate to head-based output API
  compositor-x11: migrate to head-based output API
  compositor-wayland: strict surface create/destroy
  compositor-wayland: migrate to head-based output API

 compositor/cms-colord.c             |  38 +-
 compositor/main.c                   | 313 +++++++++---
 compositor/weston-screenshooter.c   |   2 +-
 desktop-shell/input-panel.c         |   4 +-
 desktop-shell/shell.c               |   4 +-
 fullscreen-shell/fullscreen-shell.c |   4 +-
 ivi-shell/input-panel-ivi.c         |   4 +-
 libweston-desktop/wl-shell.c        |   2 +-
 libweston-desktop/xdg-shell-v5.c    |   2 +-
 libweston-desktop/xdg-shell-v6.c    |   2 +-
 libweston/compositor-drm.c          |  15 +-
 libweston/compositor-fbdev.c        | 206 +++++---
 libweston/compositor-headless.c     |  75 ++-
 libweston/compositor-rdp.c          |  64 ++-
 libweston/compositor-wayland.c      | 254 +++++++---
 libweston/compositor-x11.c          |  70 ++-
 libweston/compositor.c              | 923 +++++++++++++++++++++++++++++++++---
 libweston/compositor.h              | 182 ++++++-
 libweston/windowed-output-api.h     |  23 +-
 tests/weston-test.c                 |   2 +-
 20 files changed, 1814 insertions(+), 375 deletions(-)
    
Revision 2
      From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Hi all,

this is v5 (to match the numbering of my public branches) of the libweston user
facing API and infrastructure for supporting shared-CRTC clone mode.

Previous submission with rationale:
https://lists.freedesktop.org/archives/wayland-devel/2017-October/035604.html

Design document:
https://phabricator.freedesktop.org/w/wayland/weston/atomic-output-config/

The goal:
https://phabricator.freedesktop.org/T7727

Changes in v5 compared to v3 are minor:
- "libweston: properly orphan wl_output resources" is new.
- Removal of wl_output global, when a head is detached from an enabled output.
- Print "Detected a monitor change" only for enabled heads.

You can find this series in the branch:
https://gitlab.collabora.com/pq/weston/commits/clonemode-user-API-5

I went through the same testing procedure as with v3, the previous submission.


However, the interesting bits are in the branch:
https://gitlab.collabora.com/pq/weston/commits/clonemode-4

As new things compared to clonemode-user-API-2, that one contains:
- support for configuring clone mode in weston.ini
- main.c implementation to configure a clode using the new API
- desktop-shell enhancements to avoid redundant panel and background surfaces
  in clone mode
- hooking up custom data to weston_output via a new user-side destroy signal
- naming outputs freely
- DRM-backend support for shared-CRTC clone mode
- video mode list merging in the DRM-backend

The shared-CRTC clone mode has been tested to work on an i.MX6 device.
Unfortunately it seems that PC hardware that would support it is becoming
scarce AFAIU.

Most of the patches in clonemode-4 depend on the atomic modesetting series and
can therefore be submitted only after that one.


Thanks,
pq

Pekka Paalanen (36):
  libweston: introduce weston_head
  libweston: move wl_output to weston_head
  libweston: use head in wl_output global
  libweston: make wl_output point to weston_head
  libweston: refactor weston_mode_switch_finish
  libweston: introduce weston_output::head_list
  libweston: properly orphan wl_output resources
  libweston: strdup head make, model, serial_number
  cms-colord: find a good head
  libweston: add name to weston_head
  libweston: add weston_head::connected
  libweston: add compositor list of heads
  libweston: add heads_changed hook
  libweston: new head-based output management API
  libweston: add weston_head destroy signal
  libweston: add weston_head_is_device_changed() API
  weston: move weston_output_enable() into callers
  weston: migrate headless to head-based output API
  weston: migrate x11 to head-based output API
  weston: migrate wayland to head-based output API
  weston: migrate fbdev to head-based output API
  weston: migrate RDP to head-based output API
  weston: migrate DRM to head-based output API
  libweston: change windowed_output_api output_create to create_head
  libweston: remove output_pending_signal
  libweston: stop auto-adding the implicit head
  libweston: assert make/model in weston_output_enable()
  libweston: assert current_mode in weston_output_enable()
  libweston: cancel idle_repaint on output destroy
  compositor-headless: migrate to head-based output API
  compositor-rdp: migrate to head-based output API
  compositor-fbdev: make re-enable less drastic
  compositor-fbdev: migrate to head-based output API
  compositor-x11: migrate to head-based output API
  compositor-wayland: strict surface create/destroy
  compositor-wayland: migrate to head-based output API

 compositor/cms-colord.c             |  38 +-
 compositor/main.c                   | 304 +++++++++---
 compositor/weston-screenshooter.c   |   2 +-
 desktop-shell/input-panel.c         |   4 +-
 desktop-shell/shell.c               |   4 +-
 fullscreen-shell/fullscreen-shell.c |   4 +-
 ivi-shell/input-panel-ivi.c         |   4 +-
 libweston-desktop/wl-shell.c        |   2 +-
 libweston-desktop/xdg-shell-v5.c    |   2 +-
 libweston-desktop/xdg-shell-v6.c    |   2 +-
 libweston/compositor-drm.c          |  15 +-
 libweston/compositor-fbdev.c        | 206 +++++---
 libweston/compositor-headless.c     |  75 ++-
 libweston/compositor-rdp.c          |  64 ++-
 libweston/compositor-wayland.c      | 254 +++++++---
 libweston/compositor-x11.c          |  71 ++-
 libweston/compositor.c              | 948 +++++++++++++++++++++++++++++++++---
 libweston/compositor.h              | 182 ++++++-
 libweston/windowed-output-api.h     |  23 +-
 tests/weston-test.c                 |   2 +-
 20 files changed, 1832 insertions(+), 374 deletions(-)
    
Revision 3
      From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Hi all,

here is the v6 of the shared-CRTC clone mode series. Since v5, quite
many patches have been extracted from this series, sent out and merged
upstream. However, now the series is bigger than ever, because here I am
posting the complete series, including the full DRM-backend migration
and DRM shared-CRTC clone mode implementation, thanks to having the
basic atomic modesetting landed upstream.

The previous submission is here:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036236.html

Design discussion etc. (sequence diagrams!) can be found here:
https://phabricator.freedesktop.org/T7727
https://phabricator.freedesktop.org/w/wayland/weston/atomic-output-config/
https://lists.freedesktop.org/archives/wayland-devel/2017-October/035604.html

The series is available as a branch at:
https://gitlab.collabora.com/pq/weston/commits/clonemode-6

Highlights since v5:
- DRM-backend migration
- shared-CRTC clone mode implemented in DRM backend
- applied review comments from v5
- don't create a weston_output just to turn it off (DRM)
- cms-colord will print a warning when used with clone mode
- cms-colord vs. clone mode mentioned in weston-drm.man

Unfortunately the testing results are not 100%, you can find my testing
procedure below the diffstat.

The patch series is structured as follows:

- Patches 1-17 introduce most of the new head-based API, and build the
  scaffolding that allows migrating the frontends and the backends one
  by one.

- Patches 18-24 migrate the frontends one by one. Patch 19 introduces
  the simple output configurator which is first used for all backends,
  including the DRM-backend.

- Patches 25-30 clean up libweston after the frontend migration.

- Patches 31-38 migrate all the backends to the head-based API. At this
  point the DRM-backend migration is basically a fake, though.

- Patch 39 removes weston_output::head with the last bits of the
  scaffolding.

- Patches 40-44 enhances libweston core to better support the
  DRM-backend's clone mode configuration and improve logging.

- Patches 45-55 implement the head-based API for real in the
  DRM-backend, culminating in patch 55 which creates heads for all
  connectors.

- Patch 56 removes unused_connectors array which has been replace with
  the head list.
 
- Patches 57-70 finally implement everything needed for shared-CRTC
  clone mode in the DRM-backend.

- Patches 71-73 add a new output configrator logic in the frontend to
  handle clone mode, supporting a new weston.ini key "same-as".


Do you think we should call the weston.ini key "clone-of" instead, to
leave "same-as" reserved for clone mode where only the desktop area is
the same but the monitors would have different video modes, scaling,
etc.?

There are several imaginable uses for "same-as" variants:
- get me shared-CRTC clone mode or fail
- get me clone mode, preferring shared-CRTC but automatic fallback to
  independent CRTCs
- get me clone mode, but I want one monitor with HiDPI and one with
  LoDPI

Here I have implemented the automatic fallback version, except it cannot
actually fall back, because we have no API to make two weston_outputs
show the same area, and libweston's damage tracking could not handle it
even if we could.


Pekka Paalanen (73):
  libweston: introduce weston_head
  libweston: move wl_output to weston_head
  libweston: use head in wl_output global
  libweston: make wl_output point to weston_head
  libweston: refactor weston_mode_switch_finish
  libweston: introduce weston_output::head_list
  libweston: properly orphan wl_output resources
  libweston: strdup head make, model, serial_number
  cms-colord: find a good head
  libweston: add name to weston_head
  libweston: add weston_head::connected
  libweston: add weston_head_is_enabled()
  libweston: add compositor list of heads
  libweston: add heads_changed hook
  libweston: new head-based output management API
  libweston: add weston_head destroy signal
  libweston: add weston_head_is_device_changed() API
  weston: move weston_output_enable() into callers
  weston: migrate headless to head-based output API
  weston: migrate x11 to head-based output API
  weston: migrate wayland to head-based output API
  weston: migrate fbdev to head-based output API
  weston: migrate RDP to head-based output API
  weston: migrate DRM to head-based output API
  libweston: change windowed_output_api output_create to create_head
  libweston: remove output_pending_signal
  libweston: stop auto-adding the implicit head
  libweston: assert make/model in weston_output_enable()
  libweston: assert current_mode in weston_output_enable()
  libweston: cancel idle_repaint on output destroy
  compositor-headless: migrate to head-based output API
  compositor-rdp: migrate to head-based output API
  compositor-fbdev: make re-enable less drastic
  compositor-fbdev: migrate to head-based output API
  compositor-x11: migrate to head-based output API
  compositor-wayland: strict surface create/destroy
  compositor-wayland: migrate to head-based output API
  compositor-drm: start migration to head-based output API
  libweston: remove weston_output::head
  libweston: print head names on output enable
  libweston: create/find output by name
  libweston: support user data on weston_output
  libweston: allow attaching heads to enabled outputs
  libweston: log head detach on enabled output
  compositor-drm: drm_output_find_by_connector from head_list
  compositor-drm: use head_find_by_connector in update_unused_outputs
  compositor-drm: find disconnects from head_list
  compositor-drm: move backlight into drm_head
  compositor-drm: move connector fields into drm_head
  compositor-drm: allocate CRTC on enable()
  compositor-drm: simplify drm_output_find_by_crtc()
  compositor-drm: simplify drm_output_find_special_plane()
  compositor-drm: get current mode on head discovery
  compositor-drm: move mode list to set_mode()
  compositor-drm: create heads for all connectors
  compositor-drm: remove unused_connectors array
  compositor-drm: drm_output_apply_state_legacy heads
  compositor-drm: drm_output_apply_state_atomic heads
  compositor-drm: drm_set_backlight heads
  compositor-drm: unify head status logging
  compositor-drm: combine mode list from heads
  compositor-drm: backlight control for all heads
  compositor-drm: update video mode printing
  compositor-drm: introduce drm_head_read_current_setup()
  compositor-drm: no need to clear inherited_mode
  compositor-drm: rewrite crtc picking for clone mode
  compositor-drm: preserve CRTC routing harder
  compositor-drm: head detach requires a modeset
  compositor-drm: head attach requires a modeset
  compositor-drm: allow shared-CRTC cloning
  weston: store weston_compositor in wet_compositor
  weston: use wet.compositor consistently in main()
  weston: support clone mode on DRM-frontend

 compositor/cms-colord.c             |   45 +-
 compositor/main.c                   |  818 +++++++++++++++++++++----
 compositor/weston-screenshooter.c   |    2 +-
 desktop-shell/input-panel.c         |    4 +-
 desktop-shell/shell.c               |    4 +-
 fullscreen-shell/fullscreen-shell.c |    4 +-
 ivi-shell/input-panel-ivi.c         |    4 +-
 libweston-desktop/wl-shell.c        |    2 +-
 libweston-desktop/xdg-shell-v6.c    |    2 +-
 libweston/compositor-drm.c          | 1128 +++++++++++++++++++++++------------
 libweston/compositor-fbdev.c        |  206 ++++---
 libweston/compositor-headless.c     |   75 ++-
 libweston/compositor-rdp.c          |   64 +-
 libweston/compositor-wayland.c      |  254 ++++++--
 libweston/compositor-x11.c          |   71 ++-
 libweston/compositor.c              | 1107 +++++++++++++++++++++++++++++++---
 libweston/compositor.h              |  198 +++++-
 libweston/windowed-output-api.h     |   23 +-
 man/weston-drm.man                  |   12 +
 tests/weston-test.c                 |    2 +-
 20 files changed, 3249 insertions(+), 776 deletions(-)


Testing procedure and results:

All tests were successful except where otherwise mentioned.


headless-backend testing:

$ make -j7 distcheck


x11-backend testing:

$ weston
$ weston --output-count=3
  - close x11 windows one by one
$ weston --fullscreen (equally broken before and after)


Wayland-backend testing:

parent: $ weston --output-count=2 --width=700
outputs have different height

tests:

weston --use-pixman
weston --use-pixman --fullscreen
weston --use-pixman --output-count=2
weston --use-pixman --sprawl
- close parent outputs one by one

In the --sprawl case, closing the first output soon results in the
parent compositor:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ba3b8f in wl_signal_emit (signal=0x555555da74a8, data=0x555555da74a0) at /home/pq/local/include/wayland-server-core.h:467
467		wl_list_for_each_safe(l, next, &signal->listener_list, link)
(gdb) bt
#0  0x00007ffff7ba3b8f in wl_signal_emit (signal=0x555555da74a8, data=0x555555da74a0) at /home/pq/local/include/wayland-server-core.h:467
#1  0x00007ffff7ba8a4c in weston_surface_destroy (surface=0x555555da74a0) at /home/pq/git/weston/libweston/compositor.c:1904
#2  0x00007fffee108196 in fade_out_done_idle_cb (data=0x555555da7d20) at /home/pq/git/weston/desktop-shell/shell.c:2281
#3  0x00007ffff798dcac in wl_event_loop_dispatch_idle (loop=loop@entry=0x55555576c250) at src/event-loop.c:600
#4  0x00007ffff798dd64 in wl_event_loop_dispatch (loop=0x55555576c250, timeout=timeout@entry=-1) at src/event-loop.c:646
#5  0x00007ffff798c4fa in wl_display_run (display=0x55555576c170) at src/wayland-server.c:1260
#6  0x000055555555dd86 in main (argc=1, argv=0x7fffffffdb58) at /home/pq/git/weston/compositor/main.c:2477



parent: $ weston --output-count=2 --width=700 --shell=fullscreen-shell.so

tests:

weston --use-pixman
- close parent outputs one by one


RDP-backend testing:

- using remmina as client, connected twice in a row



fbdev-backend testing:

$ weston -Bfbdev-backend.so


DRM-backend testing:

Two outputs plugged in, third unplugged.
1. start Weston, ensure both outputs work
2. unplug one output, ensure remaining output works
3. re-plug the output, ensure both outputs work
4. quit

One output plugged in, the rest unplugged. The plugged-in output is
configured to be off in weston.ini.
1. start Weston, zero outputs, check via remote login weston-info works
2. plug in an output, check it works
3. unplug the output, check weston-info via remote



Thanks,
pq
    
Revision 4
      From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Hi all,

this is actually clone mode series v9 part 3.

Yes, part 2 was never posted separately, it was landed directly from v6
as it didn't need any changes. This here is what are still left of the
roughly 135 patches I have written and recorded as part of the clone
mode work since March 2017:

https://phabricator.freedesktop.org/T7727

The changes here compared to v6 are minor, mostly just rebasing and
following the changes asked for.

Patch 9 is new. It is so very easy to forget to update the copyright
notices.

The patches are also available in the branch:
https://gitlab.collabora.com/pq/weston/commits/clonemode-9-part3


Thanks,
pq

Pekka Paalanen (9):
  compositor-drm: rewrite crtc picking for clone mode
  compositor-drm: preserve CRTC routing harder
  compositor-drm: head detach requires a modeset
  compositor-drm: head attach requires a modeset
  compositor-drm: allow shared-CRTC cloning
  weston: store weston_compositor in wet_compositor
  weston: use wet.compositor consistently in main()
  weston: support clone mode on DRM-frontend
  Update copyrights for Collabora and General Electric Company

 compositor/main.c          | 556 ++++++++++++++++++++++++++++++++++++++++-----
 libweston/compositor-drm.c | 251 +++++++++++++++-----
 libweston/compositor.c     |   3 +-
 libweston/compositor.h     |   3 +-
 man/weston-drm.man         |  12 +
 5 files changed, 718 insertions(+), 107 deletions(-)
    
Revision 5
      From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Hi all,

all of the clone mode infrastructure has landed. There is just this one
patch remaining that actually allows one to use it through weston.ini.

Mind, this may be hard to test, because most contemporary PC graphics
devices might not support shared-CRTC clone mode at all. So if you try
this and face a frozen or black screen, it's likely that your hardware
just doesn't support this. An indication of no support is an error in
Weston log saying "atomic: couldn't commit new state" or "set mode
failed". Unfortunately, Weston does not recover from modeset failures
yet, but you should be able to quit gracefully with the usual
Ctrl+Alt+Backspace. You can still see in the Weston log how Weston tried
to configure clone mode.

I have used an i.MX6 based system to test.

This is also available in a GitLab(!) branch here along with the other
patch (force-on output) depending on this one:
https://gitlab.freedesktop.org/pq/weston/commits/clonemode-v10


The old Phabricator task (obsolete):
https://phabricator.freedesktop.org/T7727
The GitLab issue:
https://gitlab.freedesktop.org/wayland/weston/issues/22


Thanks,
pq

Pekka Paalanen (1):
  weston: support clone mode on DRM-frontend

 compositor/main.c  | 492 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 man/weston-drm.man |  12 ++
 2 files changed, 484 insertions(+), 20 deletions(-)
    

Revisions

Patches download mbox

# Name Submitter State A F R T
[weston,v3,01/36] weston: arm SEGV handler earlier Pekka Paalanen Accepted 2
[weston,v3,02/36] libweston: introduce weston_head Pekka Paalanen Superseded
[weston,v3,03/36] libweston: move wl_output to weston_head Pekka Paalanen Superseded
[weston,v3,04/36] libweston: use head in wl_output global Pekka Paalanen Superseded
[weston,v3,05/36] libweston: make wl_output point to weston_head Pekka Paalanen Superseded
[weston,v3,06/36] libweston: refactor weston_mode_switch_finish Pekka Paalanen Accepted 1
[weston,v3,07/36] libweston: introduce weston_output::head_list Pekka Paalanen Superseded
[weston,v3,08/36] libweston: strdup head make, model, serial_number Pekka Paalanen Accepted 1
[weston,v3,09/36] cms-colord: find a good head Pekka Paalanen Superseded
[weston,v3,10/36] libweston: add name to weston_head Pekka Paalanen Accepted
[weston,v3,11/36] libweston: add weston_head::connected Pekka Paalanen Superseded
[weston,v3,12/36] libweston: add compositor list of heads Pekka Paalanen Accepted
[weston,v3,13/36] libweston: add heads_changed hook Pekka Paalanen Superseded
[weston,v3,14/36] libweston: new head-based output management API Pekka Paalanen Superseded
[weston,v3,15/36] libweston: add weston_head destroy signal Pekka Paalanen Accepted
[weston,v3,16/36] libweston: add weston_head_is_device_changed() API Pekka Paalanen Superseded
[weston,v3,17/36] weston: move weston_output_enable() into callers Pekka Paalanen Accepted
[weston,v3,18/36] weston: migrate headless to head-based output API Pekka Paalanen Superseded
[weston,v3,19/36] weston: migrate x11 to head-based output API Pekka Paalanen Accepted
[weston,v3,20/36] weston: migrate wayland to head-based output API Pekka Paalanen Accepted
[weston,v3,21/36] weston: migrate fbdev to head-based output API Pekka Paalanen Superseded
[weston,v3,22/36] weston: migrate RDP to head-based output API Pekka Paalanen Superseded
[weston,v3,23/36] weston: migrate DRM to head-based output API Pekka Paalanen Superseded
[weston,v3,24/36] libweston: change windowed_output_api output_create to create_head Pekka Paalanen Accepted
[weston,v3,25/36] libweston: remove output_pending_signal Pekka Paalanen Superseded
[weston,v3,26/36] libweston: stop auto-adding the implicit head Pekka Paalanen Accepted
[weston,v3,27/36] libweston: assert make/model in weston_output_enable() Pekka Paalanen Accepted
[weston,v3,28/36] libweston: assert current_mode in weston_output_enable() Pekka Paalanen Accepted
[weston,v3,29/36] libweston: cancel idle_repaint on output destroy Pekka Paalanen Accepted
[weston,v3,30/36] compositor-headless: migrate to head-based output API Pekka Paalanen Superseded
[weston,v3,31/36] compositor-rdp: migrate to head-based output API Pekka Paalanen Superseded
[weston,v3,32/36] compositor-fbdev: make re-enable less drastic Pekka Paalanen Accepted
[weston,v3,33/36] compositor-fbdev: migrate to head-based output API Pekka Paalanen Superseded
[weston,v3,34/36] compositor-x11: migrate to head-based output API Pekka Paalanen Superseded
[weston,v3,35/36] compositor-wayland: strict surface create/destroy Pekka Paalanen Accepted
[weston,v3,36/36] compositor-wayland: migrate to head-based output API Pekka Paalanen Superseded

Patches download mbox

# Name Submitter State A F R T
[weston,v5,01/36] libweston: introduce weston_head Pekka Paalanen Superseded 1
[weston,v5,02/36] libweston: move wl_output to weston_head Pekka Paalanen Superseded
[weston,v5,03/36] libweston: use head in wl_output global Pekka Paalanen Accepted
[weston,v5,04/36] libweston: make wl_output point to weston_head Pekka Paalanen Superseded 1
[weston,v5,05/36] libweston: refactor weston_mode_switch_finish Pekka Paalanen Superseded 2
[weston,v5,06/36] libweston: introduce weston_output::head_list Pekka Paalanen Superseded 1
[weston,v5,07/36] libweston: properly orphan wl_output resources Pekka Paalanen Accepted
[weston,v5,08/36] libweston: strdup head make, model, serial_number Pekka Paalanen Superseded 1
[weston,v5,09/36] cms-colord: find a good head Pekka Paalanen Superseded
[weston,v5,10/36] libweston: add name to weston_head Pekka Paalanen Superseded
[weston,v5,11/36] libweston: add weston_head::connected Pekka Paalanen Superseded 1
[weston,v5,12/36] libweston: add compositor list of heads Pekka Paalanen Superseded
[weston,v5,13/36] libweston: add heads_changed hook Pekka Paalanen Superseded 1
[weston,v5,14/36] libweston: new head-based output management API Pekka Paalanen Superseded 1 1
[weston,v5,15/36] libweston: add weston_head destroy signal Pekka Paalanen Superseded 1
[weston,v5,16/36] libweston: add weston_head_is_device_changed() API Pekka Paalanen Superseded 1
[weston,v5,17/36] weston: move weston_output_enable() into callers Pekka Paalanen Superseded
[weston,v5,18/36] weston: migrate headless to head-based output API Pekka Paalanen Superseded
[weston,v5,19/36] weston: migrate x11 to head-based output API Pekka Paalanen Superseded
[weston,v5,20/36] weston: migrate wayland to head-based output API Pekka Paalanen Superseded
[weston,v5,21/36] weston: migrate fbdev to head-based output API Pekka Paalanen Superseded
[weston,v5,22/36] weston: migrate RDP to head-based output API Pekka Paalanen Superseded
[weston,v5,23/36] weston: migrate DRM to head-based output API Pekka Paalanen Superseded
[weston,v5,24/36] libweston: change windowed_output_api output_create to create_head Pekka Paalanen Superseded
[weston,v5,25/36] libweston: remove output_pending_signal Pekka Paalanen Superseded
[weston,v5,26/36] libweston: stop auto-adding the implicit head Pekka Paalanen Superseded
[weston,v5,27/36] libweston: assert make/model in weston_output_enable() Pekka Paalanen Superseded
[weston,v5,28/36] libweston: assert current_mode in weston_output_enable() Pekka Paalanen Superseded
[weston,v5,29/36] libweston: cancel idle_repaint on output destroy Pekka Paalanen Superseded
[weston,v5,30/36] compositor-headless: migrate to head-based output API Pekka Paalanen Superseded
[weston,v5,31/36] compositor-rdp: migrate to head-based output API Pekka Paalanen Superseded
[weston,v5,32/36] compositor-fbdev: make re-enable less drastic Pekka Paalanen Superseded
[weston,v5,33/36] compositor-fbdev: migrate to head-based output API Pekka Paalanen Superseded
[weston,v5,34/36] compositor-x11: migrate to head-based output API Pekka Paalanen Superseded
[weston,v5,35/36] compositor-wayland: strict surface create/destroy Pekka Paalanen Superseded
[weston,v5,36/36] compositor-wayland: migrate to head-based output API Pekka Paalanen Superseded

Patches download mbox

# Name Submitter State A F R T
[weston,v6,01/73] libweston: introduce weston_head Pekka Paalanen Accepted
[weston,v6,02/73] libweston: move wl_output to weston_head Pekka Paalanen Accepted
[weston,v6,03/73] libweston: use head in wl_output global Pekka Paalanen Accepted
[weston,v6,04/73] libweston: make wl_output point to weston_head Pekka Paalanen Accepted
[weston,v6,05/73] libweston: refactor weston_mode_switch_finish Pekka Paalanen Accepted
[weston,v6,06/73] libweston: introduce weston_output::head_list Pekka Paalanen Accepted
[weston,v6,07/73] libweston: properly orphan wl_output resources Pekka Paalanen Accepted
[weston,v6,08/73] libweston: strdup head make, model, serial_number Pekka Paalanen Accepted
[weston,v6,09/73] cms-colord: find a good head Pekka Paalanen Accepted
[weston,v6,10/73] libweston: add name to weston_head Pekka Paalanen Accepted 1
[weston,v6,11/73] libweston: add weston_head::connected Pekka Paalanen Accepted 1
[weston,v6,12/73] libweston: add weston_head_is_enabled() Pekka Paalanen Accepted 1
[weston,v6,13/73] libweston: add compositor list of heads Pekka Paalanen Accepted 1
[weston,v6,14/73] libweston: add heads_changed hook Pekka Paalanen Accepted 1
[weston,v6,15/73] libweston: new head-based output management API Pekka Paalanen Accepted 1
[weston,v6,16/73] libweston: add weston_head destroy signal Pekka Paalanen Accepted 1
[weston,v6,17/73] libweston: add weston_head_is_device_changed() API Pekka Paalanen Accepted
[weston,v6,18/73] weston: move weston_output_enable() into callers Pekka Paalanen Accepted
[weston,v6,19/73] weston: migrate headless to head-based output API Pekka Paalanen Accepted
[weston,v6,20/73] weston: migrate x11 to head-based output API Pekka Paalanen Accepted
[weston,v6,21/73] weston: migrate wayland to head-based output API Pekka Paalanen Accepted
[weston,v6,22/73] weston: migrate fbdev to head-based output API Pekka Paalanen Accepted
[weston,v6,23/73] weston: migrate RDP to head-based output API Pekka Paalanen Accepted
[weston,v6,24/73] weston: migrate DRM to head-based output API Pekka Paalanen Accepted
[weston,v6,25/73] libweston: change windowed_output_api output_create to create_head Pekka Paalanen Accepted
[weston,v6,26/73] libweston: remove output_pending_signal Pekka Paalanen Accepted
[weston,v6,27/73] libweston: stop auto-adding the implicit head Pekka Paalanen Accepted
[weston,v6,28/73] libweston: assert make/model in weston_output_enable() Pekka Paalanen Accepted
[weston,v6,29/73] libweston: assert current_mode in weston_output_enable() Pekka Paalanen Accepted
[weston,v6,30/73] libweston: cancel idle_repaint on output destroy Pekka Paalanen Accepted
[weston,v6,31/73] compositor-headless: migrate to head-based output API Pekka Paalanen Accepted
[weston,v6,32/73] compositor-rdp: migrate to head-based output API Pekka Paalanen Accepted
[weston,v6,33/73] compositor-fbdev: make re-enable less drastic Pekka Paalanen Accepted
[weston,v6,34/73] compositor-fbdev: migrate to head-based output API Pekka Paalanen Accepted
[weston,v6,35/73] compositor-x11: migrate to head-based output API Pekka Paalanen Accepted
[weston,v6,36/73] compositor-wayland: strict surface create/destroy Pekka Paalanen Accepted
[weston,v6,37/73] compositor-wayland: migrate to head-based output API Pekka Paalanen Accepted
[weston,v6,38/73] compositor-drm: start migration to head-based output API Pekka Paalanen Accepted
[weston,v6,39/73] libweston: remove weston_output::head Pekka Paalanen Accepted
[weston,v6,40/73] libweston: print head names on output enable Pekka Paalanen Accepted
[weston,v6,41/73] libweston: create/find output by name Pekka Paalanen Accepted
[weston,v6,42/73] libweston: support user data on weston_output Pekka Paalanen Accepted
[weston,v6,43/73] libweston: allow attaching heads to enabled outputs Pekka Paalanen Accepted
[weston,v6,44/73] libweston: log head detach on enabled output Pekka Paalanen Accepted
[weston,v6,45/73] compositor-drm: drm_output_find_by_connector from head_list Pekka Paalanen Accepted
[weston,v6,46/73] compositor-drm: use head_find_by_connector in update_unused_outputs Pekka Paalanen Accepted
[weston,v6,47/73] compositor-drm: find disconnects from head_list Pekka Paalanen Accepted
[weston,v6,48/73] compositor-drm: move backlight into drm_head Pekka Paalanen Accepted
[weston,v6,49/73] compositor-drm: move connector fields into drm_head Pekka Paalanen Accepted
[weston,v6,50/73] compositor-drm: allocate CRTC on enable() Pekka Paalanen Accepted
[weston,v6,51/73] compositor-drm: simplify drm_output_find_by_crtc() Pekka Paalanen Accepted
[weston,v6,52/73] compositor-drm: simplify drm_output_find_special_plane() Pekka Paalanen Accepted
[weston,v6,53/73] compositor-drm: get current mode on head discovery Pekka Paalanen Accepted
[weston,v6,54/73] compositor-drm: move mode list to set_mode() Pekka Paalanen Accepted
[weston,v6,55/73] compositor-drm: create heads for all connectors Pekka Paalanen Accepted
[weston,v6,56/73] compositor-drm: remove unused_connectors array Pekka Paalanen Accepted
[weston,v6,57/73] compositor-drm: drm_output_apply_state_legacy heads Pekka Paalanen Accepted
[weston,v6,58/73] compositor-drm: drm_output_apply_state_atomic heads Pekka Paalanen Accepted
[weston,v6,59/73] compositor-drm: drm_set_backlight heads Pekka Paalanen Accepted
[weston,v6,60/73] compositor-drm: unify head status logging Pekka Paalanen Accepted
[weston,v6,61/73] compositor-drm: combine mode list from heads Pekka Paalanen Accepted
[weston,v6,62/73] compositor-drm: backlight control for all heads Pekka Paalanen Accepted
[weston,v6,63/73] compositor-drm: update video mode printing Pekka Paalanen Accepted
[weston,v6,64/73] compositor-drm: introduce drm_head_read_current_setup() Pekka Paalanen Accepted
[weston,v6,65/73] compositor-drm: no need to clear inherited_mode Pekka Paalanen Accepted 1
[weston,v6,66/73] compositor-drm: rewrite crtc picking for clone mode Pekka Paalanen Accepted
[weston,v6,67/73] compositor-drm: preserve CRTC routing harder Pekka Paalanen Accepted
[weston,v6,68/73] compositor-drm: head detach requires a modeset Pekka Paalanen Accepted
[weston,v6,69/73] compositor-drm: head attach requires a modeset Pekka Paalanen Superseded
[weston,v6,70/73] compositor-drm: allow shared-CRTC cloning Pekka Paalanen Accepted
[weston,v6,71/73] weston: store weston_compositor in wet_compositor Pekka Paalanen Superseded
[weston,v6,72/73] weston: use wet.compositor consistently in main() Pekka Paalanen Accepted
[weston,v6,73/73] weston: support clone mode on DRM-frontend Pekka Paalanen Superseded

Patches download mbox

# Name Submitter State A F R T
[weston,v10,1/1] weston: support clone mode on DRM-frontend Pekka Paalanen Accepted 2 1 1