[PATCH weston v6 56/73] compositor-drm: remove unused_connectors array
Pekka Paalanen
ppaalanen at gmail.com
Thu Apr 12 12:48:51 UTC 2018
On Thu, 12 Apr 2018 14:38:01 +0200
Daniel Stone <daniel at fooishbar.org> wrote:
> Hi Pekka,
>
> On 16 February 2018 at 15:57, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > Replace the unused_connectors array by iterating through the head list
> > instead. A head that is not enabled (attached to an enabled output) is
> > basically an unused connector.
> >
> > All connectors regardless of their status have a drm_head. This has the
> > nice effect that drm_pending_state_apply_atomic() does not need to
> > re-query the connector properties every time, they can be simply looked
> > up in the drm_head.
>
> \o/ Nice!
>
> Small comment, which also applies to some of the other patches IIRC:
>
> > if (b->state_invalid) {
> > + struct weston_head *head_base;
> > + struct drm_head *head;
> > uint32_t *unused;
> > int err;
> >
> > /* If we need to reset all our state (e.g. because we've
> > * just started, or just been VT-switched in), explicitly
> > * disable all the CRTCs and connectors we aren't using. */
> > - wl_array_for_each(unused, &b->unused_connectors) {
> > - struct drm_property_info infos[WDRM_CONNECTOR__COUNT];
> > + wl_list_for_each(head_base,
> > + &b->compositor->head_list, compositor_link) {
>
> wl_list_for_each(head, &b->compositor->head_list, base.compositor_link)
>
> You can get rid of the head_base declaration as well as the cast that way.
Actually I very specifically chose to not do that. I want to keep the
to_drm_head() call, because I envision in the future we will have
several different kinds of heads (virtual maybe) and to_drm_head()
might actually return NULL. Grepping for it will be easy, finding all
the wl_list_for_each(..., base.derived_field) will be hard.
I have been migrating the whole code base towards the explicit calls of
down-cast wrappers and away from the sneaky container_of() double-casts
as I go. This applies to outputs as well.
Thanks,
pq
>
> That being said, I'm still working through and up to here I've only
> these two comments. Otherwise, so far, very happy to land what's here.
>
> Cheers,
> Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180412/af4ec9d0/attachment.sig>
More information about the wayland-devel
mailing list