Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Gabriel Krisman Bertazi and committed by
Daniel Vetter
b834ff86 5bbf92d3

+40 -10
+17 -10
Documentation/gpu/drm-mm.rst
··· 34 34 ------------------ 35 35 36 36 **Warning** 37 - 38 37 This section is outdated. 39 38 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. 45 45 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: 47 48 48 49 .. code-block:: c 49 50 50 - struct ttm_global_reference { 51 + struct drm_global_reference { 51 52 enum ttm_global_types global_type; 52 53 size_t size; 53 54 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 *); 56 57 }; 57 58 58 59 ··· 76 75 ttm_bo_global_release(), respectively. Also, like the previous 77 76 object, ttm_global_item_ref() is used to create an initial reference 78 77 count for the TTM, which will call your initialization function. 78 + 79 + See the radeon_ttm.c file for an example of usage. 80 + 81 + .. kernel-doc:: drivers/gpu/drm/drm_global.c 82 + :export: 83 + 79 84 80 85 The Graphics Execution Manager (GEM) 81 86 ====================================
+23
drivers/gpu/drm/drm_global.c
··· 63 63 } 64 64 } 65 65 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 + */ 66 78 int drm_global_item_ref(struct drm_global_reference *ref) 67 79 { 68 80 int ret = 0; ··· 108 96 return ret; 109 97 } 110 98 EXPORT_SYMBOL(drm_global_item_ref); 99 + 100 + /** 101 + * drm_global_item_unref - Drop reference to memory 102 + * object 103 + * @ref: Object being removed 104 + * 105 + * Drop a reference to the memory object and eventually call the 106 + * release() hook. The allocated object should be dropped in the 107 + * release() hook or before calling this function 108 + * 109 + */ 111 110 112 111 void drm_global_item_unref(struct drm_global_reference *ref) 113 112 {