summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 30bb6efe..025b000e 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/gk20a.h> 18#include <linux/gk20a.h>
19#include <linux/version.h>
19 20
20#include "channel_sync_gk20a.h" 21#include "channel_sync_gk20a.h"
21#include "gk20a.h" 22#include "gk20a.h"
@@ -93,10 +94,12 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
93 int i; 94 int i;
94 int num_wait_cmds; 95 int num_wait_cmds;
95 struct sync_fence *sync_fence; 96 struct sync_fence *sync_fence;
97 struct sync_pt *pt;
96 struct priv_cmd_entry *wait_cmd = NULL; 98 struct priv_cmd_entry *wait_cmd = NULL;
97 struct gk20a_channel_syncpt *sp = 99 struct gk20a_channel_syncpt *sp =
98 container_of(s, struct gk20a_channel_syncpt, ops); 100 container_of(s, struct gk20a_channel_syncpt, ops);
99 struct channel_gk20a *c = sp->c; 101 struct channel_gk20a *c = sp->c;
102 u32 wait_id;
100 int err = 0; 103 int err = 0;
101 104
102 sync_fence = nvhost_sync_fdget(fd); 105 sync_fence = nvhost_sync_fdget(fd);
@@ -104,9 +107,13 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
104 return -EINVAL; 107 return -EINVAL;
105 108
106 /* validate syncpt ids */ 109 /* validate syncpt ids */
110#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
111 list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) {
112#else
107 for (i = 0; i < sync_fence->num_fences; i++) { 113 for (i = 0; i < sync_fence->num_fences; i++) {
108 struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); 114 pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt);
109 u32 wait_id = nvhost_sync_pt_id(pt); 115#endif
116 wait_id = nvhost_sync_pt_id(pt);
110 if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, 117 if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev,
111 wait_id)) { 118 wait_id)) {
112 sync_fence_put(sync_fence); 119 sync_fence_put(sync_fence);
@@ -129,9 +136,13 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
129 } 136 }
130 137
131 i = 0; 138 i = 0;
139#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
140 list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) {
141#else
132 for (i = 0; i < sync_fence->num_fences; i++) { 142 for (i = 0; i < sync_fence->num_fences; i++) {
133 struct fence *f = sync_fence->cbs[i].sync_pt; 143 struct fence *f = sync_fence->cbs[i].sync_pt;
134 struct sync_pt *pt = sync_pt_from_fence(f); 144 struct sync_pt *pt = sync_pt_from_fence(f);
145#endif
135 u32 wait_id = nvhost_sync_pt_id(pt); 146 u32 wait_id = nvhost_sync_pt_id(pt);
136 u32 wait_value = nvhost_sync_pt_thresh(pt); 147 u32 wait_value = nvhost_sync_pt_thresh(pt);
137 148
@@ -144,6 +155,9 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
144 } else 155 } else
145 add_wait_cmd(&wait_cmd->ptr[i * 4], wait_id, 156 add_wait_cmd(&wait_cmd->ptr[i * 4], wait_id,
146 wait_value); 157 wait_value);
158#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
159 i++;
160#endif
147 } 161 }
148 WARN_ON(i != num_wait_cmds); 162 WARN_ON(i != num_wait_cmds);
149 sync_fence_put(sync_fence); 163 sync_fence_put(sync_fence);