[PATCH weston v12 02/40] compositor-drm: Introduce drm_plane_state structure

Pekka Paalanen ppaalanen at gmail.com
Thu Sep 28 14:07:54 UTC 2017


On Tue, 26 Sep 2017 18:15:35 +0100
Daniel Stone <daniels at collabora.com> wrote:

> Track dynamic plane state (CRTC, FB, position) in separate structures,
> rather than as part of the plane. This will make it easier to handle
> state management later, and much more closely tracks what the kernel
> does with atomic modesets.
> 
> The fb_last pointer previously used in drm_plane now becomes part of
> output->state_last, and is not directly visible from the plane itself.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  libweston/compositor-drm.c | 342 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 277 insertions(+), 65 deletions(-)

> +/**
> + * Duplicate an existing plane state into a new plane state, storing it within
> + * the given output state. If the output state already contains a plane state
> + * for the drm_plane referenced by 'src', that plane state is freed first.
> + */
> +static struct drm_plane_state *
> +drm_plane_state_duplicate(struct drm_output_state *state_output,
> +			  struct drm_plane_state *src)
> +{
> +	struct drm_plane_state *dst = malloc(sizeof(*dst));
> +	struct drm_plane_state *old, *tmp;
> +
> +	assert(src);
> +	assert(dst);
> +	*dst = *src;
> +	wl_list_init(&dst->link);
> +
> +	wl_list_for_each_safe(old, tmp, &state_output->plane_list, link) {
> +		if (old->plane == dst->plane)
> +			drm_plane_state_free(old, false);
> +	}

Hi,

should this not protect against src == old?

That is, duplicating a plane state that is already in the output state
as well?

Or, should there be assert(src != old);?

> +
> +	wl_list_insert(&state_output->plane_list, &dst->link);

Or move the below to above the loop?

> +	if (src->fb)
> +		dst->fb = drm_fb_ref(src->fb);
> +	dst->output_state = state_output;
> +	dst->complete = false;
> +
> +	return dst;
> +}

Otherwise I would be happy to give a R-b.


Thanks,
pq
-------------- 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/20170928/e754618c/attachment.sig>


More information about the wayland-devel mailing list