Skip to contentSkip to conversation

drm documentation and clean ups

PATCH Superseded Gabriel Krisman Bertazi 5 participants 16 messages Dec 28, 2016 – Jun 21, 2017

Subsystems (11)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm documentation and clean ups

Hi,

Here is a first batch of cleanups and documentation improvements to get me started on the DRM subsystem. I'm crawling through the newbie's page, and should share patches for load/unload callbacks removal next, once I properly test them.

Thanks,

Gabriel Krisman Bertazi (6):
drm: Deduplicate driver initialization message
exynos_drm: Clean up duplicated assignment in exynos_drm_driver
drm: Drop unused forward declaration of drm_version
drm: Export drm_ioctl_permit to kernel-doc
drm: Document deprecated load/unload hook
drm: Update TTM initialization documentation

 Documentation/gpu/drm-mm.rst                    | 30 ++++++++++++++-----------
 drivers/gpu/drm/armada/armada_drv.c             |  6 -----
 drivers/gpu/drm/drm_drv.c                       |  7 ++++++
 drivers/gpu/drm/drm_global.c                    | 23 +++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c                     | 11 +++++----
 drivers/gpu/drm/drm_pci.c                       |  4 ----
 drivers/gpu/drm/drm_platform.c                  |  4 ----
 drivers/gpu/drm/exynos/exynos_drm_drv.c         |  1 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       |  4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  4 ----
 drivers/gpu/drm/tegra/drm.c                     |  4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        |  4 ----
 include/drm/drm_drv.h                           | 30 +++++++++++++++++++++++++
 13 files changed, 82 insertions(+), 50 deletions(-)
Signature · 6 lines
2.11.0

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

PATCH 1/6 drm: Deduplicate driver initialization message

Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message.

Notice that this was tested only with Exynos, but looks simple enough for the other drivers.

---
 drivers/gpu/drm/armada/armada_drv.c             | 6 ------
 drivers/gpu/drm/drm_drv.c                       | 7 +++++++
 drivers/gpu/drm/drm_pci.c                       | 4 ----
 drivers/gpu/drm/drm_platform.c                  | 4 ----
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ----
 drivers/gpu/drm/tegra/drm.c                     | 4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        | 4 ----
 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +0 -6
index 07086b427c22..63f42d001f33 100644
@@ -203,12 +203,6 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 armada_drm_driver.name, armada_drm_driver.major,
-		 armada_drm_driver.minor, armada_drm_driver.patchlevel,
-		 armada_drm_driver.date, dev_name(dev),
-		 priv->drm.primary->index);
-
 	return 0;
 
  err_poll:
drivers/gpu/drm/drm_drv.c +7 -0
index 4a7b3e98d586..d5aeba58c2ac 100644
@@ -728,6 +728,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  */
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
+	struct drm_driver *driver = dev->driver;
 	int ret;
 
 	mutex_lock(&drm_global_mutex);
@@ -758,6 +759,12 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 		drm_modeset_register_all(dev);
 
 	ret = 0;
+
+	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+		 driver->name, driver->major, driver->minor,
+		 driver->patchlevel, driver->date, dev_name(dev->dev),
+		 dev->primary->index);
+
 	goto out_unlock;
 
 err_minors:
drivers/gpu/drm/drm_pci.c +0 -4
index 3ceea9cb9d3e..dc358f860aea 100644
@@ -257,10 +257,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 	if (ret)
 		goto err_agp;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
-
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
drivers/gpu/drm/drm_platform.c +0 -4
index 026269851ce9..7af3005a030c 100644
@@ -57,10 +57,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -4
index 0b35da73c2b0..9a31711d5158 100644
@@ -415,10 +415,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -4
index fa228b7b022c..7df0e8535e41 100644
@@ -217,10 +217,6 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm_dev->primary->index);
-
 	return 0;
 
 err_kms_cleanup:
drivers/gpu/drm/tegra/drm.c +0 -4
index e289dbc6ad82..1acf1da3f0df 100644
@@ -992,10 +992,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +0 -4
index 3b97d50fd392..43e1d5916c6c 100644
@@ -83,10 +83,6 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
Signature · 6 lines
2.11.0

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

Re: [PATCH 1/6] drm: Deduplicate driver initialization message

Quoted 8 lines · Gabriel Krisman Bertazi

Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message.

Notice that this was tested only with Exynos, but looks simple enough for the other drivers.

Makes sense, applied to drm-misc.

Thanks, Daniel

