mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-06 18:05:39 +00:00
compositor-drm: get current mode on head discovery
The inherited mode is the video mode on the connector when we have not yet reconfigured the connector, if set. Get the inherited mode the moment we create a drm_head, not when we determine the mode for a drm_output. This way we are sure to read all inherited modes before we reconfigure a single CRTC. Enabling one output may grab the CRTC from another connector, overwriting whatever mode that connector might have had. The inherited mode is stored in drm_head, where we can keep it for the lifetime of the head, rather than relying on re-loading it from the kernel at set_mode() time. 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>
This commit is contained in:
parent
f857046559
commit
13d233edba
|
@ -416,6 +416,8 @@ struct drm_head {
|
|||
struct drm_property_info props_conn[WDRM_CONNECTOR__COUNT];
|
||||
|
||||
struct backlight *backlight;
|
||||
|
||||
drmModeModeInfo inherited_mode; /**< Original mode on the connector */
|
||||
};
|
||||
|
||||
struct drm_output {
|
||||
|
@ -4560,12 +4562,9 @@ drm_output_set_mode(struct weston_output *base,
|
|||
struct drm_head *head = to_drm_head(weston_output_get_first_head(base));
|
||||
|
||||
struct drm_mode *current;
|
||||
drmModeModeInfo crtc_mode;
|
||||
|
||||
if (connector_get_current_mode(head->connector, b->drm.fd, &crtc_mode) < 0)
|
||||
return -1;
|
||||
|
||||
current = drm_output_choose_initial_mode(b, output, mode, modeline, &crtc_mode);
|
||||
current = drm_output_choose_initial_mode(b, output, mode, modeline,
|
||||
&head->inherited_mode);
|
||||
if (!current)
|
||||
return -1;
|
||||
|
||||
|
@ -5079,6 +5078,13 @@ 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) {
|
||||
weston_log("Failed to retrieve current mode from connector %d.\n",
|
||||
head->connector_id);
|
||||
/* Continue, inherited_mode was memset to zero. */
|
||||
}
|
||||
|
||||
weston_compositor_add_head(backend->compositor, &head->base);
|
||||
|
||||
weston_log("DRM: found head '%s', connector %d %s.\n",
|
||||
|
|
Loading…
Reference in a new issue