[PATCHv4 09/13] drm: Add plane max width/height properties

Daniel Vetter daniel at ffwll.ch
Fri Mar 28 01:21:06 PDT 2014


On Thu, Mar 27, 2014 at 05:44:34PM -0700, Matt Roper wrote:
> Some hardware has different size limits for different planes (e.g.,
> sprites/overlays can't always be as large as the upper bound for the
> primary plane).  Adding read-only plane properties allows userspace
> to check these limits.  By default, mode_config.max_{width,height} are
> used for non-cursor planes and mode_config.cursor_{width,height} are
> used for cursors; drivers should override these defaults after calling
> plane_init, if necessary.
> 
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>

Hm, I think we should wait with exposing this to userspace. In some other
thread which I've dragged onto dri-devel we've discussed this and we might
actually need per pixel format limits. And a lot more limits than just max
width/height.

So for now I think we should just leave the current mess which presumes
that userspace knows, and tackle it later. Also this avoids that universal
planes get bogged down in some minute detail bikeshed discusssion which is
really just auxilliary to the main concept. And I don't want this to
happen.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c | 30 ++++++++++++++++++++++++++++++
>  include/drm/drm_crtc.h     |  2 ++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 0c70101..24226de 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1028,6 +1028,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  			     enum drm_plane_type type)
>  {
>  	int ret;
> +	uint32_t maxwidth, maxheight;
>  
>  	drm_modeset_lock_all(dev);
>  
> @@ -1061,6 +1062,28 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  				   dev->mode_config.plane_type_property,
>  				   plane->type);
>  
> +	/*
> +	 * Drivers may override default max width/height after calling
> +	 * plane_init.
> +	 */
> +	if (plane->type == DRM_PLANE_TYPE_CURSOR) {
> +		maxwidth = dev->mode_config.cursor_width;
> +		if (!maxwidth)
> +			maxwidth = 64;
> +		maxheight = dev->mode_config.cursor_height;
> +		if (!maxheight)
> +			maxheight = 64;
> +	} else {
> +		maxwidth = dev->mode_config.max_width;
> +		maxheight = dev->mode_config.max_height;
> +	}
> +	drm_object_attach_property(&plane->base,
> +				   dev->mode_config.plane_maxwidth_property,
> +				   maxwidth);
> +	drm_object_attach_property(&plane->base,
> +				   dev->mode_config.plane_maxheight_property,
> +				   maxheight);
> +
>   out:
>  	drm_modeset_unlock_all(dev);
>  
> @@ -1175,6 +1198,7 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
>  static int drm_mode_create_standard_plane_properties(struct drm_device *dev)
>  {
>  	struct drm_property *type;
> +	struct drm_property *maxwidth, *maxheight;
>  
>  	/*
>  	 * Standard properties (apply to all planes)
> @@ -1182,7 +1206,13 @@ static int drm_mode_create_standard_plane_properties(struct drm_device *dev)
>  	type = drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE,
>  					"type", drm_plane_type_enum_list,
>  					ARRAY_SIZE(drm_plane_type_enum_list));
> +	maxwidth = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE,
> +					     "max width", 1, INT_MAX);
> +	maxheight = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE,
> +					      "max height", 1, INT_MAX);
>  	dev->mode_config.plane_type_property = type;
> +	dev->mode_config.plane_maxwidth_property = maxwidth;
> +	dev->mode_config.plane_maxheight_property = maxheight;
>  
>  	return 0;
>  }
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 4c4f792..78cf825 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -772,6 +772,8 @@ struct drm_mode_config {
>  	struct drm_property *edid_property;
>  	struct drm_property *dpms_property;
>  	struct drm_property *plane_type_property;
> +	struct drm_property *plane_maxwidth_property;
> +	struct drm_property *plane_maxheight_property;
>  
>  	/* DVI-I properties */
>  	struct drm_property *dvi_i_subconnector_property;
> -- 
> 1.8.5.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list