Quoted 150 lines
---
 drivers/gpu/drm/armada/armada_drv.c             | 6 ------
 drivers/gpu/drm/drm_drv.c                       | 7 +++++++
 drivers/gpu/drm/drm_pci.c                       | 4 ----
 drivers/gpu/drm/drm_platform.c                  | 4 ----
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ----
 drivers/gpu/drm/tegra/drm.c                     | 4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        | 4 ----
 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +0 -6
index 07086b427c22..63f42d001f33 100644
@@ -203,12 +203,6 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 armada_drm_driver.name, armada_drm_driver.major,
-		 armada_drm_driver.minor, armada_drm_driver.patchlevel,
-		 armada_drm_driver.date, dev_name(dev),
-		 priv->drm.primary->index);
-
 	return 0;
 
  err_poll:
drivers/gpu/drm/drm_drv.c +7 -0
index 4a7b3e98d586..d5aeba58c2ac 100644
@@ -728,6 +728,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  */
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
+	struct drm_driver *driver = dev->driver;
 	int ret;
 
 	mutex_lock(&drm_global_mutex);
@@ -758,6 +759,12 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 		drm_modeset_register_all(dev);
 
 	ret = 0;
+
+	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+		 driver->name, driver->major, driver->minor,
+		 driver->patchlevel, driver->date, dev_name(dev->dev),
+		 dev->primary->index);
+
 	goto out_unlock;
 
 err_minors:
drivers/gpu/drm/drm_pci.c +0 -4
index 3ceea9cb9d3e..dc358f860aea 100644
@@ -257,10 +257,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 	if (ret)
 		goto err_agp;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
-
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
drivers/gpu/drm/drm_platform.c +0 -4
index 026269851ce9..7af3005a030c 100644
@@ -57,10 +57,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -4
index 0b35da73c2b0..9a31711d5158 100644
@@ -415,10 +415,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -4
index fa228b7b022c..7df0e8535e41 100644
@@ -217,10 +217,6 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm_dev->primary->index);
-
 	return 0;
 
 err_kms_cleanup:
drivers/gpu/drm/tegra/drm.c +0 -4
index e289dbc6ad82..1acf1da3f0df 100644
@@ -992,10 +992,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +0 -4
index 3b97d50fd392..43e1d5916c6c 100644
@@ -83,10 +83,6 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 1/6] drm: Deduplicate driver initialization message

Quoted 11 lines · Daniel Vetter
Quoted 8 lines · Gabriel Krisman Bertazi

Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message.

Notice that this was tested only with Exynos, but looks simple enough for the other drivers.

Makes sense, applied to drm-misc.

Makes sense for everything except i915:

https://bugs.freedesktop.org/show_bug.cgi?id=101025

BR,
Jani.

Quoted 153 lines

Thanks, Daniel

Quoted 150 lines
---
 drivers/gpu/drm/armada/armada_drv.c             | 6 ------
 drivers/gpu/drm/drm_drv.c                       | 7 +++++++
 drivers/gpu/drm/drm_pci.c                       | 4 ----
 drivers/gpu/drm/drm_platform.c                  | 4 ----
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ----
 drivers/gpu/drm/tegra/drm.c                     | 4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        | 4 ----
 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +0 -6
index 07086b427c22..63f42d001f33 100644
@@ -203,12 +203,6 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 armada_drm_driver.name, armada_drm_driver.major,
-		 armada_drm_driver.minor, armada_drm_driver.patchlevel,
-		 armada_drm_driver.date, dev_name(dev),
-		 priv->drm.primary->index);
-
 	return 0;
 
  err_poll:
drivers/gpu/drm/drm_drv.c +7 -0
index 4a7b3e98d586..d5aeba58c2ac 100644
@@ -728,6 +728,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  */
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
+	struct drm_driver *driver = dev->driver;
 	int ret;
 
 	mutex_lock(&drm_global_mutex);
@@ -758,6 +759,12 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 		drm_modeset_register_all(dev);
 
 	ret = 0;
+
+	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+		 driver->name, driver->major, driver->minor,
+		 driver->patchlevel, driver->date, dev_name(dev->dev),
+		 dev->primary->index);
+
 	goto out_unlock;
 
 err_minors:
drivers/gpu/drm/drm_pci.c +0 -4
index 3ceea9cb9d3e..dc358f860aea 100644
@@ -257,10 +257,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 	if (ret)
 		goto err_agp;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
