[PATCH weston v11 01/13] compositor-drm: Refactor sprite create/destroy into helpers

Pekka Paalanen ppaalanen at gmail.com
Wed Jul 19 12:55:05 UTC 2017


On Tue, 18 Jul 2017 14:14:23 +0100
Daniel Stone <daniels at collabora.com> wrote:

> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> This moves the single sprite creation code from create_sprites() into a
> new function. The readability clean-up is small, but my intention is to
> write an alternate version of create_sprites(), and sharing the single
> sprite creation code is useful.
> 
> [daniels: Genericised from drm_sprite to drm_plane, moving some of the
>           logic back into create_sprites(), also symmetrical
>           drm_plane_destroy.]
> 
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  libweston/compositor-drm.c | 188 ++++++++++++++++++++++++++++-----------------
>  1 file changed, 117 insertions(+), 71 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 10adb463..5967a18f 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -1817,6 +1817,123 @@ init_pixman(struct drm_backend *b)
>  }

Hi,

the documentation mistakes are now fixed, but the two things we talked
about mentioning in the commit message are still not mentioned.

> +static void
> +drm_plane_destroy(struct drm_plane *plane)
> +{
> +	drmModeSetPlane(plane->backend->drm.fd, plane->plane_id, 0, 0, 0,
> +			0, 0, 0, 0, 0, 0, 0, 0);
> +	assert(!plane->fb_last);
> +	assert(!plane->fb_pending);
> +	drm_fb_unref(plane->fb_current);
> +	weston_plane_release(&plane->base);
> +	wl_list_remove(&plane->link);
> +	free(plane);
> +}

This function does not use output->crtc_id like the old code did (it's
not necessary), and adds the wl_list_remove() (missing it was not a
problem because the dangling pointers got freed anyway).

A short note about those would be nice in the commit message, but
anyway:
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


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/20170719/3c8ae08c/attachment.sig>


More information about the wayland-devel mailing list