aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu.h
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-08-16 22:48:26 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-08-17 16:50:12 -0400
commit0b492a4c92050862a9780b941d52c05923fcd669 (patch)
tree174e668c9052d8ea029895ab015991226fe689c1 /drivers/gpu/drm/amd/amdgpu/amdgpu.h
parent404b2fa3385565b1c472a0482f6564a1550fc8d1 (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.h50
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;
179struct amdgpu_semaphore; 179struct amdgpu_semaphore;
180struct amdgpu_cs_parser; 180struct amdgpu_cs_parser;
181struct amdgpu_irq_src; 181struct amdgpu_irq_src;
182struct amdgpu_fpriv;
182 183
183enum amdgpu_cp_irq { 184enum 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
987struct amdgpu_ctx_state {
988 uint64_t flags;
989 uint32_t hangs;
990};
991
992struct amdgpu_ctx { 988struct 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
1001struct amdgpu_ctx_mgr { 993struct 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
1000int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
1001 uint32_t *id);
1002int amdgpu_ctx_free(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
1003 uint32_t id);
1004
1005void amdgpu_ctx_fini(struct amdgpu_fpriv *fpriv);
1006
1007struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id);
1008int amdgpu_ctx_put(struct amdgpu_ctx *ctx);
1009
1010int 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
1853int amdgpu_ctx_alloc(struct amdgpu_device *adev,struct amdgpu_fpriv *fpriv,
1854 uint32_t *id,uint32_t flags);
1855int amdgpu_ctx_free(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
1856 uint32_t id);
1857
1858void amdgpu_ctx_fini(struct amdgpu_fpriv *fpriv);
1859struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id);
1860int amdgpu_ctx_put(struct amdgpu_ctx *ctx);
1861
1862extern int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
1863 struct drm_file *filp);
1864
1865/* 1859/*
1866 * CGS 1860 * CGS
1867 */ 1861 */