mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-04 15:10:20 +00:00
buffer: add GenericFd memory type
Add a Generic fd type. These could be eventfd or timerfd, the meaning can depend on extra metadata.
This commit is contained in:
parent
77f3b7f6e4
commit
f3fe20bdde
|
@ -27,9 +27,17 @@ enum spa_data_type {
|
|||
SPA_DATA_Invalid,
|
||||
SPA_DATA_MemPtr, /**< pointer to memory, the data field in
|
||||
* struct spa_data is set. */
|
||||
SPA_DATA_MemFd, /**< generic fd, mmap to get to memory */
|
||||
SPA_DATA_DmaBuf, /**< fd to dmabuf memory */
|
||||
SPA_DATA_MemId, /**< memory is identified with an id */
|
||||
SPA_DATA_MemFd, /**< memfd, mmap to get to memory. */
|
||||
SPA_DATA_DmaBuf, /**< fd to dmabuf memory. This might not be readily
|
||||
* mappable (unless the MAPPABLE flag is set) and should
|
||||
* normally be handled with DMABUF apis. */
|
||||
SPA_DATA_MemId, /**< memory is identified with an id. The actual memory
|
||||
* can be obtained in some other way and can be identified
|
||||
* with this id. */
|
||||
SPA_DATA_GenericFd, /**< generic fd, type and usage might be in metadata. If
|
||||
* there is a size and MAPPABLE flag, this can be mmapped
|
||||
* to obtain a memory region. The semantics of memfd might
|
||||
* not be available (SEALING, ...) */
|
||||
|
||||
_SPA_DATA_LAST, /**< not part of ABI */
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ static const struct spa_type_info spa_type_data_type[] = {
|
|||
{ SPA_DATA_MemFd, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_FD_BASE "MemFd", NULL },
|
||||
{ SPA_DATA_DmaBuf, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_FD_BASE "DmaBuf", NULL },
|
||||
{ SPA_DATA_MemId, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_BASE "MemId", NULL },
|
||||
{ SPA_DATA_GenericFd, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_BASE "GenericFd", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
|
@ -855,6 +855,7 @@ do_port_use_buffers(struct impl *impl,
|
|||
switch (d->type) {
|
||||
case SPA_DATA_DmaBuf:
|
||||
case SPA_DATA_MemFd:
|
||||
case SPA_DATA_GenericFd:
|
||||
{
|
||||
uint32_t flags = PW_MEMBLOCK_FLAG_DONT_CLOSE;
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ PWTEST(buffer_abi_types)
|
|||
pwtest_int_eq(SPA_DATA_MemFd, 2);
|
||||
pwtest_int_eq(SPA_DATA_DmaBuf, 3);
|
||||
pwtest_int_eq(SPA_DATA_MemId, 4);
|
||||
pwtest_int_eq(_SPA_DATA_LAST, 5);
|
||||
pwtest_int_eq(SPA_DATA_GenericFd, 5);
|
||||
pwtest_int_eq(_SPA_DATA_LAST, 6);
|
||||
|
||||
/* meta */
|
||||
pwtest_int_eq(SPA_META_Invalid, 0);
|
||||
|
|
Loading…
Reference in a new issue