[PATCH weston 40/68] compositor-drm: Use apply_state for starting repaint
Daniel Stone
daniels at collabora.com
Fri Dec 9 19:57:55 UTC 2016
Rather than open-coding it ourselves, use the new apply_state helper in
drm_output_start_repaint.
Signed-off-by: Daniel Stone <daniels at collabora.com>
Reported-by: Fabien DESSENNE <fabien.dessenne at st.com>
Differential Revision: https://phabricator.freedesktop.org/D1514
---
libweston/compositor-drm.c | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index ec8db31..5959aed 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1743,12 +1743,9 @@ static void
drm_output_start_repaint_loop(struct weston_output *output_base)
{
struct drm_output *output = to_drm_output(output_base);
- struct drm_output_state *output_state;
- struct drm_plane_state *plane_state;
struct drm_plane *scanout_plane = output->scanout_plane;
struct drm_backend *backend =
to_drm_backend(output_base->compositor);
- uint32_t fb_id;
struct timespec ts, tnow;
struct timespec vbl2now;
int64_t refresh_nsec;
@@ -1798,37 +1795,21 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
/* Immediate query didn't provide valid timestamp.
* Use pageflip fallback.
*/
- fb_id = scanout_plane->state_cur->fb->fb_id;
assert(!output->page_flip_pending);
assert(!output->state_last);
assert(!output->state_pending);
- output_state =
+ output->state_pending =
drm_output_state_duplicate(output->state_cur,
DRM_OUTPUT_STATE_PRESERVE_PLANES);
- if (drmModePageFlip(backend->drm.fd, output->crtc_id, fb_id,
- DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
- weston_log("queueing pageflip failed: %m\n");
- drm_output_state_free(output_state);
+ ret = drm_output_apply_state(output->state_pending);
+ if (ret != 0) {
+ weston_log("applying repaint-start state failed: %m\n");
goto finish_frame;
}
- wl_list_for_each(plane_state, &output_state->plane_list, link) {
- if (plane_state->plane->type != WDRM_PLANE_TYPE_OVERLAY)
- continue;
-
- vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
- vbl.request.type |= drm_waitvblank_pipe(output);
- vbl.request.sequence = 1;
- vbl.request.signal = (unsigned long) plane_state;
- drmWaitVBlank(backend->drm.fd, &vbl);
- }
-
- drm_output_assign_state(output_state,
- DRM_OUTPUT_STATE_UPDATE_ASYNCHRONOUS);
-
return;
finish_frame:
--
2.9.3
More information about the wayland-devel
mailing list