diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
| commit | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch) | |
| tree | 4ef34501728a087be24f4ba0af90f91486bf780b /include/gk20a/fence_gk20a.h | |
| parent | 306a03d18b305e4e573be3b2931978fa10679eb9 (diff) | |
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time
being. Only a couple structs are required, so it should be fairly
easy to remove this dependency at some point in the future.
Diffstat (limited to 'include/gk20a/fence_gk20a.h')
| -rw-r--r-- | include/gk20a/fence_gk20a.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/gk20a/fence_gk20a.h b/include/gk20a/fence_gk20a.h new file mode 100644 index 0000000..0311279 --- /dev/null +++ b/include/gk20a/fence_gk20a.h | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* | ||
| 2 | * drivers/video/tegra/host/gk20a/fence_gk20a.h | ||
| 3 | * | ||
| 4 | * GK20A Fences | ||
| 5 | * | ||
| 6 | * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. | ||
| 7 | * | ||
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 9 | * copy of this software and associated documentation files (the "Software"), | ||
| 10 | * to deal in the Software without restriction, including without limitation | ||
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 12 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 13 | * Software is furnished to do so, subject to the following conditions: | ||
| 14 | * | ||
| 15 | * The above copyright notice and this permission notice shall be included in | ||
| 16 | * all copies or substantial portions of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 24 | * DEALINGS IN THE SOFTWARE. | ||
| 25 | */ | ||
| 26 | #ifndef NVGPU_GK20A_FENCE_GK20A_H | ||
| 27 | #define NVGPU_GK20A_FENCE_GK20A_H | ||
| 28 | |||
| 29 | #include <nvgpu/types.h> | ||
| 30 | #include <nvgpu/kref.h> | ||
| 31 | #include <nvgpu/os_fence.h> | ||
| 32 | |||
| 33 | struct platform_device; | ||
| 34 | struct nvgpu_semaphore; | ||
| 35 | struct channel_gk20a; | ||
| 36 | struct gk20a; | ||
| 37 | struct nvgpu_os_fence; | ||
| 38 | |||
| 39 | struct gk20a_fence_ops; | ||
| 40 | |||
| 41 | struct gk20a_fence { | ||
| 42 | struct gk20a *g; | ||
| 43 | |||
| 44 | /* Valid for all fence types: */ | ||
| 45 | bool valid; | ||
| 46 | struct nvgpu_ref ref; | ||
| 47 | const struct gk20a_fence_ops *ops; | ||
| 48 | |||
| 49 | struct nvgpu_os_fence os_fence; | ||
| 50 | |||
| 51 | /* Valid for fences created from semaphores: */ | ||
| 52 | struct nvgpu_semaphore *semaphore; | ||
| 53 | struct nvgpu_cond *semaphore_wq; | ||
| 54 | |||
| 55 | /* Valid for fences created from syncpoints: */ | ||
| 56 | struct nvgpu_nvhost_dev *nvhost_dev; | ||
| 57 | u32 syncpt_id; | ||
| 58 | u32 syncpt_value; | ||
| 59 | |||
| 60 | /* Valid for fences part of a pre-allocated fence pool */ | ||
| 61 | struct nvgpu_allocator *allocator; | ||
| 62 | }; | ||
| 63 | |||
| 64 | /* Fences can be created from semaphores or syncpoint (id, value) pairs */ | ||
| 65 | int gk20a_fence_from_semaphore( | ||
| 66 | struct gk20a_fence *fence_out, | ||
| 67 | struct nvgpu_semaphore *semaphore, | ||
| 68 | struct nvgpu_cond *semaphore_wq, | ||
| 69 | struct nvgpu_os_fence os_fence); | ||
| 70 | |||
| 71 | int gk20a_fence_from_syncpt( | ||
| 72 | struct gk20a_fence *fence_out, | ||
| 73 | struct nvgpu_nvhost_dev *nvhost_dev, | ||
| 74 | u32 id, u32 value, | ||
| 75 | struct nvgpu_os_fence os_fence); | ||
| 76 | |||
| 77 | int gk20a_alloc_fence_pool( | ||
| 78 | struct channel_gk20a *c, | ||
| 79 | unsigned int count); | ||
| 80 | |||
| 81 | void gk20a_free_fence_pool( | ||
| 82 | struct channel_gk20a *c); | ||
| 83 | |||
| 84 | struct gk20a_fence *gk20a_alloc_fence( | ||
| 85 | struct channel_gk20a *c); | ||
| 86 | |||
| 87 | void gk20a_init_fence(struct gk20a_fence *f, | ||
| 88 | const struct gk20a_fence_ops *ops, | ||
| 89 | struct nvgpu_os_fence os_fence); | ||
| 90 | |||
| 91 | /* Fence operations */ | ||
| 92 | void gk20a_fence_put(struct gk20a_fence *f); | ||
| 93 | struct gk20a_fence *gk20a_fence_get(struct gk20a_fence *f); | ||
| 94 | int gk20a_fence_wait(struct gk20a *g, struct gk20a_fence *f, | ||
| 95 | unsigned long timeout); | ||
| 96 | bool gk20a_fence_is_expired(struct gk20a_fence *f); | ||
| 97 | bool gk20a_fence_is_valid(struct gk20a_fence *f); | ||
| 98 | int gk20a_fence_install_fd(struct gk20a_fence *f, int fd); | ||
| 99 | |||
| 100 | #endif /* NVGPU_GK20A_FENCE_GK20A_H */ | ||
