mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-14 06:59:43 -05:00
render/timeline: add wlr_render_timeline_import
This commit is contained in:
parent
f80f89b560
commit
7ae10e078a
2 changed files with 22 additions and 0 deletions
|
|
@ -30,6 +30,11 @@ struct wlr_render_timeline;
|
|||
* Create a new synchronization timeline.
|
||||
*/
|
||||
struct wlr_render_timeline *wlr_render_timeline_create(int drm_fd);
|
||||
/**
|
||||
* Import a timeline from a drm_syncobj FD.
|
||||
*/
|
||||
struct wlr_render_timeline *wlr_render_timeline_import(int drm_fd,
|
||||
int drm_syncobj_fd);
|
||||
/**
|
||||
* Destroy a synchronization timeline.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,23 @@ struct wlr_render_timeline *wlr_render_timeline_create(int drm_fd) {
|
|||
return timeline;
|
||||
}
|
||||
|
||||
struct wlr_render_timeline *wlr_render_timeline_import(int drm_fd,
|
||||
int drm_syncobj_fd) {
|
||||
struct wlr_render_timeline *timeline = calloc(1, sizeof(*timeline));
|
||||
if (timeline == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
timeline->drm_fd = drm_fd;
|
||||
|
||||
if (drmSyncobjFDToHandle(drm_fd, drm_syncobj_fd, &timeline->handle) != 0) {
|
||||
wlr_log_errno(WLR_ERROR, "drmSyncobjFDToHandle failed");
|
||||
free(timeline);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return timeline;
|
||||
}
|
||||
|
||||
void wlr_render_timeline_destroy(struct wlr_render_timeline *timeline) {
|
||||
drmSyncobjDestroy(timeline->drm_fd, timeline->handle);
|
||||
free(timeline);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue