diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-08-16 22:48:26 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:50:12 -0400 |
commit | 0b492a4c92050862a9780b941d52c05923fcd669 (patch) | |
tree | 174e668c9052d8ea029895ab015991226fe689c1 /drivers/gpu/drm/amd/amdgpu/amdgpu.h | |
parent | 404b2fa3385565b1c472a0482f6564a1550fc8d1 (diff) |
drm/amdgpu: cleanup context structure v2
The comment is misleading and incorrect, remove it.
Printing the id is completely meaningless and this practice
can cause a race conditions on command submission.
The flags and hangs fields are completely unused.
Give all fields a common indentation.
v2: remove fpriv reference and unused flags as well, fix debug message.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 548e2bb72d99..069cc28941ba 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -179,6 +179,7 @@ struct amdgpu_ring; | |||
179 | struct amdgpu_semaphore; | 179 | struct amdgpu_semaphore; |
180 | struct amdgpu_cs_parser; | 180 | struct amdgpu_cs_parser; |
181 | struct amdgpu_irq_src; | 181 | struct amdgpu_irq_src; |
182 | struct amdgpu_fpriv; | ||
182 | 183 | ||
183 | enum amdgpu_cp_irq { | 184 | enum amdgpu_cp_irq { |
184 | AMDGPU_CP_IRQ_GFX_EOP = 0, | 185 | AMDGPU_CP_IRQ_GFX_EOP = 0, |
@@ -984,27 +985,32 @@ struct amdgpu_vm_manager { | |||
984 | * context related structures | 985 | * context related structures |
985 | */ | 986 | */ |
986 | 987 | ||
987 | struct amdgpu_ctx_state { | ||
988 | uint64_t flags; | ||
989 | uint32_t hangs; | ||
990 | }; | ||
991 | |||
992 | struct amdgpu_ctx { | 988 | struct amdgpu_ctx { |
993 | /* call kref_get()before CS start and kref_put() after CS fence signaled */ | 989 | struct kref refcount; |
994 | struct kref refcount; | 990 | unsigned reset_counter; |
995 | struct amdgpu_fpriv *fpriv; | ||
996 | struct amdgpu_ctx_state state; | ||
997 | uint32_t id; | ||
998 | unsigned reset_counter; | ||
999 | }; | 991 | }; |
1000 | 992 | ||
1001 | struct amdgpu_ctx_mgr { | 993 | struct amdgpu_ctx_mgr { |
1002 | struct amdgpu_device *adev; | 994 | struct amdgpu_device *adev; |
1003 | struct idr ctx_handles; | 995 | struct mutex lock; |
1004 | /* lock for IDR system */ | 996 | /* protected by lock */ |
1005 | struct mutex lock; | 997 | struct idr ctx_handles; |
1006 | }; | 998 | }; |
1007 | 999 | ||
1000 | int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv, | ||
1001 | uint32_t *id); | ||
1002 | int amdgpu_ctx_free(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv, | ||
1003 | uint32_t id); | ||
1004 | |||
1005 | void amdgpu_ctx_fini(struct amdgpu_fpriv *fpriv); | ||
1006 | |||
1007 | struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id); | ||
1008 | int amdgpu_ctx_put(struct amdgpu_ctx *ctx); | ||
1009 | |||
1010 | int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, | ||
1011 | struct drm_file *filp); | ||
1012 | |||
1013 | |||
1008 | /* | 1014 | /* |
1009 | * file private structure | 1015 | * file private structure |
1010 | */ | 1016 | */ |
@@ -1013,7 +1019,7 @@ struct amdgpu_fpriv { | |||
1013 | struct amdgpu_vm vm; | 1019 | struct amdgpu_vm vm; |
1014 | struct mutex bo_list_lock; | 1020 | struct mutex bo_list_lock; |
1015 | struct idr bo_list_handles; | 1021 | struct idr bo_list_handles; |
1016 | struct amdgpu_ctx_mgr ctx_mgr; | 1022 | struct amdgpu_ctx_mgr ctx_mgr; |
1017 | }; | 1023 | }; |
1018 | 1024 | ||
1019 | /* | 1025 | /* |
@@ -1850,18 +1856,6 @@ struct amdgpu_atcs { | |||
1850 | struct amdgpu_atcs_functions functions; | 1856 | struct amdgpu_atcs_functions functions; |
1851 | }; | 1857 | }; |
1852 | 1858 | ||
1853 | int amdgpu_ctx_alloc(struct amdgpu_device *adev,struct amdgpu_fpriv *fpriv, | ||
1854 | uint32_t *id,uint32_t flags); | ||
1855 | int amdgpu_ctx_free(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv, | ||
1856 | uint32_t id); | ||
1857 | |||
1858 | void amdgpu_ctx_fini(struct amdgpu_fpriv *fpriv); | ||
1859 | struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id); | ||
1860 | int amdgpu_ctx_put(struct amdgpu_ctx *ctx); | ||
1861 | |||
1862 | extern int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, | ||
1863 | struct drm_file *filp); | ||
1864 | |||
1865 | /* | 1859 | /* |
1866 | * CGS | 1860 | * CGS |
1867 | */ | 1861 | */ |