Userspace needs this information to access tiled
buffers via the CPU.

Signed-off-by: Alex Deucher <alexdeuc...@gmail.com>
---
 drivers/gpu/drm/radeon/evergreen.c  |    1 +
 drivers/gpu/drm/radeon/r600.c       |    2 +-
 drivers/gpu/drm/radeon/radeon.h     |    3 +++
 drivers/gpu/drm/radeon/radeon_drv.c |    3 ++-
 drivers/gpu/drm/radeon/radeon_kms.c |   12 ++++++++++++
 drivers/gpu/drm/radeon/rv770.c      |    3 ++-
 include/drm/radeon_drm.h            |    1 +
 7 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c 
b/drivers/gpu/drm/radeon/evergreen.c
index 8c8e4d3..e220c7e 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1104,6 +1104,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
                                                                 
rdev->config.evergreen.max_backends) &
                                                                
EVERGREEN_MAX_BACKENDS_MASK));
 
+       rdev->config.evergreen.tile_config = gb_addr_config;
        WREG32(GB_BACKEND_MAP, gb_backend_map);
        WREG32(GB_ADDR_CONFIG, gb_addr_config);
        WREG32(DMIF_ADDR_CONFIG, gb_addr_config);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 44e96a2..dac2534 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1508,7 +1508,7 @@ void r600_gpu_init(struct radeon_device *rdev)
                                                         
r600_count_pipe_bits((cc_rb_backend_disable &
                                                                               
R6XX_MAX_BACKENDS_MASK) >> 16)),
                                                        (cc_rb_backend_disable 
>> 16));
-
+       rdev->config.r600.tile_config = tiling_config;
        tiling_config |= BACKEND_MAP(backend_map);
        WREG32(GB_TILING_CONFIG, tiling_config);
        WREG32(DCP_TILING_CONFIG, tiling_config & 0xffff);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5c9ce2b..78b59a7 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -892,6 +892,7 @@ struct r600_asic {
        unsigned                tiling_nbanks;
        unsigned                tiling_npipes;
        unsigned                tiling_group_size;
+       unsigned                tile_config;
        struct r100_gpu_lockup  lockup;
 };
 
@@ -916,6 +917,7 @@ struct rv770_asic {
        unsigned                tiling_nbanks;
        unsigned                tiling_npipes;
        unsigned                tiling_group_size;
+       unsigned                tile_config;
        struct r100_gpu_lockup  lockup;
 };
 
@@ -941,6 +943,7 @@ struct evergreen_asic {
        unsigned tiling_nbanks;
        unsigned tiling_npipes;
        unsigned tiling_group_size;
+       unsigned tile_config;
 };
 
 union radeon_asic_config {
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 902d173..ece06a6 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -45,9 +45,10 @@
  * - 2.2.0 - add r6xx/r7xx const buffer support
  * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
  * - 2.4.0 - add crtc id query
+ * - 2.5.0 - add tiling config query (r6xx+)
  */
 #define KMS_DRIVER_MAJOR       2
-#define KMS_DRIVER_MINOR       4
+#define KMS_DRIVER_MINOR       5
 #define KMS_DRIVER_PATCHLEVEL  0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 021572a..977447e 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -134,6 +134,18 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
                        return -EINVAL;
                }
                break;
+       case RADEON_INFO_TILING_CONFIG:
+               if (rdev->family >= CHIP_CEDAR)
+                       value = rdev->config.evergreen.tile_config;
+               else if (rdev->family >= CHIP_RV770)
+                       value = rdev->config.rv770.tile_config;
+               else if (rdev->family >= CHIP_R600)
+                       value = rdev->config.r600.tile_config;
+               else {
+                       DRM_DEBUG("tiling config is r6xx+ only!\n");
+                       return -EINVAL;
+               }
+               break;
        default:
                DRM_DEBUG("Invalid request %d\n", info->request);
                return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 253f24a..d285ca8 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -648,8 +648,9 @@ static void rv770_gpu_init(struct radeon_device *rdev)
                                                                 
r600_count_pipe_bits((cc_rb_backend_disable &
                                                                                
       R7XX_MAX_BACKENDS_MASK) >> 16)),
                                                                
(cc_rb_backend_disable >> 16));
-       gb_tiling_config |= BACKEND_MAP(backend_map);
 
+       rdev->config.rv770.tile_config = gb_tiling_config;
+       gb_tiling_config |= BACKEND_MAP(backend_map);
 
        WREG32(GB_TILING_CONFIG, gb_tiling_config);
        WREG32(DCP_TILING_CONFIG, (gb_tiling_config & 0xffff));
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 3ff9fc0..387c116 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -903,6 +903,7 @@ struct drm_radeon_cs {
 #define RADEON_INFO_NUM_Z_PIPES        0x02
 #define RADEON_INFO_ACCEL_WORKING      0x03
 #define RADEON_INFO_CRTC_FROM_ID       0x04
+#define RADEON_INFO_TILING_CONFIG      0x05
 
 struct drm_radeon_info {
        uint32_t                request;
-- 
1.5.6.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to