Skip to contentSkip to conversation

drm: add drm device name

PATCH In review Jiang, Sonny 13 participants 20 messages Sep 3, 2019 – Sep 18, 2019 10 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: add drm device name

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
---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -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 */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -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
drivers/gpu/drm/drm_ioctl.c +1 -1
index 2263e3ddd822..61f02965106b 100644
@@ -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);
 
 	return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
 	/** @unique: Unique name of the device */
 	char *unique;
 
+	/** @name: device name */
+	char *name;
+
 	/**
 	 * @struct_mutex:
 	 *
include/drm/drm_drv.h +1 -0
index 68ca736c548d..f742e2bde467 100644
@@ -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
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

+ dri-devel

Quoted 107 lines · Sonny

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
---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -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 */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -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

drivers/gpu/drm/drm_ioctl.c +1 -1
index 2263e3ddd822..61f02965106b 100644
@@ -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);
 
        return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
        /** @unique: Unique name of the device */
        char *unique;
 
+       /** @name: device name */
+       char *name;
+
        /**
         * @struct_mutex:
         *
include/drm/drm_drv.h +1 -0
index 68ca736c548d..f742e2bde467 100644
@@ -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

Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 68 lines · Marek Olšák

+ dri-devel

Quoted 64 lines · Sonny

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
---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -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 */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -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
drivers/gpu/drm/drm_ioctl.c +0 -0
index 2263e3ddd822..61f02965106b 100644
Quoted 8 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void *data, · line 509

Quoted 8 lines
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -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

BR,
-R

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
        return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
        /** @unique: Unique name of the device */
        char *unique;
 
+       /** @name: device name */
+       char *name;
+
        /**
         * @struct_mutex:
         *
include/drm/drm_drv.h +1 -1
index 68ca736c548d..f742e2bde467 100644
@@ -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

Quoted 9 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAF6AEGvvUUOGujJC9P3t72N93AJuxiiVt0OAk8zf226Q8WmHvg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 82 lines · Rob Clark
Quoted 68 lines · Marek Olšák

+ dri-devel

Quoted 64 lines · Sonny

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
---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -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 */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -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
drivers/gpu/drm/drm_ioctl.c +0 -0
index 2263e3ddd822..61f02965106b 100644
Quoted 8 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void *data, · line 509

Quoted 8 lines
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -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

Quoted 7 lines

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? -Daniel

Quoted 49 lines

BR,
-R

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
        return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
        /** @unique: Unique name of the device */
        char *unique;
 
+       /** @name: device name */
+       char *name;
+
        /**
         * @struct_mutex:
         *
include/drm/drm_drv.h +1 -1
index 68ca736c548d..f742e2bde467 100644
@@ -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

Quoted 9 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw
Quoted 100 lines · Daniel Vetter
Quoted 82 lines · Rob Clark
Quoted 68 lines · Marek Olšák

+ dri-devel

Quoted 64 lines · Sonny

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
---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 67b09cb2a9e2..8f0971cea363 100644
@@ -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 */
drivers/gpu/drm/drm_drv.c +17 -0
index 862621494a93..6c33879bb538 100644
@@ -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
drivers/gpu/drm/drm_ioctl.c +0 -0
index 2263e3ddd822..61f02965106b 100644
Quoted 8 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void *data, · line 509

Quoted 8 lines
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -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

Quoted 7 lines

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.

Quoted 2 lines

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.

Quoted 51 lines

-Daniel

Quoted 49 lines

BR,
-R

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
        return err;
 }
include/drm/drm_device.h +3 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
        /** @unique: Unique name of the device */
        char *unique;
 
+       /** @name: device name */
+       char *name;
+
        /**
         * @struct_mutex:
         *
include/drm/drm_drv.h +1 -1
index 68ca736c548d..f742e2bde467 100644
@@ -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

Quoted 9 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAKMK7uHFNhdNY4Y9ZFMNuci7gssPWCT5f5y=e4npg8s5r_jBdQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Marek

Quoted 166 lines · Daniel Vetter
Quoted 6 lines · Rob Clark
Quoted 4 lines · Marek Olšák

+ dri-devel

On Tue, Sep 3, 2019 at 5:41 PM Jiang, Sonny <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

Add DRM device name and use DRM_IOCTL_VERSION ioctl drmVersion::desc

passing it to user space

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

instead of unused DRM driver name descriptor.

Change-Id I809f6d3e057111417efbe8fa7cab8f0113ba4b21
---
 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(-)
Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device

Quoted 4 lines

index 67b09cb2a9e2..8f0971cea363 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -2809,6 +2809,8 @@ int amdgpu_device_init(struct amdgpu_device

*adev,

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device · line 2812

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
        /* init the mode config */
        drm_mode_config_init(adev->ddev);
 
