backend/drm: Add support for hotplug_mode_update connector property

This connector property is used by virtual graphics drivers to indicate
that a virtual display has changed its list of supported resolutions and
updated its preferred mode. In the event of a hotplug the connector is
considered to be "re-plugged" without disconnecting first. This allows
virtual displays to be resized automatically when their window size
changes.

Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
This commit is contained in:
Ian Forbes 2024-11-04 15:19:13 -06:00
parent 3fdbfb0be8
commit a8611fdfb2
3 changed files with 10 additions and 0 deletions

View file

@ -1791,6 +1791,14 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
drm_conn->connection != DRM_MODE_CONNECTED) { drm_conn->connection != DRM_MODE_CONNECTED) {
wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name); wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name);
disconnect_drm_connector(wlr_conn); disconnect_drm_connector(wlr_conn);
} else if (wlr_conn->status == DRM_MODE_CONNECTED &&
drm_conn->connection == DRM_MODE_CONNECTED
&& wlr_conn->props.hotplug_mode_update > 0)
{
wlr_log(WLR_INFO, "'%s' reconnected", wlr_conn->name);
disconnect_drm_connector(wlr_conn);
connect_drm_connector(wlr_conn, drm_conn);
new_outputs[new_outputs_len++] = wlr_conn;
} }
drmModeFreeConnector(drm_conn); drmModeFreeConnector(drm_conn);

View file

@ -25,6 +25,7 @@ static const struct prop_info connector_info[] = {
{ "EDID", INDEX(edid) }, { "EDID", INDEX(edid) },
{ "PATH", INDEX(path) }, { "PATH", INDEX(path) },
{ "content type", INDEX(content_type) }, { "content type", INDEX(content_type) },
{ "hotplug_mode_update", INDEX(hotplug_mode_update) },
{ "link-status", INDEX(link_status) }, { "link-status", INDEX(link_status) },
{ "max bpc", INDEX(max_bpc) }, { "max bpc", INDEX(max_bpc) },
{ "non-desktop", INDEX(non_desktop) }, { "non-desktop", INDEX(non_desktop) },

View file

@ -22,6 +22,7 @@ struct wlr_drm_connector_props {
uint32_t panel_orientation; // not guaranteed to exist uint32_t panel_orientation; // not guaranteed to exist
uint32_t content_type; // not guaranteed to exist uint32_t content_type; // not guaranteed to exist
uint32_t max_bpc; // not guaranteed to exist uint32_t max_bpc; // not guaranteed to exist
uint32_t hotplug_mode_update; // not guaranteed to exist, VMs only
// atomic-modesetting only // atomic-modesetting only