[PATCH weston v5 00/42] Atomic modesetting

Daniel Stone daniels at collabora.com
Wed Nov 16 14:24:52 UTC 2016

Well, that got quite out of hand.

When working on earlier rounds of atomic, I found it very difficult to
keep it stable and handle all the corner cases, especially with
TEST_ONLY. Coming back to it this time, I've tried to do a few things

Firstly, rather than using various parts of the structures as staging
points, I've gone for building explicit state for all the objects we
track, backed up with a pile of asserts. Everything we do runs through
these state structures. They happen to look a lot like the kernel's: I
did start with a slightly different model, but over a few iterations
ended up naturally gravitating towards the kernel model. I think this
is a pretty good sign.

Secondly, rather than committing at various places all through the
backend, I've tried to centralise state application to exactly one path.
This makes it easier to reason about what exactly is happening.

Thirdly, rather than going straight for the jugular and enabling sprite
support, I've conservatively left it off. Constructing the state is
hard, and trying to do it properly made assign_planes untenable. More

There are still a couple of warts, and one patch which is definitely
broken (note the XXX), and I'm sure other things will shake out. As
I think of it, I'm pretty sure we don't set the weston_plane geometry
correctly, except for cursor planes. And disable_pending etc are
missing conditionals for atomic_update_pending, to go with
page_flip_pending et al. Ho hum.

Hopefully it's relatively easy to review these as separate bodies of
work: the first few misc cleanup patches, the drm_fb series,
the state management series, moving to output_state/plane_state, and
atomic support. Each patch is much less randomly invasive than previous

My plan is to continue testing this, including on other implementations:
so far it's been tested across EGL and Pixman on Intel Skylake and
Rockchip, and polish this set of patches. On top of this, I want to do
a couple more things. Firstly, collapse the prepare_*_view functions
into a common set which work on drm_plane_state, so we can stop getting
transforms wrong. After that, pull in Esaki-san's support for importing
dmabuf without GBM. And with all this, butcher assign_planes so we can
work through it with atomic's TEST_ONLY mode and gain some confidence in
plane configuration, so we can disable sprites_are_broken.

There are certainly more warts lying in the future, including
https://phabricator.freedesktop.org/T7621 (and DPMS): in general, we have
a pretty unfortunate impedance mismatch, where the Wayland protocol is
very careful to build state atomically and the kernel demands atomic
units of state, but core Weston smashes these up and happens to throw
small state components at us at arbitrary times with no context.
Fixing those will make the backend somewhat more simple, and fix a few
broken corner cases. It should also make things like initial
configuration, resizing, etc, a lot easier.

As before, thanks to Pekka, Louis-Francis and Derek for their work on
earlier revisions, to Intel for sponsoring much early work on this,
and to Collabora for the rest.


Daniel Stone (39):
  compositor-drm: Comment struct members
  compositor-drm: Delete drm_backend_set_modes
  compositor-drm: Remove open-coded weston_compositor_wake
  Remove DPMS-on when going offscreen
  compositor-drm: Simplify drm_sprite_crtc_supported
  compositor-drm: Extract EGL destroy to helper
  compositor-drm: Reshuffle and comment plane conditions
  compositor-drm: Make scanout view preparation more stringent
  compositor-drm: Calculate more cursor state up front
  compositor-drm: Use fb->fd consistently
  compositor-drm: Use signed int for width/height
  compositor-drm: Store width and height inside drm_fb
  compositor-drm: Add explicit type member to drm_fb
  compositor-drm: Drop output from release_fb
  compositor-drm: Refcount drm_fb
  compositor-drm: Use refcounted FBs for Pixman
  compositor-drm: Use drm_fb for cursor buffers
  compositor-drm: Rename current/next FB members
  compositor-drm: Reshuffle drm_output_render
  compositor-drm: Return FB directly from render
  compositor-drm: Introduce fb_last member
  compositor-drm: Turn vblank_pending from bool to refcount
  compositor-drm: Clean up page_flip_pending path
  compositor-drm: Rename drm_sprite to drm_plane
  compositor-drm: Rename fb_plane to scanout_plane
  compositor-drm: Track all plane types
  compositor-drm: Introduce drm_output_state structure
  compositor-drm: Introduce drm_plane_state structure
  compositor-drm: Track cursor_plane with a drm_plane
  compositor-drm: Use drm_plane for scanout plane
  compositor-drm: Don't repaint if no damage
  compositor-drm: Split repaint into helper
  compositor-drm: Move DPMS into output state
  [XXX] compositor-drm: Don't restore original CRTC mode
  compositor-drm: Discover atomic properties
  compositor-drm: Add blob_id member to drm_mode
  compositor-drm: Add to_drm_mode helper
  compositor-drm: Don't open-code to_drm_output
  compositor-drm: Atomic modesetting support

Pekka Paalanen (2):
  compositor-drm: Refactor sprite create/destroy into helpers
  compositor-drm: Add universal plane awareness

Tomohito Esaki (1):
  compositor-drm: Refactor destroy drm_fb function

 libweston/compositor-drm.c | 2802 ++++++++++++++++++++++++++++++++++----------
 libweston/compositor.c     |    9 +-
 2 files changed, 2194 insertions(+), 617 deletions(-)


More information about the wayland-devel mailing list