-
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
drivers/gpu/drm/drm_platform.c +0 -4
index 026269851ce9..7af3005a030c 100644
@@ -57,10 +57,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -4
index 0b35da73c2b0..9a31711d5158 100644
@@ -415,10 +415,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -4
index fa228b7b022c..7df0e8535e41 100644
@@ -217,10 +217,6 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm_dev->primary->index);
-
 	return 0;
 
 err_kms_cleanup:
drivers/gpu/drm/tegra/drm.c +0 -4
index e289dbc6ad82..1acf1da3f0df 100644
@@ -992,10 +992,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +0 -4
index 3b97d50fd392..43e1d5916c6c 100644
@@ -83,10 +83,6 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
Signature · 6 lines
2.11.0

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

Re: [PATCH 1/6] drm: Deduplicate driver initialization message

Quoted 9 lines · Jani Nikula
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Gabriel Krisman Bertazi

Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message.

Notice that this was tested only with Exynos, but looks simple enough for the other drivers.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Makes sense, applied to drm-misc.

Makes sense for everything except i915:

https://bugs.freedesktop.org/show_bug.cgi?id=101025

Not sure how this happened, the i915 patch landed a few months earlier:

commit bc5ca47c0af4f949ba889e666b7da65569e36093

Author: Chris Wilson <[email protected]>
Date:   Thu Aug 25 08:23:14 2016 +0100

drm/i915: Restore lost "Initialized i915" welcome message

Gabriel, can you pls follow up with a patch to address this?

Thanks, Daniel

Quoted 161 lines

BR,
Jani.

Quoted 153 lines

Thanks, Daniel

Quoted 150 lines
---
 drivers/gpu/drm/armada/armada_drv.c             | 6 ------
 drivers/gpu/drm/drm_drv.c                       | 7 +++++++
 drivers/gpu/drm/drm_pci.c                       | 4 ----
 drivers/gpu/drm/drm_platform.c                  | 4 ----
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ----
 drivers/gpu/drm/tegra/drm.c                     | 4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        | 4 ----
 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +0 -6
index 07086b427c22..63f42d001f33 100644
@@ -203,12 +203,6 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 armada_drm_driver.name, armada_drm_driver.major,
-		 armada_drm_driver.minor, armada_drm_driver.patchlevel,
-		 armada_drm_driver.date, dev_name(dev),
-		 priv->drm.primary->index);
-
 	return 0;
 
  err_poll:
drivers/gpu/drm/drm_drv.c +7 -0
index 4a7b3e98d586..d5aeba58c2ac 100644
@@ -728,6 +728,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  */
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
+	struct drm_driver *driver = dev->driver;
 	int ret;
 
 	mutex_lock(&drm_global_mutex);
@@ -758,6 +759,12 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 		drm_modeset_register_all(dev);
 
 	ret = 0;
+
+	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+		 driver->name, driver->major, driver->minor,
+		 driver->patchlevel, driver->date, dev_name(dev->dev),
+		 dev->primary->index);
+
 	goto out_unlock;
 
 err_minors:
drivers/gpu/drm/drm_pci.c +0 -4
index 3ceea9cb9d3e..dc358f860aea 100644
@@ -257,10 +257,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 	if (ret)
 		goto err_agp;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
-
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
drivers/gpu/drm/drm_platform.c +0 -4
index 026269851ce9..7af3005a030c 100644
@@ -57,10 +57,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -4
index 0b35da73c2b0..9a31711d5158 100644
@@ -415,10 +415,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -4
index fa228b7b022c..7df0e8535e41 100644
@@ -217,10 +217,6 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm_dev->primary->index);
-
 	return 0;
 
 err_kms_cleanup:
drivers/gpu/drm/tegra/drm.c +0 -4
index e289dbc6ad82..1acf1da3f0df 100644
@@ -992,10 +992,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +0 -4
index 3b97d50fd392..43e1d5916c6c 100644
@@ -83,10 +83,6 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

Re: [PATCH 1/6] drm: Deduplicate driver initialization message

Quoted 20 lines · Daniel Vetter
Quoted 9 lines · Jani Nikula
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Gabriel Krisman Bertazi

Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message.

Notice that this was tested only with Exynos, but looks simple enough for the other drivers.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Makes sense, applied to drm-misc.

Makes sense for everything except i915:

https://bugs.freedesktop.org/show_bug.cgi?id=101025

Not sure how this happened, the i915 patch landed a few months earlier:

Quoted 7 lines

commit bc5ca47c0af4f949ba889e666b7da65569e36093

