diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-04-18 15:59:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-06-15 20:47:31 -0400 |
commit | 2a2c16af5f9f1ccfc93a13e820d5381e5c881e92 (patch) | |
tree | 2e5d7b042270a649978e5bb540857012c85fb5b5 /drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c | |
parent | 98d996f4ffb0137d119b5849cae46d7b7e5693e1 (diff) |
gpu: nvgpu: Move Linux files away from common
Move all Linux source code files to drivers/gpu/nvgpu/os/linux from
drivers/gpu/nvgpu/common/linux. This changes the meaning of common
to be OS independent.
JIRA NVGPU-598
JIRA NVGPU-601
Change-Id: Ib7f2a43d3688bb0d0b7dcc48469a6783fd988ce9
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1747714
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c b/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c deleted file mode 100644 index d7a72fcd..00000000 --- a/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <nvgpu/errno.h> | ||
18 | |||
19 | #include <nvgpu/types.h> | ||
20 | #include <nvgpu/os_fence.h> | ||
21 | #include <nvgpu/linux/os_fence_android.h> | ||
22 | #include <nvgpu/nvhost.h> | ||
23 | #include <nvgpu/atomic.h> | ||
24 | |||
25 | #include "gk20a/gk20a.h" | ||
26 | #include "gk20a/channel_gk20a.h" | ||
27 | #include "gk20a/channel_sync_gk20a.h" | ||
28 | #include "gk20a/mm_gk20a.h" | ||
29 | |||
30 | #include "../drivers/staging/android/sync.h" | ||
31 | |||
32 | int nvgpu_os_fence_syncpt_wait_gen_cmd(struct nvgpu_os_fence *s, | ||
33 | struct priv_cmd_entry *wait_cmd, | ||
34 | struct channel_gk20a *c, | ||
35 | int max_wait_cmds) | ||
36 | { | ||
37 | int err; | ||
38 | int wait_cmd_size; | ||
39 | int num_wait_cmds; | ||
40 | int i; | ||
41 | u32 wait_id; | ||
42 | struct sync_pt *pt; | ||
43 | |||
44 | struct sync_fence *sync_fence = (struct sync_fence *)s->priv; | ||
45 | |||
46 | if (max_wait_cmds && sync_fence->num_fences > max_wait_cmds) | ||
47 | return -EINVAL; | ||
48 | |||
49 | /* validate syncpt ids */ | ||
50 | for (i = 0; i < sync_fence->num_fences; i++) { | ||
51 | pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); | ||
52 | wait_id = nvgpu_nvhost_sync_pt_id(pt); | ||
53 | if (!wait_id || !nvgpu_nvhost_syncpt_is_valid_pt_ext( | ||
54 | c->g->nvhost_dev, wait_id)) { | ||
55 | return -EINVAL; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | num_wait_cmds = nvgpu_nvhost_sync_num_pts(sync_fence); | ||
60 | if (num_wait_cmds == 0) | ||
61 | return 0; | ||
62 | |||
63 | wait_cmd_size = c->g->ops.fifo.get_syncpt_wait_cmd_size(); | ||
64 | err = gk20a_channel_alloc_priv_cmdbuf(c, | ||
65 | wait_cmd_size * num_wait_cmds, wait_cmd); | ||
66 | if (err) { | ||
67 | nvgpu_err(c->g, | ||
68 | "not enough priv cmd buffer space"); | ||
69 | return err; | ||
70 | } | ||
71 | |||
72 | for (i = 0; i < sync_fence->num_fences; i++) { | ||
73 | struct fence *f = sync_fence->cbs[i].sync_pt; | ||
74 | struct sync_pt *pt = sync_pt_from_fence(f); | ||
75 | u32 wait_id = nvgpu_nvhost_sync_pt_id(pt); | ||
76 | u32 wait_value = nvgpu_nvhost_sync_pt_thresh(pt); | ||
77 | |||
78 | err = gk20a_channel_gen_syncpt_wait_cmd(c, wait_id, wait_value, | ||
79 | wait_cmd, wait_cmd_size, i, true); | ||
80 | } | ||
81 | |||
82 | WARN_ON(i != num_wait_cmds); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static const struct nvgpu_os_fence_ops syncpt_ops = { | ||
88 | .program_waits = nvgpu_os_fence_syncpt_wait_gen_cmd, | ||
89 | .drop_ref = nvgpu_os_fence_android_drop_ref, | ||
90 | .install_fence = nvgpu_os_fence_android_install_fd, | ||
91 | }; | ||
92 | |||
93 | int nvgpu_os_fence_syncpt_create( | ||
94 | struct nvgpu_os_fence *fence_out, struct channel_gk20a *c, | ||
95 | struct nvgpu_nvhost_dev *nvhost_dev, u32 id, u32 thresh) | ||
96 | { | ||
97 | struct sync_fence *fence = nvgpu_nvhost_sync_create_fence( | ||
98 | nvhost_dev, id, thresh, "fence"); | ||
99 | |||
100 | if (!fence) { | ||
101 | nvgpu_err(c->g, "error constructing fence %s", "fence"); | ||
102 | return -ENOMEM; | ||
103 | } | ||
104 | |||
105 | nvgpu_os_fence_init(fence_out, c->g, &syncpt_ops, fence); | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | int nvgpu_os_fence_syncpt_fdget(struct nvgpu_os_fence *fence_out, | ||
111 | struct channel_gk20a *c, int fd) | ||
112 | { | ||
113 | struct sync_fence *fence = nvgpu_nvhost_sync_fdget(fd); | ||
114 | |||
115 | if (!fence) | ||
116 | return -ENOMEM; | ||
117 | |||
118 | nvgpu_os_fence_init(fence_out, c->g, &syncpt_ops, fence); | ||
119 | |||
120 | return 0; | ||
121 | } \ No newline at end of file | ||