diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index fabb01e8c8d5..3db18f42c5c9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |||
@@ -47,9 +47,33 @@ | |||
47 | * that the the relevant GPU caches have been flushed. | 47 | * that the the relevant GPU caches have been flushed. |
48 | */ | 48 | */ |
49 | 49 | ||
50 | struct amdgpu_fence { | ||
51 | struct fence base; | ||
52 | |||
53 | /* RB, DMA, etc. */ | ||
54 | struct amdgpu_ring *ring; | ||
55 | uint64_t seq; | ||
56 | |||
57 | wait_queue_t fence_wake; | ||
58 | }; | ||
59 | |||
50 | static struct kmem_cache *amdgpu_fence_slab; | 60 | static struct kmem_cache *amdgpu_fence_slab; |
51 | static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0); | 61 | static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0); |
52 | 62 | ||
63 | /* | ||
64 | * Cast helper | ||
65 | */ | ||
66 | static const struct fence_ops amdgpu_fence_ops; | ||
67 | static inline struct amdgpu_fence *to_amdgpu_fence(struct fence *f) | ||
68 | { | ||
69 | struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); | ||
70 | |||
71 | if (__f->base.ops == &amdgpu_fence_ops) | ||
72 | return __f; | ||
73 | |||
74 | return NULL; | ||
75 | } | ||
76 | |||
53 | /** | 77 | /** |
54 | * amdgpu_fence_write - write a fence value | 78 | * amdgpu_fence_write - write a fence value |
55 | * | 79 | * |
@@ -663,7 +687,7 @@ static void amdgpu_fence_release(struct fence *f) | |||
663 | kmem_cache_free(amdgpu_fence_slab, fence); | 687 | kmem_cache_free(amdgpu_fence_slab, fence); |
664 | } | 688 | } |
665 | 689 | ||
666 | const struct fence_ops amdgpu_fence_ops = { | 690 | static const struct fence_ops amdgpu_fence_ops = { |
667 | .get_driver_name = amdgpu_fence_get_driver_name, | 691 | .get_driver_name = amdgpu_fence_get_driver_name, |
668 | .get_timeline_name = amdgpu_fence_get_timeline_name, | 692 | .get_timeline_name = amdgpu_fence_get_timeline_name, |
669 | .enable_signaling = amdgpu_fence_enable_signaling, | 693 | .enable_signaling = amdgpu_fence_enable_signaling, |