[PATCH weston v6 64/73] compositor-drm: introduce drm_head_read_current_setup()

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 16 14:57:49 UTC 2018


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Rename connector_get_current_mode() because it will be useful for
storing not just the current mode on creating a head.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor-drm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index d470647c..352bd17b 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4696,15 +4696,16 @@ drm_output_choose_initial_mode(struct drm_backend *backend,
 }
 
 static int
-connector_get_current_mode(drmModeConnector *connector, int drm_fd,
-			   drmModeModeInfo *mode)
+drm_head_read_current_setup(struct drm_head *head, struct drm_backend *backend)
 {
+	drmModeModeInfo *mode = &head->inherited_mode;
+	int drm_fd = backend->drm.fd;
 	drmModeEncoder *encoder;
 	drmModeCrtc *crtc;
 
 	/* Get the current mode on the crtc that's currently driving
 	 * this connector. */
-	encoder = drmModeGetEncoder(drm_fd, connector->encoder_id);
+	encoder = drmModeGetEncoder(drm_fd, head->connector->encoder_id);
 	memset(mode, 0, sizeof *mode);
 	if (encoder != NULL) {
 		crtc = drmModeGetCrtc(drm_fd, encoder->crtc_id);
@@ -5253,8 +5254,7 @@ drm_head_create(struct drm_backend *backend, uint32_t connector_id,
 	    head->connector->connector_type == DRM_MODE_CONNECTOR_eDP)
 		weston_head_set_internal(&head->base);
 
-	if (connector_get_current_mode(head->connector, backend->drm.fd,
-				       &head->inherited_mode) < 0) {
+	if (drm_head_read_current_setup(head, backend) < 0) {
 		weston_log("Failed to retrieve current mode from connector %d.\n",
 			   head->connector_id);
 		/* Continue, inherited_mode was memset to zero. */
-- 
2.13.6



More information about the wayland-devel mailing list