forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
....@@ -25,7 +25,8 @@
2525 *
2626 **************************************************************************/
2727
28
-#include <drm/drmP.h>
28
+#include <linux/sched/signal.h>
29
+
2930 #include "vmwgfx_drv.h"
3031
3132 #define VMW_FENCE_WRAP (1 << 31)
....@@ -184,6 +185,9 @@
184185
185186 spin_lock(f->lock);
186187
188
+ if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
189
+ goto out;
190
+
187191 if (intr && signal_pending(current)) {
188192 ret = -ERESTARTSYS;
189193 goto out;
....@@ -306,7 +310,8 @@
306310 INIT_LIST_HEAD(&fman->cleanup_list);
307311 INIT_WORK(&fman->work, &vmw_fence_work_func);
308312 fman->fifo_down = true;
309
- fman->user_fence_size = ttm_round_pot(sizeof(struct vmw_user_fence));
313
+ fman->user_fence_size = ttm_round_pot(sizeof(struct vmw_user_fence)) +
314
+ TTM_OBJ_EXTRA_SIZE;
310315 fman->fence_size = ttm_round_pot(sizeof(struct vmw_fence_obj));
311316 fman->event_fence_action_size =
312317 ttm_round_pot(sizeof(struct vmw_event_fence_action));
....@@ -510,7 +515,7 @@
510515 struct vmw_fence_manager *fman = fman_from_fence(fence);
511516
512517 if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->base.flags))
513
- return 1;
518
+ return true;
514519
515520 vmw_fences_update(fman);
516521
....@@ -650,7 +655,7 @@
650655 }
651656
652657 *p_fence = &ufence->fence;
653
- *p_handle = ufence->base.hash.key;
658
+ *p_handle = ufence->base.handle;
654659
655660 return 0;
656661 out_err:
....@@ -905,13 +910,10 @@
905910 container_of(action, struct vmw_event_fence_action, action);
906911 struct drm_device *dev = eaction->dev;
907912 struct drm_pending_event *event = eaction->event;
908
- struct drm_file *file_priv;
909
-
910913
911914 if (unlikely(event == NULL))
912915 return;
913916
914
- file_priv = event->file_priv;
915917 spin_lock_irq(&dev->event_lock);
916918
917919 if (likely(eaction->tv_sec != NULL)) {
....@@ -1137,7 +1139,7 @@
11371139 "object.\n");
11381140 goto out_no_ref_obj;
11391141 }
1140
- handle = base->hash.key;
1142
+ handle = base->handle;
11411143 }
11421144 ttm_base_object_unref(&base);
11431145 }