Commit 64d7b8be authored by Jerome Glisse's avatar Jerome Glisse Committed by Alex Deucher

drm/radeon: add si tile mode array query v3

Allow userspace to query for the tile mode array so userspace can properly
compute surface pitch and alignment requirement depending on tiling.

v2: Make strict aliasing safer by casting to char when copying
v3: merge fix from Christian
Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 902aaef6
...@@ -1483,6 +1483,7 @@ struct si_asic { ...@@ -1483,6 +1483,7 @@ struct si_asic {
unsigned multi_gpu_tile_size; unsigned multi_gpu_tile_size;
unsigned tile_config; unsigned tile_config;
uint32_t tile_mode_array[32];
}; };
union radeon_asic_config { union radeon_asic_config {
......
...@@ -73,9 +73,10 @@ ...@@ -73,9 +73,10 @@
* 2.30.0 - fix for FMASK texturing * 2.30.0 - fix for FMASK texturing
* 2.31.0 - Add fastfb support for rs690 * 2.31.0 - Add fastfb support for rs690
* 2.32.0 - new info request for rings working * 2.32.0 - new info request for rings working
* 2.33.0 - Add SI tiling mode array query
*/ */
#define KMS_DRIVER_MAJOR 2 #define KMS_DRIVER_MAJOR 2
#define KMS_DRIVER_MINOR 32 #define KMS_DRIVER_MINOR 33
#define KMS_DRIVER_PATCHLEVEL 0 #define KMS_DRIVER_PATCHLEVEL 0
int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
int radeon_driver_unload_kms(struct drm_device *dev); int radeon_driver_unload_kms(struct drm_device *dev);
......
This diff is collapsed.
...@@ -1211,6 +1211,7 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev) ...@@ -1211,6 +1211,7 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev)
gb_tile_moden = 0; gb_tile_moden = 0;
break; break;
} }
rdev->config.si.tile_mode_array[reg_offset] = gb_tile_moden;
WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden);
} }
} else if ((rdev->family == CHIP_VERDE) || } else if ((rdev->family == CHIP_VERDE) ||
...@@ -1451,6 +1452,7 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev) ...@@ -1451,6 +1452,7 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev)
gb_tile_moden = 0; gb_tile_moden = 0;
break; break;
} }
rdev->config.si.tile_mode_array[reg_offset] = gb_tile_moden;
WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden);
} }
} else } else
......
...@@ -977,6 +977,8 @@ struct drm_radeon_cs { ...@@ -977,6 +977,8 @@ struct drm_radeon_cs {
#define RADEON_INFO_FASTFB_WORKING 0x14 #define RADEON_INFO_FASTFB_WORKING 0x14
/* query if a RADEON_CS_RING_* submission is supported */ /* query if a RADEON_CS_RING_* submission is supported */
#define RADEON_INFO_RING_WORKING 0x15 #define RADEON_INFO_RING_WORKING 0x15
/* SI tile mode array */
#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16
struct drm_radeon_info { struct drm_radeon_info {
...@@ -985,4 +987,22 @@ struct drm_radeon_info { ...@@ -985,4 +987,22 @@ struct drm_radeon_info {
uint64_t value; uint64_t value;
}; };
/* Those correspond to the tile index to use, this is to explicitly state
* the API that is implicitly defined by the tile mode array.
*/
#define SI_TILE_MODE_COLOR_LINEAR_ALIGNED 8
#define SI_TILE_MODE_COLOR_1D 13
#define SI_TILE_MODE_COLOR_1D_SCANOUT 9
#define SI_TILE_MODE_COLOR_2D_8BPP 14
#define SI_TILE_MODE_COLOR_2D_16BPP 15
#define SI_TILE_MODE_COLOR_2D_32BPP 16
#define SI_TILE_MODE_COLOR_2D_64BPP 17
#define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP 11
#define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP 12
#define SI_TILE_MODE_DEPTH_STENCIL_1D 4
#define SI_TILE_MODE_DEPTH_STENCIL_2D 0
#define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA 3
#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3
#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2
#endif #endif
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