diff options
author | Dave Airlie <[email protected]> | 2010-10-08 11:56:43 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-10-18 09:25:22 +1000 |
commit | 7b3fa038830663de9bceded1b0dd2d64b8cf39c4 (patch) | |
tree | a83195c2f9200fbf76f89e32194091afceb9d1c5 /src/gallium/winsys | |
parent | e8e20313afbdf3a38e5a10e6fa566864452eeb2c (diff) |
r600g: get tiling info from kernel
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/r600/drm/r600.c | 5 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_drm.c | 62 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 1 |
3 files changed, 68 insertions, 0 deletions
diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c index 496547ca994..0a4d2e791db 100644 --- a/src/gallium/winsys/r600/drm/r600.c +++ b/src/gallium/winsys/r600/drm/r600.c @@ -40,6 +40,11 @@ enum chip_class r600_get_family_class(struct radeon *radeon) return radeon->chip_class; } +struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon) +{ + return &radeon->tiling_info; +} + static int r600_get_device(struct radeon *r600) { struct drm_radeon_info info; diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 4916843fd6d..c9de95ffc02 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -37,6 +37,9 @@ #include "xf86drm.h" #include "radeon_drm.h" +#ifndef RADEON_INFO_TILING_CONFIG +#define RADEON_INFO_TILING_CONFIG 0x6 +#endif static int radeon_get_device(struct radeon *radeon) { struct drm_radeon_info info; @@ -50,6 +53,61 @@ static int radeon_get_device(struct radeon *radeon) return r; } +static int radeon_drm_get_tiling(struct radeon *radeon) +{ + struct drm_radeon_info info; + int r; + uint32_t tiling_config; + + info.request = RADEON_INFO_TILING_CONFIG; + info.value = (uintptr_t)&tiling_config; + r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info, + sizeof(struct drm_radeon_info)); + + if (r) + return r; + + switch ((tiling_config & 0xe) >> 1) { + case 0: + radeon->tiling_info.num_channels = 1; + break; + case 1: + radeon->tiling_info.num_channels = 2; + break; + case 2: + radeon->tiling_info.num_channels = 4; + break; + case 3: + radeon->tiling_info.num_channels = 8; + break; + default: + return -EINVAL; + } + + switch ((tiling_config & 0x30) >> 4) { + case 0: + radeon->tiling_info.num_banks = 4; + break; + case 1: + radeon->tiling_info.num_banks = 8; + break; + default: + return -EINVAL; + + } + switch ((tiling_config & 0xc0) >> 6) { + case 0: + radeon->tiling_info.group_bytes = 256; + break; + case 1: + radeon->tiling_info.group_bytes = 512; + break; + default: + return -EINVAL; + } + return 0; +} + struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; @@ -157,6 +215,10 @@ struct radeon *radeon_new(int fd, unsigned device) break; } + if (radeon->chip_class == R600 || radeon->chip_class == R700) { + if (radeon_drm_get_tiling(radeon)) + return NULL; + } radeon->kman = radeon_bo_pbmgr_create(radeon); if (!radeon->kman) return NULL; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index e3868d3cb9a..08e243b00d0 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -42,6 +42,7 @@ struct radeon { enum chip_class chip_class; struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ + struct r600_tiling_info tiling_info; }; struct radeon *r600_new(int fd, unsigned device); |