Path: blob/master/drivers/gpu/drm/radeon/cayman_blit_shaders.c
15113 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 cayman_default_state[] =40{410xc0066900,420x00000000,430x00000060, /* DB_RENDER_CONTROL */440x00000000, /* DB_COUNT_CONTROL */450x00000000, /* DB_DEPTH_VIEW */460x0000002a, /* DB_RENDER_OVERRIDE */470x00000000, /* DB_RENDER_OVERRIDE2 */480x00000000, /* DB_HTILE_DATA_BASE */49500xc0026900,510x0000000a,520x00000000, /* DB_STENCIL_CLEAR */530x00000000, /* DB_DEPTH_CLEAR */54550xc0036900,560x0000000f,570x00000000, /* DB_DEPTH_INFO */580x00000000, /* DB_Z_INFO */590x00000000, /* DB_STENCIL_INFO */60610xc0016900,620x00000080,630x00000000, /* PA_SC_WINDOW_OFFSET */64650xc00d6900,660x00000083,670x0000ffff, /* PA_SC_CLIPRECT_RULE */680x00000000, /* PA_SC_CLIPRECT_0_TL */690x20002000, /* PA_SC_CLIPRECT_0_BR */700x00000000,710x20002000,720x00000000,730x20002000,740x00000000,750x20002000,760xaaaaaaaa, /* PA_SC_EDGERULE */770x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */780x0000000f, /* CB_TARGET_MASK */790x0000000f, /* CB_SHADER_MASK */80810xc0226900,820x00000094,830x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */840x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */850x80000000,860x20002000,870x80000000,880x20002000,890x80000000,900x20002000,910x80000000,920x20002000,930x80000000,940x20002000,950x80000000,960x20002000,970x80000000,980x20002000,990x80000000,1000x20002000,1010x80000000,1020x20002000,1030x80000000,1040x20002000,1050x80000000,1060x20002000,1070x80000000,1080x20002000,1090x80000000,1100x20002000,1110x80000000,1120x20002000,1130x80000000,1140x20002000,1150x00000000, /* PA_SC_VPORT_ZMIN_0 */1160x3f800000, /* PA_SC_VPORT_ZMAX_0 */1171180xc0016900,1190x000000d4,1200x00000000, /* SX_MISC */1211220xc0026900,1230x000000d9,1240x00000000, /* CP_RINGID */1250x00000000, /* CP_VMID */1261270xc0096900,1280x00000100,1290x00ffffff, /* VGT_MAX_VTX_INDX */1300x00000000, /* VGT_MIN_VTX_INDX */1310x00000000, /* VGT_INDX_OFFSET */1320x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */1330x00000000, /* SX_ALPHA_TEST_CONTROL */1340x00000000, /* CB_BLEND_RED */1350x00000000, /* CB_BLEND_GREEN */1360x00000000, /* CB_BLEND_BLUE */1370x00000000, /* CB_BLEND_ALPHA */1381390xc0016900,1400x00000187,1410x00000100, /* SPI_VS_OUT_ID_0 */1421430xc0026900,1440x00000191,1450x00000100, /* SPI_PS_INPUT_CNTL_0 */1460x00000101, /* SPI_PS_INPUT_CNTL_1 */1471480xc0016900,1490x000001b1,1500x00000000, /* SPI_VS_OUT_CONFIG */1511520xc0106900,1530x000001b3,1540x20000001, /* SPI_PS_IN_CONTROL_0 */1550x00000000, /* SPI_PS_IN_CONTROL_1 */1560x00000000, /* SPI_INTERP_CONTROL_0 */1570x00000000, /* SPI_INPUT_Z */1580x00000000, /* SPI_FOG_CNTL */1590x00100000, /* SPI_BARYC_CNTL */1600x00000000, /* SPI_PS_IN_CONTROL_2 */1610x00000000, /* SPI_COMPUTE_INPUT_CNTL */1620x00000000, /* SPI_COMPUTE_NUM_THREAD_X */1630x00000000, /* SPI_COMPUTE_NUM_THREAD_Y */1640x00000000, /* SPI_COMPUTE_NUM_THREAD_Z */1650x00000000, /* SPI_GPR_MGMT */1660x00000000, /* SPI_LDS_MGMT */1670x00000000, /* SPI_STACK_MGMT */1680x00000000, /* SPI_WAVE_MGMT_1 */1690x00000000, /* SPI_WAVE_MGMT_2 */1701710xc0016900,1720x000001e0,1730x00000000, /* CB_BLEND0_CONTROL */1741750xc00e6900,1760x00000200,1770x00000000, /* DB_DEPTH_CONTROL */1780x00000000, /* DB_EQAA */1790x00cc0010, /* CB_COLOR_CONTROL */1800x00000210, /* DB_SHADER_CONTROL */1810x00010000, /* PA_CL_CLIP_CNTL */1820x00000004, /* PA_SU_SC_MODE_CNTL */1830x00000100, /* PA_CL_VTE_CNTL */1840x00000000, /* PA_CL_VS_OUT_CNTL */1850x00000000, /* PA_CL_NANINF_CNTL */1860x00000000, /* PA_SU_LINE_STIPPLE_CNTL */1870x00000000, /* PA_SU_LINE_STIPPLE_SCALE */1880x00000000, /* PA_SU_PRIM_FILTER_CNTL */1890x00000000, /* */1900x00000000, /* */1911920xc0026900,1930x00000229,1940x00000000, /* SQ_PGM_START_FS */1950x00000000,1961970xc0016900,1980x0000023b,1990x00000000, /* SQ_LDS_ALLOC_PS */2002010xc0066900,2020x00000240,2030x00000000, /* SQ_ESGS_RING_ITEMSIZE */2040x00000000,2050x00000000,2060x00000000,2070x00000000,2080x00000000,2092100xc0046900,2110x00000247,2120x00000000, /* SQ_GS_VERT_ITEMSIZE */2130x00000000,2140x00000000,2150x00000000,2162170xc0116900,2180x00000280,2190x00000000, /* PA_SU_POINT_SIZE */2200x00000000, /* PA_SU_POINT_MINMAX */2210x00000008, /* PA_SU_LINE_CNTL */2220x00000000, /* PA_SC_LINE_STIPPLE */2230x00000000, /* VGT_OUTPUT_PATH_CNTL */2240x00000000, /* VGT_HOS_CNTL */2250x00000000,2260x00000000,2270x00000000,2280x00000000,2290x00000000,2300x00000000,2310x00000000,2320x00000000,2330x00000000,2340x00000000,2350x00000000, /* VGT_GS_MODE */2362370xc0026900,2380x00000292,2390x00000000, /* PA_SC_MODE_CNTL_0 */2400x00000000, /* PA_SC_MODE_CNTL_1 */2412420xc0016900,2430x000002a1,2440x00000000, /* VGT_PRIMITIVEID_EN */2452460xc0016900,2470x000002a5,2480x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */2492500xc0026900,2510x000002a8,2520x00000000, /* VGT_INSTANCE_STEP_RATE_0 */2530x00000000,2542550xc0026900,2560x000002ad,2570x00000000, /* VGT_REUSE_OFF */2580x00000000,2592600xc0016900,2610x000002d5,2620x00000000, /* VGT_SHADER_STAGES_EN */2632640xc0016900,2650x000002dc,2660x0000aa00, /* DB_ALPHA_TO_MASK */2672680xc0066900,2690x000002de,2700x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */2710x00000000,2720x00000000,2730x00000000,2740x00000000,2750x00000000,2762770xc0026900,2780x000002e5,2790x00000000, /* VGT_STRMOUT_CONFIG */2800x00000000,2812820xc01b6900,2830x000002f5,2840x76543210, /* PA_SC_CENTROID_PRIORITY_0 */2850xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */2860x00000000, /* PA_SC_LINE_CNTL */2870x00000000, /* PA_SC_AA_CONFIG */2880x00000005, /* PA_SU_VTX_CNTL */2890x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */2900x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */2910x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */2920x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */2930x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */2940x00000000,2950x00000000,2960x00000000,2970x00000000,2980x00000000,2990x00000000,3000x00000000,3010x00000000,3020x00000000,3030x00000000,3040x00000000,3050x00000000,3060x00000000,3070x00000000,3080x00000000,3090xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */3100xffffffff,3113120xc0026900,3130x00000316,3140x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */3150x00000010, /* */316};317318const u32 cayman_vs[] =319{3200x00000004,3210x80400400,3220x0000a03c,3230x95000688,3240x00004000,3250x15000688,3260x00000000,3270x88000000,3280x04000000,3290x67961001,330#ifdef __BIG_ENDIAN3310x00020000,332#else3330x00000000,334#endif3350x00000000,3360x04000000,3370x67961000,338#ifdef __BIG_ENDIAN3390x00020008,340#else3410x00000008,342#endif3430x00000000,344};345346const u32 cayman_ps[] =347{3480x00000004,3490xa00c0000,3500x00000008,3510x80400000,3520x00000000,3530x95000688,3540x00000000,3550x88000000,3560x00380400,3570x00146b10,3580x00380000,3590x20146b10,3600x00380400,3610x40146b00,3620x80380000,3630x60146b00,3640x00000010,3650x000d1000,3660xb0800000,3670x00000000,368};369370const u32 cayman_ps_size = ARRAY_SIZE(cayman_ps);371const u32 cayman_vs_size = ARRAY_SIZE(cayman_vs);372const u32 cayman_default_size = ARRAY_SIZE(cayman_default_state);373374375