mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-28 05:40:26 -04:00
meta: add explicit sync metadata and data type
Change the GenericFd data type to SyncObj. It's probably better to explicitly state the data type than to make something generic. Otherwise we would need to transfer the specific fd type somewhere else and there is no room for that in the buffer and the the metadata is not a good idea either because it can be modified and corrupted at runtime. Add the SyncTimeline metadata. This contains 2 points on two timelines (SyncObj datas in the buffer). The buffer can be accessed when the acquire_point is signaled on the timeline and when the buffer can be released, the release_point on the timeline should be signaled.
This commit is contained in:
parent
31de44f679
commit
9bb5780cc2
6 changed files with 26 additions and 10 deletions
|
|
@ -34,10 +34,8 @@ enum spa_data_type {
|
|||
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_SyncObj, /**< a syncobj, usually requires a spa_meta_sync_timeline metadata
|
||||
* with timeline points. */
|
||||
|
||||
_SPA_DATA_LAST, /**< not part of ABI */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ enum spa_meta_type {
|
|||
* associated with the data */
|
||||
SPA_META_Busy, /**< don't write to buffer when count > 0 */
|
||||
SPA_META_VideoTransform, /**< struct spa_meta_transform */
|
||||
SPA_META_SyncTimeline, /**< struct spa_meta_sync_timeline */
|
||||
|
||||
_SPA_META_LAST, /**< not part of ABI/API */
|
||||
};
|
||||
|
|
@ -161,6 +162,21 @@ struct spa_meta_videotransform {
|
|||
* one of enum spa_meta_videotransform_value */
|
||||
};
|
||||
|
||||
/**
|
||||
* A timeline point for explicit sync
|
||||
*
|
||||
* Metadata to describe the time on the timeline when the buffer
|
||||
* can be acquired and when it can be reused.
|
||||
*/
|
||||
struct spa_meta_sync_timeline {
|
||||
uint32_t flags;
|
||||
uint32_t padding;
|
||||
uint64_t acquire_point; /**< the timeline acquire point, this is when the data
|
||||
* can be accessed. */
|
||||
uint64_t release_point; /**< the timeline release point, this timeline point should
|
||||
* be signaled when the data is no longer accessed. */
|
||||
};
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,7 +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 },
|
||||
{ SPA_DATA_SyncObj, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_BASE "SyncObj", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
@ -61,6 +61,7 @@ static const struct spa_type_info spa_type_meta_type[] = {
|
|||
{ SPA_META_Control, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Control", NULL },
|
||||
{ SPA_META_Busy, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Busy", NULL },
|
||||
{ SPA_META_VideoTransform, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "VideoTransform", NULL },
|
||||
{ SPA_META_SyncTimeline, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "SyncTimeline", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ enum spa_param_buffers {
|
|||
/** properties for SPA_TYPE_OBJECT_ParamMeta */
|
||||
enum spa_param_meta {
|
||||
SPA_PARAM_META_START,
|
||||
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
|
||||
SPA_PARAM_META_size, /**< the expected maximum size the meta (Int) */
|
||||
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
|
||||
SPA_PARAM_META_size, /**< the expected maximum size the meta (Int) */
|
||||
};
|
||||
|
||||
/** properties for SPA_TYPE_OBJECT_ParamIO */
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ do_port_use_buffers(struct impl *impl,
|
|||
switch (d->type) {
|
||||
case SPA_DATA_DmaBuf:
|
||||
case SPA_DATA_MemFd:
|
||||
case SPA_DATA_GenericFd:
|
||||
case SPA_DATA_SyncObj:
|
||||
{
|
||||
uint32_t flags = PW_MEMBLOCK_FLAG_DONT_CLOSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ 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_GenericFd, 5);
|
||||
pwtest_int_eq(SPA_DATA_SyncObj, 5);
|
||||
pwtest_int_eq(_SPA_DATA_LAST, 6);
|
||||
|
||||
/* meta */
|
||||
|
|
@ -30,7 +30,8 @@ PWTEST(buffer_abi_types)
|
|||
pwtest_int_eq(SPA_META_Control, 6);
|
||||
pwtest_int_eq(SPA_META_Busy, 7);
|
||||
pwtest_int_eq(SPA_META_VideoTransform, 8);
|
||||
pwtest_int_eq(_SPA_META_LAST, 9);
|
||||
pwtest_int_eq(SPA_META_SyncTimeline, 9);
|
||||
pwtest_int_eq(_SPA_META_LAST, 10);
|
||||
|
||||
return PWTEST_PASS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue