Skip to content

Commit e77d040

Browse files
yunxialiChristianKoenigAMD
authored andcommitted
Documentation/gpu: Clarify drm memory stats definition
Define how to handle buffers with multiple possible placement so we don't get incompatible implementations. Callout the resident requirement for drm-purgeable- explicitly. Remove the requirement for there to be only drm-memory- or only drm-resident-, it's not what's implemented and having both is better for back-compat. Also re-order the paragraphs to flow better. Signed-off-by: Yunxiang Li <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Christian König <[email protected]>
1 parent bebf2eb commit e77d040

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

Documentation/gpu/drm-usage-stats.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -145,57 +145,57 @@ both.
145145
Memory
146146
^^^^^^
147147

148-
- drm-memory-<region>: <uint> [KiB|MiB]
149-
150-
Each possible memory type which can be used to store buffer objects by the
151-
GPU in question shall be given a stable and unique name to be returned as the
152-
string here.
148+
Each possible memory type which can be used to store buffer objects by the GPU
149+
in question shall be given a stable and unique name to be used as the "<region>"
150+
string.
153151

154152
The region name "memory" is reserved to refer to normal system memory.
155153

156-
Value shall reflect the amount of storage currently consumed by the buffer
154+
The value shall reflect the amount of storage currently consumed by the buffer
157155
objects belong to this client, in the respective memory region.
158156

159157
Default unit shall be bytes with optional unit specifiers of 'KiB' or 'MiB'
160158
indicating kibi- or mebi-bytes.
161159

162-
This key is deprecated and is an alias for drm-resident-<region>. Only one of
163-
the two should be present in the output.
164-
165-
- drm-shared-<region>: <uint> [KiB|MiB]
160+
- drm-total-<region>: <uint> [KiB|MiB]
166161

167-
The total size of buffers that are shared with another file (e.g., have more
168-
than a single handle).
162+
The total size of all requested buffers, including both shared and private
163+
memory. The backing store for the buffers does not need to be currently
164+
instantiated to count under this category. To avoid double-counting, if a buffer
165+
has multiple regions where it can be allocated to, the implementation should
166+
consistently select a single region for accounting purposes.
169167

170-
- drm-total-<region>: <uint> [KiB|MiB]
168+
- drm-shared-<region>: <uint> [KiB|MiB]
171169

172-
The total size of all created buffers including shared and private memory. The
173-
backing store for the buffers does not have to be currently instantiated to be
174-
counted under this category.
170+
The total size of buffers that are shared with another file (i.e., have more
171+
than one handle). The same requirement to avoid double-counting that applies to
172+
drm-total-<region> also applies here.
175173

176174
- drm-resident-<region>: <uint> [KiB|MiB]
177175

178-
The total size of buffers that are resident (have their backing store present or
179-
instantiated) in the specified region.
176+
The total size of buffers that are resident (i.e., have their backing store
177+
present or instantiated) in the specified region.
178+
179+
- drm-memory-<region>: <uint> [KiB|MiB]
180180

181-
This is an alias for drm-memory-<region> and only one of the two should be
182-
present in the output.
181+
This key is deprecated and is only printed by amdgpu; it is an alias for
182+
drm-resident-<region>.
183183

184184
- drm-purgeable-<region>: <uint> [KiB|MiB]
185185

186-
The total size of buffers that are purgeable.
186+
The total size of buffers that are resident and purgeable.
187187

188-
For example drivers which implement a form of 'madvise' like functionality can
189-
here count buffers which have instantiated backing store, but have been marked
190-
with an equivalent of MADV_DONTNEED.
188+
For example, drivers that implement functionality similar to 'madvise' can count
189+
buffers that have instantiated backing stores but have been marked with an
190+
equivalent of MADV_DONTNEED.
191191

192192
- drm-active-<region>: <uint> [KiB|MiB]
193193

194194
The total size of buffers that are active on one or more engines.
195195

196-
One practical example of this can be presence of unsignaled fences in an GEM
197-
buffer reservation object. Therefore the active category is a subset of
198-
resident.
196+
One practical example of this could be the presence of unsignaled fences in a
197+
GEM buffer reservation object. Therefore, the active category is a subset of the
198+
resident category.
199199

200200
Implementation Details
201201
======================

0 commit comments

Comments
 (0)