dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 5/6] drm: s/enum_blob_list/enum_list/ in drm_property
Date: Wed, 19 Nov 2014 15:25:00 -0500	[thread overview]
Message-ID: <CAF6AEGuWkeAOYiNJZx6qnETxQfNHJkG3i72b48xj=qzCLPvRoA@mail.gmail.com> (raw)
In-Reply-To: <1416418691-24747-5-git-send-email-daniel.vetter@ffwll.ch>

On Wed, Nov 19, 2014 at 12:38 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> I guess for hysterical raisins this was meant to be the way to read
> blob properties. But that's done with the two-stage approach which
> uses separate blob kms object and the special-purpose get_blob ioctl.
>
> Shipping userspace seems to have never relied on this, and the kernel
> also never put any blob thing onto that property. And nowadays it
> would blow up, e.g. in drm_property_destroy. Also it makes no sense to
> return values in an ioctl that only returns metadata about everything.
>
> So let's ditch all the internal code for the blob list, rename the
> list to be unambiguous and sprinkle comments all over the place to
> explain this peculiar piece of api.
>
> v2: Squash in fixup from Rob to remove now unused variables.
>
> Cc: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>  drivers/gpu/drm/drm_crtc.c  | 53 +++++++++++++++------------------------------
>  include/drm/drm_crtc.h      |  2 +-
>  include/uapi/drm/drm_mode.h |  2 ++
>  3 files changed, 20 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 8c550302a9ef..589a921d4313 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3457,7 +3457,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
>
>         property->flags = flags;
>         property->num_values = num_values;
> -       INIT_LIST_HEAD(&property->enum_blob_list);
> +       INIT_LIST_HEAD(&property->enum_list);
>
>         if (name) {
>                 strncpy(property->name, name, DRM_PROP_NAME_LEN);
> @@ -3679,8 +3679,8 @@ int drm_property_add_enum(struct drm_property *property, int index,
>                         (value > 63))
>                 return -EINVAL;
>
> -       if (!list_empty(&property->enum_blob_list)) {
> -               list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
> +       if (!list_empty(&property->enum_list)) {
> +               list_for_each_entry(prop_enum, &property->enum_list, head) {
>                         if (prop_enum->value == value) {
>                                 strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
>                                 prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
> @@ -3698,7 +3698,7 @@ int drm_property_add_enum(struct drm_property *property, int index,
>         prop_enum->value = value;
>
>         property->values[index] = value;
> -       list_add_tail(&prop_enum->head, &property->enum_blob_list);
> +       list_add_tail(&prop_enum->head, &property->enum_list);
>         return 0;
>  }
>  EXPORT_SYMBOL(drm_property_add_enum);
> @@ -3715,7 +3715,7 @@ void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
>  {
>         struct drm_property_enum *prop_enum, *pt;
>
> -       list_for_each_entry_safe(prop_enum, pt, &property->enum_blob_list, head) {
> +       list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
>                 list_del(&prop_enum->head);
>                 kfree(prop_enum);
>         }
> @@ -3839,16 +3839,12 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
>         struct drm_mode_get_property *out_resp = data;
>         struct drm_property *property;
>         int enum_count = 0;
> -       int blob_count = 0;
>         int value_count = 0;
>         int ret = 0, i;
>         int copied;
>         struct drm_property_enum *prop_enum;
>         struct drm_mode_property_enum __user *enum_ptr;
> -       struct drm_property_blob *prop_blob;
> -       uint32_t __user *blob_id_ptr;
>         uint64_t __user *values_ptr;
> -       uint32_t __user *blob_length_ptr;
>
>         if (!drm_core_check_feature(dev, DRIVER_MODESET))
>                 return -EINVAL;
> @@ -3862,11 +3858,8 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
>
>         if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
>                         drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
> -               list_for_each_entry(prop_enum, &property->enum_blob_list, head)
> +               list_for_each_entry(prop_enum, &property->enum_list, head)
>                         enum_count++;
> -       } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
> -               list_for_each_entry(prop_blob, &property->enum_blob_list, head)
> -                       blob_count++;
>         }
>
>         value_count = property->num_values;
> @@ -3891,7 +3884,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
>                 if ((out_resp->count_enum_blobs >= enum_count) && enum_count) {
>                         copied = 0;
>                         enum_ptr = (struct drm_mode_property_enum __user *)(unsigned long)out_resp->enum_blob_ptr;
> -                       list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
> +                       list_for_each_entry(prop_enum, &property->enum_list, head) {
>
>                                 if (copy_to_user(&enum_ptr[copied].value, &prop_enum->value, sizeof(uint64_t))) {
>                                         ret = -EFAULT;
> @@ -3909,28 +3902,16 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
>                 out_resp->count_enum_blobs = enum_count;
>         }
>
> -       if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
> -               if ((out_resp->count_enum_blobs >= blob_count) && blob_count) {
> -                       copied = 0;
> -                       blob_id_ptr = (uint32_t __user *)(unsigned long)out_resp->enum_blob_ptr;
> -                       blob_length_ptr = (uint32_t __user *)(unsigned long)out_resp->values_ptr;
> -
> -                       list_for_each_entry(prop_blob, &property->enum_blob_list, head) {
> -                               if (put_user(prop_blob->base.id, blob_id_ptr + copied)) {
> -                                       ret = -EFAULT;
> -                                       goto done;
> -                               }
> -
> -                               if (put_user(prop_blob->length, blob_length_ptr + copied)) {
> -                                       ret = -EFAULT;
> -                                       goto done;
> -                               }
> -
> -                               copied++;
> -                       }
> -               }
> -               out_resp->count_enum_blobs = blob_count;
> -       }
> +       /*
> +        * NOTE: The idea seems to have been to use this to read all the blob
> +        * property values. But nothing ever added them to the corresponding
> +        * list, userspace always used the special-purpose get_blob ioctl to
> +        * read the value for a blob property. It also doesn't make a lot of
> +        * sense to return values here when everything else is just metadata for
> +        * the property itself.
> +        */
> +       if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
> +               out_resp->count_enum_blobs = 0;
>  done:
>         drm_modeset_unlock_all(dev);
>         return ret;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index cdbae7bdac70..3773fe7bc737 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -216,7 +216,7 @@ struct drm_property {
>         uint64_t *values;
>         struct drm_device *dev;
>
> -       struct list_head enum_blob_list;
> +       struct list_head enum_list;
>  };
>
>  struct drm_crtc;
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index a0db2d4aa5f0..86574b0005ff 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -286,6 +286,8 @@ struct drm_mode_get_property {
>         char name[DRM_PROP_NAME_LEN];
>
>         __u32 count_values;
> +       /* This is only used to count enum values, not blobs. The _blobs is
> +        * simply because of a historical reason, i.e. backwards compat. */
>         __u32 count_enum_blobs;
>  };
>
> --
> 2.1.1
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-11-19 20:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 17:38 [PATCH 1/6] drm/atomic: Ensure that drm_connector_index is stable Daniel Vetter
2014-11-19 17:38 ` [PATCH 2/6] drm/atomic: Only destroy connector states with connection mutex held Daniel Vetter
2014-11-19 20:22   ` [Intel-gfx] " Rob Clark
2014-11-19 17:38 ` [PATCH 3/6] drm/atomic: Don't overrun the connector array when hotplugging Daniel Vetter
2014-11-19 20:24   ` Rob Clark
2014-11-20  8:53   ` Thierry Reding
2014-11-19 17:38 ` [PATCH 4/6] drm/crtc: Polish kerneldoc Daniel Vetter
2014-11-19 20:28   ` Rob Clark
2014-11-19 17:38 ` [PATCH 5/6] drm: s/enum_blob_list/enum_list/ in drm_property Daniel Vetter
2014-11-19 20:25   ` Rob Clark [this message]
2014-11-19 17:38 ` [PATCH 6/6] drm/atomic_helper: Make it clear that commit_planes gets the old state Daniel Vetter
2014-11-19 20:29   ` Rob Clark
2014-11-19 20:55     ` Daniel Vetter
2014-11-19 20:21 ` [Intel-gfx] [PATCH 1/6] drm/atomic: Ensure that drm_connector_index is stable 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='CAF6AEGuWkeAOYiNJZx6qnETxQfNHJkG3i72b48xj=qzCLPvRoA@mail.gmail.com' \
    --to=robdclark@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).