+       drm_dev_set_name(adev->ddev,

amdgpu_asic_name[adev->asic_type]);

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+
        r = amdgpu_device_ip_init(adev);
        if (r) {
                /* failed in exclusive mode due to timeout */
drivers/gpu/drm/drm_drv.c +1 -0
index 862621494a93..6c33879bb538 100644
@@ -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);
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_drv.c int drm_dev_set_unique(struct drm_device *dev,

Quoted 1 line
drivers/gpu/drm/drm_drv.c +0 -0
@@ -1078,6 +1079,22 @@ int drm_dev_set_unique(struct drm_device *dev,

const char *name)

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/drm_drv.c +11 -0
 }
 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);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/drm_drv.c int drm_dev_set_unique(struct drm_device *dev, · line 1100

Quoted 8 lines
drivers/gpu/drm/drm_drv.c +5 -0
+
+       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

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void

Quoted 5 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
index 2263e3ddd822..61f02965106b 100644
@@ -506,7 +506,7 @@ int drm_version(struct drm_device *dev, void

*data,

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void · line 508

Quoted 3 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
                                dev->driver->date);
        if (!err)
                err = drm_copy_field(version->desc,

&version->desc_len,

Quoted 6 lines
Quoted 2 lines

drivers/gpu/drm/drm_ioctl.c int drm_version(struct drm_device *dev, void · line 509

Quoted 2 lines
drivers/gpu/drm/drm_ioctl.c +1 -1
-                               dev->driver->desc);
+                               dev->name);

I suspect this needs to be something like dev->name ? dev->name :
dev->driver->desc

Quoted 7 lines

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?
-Daniel

Quoted 15 lines

BR,
-R

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_ioctl.c +0 -0
        return err;
 }
