[PATCH weston v10 20/61] compositor-drm: Add universal plane awareness

Pekka Paalanen ppaalanen at gmail.com
Wed Apr 12 13:26:01 UTC 2017


On Tue,  4 Apr 2017 17:54:38 +0100
Daniel Stone <daniels at collabora.com> wrote:

> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> Add awareness of, rather than support for, universal planes. Activate
> the client cap when we start if possible, and if this is activated,
> studiously ignore non-overlay planes. For now.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1495
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Co-authored-with: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> Co-authored-with: Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne at collabora.co.uk>
> ---
>  libweston/compositor-drm.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 88 insertions(+)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index a32339e4..04491da6 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -63,10 +63,21 @@
>  #include "linux-dmabuf.h"
>  #include "linux-dmabuf-unstable-v1-server-protocol.h"
>  
> +#ifndef static_assert
> +#define static_assert(cond) \
> +   do { \
> +      (void) sizeof(char [1 - 2*!(COND)]); \
> +   } while (0)
> +#endif
> +

static_assert() is never actually used anywhere, is it?
Even in the whole series.

>  #ifndef DRM_CAP_TIMESTAMP_MONOTONIC
>  #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
>  #endif
>  
> +#ifndef DRM_CLIENT_CAP_UNIVERSAL_PLANES
> +#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2
> +#endif
> +
>  #ifndef DRM_CAP_CURSOR_WIDTH
>  #define DRM_CAP_CURSOR_WIDTH 0x8
>  #endif
> @@ -80,6 +91,24 @@
>  #endif
>  
>  /**
> + * List of properties attached to DRM planes
> + */
> +enum wdrm_plane_property {
> +	WDRM_PLANE_TYPE = 0,
> +	WDRM_PLANE__COUNT
> +};
> +
> +/**
> + * Possible values for the WDRM_PLANE_TYPE property.
> + */
> +enum wdrm_plane_type {
> +	WDRM_PLANE_TYPE_PRIMARY = 0,
> +	WDRM_PLANE_TYPE_CURSOR,
> +	WDRM_PLANE_TYPE_OVERLAY,
> +	WDRM_PLANE_TYPE__COUNT
> +};
> +
> +/**
>   * List of properties attached to a DRM connector
>   */
>  enum wdrm_connector_property {
> @@ -150,10 +179,14 @@ struct drm_backend {
>  
>  	int cursors_are_broken;
>  
> +	bool universal_planes;
> +
>  	int use_pixman;
>  
>  	struct udev_input input;
>  
> +	struct drm_property_info props_plane[WDRM_PLANE__COUNT];

As mentioned earlier, needs to be stored per plane (for e.g. adding a
rotation property).

> +
>  	/* Holds the properties for connectors */
>  	struct drm_property_info props_conn[WDRM_CONNECTOR__COUNT];
>  

> @@ -2178,6 +2233,31 @@ create_sprites(struct drm_backend *b)
>  	struct drm_plane *drm_plane;
>  	uint32_t i;
>  
> +	static struct drm_property_enum_info plane_type_enums[] = {

Too bad this cannot be const, or would need a bad cast below.

> +		[WDRM_PLANE_TYPE_PRIMARY] = {
> +			.name = "Primary",
> +		},
> +		[WDRM_PLANE_TYPE_OVERLAY] = {
> +			.name = "Overlay",
> +		},
> +		[WDRM_PLANE_TYPE_CURSOR] = {
> +			.name = "Cursor",
> +		},
> +	};
> +	static const struct drm_property_info plane_props[] = {
> +		[WDRM_PLANE_TYPE] = {
> +			.name = "type",
> +			.enum_values = plane_type_enums,
> +			.num_enum_values = WDRM_PLANE_TYPE__COUNT,
> +		},
> +	};
> +
> +	if (!drm_property_info_copy(b->props_plane, plane_props,
> +				    WDRM_PLANE__COUNT)) {
> +		weston_log("failed to copy plane property info\n");
> +		return;
> +	}

Otherwise looks good. Moving the property cache to be stored per plane
will change things a bit.


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/20170412/08d36b6b/attachment.sig>


More information about the wayland-devel mailing list