diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_fence.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fence.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index ab5ea3b0d666..0a93114158cd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -29,12 +29,13 @@ | |||
29 | #include <linux/ktime.h> | 29 | #include <linux/ktime.h> |
30 | #include <linux/hrtimer.h> | 30 | #include <linux/hrtimer.h> |
31 | 31 | ||
32 | #include <nvif/notify.h> | ||
33 | #include <nvif/event.h> | ||
34 | |||
32 | #include "nouveau_drm.h" | 35 | #include "nouveau_drm.h" |
33 | #include "nouveau_dma.h" | 36 | #include "nouveau_dma.h" |
34 | #include "nouveau_fence.h" | 37 | #include "nouveau_fence.h" |
35 | 38 | ||
36 | #include <engine/fifo.h> | ||
37 | |||
38 | struct fence_work { | 39 | struct fence_work { |
39 | struct work_struct base; | 40 | struct work_struct base; |
40 | struct list_head head; | 41 | struct list_head head; |
@@ -165,12 +166,18 @@ nouveau_fence_done(struct nouveau_fence *fence) | |||
165 | return !fence->channel; | 166 | return !fence->channel; |
166 | } | 167 | } |
167 | 168 | ||
169 | struct nouveau_fence_wait { | ||
170 | struct nouveau_fence_priv *priv; | ||
171 | struct nvif_notify notify; | ||
172 | }; | ||
173 | |||
168 | static int | 174 | static int |
169 | nouveau_fence_wait_uevent_handler(void *data, u32 type, int index) | 175 | nouveau_fence_wait_uevent_handler(struct nvif_notify *notify) |
170 | { | 176 | { |
171 | struct nouveau_fence_priv *priv = data; | 177 | struct nouveau_fence_wait *wait = |
172 | wake_up_all(&priv->waiting); | 178 | container_of(notify, typeof(*wait), notify); |
173 | return NVKM_EVENT_KEEP; | 179 | wake_up_all(&wait->priv->waiting); |
180 | return NVIF_NOTIFY_KEEP; | ||
174 | } | 181 | } |
175 | 182 | ||
176 | static int | 183 | static int |
@@ -178,18 +185,22 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr) | |||
178 | 185 | ||
179 | { | 186 | { |
180 | struct nouveau_channel *chan = fence->channel; | 187 | struct nouveau_channel *chan = fence->channel; |
181 | struct nouveau_fifo *pfifo = nouveau_fifo(chan->drm->device); | ||
182 | struct nouveau_fence_priv *priv = chan->drm->fence; | 188 | struct nouveau_fence_priv *priv = chan->drm->fence; |
183 | struct nouveau_eventh *handler; | 189 | struct nouveau_fence_wait wait = { .priv = priv }; |
184 | int ret = 0; | 190 | int ret = 0; |
185 | 191 | ||
186 | ret = nouveau_event_new(pfifo->uevent, 1, 0, | 192 | ret = nvif_notify_init(chan->object, NULL, |
187 | nouveau_fence_wait_uevent_handler, | 193 | nouveau_fence_wait_uevent_handler, false, |
188 | priv, &handler); | 194 | G82_CHANNEL_DMA_V0_NTFY_UEVENT, |
195 | &(struct nvif_notify_uevent_req) { | ||
196 | }, | ||
197 | sizeof(struct nvif_notify_uevent_req), | ||
198 | sizeof(struct nvif_notify_uevent_rep), | ||
199 | &wait.notify); | ||
189 | if (ret) | 200 | if (ret) |
190 | return ret; | 201 | return ret; |
191 | 202 | ||
192 | nouveau_event_get(handler); | 203 | nvif_notify_get(&wait.notify); |
193 | 204 | ||
194 | if (fence->timeout) { | 205 | if (fence->timeout) { |
195 | unsigned long timeout = fence->timeout - jiffies; | 206 | unsigned long timeout = fence->timeout - jiffies; |
@@ -221,7 +232,7 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr) | |||
221 | } | 232 | } |
222 | } | 233 | } |
223 | 234 | ||
224 | nouveau_event_ref(NULL, &handler); | 235 | nvif_notify_fini(&wait.notify); |
225 | if (unlikely(ret < 0)) | 236 | if (unlikely(ret < 0)) |
226 | return ret; | 237 | return ret; |
227 | 238 | ||