compositor-drm: drm_output_find_by_connector from head_list
Switch drm_output_find_by_connector() to search for the output by iterating the compositor's head_list. drm_head_find_by_connector() will be useful later on its own. As of "compositor-drm: start migration to head-based output API" the head list is guaranteed to contain all created drm_outputs through the automatically created drm_head. This simplifies the code a little, introduces drm_head_find_by_connector(), and works towards the eventual removal of drm_output_find_by_connector(). 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:
+21
-11
@@ -803,21 +803,31 @@ drm_output_find_by_crtc(struct drm_backend *b, uint32_t crtc_id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct drm_head *
|
||||||
|
drm_head_find_by_connector(struct drm_backend *backend, uint32_t connector_id)
|
||||||
|
{
|
||||||
|
struct weston_head *base;
|
||||||
|
struct drm_head *head;
|
||||||
|
|
||||||
|
wl_list_for_each(base,
|
||||||
|
&backend->compositor->head_list, compositor_link) {
|
||||||
|
head = to_drm_head(base);
|
||||||
|
if (head->output && head->output->connector_id == connector_id)
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static struct drm_output *
|
static struct drm_output *
|
||||||
drm_output_find_by_connector(struct drm_backend *b, uint32_t connector_id)
|
drm_output_find_by_connector(struct drm_backend *b, uint32_t connector_id)
|
||||||
{
|
{
|
||||||
struct drm_output *output;
|
struct drm_head *head;
|
||||||
|
|
||||||
wl_list_for_each(output, &b->compositor->output_list, base.link) {
|
/* XXX: like the old version, this counts both enabled and disabled outputs */
|
||||||
if (output->connector_id == connector_id)
|
head = drm_head_find_by_connector(b, connector_id);
|
||||||
return output;
|
if (head && head->output)
|
||||||
}
|
return head->output;
|
||||||
|
|
||||||
wl_list_for_each(output, &b->compositor->pending_output_list,
|
|
||||||
base.link) {
|
|
||||||
if (output->connector_id == connector_id)
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user