forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/nouveau/nouveau_fence.c
....@@ -24,10 +24,9 @@
2424 *
2525 */
2626
27
-#include <drm/drmP.h>
28
-
2927 #include <linux/ktime.h>
3028 #include <linux/hrtimer.h>
29
+#include <linux/sched/signal.h>
3130 #include <trace/events/dma_fence.h>
3231
3332 #include <nvif/cl826e.h>
....@@ -88,7 +87,7 @@
8887 }
8988
9089 void
91
-nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
90
+nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
9291 {
9392 struct nouveau_fence *fence;
9493
....@@ -96,12 +95,20 @@
9695 while (!list_empty(&fctx->pending)) {
9796 fence = list_entry(fctx->pending.next, typeof(*fence), head);
9897
98
+ if (error)
99
+ dma_fence_set_error(&fence->base, error);
100
+
99101 if (nouveau_fence_signal(fence))
100102 nvif_notify_put(&fctx->notify);
101103 }
102104 spin_unlock_irq(&fctx->lock);
105
+}
103106
104
- nvif_notify_fini(&fctx->notify);
107
+void
108
+nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
109
+{
110
+ nouveau_fence_context_kill(fctx, 0);
111
+ nvif_notify_dtor(&fctx->notify);
105112 fctx->dead = 1;
106113
107114 /*
....@@ -188,7 +195,8 @@
188195 if (!priv->uevent)
189196 return;
190197
191
- ret = nvif_notify_init(&chan->user, nouveau_fence_wait_uevent_handler,
198
+ ret = nvif_notify_ctor(&chan->user, "fenceNonStallIntr",
199
+ nouveau_fence_wait_uevent_handler,
192200 false, NV826E_V0_NTFY_NON_STALL_INTERRUPT,
193201 &(struct nvif_notify_uevent_req) { },
194202 sizeof(struct nvif_notify_uevent_req),
....@@ -335,20 +343,20 @@
335343 {
336344 struct nouveau_fence_chan *fctx = chan->fence;
337345 struct dma_fence *fence;
338
- struct reservation_object *resv = nvbo->bo.resv;
339
- struct reservation_object_list *fobj;
346
+ struct dma_resv *resv = nvbo->bo.base.resv;
347
+ struct dma_resv_list *fobj;
340348 struct nouveau_fence *f;
341349 int ret = 0, i;
342350
343351 if (!exclusive) {
344
- ret = reservation_object_reserve_shared(resv);
352
+ ret = dma_resv_reserve_shared(resv, 1);
345353
346354 if (ret)
347355 return ret;
348356 }
349357
350
- fobj = reservation_object_get_list(resv);
351
- fence = reservation_object_get_excl(resv);
358
+ fobj = dma_resv_get_list(resv);
359
+ fence = dma_resv_get_excl(resv);
352360
353361 if (fence && (!exclusive || !fobj || !fobj->shared_count)) {
354362 struct nouveau_channel *prev = NULL;
....@@ -377,7 +385,7 @@
377385 bool must_wait = true;
378386
379387 fence = rcu_dereference_protected(fobj->shared[i],
380
- reservation_object_held(resv));
388
+ dma_resv_held(resv));
381389
382390 f = nouveau_local_fence(fence, chan->drm);
383391 if (f) {
....@@ -526,6 +534,5 @@
526534 .get_timeline_name = nouveau_fence_get_timeline_name,
527535 .enable_signaling = nouveau_fence_enable_signaling,
528536 .signaled = nouveau_fence_is_signaled,
529
- .wait = dma_fence_default_wait,
530537 .release = nouveau_fence_release
531538 };