[PATCH v15 20/34] compositor-drm: Support modifiers for drm_fb

Thierry Reding thierry.reding at gmail.com
Thu Mar 15 16:41:48 UTC 2018


On Mon, Feb 05, 2018 at 06:44:29PM +0000, Daniel Stone wrote:
> Use the new drmModeAddFB2WithModifiers interface to import buffers with
> modifiers.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> ---
>  configure.ac               |  3 +++
>  libweston/compositor-drm.c | 26 +++++++++++++++++++++++++-
>  2 files changed, 28 insertions(+), 1 deletion(-)

Just a drive-by comment, haven't looked at any of this in great detail.

[...]
> @@ -845,7 +846,28 @@ drm_fb_destroy_gbm(struct gbm_bo *bo, void *data)
>  static int
>  drm_fb_addfb(struct drm_fb *fb)
>  {
> -	int ret;
> +	int ret = -EINVAL;
> +#ifdef HAVE_DRM_ADDFB2_MODIFIERS
> +	uint64_t mods[4] = { };
> +	int i;

Why not make this size_t...

> +#endif
> +
> +	/* If we have a modifier set, we must only use the WithModifiers
> +	 * entrypoint; we cannot import it through legacy ioctls. */
> +	if (fb->modifier != DRM_FORMAT_MOD_INVALID) {
> +		/* KMS demands that if a modifier is set, it must be the same
> +		 * for all planes. */
> +#ifdef HAVE_DRM_ADDFB2_MODIFIERS
> +		for (i = 0; i < (int) ARRAY_LENGTH(mods) && fb->handles[i]; i++)

... so you can get rid of the cast here?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180315/4c4d09bd/attachment.sig>


More information about the wayland-devel mailing list