]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
drm/amdgpu: make pipeline sync be in same place v2
[mirror_ubuntu-jammy-kernel.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ib.c
index 631a9f77b973105d99ddd0760a077b8e467985cb..cb9472f52e8c15051f3f6fb1d16f64d977ffd5a8 100644 (file)
@@ -121,7 +121,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 {
        struct amdgpu_device *adev = ring->adev;
        struct amdgpu_ib *ib = &ibs[0];
-       struct dma_fence *tmp;
+       struct dma_fence *tmp = NULL;
        bool skip_preamble, need_ctx_switch;
        unsigned patch_offset = ~0;
        struct amdgpu_vm *vm;
@@ -163,8 +163,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
        }
 
        if (ring->funcs->emit_pipeline_sync && job &&
-           (tmp = amdgpu_sync_get_fence(&job->sched_sync))) {
-               job->need_pipeline_sync = true;
+           ((tmp = amdgpu_sync_get_fence(&job->sched_sync)) ||
+            amdgpu_vm_need_pipeline_sync(ring, job))) {
                amdgpu_ring_emit_pipeline_sync(ring);
                dma_fence_put(tmp);
        }