Author: Chris Wilson <[email protected]>
Date:   Thu Aug 25 08:23:14 2016 +0100

drm/i915: Restore lost "Initialized i915" welcome message

Gabriel, can you pls follow up with a patch to address this?

Isn't the fix then to revert that? Since the message now comes from core?

BR,
Jani.

Quoted 164 lines

Thanks, Daniel

Quoted 161 lines

BR,
Jani.

Quoted 153 lines

Thanks, Daniel

Quoted 150 lines
---
 drivers/gpu/drm/armada/armada_drv.c             | 6 ------
 drivers/gpu/drm/drm_drv.c                       | 7 +++++++
 drivers/gpu/drm/drm_pci.c                       | 4 ----
 drivers/gpu/drm/drm_platform.c                  | 4 ----
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 4 ----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ----
 drivers/gpu/drm/tegra/drm.c                     | 4 ----
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c        | 4 ----
 8 files changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +0 -6
index 07086b427c22..63f42d001f33 100644
@@ -203,12 +203,6 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 armada_drm_driver.name, armada_drm_driver.major,
-		 armada_drm_driver.minor, armada_drm_driver.patchlevel,
-		 armada_drm_driver.date, dev_name(dev),
-		 priv->drm.primary->index);
-
 	return 0;
 
  err_poll:
drivers/gpu/drm/drm_drv.c +7 -0
index 4a7b3e98d586..d5aeba58c2ac 100644
@@ -728,6 +728,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  */
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
+	struct drm_driver *driver = dev->driver;
 	int ret;
 
 	mutex_lock(&drm_global_mutex);
@@ -758,6 +759,12 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 		drm_modeset_register_all(dev);
 
 	ret = 0;
+
+	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+		 driver->name, driver->major, driver->minor,
+		 driver->patchlevel, driver->date, dev_name(dev->dev),
+		 dev->primary->index);
+
 	goto out_unlock;
 
 err_minors:
drivers/gpu/drm/drm_pci.c +0 -4
index 3ceea9cb9d3e..dc358f860aea 100644
@@ -257,10 +257,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 	if (ret)
 		goto err_agp;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
-
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
drivers/gpu/drm/drm_platform.c +0 -4
index 026269851ce9..7af3005a030c 100644
@@ -57,10 +57,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -4
index 0b35da73c2b0..9a31711d5158 100644
@@ -415,10 +415,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -4
index fa228b7b022c..7df0e8535e41 100644
@@ -217,10 +217,6 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
-		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm_dev->primary->index);
-
 	return 0;
 
 err_kms_cleanup:
drivers/gpu/drm/tegra/drm.c +0 -4
index e289dbc6ad82..1acf1da3f0df 100644
@@ -992,10 +992,6 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto unref;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
-
 	return 0;
 
 unref:
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +0 -4
index 3b97d50fd392..43e1d5916c6c 100644
@@ -83,10 +83,6 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 	if (ret)
 		goto err_free;
 
-	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
-
 	return 0;
 
 err_free:
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 2/6 exynos_drm: Clean up duplicated assignment in exynos_drm_driver

In reply to Gabriel Krisman Bertazi

num_ioctls is already assigned when declaring the exynos_drm_driver structure. No need to duplicate it here.

---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -1
index 739180ac3da5..44b4d07eefb5 100644
@@ -570,7 +570,6 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 	struct component_match *match;
 
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
 
 	match = exynos_drm_match_add(&pdev->dev);
 	if (IS_ERR(match))
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/6
#7 lore raw

Re: [PATCH 2/6] exynos_drm: Clean up duplicated assignment in exynos_drm_driver

Hi Inki,

Quoted 4 lines · Gabriel Krisman Bertazi

num_ioctls is already assigned when declaring the exynos_drm_driver structure. No need to duplicate it here.

It looks like the patch has not been merged, probably due to lack of your e-mail.
Anyway it does the right thing, could you take it?

--
Regards
Andrzej

Quoted 9 lines
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -0
index 739180ac3da5..44b4d07eefb5 100644

drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev) · line 575

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -1
@@ -570,7 +570,6 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 	struct component_match *match;
 
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
 
 	match = exynos_drm_match_add(&pdev->dev);
 	if (IS_ERR(match))

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

maintainer
#8 lore raw

Re: [PATCH 2/6] exynos_drm: Clean up duplicated assignment in exynos_drm_driver

Hi Andrzej,

2017년 06월 19일 20:03에 Andrzej Hajda 이(가) 쓴 글:

Quoted 11 lines

