All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>, Rob Clark <robdclark@gmail.com>
Cc: "Jiang, Sonny" <Sonny.Jiang@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: add drm device name
Date: Mon, 09 Sep 2019 13:13:22 +0300	[thread overview]
Message-ID: <87h85l3hh9.fsf@intel.com> (raw)
In-Reply-To: <CAKMK7uHFNhdNY4Y9ZFMNuci7gssPWCT5f5y=e4npg8s5r_jBdQ@mail.gmail.com>

On Sat, 07 Sep 2019, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sat, Sep 7, 2019 at 3:18 AM Rob Clark <robdclark@gmail.com> wrote:
>>
>> On Fri, Sep 6, 2019 at 3:16 PM Marek Olšák <maraeo@gmail.com> wrote:
>> >
>> > + dri-devel
>> >
>> > On Tue, Sep 3, 2019 at 5:41 PM Jiang, Sonny <Sonny.Jiang@amd.com> wrote:
>> >>
>> >> Add DRM device name and use DRM_IOCTL_VERSION ioctl drmVersion::desc passing it to user space
>> >> instead of unused DRM driver name descriptor.
>> >>
>> >> Change-Id: I809f6d3e057111417efbe8fa7cab8f0113ba4b21
>> >> Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
>> >> ---
>> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 ++
>> >>  drivers/gpu/drm/drm_drv.c                  | 17 +++++++++++++++++
>> >>  drivers/gpu/drm/drm_ioctl.c                |  2 +-
>> >>  include/drm/drm_device.h                   |  3 +++
>> >>  include/drm/drm_drv.h                      |  1 +
>> >>  5 files changed, 24 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> index 67b09cb2a9e2..8f0971cea363 100644
>> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> >> @@ -2809,6 +2809,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>> >>         /* init the mode config */
>> >>         drm_mode_config_init(adev->ddev);
>> >>
>> >> +       drm_dev_set_name(adev->ddev, amdgpu_asic_name[adev->asic_type]);
>> >> +
>> >>         r = amdgpu_device_ip_init(adev);
>> >>         if (r) {
>> >>                 /* failed in exclusive mode due to timeout */
>> >> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
>> >> index 862621494a93..6c33879bb538 100644
>> >> --- a/drivers/gpu/drm/drm_drv.c
>> >> +++ b/drivers/gpu/drm/drm_drv.c
>> >> @@ -802,6 +802,7 @@ void drm_dev_fini(struct drm_device *dev)
>> >>         mutex_destroy(&dev->struct_mutex);
>> >>         drm_legacy_destroy_members(dev);
>> >>         kfree(dev->unique);
>> >> +       kfree(dev->name);
>> >>  }
>> >>  EXPORT_SYMBOL(drm_dev_fini);
>> >>
>> >> @@ -1078,6 +1079,22 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name)
>> >>  }
>> >>  EXPORT_SYMBOL(drm_dev_set_unique);
>> >>
>> >> +/**
>> >> + * drm_dev_set_name - Set the name of a DRM device
>> >> + * @dev: device of which to set the name
>> >> + * @name: name to be set
>> >> + *
>> >> + * Return: 0 on success or a negative error code on failure.
>> >> + */
>> >> +int drm_dev_set_name(struct drm_device *dev, const char *name)
>> >> +{
>> >> +       kfree(dev->name);
>> >> +       dev->name = kstrdup(name, GFP_KERNEL);
>> >> +
>> >> +       return dev->name ? 0 : -ENOMEM;
>> >> +}
>> >> +EXPORT_SYMBOL(drm_dev_set_name);
>> >> +
>> >>  /*
>> >>   * DRM Core
>> >>   * The DRM core module initializes all global DRM objects and makes them
>> >> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> >> index 2263e3ddd822..61f02965106b 100644
>> >> --- a/drivers/gpu/drm/drm_ioctl.c
>> >> +++ b/drivers/gpu/drm/drm_ioctl.c
>> >> @@ -506,7 +506,7 @@ int drm_version(struct drm_device *dev, void *data,
>> >>                                 dev->driver->date);
>> >>         if (!err)
>> >>                 err = drm_copy_field(version->desc, &version->desc_len,
>> >> -                               dev->driver->desc);
>> >> +                               dev->name);
>>
>> I suspect this needs to be something like dev->name ? dev->name :
>> dev->driver->desc
>>
>> Or somewhere something needs to arrange for dev->name to default to
>> dev->driver->desc
>>
>> And maybe this should be dev->desc instead of dev->name.. that at
>> least seems less confusing to me.
>>
>> other than that, I don't see a big problem
>
> (recap from irc)
>
> I thought we're using this as essentially an uapi identifier, so that
> you know which kind of ioctl set a driver supports. Not so big deal on
> pci, where we match against pci ids anyway, kinda bigger deal where
> that's not around. Listing codenames and or something else that
> changes all the time feels a bit silly for that. Imo if you just want
> to expose this to userspace, stuff it into an amdgpu info/query ioctl.
>
> So what do you need this for exactly, where's the userspace that needs
> this?

Indeed; using this e.g. for changing userspace behaviour would seem
wrong.

BR,
Jani.


> -Daniel
>
>>
>> BR,
>> -R
>>
>> >>
>> >>         return err;
>> >>  }
>> >> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
>> >> index 7f9ef709b2b6..e29912c484e4 100644
>> >> --- a/include/drm/drm_device.h
>> >> +++ b/include/drm/drm_device.h
>> >> @@ -123,6 +123,9 @@ struct drm_device {
>> >>         /** @unique: Unique name of the device */
>> >>         char *unique;
>> >>
>> >> +       /** @name: device name */
>> >> +       char *name;
>> >> +
>> >>         /**
>> >>          * @struct_mutex:
>> >>          *
>> >> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> >> index 68ca736c548d..f742e2bde467 100644
>> >> --- a/include/drm/drm_drv.h
>> >> +++ b/include/drm/drm_drv.h
>> >> @@ -798,6 +798,7 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
>> >>
>> >>
>> >>  int drm_dev_set_unique(struct drm_device *dev, const char *name);
>> >> +int drm_dev_set_name(struct drm_device *dev, const char *name);
>> >>
>> >>
>> >>  #endif
>> >> --
>> >> 2.17.1
>> >>
>> >> _______________________________________________
>> >> amd-gfx mailing list
>> >> amd-gfx@lists.freedesktop.org
>> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>> >
>> > _______________________________________________
>> > dri-devel mailing list
>> > dri-devel@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-09-09 10:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 21:41 [PATCH] drm: add drm device name Jiang, Sonny
     [not found] ` <20190903214040.2386-1-sonny.jiang-5C7GfCeVMHo@public.gmane.org>
2019-09-06 22:15   ` Marek Olšák
2019-09-07  1:18     ` Rob Clark
     [not found]       ` <CAF6AEGvvUUOGujJC9P3t72N93AJuxiiVt0OAk8zf226Q8WmHvg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-07 19:47         ` Daniel Vetter
2019-09-09 10:13           ` Jani Nikula [this message]
     [not found]           ` <CAKMK7uHFNhdNY4Y9ZFMNuci7gssPWCT5f5y=e4npg8s5r_jBdQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-17  0:06             ` Marek Olšák
     [not found]               ` <CAAxE2A6sESsKAi3K1etAZeCwAPgexn099G6g0aJQnavTkiH+mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-17  5:47                 ` Jani Nikula
     [not found]                   ` <87woe7eanv.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-17  8:12                     ` Christian König
2019-09-17  8:17                       ` Daniel Vetter
     [not found]                         ` <CAKMK7uEj4FZ3YQqG-cCTa4EEaJoAk09Zaz398F9Hmo+mdXCKiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-17  8:23                           ` Koenig, Christian
     [not found]                             ` <7540df63-e623-19b0-dde5-b89ff2b7fb89-5C7GfCeVMHo@public.gmane.org>
2019-09-17  9:23                               ` Michel Dänzer
2019-09-17  9:27                                 ` Michel Dänzer
     [not found]                                   ` <5d0a8619-7073-fac2-cdd6-83b55221140b-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-09-17 11:20                                     ` Christian König
2019-09-17 14:33                                       ` Michel Dänzer
     [not found]                                         ` <4d255e1c-1d4a-a754-afe0-b18776a11a7e-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-09-17 23:41                                           ` Marek Olšák
     [not found]                                             ` <CAAxE2A7RcsiEsWBtbsDE2Wp+Vx7n-vwM1qL6HX_qKt=KnHCd4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-18 14:03                                               ` Michel Dänzer
2019-09-18 20:10                                                 ` Marek Olšák
2019-09-18 21:13                                                   ` Marek Olšák
2019-09-17 11:32                                     ` Daniel Vetter
2019-09-18  6:57                                       ` Pekka Paalanen

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=87h85l3hh9.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Sonny.Jiang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robdclark@gmail.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.