All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: Keith Packard <keithp@keithp.com>
Cc: linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm/plane: drop num_overlay_planes (v2)
Date: Mon, 16 Oct 2017 15:23:52 -0400	[thread overview]
Message-ID: <20171016192352.4qqernqwzg4fnxry@art_vandelay> (raw)
In-Reply-To: <20171013015631.6926-2-keithp@keithp.com>

On Thu, Oct 12, 2017 at 06:56:27PM -0700, Keith Packard wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> In order to implement plane leasing we need to count things,
> just make the code consistent with the counting code currently
> used for counting crtcs/encoders/connectors and drop the need
> for num_overlay_planes.
> 
> v2: don't forget to assign plane_ptr. (keithp)
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/drm_mode_config.c |  1 -
>  drivers/gpu/drm/drm_plane.c       | 46 ++++++++++++++-------------------------
>  include/drm/drm_mode_config.h     | 13 -----------
>  3 files changed, 16 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 74f6ff5df656..919e78d45ab0 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -385,7 +385,6 @@ void drm_mode_config_init(struct drm_device *dev)
>  	dev->mode_config.num_connector = 0;
>  	dev->mode_config.num_crtc = 0;
>  	dev->mode_config.num_encoder = 0;
> -	dev->mode_config.num_overlay_plane = 0;
>  	dev->mode_config.num_total_plane = 0;
>  }
>  EXPORT_SYMBOL(drm_mode_config_init);
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 574fd1475214..c10869bad729 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -241,8 +241,6 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  
>  	list_add_tail(&plane->head, &config->plane_list);
>  	plane->index = config->num_total_plane++;
> -	if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> -		config->num_overlay_plane++;
>  
>  	drm_object_attach_property(&plane->base,
>  				   config->plane_type_property,
> @@ -353,8 +351,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
>  
>  	list_del(&plane->head);
>  	dev->mode_config.num_total_plane--;
> -	if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> -		dev->mode_config.num_overlay_plane--;
>  
>  	WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
>  	if (plane->state && plane->funcs->atomic_destroy_state)
> @@ -462,43 +458,33 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
>  	struct drm_mode_config *config;
>  	struct drm_plane *plane;
>  	uint32_t __user *plane_ptr;
> -	int copied = 0;
> -	unsigned num_planes;
> +	int count = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
>  		return -EINVAL;
>  
>  	config = &dev->mode_config;
> -
> -	if (file_priv->universal_planes)
> -		num_planes = config->num_total_plane;
> -	else
> -		num_planes = config->num_overlay_plane;
> +	plane_ptr = u64_to_user_ptr(plane_resp->plane_id_ptr);
>  
>  	/*
>  	 * This ioctl is called twice, once to determine how much space is
>  	 * needed, and the 2nd time to fill it.
>  	 */
> -	if (num_planes &&
> -	    (plane_resp->count_planes >= num_planes)) {
> -		plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr;
> -
> -		/* Plane lists are invariant, no locking needed. */
> -		drm_for_each_plane(plane, dev) {
> -			/*
> -			 * 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))
> -				return -EFAULT;
> -			copied++;
> -		}
> +	drm_for_each_plane(plane, dev) {
> +		/*
> +		 * Unless userspace set the 'universal planes'
> +		 * capability bit, only advertise overlays.
> +		 */
> +		if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
> +		    !file_priv->universal_planes)
> +			continue;
> +
> +		if (count < config->num_total_plane &&
> +		    put_user(plane->base.id, plane_ptr + count))
> +			return -EFAULT;
> +		count++;
>  	}
> -	plane_resp->count_planes = num_planes;
> +	plane_resp->count_planes = count;
>  
>  	return 0;
>  }
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 1b37368416c8..0b4ac2ebc610 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -429,19 +429,6 @@ struct drm_mode_config {
>  	 */
>  	struct list_head encoder_list;
>  
> -	/**
> -	 * @num_overlay_plane:
> -	 *
> -	 * Number of overlay planes on this device, excluding primary and cursor
> -	 * planes.
> -	 *
> -	 * Track number of overlay planes separately from number of total
> -	 * planes.  By default we only advertise overlay planes to userspace; if
> -	 * userspace sets the "universal plane" capability bit, we'll go ahead
> -	 * and expose all planes. This is invariant over the lifetime of a
> -	 * device and hence doesn't need any locks.
> -	 */
> -	int num_overlay_plane;
>  	/**
>  	 * @num_total_plane:
>  	 *
> -- 
> 2.15.0.rc0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

  reply	other threads:[~2017-10-16 19:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  1:56 [PATCH 0/5]: drm: Add drm mode object leases Keith Packard
2017-10-13  1:56 ` Keith Packard
2017-10-13  1:56 ` [PATCH 1/5] drm/plane: drop num_overlay_planes (v2) Keith Packard
2017-10-16 19:23   ` Sean Paul [this message]
2017-10-13  1:56 ` [PATCH 2/5] drm: Add new LEASE debug level Keith Packard
2017-10-13  1:56   ` Keith Packard
2017-10-16 19:24   ` Sean Paul
2017-10-13  1:56 ` [PATCH 3/5] drm: Add drm_object lease infrastructure [v4] Keith Packard
2017-10-13  1:56   ` Keith Packard
2017-10-16 19:44   ` Sean Paul
2017-10-16 20:42     ` Keith Packard
2017-10-16 21:05       ` Sean Paul
2017-10-16 21:05         ` Sean Paul
2017-10-13  1:56 ` [PATCH 4/5] drm: Check mode object lease status in all master ioctl paths [v3] Keith Packard
2017-10-13  1:56   ` Keith Packard
2017-10-16 20:34   ` Sean Paul
2017-10-13  1:56 ` [PATCH 5/5] drm: Add four ioctls for managing drm mode object leases [v6] Keith Packard
2017-10-13  1:56   ` Keith Packard
2017-10-16 21:03   ` Sean Paul
2017-10-16 21:03     ` Sean Paul
2017-10-16 21:31     ` Keith Packard
2017-10-16 21:31       ` Keith Packard
2017-10-16  9:13 ` [PATCH 0/5]: drm: Add drm mode object leases Daniel Vetter
2017-10-16  9:13   ` Daniel Vetter
2017-10-16 17:52   ` Keith Packard
2017-10-16 17:52     ` Keith Packard

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=20171016192352.4qqernqwzg4fnxry@art_vandelay \
    --to=seanpaul@chromium.org \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keithp@keithp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.