drm-backend: add helper function resources_has_connector()

Add helper function resources_has_connector(), what makes
the function drm_backend_update_connectors() look better.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 4 years ago committed by Pekka Paalanen
parent 993920dd81
commit 99611c8788
  1. 21
      libweston/backend-drm/drm.c

@ -2265,6 +2265,17 @@ drm_backend_create_heads(struct drm_backend *b, struct udev_device *drm_device)
return 0;
}
static bool
resources_has_connector(drmModeRes *resources, uint32_t connector_id)
{
for (int i = 0; i < resources->count_connectors; i++) {
if (resources->connectors[i] == connector_id)
return true;
}
return false;
}
static void
drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_device)
{
@ -2307,18 +2318,10 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev
/* Remove connectors that have disappeared. */
wl_list_for_each_safe(base, next,
&b->compositor->head_list, compositor_link) {
bool removed = true;
head = to_drm_head(base);
connector_id = head->connector.connector_id;
for (i = 0; i < resources->count_connectors; i++) {
if (resources->connectors[i] == connector_id) {
removed = false;
break;
}
}
if (!removed)
if (resources_has_connector(resources, connector_id))
continue;
weston_log("DRM: head '%s' (connector %d) disappeared.\n",

Loading…
Cancel
Save