public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	DRI Development <dri-devel@lists.freedesktop.org>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 4/9] drm: Remove drm_mode_object->atomic_count
Date: Thu, 25 Aug 2016 17:55:01 +0530	[thread overview]
Message-ID: <57BEE39D.8000403@codeaurora.org> (raw)
In-Reply-To: <1471467366-26444-4-git-send-email-daniel.vetter@ffwll.ch>



On 08/18/2016 02:26 AM, Daniel Vetter wrote:
> It's only used in drm_mode_object_get_properties, and we can compute
> it there directly with a bit of code shuffling.
>

Reviewed-by: Archit Taneja <architt@codeaurora.org>

> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>   drivers/gpu/drm/drm_mode_object.c | 31 ++++++++++++-------------------
>   include/drm/drm_mode_object.h     |  2 +-
>   2 files changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index cef9104e8285..a92aeed51156 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -209,8 +209,6 @@ void drm_object_attach_property(struct drm_mode_object *obj,
>   	obj->properties->properties[count] = property;
>   	obj->properties->values[count] = init_val;
>   	obj->properties->count++;
> -	if (property->flags & DRM_MODE_PROP_ATOMIC)
> -		obj->properties->atomic_count++;
>   }
>   EXPORT_SYMBOL(drm_object_attach_property);
>
> @@ -288,35 +286,30 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
>   				   uint64_t __user *prop_values,
>   				   uint32_t *arg_count_props)
>   {
> -	int props_count;
> -	int i, ret, copied;
> +	int i, ret, count;
>
> -	props_count = obj->properties->count;
> -	if (!atomic)
> -		props_count -= obj->properties->atomic_count;
> +	for (i = 0, count = 0; i < obj->properties->count; i++) {
> +		struct drm_property *prop = obj->properties->properties[i];
> +		uint64_t val;
>
> -	if ((*arg_count_props >= props_count) && props_count) {
> -		for (i = 0, copied = 0; copied < props_count; i++) {
> -			struct drm_property *prop = obj->properties->properties[i];
> -			uint64_t val;
> -
> -			if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic)
> -				continue;
> +		if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic)
> +			continue;
>
> +		if (*arg_count_props > count) {
>   			ret = drm_object_property_get_value(obj, prop, &val);
>   			if (ret)
>   				return ret;
>
> -			if (put_user(prop->base.id, prop_ptr + copied))
> +			if (put_user(prop->base.id, prop_ptr + count))
>   				return -EFAULT;
>
> -			if (put_user(val, prop_values + copied))
> +			if (put_user(val, prop_values + count))
>   				return -EFAULT;
> -
> -			copied++;
>   		}
> +
> +		count++;
>   	}
> -	*arg_count_props = props_count;
> +	*arg_count_props = count;
>
>   	return 0;
>   }
> diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h
> index c0e4414299f7..b8adb6425f2a 100644
> --- a/include/drm/drm_mode_object.h
> +++ b/include/drm/drm_mode_object.h
> @@ -37,7 +37,7 @@ struct drm_mode_object {
>
>   #define DRM_OBJECT_MAX_PROPERTY 24
>   struct drm_object_properties {
> -	int count, atomic_count;
> +	int count;
>   	/* NOTE: if we ever start dynamically destroying properties (ie.
>   	 * not at drm_mode_config_cleanup() time), then we'd have to do
>   	 * a better job of detaching property from mode objects to avoid
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-08-25 12:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 20:55 [PATCH 1/9] drm: Extract drm_encoder.[hc] Daniel Vetter
2016-08-17 20:55 ` [PATCH 2/9] drm/doc: Polish kerneldoc for encoders Daniel Vetter
2016-08-25 12:24   ` Archit Taneja
2016-08-17 20:56 ` [PATCH 3/9] drm: Extract drm_mode_object.[hc] Daniel Vetter
2016-08-25 12:25   ` Archit Taneja
2016-08-25 19:40     ` Daniel Vetter
2016-08-26  3:16       ` Archit Taneja
2016-08-17 20:56 ` [PATCH 4/9] drm: Remove drm_mode_object->atomic_count Daniel Vetter
2016-08-25 12:25   ` Archit Taneja [this message]
2016-08-17 20:56 ` [PATCH 5/9] drm/doc: Polish docs for drm_mode_object Daniel Vetter
2016-08-25 12:25   ` Archit Taneja
2016-08-17 20:56 ` [PATCH 6/9] drm: move drm_mode_legacy_fb_format to drm_fourcc.c Daniel Vetter
2016-08-25 12:25   ` Archit Taneja
2016-08-17 20:56 ` [PATCH 7/9] drm: Extract drm_property.[hc] Daniel Vetter
2016-08-18 11:11   ` Emil Velikov
2016-08-18 13:11     ` Daniel Vetter
2016-08-25 12:25   ` Archit Taneja
2016-08-17 20:56 ` [PATCH 8/9] drm: Unify handling of blob and object properties Daniel Vetter
2016-08-25 12:26   ` Archit Taneja
2016-08-17 20:56 ` [PATCH 9/9] drm/doc: Polish docs for drm_property&drm_property_blob Daniel Vetter
2016-08-18  7:39 ` ✗ Ro.CI.BAT: failure for series starting with [1/9] drm: Extract drm_encoder.[hc] Patchwork
2016-08-25 12:23 ` [PATCH 1/9] " Archit Taneja
2016-08-25 19:38   ` Daniel Vetter

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=57BEE39D.8000403@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox