[PATCH weston 44/68] compositor-drm: Add to_drm_mode helper

Daniel Stone daniels at collabora.com
Fri Dec 9 19:57:59 UTC 2016


Much like we already have to_drm_output and to_drm_backend.

Differential Revision: https://phabricator.freedesktop.org/D1505

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 libweston/compositor-drm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index c98ba25..b33d519 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -393,6 +393,12 @@ to_drm_backend(struct weston_compositor *base)
 	return container_of(base->backend, struct drm_backend, base);
 }
 
+static inline struct drm_mode *
+to_drm_mode(struct weston_mode *base)
+{
+	return container_of(base, struct drm_mode, base);
+}
+
 /**
  * Return a string describing the type of a DRM object
  */
@@ -1740,7 +1746,7 @@ drm_output_apply_state(struct drm_output_state *state)
 	assert(scanout_state->src_w == scanout_state->dest_w << 16);
 	assert(scanout_state->src_h == scanout_state->dest_h << 16);
 
-	mode = container_of(output->base.current_mode, struct drm_mode, base);
+	mode = to_drm_mode(output->base.current_mode);
 	if (!scanout_plane->state_cur->fb ||
 	    scanout_plane->state_cur->fb->stride != scanout_state->fb->stride) {
 		ret = drmModeSetCrtc(backend->drm.fd, output->crtc_id,
-- 
2.9.3



More information about the wayland-devel mailing list