mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 00:24:12 +08:00
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull radeon drm fixes from Dave Airlie: "Just piping a bunch of fixes from pre-xmas from Alex for radeon, all either fix bad hw setup issues or regressions" * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/radeon: Bump version for CIK DCE tiling fix drm/radeon: set correct number of banks for CIK chips in DCE drm/radeon: set correct pipe config for Hawaii in DCE drm/radeon: expose render backend mask to the userspace drm/radeon: fix render backend setup for SI and CIK drm/radeon: 0x9649 is SUMO2 not SUMO drm/radeon: fix UVD 256MB check
This commit is contained in:
commit
9a0bb2966e
@ -1143,31 +1143,53 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
|
||||
}
|
||||
|
||||
if (tiling_flags & RADEON_TILING_MACRO) {
|
||||
if (rdev->family >= CHIP_BONAIRE)
|
||||
tmp = rdev->config.cik.tile_config;
|
||||
else if (rdev->family >= CHIP_TAHITI)
|
||||
tmp = rdev->config.si.tile_config;
|
||||
else if (rdev->family >= CHIP_CAYMAN)
|
||||
tmp = rdev->config.cayman.tile_config;
|
||||
else
|
||||
tmp = rdev->config.evergreen.tile_config;
|
||||
evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);
|
||||
|
||||
switch ((tmp & 0xf0) >> 4) {
|
||||
case 0: /* 4 banks */
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK);
|
||||
break;
|
||||
case 1: /* 8 banks */
|
||||
default:
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK);
|
||||
break;
|
||||
case 2: /* 16 banks */
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK);
|
||||
break;
|
||||
/* Set NUM_BANKS. */
|
||||
if (rdev->family >= CHIP_BONAIRE) {
|
||||
unsigned tileb, index, num_banks, tile_split_bytes;
|
||||
|
||||
/* Calculate the macrotile mode index. */
|
||||
tile_split_bytes = 64 << tile_split;
|
||||
tileb = 8 * 8 * target_fb->bits_per_pixel / 8;
|
||||
tileb = min(tile_split_bytes, tileb);
|
||||
|
||||
for (index = 0; tileb > 64; index++) {
|
||||
tileb >>= 1;
|
||||
}
|
||||
|
||||
if (index >= 16) {
|
||||
DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n",
|
||||
target_fb->bits_per_pixel, tile_split);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks);
|
||||
} else {
|
||||
/* SI and older. */
|
||||
if (rdev->family >= CHIP_TAHITI)
|
||||
tmp = rdev->config.si.tile_config;
|
||||
else if (rdev->family >= CHIP_CAYMAN)
|
||||
tmp = rdev->config.cayman.tile_config;
|
||||
else
|
||||
tmp = rdev->config.evergreen.tile_config;
|
||||
|
||||
switch ((tmp & 0xf0) >> 4) {
|
||||
case 0: /* 4 banks */
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK);
|
||||
break;
|
||||
case 1: /* 8 banks */
|
||||
default:
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK);
|
||||
break;
|
||||
case 2: /* 16 banks */
|
||||
fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1);
|
||||
|
||||
evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);
|
||||
fb_format |= EVERGREEN_GRPH_TILE_SPLIT(tile_split);
|
||||
fb_format |= EVERGREEN_GRPH_BANK_WIDTH(bankw);
|
||||
fb_format |= EVERGREEN_GRPH_BANK_HEIGHT(bankh);
|
||||
@ -1180,19 +1202,12 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
|
||||
fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1);
|
||||
|
||||
if (rdev->family >= CHIP_BONAIRE) {
|
||||
u32 num_pipe_configs = rdev->config.cik.max_tile_pipes;
|
||||
u32 num_rb = rdev->config.cik.max_backends_per_se;
|
||||
if (num_pipe_configs > 8)
|
||||
num_pipe_configs = 8;
|
||||
if (num_pipe_configs == 8)
|
||||
fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P8_32x32_16x16);
|
||||
else if (num_pipe_configs == 4) {
|
||||
if (num_rb == 4)
|
||||
fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P4_16x16);
|
||||
else if (num_rb < 4)
|
||||
fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P4_8x16);
|
||||
} else if (num_pipe_configs == 2)
|
||||
fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P2);
|
||||
/* Read the pipe config from the 2D TILED SCANOUT mode.
|
||||
* It should be the same for the other modes too, but not all
|
||||
* modes set the pipe config field. */
|
||||
u32 pipe_config = (rdev->config.cik.tile_mode_array[10] >> 6) & 0x1f;
|
||||
|
||||
fb_format |= CIK_GRPH_PIPE_CONFIG(pipe_config);
|
||||
} else if ((rdev->family == CHIP_TAHITI) ||
|
||||
(rdev->family == CHIP_PITCAIRN))
|
||||
fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16);
|
||||
|
@ -3057,7 +3057,7 @@ static u32 cik_create_bitmask(u32 bit_width)
|
||||
* Returns the disabled RB bitmask.
|
||||
*/
|
||||
static u32 cik_get_rb_disabled(struct radeon_device *rdev,
|
||||
u32 max_rb_num, u32 se_num,
|
||||
u32 max_rb_num_per_se,
|
||||
u32 sh_per_se)
|
||||
{
|
||||
u32 data, mask;
|
||||
@ -3071,7 +3071,7 @@ static u32 cik_get_rb_disabled(struct radeon_device *rdev,
|
||||
|
||||
data >>= BACKEND_DISABLE_SHIFT;
|
||||
|
||||
mask = cik_create_bitmask(max_rb_num / se_num / sh_per_se);
|
||||
mask = cik_create_bitmask(max_rb_num_per_se / sh_per_se);
|
||||
|
||||
return data & mask;
|
||||
}
|
||||
@ -3088,7 +3088,7 @@ static u32 cik_get_rb_disabled(struct radeon_device *rdev,
|
||||
*/
|
||||
static void cik_setup_rb(struct radeon_device *rdev,
|
||||
u32 se_num, u32 sh_per_se,
|
||||
u32 max_rb_num)
|
||||
u32 max_rb_num_per_se)
|
||||
{
|
||||
int i, j;
|
||||
u32 data, mask;
|
||||
@ -3098,7 +3098,7 @@ static void cik_setup_rb(struct radeon_device *rdev,
|
||||
for (i = 0; i < se_num; i++) {
|
||||
for (j = 0; j < sh_per_se; j++) {
|
||||
cik_select_se_sh(rdev, i, j);
|
||||
data = cik_get_rb_disabled(rdev, max_rb_num, se_num, sh_per_se);
|
||||
data = cik_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se);
|
||||
if (rdev->family == CHIP_HAWAII)
|
||||
disabled_rbs |= data << ((i * sh_per_se + j) * HAWAII_RB_BITMAP_WIDTH_PER_SH);
|
||||
else
|
||||
@ -3108,12 +3108,14 @@ static void cik_setup_rb(struct radeon_device *rdev,
|
||||
cik_select_se_sh(rdev, 0xffffffff, 0xffffffff);
|
||||
|
||||
mask = 1;
|
||||
for (i = 0; i < max_rb_num; i++) {
|
||||
for (i = 0; i < max_rb_num_per_se * se_num; i++) {
|
||||
if (!(disabled_rbs & mask))
|
||||
enabled_rbs |= mask;
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
rdev->config.cik.backend_enable_mask = enabled_rbs;
|
||||
|
||||
for (i = 0; i < se_num; i++) {
|
||||
cik_select_se_sh(rdev, i, 0xffffffff);
|
||||
data = 0;
|
||||
|
@ -1940,7 +1940,7 @@ struct si_asic {
|
||||
unsigned sc_earlyz_tile_fifo_size;
|
||||
|
||||
unsigned num_tile_pipes;
|
||||
unsigned num_backends_per_se;
|
||||
unsigned backend_enable_mask;
|
||||
unsigned backend_disable_mask_per_asic;
|
||||
unsigned backend_map;
|
||||
unsigned num_texture_channel_caches;
|
||||
@ -1970,7 +1970,7 @@ struct cik_asic {
|
||||
unsigned sc_earlyz_tile_fifo_size;
|
||||
|
||||
unsigned num_tile_pipes;
|
||||
unsigned num_backends_per_se;
|
||||
unsigned backend_enable_mask;
|
||||
unsigned backend_disable_mask_per_asic;
|
||||
unsigned backend_map;
|
||||
unsigned num_texture_channel_caches;
|
||||
|
@ -77,9 +77,10 @@
|
||||
* 2.33.0 - Add SI tiling mode array query
|
||||
* 2.34.0 - Add CIK tiling mode array query
|
||||
* 2.35.0 - Add CIK macrotile mode array query
|
||||
* 2.36.0 - Fix CIK DCE tiling setup
|
||||
*/
|
||||
#define KMS_DRIVER_MAJOR 2
|
||||
#define KMS_DRIVER_MINOR 35
|
||||
#define KMS_DRIVER_MINOR 36
|
||||
#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);
|
||||
|
@ -461,6 +461,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
case RADEON_INFO_SI_CP_DMA_COMPUTE:
|
||||
*value = 1;
|
||||
break;
|
||||
case RADEON_INFO_SI_BACKEND_ENABLED_MASK:
|
||||
if (rdev->family >= CHIP_BONAIRE) {
|
||||
*value = rdev->config.cik.backend_enable_mask;
|
||||
} else if (rdev->family >= CHIP_TAHITI) {
|
||||
*value = rdev->config.si.backend_enable_mask;
|
||||
} else {
|
||||
DRM_DEBUG_KMS("BACKEND_ENABLED_MASK is si+ only!\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DRM_DEBUG_KMS("Invalid request %d\n", info->request);
|
||||
return -EINVAL;
|
||||
|
@ -473,7 +473,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((start >> 28) != (end >> 28)) {
|
||||
if ((start >> 28) != ((end - 1) >> 28)) {
|
||||
DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
|
||||
start, end);
|
||||
return -EINVAL;
|
||||
|
@ -2811,7 +2811,7 @@ static void si_setup_spi(struct radeon_device *rdev,
|
||||
}
|
||||
|
||||
static u32 si_get_rb_disabled(struct radeon_device *rdev,
|
||||
u32 max_rb_num, u32 se_num,
|
||||
u32 max_rb_num_per_se,
|
||||
u32 sh_per_se)
|
||||
{
|
||||
u32 data, mask;
|
||||
@ -2825,14 +2825,14 @@ static u32 si_get_rb_disabled(struct radeon_device *rdev,
|
||||
|
||||
data >>= BACKEND_DISABLE_SHIFT;
|
||||
|
||||
mask = si_create_bitmask(max_rb_num / se_num / sh_per_se);
|
||||
mask = si_create_bitmask(max_rb_num_per_se / sh_per_se);
|
||||
|
||||
return data & mask;
|
||||
}
|
||||
|
||||
static void si_setup_rb(struct radeon_device *rdev,
|
||||
u32 se_num, u32 sh_per_se,
|
||||
u32 max_rb_num)
|
||||
u32 max_rb_num_per_se)
|
||||
{
|
||||
int i, j;
|
||||
u32 data, mask;
|
||||
@ -2842,19 +2842,21 @@ static void si_setup_rb(struct radeon_device *rdev,
|
||||
for (i = 0; i < se_num; i++) {
|
||||
for (j = 0; j < sh_per_se; j++) {
|
||||
si_select_se_sh(rdev, i, j);
|
||||
data = si_get_rb_disabled(rdev, max_rb_num, se_num, sh_per_se);
|
||||
data = si_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se);
|
||||
disabled_rbs |= data << ((i * sh_per_se + j) * TAHITI_RB_BITMAP_WIDTH_PER_SH);
|
||||
}
|
||||
}
|
||||
si_select_se_sh(rdev, 0xffffffff, 0xffffffff);
|
||||
|
||||
mask = 1;
|
||||
for (i = 0; i < max_rb_num; i++) {
|
||||
for (i = 0; i < max_rb_num_per_se * se_num; i++) {
|
||||
if (!(disabled_rbs & mask))
|
||||
enabled_rbs |= mask;
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
rdev->config.si.backend_enable_mask = enabled_rbs;
|
||||
|
||||
for (i = 0; i < se_num; i++) {
|
||||
si_select_se_sh(rdev, i, 0xffffffff);
|
||||
data = 0;
|
||||
|
@ -600,7 +600,7 @@
|
||||
{0x1002, 0x9645, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
|
||||
{0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
|
||||
{0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
|
||||
{0x1002, 0x9649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
|
||||
{0x1002, 0x9649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
|
||||
{0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
|
||||
{0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
|
||||
{0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
|
||||
|
@ -983,6 +983,8 @@ struct drm_radeon_cs {
|
||||
#define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17
|
||||
/* CIK macrotile mode array */
|
||||
#define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18
|
||||
/* query the number of render backends */
|
||||
#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19
|
||||
|
||||
|
||||
struct drm_radeon_info {
|
||||
|
Loading…
Reference in New Issue
Block a user