[PATCH] compositor-drm: Define DPMS property as an enum

Pekka Paalanen ppaalanen at gmail.com
Mon Jul 9 12:38:51 UTC 2018


On Fri,  6 Jul 2018 11:36:49 +0100
Daniel Stone <daniels at collabora.com> wrote:

> The DPMS connector property is an enum property in KMS, which made our
> property handling complain at startup as we weren't defining its enums.
> Fix our definition so we parse the enum values.
> 
> The only user of the property is the legacy path, which can continue
> using fixed values as those values are part of the KMS ABI. The atomic
> path does not need any changes, since atomic uses routing and CRTC
> active to determine the connector's power state, rather than a property.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/125
> ---
>  libweston/compositor-drm.c | 41 +++++++++++++++++++++++++++++---------
>  1 file changed, 32 insertions(+), 9 deletions(-)

Nice! Pushed:
   79e95cb9..7625577a  master -> master


Thanks,
pq


> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 7dcc634c6..0de6d6ba0 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -186,9 +186,36 @@ enum wdrm_connector_property {
>  	WDRM_CONNECTOR__COUNT
>  };
>  
> +enum wdrm_dpms_state {
> +	WDRM_DPMS_STATE_OFF = 0,
> +	WDRM_DPMS_STATE_ON,
> +	WDRM_DPMS_STATE_STANDBY, /* unused */
> +	WDRM_DPMS_STATE_SUSPEND, /* unused */
> +	WDRM_DPMS_STATE__COUNT
> +};
> +
> +static struct drm_property_enum_info dpms_state_enums[] = {
> +	[WDRM_DPMS_STATE_OFF] = {
> +		.name = "Off",
> +	},
> +	[WDRM_DPMS_STATE_ON] = {
> +		.name = "On",
> +	},
> +	[WDRM_DPMS_STATE_STANDBY] = {
> +		.name = "Standby",
> +	},
> +	[WDRM_DPMS_STATE_SUSPEND] = {
> +		.name = "Suspend",
> +	},
> +};
> +
>  static const struct drm_property_info connector_props[] = {
>  	[WDRM_CONNECTOR_EDID] = { .name = "EDID" },
> -	[WDRM_CONNECTOR_DPMS] = { .name = "DPMS" },
> +	[WDRM_CONNECTOR_DPMS] = {
> +		.name = "DPMS",
> +		.enum_values = dpms_state_enums,
> +		.num_enum_values = WDRM_DPMS_STATE__COUNT,
> +	},
>  	[WDRM_CONNECTOR_CRTC_ID] = { .name = "CRTC_ID", },
>  };
>  
> @@ -2372,6 +2399,8 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
>  				     current_mode->blob_id);
>  		ret |= crtc_add_prop(req, output, WDRM_CRTC_ACTIVE, 1);
>  
> +		/* No need for the DPMS property, since it is implicit in
> +		 * routing and CRTC activity. */
>  		wl_list_for_each(head, &output->base.head_list, base.output_link) {
>  			ret |= connector_add_prop(req, head, WDRM_CONNECTOR_CRTC_ID,
>  						  output->crtc_id);
> @@ -2380,6 +2409,8 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
>  		ret |= crtc_add_prop(req, output, WDRM_CRTC_MODE_ID, 0);
>  		ret |= crtc_add_prop(req, output, WDRM_CRTC_ACTIVE, 0);
>  
> +		/* No need for the DPMS property, since it is implicit in
> +		 * routing and CRTC activity. */
>  		wl_list_for_each(head, &output->base.head_list, base.output_link)
>  			ret |= connector_add_prop(req, head, WDRM_CONNECTOR_CRTC_ID, 0);
>  	}
> @@ -2463,14 +2494,6 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
>  						       info->prop_id, 0);
>  			if (err <= 0)
>  				ret = -1;
> -
> -			info = &head->props_conn[WDRM_CONNECTOR_DPMS];
> -			if (info->prop_id > 0)
> -				err = drmModeAtomicAddProperty(req, head->connector_id,
> -							       info->prop_id,
> -							       DRM_MODE_DPMS_OFF);
> -			if (err <= 0)
> -				ret = -1;
>  		}
>  
>  		wl_array_for_each(unused, &b->unused_crtcs) {

-------------- 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/20180709/f40cd7d2/attachment.sig>


More information about the wayland-devel mailing list