Hi Inki,

Quoted 4 lines · Gabriel Krisman Bertazi

num_ioctls is already assigned when declaring the exynos_drm_driver structure. No need to duplicate it here.

It looks like the patch has not been merged, probably due to lack of your e-mail.
Anyway it does the right thing, could you take it?

Got it. Thanks for notice.

Thanks,
Inki Dae

Quoted 18 lines

--
Regards
Andrzej

Quoted 11 lines
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -0
index 739180ac3da5..44b4d07eefb5 100644
@@ -570,7 +570,6 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 	struct component_match *match;
 
Quoted 9 lines

drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev) · line 575

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -1
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
 
 	match = exynos_drm_match_add(&pdev->dev);
 	if (IS_ERR(match))

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

#9 lore raw

PATCH 3/6 drm: Drop unused forward declaration of drm_version

In reply to Gabriel Krisman Bertazi
---
 drivers/gpu/drm/drm_ioctl.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_ioctl.c +0 -3
index d180673c1323..5c80e720aeca 100644
@@ -95,9 +95,6 @@
  * broken.
  */
 
-static int drm_version(struct drm_device *dev, void *data,
-		       struct drm_file *file_priv);
-
 /*
  * Get the bus id.
  *
Signature · 6 lines
2.11.0

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

PATCH 4/6 drm: Export drm_ioctl_permit to kernel-doc

In reply to Gabriel Krisman Bertazi

drm_ioctl_permit is exported but missed a kernel-doc style documentation.

---
 drivers/gpu/drm/drm_ioctl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_ioctl.c +5 -3
index 5c80e720aeca..a7c61c23685a 100644
@@ -478,15 +478,17 @@ static int drm_version(struct drm_device *dev, void *data,
 	return err;
 }
 
-/*
+/**
  * drm_ioctl_permit - Check ioctl permissions against caller
  *
  * @flags: ioctl permission flags.
  * @file_priv: Pointer to struct drm_file identifying the caller.
  *
  * Checks whether the caller is allowed to run an ioctl with the
- * indicated permissions. If so, returns zero. Otherwise returns an
- * error code suitable for ioctl return.
+ * indicated permissions.
+ *
+ * Returns:
+ * Zero if allowed, -EACCES otherwise.
  */
 int drm_ioctl_permit(u32 flags, struct drm_file *file_priv)
 {
Signature · 6 lines
2.11.0

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

PATCH 5/6 drm: Document deprecated load/unload hook

In reply to Gabriel Krisman Bertazi
---
 include/drm/drm_drv.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
include/drm/drm_drv.h +30 -0
index c4fc49583dc0..0c8e4e979870 100644
@@ -64,12 +64,42 @@ struct drm_mode_create_dumb;
  * structure for GEM drivers.
  */
 struct drm_driver {
+
+	/**
+	 * @load:
+	 *
+	 * Backward-compatible driver callback to complete
+	 * initialization steps after the driver is registered.  For
+	 * this reason, may suffer from race conditions and its use is
+	 * dicouraged for new drivers.  It is therefore only supported
+	 * for existing drivers not yet converted to the new scheme.
+	 *
+	 * Returns:
+	 * Zero on success, non-zero value on failure.
+	 */
 	int (*load) (struct drm_device *, unsigned long flags);
 	int (*firstopen) (struct drm_device *);
 	int (*open) (struct drm_device *, struct drm_file *);
 	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
 	void (*postclose) (struct drm_device *, struct drm_file *);
 	void (*lastclose) (struct drm_device *);
+
+	/**
+	 * @unload:
+	 *
+	 * Reverse the effects of the driver load callback.  Ideally,
+	 * the clean up performed by the driver should happen in the
+	 * reverse order of the initialization.  Similarly to the load
+	 * hook, this handler is deprecated and its usage should be
+	 * dropped in favor of an open-coded teardown function at the
+	 * driver layer.
+	 *
+	 * The unload() hook is called immediately after unregistering
+	 * the device.
+	 *
+	 * Returns:
+	 * The return value is ignored.
+	 */
 	int (*unload) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
Signature · 6 lines
2.11.0

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

Re: [PATCH 5/6] drm: Document deprecated load/unload hook

Quoted 11 lines · Gabriel Krisman Bertazi
---
 include/drm/drm_drv.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
include/drm/drm_drv.h +0 -0
index c4fc49583dc0..0c8e4e979870 100644
@@ -64,12 +64,42 @@ struct drm_mode_create_dumb;
  * structure for GEM drivers.

include/drm/drm_drv.h struct drm_mode_create_dumb; · line 74

Quoted 10 lines
include/drm/drm_drv.h +8 -0
  */
 struct drm_driver {
+
+	/**
+	 * @load:
+	 *
+	 * Backward-compatible driver callback to complete
+	 * initialization steps after the driver is registered.  For
+	 * this reason, may suffer from race conditions and its use is
+	 * dicouraged for new drivers.  It is therefore only supported

s/discouraged/deprecated/ ... need some stronger wording here.

include/drm/drm_drv.h struct drm_mode_create_dumb; · line 75

Quoted 1 line
include/drm/drm_drv.h +1 -0
+	 * for existing drivers not yet converted to the new scheme.

I think a link to the new scheme would be good, maybe:

"See drm_dev_init() and drm_dev_register() for proper and race-free way to set up a &drm_device."

Unload is also deprecated, so similar comments apply for that. -Daniel

Quoted 37 lines
include/drm/drm_drv.h +21 -0
+	 *
+	 * Returns:
+	 * Zero on success, non-zero value on failure.
+	 */
 	int (*load) (struct drm_device *, unsigned long flags);
 	int (*firstopen) (struct drm_device *);
 	int (*open) (struct drm_device *, struct drm_file *);
 	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
 	void (*postclose) (struct drm_device *, struct drm_file *);
 	void (*lastclose) (struct drm_device *);
+
+	/**
+	 * @unload:
+	 *
+	 * Reverse the effects of the driver load callback.  Ideally,
+	 * the clean up performed by the driver should happen in the
+	 * reverse order of the initialization.  Similarly to the load
+	 * hook, this handler is deprecated and its usage should be
+	 * dropped in favor of an open-coded teardown function at the
+	 * driver layer.
+	 *
+	 * The unload() hook is called immediately after unregistering
+	 * the device.
+	 *
+	 * Returns:
+	 * The return value is ignored.
+	 */
 	int (*unload) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 6/6 drm: Update TTM initialization documentation

In reply to Gabriel Krisman Bertazi

ttm_global_reference was renamed to drm_global_reference. This updates the documentation to reflect that. While we are there, document the drm_global_reference API and update the initialization interface documentation.

---
 Documentation/gpu/drm-mm.rst | 30 +++++++++++++++++-------------
 drivers/gpu/drm/drm_global.c | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 13 deletions(-)
Documentation/gpu/drm-mm.rst +17 -13
index cb5daffcd6be..3686ed148003 100644
@@ -33,26 +33,24 @@ TTM design background and information belongs here.
 TTM initialization
 ------------------
 
-    **Warning**
+Drivers wishing to support TTM must pass a filled :c:type:`ttm_bo_driver
+<ttm_bo_driver>` structure to ttm_bo_device_init, together with an
+initialized global reference to the memory manager.  The ttm_bo_driver
+structure contains several fields with function pointers for
+initializing the TTM, allocating and freeing memory, waiting for command
+completion and fence synchronization, and memory migration.
 
-    This section is outdated.
-
-Drivers wishing to support TTM must fill out a drm_bo_driver
-structure. The structure contains several fields with function pointers
-for initializing the TTM, allocating and freeing memory, waiting for
-command completion and fence synchronization, and memory migration. See
-the radeon_ttm.c file for an example of usage.
-
-The ttm_global_reference structure is made up of several fields:
+The :c:type:`struct drm_global_reference <drm_global_reference>` is made
+up of several fields:
 
 .. code-block:: c
 
-              struct ttm_global_reference {
+              struct drm_global_reference {
                       enum ttm_global_types global_type;
                       size_t size;
                       void *object;
-                      int (*init) (struct ttm_global_reference *);
-                      void (*release) (struct ttm_global_reference *);
+                      int (*init) (struct drm_global_reference *);
+                      void (*release) (struct drm_global_reference *);
               };
 
 
@@ -76,6 +74,12 @@ ttm_bo_global_release(), respectively. Also, like the previous
 object, ttm_global_item_ref() is used to create an initial reference
 count for the TTM, which will call your initialization function.
 
+See the radeon_ttm.c file for an example of usage.
+
+.. kernel-doc:: drivers/gpu/drm/drm_global.c
+   :export:
+
+
 The Graphics Execution Manager (GEM)
 ====================================
 
drivers/gpu/drm/drm_global.c +23 -0
index b404287abb97..b2dc21e33ae0 100644
@@ -63,6 +63,18 @@ void drm_global_release(void)
 	}
 }
 
+/**
+ * drm_global_item_ref - Initialize and acquire reference to memory
+ * object
+ * @ref: Object for initialization
+ *
+ * This initializes a memory object, allocating memory and calling the
+ * .init() hook. Further calls will increase the reference count for
+ * that item.
+ *
+ * Returns:
+ * Zero on success, non-zero otherwise.
+ */
 int drm_global_item_ref(struct drm_global_reference *ref)
 {
 	int ret = 0;
@@ -97,6 +109,17 @@ int drm_global_item_ref(struct drm_global_reference *ref)
 }
 EXPORT_SYMBOL(drm_global_item_ref);
 
+/**
+ * drm_global_item_unref - Drop reference to memory
+ * object
+ * @ref: Object being removed
+ *
+ * Drop a reference to the memory object and eventually call the
+ * release() hook.  The allocated object should be dropped in the
+ * release() hook or before calling this function
+ *
+ */
+
 void drm_global_item_unref(struct drm_global_reference *ref)
 {
 	struct drm_global_item *item = &glob[ref->global_type];
Signature · 6 lines
2.11.0

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

Re: [PATCH 6/6] drm: Update TTM initialization documentation

Quoted 6 lines · Gabriel Krisman Bertazi

ttm_global_reference was renamed to drm_global_reference. This updates the documentation to reflect that. While we are there, document the drm_global_reference API and update the initialization interface documentation.

Also merged patches 3,5&6.

Thanks, Daniel

Quoted 108 lines
---
 Documentation/gpu/drm-mm.rst | 30 +++++++++++++++++-------------
 drivers/gpu/drm/drm_global.c | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 13 deletions(-)
Documentation/gpu/drm-mm.rst +17 -13
index cb5daffcd6be..3686ed148003 100644
@@ -33,26 +33,24 @@ TTM design background and information belongs here.
 TTM initialization
 ------------------
 
-    **Warning**
+Drivers wishing to support TTM must pass a filled :c:type:`ttm_bo_driver
+<ttm_bo_driver>` structure to ttm_bo_device_init, together with an
+initialized global reference to the memory manager.  The ttm_bo_driver
+structure contains several fields with function pointers for
+initializing the TTM, allocating and freeing memory, waiting for command
+completion and fence synchronization, and memory migration.
 
-    This section is outdated.
-
-Drivers wishing to support TTM must fill out a drm_bo_driver
-structure. The structure contains several fields with function pointers
-for initializing the TTM, allocating and freeing memory, waiting for
-command completion and fence synchronization, and memory migration. See
-the radeon_ttm.c file for an example of usage.
-
-The ttm_global_reference structure is made up of several fields:
+The :c:type:`struct drm_global_reference <drm_global_reference>` is made
+up of several fields:
 
 .. code-block:: c
 
-              struct ttm_global_reference {
+              struct drm_global_reference {
                       enum ttm_global_types global_type;
                       size_t size;
                       void *object;
-                      int (*init) (struct ttm_global_reference *);
-                      void (*release) (struct ttm_global_reference *);
+                      int (*init) (struct drm_global_reference *);
+                      void (*release) (struct drm_global_reference *);
               };
 
 
@@ -76,6 +74,12 @@ ttm_bo_global_release(), respectively. Also, like the previous
 object, ttm_global_item_ref() is used to create an initial reference
 count for the TTM, which will call your initialization function.
 
+See the radeon_ttm.c file for an example of usage.
+
+.. kernel-doc:: drivers/gpu/drm/drm_global.c
+   :export:
+
+
 The Graphics Execution Manager (GEM)
 ====================================
 
drivers/gpu/drm/drm_global.c +23 -0
index b404287abb97..b2dc21e33ae0 100644
@@ -63,6 +63,18 @@ void drm_global_release(void)
 	}
 }
 
+/**
+ * drm_global_item_ref - Initialize and acquire reference to memory
+ * object
+ * @ref: Object for initialization
+ *
+ * This initializes a memory object, allocating memory and calling the
+ * .init() hook. Further calls will increase the reference count for
+ * that item.
+ *
+ * Returns:
+ * Zero on success, non-zero otherwise.
+ */
 int drm_global_item_ref(struct drm_global_reference *ref)
 {
 	int ret = 0;
@@ -97,6 +109,17 @@ int drm_global_item_ref(struct drm_global_reference *ref)
 }
 EXPORT_SYMBOL(drm_global_item_ref);
 
+/**
+ * drm_global_item_unref - Drop reference to memory
+ * object
+ * @ref: Object being removed
+ *
+ * Drop a reference to the memory object and eventually call the
+ * release() hook.  The allocated object should be dropped in the
+ * release() hook or before calling this function
+ *
+ */
+
 void drm_global_item_unref(struct drm_global_reference *ref)
 {
 	struct drm_global_item *item = &glob[ref->global_type];
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

Re: [PATCH 6/6] drm: Update TTM initialization documentation

In reply to Gabriel Krisman Bertazi
Quoted 18 lines · Gabriel Krisman Bertazi

ttm_global_reference was renamed to drm_global_reference. This updates the documentation to reflect that. While we are there, document the drm_global_reference API and update the initialization interface documentation.

---
 Documentation/gpu/drm-mm.rst | 30 +++++++++++++++++-------------
 drivers/gpu/drm/drm_global.c | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 13 deletions(-)
Documentation/gpu/drm-mm.rst +0 -0
index cb5daffcd6be..3686ed148003 100644
@@ -33,26 +33,24 @@ TTM design background and information belongs here.
 TTM initialization
 ------------------

Documentation/gpu/drm-mm.rst TTM design background and information belongs here. · line 38

Quoted 10 lines
Documentation/gpu/drm-mm.rst +6 -2
 
-    **Warning**
+Drivers wishing to support TTM must pass a filled :c:type:`ttm_bo_driver
+<ttm_bo_driver>` structure to ttm_bo_device_init, together with an
+initialized global reference to the memory manager.  The ttm_bo_driver
+structure contains several fields with function pointers for
+initializing the TTM, allocating and freeing memory, waiting for command
+completion and fence synchronization, and memory migration.
 
-    This section is outdated.

Forgot to mention: I kept this warning, since TTM docs are still massively inadequate.
-Daniel

Quoted 86 lines
Documentation/gpu/drm-mm.rst +11 -11
-
-Drivers wishing to support TTM must fill out a drm_bo_driver
-structure. The structure contains several fields with function pointers
-for initializing the TTM, allocating and freeing memory, waiting for
-command completion and fence synchronization, and memory migration. See
-the radeon_ttm.c file for an example of usage.
-
-The ttm_global_reference structure is made up of several fields:
+The :c:type:`struct drm_global_reference <drm_global_reference>` is made
+up of several fields:
 
 .. code-block:: c
 
-              struct ttm_global_reference {
+              struct drm_global_reference {
                       enum ttm_global_types global_type;
                       size_t size;
                       void *object;
-                      int (*init) (struct ttm_global_reference *);
-                      void (*release) (struct ttm_global_reference *);
+                      int (*init) (struct drm_global_reference *);
+                      void (*release) (struct drm_global_reference *);
               };
 
 
@@ -76,6 +74,12 @@ ttm_bo_global_release(), respectively. Also, like the previous
 object, ttm_global_item_ref() is used to create an initial reference
 count for the TTM, which will call your initialization function.
 
+See the radeon_ttm.c file for an example of usage.
+
+.. kernel-doc:: drivers/gpu/drm/drm_global.c
+   :export:
+
+
 The Graphics Execution Manager (GEM)
 ====================================
 
drivers/gpu/drm/drm_global.c +23 -0
index b404287abb97..b2dc21e33ae0 100644
@@ -63,6 +63,18 @@ void drm_global_release(void)
 	}
 }
 
+/**
+ * drm_global_item_ref - Initialize and acquire reference to memory
+ * object
+ * @ref: Object for initialization
+ *
+ * This initializes a memory object, allocating memory and calling the
+ * .init() hook. Further calls will increase the reference count for
+ * that item.
+ *
+ * Returns:
+ * Zero on success, non-zero otherwise.
+ */
 int drm_global_item_ref(struct drm_global_reference *ref)
 {
 	int ret = 0;
@@ -97,6 +109,17 @@ int drm_global_item_ref(struct drm_global_reference *ref)
 }
 EXPORT_SYMBOL(drm_global_item_ref);
 
+/**
+ * drm_global_item_unref - Drop reference to memory
+ * object
+ * @ref: Object being removed
+ *
+ * Drop a reference to the memory object and eventually call the
+ * release() hook.  The allocated object should be dropped in the
+ * release() hook or before calling this function
+ *
+ */
+
 void drm_global_item_unref(struct drm_global_reference *ref)
 {
 	struct drm_global_item *item = &glob[ref->global_type];
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel