Commit ec1a6cce authored by Christian König's avatar Christian König Committed by Dave Airlie

drm/radeon: register ring debugfs handlers on init

Just register the debugfs files on init instead of
checking the chipset type multiple times.
Signed-off-by: default avatarChristian König <deathsimple@vodafone.de>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 25a9e352
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "atom.h" #include "atom.h"
int radeon_debugfs_ib_init(struct radeon_device *rdev); int radeon_debugfs_ib_init(struct radeon_device *rdev);
int radeon_debugfs_ring_init(struct radeon_device *rdev); int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring);
u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx)
{ {
...@@ -237,9 +237,6 @@ int radeon_ib_pool_init(struct radeon_device *rdev) ...@@ -237,9 +237,6 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
if (radeon_debugfs_ib_init(rdev)) { if (radeon_debugfs_ib_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for IB !\n"); DRM_ERROR("Failed to register debugfs file for IB !\n");
} }
if (radeon_debugfs_ring_init(rdev)) {
DRM_ERROR("Failed to register debugfs file for rings !\n");
}
radeon_mutex_unlock(&rdev->ib_pool.mutex); radeon_mutex_unlock(&rdev->ib_pool.mutex);
return 0; return 0;
} }
...@@ -411,6 +408,9 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig ...@@ -411,6 +408,9 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig
} }
ring->ptr_mask = (ring->ring_size / 4) - 1; ring->ptr_mask = (ring->ring_size / 4) - 1;
ring->ring_free_dw = ring->ring_size / 4; ring->ring_free_dw = ring->ring_size / 4;
if (radeon_debugfs_ring_init(rdev, ring)) {
DRM_ERROR("Failed to register debugfs file for rings !\n");
}
return 0; return 0;
} }
...@@ -501,17 +501,24 @@ static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32]; ...@@ -501,17 +501,24 @@ static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32];
static unsigned radeon_debugfs_ib_idx[RADEON_IB_POOL_SIZE]; static unsigned radeon_debugfs_ib_idx[RADEON_IB_POOL_SIZE];
#endif #endif
int radeon_debugfs_ring_init(struct radeon_device *rdev) int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
if (rdev->family >= CHIP_CAYMAN) unsigned i;
return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, for (i = 0; i < ARRAY_SIZE(radeon_debugfs_ring_info_list); ++i) {
ARRAY_SIZE(radeon_debugfs_ring_info_list)); struct drm_info_list *info = &radeon_debugfs_ring_info_list[i];
else int ridx = *(int*)radeon_debugfs_ring_info_list[i].data;
return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, 1); unsigned r;
#else
return 0; if (&rdev->ring[ridx] != ring)
continue;
r = radeon_debugfs_add_files(rdev, info, 1);
if (r)
return r;
}
#endif #endif
return 0;
} }
int radeon_debugfs_ib_init(struct radeon_device *rdev) int radeon_debugfs_ib_init(struct radeon_device *rdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment