weston/libweston
Daniel Stone f30a18c1c3 compositor-drm: Introduce fb_last member
Previously, framebuffers were stored as fb_current and fb_pending.
In this scheme, current was the last buffer that the kernel/hardware had
acknowledged displaying: a framebuffer would be created, set as
fb_pending, and Weston would request the kernel display it. When the
kernel signals that the request was completed and the hardware had made
the buffer current (i.e. page_flip_handler / vblank_handler), we would
unreference the old fb_current, and promote fb_pending to fb_current.

In other words, the view is 'which buffer has turned to light?'.

This patch changes them to a tristate of fb_last, fb_current and
fb_pending, based around the kernel's view of the current state.
fb_pending is used purely as a staging area for request construction;
when the kernel acknowledges a request (e.g. drmModePageFlip returns 0),
the previous buffer is moved to fb_last, and this new buffer to
fb_current. When the kernel signals that the request has completed and
the hardware has made the buffer current, we simply unreference and
clear fb_last, without touching fb_current/fb_pending.

The view here is now 'which state is current in the kernel?'.

As all state changes are incremental on the last state submitted to the
kernel, even if the hardware has not yet been able to make it current,
this simplifies state tracking: all state submissions will always be
relative to fb_current, rather than the previous
(fb_pending) ? fb_pending : fb_current.

The use of fb_pending is strictly bounded between a repaint cycle
(including a grouped set of repaints) beginning, and those repaints
being flushed to the kernel.

fb_current will always be valid between an output's first repaint
flush, and when a disable/destroy request has been processed. For a
plane, it will be valid when a repaint cycle enabling that plane has
been flushed, and when a repaint cycle disabling that plane has been
flushed.

fb_last is only present when a repaint request for the output/plane has
been submitted, but not yet completed by the hardware.

This is the same set of constructs which will be used for storing
plane/output state objects in future patches.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-10 13:55:25 +03:00
..
animation.c libweston: Add move (without scale) animation 2016-11-21 18:22:47 +00:00
bindings.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
clipboard.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
compositor-drm.c compositor-drm: Introduce fb_last member 2017-04-10 13:55:25 +03:00
compositor-drm.h compositor-drm: pageflip timeout implementation 2017-03-07 16:42:40 +02:00
compositor-fbdev.c Allow backends to group repaint flushes 2017-03-14 12:01:50 +02:00
compositor-fbdev.h weston: Port fbdev backend to new output handling API 2016-10-03 14:24:08 +03:00
compositor-headless.c Allow backends to group repaint flushes 2017-03-14 12:01:50 +02:00
compositor-headless.h weston: Port headless backend to new output handling API 2016-10-03 14:24:08 +03:00
compositor-rdp.c Allow backends to group repaint flushes 2017-03-14 12:01:50 +02:00
compositor-rdp.h weston: Port RDP backend to new output handling API 2016-10-03 14:24:08 +03:00
compositor-wayland.c compositor-wayland: Properly dealloc mmap data using munmap 2017-03-31 01:38:30 +02:00
compositor-wayland.h compositor-wayland: Convert fullscreen flag to bool 2016-10-14 10:42:17 +02:00
compositor-x11.c Allow backends to group repaint flushes 2017-03-14 12:01:50 +02:00
compositor-x11.h weston: Port X11 backend to new output handling API 2016-10-05 14:59:09 +03:00
compositor.c Fix uninitialized msec_to_next in output_repaint_timer_arm 2017-03-22 17:55:07 +01:00
compositor.h Allow backends to group repaint flushes 2017-03-14 12:01:50 +02:00
data-device.c libweston: Rename weston_surface::configure to ::committed 2016-08-14 09:28:50 +02:00
dbus.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
dbus.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
gl-renderer.c gl-renderer: Change 'data' type to 'uint8_t *', since 'void *' arithmetic is undefined 2017-03-31 01:26:36 +02:00
gl-renderer.h gl-renderer: Add <platform_attribs> param to gl_renderer_display_create 2016-11-07 17:06:44 +02:00
input.c Don't prepend protocol/ to include paths 2016-11-29 09:49:00 +00:00
launcher-direct.c configure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR 2017-04-07 12:02:47 +03:00
launcher-impl.h libweston/launcher: annotate iface(s) as constant data 2017-02-27 21:55:02 +00:00
launcher-logind.c launcher: Add sysmacros.h include for major() 2017-03-13 17:56:16 +00:00
launcher-util.c libweston/launcher: annotate iface(s) as constant data 2017-02-27 21:55:02 +00:00
launcher-util.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
launcher-weston-launch.c configure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR 2017-04-07 12:02:47 +03:00
libbacklight.c Switch to use safe_strtoint instead of strtol 2016-08-06 18:19:22 -07:00
libbacklight.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
libinput-device.c libinput: Suppress unhandled-case warning 2017-03-17 17:37:47 +00:00
libinput-device.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
libinput-seat.c Add configuration option for no input device. 2016-10-22 15:04:58 +01:00
libinput-seat.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
libweston.pc.in libweston: fix major in libweston.pc 2016-08-02 14:19:11 +03:00
linux-dmabuf.c (multiple): Use standard permission notice 2017-02-13 21:45:12 +00:00
linux-dmabuf.h (multiple): Use standard permission notice 2017-02-13 21:45:12 +00:00
log.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
noop-renderer.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
pixel-formats.c libweston: Add pixel-format helpers 2017-04-07 12:28:36 +03:00
pixel-formats.h libweston: Add pixel-format helpers 2017-04-07 12:28:36 +03:00
pixman-renderer.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
pixman-renderer.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
plugin-registry.c compositor: add plugin-registry 2016-07-01 14:10:26 +03:00
plugin-registry.h compositor: add plugin-registry 2016-07-01 14:10:26 +03:00
screenshooter.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
spring-tool.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00
timeline-object.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
timeline.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
timeline.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
vaapi-recorder.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
vaapi-recorder.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
version.h.in Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
vertex-clipping.c Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
vertex-clipping.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
weston-launch.c configure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR 2017-04-07 12:02:47 +03:00
weston-launch.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
windowed-output-api.h libweston: Add initial output API for windowed outputs configuration 2016-10-03 13:51:24 +03:00
zoom.c include stdint.h for int32_t/uint32_t 2016-07-26 16:26:08 -07:00