History

dma-buf: add DMA_BUF_SET_NAME ioctls

This patch adds complimentary DMA_BUF_SET_NAME ioctls, which lets userspace processes attach a free-form name to each buffer. This information can be extremely helpful for tracking and accounting shared buffers. For example, on Android, we know what each buffer will be used for at allocation time: GL, multimedia, camera, etc. The userspace allocator can use DMA_BUF_SET_NAME to associate that information with the buffer, so we can later give developers a breakdown of how much memory they're allocating for graphics, camera, etc.

Greg Hackmann committed 7 years ago

Commit bb2bb901 parent ed63bb13 files · +69 −4Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/dma-buf.h+4−1
@@ -280,10 +280,12 @@ struct dma_buf_ops { · 279 unmodified lines
280 * @file: file pointer used for sharing buffers across, and for refcounting.280 * @file: file pointer used for sharing buffers across, and for refcounting.
281 * @attachments: list of dma_buf_attachment that denotes all devices attached.281 * @attachments: list of dma_buf_attachment that denotes all devices attached.
282 * @ops: dma_buf_ops associated with this buffer object.282 * @ops: dma_buf_ops associated with this buffer object.
283 * @lock: used internally to serialize list manipulation, attach/detach and vmap/unmap283 * @lock: used internally to serialize list manipulation, attach/detach and
284 * vmap/unmap, and accesses to name
284 * @vmapping_counter: used internally to refcnt the vmaps285 * @vmapping_counter: used internally to refcnt the vmaps
285 * @vmap_ptr: the current vmap ptr if vmapping_counter > 0286 * @vmap_ptr: the current vmap ptr if vmapping_counter > 0
286 * @exp_name: name of the exporter; useful for debugging.287 * @exp_name: name of the exporter; useful for debugging.
288 * @name: userspace-provided name; useful for accounting and debugging.
287 * @owner: pointer to exporter module; used for refcounting when exporter is a289 * @owner: pointer to exporter module; used for refcounting when exporter is a
288 * kernel module.290 * kernel module.
289 * @list_node: node for dma_buf accounting and debugging.291 * @list_node: node for dma_buf accounting and debugging.
@@ -311,6 +313,7 @@ struct dma_buf { · 21 unmodified lines
311 unsigned vmapping_counter;313 unsigned vmapping_counter;
312 void *vmap_ptr;314 void *vmap_ptr;
313 const char *exp_name;315 const char *exp_name;
316 const char *name;
314 struct module *owner;317 struct module *owner;
315 struct list_head list_node;318 struct list_head list_node;
316 void *priv;319 void *priv;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t