backend-drm: handle hotplug events per drm device

If Weston receives a hotplug event, it has to check if the hotplug device
actually belongs to the drm device before updating the heads of the device. The
hotplug event should only remove heads that belong to the device and must not
change heads of other devices.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
dev
Michael Tretter 3 years ago committed by Daniel Stone
parent d990c6a939
commit 6e36787dfd
  1. 15
      libweston/backend-drm/drm.c

@ -2422,9 +2422,10 @@ resources_has_connector(drmModeRes *resources, uint32_t connector_id)
} }
static void static void
drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_device) drm_backend_update_connectors(struct drm_device *device,
struct udev_device *drm_device)
{ {
struct drm_device *device = b->drm; struct drm_backend *b = device->backend;
drmModeRes *resources; drmModeRes *resources;
drmModeConnector *conn; drmModeConnector *conn;
struct weston_head *base, *base_next; struct weston_head *base, *base_next;
@ -2472,6 +2473,9 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev
head = to_drm_head(base); head = to_drm_head(base);
connector_id = head->connector.connector_id; connector_id = head->connector.connector_id;
if (head->connector.device != device)
continue;
if (resources_has_connector(resources, connector_id)) if (resources_has_connector(resources, connector_id))
continue; continue;
@ -2544,9 +2548,8 @@ drm_backend_update_conn_props(struct drm_backend *b,
} }
static int static int
udev_event_is_hotplug(struct drm_backend *b, struct udev_device *udev_device) udev_event_is_hotplug(struct drm_device *device, struct udev_device *udev_device)
{ {
struct drm_device *device = b->drm;
const char *sysnum; const char *sysnum;
const char *val; const char *val;
@ -2595,11 +2598,11 @@ udev_drm_event(int fd, uint32_t mask, void *data)
event = udev_monitor_receive_device(b->udev_monitor); event = udev_monitor_receive_device(b->udev_monitor);
if (udev_event_is_hotplug(b, event)) { if (udev_event_is_hotplug(b->drm, event)) {
if (udev_event_is_conn_prop_change(b, event, &conn_id, &prop_id)) if (udev_event_is_conn_prop_change(b, event, &conn_id, &prop_id))
drm_backend_update_conn_props(b, conn_id, prop_id); drm_backend_update_conn_props(b, conn_id, prop_id);
else else
drm_backend_update_connectors(b, event); drm_backend_update_connectors(b->drm, event);
} }
udev_device_unref(event); udev_device_unref(event);

Loading…
Cancel
Save