diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h new file mode 100644 index 00000000..629dc694 --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * drivers/video/tegra/host/gk20a/fence_gk20a.h | ||
3 | * | ||
4 | * GK20A Fences | ||
5 | * | ||
6 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms and conditions of the GNU General Public License, | ||
10 | * version 2, as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | */ | ||
17 | #ifndef _GK20A_FENCE_H_ | ||
18 | #define _GK20A_FENCE_H_ | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | #include <linux/kref.h> | ||
22 | #include <linux/wait.h> | ||
23 | |||
24 | struct platform_device; | ||
25 | struct sync_timeline; | ||
26 | struct sync_fence; | ||
27 | struct gk20a_semaphore; | ||
28 | struct channel_gk20a; | ||
29 | |||
30 | struct gk20a_fence_ops; | ||
31 | |||
32 | struct gk20a_fence { | ||
33 | /* Valid for all fence types: */ | ||
34 | struct kref ref; | ||
35 | bool wfi; | ||
36 | struct sync_fence *sync_fence; | ||
37 | const struct gk20a_fence_ops *ops; | ||
38 | |||
39 | /* Valid for fences created from semaphores: */ | ||
40 | struct gk20a_semaphore *semaphore; | ||
41 | wait_queue_head_t *semaphore_wq; | ||
42 | |||
43 | /* Valid for fences created from syncpoints: */ | ||
44 | struct platform_device *host1x_pdev; | ||
45 | u32 syncpt_id; | ||
46 | u32 syncpt_value; | ||
47 | }; | ||
48 | |||
49 | /* Fences can be created from semaphores or syncpoint (id, value) pairs */ | ||
50 | struct gk20a_fence *gk20a_fence_from_semaphore( | ||
51 | struct sync_timeline *timeline, | ||
52 | struct gk20a_semaphore *semaphore, | ||
53 | wait_queue_head_t *semaphore_wq, | ||
54 | struct sync_fence *dependency, | ||
55 | bool wfi); | ||
56 | |||
57 | struct gk20a_fence *gk20a_fence_from_syncpt( | ||
58 | struct platform_device *host1x_pdev, | ||
59 | u32 id, u32 value, bool wfi); | ||
60 | |||
61 | /* Fence operations */ | ||
62 | void gk20a_fence_put(struct gk20a_fence *f); | ||
63 | struct gk20a_fence *gk20a_fence_get(struct gk20a_fence *f); | ||
64 | int gk20a_fence_wait(struct gk20a_fence *f, int timeout); | ||
65 | bool gk20a_fence_is_expired(struct gk20a_fence *f); | ||
66 | int gk20a_fence_install_fd(struct gk20a_fence *f); | ||
67 | |||
68 | #endif | ||