|
Ream v0.1.0-1
C++ graphics library for Linux
|
A DRM synchronization object (syncobj) timeline for explicit synchronization. More...
#include <RDRMTimeline.h>
Inheritance diagram for RDRMTimeline:Public Types | |
| using | Callback = std::function< void(RDRMTimeline *timeline)> |
| Callback type invoked by waitAsync() when a point condition is met. | |
Public Member Functions | |
| CZSpFd | exportTimeline () const noexcept |
| Exports the whole timeline syncobj as a file descriptor. | |
| CZSpFd | exportSyncFile (UInt64 point) const noexcept |
Exports the fence at a given timeline point as a sync_file file descriptor. | |
| bool | importSyncFile (int fd, UInt64 point, CZOwn own) noexcept |
Imports a sync_file fence into a given timeline point. | |
| bool | transferPoint (UInt64 srcPoint, std::shared_ptr< RDRMTimeline > dst, UInt64 dstPoint) noexcept |
| Copies the fence at a source point of this timeline to a point of another timeline. | |
| int | waitSync (UInt64 point, UInt32 flags, Int64 timeoutNs=0) noexcept |
| Synchronously waits for a timeline point. | |
| std::shared_ptr< CZEventSource > | waitAsync (UInt64 point, UInt32 flags, Callback callback) noexcept |
| Asynchronously waits for a timeline point via an eventfd-backed event source. | |
| bool | signalPoint (UInt64 point) noexcept |
| Immediately signals a timeline point. | |
| std::shared_ptr< RCore > | core () const noexcept |
| Returns the internal shared reference to the core instance. | |
| RDevice * | device () const noexcept |
| Returns the DRM device this timeline belongs to. | |
| UInt32 | handle () const noexcept |
| Returns the DRM syncobj handle backing this timeline. | |
| ~RDRMTimeline () noexcept | |
| Destroys the underlying DRM syncobj. | |
Public Member Functions inherited from RObject | |
| RObject ()=default | |
| Constructs a default RObject. | |
Static Public Member Functions | |
| static std::shared_ptr< RDRMTimeline > | Make (RDevice *device=nullptr) noexcept |
| Creates a new empty timeline syncobj. | |
| static std::shared_ptr< RDRMTimeline > | Import (int timelineFd, CZOwn own, RDevice *device=nullptr) noexcept |
| Imports a timeline from an exported syncobj file descriptor. | |
A DRM synchronization object (syncobj) timeline for explicit synchronization.
Wraps a DRM timeline syncobj, which associates fences with monotonically increasing 64-bit timeline points. Timelines are used for explicit GPU/display synchronization: a producer signals a point once its work completes, and consumers wait on that point before accessing the shared buffer.
A timeline is bound to a specific DRM device, which must advertise the Timeline capability. Timelines can be exported/imported as file descriptors for sharing across processes, and individual points can be exported to or imported from sync_file file descriptors to interoperate with implicit-sync APIs.
Use Make() to create a new timeline, or Import() to adopt an exported one.
| using Callback = std::function<void(RDRMTimeline *timeline)> |
Callback type invoked by waitAsync() when a point condition is met.
| timeline | The timeline that triggered the callback. |
|
noexcept |
Destroys the underlying DRM syncobj.
|
staticnoexcept |
Creates a new empty timeline syncobj.
| device | The DRM device to create the timeline on. If nullptr, RCore::mainDevice() is used. The device must support the Timeline capability. |
|
staticnoexcept |
Imports a timeline from an exported syncobj file descriptor.
| timelineFd | A file descriptor previously produced by exportTimeline(). |
| own | CZOwn::Own to close timelineFd before returning (in all cases), or CZOwn::Borrow to leave it open for the caller to manage. |
| device | The DRM device to import onto. If nullptr, RCore::mainDevice() is used. The device must support the Timeline capability. |
|
noexcept |
Exports the whole timeline syncobj as a file descriptor.
The returned descriptor can be shared and re-imported via Import().
|
noexcept |
Exports the fence at a given timeline point as a sync_file file descriptor.
| point | The timeline point whose fence should be exported. |
|
noexcept |
Imports a sync_file fence into a given timeline point.
| fd | A sync_file file descriptor. |
| point | The timeline point to associate the imported fence with. |
| own | CZOwn::Own to close fd before returning (in all cases), or CZOwn::Borrow to leave it open for the caller to manage. |
|
noexcept |
Copies the fence at a source point of this timeline to a point of another timeline.
| srcPoint | The source point on this timeline. |
| dst | The destination timeline, which must belong to the same device as this one. |
| dstPoint | The destination point on dst. |
dst is null, belongs to a different device, or the transfer fails.
|
noexcept |
Synchronously waits for a timeline point.
| point | The timeline point to wait on. |
| flags | DRM syncobj wait flags (e.g. DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to become available rather than signalled). |
| timeoutNs | Absolute/relative timeout in nanoseconds as accepted by the DRM syncobj timeline wait (0 for an immediate poll). |
|
noexcept |
Asynchronously waits for a timeline point via an eventfd-backed event source.
Registers an eventfd with the DRM syncobj and returns a CZEventSource that invokes callback once the point condition is met. Keep the returned event source alive for as long as the wait should remain active.
| point | The timeline point to wait on. |
| flags | Zero to wait for the point to be signalled, or DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be available for the point. |
| callback | The callback to invoke; must not be null. |
|
noexcept |
Immediately signals a timeline point.
| point | The timeline point to signal. |
|
inlinenoexcept |
Returns the internal shared reference to the core instance.
This ensures the current RCore instance stays alive while the timeline exists.
|
inlinenoexcept |
Returns the DRM device this timeline belongs to.
|
inlinenoexcept |
Returns the DRM syncobj handle backing this timeline.