Path: blob/master/drivers/gpu/drm/radeon/evergreen_blit_shaders.c
15112 views
/*1* Copyright 2010 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR18* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,19* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*22* Authors:23* Alex Deucher <[email protected]>24*/2526#include <linux/types.h>27#include <linux/kernel.h>2829/*30* evergreen cards need to use the 3D engine to blit data which requires31* quite a bit of hw state setup. Rather than pull the whole 3D driver32* (which normally generates the 3D state) into the DRM, we opt to use33* statically generated state tables. The regsiter state and shaders34* were hand generated to support blitting functionality. See the 3D35* driver or documentation for descriptions of the registers and36* shader instructions.37*/3839const u32 evergreen_default_state[] =40{410xc0016900,420x0000023b,430x00000000, /* SQ_LDS_ALLOC_PS */44450xc0066900,460x00000240,470x00000000, /* SQ_ESGS_RING_ITEMSIZE */480x00000000,490x00000000,500x00000000,510x00000000,520x00000000,53540xc0046900,550x00000247,560x00000000, /* SQ_GS_VERT_ITEMSIZE */570x00000000,580x00000000,590x00000000,60610xc0026900,620x00000010,630x00000000, /* DB_Z_INFO */640x00000000, /* DB_STENCIL_INFO */65660xc0016900,670x00000200,680x00000000, /* DB_DEPTH_CONTROL */69700xc0066900,710x00000000,720x00000060, /* DB_RENDER_CONTROL */730x00000000, /* DB_COUNT_CONTROL */740x00000000, /* DB_DEPTH_VIEW */750x0000002a, /* DB_RENDER_OVERRIDE */760x00000000, /* DB_RENDER_OVERRIDE2 */770x00000000, /* DB_HTILE_DATA_BASE */78790xc0026900,800x0000000a,810x00000000, /* DB_STENCIL_CLEAR */820x00000000, /* DB_DEPTH_CLEAR */83840xc0016900,850x000002dc,860x0000aa00, /* DB_ALPHA_TO_MASK */87880xc0016900,890x00000080,900x00000000, /* PA_SC_WINDOW_OFFSET */91920xc00d6900,930x00000083,940x0000ffff, /* PA_SC_CLIPRECT_RULE */950x00000000, /* PA_SC_CLIPRECT_0_TL */960x20002000, /* PA_SC_CLIPRECT_0_BR */970x00000000,980x20002000,990x00000000,1000x20002000,1010x00000000,1020x20002000,1030xaaaaaaaa, /* PA_SC_EDGERULE */1040x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */1050x0000000f, /* CB_TARGET_MASK */1060x0000000f, /* CB_SHADER_MASK */1071080xc0226900,1090x00000094,1100x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */1110x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */1120x80000000,1130x20002000,1140x80000000,1150x20002000,1160x80000000,1170x20002000,1180x80000000,1190x20002000,1200x80000000,1210x20002000,1220x80000000,1230x20002000,1240x80000000,1250x20002000,1260x80000000,1270x20002000,1280x80000000,1290x20002000,1300x80000000,1310x20002000,1320x80000000,1330x20002000,1340x80000000,1350x20002000,1360x80000000,1370x20002000,1380x80000000,1390x20002000,1400x80000000,1410x20002000,1420x00000000, /* PA_SC_VPORT_ZMIN_0 */1430x3f800000, /* PA_SC_VPORT_ZMAX_0 */1441450xc0016900,1460x000000d4,1470x00000000, /* SX_MISC */1481490xc0026900,1500x00000292,1510x00000000, /* PA_SC_MODE_CNTL_0 */1520x00000000, /* PA_SC_MODE_CNTL_1 */1531540xc0106900,1550x00000300,1560x00000000, /* PA_SC_LINE_CNTL */1570x00000000, /* PA_SC_AA_CONFIG */1580x00000005, /* PA_SU_VTX_CNTL */1590x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */1600x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */1610x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */1620x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */1630x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */1640x00000000, /* */1650x00000000, /* */1660x00000000, /* */1670x00000000, /* */1680x00000000, /* */1690x00000000, /* */1700x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */1710xffffffff, /* PA_SC_AA_MASK */1721730xc00d6900,1740x00000202,1750x00cc0010, /* CB_COLOR_CONTROL */1760x00000210, /* DB_SHADER_CONTROL */1770x00010000, /* PA_CL_CLIP_CNTL */1780x00000004, /* PA_SU_SC_MODE_CNTL */1790x00000100, /* PA_CL_VTE_CNTL */1800x00000000, /* PA_CL_VS_OUT_CNTL */1810x00000000, /* PA_CL_NANINF_CNTL */1820x00000000, /* PA_SU_LINE_STIPPLE_CNTL */1830x00000000, /* PA_SU_LINE_STIPPLE_SCALE */1840x00000000, /* PA_SU_PRIM_FILTER_CNTL */1850x00000000, /* */1860x00000000, /* */1870x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */1881890xc0066900,1900x000002de,1910x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */1920x00000000, /* */1930x00000000, /* */1940x00000000, /* */1950x00000000, /* */1960x00000000, /* */1971980xc0016900,1990x00000229,2000x00000000, /* SQ_PGM_START_FS */2012020xc0016900,2030x0000022a,2040x00000000, /* SQ_PGM_RESOURCES_FS */2052060xc0096900,2070x00000100,2080x00ffffff, /* VGT_MAX_VTX_INDX */2090x00000000, /* */2100x00000000, /* */2110x00000000, /* */2120x00000000, /* SX_ALPHA_TEST_CONTROL */2130x00000000, /* CB_BLEND_RED */2140x00000000, /* CB_BLEND_GREEN */2150x00000000, /* CB_BLEND_BLUE */2160x00000000, /* CB_BLEND_ALPHA */2172180xc0026900,2190x000002a8,2200x00000000, /* VGT_INSTANCE_STEP_RATE_0 */2210x00000000, /* */2222230xc0026900,2240x000002ad,2250x00000000, /* VGT_REUSE_OFF */2260x00000000, /* */2272280xc0116900,2290x00000280,2300x00000000, /* PA_SU_POINT_SIZE */2310x00000000, /* PA_SU_POINT_MINMAX */2320x00000008, /* PA_SU_LINE_CNTL */2330x00000000, /* PA_SC_LINE_STIPPLE */2340x00000000, /* VGT_OUTPUT_PATH_CNTL */2350x00000000, /* VGT_HOS_CNTL */2360x00000000, /* */2370x00000000, /* */2380x00000000, /* */2390x00000000, /* */2400x00000000, /* */2410x00000000, /* */2420x00000000, /* */2430x00000000, /* */2440x00000000, /* */2450x00000000, /* */2460x00000000, /* VGT_GS_MODE */2472480xc0016900,2490x000002a1,2500x00000000, /* VGT_PRIMITIVEID_EN */2512520xc0016900,2530x000002a5,2540x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */2552560xc0016900,2570x000002d5,2580x00000000, /* VGT_SHADER_STAGES_EN */2592600xc0026900,2610x000002e5,2620x00000000, /* VGT_STRMOUT_CONFIG */2630x00000000, /* */2642650xc0016900,2660x000001e0,2670x00000000, /* CB_BLEND0_CONTROL */2682690xc0016900,2700x000001b1,2710x00000000, /* SPI_VS_OUT_CONFIG */2722730xc0016900,2740x00000187,2750x00000000, /* SPI_VS_OUT_ID_0 */2762770xc0016900,2780x00000191,2790x00000100, /* SPI_PS_INPUT_CNTL_0 */2802810xc00b6900,2820x000001b3,2830x20000001, /* SPI_PS_IN_CONTROL_0 */2840x00000000, /* SPI_PS_IN_CONTROL_1 */2850x00000000, /* SPI_INTERP_CONTROL_0 */2860x00000000, /* SPI_INPUT_Z */2870x00000000, /* SPI_FOG_CNTL */2880x00100000, /* SPI_BARYC_CNTL */2890x00000000, /* SPI_PS_IN_CONTROL_2 */2900x00000000, /* */2910x00000000, /* */2920x00000000, /* */2930x00000000, /* */2942950xc0026900,2960x00000316,2970x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */2980x00000010, /* */299};300301const u32 evergreen_vs[] =302{3030x00000004,3040x80800400,3050x0000a03c,3060x95000688,3070x00004000,3080x15200688,3090x00000000,3100x00000000,3110x3c000000,3120x67961001,313#ifdef __BIG_ENDIAN3140x000a0000,315#else3160x00080000,317#endif3180x00000000,3190x1c000000,3200x67961000,321#ifdef __BIG_ENDIAN3220x00020008,323#else3240x00000008,325#endif3260x00000000,327};328329const u32 evergreen_ps[] =330{3310x00000003,3320xa00c0000,3330x00000008,3340x80400000,3350x00000000,3360x95200688,3370x00380400,3380x00146b10,3390x00380000,3400x20146b10,3410x00380400,3420x40146b00,3430x80380000,3440x60146b00,3450x00000000,3460x00000000,3470x00000010,3480x000d1000,3490xb0800000,3500x00000000,351};352353const u32 evergreen_ps_size = ARRAY_SIZE(evergreen_ps);354const u32 evergreen_vs_size = ARRAY_SIZE(evergreen_vs);355const u32 evergreen_default_size = ARRAY_SIZE(evergreen_default_state);356357358