mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-26 00:52:21 +00:00
render/drm_syncobj: add wlr_drm_syncobj_timeline_import()
This commit is contained in:
parent
7fc00ef777
commit
ea75aa3065
@ -37,6 +37,11 @@ struct wlr_drm_syncobj_timeline {
|
|||||||
* Create a new synchronization timeline.
|
* Create a new synchronization timeline.
|
||||||
*/
|
*/
|
||||||
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_create(int drm_fd);
|
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_create(int drm_fd);
|
||||||
|
/**
|
||||||
|
* Import a timeline from a drm_syncobj FD.
|
||||||
|
*/
|
||||||
|
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_import(int drm_fd,
|
||||||
|
int drm_syncobj_fd);
|
||||||
/**
|
/**
|
||||||
* Reference a synchronization timeline.
|
* Reference a synchronization timeline.
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,24 @@ struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_create(int drm_fd) {
|
|||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_import(int drm_fd,
|
||||||
|
int drm_syncobj_fd) {
|
||||||
|
struct wlr_drm_syncobj_timeline *timeline = calloc(1, sizeof(*timeline));
|
||||||
|
if (timeline == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
timeline->drm_fd = drm_fd;
|
||||||
|
timeline->n_refs = 1;
|
||||||
|
|
||||||
|
if (drmSyncobjFDToHandle(drm_fd, drm_syncobj_fd, &timeline->handle) != 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR, "drmSyncobjFDToHandle failed");
|
||||||
|
free(timeline);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return timeline;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_ref(struct wlr_drm_syncobj_timeline *timeline) {
|
struct wlr_drm_syncobj_timeline *wlr_drm_syncobj_timeline_ref(struct wlr_drm_syncobj_timeline *timeline) {
|
||||||
timeline->n_refs++;
|
timeline->n_refs++;
|
||||||
return timeline;
|
return timeline;
|
||||||
|
Loading…
Reference in New Issue
Block a user