diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-05-31 19:00:25 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-06-01 12:00:14 -0400 |
commit | 416a2bd274566a6f607a271f524b2dc0b84d9106 (patch) | |
tree | 502720262c07cdb14bc14155bc8295cc20a7d411 /drivers/gpu | |
parent | 95c4b23ec4e2fa5604df229ddf134e31d7b3b378 (diff) |
drm/radeon: fixup tiling group size and backendmap on r6xx-r9xx (v4)
Tiling group size is always 256bits on r6xx/r7xx/r8xx/9xx. Also fix and
simplify render backend map. This now properly sets up the backend map
on r6xx-9xx which should improve 3D performance.
Vadim benchmarked also:
Some benchmarks on juniper (5750), fullscreen 1920x1080,
first result - kernel 3.4.0+ (fb21affa), second - with these patches:
Lightsmark: 91 fps => 123 fps +35%
Doom3: 74 fps => 101 fps +36%
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 368 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreend.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/ni.c | 351 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/nid.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 199 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600d.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 264 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv770d.h | 3 |
9 files changed, 222 insertions, 991 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 6a57f0d4dae8..01550d05e273 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1558,163 +1558,10 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
1558 | /* | 1558 | /* |
1559 | * Core functions | 1559 | * Core functions |
1560 | */ | 1560 | */ |
1561 | static u32 evergreen_get_tile_pipe_to_backend_map(struct radeon_device *rdev, | ||
1562 | u32 num_tile_pipes, | ||
1563 | u32 num_backends, | ||
1564 | u32 backend_disable_mask) | ||
1565 | { | ||
1566 | u32 backend_map = 0; | ||
1567 | u32 enabled_backends_mask = 0; | ||
1568 | u32 enabled_backends_count = 0; | ||
1569 | u32 cur_pipe; | ||
1570 | u32 swizzle_pipe[EVERGREEN_MAX_PIPES]; | ||
1571 | u32 cur_backend = 0; | ||
1572 | u32 i; | ||
1573 | bool force_no_swizzle; | ||
1574 | |||
1575 | if (num_tile_pipes > EVERGREEN_MAX_PIPES) | ||
1576 | num_tile_pipes = EVERGREEN_MAX_PIPES; | ||
1577 | if (num_tile_pipes < 1) | ||
1578 | num_tile_pipes = 1; | ||
1579 | if (num_backends > EVERGREEN_MAX_BACKENDS) | ||
1580 | num_backends = EVERGREEN_MAX_BACKENDS; | ||
1581 | if (num_backends < 1) | ||
1582 | num_backends = 1; | ||
1583 | |||
1584 | for (i = 0; i < EVERGREEN_MAX_BACKENDS; ++i) { | ||
1585 | if (((backend_disable_mask >> i) & 1) == 0) { | ||
1586 | enabled_backends_mask |= (1 << i); | ||
1587 | ++enabled_backends_count; | ||
1588 | } | ||
1589 | if (enabled_backends_count == num_backends) | ||
1590 | break; | ||
1591 | } | ||
1592 | |||
1593 | if (enabled_backends_count == 0) { | ||
1594 | enabled_backends_mask = 1; | ||
1595 | enabled_backends_count = 1; | ||
1596 | } | ||
1597 | |||
1598 | if (enabled_backends_count != num_backends) | ||
1599 | num_backends = enabled_backends_count; | ||
1600 | |||
1601 | memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * EVERGREEN_MAX_PIPES); | ||
1602 | switch (rdev->family) { | ||
1603 | case CHIP_CEDAR: | ||
1604 | case CHIP_REDWOOD: | ||
1605 | case CHIP_PALM: | ||
1606 | case CHIP_SUMO: | ||
1607 | case CHIP_SUMO2: | ||
1608 | case CHIP_TURKS: | ||
1609 | case CHIP_CAICOS: | ||
1610 | force_no_swizzle = false; | ||
1611 | break; | ||
1612 | case CHIP_CYPRESS: | ||
1613 | case CHIP_HEMLOCK: | ||
1614 | case CHIP_JUNIPER: | ||
1615 | case CHIP_BARTS: | ||
1616 | default: | ||
1617 | force_no_swizzle = true; | ||
1618 | break; | ||
1619 | } | ||
1620 | if (force_no_swizzle) { | ||
1621 | bool last_backend_enabled = false; | ||
1622 | |||
1623 | force_no_swizzle = false; | ||
1624 | for (i = 0; i < EVERGREEN_MAX_BACKENDS; ++i) { | ||
1625 | if (((enabled_backends_mask >> i) & 1) == 1) { | ||
1626 | if (last_backend_enabled) | ||
1627 | force_no_swizzle = true; | ||
1628 | last_backend_enabled = true; | ||
1629 | } else | ||
1630 | last_backend_enabled = false; | ||
1631 | } | ||
1632 | } | ||
1633 | |||
1634 | switch (num_tile_pipes) { | ||
1635 | case 1: | ||
1636 | case 3: | ||
1637 | case 5: | ||
1638 | case 7: | ||
1639 | DRM_ERROR("odd number of pipes!\n"); | ||
1640 | break; | ||
1641 | case 2: | ||
1642 | swizzle_pipe[0] = 0; | ||
1643 | swizzle_pipe[1] = 1; | ||
1644 | break; | ||
1645 | case 4: | ||
1646 | if (force_no_swizzle) { | ||
1647 | swizzle_pipe[0] = 0; | ||
1648 | swizzle_pipe[1] = 1; | ||
1649 | swizzle_pipe[2] = 2; | ||
1650 | swizzle_pipe[3] = 3; | ||
1651 | } else { | ||
1652 | swizzle_pipe[0] = 0; | ||
1653 | swizzle_pipe[1] = 2; | ||
1654 | swizzle_pipe[2] = 1; | ||
1655 | swizzle_pipe[3] = 3; | ||
1656 | } | ||
1657 | break; | ||
1658 | case 6: | ||
1659 | if (force_no_swizzle) { | ||
1660 | swizzle_pipe[0] = 0; | ||
1661 | swizzle_pipe[1] = 1; | ||
1662 | swizzle_pipe[2] = 2; | ||
1663 | swizzle_pipe[3] = 3; | ||
1664 | swizzle_pipe[4] = 4; | ||
1665 | swizzle_pipe[5] = 5; | ||
1666 | } else { | ||
1667 | swizzle_pipe[0] = 0; | ||
1668 | swizzle_pipe[1] = 2; | ||
1669 | swizzle_pipe[2] = 4; | ||
1670 | swizzle_pipe[3] = 1; | ||
1671 | swizzle_pipe[4] = 3; | ||
1672 | swizzle_pipe[5] = 5; | ||
1673 | } | ||
1674 | break; | ||
1675 | case 8: | ||
1676 | if (force_no_swizzle) { | ||
1677 | swizzle_pipe[0] = 0; | ||
1678 | swizzle_pipe[1] = 1; | ||
1679 | swizzle_pipe[2] = 2; | ||
1680 | swizzle_pipe[3] = 3; | ||
1681 | swizzle_pipe[4] = 4; | ||
1682 | swizzle_pipe[5] = 5; | ||
1683 | swizzle_pipe[6] = 6; | ||
1684 | swizzle_pipe[7] = 7; | ||
1685 | } else { | ||
1686 | swizzle_pipe[0] = 0; | ||
1687 | swizzle_pipe[1] = 2; | ||
1688 | swizzle_pipe[2] = 4; | ||
1689 | swizzle_pipe[3] = 6; | ||
1690 | swizzle_pipe[4] = 1; | ||
1691 | swizzle_pipe[5] = 3; | ||
1692 | swizzle_pipe[6] = 5; | ||
1693 | swizzle_pipe[7] = 7; | ||
1694 | } | ||
1695 | break; | ||
1696 | } | ||
1697 | |||
1698 | for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { | ||
1699 | while (((1 << cur_backend) & enabled_backends_mask) == 0) | ||
1700 | cur_backend = (cur_backend + 1) % EVERGREEN_MAX_BACKENDS; | ||
1701 | |||
1702 | backend_map |= (((cur_backend & 0xf) << (swizzle_pipe[cur_pipe] * 4))); | ||
1703 | |||
1704 | cur_backend = (cur_backend + 1) % EVERGREEN_MAX_BACKENDS; | ||
1705 | } | ||
1706 | |||
1707 | return backend_map; | ||
1708 | } | ||
1709 | |||
1710 | static void evergreen_gpu_init(struct radeon_device *rdev) | 1561 | static void evergreen_gpu_init(struct radeon_device *rdev) |
1711 | { | 1562 | { |
1712 | u32 cc_rb_backend_disable = 0; | 1563 | u32 gb_addr_config; |
1713 | u32 cc_gc_shader_pipe_config; | ||
1714 | u32 gb_addr_config = 0; | ||
1715 | u32 mc_shared_chmap, mc_arb_ramcfg; | 1564 | u32 mc_shared_chmap, mc_arb_ramcfg; |
1716 | u32 gb_backend_map; | ||
1717 | u32 grbm_gfx_index; | ||
1718 | u32 sx_debug_1; | 1565 | u32 sx_debug_1; |
1719 | u32 smx_dc_ctl0; | 1566 | u32 smx_dc_ctl0; |
1720 | u32 sq_config; | 1567 | u32 sq_config; |
@@ -1729,6 +1576,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1729 | u32 sq_stack_resource_mgmt_3; | 1576 | u32 sq_stack_resource_mgmt_3; |
1730 | u32 vgt_cache_invalidation; | 1577 | u32 vgt_cache_invalidation; |
1731 | u32 hdp_host_path_cntl, tmp; | 1578 | u32 hdp_host_path_cntl, tmp; |
1579 | u32 disabled_rb_mask; | ||
1732 | int i, j, num_shader_engines, ps_thread_count; | 1580 | int i, j, num_shader_engines, ps_thread_count; |
1733 | 1581 | ||
1734 | switch (rdev->family) { | 1582 | switch (rdev->family) { |
@@ -1753,6 +1601,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1753 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; | 1601 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
1754 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1602 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1755 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1603 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1604 | gb_addr_config = CYPRESS_GB_ADDR_CONFIG_GOLDEN; | ||
1756 | break; | 1605 | break; |
1757 | case CHIP_JUNIPER: | 1606 | case CHIP_JUNIPER: |
1758 | rdev->config.evergreen.num_ses = 1; | 1607 | rdev->config.evergreen.num_ses = 1; |
@@ -1774,6 +1623,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1774 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; | 1623 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
1775 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1624 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1776 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1625 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1626 | gb_addr_config = JUNIPER_GB_ADDR_CONFIG_GOLDEN; | ||
1777 | break; | 1627 | break; |
1778 | case CHIP_REDWOOD: | 1628 | case CHIP_REDWOOD: |
1779 | rdev->config.evergreen.num_ses = 1; | 1629 | rdev->config.evergreen.num_ses = 1; |
@@ -1795,6 +1645,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1795 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; | 1645 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
1796 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1646 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1797 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1647 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1648 | gb_addr_config = REDWOOD_GB_ADDR_CONFIG_GOLDEN; | ||
1798 | break; | 1649 | break; |
1799 | case CHIP_CEDAR: | 1650 | case CHIP_CEDAR: |
1800 | default: | 1651 | default: |
@@ -1817,6 +1668,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1817 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 1668 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1818 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1669 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1819 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1670 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1671 | gb_addr_config = CEDAR_GB_ADDR_CONFIG_GOLDEN; | ||
1820 | break; | 1672 | break; |
1821 | case CHIP_PALM: | 1673 | case CHIP_PALM: |
1822 | rdev->config.evergreen.num_ses = 1; | 1674 | rdev->config.evergreen.num_ses = 1; |
@@ -1838,6 +1690,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1838 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 1690 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1839 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1691 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1840 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1692 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1693 | gb_addr_config = CEDAR_GB_ADDR_CONFIG_GOLDEN; | ||
1841 | break; | 1694 | break; |
1842 | case CHIP_SUMO: | 1695 | case CHIP_SUMO: |
1843 | rdev->config.evergreen.num_ses = 1; | 1696 | rdev->config.evergreen.num_ses = 1; |
@@ -1865,6 +1718,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1865 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 1718 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1866 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1719 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1867 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1720 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1721 | gb_addr_config = REDWOOD_GB_ADDR_CONFIG_GOLDEN; | ||
1868 | break; | 1722 | break; |
1869 | case CHIP_SUMO2: | 1723 | case CHIP_SUMO2: |
1870 | rdev->config.evergreen.num_ses = 1; | 1724 | rdev->config.evergreen.num_ses = 1; |
@@ -1886,6 +1740,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1886 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 1740 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1887 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1741 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1888 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1742 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1743 | gb_addr_config = REDWOOD_GB_ADDR_CONFIG_GOLDEN; | ||
1889 | break; | 1744 | break; |
1890 | case CHIP_BARTS: | 1745 | case CHIP_BARTS: |
1891 | rdev->config.evergreen.num_ses = 2; | 1746 | rdev->config.evergreen.num_ses = 2; |
@@ -1907,6 +1762,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1907 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; | 1762 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
1908 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1763 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1909 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1764 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1765 | gb_addr_config = BARTS_GB_ADDR_CONFIG_GOLDEN; | ||
1910 | break; | 1766 | break; |
1911 | case CHIP_TURKS: | 1767 | case CHIP_TURKS: |
1912 | rdev->config.evergreen.num_ses = 1; | 1768 | rdev->config.evergreen.num_ses = 1; |
@@ -1928,6 +1784,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1928 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; | 1784 | rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
1929 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1785 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1930 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1786 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1787 | gb_addr_config = TURKS_GB_ADDR_CONFIG_GOLDEN; | ||
1931 | break; | 1788 | break; |
1932 | case CHIP_CAICOS: | 1789 | case CHIP_CAICOS: |
1933 | rdev->config.evergreen.num_ses = 1; | 1790 | rdev->config.evergreen.num_ses = 1; |
@@ -1949,6 +1806,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1949 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 1806 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1950 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1807 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1951 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1808 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1809 | gb_addr_config = CAICOS_GB_ADDR_CONFIG_GOLDEN; | ||
1952 | break; | 1810 | break; |
1953 | } | 1811 | } |
1954 | 1812 | ||
@@ -1965,20 +1823,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1965 | 1823 | ||
1966 | evergreen_fix_pci_max_read_req_size(rdev); | 1824 | evergreen_fix_pci_max_read_req_size(rdev); |
1967 | 1825 | ||
1968 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & ~2; | ||
1969 | |||
1970 | cc_gc_shader_pipe_config |= | ||
1971 | INACTIVE_QD_PIPES((EVERGREEN_MAX_PIPES_MASK << rdev->config.evergreen.max_pipes) | ||
1972 | & EVERGREEN_MAX_PIPES_MASK); | ||
1973 | cc_gc_shader_pipe_config |= | ||
1974 | INACTIVE_SIMDS((EVERGREEN_MAX_SIMDS_MASK << rdev->config.evergreen.max_simds) | ||
1975 | & EVERGREEN_MAX_SIMDS_MASK); | ||
1976 | |||
1977 | cc_rb_backend_disable = | ||
1978 | BACKEND_DISABLE((EVERGREEN_MAX_BACKENDS_MASK << rdev->config.evergreen.max_backends) | ||
1979 | & EVERGREEN_MAX_BACKENDS_MASK); | ||
1980 | |||
1981 | |||
1982 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); | 1826 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); |
1983 | if ((rdev->family == CHIP_PALM) || | 1827 | if ((rdev->family == CHIP_PALM) || |
1984 | (rdev->family == CHIP_SUMO) || | 1828 | (rdev->family == CHIP_SUMO) || |
@@ -1987,134 +1831,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1987 | else | 1831 | else |
1988 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 1832 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
1989 | 1833 | ||
1990 | switch (rdev->config.evergreen.max_tile_pipes) { | ||
1991 | case 1: | ||
1992 | default: | ||
1993 | gb_addr_config |= NUM_PIPES(0); | ||
1994 | break; | ||
1995 | case 2: | ||
1996 | gb_addr_config |= NUM_PIPES(1); | ||
1997 | break; | ||
1998 | case 4: | ||
1999 | gb_addr_config |= NUM_PIPES(2); | ||
2000 | break; | ||
2001 | case 8: | ||
2002 | gb_addr_config |= NUM_PIPES(3); | ||
2003 | break; | ||
2004 | } | ||
2005 | |||
2006 | gb_addr_config |= PIPE_INTERLEAVE_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); | ||
2007 | gb_addr_config |= BANK_INTERLEAVE_SIZE(0); | ||
2008 | gb_addr_config |= NUM_SHADER_ENGINES(rdev->config.evergreen.num_ses - 1); | ||
2009 | gb_addr_config |= SHADER_ENGINE_TILE_SIZE(1); | ||
2010 | gb_addr_config |= NUM_GPUS(0); /* Hemlock? */ | ||
2011 | gb_addr_config |= MULTI_GPU_TILE_SIZE(2); | ||
2012 | |||
2013 | if (((mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT) > 2) | ||
2014 | gb_addr_config |= ROW_SIZE(2); | ||
2015 | else | ||
2016 | gb_addr_config |= ROW_SIZE((mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT); | ||
2017 | |||
2018 | if (rdev->ddev->pdev->device == 0x689e) { | ||
2019 | u32 efuse_straps_4; | ||
2020 | u32 efuse_straps_3; | ||
2021 | u8 efuse_box_bit_131_124; | ||
2022 | |||
2023 | WREG32(RCU_IND_INDEX, 0x204); | ||
2024 | efuse_straps_4 = RREG32(RCU_IND_DATA); | ||
2025 | WREG32(RCU_IND_INDEX, 0x203); | ||
2026 | efuse_straps_3 = RREG32(RCU_IND_DATA); | ||
2027 | efuse_box_bit_131_124 = (u8)(((efuse_straps_4 & 0xf) << 4) | ((efuse_straps_3 & 0xf0000000) >> 28)); | ||
2028 | |||
2029 | switch(efuse_box_bit_131_124) { | ||
2030 | case 0x00: | ||
2031 | gb_backend_map = 0x76543210; | ||
2032 | break; | ||
2033 | case 0x55: | ||
2034 | gb_backend_map = 0x77553311; | ||
2035 | break; | ||
2036 | case 0x56: | ||
2037 | gb_backend_map = 0x77553300; | ||
2038 | break; | ||
2039 | case 0x59: | ||
2040 | gb_backend_map = 0x77552211; | ||
2041 | break; | ||
2042 | case 0x66: | ||
2043 | gb_backend_map = 0x77443300; | ||
2044 | break; | ||
2045 | case 0x99: | ||
2046 | gb_backend_map = 0x66552211; | ||
2047 | break; | ||
2048 | case 0x5a: | ||
2049 | gb_backend_map = 0x77552200; | ||
2050 | break; | ||
2051 | case 0xaa: | ||
2052 | gb_backend_map = 0x66442200; | ||
2053 | break; | ||
2054 | case 0x95: | ||
2055 | gb_backend_map = 0x66553311; | ||
2056 | break; | ||
2057 | default: | ||
2058 | DRM_ERROR("bad backend map, using default\n"); | ||
2059 | gb_backend_map = | ||
2060 | evergreen_get_tile_pipe_to_backend_map(rdev, | ||
2061 | rdev->config.evergreen.max_tile_pipes, | ||
2062 | rdev->config.evergreen.max_backends, | ||
2063 | ((EVERGREEN_MAX_BACKENDS_MASK << | ||
2064 | rdev->config.evergreen.max_backends) & | ||
2065 | EVERGREEN_MAX_BACKENDS_MASK)); | ||
2066 | break; | ||
2067 | } | ||
2068 | } else if (rdev->ddev->pdev->device == 0x68b9) { | ||
2069 | u32 efuse_straps_3; | ||
2070 | u8 efuse_box_bit_127_124; | ||
2071 | |||
2072 | WREG32(RCU_IND_INDEX, 0x203); | ||
2073 | efuse_straps_3 = RREG32(RCU_IND_DATA); | ||
2074 | efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28); | ||
2075 | |||
2076 | switch(efuse_box_bit_127_124) { | ||
2077 | case 0x0: | ||
2078 | gb_backend_map = 0x00003210; | ||
2079 | break; | ||
2080 | case 0x5: | ||
2081 | case 0x6: | ||
2082 | case 0x9: | ||
2083 | case 0xa: | ||
2084 | gb_backend_map = 0x00003311; | ||
2085 | break; | ||
2086 | default: | ||
2087 | DRM_ERROR("bad backend map, using default\n"); | ||
2088 | gb_backend_map = | ||
2089 | evergreen_get_tile_pipe_to_backend_map(rdev, | ||
2090 | rdev->config.evergreen.max_tile_pipes, | ||
2091 | rdev->config.evergreen.max_backends, | ||
2092 | ((EVERGREEN_MAX_BACKENDS_MASK << | ||
2093 | rdev->config.evergreen.max_backends) & | ||
2094 | EVERGREEN_MAX_BACKENDS_MASK)); | ||
2095 | break; | ||
2096 | } | ||
2097 | } else { | ||
2098 | switch (rdev->family) { | ||
2099 | case CHIP_CYPRESS: | ||
2100 | case CHIP_HEMLOCK: | ||
2101 | case CHIP_BARTS: | ||
2102 | gb_backend_map = 0x66442200; | ||
2103 | break; | ||
2104 | case CHIP_JUNIPER: | ||
2105 | gb_backend_map = 0x00002200; | ||
2106 | break; | ||
2107 | default: | ||
2108 | gb_backend_map = | ||
2109 | evergreen_get_tile_pipe_to_backend_map(rdev, | ||
2110 | rdev->config.evergreen.max_tile_pipes, | ||
2111 | rdev->config.evergreen.max_backends, | ||
2112 | ((EVERGREEN_MAX_BACKENDS_MASK << | ||
2113 | rdev->config.evergreen.max_backends) & | ||
2114 | EVERGREEN_MAX_BACKENDS_MASK)); | ||
2115 | } | ||
2116 | } | ||
2117 | |||
2118 | /* setup tiling info dword. gb_addr_config is not adequate since it does | 1834 | /* setup tiling info dword. gb_addr_config is not adequate since it does |
2119 | * not have bank info, so create a custom tiling dword. | 1835 | * not have bank info, so create a custom tiling dword. |
2120 | * bits 3:0 num_pipes | 1836 | * bits 3:0 num_pipes |
@@ -2147,42 +1863,48 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2147 | else | 1863 | else |
2148 | rdev->config.evergreen.tile_config |= 0 << 4; | 1864 | rdev->config.evergreen.tile_config |= 0 << 4; |
2149 | } | 1865 | } |
2150 | rdev->config.evergreen.tile_config |= | 1866 | rdev->config.evergreen.tile_config |= 0 << 8; |
2151 | ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) << 8; | ||
2152 | rdev->config.evergreen.tile_config |= | 1867 | rdev->config.evergreen.tile_config |= |
2153 | ((gb_addr_config & 0x30000000) >> 28) << 12; | 1868 | ((gb_addr_config & 0x30000000) >> 28) << 12; |
2154 | 1869 | ||
2155 | rdev->config.evergreen.backend_map = gb_backend_map; | 1870 | num_shader_engines = (gb_addr_config & NUM_SHADER_ENGINES(3) >> 12) + 1; |
2156 | WREG32(GB_BACKEND_MAP, gb_backend_map); | ||
2157 | WREG32(GB_ADDR_CONFIG, gb_addr_config); | ||
2158 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); | ||
2159 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); | ||
2160 | |||
2161 | num_shader_engines = ((RREG32(GB_ADDR_CONFIG) & NUM_SHADER_ENGINES(3)) >> 12) + 1; | ||
2162 | grbm_gfx_index = INSTANCE_BROADCAST_WRITES; | ||
2163 | 1871 | ||
2164 | for (i = 0; i < rdev->config.evergreen.num_ses; i++) { | 1872 | if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) { |
2165 | u32 rb = cc_rb_backend_disable | (0xf0 << 16); | 1873 | u32 efuse_straps_4; |
2166 | u32 sp = cc_gc_shader_pipe_config; | 1874 | u32 efuse_straps_3; |
2167 | u32 gfx = grbm_gfx_index | SE_INDEX(i); | ||
2168 | 1875 | ||
2169 | if (i == num_shader_engines) { | 1876 | WREG32(RCU_IND_INDEX, 0x204); |
2170 | rb |= BACKEND_DISABLE(EVERGREEN_MAX_BACKENDS_MASK); | 1877 | efuse_straps_4 = RREG32(RCU_IND_DATA); |
2171 | sp |= INACTIVE_SIMDS(EVERGREEN_MAX_SIMDS_MASK); | 1878 | WREG32(RCU_IND_INDEX, 0x203); |
1879 | efuse_straps_3 = RREG32(RCU_IND_DATA); | ||
1880 | tmp = (((efuse_straps_4 & 0xf) << 4) | | ||
1881 | ((efuse_straps_3 & 0xf0000000) >> 28)); | ||
1882 | } else { | ||
1883 | tmp = 0; | ||
1884 | for (i = (rdev->config.evergreen.num_ses - 1); i >= 0; i--) { | ||
1885 | u32 rb_disable_bitmap; | ||
1886 | |||
1887 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_INDEX(i)); | ||
1888 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_INDEX(i)); | ||
1889 | rb_disable_bitmap = (RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000) >> 16; | ||
1890 | tmp <<= 4; | ||
1891 | tmp |= rb_disable_bitmap; | ||
2172 | } | 1892 | } |
1893 | } | ||
1894 | /* enabled rb are just the one not disabled :) */ | ||
1895 | disabled_rb_mask = tmp; | ||
2173 | 1896 | ||
2174 | WREG32(GRBM_GFX_INDEX, gfx); | 1897 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |
2175 | WREG32(RLC_GFX_INDEX, gfx); | 1898 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); |
2176 | 1899 | ||
2177 | WREG32(CC_RB_BACKEND_DISABLE, rb); | 1900 | WREG32(GB_ADDR_CONFIG, gb_addr_config); |
2178 | WREG32(CC_SYS_RB_BACKEND_DISABLE, rb); | 1901 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); |
2179 | WREG32(GC_USER_RB_BACKEND_DISABLE, rb); | 1902 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); |
2180 | WREG32(CC_GC_SHADER_PIPE_CONFIG, sp); | ||
2181 | } | ||
2182 | 1903 | ||
2183 | grbm_gfx_index = INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES; | 1904 | tmp = gb_addr_config & NUM_PIPES_MASK; |
2184 | WREG32(GRBM_GFX_INDEX, grbm_gfx_index); | 1905 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.evergreen.max_backends, |
2185 | WREG32(RLC_GFX_INDEX, grbm_gfx_index); | 1906 | EVERGREEN_MAX_BACKENDS, disabled_rb_mask); |
1907 | WREG32(GB_BACKEND_MAP, tmp); | ||
2186 | 1908 | ||
2187 | WREG32(CGTS_SYS_TCC_DISABLE, 0); | 1909 | WREG32(CGTS_SYS_TCC_DISABLE, 0); |
2188 | WREG32(CGTS_TCC_DISABLE, 0); | 1910 | WREG32(CGTS_TCC_DISABLE, 0); |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 3dd43e760362..2773039b4902 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -37,6 +37,15 @@ | |||
37 | #define EVERGREEN_MAX_PIPES_MASK 0xFF | 37 | #define EVERGREEN_MAX_PIPES_MASK 0xFF |
38 | #define EVERGREEN_MAX_LDS_NUM 0xFFFF | 38 | #define EVERGREEN_MAX_LDS_NUM 0xFFFF |
39 | 39 | ||
40 | #define CYPRESS_GB_ADDR_CONFIG_GOLDEN 0x02011003 | ||
41 | #define BARTS_GB_ADDR_CONFIG_GOLDEN 0x02011003 | ||
42 | #define CAYMAN_GB_ADDR_CONFIG_GOLDEN 0x02011003 | ||
43 | #define JUNIPER_GB_ADDR_CONFIG_GOLDEN 0x02010002 | ||
44 | #define REDWOOD_GB_ADDR_CONFIG_GOLDEN 0x02010002 | ||
45 | #define TURKS_GB_ADDR_CONFIG_GOLDEN 0x02010002 | ||
46 | #define CEDAR_GB_ADDR_CONFIG_GOLDEN 0x02010001 | ||
47 | #define CAICOS_GB_ADDR_CONFIG_GOLDEN 0x02010001 | ||
48 | |||
40 | /* Registers */ | 49 | /* Registers */ |
41 | 50 | ||
42 | #define RCU_IND_INDEX 0x100 | 51 | #define RCU_IND_INDEX 0x100 |
@@ -54,6 +63,7 @@ | |||
54 | #define BACKEND_DISABLE(x) ((x) << 16) | 63 | #define BACKEND_DISABLE(x) ((x) << 16) |
55 | #define GB_ADDR_CONFIG 0x98F8 | 64 | #define GB_ADDR_CONFIG 0x98F8 |
56 | #define NUM_PIPES(x) ((x) << 0) | 65 | #define NUM_PIPES(x) ((x) << 0) |
66 | #define NUM_PIPES_MASK 0x0000000f | ||
57 | #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4) | 67 | #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4) |
58 | #define BANK_INTERLEAVE_SIZE(x) ((x) << 8) | 68 | #define BANK_INTERLEAVE_SIZE(x) ((x) << 8) |
59 | #define NUM_SHADER_ENGINES(x) ((x) << 12) | 69 | #define NUM_SHADER_ENGINES(x) ((x) << 12) |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 15f950c870da..3df4efa11942 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -417,215 +417,17 @@ out: | |||
417 | /* | 417 | /* |
418 | * Core functions | 418 | * Core functions |
419 | */ | 419 | */ |
420 | static u32 cayman_get_tile_pipe_to_backend_map(struct radeon_device *rdev, | ||
421 | u32 num_tile_pipes, | ||
422 | u32 num_backends_per_asic, | ||
423 | u32 *backend_disable_mask_per_asic, | ||
424 | u32 num_shader_engines) | ||
425 | { | ||
426 | u32 backend_map = 0; | ||
427 | u32 enabled_backends_mask = 0; | ||
428 | u32 enabled_backends_count = 0; | ||
429 | u32 num_backends_per_se; | ||
430 | u32 cur_pipe; | ||
431 | u32 swizzle_pipe[CAYMAN_MAX_PIPES]; | ||
432 | u32 cur_backend = 0; | ||
433 | u32 i; | ||
434 | bool force_no_swizzle; | ||
435 | |||
436 | /* force legal values */ | ||
437 | if (num_tile_pipes < 1) | ||
438 | num_tile_pipes = 1; | ||
439 | if (num_tile_pipes > rdev->config.cayman.max_tile_pipes) | ||
440 | num_tile_pipes = rdev->config.cayman.max_tile_pipes; | ||
441 | if (num_shader_engines < 1) | ||
442 | num_shader_engines = 1; | ||
443 | if (num_shader_engines > rdev->config.cayman.max_shader_engines) | ||
444 | num_shader_engines = rdev->config.cayman.max_shader_engines; | ||
445 | if (num_backends_per_asic < num_shader_engines) | ||
446 | num_backends_per_asic = num_shader_engines; | ||
447 | if (num_backends_per_asic > (rdev->config.cayman.max_backends_per_se * num_shader_engines)) | ||
448 | num_backends_per_asic = rdev->config.cayman.max_backends_per_se * num_shader_engines; | ||
449 | |||
450 | /* make sure we have the same number of backends per se */ | ||
451 | num_backends_per_asic = ALIGN(num_backends_per_asic, num_shader_engines); | ||
452 | /* set up the number of backends per se */ | ||
453 | num_backends_per_se = num_backends_per_asic / num_shader_engines; | ||
454 | if (num_backends_per_se > rdev->config.cayman.max_backends_per_se) { | ||
455 | num_backends_per_se = rdev->config.cayman.max_backends_per_se; | ||
456 | num_backends_per_asic = num_backends_per_se * num_shader_engines; | ||
457 | } | ||
458 | |||
459 | /* create enable mask and count for enabled backends */ | ||
460 | for (i = 0; i < CAYMAN_MAX_BACKENDS; ++i) { | ||
461 | if (((*backend_disable_mask_per_asic >> i) & 1) == 0) { | ||
462 | enabled_backends_mask |= (1 << i); | ||
463 | ++enabled_backends_count; | ||
464 | } | ||
465 | if (enabled_backends_count == num_backends_per_asic) | ||
466 | break; | ||
467 | } | ||
468 | |||
469 | /* force the backends mask to match the current number of backends */ | ||
470 | if (enabled_backends_count != num_backends_per_asic) { | ||
471 | u32 this_backend_enabled; | ||
472 | u32 shader_engine; | ||
473 | u32 backend_per_se; | ||
474 | |||
475 | enabled_backends_mask = 0; | ||
476 | enabled_backends_count = 0; | ||
477 | *backend_disable_mask_per_asic = CAYMAN_MAX_BACKENDS_MASK; | ||
478 | for (i = 0; i < CAYMAN_MAX_BACKENDS; ++i) { | ||
479 | /* calc the current se */ | ||
480 | shader_engine = i / rdev->config.cayman.max_backends_per_se; | ||
481 | /* calc the backend per se */ | ||
482 | backend_per_se = i % rdev->config.cayman.max_backends_per_se; | ||
483 | /* default to not enabled */ | ||
484 | this_backend_enabled = 0; | ||
485 | if ((shader_engine < num_shader_engines) && | ||
486 | (backend_per_se < num_backends_per_se)) | ||
487 | this_backend_enabled = 1; | ||
488 | if (this_backend_enabled) { | ||
489 | enabled_backends_mask |= (1 << i); | ||
490 | *backend_disable_mask_per_asic &= ~(1 << i); | ||
491 | ++enabled_backends_count; | ||
492 | } | ||
493 | } | ||
494 | } | ||
495 | |||
496 | |||
497 | memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * CAYMAN_MAX_PIPES); | ||
498 | switch (rdev->family) { | ||
499 | case CHIP_CAYMAN: | ||
500 | case CHIP_ARUBA: | ||
501 | force_no_swizzle = true; | ||
502 | break; | ||
503 | default: | ||
504 | force_no_swizzle = false; | ||
505 | break; | ||
506 | } | ||
507 | if (force_no_swizzle) { | ||
508 | bool last_backend_enabled = false; | ||
509 | |||
510 | force_no_swizzle = false; | ||
511 | for (i = 0; i < CAYMAN_MAX_BACKENDS; ++i) { | ||
512 | if (((enabled_backends_mask >> i) & 1) == 1) { | ||
513 | if (last_backend_enabled) | ||
514 | force_no_swizzle = true; | ||
515 | last_backend_enabled = true; | ||
516 | } else | ||
517 | last_backend_enabled = false; | ||
518 | } | ||
519 | } | ||
520 | |||
521 | switch (num_tile_pipes) { | ||
522 | case 1: | ||
523 | case 3: | ||
524 | case 5: | ||
525 | case 7: | ||
526 | DRM_ERROR("odd number of pipes!\n"); | ||
527 | break; | ||
528 | case 2: | ||
529 | swizzle_pipe[0] = 0; | ||
530 | swizzle_pipe[1] = 1; | ||
531 | break; | ||
532 | case 4: | ||
533 | if (force_no_swizzle) { | ||
534 | swizzle_pipe[0] = 0; | ||
535 | swizzle_pipe[1] = 1; | ||
536 | swizzle_pipe[2] = 2; | ||
537 | swizzle_pipe[3] = 3; | ||
538 | } else { | ||
539 | swizzle_pipe[0] = 0; | ||
540 | swizzle_pipe[1] = 2; | ||
541 | swizzle_pipe[2] = 1; | ||
542 | swizzle_pipe[3] = 3; | ||
543 | } | ||
544 | break; | ||
545 | case 6: | ||
546 | if (force_no_swizzle) { | ||
547 | swizzle_pipe[0] = 0; | ||
548 | swizzle_pipe[1] = 1; | ||
549 | swizzle_pipe[2] = 2; | ||
550 | swizzle_pipe[3] = 3; | ||
551 | swizzle_pipe[4] = 4; | ||
552 | swizzle_pipe[5] = 5; | ||
553 | } else { | ||
554 | swizzle_pipe[0] = 0; | ||
555 | swizzle_pipe[1] = 2; | ||
556 | swizzle_pipe[2] = 4; | ||
557 | swizzle_pipe[3] = 1; | ||
558 | swizzle_pipe[4] = 3; | ||
559 | swizzle_pipe[5] = 5; | ||
560 | } | ||
561 | break; | ||
562 | case 8: | ||
563 | if (force_no_swizzle) { | ||
564 | swizzle_pipe[0] = 0; | ||
565 | swizzle_pipe[1] = 1; | ||
566 | swizzle_pipe[2] = 2; | ||
567 | swizzle_pipe[3] = 3; | ||
568 | swizzle_pipe[4] = 4; | ||
569 | swizzle_pipe[5] = 5; | ||
570 | swizzle_pipe[6] = 6; | ||
571 | swizzle_pipe[7] = 7; | ||
572 | } else { | ||
573 | swizzle_pipe[0] = 0; | ||
574 | swizzle_pipe[1] = 2; | ||
575 | swizzle_pipe[2] = 4; | ||
576 | swizzle_pipe[3] = 6; | ||
577 | swizzle_pipe[4] = 1; | ||
578 | swizzle_pipe[5] = 3; | ||
579 | swizzle_pipe[6] = 5; | ||
580 | swizzle_pipe[7] = 7; | ||
581 | } | ||
582 | break; | ||
583 | } | ||
584 | |||
585 | for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { | ||
586 | while (((1 << cur_backend) & enabled_backends_mask) == 0) | ||
587 | cur_backend = (cur_backend + 1) % CAYMAN_MAX_BACKENDS; | ||
588 | |||
589 | backend_map |= (((cur_backend & 0xf) << (swizzle_pipe[cur_pipe] * 4))); | ||
590 | |||
591 | cur_backend = (cur_backend + 1) % CAYMAN_MAX_BACKENDS; | ||
592 | } | ||
593 | |||
594 | return backend_map; | ||
595 | } | ||
596 | |||
597 | static u32 cayman_get_disable_mask_per_asic(struct radeon_device *rdev, | ||
598 | u32 disable_mask_per_se, | ||
599 | u32 max_disable_mask_per_se, | ||
600 | u32 num_shader_engines) | ||
601 | { | ||
602 | u32 disable_field_width_per_se = r600_count_pipe_bits(disable_mask_per_se); | ||
603 | u32 disable_mask_per_asic = disable_mask_per_se & max_disable_mask_per_se; | ||
604 | |||
605 | if (num_shader_engines == 1) | ||
606 | return disable_mask_per_asic; | ||
607 | else if (num_shader_engines == 2) | ||
608 | return disable_mask_per_asic | (disable_mask_per_asic << disable_field_width_per_se); | ||
609 | else | ||
610 | return 0xffffffff; | ||
611 | } | ||
612 | |||
613 | static void cayman_gpu_init(struct radeon_device *rdev) | 420 | static void cayman_gpu_init(struct radeon_device *rdev) |
614 | { | 421 | { |
615 | u32 cc_rb_backend_disable = 0; | ||
616 | u32 cc_gc_shader_pipe_config; | ||
617 | u32 gb_addr_config = 0; | 422 | u32 gb_addr_config = 0; |
618 | u32 mc_shared_chmap, mc_arb_ramcfg; | 423 | u32 mc_shared_chmap, mc_arb_ramcfg; |
619 | u32 gb_backend_map; | ||
620 | u32 cgts_tcc_disable; | 424 | u32 cgts_tcc_disable; |
621 | u32 sx_debug_1; | 425 | u32 sx_debug_1; |
622 | u32 smx_dc_ctl0; | 426 | u32 smx_dc_ctl0; |
623 | u32 gc_user_shader_pipe_config; | ||
624 | u32 gc_user_rb_backend_disable; | ||
625 | u32 cgts_user_tcc_disable; | ||
626 | u32 cgts_sm_ctrl_reg; | 427 | u32 cgts_sm_ctrl_reg; |
627 | u32 hdp_host_path_cntl; | 428 | u32 hdp_host_path_cntl; |
628 | u32 tmp; | 429 | u32 tmp; |
430 | u32 disabled_rb_mask; | ||
629 | int i, j; | 431 | int i, j; |
630 | 432 | ||
631 | switch (rdev->family) { | 433 | switch (rdev->family) { |
@@ -650,6 +452,7 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
650 | rdev->config.cayman.sc_prim_fifo_size = 0x100; | 452 | rdev->config.cayman.sc_prim_fifo_size = 0x100; |
651 | rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; | 453 | rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; |
652 | rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; | 454 | rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; |
455 | gb_addr_config = CAYMAN_GB_ADDR_CONFIG_GOLDEN; | ||
653 | break; | 456 | break; |
654 | case CHIP_ARUBA: | 457 | case CHIP_ARUBA: |
655 | default: | 458 | default: |
@@ -687,6 +490,7 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
687 | rdev->config.cayman.sc_prim_fifo_size = 0x40; | 490 | rdev->config.cayman.sc_prim_fifo_size = 0x40; |
688 | rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; | 491 | rdev->config.cayman.sc_hiz_tile_fifo_size = 0x30; |
689 | rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; | 492 | rdev->config.cayman.sc_earlyz_tile_fifo_size = 0x130; |
493 | gb_addr_config = ARUBA_GB_ADDR_CONFIG_GOLDEN; | ||
690 | break; | 494 | break; |
691 | } | 495 | } |
692 | 496 | ||
@@ -706,39 +510,6 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
706 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); | 510 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); |
707 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 511 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
708 | 512 | ||
709 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE); | ||
710 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG); | ||
711 | cgts_tcc_disable = 0xffff0000; | ||
712 | for (i = 0; i < rdev->config.cayman.max_texture_channel_caches; i++) | ||
713 | cgts_tcc_disable &= ~(1 << (16 + i)); | ||
714 | gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE); | ||
715 | gc_user_shader_pipe_config = RREG32(GC_USER_SHADER_PIPE_CONFIG); | ||
716 | cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE); | ||
717 | |||
718 | rdev->config.cayman.num_shader_engines = rdev->config.cayman.max_shader_engines; | ||
719 | tmp = ((~gc_user_shader_pipe_config) & INACTIVE_QD_PIPES_MASK) >> INACTIVE_QD_PIPES_SHIFT; | ||
720 | rdev->config.cayman.num_shader_pipes_per_simd = r600_count_pipe_bits(tmp); | ||
721 | rdev->config.cayman.num_tile_pipes = rdev->config.cayman.max_tile_pipes; | ||
722 | tmp = ((~gc_user_shader_pipe_config) & INACTIVE_SIMDS_MASK) >> INACTIVE_SIMDS_SHIFT; | ||
723 | rdev->config.cayman.num_simds_per_se = r600_count_pipe_bits(tmp); | ||
724 | tmp = ((~gc_user_rb_backend_disable) & BACKEND_DISABLE_MASK) >> BACKEND_DISABLE_SHIFT; | ||
725 | rdev->config.cayman.num_backends_per_se = r600_count_pipe_bits(tmp); | ||
726 | tmp = (gc_user_rb_backend_disable & BACKEND_DISABLE_MASK) >> BACKEND_DISABLE_SHIFT; | ||
727 | rdev->config.cayman.backend_disable_mask_per_asic = | ||
728 | cayman_get_disable_mask_per_asic(rdev, tmp, CAYMAN_MAX_BACKENDS_PER_SE_MASK, | ||
729 | rdev->config.cayman.num_shader_engines); | ||
730 | rdev->config.cayman.backend_map = | ||
731 | cayman_get_tile_pipe_to_backend_map(rdev, rdev->config.cayman.num_tile_pipes, | ||
732 | rdev->config.cayman.num_backends_per_se * | ||
733 | rdev->config.cayman.num_shader_engines, | ||
734 | &rdev->config.cayman.backend_disable_mask_per_asic, | ||
735 | rdev->config.cayman.num_shader_engines); | ||
736 | tmp = ((~cgts_user_tcc_disable) & TCC_DISABLE_MASK) >> TCC_DISABLE_SHIFT; | ||
737 | rdev->config.cayman.num_texture_channel_caches = r600_count_pipe_bits(tmp); | ||
738 | tmp = (mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT; | ||
739 | rdev->config.cayman.mem_max_burst_length_bytes = (tmp + 1) * 256; | ||
740 | if (rdev->config.cayman.mem_max_burst_length_bytes > 512) | ||
741 | rdev->config.cayman.mem_max_burst_length_bytes = 512; | ||
742 | tmp = (mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT; | 513 | tmp = (mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT; |
743 | rdev->config.cayman.mem_row_size_in_kb = (4 * (1 << (8 + tmp))) / 1024; | 514 | rdev->config.cayman.mem_row_size_in_kb = (4 * (1 << (8 + tmp))) / 1024; |
744 | if (rdev->config.cayman.mem_row_size_in_kb > 4) | 515 | if (rdev->config.cayman.mem_row_size_in_kb > 4) |
@@ -748,73 +519,6 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
748 | rdev->config.cayman.num_gpus = 1; | 519 | rdev->config.cayman.num_gpus = 1; |
749 | rdev->config.cayman.multi_gpu_tile_size = 64; | 520 | rdev->config.cayman.multi_gpu_tile_size = 64; |
750 | 521 | ||
751 | //gb_addr_config = 0x02011003 | ||
752 | #if 0 | ||
753 | gb_addr_config = RREG32(GB_ADDR_CONFIG); | ||
754 | #else | ||
755 | gb_addr_config = 0; | ||
756 | switch (rdev->config.cayman.num_tile_pipes) { | ||
757 | case 1: | ||
758 | default: | ||
759 | gb_addr_config |= NUM_PIPES(0); | ||
760 | break; | ||
761 | case 2: | ||
762 | gb_addr_config |= NUM_PIPES(1); | ||
763 | break; | ||
764 | case 4: | ||
765 | gb_addr_config |= NUM_PIPES(2); | ||
766 | break; | ||
767 | case 8: | ||
768 | gb_addr_config |= NUM_PIPES(3); | ||
769 | break; | ||
770 | } | ||
771 | |||
772 | tmp = (rdev->config.cayman.mem_max_burst_length_bytes / 256) - 1; | ||
773 | gb_addr_config |= PIPE_INTERLEAVE_SIZE(tmp); | ||
774 | gb_addr_config |= NUM_SHADER_ENGINES(rdev->config.cayman.num_shader_engines - 1); | ||
775 | tmp = (rdev->config.cayman.shader_engine_tile_size / 16) - 1; | ||
776 | gb_addr_config |= SHADER_ENGINE_TILE_SIZE(tmp); | ||
777 | switch (rdev->config.cayman.num_gpus) { | ||
778 | case 1: | ||
779 | default: | ||
780 | gb_addr_config |= NUM_GPUS(0); | ||
781 | break; | ||
782 | case 2: | ||
783 | gb_addr_config |= NUM_GPUS(1); | ||
784 | break; | ||
785 | case 4: | ||
786 | gb_addr_config |= NUM_GPUS(2); | ||
787 | break; | ||
788 | } | ||
789 | switch (rdev->config.cayman.multi_gpu_tile_size) { | ||
790 | case 16: | ||
791 | gb_addr_config |= MULTI_GPU_TILE_SIZE(0); | ||
792 | break; | ||
793 | case 32: | ||
794 | default: | ||
795 | gb_addr_config |= MULTI_GPU_TILE_SIZE(1); | ||
796 | break; | ||
797 | case 64: | ||
798 | gb_addr_config |= MULTI_GPU_TILE_SIZE(2); | ||
799 | break; | ||
800 | case 128: | ||
801 | gb_addr_config |= MULTI_GPU_TILE_SIZE(3); | ||
802 | break; | ||
803 | } | ||
804 | switch (rdev->config.cayman.mem_row_size_in_kb) { | ||
805 | case 1: | ||
806 | default: | ||
807 | gb_addr_config |= ROW_SIZE(0); | ||
808 | break; | ||
809 | case 2: | ||
810 | gb_addr_config |= ROW_SIZE(1); | ||
811 | break; | ||
812 | case 4: | ||
813 | gb_addr_config |= ROW_SIZE(2); | ||
814 | break; | ||
815 | } | ||
816 | #endif | ||
817 | |||
818 | tmp = (gb_addr_config & NUM_PIPES_MASK) >> NUM_PIPES_SHIFT; | 522 | tmp = (gb_addr_config & NUM_PIPES_MASK) >> NUM_PIPES_SHIFT; |
819 | rdev->config.cayman.num_tile_pipes = (1 << tmp); | 523 | rdev->config.cayman.num_tile_pipes = (1 << tmp); |
820 | tmp = (gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT; | 524 | tmp = (gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT; |
@@ -828,17 +532,7 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
828 | tmp = (gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT; | 532 | tmp = (gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT; |
829 | rdev->config.cayman.mem_row_size_in_kb = 1 << tmp; | 533 | rdev->config.cayman.mem_row_size_in_kb = 1 << tmp; |
830 | 534 | ||
831 | //gb_backend_map = 0x76541032; | 535 | |
832 | #if 0 | ||
833 | gb_backend_map = RREG32(GB_BACKEND_MAP); | ||
834 | #else | ||
835 | gb_backend_map = | ||
836 | cayman_get_tile_pipe_to_backend_map(rdev, rdev->config.cayman.num_tile_pipes, | ||
837 | rdev->config.cayman.num_backends_per_se * | ||
838 | rdev->config.cayman.num_shader_engines, | ||
839 | &rdev->config.cayman.backend_disable_mask_per_asic, | ||
840 | rdev->config.cayman.num_shader_engines); | ||
841 | #endif | ||
842 | /* setup tiling info dword. gb_addr_config is not adequate since it does | 536 | /* setup tiling info dword. gb_addr_config is not adequate since it does |
843 | * not have bank info, so create a custom tiling dword. | 537 | * not have bank info, so create a custom tiling dword. |
844 | * bits 3:0 num_pipes | 538 | * bits 3:0 num_pipes |
@@ -877,25 +571,38 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
877 | rdev->config.cayman.tile_config |= | 571 | rdev->config.cayman.tile_config |= |
878 | ((gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT) << 12; | 572 | ((gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT) << 12; |
879 | 573 | ||
880 | rdev->config.cayman.backend_map = gb_backend_map; | 574 | tmp = 0; |
881 | WREG32(GB_BACKEND_MAP, gb_backend_map); | 575 | for (i = (rdev->config.cayman.max_shader_engines - 1); i >= 0; i--) { |
576 | u32 rb_disable_bitmap; | ||
577 | |||
578 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_INDEX(i)); | ||
579 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_INDEX(i)); | ||
580 | rb_disable_bitmap = (RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000) >> 16; | ||
581 | tmp <<= 4; | ||
582 | tmp |= rb_disable_bitmap; | ||
583 | } | ||
584 | /* enabled rb are just the one not disabled :) */ | ||
585 | disabled_rb_mask = tmp; | ||
586 | |||
587 | WREG32(GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | ||
588 | WREG32(RLC_GFX_INDEX, INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES); | ||
589 | |||
882 | WREG32(GB_ADDR_CONFIG, gb_addr_config); | 590 | WREG32(GB_ADDR_CONFIG, gb_addr_config); |
883 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); | 591 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); |
884 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); | 592 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); |
885 | 593 | ||
886 | /* primary versions */ | 594 | tmp = gb_addr_config & NUM_PIPES_MASK; |
887 | WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); | 595 | tmp = r6xx_remap_render_backend(rdev, tmp, |
888 | WREG32(CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); | 596 | rdev->config.cayman.max_backends_per_se * |
889 | WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | 597 | rdev->config.cayman.max_shader_engines, |
598 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | ||
599 | WREG32(GB_BACKEND_MAP, tmp); | ||
890 | 600 | ||
601 | cgts_tcc_disable = 0xffff0000; | ||
602 | for (i = 0; i < rdev->config.cayman.max_texture_channel_caches; i++) | ||
603 | cgts_tcc_disable &= ~(1 << (16 + i)); | ||
891 | WREG32(CGTS_TCC_DISABLE, cgts_tcc_disable); | 604 | WREG32(CGTS_TCC_DISABLE, cgts_tcc_disable); |
892 | WREG32(CGTS_SYS_TCC_DISABLE, cgts_tcc_disable); | 605 | WREG32(CGTS_SYS_TCC_DISABLE, cgts_tcc_disable); |
893 | |||
894 | /* user versions */ | ||
895 | WREG32(GC_USER_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
896 | WREG32(GC_USER_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
897 | WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | ||
898 | |||
899 | WREG32(CGTS_USER_SYS_TCC_DISABLE, cgts_tcc_disable); | 606 | WREG32(CGTS_USER_SYS_TCC_DISABLE, cgts_tcc_disable); |
900 | WREG32(CGTS_USER_TCC_DISABLE, cgts_tcc_disable); | 607 | WREG32(CGTS_USER_TCC_DISABLE, cgts_tcc_disable); |
901 | 608 | ||
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h index 2aa7046ada56..a0b98066e207 100644 --- a/drivers/gpu/drm/radeon/nid.h +++ b/drivers/gpu/drm/radeon/nid.h | |||
@@ -41,6 +41,9 @@ | |||
41 | #define CAYMAN_MAX_TCC 16 | 41 | #define CAYMAN_MAX_TCC 16 |
42 | #define CAYMAN_MAX_TCC_MASK 0xFF | 42 | #define CAYMAN_MAX_TCC_MASK 0xFF |
43 | 43 | ||
44 | #define CAYMAN_GB_ADDR_CONFIG_GOLDEN 0x02011003 | ||
45 | #define ARUBA_GB_ADDR_CONFIG_GOLDEN 0x12010001 | ||
46 | |||
44 | #define DMIF_ADDR_CONFIG 0xBD4 | 47 | #define DMIF_ADDR_CONFIG 0xBD4 |
45 | #define SRBM_GFX_CNTL 0x0E44 | 48 | #define SRBM_GFX_CNTL 0x0E44 |
46 | #define RINGID(x) (((x) & 0x3) << 0) | 49 | #define RINGID(x) (((x) & 0x3) << 0) |
@@ -148,6 +151,8 @@ | |||
148 | #define CGTS_SYS_TCC_DISABLE 0x3F90 | 151 | #define CGTS_SYS_TCC_DISABLE 0x3F90 |
149 | #define CGTS_USER_SYS_TCC_DISABLE 0x3F94 | 152 | #define CGTS_USER_SYS_TCC_DISABLE 0x3F94 |
150 | 153 | ||
154 | #define RLC_GFX_INDEX 0x3FC4 | ||
155 | |||
151 | #define CONFIG_MEMSIZE 0x5428 | 156 | #define CONFIG_MEMSIZE 0x5428 |
152 | 157 | ||
153 | #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480 | 158 | #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480 |
@@ -212,6 +217,12 @@ | |||
212 | #define SOFT_RESET_VGT (1 << 14) | 217 | #define SOFT_RESET_VGT (1 << 14) |
213 | #define SOFT_RESET_IA (1 << 15) | 218 | #define SOFT_RESET_IA (1 << 15) |
214 | 219 | ||
220 | #define GRBM_GFX_INDEX 0x802C | ||
221 | #define INSTANCE_INDEX(x) ((x) << 0) | ||
222 | #define SE_INDEX(x) ((x) << 16) | ||
223 | #define INSTANCE_BROADCAST_WRITES (1 << 30) | ||
224 | #define SE_BROADCAST_WRITES (1 << 31) | ||
225 | |||
215 | #define SCRATCH_REG0 0x8500 | 226 | #define SCRATCH_REG0 0x8500 |
216 | #define SCRATCH_REG1 0x8504 | 227 | #define SCRATCH_REG1 0x8504 |
217 | #define SCRATCH_REG2 0x8508 | 228 | #define SCRATCH_REG2 0x8508 |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index f388a1d73b63..45cfcea63507 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1376,113 +1376,51 @@ int r600_asic_reset(struct radeon_device *rdev) | |||
1376 | return r600_gpu_soft_reset(rdev); | 1376 | return r600_gpu_soft_reset(rdev); |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static u32 r600_get_tile_pipe_to_backend_map(u32 num_tile_pipes, | 1379 | u32 r6xx_remap_render_backend(struct radeon_device *rdev, |
1380 | u32 num_backends, | 1380 | u32 tiling_pipe_num, |
1381 | u32 backend_disable_mask) | 1381 | u32 max_rb_num, |
1382 | { | 1382 | u32 total_max_rb_num, |
1383 | u32 backend_map = 0; | 1383 | u32 disabled_rb_mask) |
1384 | u32 enabled_backends_mask; | 1384 | { |
1385 | u32 enabled_backends_count; | 1385 | u32 rendering_pipe_num, rb_num_width, req_rb_num; |
1386 | u32 cur_pipe; | 1386 | u32 pipe_rb_ratio, pipe_rb_remain; |
1387 | u32 swizzle_pipe[R6XX_MAX_PIPES]; | 1387 | u32 data = 0, mask = 1 << (max_rb_num - 1); |
1388 | u32 cur_backend; | 1388 | unsigned i, j; |
1389 | u32 i; | 1389 | |
1390 | 1390 | /* mask out the RBs that don't exist on that asic */ | |
1391 | if (num_tile_pipes > R6XX_MAX_PIPES) | 1391 | disabled_rb_mask |= (0xff << max_rb_num) & 0xff; |
1392 | num_tile_pipes = R6XX_MAX_PIPES; | 1392 | |
1393 | if (num_tile_pipes < 1) | 1393 | rendering_pipe_num = 1 << tiling_pipe_num; |
1394 | num_tile_pipes = 1; | 1394 | req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask); |
1395 | if (num_backends > R6XX_MAX_BACKENDS) | 1395 | BUG_ON(rendering_pipe_num < req_rb_num); |
1396 | num_backends = R6XX_MAX_BACKENDS; | 1396 | |
1397 | if (num_backends < 1) | 1397 | pipe_rb_ratio = rendering_pipe_num / req_rb_num; |
1398 | num_backends = 1; | 1398 | pipe_rb_remain = rendering_pipe_num - pipe_rb_ratio * req_rb_num; |
1399 | 1399 | ||
1400 | enabled_backends_mask = 0; | 1400 | if (rdev->family <= CHIP_RV740) { |
1401 | enabled_backends_count = 0; | 1401 | /* r6xx/r7xx */ |
1402 | for (i = 0; i < R6XX_MAX_BACKENDS; ++i) { | 1402 | rb_num_width = 2; |
1403 | if (((backend_disable_mask >> i) & 1) == 0) { | 1403 | } else { |
1404 | enabled_backends_mask |= (1 << i); | 1404 | /* eg+ */ |
1405 | ++enabled_backends_count; | 1405 | rb_num_width = 4; |
1406 | } | ||
1407 | if (enabled_backends_count == num_backends) | ||
1408 | break; | ||
1409 | } | ||
1410 | |||
1411 | if (enabled_backends_count == 0) { | ||
1412 | enabled_backends_mask = 1; | ||
1413 | enabled_backends_count = 1; | ||
1414 | } | ||
1415 | |||
1416 | if (enabled_backends_count != num_backends) | ||
1417 | num_backends = enabled_backends_count; | ||
1418 | |||
1419 | memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * R6XX_MAX_PIPES); | ||
1420 | switch (num_tile_pipes) { | ||
1421 | case 1: | ||
1422 | swizzle_pipe[0] = 0; | ||
1423 | break; | ||
1424 | case 2: | ||
1425 | swizzle_pipe[0] = 0; | ||
1426 | swizzle_pipe[1] = 1; | ||
1427 | break; | ||
1428 | case 3: | ||
1429 | swizzle_pipe[0] = 0; | ||
1430 | swizzle_pipe[1] = 1; | ||
1431 | swizzle_pipe[2] = 2; | ||
1432 | break; | ||
1433 | case 4: | ||
1434 | swizzle_pipe[0] = 0; | ||
1435 | swizzle_pipe[1] = 1; | ||
1436 | swizzle_pipe[2] = 2; | ||
1437 | swizzle_pipe[3] = 3; | ||
1438 | break; | ||
1439 | case 5: | ||
1440 | swizzle_pipe[0] = 0; | ||
1441 | swizzle_pipe[1] = 1; | ||
1442 | swizzle_pipe[2] = 2; | ||
1443 | swizzle_pipe[3] = 3; | ||
1444 | swizzle_pipe[4] = 4; | ||
1445 | break; | ||
1446 | case 6: | ||
1447 | swizzle_pipe[0] = 0; | ||
1448 | swizzle_pipe[1] = 2; | ||
1449 | swizzle_pipe[2] = 4; | ||
1450 | swizzle_pipe[3] = 5; | ||
1451 | swizzle_pipe[4] = 1; | ||
1452 | swizzle_pipe[5] = 3; | ||
1453 | break; | ||
1454 | case 7: | ||
1455 | swizzle_pipe[0] = 0; | ||
1456 | swizzle_pipe[1] = 2; | ||
1457 | swizzle_pipe[2] = 4; | ||
1458 | swizzle_pipe[3] = 6; | ||
1459 | swizzle_pipe[4] = 1; | ||
1460 | swizzle_pipe[5] = 3; | ||
1461 | swizzle_pipe[6] = 5; | ||
1462 | break; | ||
1463 | case 8: | ||
1464 | swizzle_pipe[0] = 0; | ||
1465 | swizzle_pipe[1] = 2; | ||
1466 | swizzle_pipe[2] = 4; | ||
1467 | swizzle_pipe[3] = 6; | ||
1468 | swizzle_pipe[4] = 1; | ||
1469 | swizzle_pipe[5] = 3; | ||
1470 | swizzle_pipe[6] = 5; | ||
1471 | swizzle_pipe[7] = 7; | ||
1472 | break; | ||
1473 | } | 1406 | } |
1474 | 1407 | ||
1475 | cur_backend = 0; | 1408 | for (i = 0; i < max_rb_num; i++) { |
1476 | for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { | 1409 | if (!(mask & disabled_rb_mask)) { |
1477 | while (((1 << cur_backend) & enabled_backends_mask) == 0) | 1410 | for (j = 0; j < pipe_rb_ratio; j++) { |
1478 | cur_backend = (cur_backend + 1) % R6XX_MAX_BACKENDS; | 1411 | data <<= rb_num_width; |
1479 | 1412 | data |= max_rb_num - i - 1; | |
1480 | backend_map |= (u32)(((cur_backend & 3) << (swizzle_pipe[cur_pipe] * 2))); | 1413 | } |
1481 | 1414 | if (pipe_rb_remain) { | |
1482 | cur_backend = (cur_backend + 1) % R6XX_MAX_BACKENDS; | 1415 | data <<= rb_num_width; |
1416 | data |= max_rb_num - i - 1; | ||
1417 | pipe_rb_remain--; | ||
1418 | } | ||
1419 | } | ||
1420 | mask >>= 1; | ||
1483 | } | 1421 | } |
1484 | 1422 | ||
1485 | return backend_map; | 1423 | return data; |
1486 | } | 1424 | } |
1487 | 1425 | ||
1488 | int r600_count_pipe_bits(uint32_t val) | 1426 | int r600_count_pipe_bits(uint32_t val) |
@@ -1500,7 +1438,6 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
1500 | { | 1438 | { |
1501 | u32 tiling_config; | 1439 | u32 tiling_config; |
1502 | u32 ramcfg; | 1440 | u32 ramcfg; |
1503 | u32 backend_map; | ||
1504 | u32 cc_rb_backend_disable; | 1441 | u32 cc_rb_backend_disable; |
1505 | u32 cc_gc_shader_pipe_config; | 1442 | u32 cc_gc_shader_pipe_config; |
1506 | u32 tmp; | 1443 | u32 tmp; |
@@ -1511,8 +1448,9 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
1511 | u32 sq_thread_resource_mgmt = 0; | 1448 | u32 sq_thread_resource_mgmt = 0; |
1512 | u32 sq_stack_resource_mgmt_1 = 0; | 1449 | u32 sq_stack_resource_mgmt_1 = 0; |
1513 | u32 sq_stack_resource_mgmt_2 = 0; | 1450 | u32 sq_stack_resource_mgmt_2 = 0; |
1451 | u32 disabled_rb_mask; | ||
1514 | 1452 | ||
1515 | /* FIXME: implement */ | 1453 | rdev->config.r600.tiling_group_size = 256; |
1516 | switch (rdev->family) { | 1454 | switch (rdev->family) { |
1517 | case CHIP_R600: | 1455 | case CHIP_R600: |
1518 | rdev->config.r600.max_pipes = 4; | 1456 | rdev->config.r600.max_pipes = 4; |
@@ -1616,10 +1554,7 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
1616 | rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); | 1554 | rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1617 | tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); | 1555 | tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1618 | tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); | 1556 | tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); |
1619 | if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) | 1557 | |
1620 | rdev->config.r600.tiling_group_size = 512; | ||
1621 | else | ||
1622 | rdev->config.r600.tiling_group_size = 256; | ||
1623 | tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; | 1558 | tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
1624 | if (tmp > 3) { | 1559 | if (tmp > 3) { |
1625 | tiling_config |= ROW_TILING(3); | 1560 | tiling_config |= ROW_TILING(3); |
@@ -1631,32 +1566,36 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
1631 | tiling_config |= BANK_SWAPS(1); | 1566 | tiling_config |= BANK_SWAPS(1); |
1632 | 1567 | ||
1633 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | 1568 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; |
1634 | cc_rb_backend_disable |= | 1569 | tmp = R6XX_MAX_BACKENDS - |
1635 | BACKEND_DISABLE((R6XX_MAX_BACKENDS_MASK << rdev->config.r600.max_backends) & R6XX_MAX_BACKENDS_MASK); | 1570 | r600_count_pipe_bits((cc_rb_backend_disable >> 16) & R6XX_MAX_BACKENDS_MASK); |
1636 | 1571 | if (tmp < rdev->config.r600.max_backends) { | |
1637 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; | 1572 | rdev->config.r600.max_backends = tmp; |
1638 | cc_gc_shader_pipe_config |= | 1573 | } |
1639 | INACTIVE_QD_PIPES((R6XX_MAX_PIPES_MASK << rdev->config.r600.max_pipes) & R6XX_MAX_PIPES_MASK); | 1574 | |
1640 | cc_gc_shader_pipe_config |= | 1575 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00; |
1641 | INACTIVE_SIMDS((R6XX_MAX_SIMDS_MASK << rdev->config.r600.max_simds) & R6XX_MAX_SIMDS_MASK); | 1576 | tmp = R6XX_MAX_PIPES - |
1642 | 1577 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R6XX_MAX_PIPES_MASK); | |
1643 | backend_map = r600_get_tile_pipe_to_backend_map(rdev->config.r600.max_tile_pipes, | 1578 | if (tmp < rdev->config.r600.max_pipes) { |
1644 | (R6XX_MAX_BACKENDS - | 1579 | rdev->config.r600.max_pipes = tmp; |
1645 | r600_count_pipe_bits((cc_rb_backend_disable & | 1580 | } |
1646 | R6XX_MAX_BACKENDS_MASK) >> 16)), | 1581 | tmp = R6XX_MAX_SIMDS - |
1647 | (cc_rb_backend_disable >> 16)); | 1582 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); |
1583 | if (tmp < rdev->config.r600.max_simds) { | ||
1584 | rdev->config.r600.max_simds = tmp; | ||
1585 | } | ||
1586 | |||
1587 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK; | ||
1588 | tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; | ||
1589 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends, | ||
1590 | R6XX_MAX_BACKENDS, disabled_rb_mask); | ||
1591 | tiling_config |= tmp << 16; | ||
1592 | rdev->config.r600.backend_map = tmp; | ||
1593 | |||
1648 | rdev->config.r600.tile_config = tiling_config; | 1594 | rdev->config.r600.tile_config = tiling_config; |
1649 | rdev->config.r600.backend_map = backend_map; | ||
1650 | tiling_config |= BACKEND_MAP(backend_map); | ||
1651 | WREG32(GB_TILING_CONFIG, tiling_config); | 1595 | WREG32(GB_TILING_CONFIG, tiling_config); |
1652 | WREG32(DCP_TILING_CONFIG, tiling_config & 0xffff); | 1596 | WREG32(DCP_TILING_CONFIG, tiling_config & 0xffff); |
1653 | WREG32(HDP_TILING_CONFIG, tiling_config & 0xffff); | 1597 | WREG32(HDP_TILING_CONFIG, tiling_config & 0xffff); |
1654 | 1598 | ||
1655 | /* Setup pipes */ | ||
1656 | WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
1657 | WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | ||
1658 | WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | ||
1659 | |||
1660 | tmp = R6XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); | 1599 | tmp = R6XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); |
1661 | WREG32(VGT_OUT_DEALLOC_CNTL, (tmp * 4) & DEALLOC_DIST_MASK); | 1600 | WREG32(VGT_OUT_DEALLOC_CNTL, (tmp * 4) & DEALLOC_DIST_MASK); |
1662 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, ((tmp * 4) - 2) & VTX_REUSE_DEPTH_MASK); | 1601 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, ((tmp * 4) - 2) & VTX_REUSE_DEPTH_MASK); |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 15bd3b216243..a0dbf1fe6a40 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -219,6 +219,8 @@ | |||
219 | #define BACKEND_MAP(x) ((x) << 16) | 219 | #define BACKEND_MAP(x) ((x) << 16) |
220 | 220 | ||
221 | #define GB_TILING_CONFIG 0x98F0 | 221 | #define GB_TILING_CONFIG 0x98F0 |
222 | #define PIPE_TILING__SHIFT 1 | ||
223 | #define PIPE_TILING__MASK 0x0000000e | ||
222 | 224 | ||
223 | #define GC_USER_SHADER_PIPE_CONFIG 0x8954 | 225 | #define GC_USER_SHADER_PIPE_CONFIG 0x8954 |
224 | #define INACTIVE_QD_PIPES(x) ((x) << 8) | 226 | #define INACTIVE_QD_PIPES(x) ((x) << 8) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 492654f8ee74..e25836b72c73 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1845,6 +1845,11 @@ extern struct radeon_hdmi_acr r600_hdmi_acr(uint32_t clock); | |||
1845 | extern void r600_hdmi_enable(struct drm_encoder *encoder); | 1845 | extern void r600_hdmi_enable(struct drm_encoder *encoder); |
1846 | extern void r600_hdmi_disable(struct drm_encoder *encoder); | 1846 | extern void r600_hdmi_disable(struct drm_encoder *encoder); |
1847 | extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); | 1847 | extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); |
1848 | extern u32 r6xx_remap_render_backend(struct radeon_device *rdev, | ||
1849 | u32 tiling_pipe_num, | ||
1850 | u32 max_rb_num, | ||
1851 | u32 total_max_rb_num, | ||
1852 | u32 enabled_rb_mask); | ||
1848 | 1853 | ||
1849 | /* | 1854 | /* |
1850 | * evergreen functions used by radeon_encoder.c | 1855 | * evergreen functions used by radeon_encoder.c |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c12349dba3a2..04ddc365a908 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -365,180 +365,6 @@ void r700_cp_fini(struct radeon_device *rdev) | |||
365 | /* | 365 | /* |
366 | * Core functions | 366 | * Core functions |
367 | */ | 367 | */ |
368 | static u32 r700_get_tile_pipe_to_backend_map(struct radeon_device *rdev, | ||
369 | u32 num_tile_pipes, | ||
370 | u32 num_backends, | ||
371 | u32 backend_disable_mask) | ||
372 | { | ||
373 | u32 backend_map = 0; | ||
374 | u32 enabled_backends_mask; | ||
375 | u32 enabled_backends_count; | ||
376 | u32 cur_pipe; | ||
377 | u32 swizzle_pipe[R7XX_MAX_PIPES]; | ||
378 | u32 cur_backend; | ||
379 | u32 i; | ||
380 | bool force_no_swizzle; | ||
381 | |||
382 | if (num_tile_pipes > R7XX_MAX_PIPES) | ||
383 | num_tile_pipes = R7XX_MAX_PIPES; | ||
384 | if (num_tile_pipes < 1) | ||
385 | num_tile_pipes = 1; | ||
386 | if (num_backends > R7XX_MAX_BACKENDS) | ||
387 | num_backends = R7XX_MAX_BACKENDS; | ||
388 | if (num_backends < 1) | ||
389 | num_backends = 1; | ||
390 | |||
391 | enabled_backends_mask = 0; | ||
392 | enabled_backends_count = 0; | ||
393 | for (i = 0; i < R7XX_MAX_BACKENDS; ++i) { | ||
394 | if (((backend_disable_mask >> i) & 1) == 0) { | ||
395 | enabled_backends_mask |= (1 << i); | ||
396 | ++enabled_backends_count; | ||
397 | } | ||
398 | if (enabled_backends_count == num_backends) | ||
399 | break; | ||
400 | } | ||
401 | |||
402 | if (enabled_backends_count == 0) { | ||
403 | enabled_backends_mask = 1; | ||
404 | enabled_backends_count = 1; | ||
405 | } | ||
406 | |||
407 | if (enabled_backends_count != num_backends) | ||
408 | num_backends = enabled_backends_count; | ||
409 | |||
410 | switch (rdev->family) { | ||
411 | case CHIP_RV770: | ||
412 | case CHIP_RV730: | ||
413 | force_no_swizzle = false; | ||
414 | break; | ||
415 | case CHIP_RV710: | ||
416 | case CHIP_RV740: | ||
417 | default: | ||
418 | force_no_swizzle = true; | ||
419 | break; | ||
420 | } | ||
421 | |||
422 | memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * R7XX_MAX_PIPES); | ||
423 | switch (num_tile_pipes) { | ||
424 | case 1: | ||
425 | swizzle_pipe[0] = 0; | ||
426 | break; | ||
427 | case 2: | ||
428 | swizzle_pipe[0] = 0; | ||
429 | swizzle_pipe[1] = 1; | ||
430 | break; | ||
431 | case 3: | ||
432 | if (force_no_swizzle) { | ||
433 | swizzle_pipe[0] = 0; | ||
434 | swizzle_pipe[1] = 1; | ||
435 | swizzle_pipe[2] = 2; | ||
436 | } else { | ||
437 | swizzle_pipe[0] = 0; | ||
438 | swizzle_pipe[1] = 2; | ||
439 | swizzle_pipe[2] = 1; | ||
440 | } | ||
441 | break; | ||
442 | case 4: | ||
443 | if (force_no_swizzle) { | ||
444 | swizzle_pipe[0] = 0; | ||
445 | swizzle_pipe[1] = 1; | ||
446 | swizzle_pipe[2] = 2; | ||
447 | swizzle_pipe[3] = 3; | ||
448 | } else { | ||
449 | swizzle_pipe[0] = 0; | ||
450 | swizzle_pipe[1] = 2; | ||
451 | swizzle_pipe[2] = 3; | ||
452 | swizzle_pipe[3] = 1; | ||
453 | } | ||
454 | break; | ||
455 | case 5: | ||
456 | if (force_no_swizzle) { | ||
457 | swizzle_pipe[0] = 0; | ||
458 | swizzle_pipe[1] = 1; | ||
459 | swizzle_pipe[2] = 2; | ||
460 | swizzle_pipe[3] = 3; | ||
461 | swizzle_pipe[4] = 4; | ||
462 | } else { | ||
463 | swizzle_pipe[0] = 0; | ||
464 | swizzle_pipe[1] = 2; | ||
465 | swizzle_pipe[2] = 4; | ||
466 | swizzle_pipe[3] = 1; | ||
467 | swizzle_pipe[4] = 3; | ||
468 | } | ||
469 | break; | ||
470 | case 6: | ||
471 | if (force_no_swizzle) { | ||
472 | swizzle_pipe[0] = 0; | ||
473 | swizzle_pipe[1] = 1; | ||
474 | swizzle_pipe[2] = 2; | ||
475 | swizzle_pipe[3] = 3; | ||
476 | swizzle_pipe[4] = 4; | ||
477 | swizzle_pipe[5] = 5; | ||
478 | } else { | ||
479 | swizzle_pipe[0] = 0; | ||
480 | swizzle_pipe[1] = 2; | ||
481 | swizzle_pipe[2] = 4; | ||
482 | swizzle_pipe[3] = 5; | ||
483 | swizzle_pipe[4] = 3; | ||
484 | swizzle_pipe[5] = 1; | ||
485 | } | ||
486 | break; | ||
487 | case 7: | ||
488 | if (force_no_swizzle) { | ||
489 | swizzle_pipe[0] = 0; | ||
490 | swizzle_pipe[1] = 1; | ||
491 | swizzle_pipe[2] = 2; | ||
492 | swizzle_pipe[3] = 3; | ||
493 | swizzle_pipe[4] = 4; | ||
494 | swizzle_pipe[5] = 5; | ||
495 | swizzle_pipe[6] = 6; | ||
496 | } else { | ||
497 | swizzle_pipe[0] = 0; | ||
498 | swizzle_pipe[1] = 2; | ||
499 | swizzle_pipe[2] = 4; | ||
500 | swizzle_pipe[3] = 6; | ||
501 | swizzle_pipe[4] = 3; | ||
502 | swizzle_pipe[5] = 1; | ||
503 | swizzle_pipe[6] = 5; | ||
504 | } | ||
505 | break; | ||
506 | case 8: | ||
507 | if (force_no_swizzle) { | ||
508 | swizzle_pipe[0] = 0; | ||
509 | swizzle_pipe[1] = 1; | ||
510 | swizzle_pipe[2] = 2; | ||
511 | swizzle_pipe[3] = 3; | ||
512 | swizzle_pipe[4] = 4; | ||
513 | swizzle_pipe[5] = 5; | ||
514 | swizzle_pipe[6] = 6; | ||
515 | swizzle_pipe[7] = 7; | ||
516 | } else { | ||
517 | swizzle_pipe[0] = 0; | ||
518 | swizzle_pipe[1] = 2; | ||
519 | swizzle_pipe[2] = 4; | ||
520 | swizzle_pipe[3] = 6; | ||
521 | swizzle_pipe[4] = 3; | ||
522 | swizzle_pipe[5] = 1; | ||
523 | swizzle_pipe[6] = 7; | ||
524 | swizzle_pipe[7] = 5; | ||
525 | } | ||
526 | break; | ||
527 | } | ||
528 | |||
529 | cur_backend = 0; | ||
530 | for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { | ||
531 | while (((1 << cur_backend) & enabled_backends_mask) == 0) | ||
532 | cur_backend = (cur_backend + 1) % R7XX_MAX_BACKENDS; | ||
533 | |||
534 | backend_map |= (u32)(((cur_backend & 3) << (swizzle_pipe[cur_pipe] * 2))); | ||
535 | |||
536 | cur_backend = (cur_backend + 1) % R7XX_MAX_BACKENDS; | ||
537 | } | ||
538 | |||
539 | return backend_map; | ||
540 | } | ||
541 | |||
542 | static void rv770_gpu_init(struct radeon_device *rdev) | 368 | static void rv770_gpu_init(struct radeon_device *rdev) |
543 | { | 369 | { |
544 | int i, j, num_qd_pipes; | 370 | int i, j, num_qd_pipes; |
@@ -554,14 +380,17 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
554 | u32 sq_thread_resource_mgmt; | 380 | u32 sq_thread_resource_mgmt; |
555 | u32 hdp_host_path_cntl; | 381 | u32 hdp_host_path_cntl; |
556 | u32 sq_dyn_gpr_size_simd_ab_0; | 382 | u32 sq_dyn_gpr_size_simd_ab_0; |
557 | u32 backend_map; | ||
558 | u32 gb_tiling_config = 0; | 383 | u32 gb_tiling_config = 0; |
559 | u32 cc_rb_backend_disable = 0; | 384 | u32 cc_rb_backend_disable = 0; |
560 | u32 cc_gc_shader_pipe_config = 0; | 385 | u32 cc_gc_shader_pipe_config = 0; |
561 | u32 mc_arb_ramcfg; | 386 | u32 mc_arb_ramcfg; |
562 | u32 db_debug4; | 387 | u32 db_debug4, tmp; |
388 | u32 inactive_pipes, shader_pipe_config; | ||
389 | u32 disabled_rb_mask; | ||
390 | unsigned active_number; | ||
563 | 391 | ||
564 | /* setup chip specs */ | 392 | /* setup chip specs */ |
393 | rdev->config.rv770.tiling_group_size = 256; | ||
565 | switch (rdev->family) { | 394 | switch (rdev->family) { |
566 | case CHIP_RV770: | 395 | case CHIP_RV770: |
567 | rdev->config.rv770.max_pipes = 4; | 396 | rdev->config.rv770.max_pipes = 4; |
@@ -672,23 +501,60 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
672 | /* setup tiling, simd, pipe config */ | 501 | /* setup tiling, simd, pipe config */ |
673 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 502 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
674 | 503 | ||
504 | shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG); | ||
505 | inactive_pipes = (shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> INACTIVE_QD_PIPES_SHIFT; | ||
506 | for (i = 0, tmp = 1, active_number = 0; i < R7XX_MAX_PIPES; i++) { | ||
507 | if (!(inactive_pipes & tmp)) { | ||
508 | active_number++; | ||
509 | } | ||
510 | tmp <<= 1; | ||
511 | } | ||
512 | if (active_number == 1) { | ||
513 | WREG32(SPI_CONFIG_CNTL, DISABLE_INTERP_1); | ||
514 | } else { | ||
515 | WREG32(SPI_CONFIG_CNTL, 0); | ||
516 | } | ||
517 | |||
518 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | ||
519 | tmp = R7XX_MAX_BACKENDS - r600_count_pipe_bits(cc_rb_backend_disable >> 16); | ||
520 | if (tmp < rdev->config.rv770.max_backends) { | ||
521 | rdev->config.rv770.max_backends = tmp; | ||
522 | } | ||
523 | |||
524 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; | ||
525 | tmp = R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R7XX_MAX_PIPES_MASK); | ||
526 | if (tmp < rdev->config.rv770.max_pipes) { | ||
527 | rdev->config.rv770.max_pipes = tmp; | ||
528 | } | ||
529 | tmp = R7XX_MAX_SIMDS - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); | ||
530 | if (tmp < rdev->config.rv770.max_simds) { | ||
531 | rdev->config.rv770.max_simds = tmp; | ||
532 | } | ||
533 | |||
675 | switch (rdev->config.rv770.max_tile_pipes) { | 534 | switch (rdev->config.rv770.max_tile_pipes) { |
676 | case 1: | 535 | case 1: |
677 | default: | 536 | default: |
678 | gb_tiling_config |= PIPE_TILING(0); | 537 | gb_tiling_config = PIPE_TILING(0); |
679 | break; | 538 | break; |
680 | case 2: | 539 | case 2: |
681 | gb_tiling_config |= PIPE_TILING(1); | 540 | gb_tiling_config = PIPE_TILING(1); |
682 | break; | 541 | break; |
683 | case 4: | 542 | case 4: |
684 | gb_tiling_config |= PIPE_TILING(2); | 543 | gb_tiling_config = PIPE_TILING(2); |
685 | break; | 544 | break; |
686 | case 8: | 545 | case 8: |
687 | gb_tiling_config |= PIPE_TILING(3); | 546 | gb_tiling_config = PIPE_TILING(3); |
688 | break; | 547 | break; |
689 | } | 548 | } |
690 | rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; | 549 | rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; |
691 | 550 | ||
551 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R7XX_MAX_BACKENDS_MASK; | ||
552 | tmp = (gb_tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; | ||
553 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.rv770.max_backends, | ||
554 | R7XX_MAX_BACKENDS, disabled_rb_mask); | ||
555 | gb_tiling_config |= tmp << 16; | ||
556 | rdev->config.rv770.backend_map = tmp; | ||
557 | |||
692 | if (rdev->family == CHIP_RV770) | 558 | if (rdev->family == CHIP_RV770) |
693 | gb_tiling_config |= BANK_TILING(1); | 559 | gb_tiling_config |= BANK_TILING(1); |
694 | else { | 560 | else { |
@@ -699,10 +565,6 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
699 | } | 565 | } |
700 | rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); | 566 | rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); |
701 | gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); | 567 | gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); |
702 | if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) | ||
703 | rdev->config.rv770.tiling_group_size = 512; | ||
704 | else | ||
705 | rdev->config.rv770.tiling_group_size = 256; | ||
706 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { | 568 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { |
707 | gb_tiling_config |= ROW_TILING(3); | 569 | gb_tiling_config |= ROW_TILING(3); |
708 | gb_tiling_config |= SAMPLE_SPLIT(3); | 570 | gb_tiling_config |= SAMPLE_SPLIT(3); |
@@ -714,47 +576,19 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
714 | } | 576 | } |
715 | 577 | ||
716 | gb_tiling_config |= BANK_SWAPS(1); | 578 | gb_tiling_config |= BANK_SWAPS(1); |
717 | |||
718 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | ||
719 | cc_rb_backend_disable |= | ||
720 | BACKEND_DISABLE((R7XX_MAX_BACKENDS_MASK << rdev->config.rv770.max_backends) & R7XX_MAX_BACKENDS_MASK); | ||
721 | |||
722 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; | ||
723 | cc_gc_shader_pipe_config |= | ||
724 | INACTIVE_QD_PIPES((R7XX_MAX_PIPES_MASK << rdev->config.rv770.max_pipes) & R7XX_MAX_PIPES_MASK); | ||
725 | cc_gc_shader_pipe_config |= | ||
726 | INACTIVE_SIMDS((R7XX_MAX_SIMDS_MASK << rdev->config.rv770.max_simds) & R7XX_MAX_SIMDS_MASK); | ||
727 | |||
728 | if (rdev->family == CHIP_RV740) | ||
729 | backend_map = 0x28; | ||
730 | else | ||
731 | backend_map = r700_get_tile_pipe_to_backend_map(rdev, | ||
732 | rdev->config.rv770.max_tile_pipes, | ||
733 | (R7XX_MAX_BACKENDS - | ||
734 | r600_count_pipe_bits((cc_rb_backend_disable & | ||
735 | R7XX_MAX_BACKENDS_MASK) >> 16)), | ||
736 | (cc_rb_backend_disable >> 16)); | ||
737 | |||
738 | rdev->config.rv770.tile_config = gb_tiling_config; | 579 | rdev->config.rv770.tile_config = gb_tiling_config; |
739 | rdev->config.rv770.backend_map = backend_map; | ||
740 | gb_tiling_config |= BACKEND_MAP(backend_map); | ||
741 | 580 | ||
742 | WREG32(GB_TILING_CONFIG, gb_tiling_config); | 581 | WREG32(GB_TILING_CONFIG, gb_tiling_config); |
743 | WREG32(DCP_TILING_CONFIG, (gb_tiling_config & 0xffff)); | 582 | WREG32(DCP_TILING_CONFIG, (gb_tiling_config & 0xffff)); |
744 | WREG32(HDP_TILING_CONFIG, (gb_tiling_config & 0xffff)); | 583 | WREG32(HDP_TILING_CONFIG, (gb_tiling_config & 0xffff)); |
745 | 584 | ||
746 | WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
747 | WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | ||
748 | WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); | ||
749 | WREG32(CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
750 | |||
751 | WREG32(CGTS_SYS_TCC_DISABLE, 0); | 585 | WREG32(CGTS_SYS_TCC_DISABLE, 0); |
752 | WREG32(CGTS_TCC_DISABLE, 0); | 586 | WREG32(CGTS_TCC_DISABLE, 0); |
753 | WREG32(CGTS_USER_SYS_TCC_DISABLE, 0); | 587 | WREG32(CGTS_USER_SYS_TCC_DISABLE, 0); |
754 | WREG32(CGTS_USER_TCC_DISABLE, 0); | 588 | WREG32(CGTS_USER_TCC_DISABLE, 0); |
755 | 589 | ||
756 | num_qd_pipes = | 590 | |
757 | R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); | 591 | num_qd_pipes = R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); |
758 | WREG32(VGT_OUT_DEALLOC_CNTL, (num_qd_pipes * 4) & DEALLOC_DIST_MASK); | 592 | WREG32(VGT_OUT_DEALLOC_CNTL, (num_qd_pipes * 4) & DEALLOC_DIST_MASK); |
759 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, ((num_qd_pipes * 4) - 2) & VTX_REUSE_DEPTH_MASK); | 593 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, ((num_qd_pipes * 4) - 2) & VTX_REUSE_DEPTH_MASK); |
760 | 594 | ||
@@ -815,8 +649,6 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
815 | 649 | ||
816 | WREG32(VGT_NUM_INSTANCES, 1); | 650 | WREG32(VGT_NUM_INSTANCES, 1); |
817 | 651 | ||
818 | WREG32(SPI_CONFIG_CNTL, GPR_WRITE_PRIORITY(0)); | ||
819 | |||
820 | WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4)); | 652 | WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4)); |
821 | 653 | ||
822 | WREG32(CP_PERFMON_CNTL, 0); | 654 | WREG32(CP_PERFMON_CNTL, 0); |
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h index 7addbef54b42..fdc089896011 100644 --- a/drivers/gpu/drm/radeon/rv770d.h +++ b/drivers/gpu/drm/radeon/rv770d.h | |||
@@ -106,10 +106,13 @@ | |||
106 | #define BACKEND_MAP(x) ((x) << 16) | 106 | #define BACKEND_MAP(x) ((x) << 16) |
107 | 107 | ||
108 | #define GB_TILING_CONFIG 0x98F0 | 108 | #define GB_TILING_CONFIG 0x98F0 |
109 | #define PIPE_TILING__SHIFT 1 | ||
110 | #define PIPE_TILING__MASK 0x0000000e | ||
109 | 111 | ||
110 | #define GC_USER_SHADER_PIPE_CONFIG 0x8954 | 112 | #define GC_USER_SHADER_PIPE_CONFIG 0x8954 |
111 | #define INACTIVE_QD_PIPES(x) ((x) << 8) | 113 | #define INACTIVE_QD_PIPES(x) ((x) << 8) |
112 | #define INACTIVE_QD_PIPES_MASK 0x0000FF00 | 114 | #define INACTIVE_QD_PIPES_MASK 0x0000FF00 |
115 | #define INACTIVE_QD_PIPES_SHIFT 8 | ||
113 | #define INACTIVE_SIMDS(x) ((x) << 16) | 116 | #define INACTIVE_SIMDS(x) ((x) << 16) |
114 | #define INACTIVE_SIMDS_MASK 0x00FF0000 | 117 | #define INACTIVE_SIMDS_MASK 0x00FF0000 |
115 | 118 | ||