include/drm/drm_device.h +0 -0
index 7f9ef709b2b6..e29912c484e4 100644
@@ -123,6 +123,9 @@ struct drm_device {
        /** @unique: Unique name of the device */
        char *unique;
 
Quoted 11 lines
Quoted 11 lines

include/drm/drm_drv.h static inline bool

Quoted 11 lines
include/drm/drm_device.h +3 -0
+       /** @name: device name */
+       char *name;
+
        /**
         * @struct_mutex:
         *
include/drm/drm_drv.h +0 -0
index 68ca736c548d..f742e2bde467 100644
@@ -798,6 +798,7 @@ static inline bool

drm_drv_uses_atomic_modeset(struct drm_device *dev)

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
include/drm/drm_drv.h +1 -1
 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 [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 5 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAAxE2A6sESsKAi3K1etAZeCwAPgexn099G6g0aJQnavTkiH+mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw
Quoted 4 lines · Marek Olšák

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want to achieve in the commit message.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 7 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

Regards,
Christian.

Quoted 4 lines

BR,
Jani.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw
Quoted 11 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 7 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAKMK7uEj4FZ3YQqG-cCTa4EEaJoAk09Zaz398F9Hmo+mdXCKiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 8 lines
Quoted 6 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 5 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

I mean it could be perfectly valid to not only match the kernel, but also the hardware generation for that.

Christian.

Quoted 1 line

-Daniel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 7540df63-e623-19b0-dde5-b89ff2b7fb89-5C7GfCeVMHo@public.gmane.org

#17 lore raw
Quoted 18 lines · Christian

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 8 lines
Quoted 6 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 5 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Quoted 3 lines

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

For the Xorg modesetting driver, there's a simple solution, see
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/278 . Something similar can probably be done in Mesa as well.

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#18 lore raw
Quoted 23 lines · Michel Dänzer
Quoted 18 lines · Christian

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 8 lines
Quoted 6 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 5 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Quoted 3 lines

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

Quoted 8 lines

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

For the Xorg modesetting driver, there's a simple solution, see
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/278 . Something similar can probably be done in Mesa as well.

Another possibility might be for Xorg to use
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_query_driver.txt
to determine the driver name. Then only Mesa might need any HW specific code.

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 5d0a8619-7073-fac2-cdd6-83b55221140b-otUistvHUpPR7s880joybQ@public.gmane.org

#20 lore raw

Am 17.09.19 um 11:27 schrieb Michel Dänzer:

Quoted 19 lines · Michel Dänzer
Quoted 18 lines · Christian
Quoted 17 lines

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 16 lines
Quoted 9 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 7 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

Well how is userspace currently handling that? The kernel should NOT say which driver to use in userspace, but rather which one is used in the kernel.

Mapping that information to an userspace driver still needs to be done somewhere else, but the difference is that you don't need to add all PCI-IDs twice.

Christian.

Quoted 11 lines
Quoted 5 lines

For the Xorg modesetting driver, there's a simple solution, see
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/278 . Something similar can probably be done in Mesa as well.

Another possibility might be for Xorg to use
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_query_driver.txt
to determine the driver name. Then only Mesa might need any HW specific code.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#21 lore raw
Quoted 25 lines · Christian König

Am 17.09.19 um 11:27 schrieb Michel Dänzer:

Quoted 24 lines · Michel Dänzer
Quoted 23 lines · Christian
Quoted 22 lines

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 11 lines
Quoted 9 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 8 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want
to achieve in the commit message.

Quoted 6 lines
Quoted 1 line

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Well we already have an IOCTL for that, but I thought the intention here
was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

Well how is userspace currently handling that? The kernel should NOT say which driver to use in userspace, but rather which one is used in the kernel.

Would that really help though? E.g. the radeon kernel driver supports radeon/r200/r300/r600/radeonsi DRI drivers, the i915 one i915/i965/iris (and the amdgpu one radeonsi/amdgpu).

The HW generation identifier proposed in these patches might be useful, but I suspect there'll always be cases where userspace needs to know more precisely.

Quoted 3 lines

Mapping that information to an userspace driver still needs to be done somewhere else, but the difference is that you don't need to add all PCI-IDs twice.

It should only really be necessary in Mesa.

Quoted 2 lines · Daniel Vetter

How are other compositors solving this? I don't expect they have a pciid table like modesetting copied to all of them ...

They don't need any of this. The Xorg modesetting driver only did for determining the client driver name to advertise via the DRI2 extension.

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 4d255e1c-1d4a-a754-afe0-b18776a11a7e-otUistvHUpPR7s880joybQ@public.gmane.org

#23 lore raw

drmVersion::name = amdgpu, radeon, intel, etc.
drmVersion::desc = vega10, vega12, vega20, ...

The common Mesa code will use name and desc to select the driver.

The AMD-specific Mesa code will use desc to identify the chip.

Mesa won't receive any PCI IDs for future chips.

Marek

Quoted 59 lines · Michel Dänzer
Quoted 17 lines · Christian König

Am 17.09.19 um 11:27 schrieb Michel Dänzer:

Quoted 16 lines · Michel Dänzer
Quoted 15 lines · Christian
Quoted 14 lines

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 13 lines
Quoted 10 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 8 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

I'd think this would warrant a high level description of what you want
to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every

generation?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Well we already have an IOCTL for that, but I thought the intention here
was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

Well how is userspace currently handling that? The kernel should NOT say which driver to use in userspace, but rather which one is used in the kernel.

Would that really help though? E.g. the radeon kernel driver supports radeon/r200/r300/r600/radeonsi DRI drivers, the i915 one i915/i965/iris (and the amdgpu one radeonsi/amdgpu).

The HW generation identifier proposed in these patches might be useful, but I suspect there'll always be cases where userspace needs to know more precisely.

Quoted 3 lines

Mapping that information to an userspace driver still needs to be done somewhere else, but the difference is that you don't need to add all PCI-IDs twice.

It should only really be necessary in Mesa.

Quoted 2 lines · Daniel Vetter

How are other compositors solving this? I don't expect they have a pciid table like modesetting copied to all of them ...

They don't need any of this. The Xorg modesetting driver only did for determining the client driver name to advertise via the DRI2 extension.

Quoted 7 lines

--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAAxE2A7RcsiEsWBtbsDE2Wp+Vx7n-vwM1qL6HX_qKt=KnHCd4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#25 lore raw
Quoted 4 lines · Marek Olšák

drmVersion::name = amdgpu, radeon, intel, etc.
drmVersion::desc = vega10, vega12, vega20, ...

The common Mesa code will use name and desc to select the driver.

Like the Xorg modesetting driver, that code doesn't need this kernel functionality or new PCI IDs. It can just select the current driver for all devices which aren't supported by older drivers (which is a fixed set at this point).

Quoted 1 line

The AMD-specific Mesa code will use desc to identify the chip.

Doesn't libdrm_amdgpu's struct amdgpu_gpu_info::family_id provide the same information?

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#26 lore raw
Quoted 12 lines · Michel Dänzer
Quoted 4 lines · Marek Olšák

drmVersion::name = amdgpu, radeon, intel, etc.
drmVersion::desc = vega10, vega12, vega20, ...

The common Mesa code will use name and desc to select the driver.

Like the Xorg modesetting driver, that code doesn't need this kernel functionality or new PCI IDs. It can just select the current driver for all devices which aren't supported by older drivers (which is a fixed set at this point).

Quoted 5 lines
Quoted 1 line

The AMD-specific Mesa code will use desc to identify the chip.

Doesn't libdrm_amdgpu's struct amdgpu_gpu_info::family_id provide the same information?

Not for the common code, though I guess common Mesa code could use the INFO ioctl. Is that what you mean?

Marek

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#27 lore raw

Let's drop this patch. Mesa will use family_id.

Marek

Quoted 16 lines · Marek Olšák
Quoted 14 lines · Michel Dänzer
Quoted 4 lines · Marek Olšák

drmVersion::name = amdgpu, radeon, intel, etc.
drmVersion::desc = vega10, vega12, vega20, ...

The common Mesa code will use name and desc to select the driver.

Like the Xorg modesetting driver, that code doesn't need this kernel functionality or new PCI IDs. It can just select the current driver for all devices which aren't supported by older drivers (which is a fixed set at this point).

Quoted 1 line

The AMD-specific Mesa code will use desc to identify the chip.

Quoted 9 lines
Quoted 3 lines

Doesn't libdrm_amdgpu's struct amdgpu_gpu_info::family_id provide the same information?

Not for the common code, though I guess common Mesa code could use the INFO ioctl. Is that what you mean?

Marek

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#28 lore raw
In reply to a message not in the archive
Quoted 30 lines · Michel Dänzer
Quoted 28 lines · Michel Dänzer
Quoted 18 lines · Christian

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 8 lines
Quoted 6 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 5 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Quoted 3 lines

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

Quoted 8 lines
Quoted 3 lines

For the Xorg modesetting driver, there's a simple solution, see
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/278 . Something similar can probably be done in Mesa as well.

Another possibility might be for Xorg to use
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_query_driver.txt
to determine the driver name. Then only Mesa might need any HW specific code.

How are other compositors solving this? I don't expect they have a pciid table like modesetting copied to all of them ... -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#29 lore raw
Quoted 35 lines · On Tue, 17 Sep 2019 13:32:05 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 34 lines · Michel Dänzer
Quoted 31 lines · Michel Dänzer
Quoted 18 lines · Christian

Am 17.09.19 um 10:17 schrieb Daniel Vetter:

Quoted 8 lines
Quoted 6 lines · Christian König

Am 17.09.19 um 07:47 schrieb Jani Nikula:

Quoted 5 lines · Marek Olšák
Quoted 4 lines

The purpose is to get rid of all PCI ID tables for all drivers in userspace. (or at least stop updating them)

Mesa common code and modesetting will use this.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I'd think this would warrant a high level description of what you want to achieve in the commit message.

And maybe explicitly call it uapi_name or even uapi_driver_name.

If it's uapi_name, then why do we need a new one for every generation? Userspace drivers tend to span a lot more than just 1 generation. And if you want to have per-generation data from the kernel to userspace, then imo that's much better suited in some amdgpu ioctl, instead of trying to encode that into the driver name.

Quoted 3 lines

Well we already have an IOCTL for that, but I thought the intention here was to get rid of the PCI-ID tables in userspace to figure out which driver to load.

That's just unrealistic in general, I'm afraid. See e.g. the ongoing transition from i965 to iris for recent Intel hardware. How is the kernel supposed to know which driver is to be used?

For the Xorg modesetting driver, there's a simple solution, see
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/278 . Something similar can probably be done in Mesa as well.

Quoted 7 lines
Quoted 4 lines

Another possibility might be for Xorg to use
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_query_driver.txt
to determine the driver name. Then only Mesa might need any HW specific code.

How are other compositors solving this? I don't expect they have a pciid table like modesetting copied to all of them ...

Hi,

other compositors have no driver-specific code at all, so they do not need to know what the driver in kernel or Mesa is, or what chip they are running. They may report chip name and stuff in logs for the users' amusement, but nothing more.

Even the NVIDIA proprietary driver detection happens through EGL extension search: no-one else exposes EGLStreams.

Unless maybe if someone needs to quirk around driver bugs.

Thanks,
pq

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel