[PATCH v2 weston 04/16] compositor-drm: Record current DPMS level

Bryce Harrington bryce at osg.samsung.com
Fri Jul 10 17:58:17 PDT 2015


On Mon, Jun 22, 2015 at 05:25:09PM +0100, Daniel Stone wrote:
> Track the current DPMS level for any given output, and track failure (or
> otherwise) of the DPMS-setting property call.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  src/compositor-drm.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 43dd483..f8ba427 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -168,6 +168,8 @@ struct drm_output {
>  	drmModePropertyPtr dpms_prop;
>  	uint32_t format;
>  
> +	enum dpms_enum dpms;
> +
>  	int vblank_pending;
>  	int page_flip_pending;
>  	int destroy_pending;
> @@ -1602,12 +1604,20 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
>  	struct drm_output *output = (struct drm_output *) output_base;
>  	struct weston_compositor *ec = output_base->compositor;
>  	struct drm_compositor *c = (struct drm_compositor *) ec;
> +	int ret;
>  
>  	if (!output->dpms_prop)
>  		return;
>  
> -	drmModeConnectorSetProperty(c->drm.fd, output->connector_id,
> -				    output->dpms_prop->prop_id, level);
> +	ret = drmModeConnectorSetProperty(c->drm.fd, output->connector_id,
> +				 	  output->dpms_prop->prop_id, level);
> +	if (ret) {

Just a nitpick, but we don't actually use ret for anything other than
this test.  Maybe save the variable and just do "if
(drmModeConnectorSetProperty(..." ?

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

> +		weston_log("DRM: DPMS: failed property set for %s\n",
> +			   output->base.name);
> +		return;
> +	}
> +
> +	output->dpms = level;
>  }
>  
>  static const char * const connector_type_names[] = {
> -- 
> 2.4.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list