compositor-drm: introduce drm_head_read_current_setup()

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>
dev
Pekka Paalanen 7 years ago
parent c0eb25464b
commit 9c03a7c4ab
  1. 10
      libweston/compositor-drm.c

@ -4678,15 +4678,16 @@ drm_output_choose_initial_mode(struct drm_backend *backend,
} }
static int static int
connector_get_current_mode(drmModeConnector *connector, int drm_fd, drm_head_read_current_setup(struct drm_head *head, struct drm_backend *backend)
drmModeModeInfo *mode)
{ {
drmModeModeInfo *mode = &head->inherited_mode;
int drm_fd = backend->drm.fd;
drmModeEncoder *encoder; drmModeEncoder *encoder;
drmModeCrtc *crtc; drmModeCrtc *crtc;
/* Get the current mode on the crtc that's currently driving /* Get the current mode on the crtc that's currently driving
* this connector. */ * this connector. */
encoder = drmModeGetEncoder(drm_fd, connector->encoder_id); encoder = drmModeGetEncoder(drm_fd, head->connector->encoder_id);
memset(mode, 0, sizeof *mode); memset(mode, 0, sizeof *mode);
if (encoder != NULL) { if (encoder != NULL) {
crtc = drmModeGetCrtc(drm_fd, encoder->crtc_id); 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) head->connector->connector_type == DRM_MODE_CONNECTOR_eDP)
weston_head_set_internal(&head->base); weston_head_set_internal(&head->base);
if (connector_get_current_mode(head->connector, backend->drm.fd, if (drm_head_read_current_setup(head, backend) < 0) {
&head->inherited_mode) < 0) {
weston_log("Failed to retrieve current mode from connector %d.\n", weston_log("Failed to retrieve current mode from connector %d.\n",
head->connector_id); head->connector_id);
/* Continue, inherited_mode was memset to zero. */ /* Continue, inherited_mode was memset to zero. */

Loading…
Cancel
Save