mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-10 13:29:44 -05:00
render/timeline: add wlr_render_timeline_transfer
This commit is contained in:
parent
3096cf7964
commit
43df0bd565
2 changed files with 21 additions and 0 deletions
|
|
@ -39,6 +39,13 @@ struct wlr_render_timeline *wlr_render_timeline_import(int drm_fd,
|
|||
* Destroy a synchronization timeline.
|
||||
*/
|
||||
void wlr_render_timeline_destroy(struct wlr_render_timeline *timeline);
|
||||
/**
|
||||
* Transfer a point from a timeline to another.
|
||||
*
|
||||
* Both timelines must have been created with the same DRM FD.
|
||||
*/
|
||||
bool wlr_render_timeline_transfer(struct wlr_render_timeline *dst,
|
||||
uint64_t dst_point, struct wlr_render_timeline *src, uint64_t src_point);
|
||||
/**
|
||||
* Export a timeline point as a sync_file FD.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <assert.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -48,6 +49,19 @@ void wlr_render_timeline_destroy(struct wlr_render_timeline *timeline) {
|
|||
free(timeline);
|
||||
}
|
||||
|
||||
bool wlr_render_timeline_transfer(struct wlr_render_timeline *dst,
|
||||
uint64_t dst_point, struct wlr_render_timeline *src, uint64_t src_point) {
|
||||
assert(dst->drm_fd == src->drm_fd);
|
||||
|
||||
if (drmSyncobjTransfer(dst->drm_fd, dst->handle, dst_point,
|
||||
src->handle, src_point, 0) != 0) {
|
||||
wlr_log_errno(WLR_ERROR, "drmSyncobjTransfer failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int wlr_render_timeline_export_sync_file(struct wlr_render_timeline *timeline,
|
||||
uint64_t src_point) {
|
||||
int sync_file_fd = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue