diff --git a/spa/include/spa/buffer/buffer.h b/spa/include/spa/buffer/buffer.h index e29be088a..2b60bb8f5 100644 --- a/spa/include/spa/buffer/buffer.h +++ b/spa/include/spa/buffer/buffer.h @@ -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 */ }; diff --git a/spa/include/spa/buffer/meta.h b/spa/include/spa/buffer/meta.h index 42e6a3fb7..397441347 100644 --- a/spa/include/spa/buffer/meta.h +++ b/spa/include/spa/buffer/meta.h @@ -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. */ +}; + /** * \} */ diff --git a/spa/include/spa/buffer/type-info.h b/spa/include/spa/buffer/type-info.h index bb4103f3f..29f5df5fc 100644 --- a/spa/include/spa/buffer/type-info.h +++ b/spa/include/spa/buffer/type-info.h @@ -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 }, }; diff --git a/spa/include/spa/param/buffers.h b/spa/include/spa/param/buffers.h index 87b531dd8..9c157ae2a 100644 --- a/spa/include/spa/param/buffers.h +++ b/spa/include/spa/param/buffers.h @@ -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 */ diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 24c00fe1d..0d24209d7 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -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; diff --git a/test/test-spa-buffer.c b/test/test-spa-buffer.c index eb4076951..9b0458053 100644 --- a/test/test-spa-buffer.c +++ b/test/test-spa-buffer.c @@ -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; }