Skip to content

Commit b834ff8

Browse files
Gabriel Krisman Bertazidanvet
authored andcommitted
drm: Update TTM initialization documentation
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> [danvet: Keep the warning, ttm docs are still massively inadequate.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161228143216.26821-7-krisman@collabora.co.uk
1 parent 5bbf92d commit b834ff8

2 files changed

Lines changed: 40 additions & 10 deletions

File tree

‎Documentation/gpu/drm-mm.rst‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,26 @@ TTM initialization
3434
------------------
3535

3636
**Warning**
37-
3837
This section is outdated.
3938

40-
Drivers wishing to support TTM must fill out a drm_bo_driver
41-
structure. The structure contains several fields with function pointers
42-
for initializing the TTM, allocating and freeing memory, waiting for
43-
command completion and fence synchronization, and memory migration. See
44-
the radeon_ttm.c file for an example of usage.
39+
Drivers wishing to support TTM must pass a filled :c:type:`ttm_bo_driver
40+
<ttm_bo_driver>` structure to ttm_bo_device_init, together with an
41+
initialized global reference to the memory manager. The ttm_bo_driver
42+
structure contains several fields with function pointers for
43+
initializing the TTM, allocating and freeing memory, waiting for command
44+
completion and fence synchronization, and memory migration.
4545

46-
The ttm_global_reference structure is made up of several fields:
46+
The :c:type:`struct drm_global_reference <drm_global_reference>` is made
47+
up of several fields:
4748

4849
.. code-block:: c
4950
50-
struct ttm_global_reference {
51+
struct drm_global_reference {
5152
enum ttm_global_types global_type;
5253
size_t size;
5354
void *object;
54-
int (*init) (struct ttm_global_reference *);
55-
void (*release) (struct ttm_global_reference *);
55+
int (*init) (struct drm_global_reference *);
56+
void (*release) (struct drm_global_reference *);
5657
};
5758
5859
@@ -76,6 +77,12 @@ ttm_bo_global_release(), respectively. Also, like the previous
7677
object, ttm_global_item_ref() is used to create an initial reference
7778
count for the TTM, which will call your initialization function.
7879

80+
See the radeon_ttm.c file for an example of usage.
81+
82+
.. kernel-doc:: drivers/gpu/drm/drm_global.c
83+
:export:
84+
85+
7986
The Graphics Execution Manager (GEM)
8087
====================================
8188

‎drivers/gpu/drm/drm_global.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ void drm_global_release(void)
6363
}
6464
}
6565

66+
/**
67+
* drm_global_item_ref - Initialize and acquire reference to memory
68+
* object
69+
* @ref: Object for initialization
70+
*
71+
* This initializes a memory object, allocating memory and calling the
72+
* .init() hook. Further calls will increase the reference count for
73+
* that item.
74+
*
75+
* Returns:
76+
* Zero on success, non-zero otherwise.
77+
*/
6678
int drm_global_item_ref(struct drm_global_reference *ref)
6779
{
6880
int ret = 0;
@@ -97,6 +109,17 @@ int drm_global_item_ref(struct drm_global_reference *ref)
97109
}
98110
EXPORT_SYMBOL(drm_global_item_ref);
99111

112+
/**
113+
* drm_global_item_unref - Drop reference to memory
114+
* object
115+
* @ref: Object being removed
116+
*
117+
* Drop a reference to the memory object and eventually call the
118+
* release() hook. The allocated object should be dropped in the
119+
* release() hook or before calling this function
120+
*
121+
*/
122+
100123
void drm_global_item_unref(struct drm_global_reference *ref)
101124
{
102125
struct drm_global_item *item = &glob[ref->global_type];

0 commit comments

Comments
 (0)