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_sema.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_sema.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c b/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c deleted file mode 100644 index 25832417..00000000 --- a/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c +++ /dev/null | |||
@@ -1,111 +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/semaphore.h> | ||
23 | |||
24 | #include "gk20a/channel_sync_gk20a.h" | ||
25 | #include "gk20a/mm_gk20a.h" | ||
26 | |||
27 | #include "sync_sema_android.h" | ||
28 | |||
29 | #include "../drivers/staging/android/sync.h" | ||
30 | |||
31 | int nvgpu_os_fence_sema_wait_gen_cmd(struct nvgpu_os_fence *s, | ||
32 | struct priv_cmd_entry *wait_cmd, | ||
33 | struct channel_gk20a *c, | ||
34 | int max_wait_cmds) | ||
35 | { | ||
36 | int err; | ||
37 | int wait_cmd_size; | ||
38 | int num_wait_cmds; | ||
39 | int i; | ||
40 | struct nvgpu_semaphore *sema; | ||
41 | struct sync_fence *sync_fence = nvgpu_get_sync_fence(s); | ||
42 | |||
43 | wait_cmd_size = c->g->ops.fifo.get_sema_wait_cmd_size(); | ||
44 | |||
45 | num_wait_cmds = sync_fence->num_fences; | ||
46 | if (num_wait_cmds == 0) | ||
47 | return 0; | ||
48 | |||
49 | if (max_wait_cmds && num_wait_cmds > max_wait_cmds) | ||
50 | return -EINVAL; | ||
51 | |||
52 | err = gk20a_channel_alloc_priv_cmdbuf(c, | ||
53 | wait_cmd_size * num_wait_cmds, | ||
54 | wait_cmd); | ||
55 | if (err) { | ||
56 | nvgpu_err(c->g, "not enough priv cmd buffer space"); | ||
57 | return err; | ||
58 | } | ||
59 | |||
60 | for (i = 0; i < num_wait_cmds; i++) { | ||
61 | struct fence *f = sync_fence->cbs[i].sync_pt; | ||
62 | struct sync_pt *pt = sync_pt_from_fence(f); | ||
63 | |||
64 | sema = gk20a_sync_pt_sema(pt); | ||
65 | gk20a_channel_gen_sema_wait_cmd(c, sema, wait_cmd, | ||
66 | wait_cmd_size, i); | ||
67 | } | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static const struct nvgpu_os_fence_ops sema_ops = { | ||
73 | .program_waits = nvgpu_os_fence_sema_wait_gen_cmd, | ||
74 | .drop_ref = nvgpu_os_fence_android_drop_ref, | ||
75 | .install_fence = nvgpu_os_fence_android_install_fd, | ||
76 | }; | ||
77 | |||
78 | int nvgpu_os_fence_sema_create( | ||
79 | struct nvgpu_os_fence *fence_out, | ||
80 | struct channel_gk20a *c, | ||
81 | struct nvgpu_semaphore *sema) | ||
82 | { | ||
83 | struct sync_fence *fence; | ||
84 | |||
85 | fence = gk20a_sync_fence_create(c, sema, "f-gk20a-0x%04x", | ||
86 | nvgpu_semaphore_gpu_ro_va(sema)); | ||
87 | |||
88 | if (!fence) { | ||
89 | nvgpu_err(c->g, "error constructing new fence: f-gk20a-0x%04x", | ||
90 | (u32)nvgpu_semaphore_gpu_ro_va(sema)); | ||
91 | |||
92 | return -ENOMEM; | ||
93 | } | ||
94 | |||
95 | nvgpu_os_fence_init(fence_out, c->g, &sema_ops, fence); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | int nvgpu_os_fence_sema_fdget(struct nvgpu_os_fence *fence_out, | ||
101 | struct channel_gk20a *c, int fd) | ||
102 | { | ||
103 | struct sync_fence *fence = gk20a_sync_fence_fdget(fd); | ||
104 | |||
105 | if (!fence) | ||
106 | return -EINVAL; | ||
107 | |||
108 | nvgpu_os_fence_init(fence_out, c->g, &sema_ops, fence); | ||
109 | |||
110 | return 0; | ||
111 | } | ||