diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-03-20 17:18:19 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-21 02:55:54 -0400 |
commit | 48c0c902e2e6ca07b8c7ae1da48a7bb59eb88de9 (patch) | |
tree | 1dfb90439a16ca0f6533466aefa31d31bd495a8d /drivers/gpu | |
parent | 8b074dd64053d0bf93eed0638b74a8fec401577f (diff) |
drm/radeon/kms: add support for CP setup on SI
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/si.c | 267 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/si_blit_shaders.c | 252 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/si_blit_shaders.h | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/sid.h | 55 |
5 files changed, 607 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index fa3e704515f7..9d83729956ff 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile | |||
@@ -71,7 +71,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ | |||
71 | r600_blit_kms.o radeon_pm.o atombios_dp.o r600_audio.o r600_hdmi.o \ | 71 | r600_blit_kms.o radeon_pm.o atombios_dp.o r600_audio.o r600_hdmi.o \ |
72 | evergreen.o evergreen_cs.o evergreen_blit_shaders.o evergreen_blit_kms.o \ | 72 | evergreen.o evergreen_cs.o evergreen_blit_shaders.o evergreen_blit_kms.o \ |
73 | radeon_trace_points.o ni.o cayman_blit_shaders.o atombios_encoders.o \ | 73 | radeon_trace_points.o ni.o cayman_blit_shaders.o atombios_encoders.o \ |
74 | radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o | 74 | radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o si_blit_shaders.o |
75 | 75 | ||
76 | radeon-$(CONFIG_COMPAT) += radeon_ioc32.o | 76 | radeon-$(CONFIG_COMPAT) += radeon_ioc32.o |
77 | radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o | 77 | radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index a8789de8e6db..a471a8090249 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "radeon_drm.h" | 31 | #include "radeon_drm.h" |
32 | #include "sid.h" | 32 | #include "sid.h" |
33 | #include "atom.h" | 33 | #include "atom.h" |
34 | #include "si_blit_shaders.h" | ||
34 | 35 | ||
35 | #define SI_PFP_UCODE_SIZE 2144 | 36 | #define SI_PFP_UCODE_SIZE 2144 |
36 | #define SI_PM4_UCODE_SIZE 2144 | 37 | #define SI_PM4_UCODE_SIZE 2144 |
@@ -1861,6 +1862,272 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
1861 | udelay(50); | 1862 | udelay(50); |
1862 | } | 1863 | } |
1863 | 1864 | ||
1865 | /* | ||
1866 | * CP. | ||
1867 | */ | ||
1868 | static void si_cp_enable(struct radeon_device *rdev, bool enable) | ||
1869 | { | ||
1870 | if (enable) | ||
1871 | WREG32(CP_ME_CNTL, 0); | ||
1872 | else { | ||
1873 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); | ||
1874 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT)); | ||
1875 | WREG32(SCRATCH_UMSK, 0); | ||
1876 | } | ||
1877 | udelay(50); | ||
1878 | } | ||
1879 | |||
1880 | static int si_cp_load_microcode(struct radeon_device *rdev) | ||
1881 | { | ||
1882 | const __be32 *fw_data; | ||
1883 | int i; | ||
1884 | |||
1885 | if (!rdev->me_fw || !rdev->pfp_fw) | ||
1886 | return -EINVAL; | ||
1887 | |||
1888 | si_cp_enable(rdev, false); | ||
1889 | |||
1890 | /* PFP */ | ||
1891 | fw_data = (const __be32 *)rdev->pfp_fw->data; | ||
1892 | WREG32(CP_PFP_UCODE_ADDR, 0); | ||
1893 | for (i = 0; i < SI_PFP_UCODE_SIZE; i++) | ||
1894 | WREG32(CP_PFP_UCODE_DATA, be32_to_cpup(fw_data++)); | ||
1895 | WREG32(CP_PFP_UCODE_ADDR, 0); | ||
1896 | |||
1897 | /* CE */ | ||
1898 | fw_data = (const __be32 *)rdev->ce_fw->data; | ||
1899 | WREG32(CP_CE_UCODE_ADDR, 0); | ||
1900 | for (i = 0; i < SI_CE_UCODE_SIZE; i++) | ||
1901 | WREG32(CP_CE_UCODE_DATA, be32_to_cpup(fw_data++)); | ||
1902 | WREG32(CP_CE_UCODE_ADDR, 0); | ||
1903 | |||
1904 | /* ME */ | ||
1905 | fw_data = (const __be32 *)rdev->me_fw->data; | ||
1906 | WREG32(CP_ME_RAM_WADDR, 0); | ||
1907 | for (i = 0; i < SI_PM4_UCODE_SIZE; i++) | ||
1908 | WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); | ||
1909 | WREG32(CP_ME_RAM_WADDR, 0); | ||
1910 | |||
1911 | WREG32(CP_PFP_UCODE_ADDR, 0); | ||
1912 | WREG32(CP_CE_UCODE_ADDR, 0); | ||
1913 | WREG32(CP_ME_RAM_WADDR, 0); | ||
1914 | WREG32(CP_ME_RAM_RADDR, 0); | ||
1915 | return 0; | ||
1916 | } | ||
1917 | |||
1918 | static int si_cp_start(struct radeon_device *rdev) | ||
1919 | { | ||
1920 | struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; | ||
1921 | int r, i; | ||
1922 | |||
1923 | r = radeon_ring_lock(rdev, ring, 7 + 4); | ||
1924 | if (r) { | ||
1925 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | ||
1926 | return r; | ||
1927 | } | ||
1928 | /* init the CP */ | ||
1929 | radeon_ring_write(ring, PACKET3(PACKET3_ME_INITIALIZE, 5)); | ||
1930 | radeon_ring_write(ring, 0x1); | ||
1931 | radeon_ring_write(ring, 0x0); | ||
1932 | radeon_ring_write(ring, rdev->config.si.max_hw_contexts - 1); | ||
1933 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); | ||
1934 | radeon_ring_write(ring, 0); | ||
1935 | radeon_ring_write(ring, 0); | ||
1936 | |||
1937 | /* init the CE partitions */ | ||
1938 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); | ||
1939 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); | ||
1940 | radeon_ring_write(ring, 0xc000); | ||
1941 | radeon_ring_write(ring, 0xe000); | ||
1942 | radeon_ring_unlock_commit(rdev, ring); | ||
1943 | |||
1944 | si_cp_enable(rdev, true); | ||
1945 | |||
1946 | r = radeon_ring_lock(rdev, ring, si_default_size + 10); | ||
1947 | if (r) { | ||
1948 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | ||
1949 | return r; | ||
1950 | } | ||
1951 | |||
1952 | /* setup clear context state */ | ||
1953 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); | ||
1954 | radeon_ring_write(ring, PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); | ||
1955 | |||
1956 | for (i = 0; i < si_default_size; i++) | ||
1957 | radeon_ring_write(ring, si_default_state[i]); | ||
1958 | |||
1959 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); | ||
1960 | radeon_ring_write(ring, PACKET3_PREAMBLE_END_CLEAR_STATE); | ||
1961 | |||
1962 | /* set clear context state */ | ||
1963 | radeon_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0)); | ||
1964 | radeon_ring_write(ring, 0); | ||
1965 | |||
1966 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); | ||
1967 | radeon_ring_write(ring, 0x00000316); | ||
1968 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
1969 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ | ||
1970 | |||
1971 | radeon_ring_unlock_commit(rdev, ring); | ||
1972 | |||
1973 | for (i = RADEON_RING_TYPE_GFX_INDEX; i <= CAYMAN_RING_TYPE_CP2_INDEX; ++i) { | ||
1974 | ring = &rdev->ring[i]; | ||
1975 | r = radeon_ring_lock(rdev, ring, 2); | ||
1976 | |||
1977 | /* clear the compute context state */ | ||
1978 | radeon_ring_write(ring, PACKET3_COMPUTE(PACKET3_CLEAR_STATE, 0)); | ||
1979 | radeon_ring_write(ring, 0); | ||
1980 | |||
1981 | radeon_ring_unlock_commit(rdev, ring); | ||
1982 | } | ||
1983 | |||
1984 | return 0; | ||
1985 | } | ||
1986 | |||
1987 | static void si_cp_fini(struct radeon_device *rdev) | ||
1988 | { | ||
1989 | si_cp_enable(rdev, false); | ||
1990 | radeon_ring_fini(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); | ||
1991 | radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]); | ||
1992 | radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]); | ||
1993 | } | ||
1994 | |||
1995 | static int si_cp_resume(struct radeon_device *rdev) | ||
1996 | { | ||
1997 | struct radeon_ring *ring; | ||
1998 | u32 tmp; | ||
1999 | u32 rb_bufsz; | ||
2000 | int r; | ||
2001 | |||
2002 | /* Reset cp; if cp is reset, then PA, SH, VGT also need to be reset */ | ||
2003 | WREG32(GRBM_SOFT_RESET, (SOFT_RESET_CP | | ||
2004 | SOFT_RESET_PA | | ||
2005 | SOFT_RESET_VGT | | ||
2006 | SOFT_RESET_SPI | | ||
2007 | SOFT_RESET_SX)); | ||
2008 | RREG32(GRBM_SOFT_RESET); | ||
2009 | mdelay(15); | ||
2010 | WREG32(GRBM_SOFT_RESET, 0); | ||
2011 | RREG32(GRBM_SOFT_RESET); | ||
2012 | |||
2013 | WREG32(CP_SEM_WAIT_TIMER, 0x0); | ||
2014 | WREG32(CP_SEM_INCOMPLETE_TIMER_CNTL, 0x0); | ||
2015 | |||
2016 | /* Set the write pointer delay */ | ||
2017 | WREG32(CP_RB_WPTR_DELAY, 0); | ||
2018 | |||
2019 | WREG32(CP_DEBUG, 0); | ||
2020 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); | ||
2021 | |||
2022 | /* ring 0 - compute and gfx */ | ||
2023 | /* Set ring buffer size */ | ||
2024 | ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; | ||
2025 | rb_bufsz = drm_order(ring->ring_size / 8); | ||
2026 | tmp = (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; | ||
2027 | #ifdef __BIG_ENDIAN | ||
2028 | tmp |= BUF_SWAP_32BIT; | ||
2029 | #endif | ||
2030 | WREG32(CP_RB0_CNTL, tmp); | ||
2031 | |||
2032 | /* Initialize the ring buffer's read and write pointers */ | ||
2033 | WREG32(CP_RB0_CNTL, tmp | RB_RPTR_WR_ENA); | ||
2034 | ring->wptr = 0; | ||
2035 | WREG32(CP_RB0_WPTR, ring->wptr); | ||
2036 | |||
2037 | /* set the wb address wether it's enabled or not */ | ||
2038 | WREG32(CP_RB0_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC); | ||
2039 | WREG32(CP_RB0_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); | ||
2040 | |||
2041 | if (rdev->wb.enabled) | ||
2042 | WREG32(SCRATCH_UMSK, 0xff); | ||
2043 | else { | ||
2044 | tmp |= RB_NO_UPDATE; | ||
2045 | WREG32(SCRATCH_UMSK, 0); | ||
2046 | } | ||
2047 | |||
2048 | mdelay(1); | ||
2049 | WREG32(CP_RB0_CNTL, tmp); | ||
2050 | |||
2051 | WREG32(CP_RB0_BASE, ring->gpu_addr >> 8); | ||
2052 | |||
2053 | ring->rptr = RREG32(CP_RB0_RPTR); | ||
2054 | |||
2055 | /* ring1 - compute only */ | ||
2056 | /* Set ring buffer size */ | ||
2057 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]; | ||
2058 | rb_bufsz = drm_order(ring->ring_size / 8); | ||
2059 | tmp = (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; | ||
2060 | #ifdef __BIG_ENDIAN | ||
2061 | tmp |= BUF_SWAP_32BIT; | ||
2062 | #endif | ||
2063 | WREG32(CP_RB1_CNTL, tmp); | ||
2064 | |||
2065 | /* Initialize the ring buffer's read and write pointers */ | ||
2066 | WREG32(CP_RB1_CNTL, tmp | RB_RPTR_WR_ENA); | ||
2067 | ring->wptr = 0; | ||
2068 | WREG32(CP_RB1_WPTR, ring->wptr); | ||
2069 | |||
2070 | /* set the wb address wether it's enabled or not */ | ||
2071 | WREG32(CP_RB1_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP1_RPTR_OFFSET) & 0xFFFFFFFC); | ||
2072 | WREG32(CP_RB1_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP1_RPTR_OFFSET) & 0xFF); | ||
2073 | |||
2074 | mdelay(1); | ||
2075 | WREG32(CP_RB1_CNTL, tmp); | ||
2076 | |||
2077 | WREG32(CP_RB1_BASE, ring->gpu_addr >> 8); | ||
2078 | |||
2079 | ring->rptr = RREG32(CP_RB1_RPTR); | ||
2080 | |||
2081 | /* ring2 - compute only */ | ||
2082 | /* Set ring buffer size */ | ||
2083 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]; | ||
2084 | rb_bufsz = drm_order(ring->ring_size / 8); | ||
2085 | tmp = (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; | ||
2086 | #ifdef __BIG_ENDIAN | ||
2087 | tmp |= BUF_SWAP_32BIT; | ||
2088 | #endif | ||
2089 | WREG32(CP_RB2_CNTL, tmp); | ||
2090 | |||
2091 | /* Initialize the ring buffer's read and write pointers */ | ||
2092 | WREG32(CP_RB2_CNTL, tmp | RB_RPTR_WR_ENA); | ||
2093 | ring->wptr = 0; | ||
2094 | WREG32(CP_RB2_WPTR, ring->wptr); | ||
2095 | |||
2096 | /* set the wb address wether it's enabled or not */ | ||
2097 | WREG32(CP_RB2_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP2_RPTR_OFFSET) & 0xFFFFFFFC); | ||
2098 | WREG32(CP_RB2_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP2_RPTR_OFFSET) & 0xFF); | ||
2099 | |||
2100 | mdelay(1); | ||
2101 | WREG32(CP_RB2_CNTL, tmp); | ||
2102 | |||
2103 | WREG32(CP_RB2_BASE, ring->gpu_addr >> 8); | ||
2104 | |||
2105 | ring->rptr = RREG32(CP_RB2_RPTR); | ||
2106 | |||
2107 | /* start the rings */ | ||
2108 | si_cp_start(rdev); | ||
2109 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = true; | ||
2110 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = true; | ||
2111 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = true; | ||
2112 | r = radeon_ring_test(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); | ||
2113 | if (r) { | ||
2114 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; | ||
2115 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; | ||
2116 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; | ||
2117 | return r; | ||
2118 | } | ||
2119 | r = radeon_ring_test(rdev, CAYMAN_RING_TYPE_CP1_INDEX, &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]); | ||
2120 | if (r) { | ||
2121 | rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX].ready = false; | ||
2122 | } | ||
2123 | r = radeon_ring_test(rdev, CAYMAN_RING_TYPE_CP2_INDEX, &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]); | ||
2124 | if (r) { | ||
2125 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; | ||
2126 | } | ||
2127 | |||
2128 | return 0; | ||
2129 | } | ||
2130 | |||
1864 | bool si_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) | 2131 | bool si_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) |
1865 | { | 2132 | { |
1866 | u32 srbm_status; | 2133 | u32 srbm_status; |
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c b/drivers/gpu/drm/radeon/si_blit_shaders.c new file mode 100644 index 000000000000..a7124b483adf --- /dev/null +++ b/drivers/gpu/drm/radeon/si_blit_shaders.c | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | * DEALINGS IN THE SOFTWARE. | ||
22 | * | ||
23 | * Authors: | ||
24 | * Alex Deucher <alexander.deucher@amd.com> | ||
25 | */ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/kernel.h> | ||
29 | |||
30 | const u32 si_default_state[] = | ||
31 | { | ||
32 | 0xc0066900, | ||
33 | 0x00000000, | ||
34 | 0x00000060, /* DB_RENDER_CONTROL */ | ||
35 | 0x00000000, /* DB_COUNT_CONTROL */ | ||
36 | 0x00000000, /* DB_DEPTH_VIEW */ | ||
37 | 0x0000002a, /* DB_RENDER_OVERRIDE */ | ||
38 | 0x00000000, /* DB_RENDER_OVERRIDE2 */ | ||
39 | 0x00000000, /* DB_HTILE_DATA_BASE */ | ||
40 | |||
41 | 0xc0046900, | ||
42 | 0x00000008, | ||
43 | 0x00000000, /* DB_DEPTH_BOUNDS_MIN */ | ||
44 | 0x00000000, /* DB_DEPTH_BOUNDS_MAX */ | ||
45 | 0x00000000, /* DB_STENCIL_CLEAR */ | ||
46 | 0x00000000, /* DB_DEPTH_CLEAR */ | ||
47 | |||
48 | 0xc0036900, | ||
49 | 0x0000000f, | ||
50 | 0x00000000, /* DB_DEPTH_INFO */ | ||
51 | 0x00000000, /* DB_Z_INFO */ | ||
52 | 0x00000000, /* DB_STENCIL_INFO */ | ||
53 | |||
54 | 0xc0016900, | ||
55 | 0x00000080, | ||
56 | 0x00000000, /* PA_SC_WINDOW_OFFSET */ | ||
57 | |||
58 | 0xc00d6900, | ||
59 | 0x00000083, | ||
60 | 0x0000ffff, /* PA_SC_CLIPRECT_RULE */ | ||
61 | 0x00000000, /* PA_SC_CLIPRECT_0_TL */ | ||
62 | 0x20002000, /* PA_SC_CLIPRECT_0_BR */ | ||
63 | 0x00000000, | ||
64 | 0x20002000, | ||
65 | 0x00000000, | ||
66 | 0x20002000, | ||
67 | 0x00000000, | ||
68 | 0x20002000, | ||
69 | 0xaaaaaaaa, /* PA_SC_EDGERULE */ | ||
70 | 0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */ | ||
71 | 0x0000000f, /* CB_TARGET_MASK */ | ||
72 | 0x0000000f, /* CB_SHADER_MASK */ | ||
73 | |||
74 | 0xc0226900, | ||
75 | 0x00000094, | ||
76 | 0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */ | ||
77 | 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ | ||
78 | 0x80000000, | ||
79 | 0x20002000, | ||
80 | 0x80000000, | ||
81 | 0x20002000, | ||
82 | 0x80000000, | ||
83 | 0x20002000, | ||
84 | 0x80000000, | ||
85 | 0x20002000, | ||
86 | 0x80000000, | ||
87 | 0x20002000, | ||
88 | 0x80000000, | ||
89 | 0x20002000, | ||
90 | 0x80000000, | ||
91 | 0x20002000, | ||
92 | 0x80000000, | ||
93 | 0x20002000, | ||
94 | 0x80000000, | ||
95 | 0x20002000, | ||
96 | 0x80000000, | ||
97 | 0x20002000, | ||
98 | 0x80000000, | ||
99 | 0x20002000, | ||
100 | 0x80000000, | ||
101 | 0x20002000, | ||
102 | 0x80000000, | ||
103 | 0x20002000, | ||
104 | 0x80000000, | ||
105 | 0x20002000, | ||
106 | 0x80000000, | ||
107 | 0x20002000, | ||
108 | 0x00000000, /* PA_SC_VPORT_ZMIN_0 */ | ||
109 | 0x3f800000, /* PA_SC_VPORT_ZMAX_0 */ | ||
110 | |||
111 | 0xc0026900, | ||
112 | 0x000000d9, | ||
113 | 0x00000000, /* CP_RINGID */ | ||
114 | 0x00000000, /* CP_VMID */ | ||
115 | |||
116 | 0xc0046900, | ||
117 | 0x00000100, | ||
118 | 0xffffffff, /* VGT_MAX_VTX_INDX */ | ||
119 | 0x00000000, /* VGT_MIN_VTX_INDX */ | ||
120 | 0x00000000, /* VGT_INDX_OFFSET */ | ||
121 | 0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */ | ||
122 | |||
123 | 0xc0046900, | ||
124 | 0x00000105, | ||
125 | 0x00000000, /* CB_BLEND_RED */ | ||
126 | 0x00000000, /* CB_BLEND_GREEN */ | ||
127 | 0x00000000, /* CB_BLEND_BLUE */ | ||
128 | 0x00000000, /* CB_BLEND_ALPHA */ | ||
129 | |||
130 | 0xc0016900, | ||
131 | 0x000001e0, | ||
132 | 0x00000000, /* CB_BLEND0_CONTROL */ | ||
133 | |||
134 | 0xc00e6900, | ||
135 | 0x00000200, | ||
136 | 0x00000000, /* DB_DEPTH_CONTROL */ | ||
137 | 0x00000000, /* DB_EQAA */ | ||
138 | 0x00cc0010, /* CB_COLOR_CONTROL */ | ||
139 | 0x00000210, /* DB_SHADER_CONTROL */ | ||
140 | 0x00010000, /* PA_CL_CLIP_CNTL */ | ||
141 | 0x00000004, /* PA_SU_SC_MODE_CNTL */ | ||
142 | 0x00000100, /* PA_CL_VTE_CNTL */ | ||
143 | 0x00000000, /* PA_CL_VS_OUT_CNTL */ | ||
144 | 0x00000000, /* PA_CL_NANINF_CNTL */ | ||
145 | 0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */ | ||
146 | 0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */ | ||
147 | 0x00000000, /* PA_SU_PRIM_FILTER_CNTL */ | ||
148 | 0x00000000, /* */ | ||
149 | 0x00000000, /* */ | ||
150 | |||
151 | 0xc0116900, | ||
152 | 0x00000280, | ||
153 | 0x00000000, /* PA_SU_POINT_SIZE */ | ||
154 | 0x00000000, /* PA_SU_POINT_MINMAX */ | ||
155 | 0x00000008, /* PA_SU_LINE_CNTL */ | ||
156 | 0x00000000, /* PA_SC_LINE_STIPPLE */ | ||
157 | 0x00000000, /* VGT_OUTPUT_PATH_CNTL */ | ||
158 | 0x00000000, /* VGT_HOS_CNTL */ | ||
159 | 0x00000000, | ||
160 | 0x00000000, | ||
161 | 0x00000000, | ||
162 | 0x00000000, | ||
163 | 0x00000000, | ||
164 | 0x00000000, | ||
165 | 0x00000000, | ||
166 | 0x00000000, | ||
167 | 0x00000000, | ||
168 | 0x00000000, | ||
169 | 0x00000000, /* VGT_GS_MODE */ | ||
170 | |||
171 | 0xc0026900, | ||
172 | 0x00000292, | ||
173 | 0x00000000, /* PA_SC_MODE_CNTL_0 */ | ||
174 | 0x00000000, /* PA_SC_MODE_CNTL_1 */ | ||
175 | |||
176 | 0xc0016900, | ||
177 | 0x000002a1, | ||
178 | 0x00000000, /* VGT_PRIMITIVEID_EN */ | ||
179 | |||
180 | 0xc0016900, | ||
181 | 0x000002a5, | ||
182 | 0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */ | ||
183 | |||
184 | 0xc0026900, | ||
185 | 0x000002a8, | ||
186 | 0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */ | ||
187 | 0x00000000, | ||
188 | |||
189 | 0xc0026900, | ||
190 | 0x000002ad, | ||
191 | 0x00000000, /* VGT_REUSE_OFF */ | ||
192 | 0x00000000, | ||
193 | |||
194 | 0xc0016900, | ||
195 | 0x000002d5, | ||
196 | 0x00000000, /* VGT_SHADER_STAGES_EN */ | ||
197 | |||
198 | 0xc0016900, | ||
199 | 0x000002dc, | ||
200 | 0x0000aa00, /* DB_ALPHA_TO_MASK */ | ||
201 | |||
202 | 0xc0066900, | ||
203 | 0x000002de, | ||
204 | 0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */ | ||
205 | 0x00000000, | ||
206 | 0x00000000, | ||
207 | 0x00000000, | ||
208 | 0x00000000, | ||
209 | 0x00000000, | ||
210 | |||
211 | 0xc0026900, | ||
212 | 0x000002e5, | ||
213 | 0x00000000, /* VGT_STRMOUT_CONFIG */ | ||
214 | 0x00000000, | ||
215 | |||
216 | 0xc01b6900, | ||
217 | 0x000002f5, | ||
218 | 0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */ | ||
219 | 0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */ | ||
220 | 0x00000000, /* PA_SC_LINE_CNTL */ | ||
221 | 0x00000000, /* PA_SC_AA_CONFIG */ | ||
222 | 0x00000005, /* PA_SU_VTX_CNTL */ | ||
223 | 0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */ | ||
224 | 0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */ | ||
225 | 0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */ | ||
226 | 0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */ | ||
227 | 0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */ | ||
228 | 0x00000000, | ||
229 | 0x00000000, | ||
230 | 0x00000000, | ||
231 | 0x00000000, | ||
232 | 0x00000000, | ||
233 | 0x00000000, | ||
234 | 0x00000000, | ||
235 | 0x00000000, | ||
236 | 0x00000000, | ||
237 | 0x00000000, | ||
238 | 0x00000000, | ||
239 | 0x00000000, | ||
240 | 0x00000000, | ||
241 | 0x00000000, | ||
242 | 0x00000000, | ||
243 | 0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */ | ||
244 | 0xffffffff, | ||
245 | |||
246 | 0xc0026900, | ||
247 | 0x00000316, | ||
248 | 0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
249 | 0x00000010, /* */ | ||
250 | }; | ||
251 | |||
252 | const u32 si_default_size = ARRAY_SIZE(si_default_state); | ||
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h b/drivers/gpu/drm/radeon/si_blit_shaders.h new file mode 100644 index 000000000000..c739e51e3961 --- /dev/null +++ b/drivers/gpu/drm/radeon/si_blit_shaders.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | * DEALINGS IN THE SOFTWARE. | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef SI_BLIT_SHADERS_H | ||
26 | #define SI_BLIT_SHADERS_H | ||
27 | |||
28 | extern const u32 si_default_state[]; | ||
29 | |||
30 | extern const u32 si_default_size; | ||
31 | |||
32 | #endif | ||
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 3cc25dbf8efd..7e08f0896ef6 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
@@ -273,12 +273,31 @@ | |||
273 | 273 | ||
274 | #define GRBM_GFX_INDEX 0x802C | 274 | #define GRBM_GFX_INDEX 0x802C |
275 | 275 | ||
276 | #define SCRATCH_REG0 0x8500 | ||
277 | #define SCRATCH_REG1 0x8504 | ||
278 | #define SCRATCH_REG2 0x8508 | ||
279 | #define SCRATCH_REG3 0x850C | ||
280 | #define SCRATCH_REG4 0x8510 | ||
281 | #define SCRATCH_REG5 0x8514 | ||
282 | #define SCRATCH_REG6 0x8518 | ||
283 | #define SCRATCH_REG7 0x851C | ||
284 | |||
285 | #define SCRATCH_UMSK 0x8540 | ||
286 | #define SCRATCH_ADDR 0x8544 | ||
287 | |||
288 | #define CP_SEM_WAIT_TIMER 0x85BC | ||
289 | |||
290 | #define CP_SEM_INCOMPLETE_TIMER_CNTL 0x85C8 | ||
291 | |||
276 | #define CP_ME_CNTL 0x86D8 | 292 | #define CP_ME_CNTL 0x86D8 |
277 | #define CP_CE_HALT (1 << 24) | 293 | #define CP_CE_HALT (1 << 24) |
278 | #define CP_PFP_HALT (1 << 26) | 294 | #define CP_PFP_HALT (1 << 26) |
279 | #define CP_ME_HALT (1 << 28) | 295 | #define CP_ME_HALT (1 << 28) |
280 | 296 | ||
297 | #define CP_RB2_RPTR 0x86f8 | ||
298 | #define CP_RB1_RPTR 0x86fc | ||
281 | #define CP_RB0_RPTR 0x8700 | 299 | #define CP_RB0_RPTR 0x8700 |
300 | #define CP_RB_WPTR_DELAY 0x8704 | ||
282 | 301 | ||
283 | #define CP_QUEUE_THRESHOLDS 0x8760 | 302 | #define CP_QUEUE_THRESHOLDS 0x8760 |
284 | #define ROQ_IB1_START(x) ((x) << 0) | 303 | #define ROQ_IB1_START(x) ((x) << 0) |
@@ -458,6 +477,40 @@ | |||
458 | #define TCP_CHAN_STEER_LO 0xac0c | 477 | #define TCP_CHAN_STEER_LO 0xac0c |
459 | #define TCP_CHAN_STEER_HI 0xac10 | 478 | #define TCP_CHAN_STEER_HI 0xac10 |
460 | 479 | ||
480 | #define CP_RB0_BASE 0xC100 | ||
481 | #define CP_RB0_CNTL 0xC104 | ||
482 | #define RB_BUFSZ(x) ((x) << 0) | ||
483 | #define RB_BLKSZ(x) ((x) << 8) | ||
484 | #define BUF_SWAP_32BIT (2 << 16) | ||
485 | #define RB_NO_UPDATE (1 << 27) | ||
486 | #define RB_RPTR_WR_ENA (1 << 31) | ||
487 | |||
488 | #define CP_RB0_RPTR_ADDR 0xC10C | ||
489 | #define CP_RB0_RPTR_ADDR_HI 0xC110 | ||
490 | #define CP_RB0_WPTR 0xC114 | ||
491 | |||
492 | #define CP_PFP_UCODE_ADDR 0xC150 | ||
493 | #define CP_PFP_UCODE_DATA 0xC154 | ||
494 | #define CP_ME_RAM_RADDR 0xC158 | ||
495 | #define CP_ME_RAM_WADDR 0xC15C | ||
496 | #define CP_ME_RAM_DATA 0xC160 | ||
497 | |||
498 | #define CP_CE_UCODE_ADDR 0xC168 | ||
499 | #define CP_CE_UCODE_DATA 0xC16C | ||
500 | |||
501 | #define CP_RB1_BASE 0xC180 | ||
502 | #define CP_RB1_CNTL 0xC184 | ||
503 | #define CP_RB1_RPTR_ADDR 0xC188 | ||
504 | #define CP_RB1_RPTR_ADDR_HI 0xC18C | ||
505 | #define CP_RB1_WPTR 0xC190 | ||
506 | #define CP_RB2_BASE 0xC194 | ||
507 | #define CP_RB2_CNTL 0xC198 | ||
508 | #define CP_RB2_RPTR_ADDR 0xC19C | ||
509 | #define CP_RB2_RPTR_ADDR_HI 0xC1A0 | ||
510 | #define CP_RB2_WPTR 0xC1A4 | ||
511 | |||
512 | #define CP_DEBUG 0xC1FC | ||
513 | |||
461 | /* | 514 | /* |
462 | * PM4 | 515 | * PM4 |
463 | */ | 516 | */ |
@@ -483,6 +536,8 @@ | |||
483 | (((op) & 0xFF) << 8) | \ | 536 | (((op) & 0xFF) << 8) | \ |
484 | ((n) & 0x3FFF) << 16) | 537 | ((n) & 0x3FFF) << 16) |
485 | 538 | ||
539 | #define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1) | ||
540 | |||
486 | /* Packet 3 types */ | 541 | /* Packet 3 types */ |
487 | #define PACKET3_NOP 0x10 | 542 | #define PACKET3_NOP 0x10 |
488 | #define PACKET3_SET_BASE 0x11 | 543 | #define PACKET3_SET_BASE 0x11 |