All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
To: daniel.vetter@intel.com
Cc: Gabriel Krisman Bertazi <krisman@collabora.co.uk>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 6/6] drm: Update TTM initialization documentation
Date: Wed, 28 Dec 2016 12:32:16 -0200	[thread overview]
Message-ID: <20161228143216.26821-7-krisman@collabora.co.uk> (raw)
In-Reply-To: <20161228143216.26821-1-krisman@collabora.co.uk>

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.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
---
 Documentation/gpu/drm-mm.rst | 30 +++++++++++++++++-------------
 drivers/gpu/drm/drm_global.c | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst
index cb5daffcd6be..3686ed148003 100644
--- a/Documentation/gpu/drm-mm.rst
+++ b/Documentation/gpu/drm-mm.rst
@@ -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)
 ====================================
 
diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
index b404287abb97..b2dc21e33ae0 100644
--- a/drivers/gpu/drm/drm_global.c
+++ b/drivers/gpu/drm/drm_global.c
@@ -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];
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-28 14:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 14:32 [PATCH 0/6] drm documentation and clean ups Gabriel Krisman Bertazi
2016-12-28 14:32 ` [PATCH 1/6] drm: Deduplicate driver initialization message Gabriel Krisman Bertazi
2016-12-30 11:38   ` Daniel Vetter
2017-05-17 10:06     ` Jani Nikula
2017-05-17 11:41       ` Daniel Vetter
2017-05-17 11:51         ` Jani Nikula
2016-12-28 14:32 ` [PATCH 2/6] exynos_drm: Clean up duplicated assignment in exynos_drm_driver Gabriel Krisman Bertazi
2017-06-19 11:03   ` Andrzej Hajda
2017-06-21  4:58     ` Inki Dae
2016-12-28 14:32 ` [PATCH 3/6] drm: Drop unused forward declaration of drm_version Gabriel Krisman Bertazi
2016-12-28 14:32 ` [PATCH 4/6] drm: Export drm_ioctl_permit to kernel-doc Gabriel Krisman Bertazi
2016-12-28 14:32 ` [PATCH 5/6] drm: Document deprecated load/unload hook Gabriel Krisman Bertazi
2016-12-30 11:43   ` Daniel Vetter
2016-12-28 14:32 ` Gabriel Krisman Bertazi [this message]
2016-12-30 11:49   ` [PATCH 6/6] drm: Update TTM initialization documentation Daniel Vetter
2016-12-30 11:53   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161228143216.26821-7-krisman@collabora.co.uk \
    --to=krisman@collabora.co.uk \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.