[PATCH v2] drm/amdgpu: introduce new amdgpu_fence object to indicate the job embedded fence

Huang, Ray Ray.Huang at amd.com
Wed Dec 15 06:15:07 UTC 2021


[AMD Official Use Only]

Yes, exactly.

AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT is the private flag only for amdgpu. Maybe, it's cleaner to define another amdgpu_fence_ops which is dedicated for job-embedded fence.

Thanks,
Ray

From: Grodzovsky, Andrey <Andrey.Grodzovsky at amd.com> 
Sent: Wednesday, December 15, 2021 1:09 AM
To: Huang, Ray <Ray.Huang at amd.com>; dri-devel at lists.freedesktop.org; Koenig, Christian <Christian.Koenig at amd.com>; Daniel Vetter <daniel.vetter at ffwll.ch>; Sumit Semwal <sumit.semwal at linaro.org>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; amd-gfx at lists.freedesktop.org; Liu, Monk <Monk.Liu at amd.com>; linux-media at vger.kernel.org
Subject: Re: [PATCH v2] drm/amdgpu: introduce new amdgpu_fence object to indicate the job embedded fence


On 2021-12-14 12:03 p.m., Andrey Grodzovsky wrote:
- 
-    if (job != NULL) { 
-        /* mark this fence has a parent job */ 
-        set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags); 
+        if (job) 
+            dma_fence_init(fence, &amdgpu_job_fence_ops, 
+                       &ring->fence_drv.lock, 
+                       adev->fence_context + ring->idx, seq); 
+        else 
+            dma_fence_init(fence, &amdgpu_fence_ops, 
+                       &ring->fence_drv.lock, 
+                       adev->fence_context + ring->idx, seq); 
      } 


It's probably me missing something but why can't we just move setting of AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT 
to before dma_fence_init here or even into amdgpu_job_alloc instead of all the refactoring ? 

Andrey 

My bad, I see now that dma_fence_init just overrides flags to 0 and immediately call the trace .
But why then can't we add dma_fence_init_with_flags wrapper to dma-fence ?
Andrey


More information about the amd-gfx mailing list