compositor-drm: introduce drm_head_read_current_setup()
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 28 Nov 2017 12:30:10 +0000 (14:30 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 18 Apr 2018 09:00:52 +0000 (12:00 +0300)
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@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
libweston/compositor-drm.c

index 32b9182..663a3e3 100644 (file)
@@ -4678,15 +4678,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);
@@ -5235,8 +5236,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. */