2 * Copyright © 2021 NVIDIA Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 #include <sys/ioctl.h>
35 drm_tegra_syncpoint_new(struct drm_tegra
*drm
,
36 struct drm_tegra_syncpoint
**syncptp
)
38 struct drm_tegra_syncpoint_allocate args
;
39 struct drm_tegra_syncpoint
*syncpt
;
42 syncpt
= calloc(1, sizeof(*syncpt
));
46 memset(&args
, 0, sizeof(args
));
48 err
= ioctl(drm
->fd
, DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE
, &args
);
63 drm_tegra_syncpoint_free(struct drm_tegra_syncpoint
*syncpt
)
65 struct drm_tegra_syncpoint_free args
;
66 struct drm_tegra
*drm
= syncpt
->drm
;
72 memset(&args
, 0, sizeof(args
));
75 err
= ioctl(drm
->fd
, DRM_IOCTL_TEGRA_SYNCPOINT_FREE
, &args
);
85 drm_tegra_fence_wait(struct drm_tegra_fence
*fence
, unsigned long timeout
)
87 struct drm_tegra_syncpoint_wait args
;
88 struct drm_tegra
*drm
= fence
->drm
;
91 memset(&args
, 0, sizeof(args
));
93 args
.id
= fence
->syncpt
;
94 args
.threshold
= fence
->value
;
96 err
= ioctl(drm
->fd
, DRM_IOCTL_TEGRA_SYNCPOINT_WAIT
, &args
);