All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFCv3 09/14] drm: Allow userspace to ask for full plane list (universal planes)
Date: Wed, 19 Mar 2014 15:27:21 +0100	[thread overview]
Message-ID: <20140319142721.GD30571@phenom.ffwll.local> (raw)
In-Reply-To: <1395188579-17191-10-git-send-email-matthew.d.roper@intel.com>

On Tue, Mar 18, 2014 at 05:22:54PM -0700, Matt Roper wrote:
> Userspace clients which wish to receive all DRM planes (primary and
> cursor planes in addition to the traditional overlay planes) may set the
> DRM_CLIENT_CAP_UNIVERSAL_PLANES capability.
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

I don't see any issues with merging the primary plane stuff early, but I
think we should hold off a bit with exposing all this to userspace, at
least by default. I think we should have the cursor plane issues all
resolved and at least the userspace tests in decent shape before we throw
the big switch here.
-Daniel


> ---
>  drivers/gpu/drm/drm_crtc.c  | 20 +++++++++++++++-----
>  drivers/gpu/drm/drm_ioctl.c |  5 +++++
>  include/drm/drmP.h          |  5 +++++
>  include/uapi/drm/drm.h      |  8 ++++++++
>  4 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 0c395e8..fb8e493 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2160,6 +2160,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
>  	struct drm_plane *plane;
>  	uint32_t __user *plane_ptr;
>  	int copied = 0, ret = 0;
> +	unsigned num_planes;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
>  		return -EINVAL;
> @@ -2167,17 +2168,26 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
>  	drm_modeset_lock_all(dev);
>  	config = &dev->mode_config;
>  
> +	if (file_priv->universal_planes)
> +		num_planes = config->num_total_plane;
> +	else
> +		num_planes = config->num_overlay_plane;
> +
>  	/*
>  	 * This ioctl is called twice, once to determine how much space is
>  	 * needed, and the 2nd time to fill it.
>  	 */
> -	if (config->num_overlay_plane &&
> -	    (plane_resp->count_planes >= config->num_overlay_plane)) {
> +	if (num_planes &&
> +	    (plane_resp->count_planes >= num_planes)) {
>  		plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr;
>  
>  		list_for_each_entry(plane, &config->plane_list, head) {
> -			/* Only advertise overlays to userspace for now. */
> -			if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> +			/*
> +			 * Unless userspace set the 'universal planes'
> +			 * capability bit, only advertise overlays.
> +			 */
> +			if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
> +			    !file_priv->universal_planes)
>  				continue;
>  
>  			if (put_user(plane->base.id, plane_ptr + copied)) {
> @@ -2187,7 +2197,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
>  			copied++;
>  		}
>  	}
> -	plane_resp->count_planes = config->num_overlay_plane;
> +	plane_resp->count_planes = num_planes;
>  
>  out:
>  	drm_modeset_unlock_all(dev);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index f4dc9b7..5eb92b6 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -328,6 +328,11 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  			return -EINVAL;
>  		file_priv->stereo_allowed = req->value;
>  		break;
> +	case DRM_CLIENT_CAP_UNIVERSAL_PLANES:
> +		if (req->value > 1)
> +			return -EINVAL;
> +		file_priv->universal_planes = req->value;
> +		break;
>  	default:
>  		return -EINVAL;
>  	}
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 3857450..1106297 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -438,6 +438,11 @@ struct drm_file {
>  	unsigned is_master :1; /* this file private is a master for a minor */
>  	/* true when the client has asked us to expose stereo 3D mode flags */
>  	unsigned stereo_allowed :1;
> +	/*
> +	 * true if client understands CRTC primary planes and cursor planes
> +	 * in the plane list
> +	 */
> +	unsigned universal_planes:1;
>  
>  	struct pid *pid;
>  	kuid_t uid;
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index b06c8ed..6e4952b 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -637,6 +637,14 @@ struct drm_get_cap {
>   */
>  #define DRM_CLIENT_CAP_STEREO_3D	1
>  
> +/**
> + * DRM_CLIENT_CAP_UNIVERSAL_PLANES
> + *
> + * If set to 1, the DRM core will expose all planes (overlay, primary, and
> + * cursor) to userspace.
> + */
> +#define DRM_CLIENT_CAP_UNIVERSAL_PLANES  2
> +
>  /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
>  struct drm_set_client_cap {
>  	__u64 capability;
> -- 
> 1.8.5.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@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

  reply	other threads:[~2014-03-19 14:27 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19  0:22 [RFCv3 00/14] Unified plane support Matt Roper
2014-03-19  0:22 ` [RFCv3 01/14] SQUASH! drm/i915: Do not dereference pointers from ring buffer in evict event Matt Roper
2014-03-19  0:22 ` [RFCv3 02/14] drm: Add support for multiple plane types Matt Roper
2014-03-19  0:22 ` [RFCv3 03/14] drm: Add primary plane helpers Matt Roper
2014-03-19 11:28   ` Daniel Vetter
2014-03-19 12:56     ` Rob Clark
2014-03-19 18:15     ` Matt Roper
2014-03-19 19:29       ` Daniel Vetter
2014-03-19 11:50   ` Daniel Vetter
2014-03-19 12:24   ` Daniel Vetter
2014-03-19 23:01     ` Matt Roper
2014-03-20 12:39       ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 04/14] drm/exynos: Restrict plane loops to only operate on overlay planes Matt Roper
2014-03-19 11:51   ` Daniel Vetter
2014-03-19 14:26     ` Daniel Kurtz
2014-03-19 19:31       ` Daniel Vetter
2014-03-20  1:56         ` Daniel Kurtz
2014-03-20 15:35           ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 05/14] drm/i915: " Matt Roper
2014-03-19  0:22 ` [RFCv3 06/14] drm: Add plane type property Matt Roper
2014-03-19 11:31   ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 07/14] drm: Specify primary plane at CRTC initialization (v2) Matt Roper
2014-03-19 11:41   ` Daniel Vetter
2014-03-20  5:43   ` Inki Dae
2014-03-20 15:38     ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 08/14] drm: Replace crtc fb with primary plane fb (v2) Matt Roper
2014-03-19 11:57   ` Daniel Vetter
2014-03-25  1:20     ` Matt Roper
2014-03-25 10:32       ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 09/14] drm: Allow userspace to ask for full plane list (universal planes) Matt Roper
2014-03-19 14:27   ` Daniel Vetter [this message]
2014-03-19  0:22 ` [RFCv3 10/14] drm/i915: Rename similar plane functions to avoid confusion Matt Roper
2014-03-19 12:05   ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 11/14] drm/i915: Intel-specific primary plane handling Matt Roper
2014-03-19 12:11   ` [Intel-gfx] " Daniel Vetter
2014-03-19 14:37     ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 12/14] drm: Specify cursor plane at CRTC initialization Matt Roper
2014-03-28 21:04   ` Daniel Vetter
2014-04-07 10:05     ` Thierry Reding
2014-04-07 17:23       ` Rob Clark
2014-04-07 20:03         ` Daniel Vetter
2014-04-07 20:05           ` Rob Clark
2014-03-19  0:22 ` [RFCv3 13/14] drm/i915: Split cursor update code from cursor ioctl handling Matt Roper
2014-03-19  8:03   ` Chris Wilson
2014-03-19  0:22 ` [RFCv3 14/14] drm/i915: Add cursor handlers and create cursor at crtc init Matt Roper
2014-03-19  0:37 ` [RFCv3 00/14] Unified plane support Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140319142721.GD30571@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.