16b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/************************************************************************** 26b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 36b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 46b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * All Rights Reserved. 56b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 66b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 76b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * copy of this software and associated documentation files (the 86b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * "Software"), to deal in the Software without restriction, including 96b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * the following conditions: 136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * The above copyright notice and this permission notice (including the 156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * of the Software. 176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell **************************************************************************/ 276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include <strings.h> 296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 30ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/glheader.h" 31ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/macros.h" 32ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/enums.h" 336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "tnl/t_context.h" 356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "intel_batchbuffer.h" 366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "i915_reg.h" 386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "i915_context.h" 396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "i915_program.h" 406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) 436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) 446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) 456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT) 466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A1_SRC0( reg ) (((reg)&UREG_MASK)<<UREG_A1_SRC0_SHIFT_RIGHT) 476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A1_SRC1( reg ) (((reg)&UREG_MASK)>>UREG_A1_SRC1_SHIFT_LEFT) 486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A2_SRC1( reg ) (((reg)&UREG_MASK)<<UREG_A2_SRC1_SHIFT_RIGHT) 496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define A2_SRC2( reg ) (((reg)&UREG_MASK)>>UREG_A2_SRC2_SHIFT_LEFT) 506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* These are special, and don't have swizzle/negate bits. 526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<<T0_SAMPLER_NR_SHIFT) 546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define T1_ADDRESS_REG( reg ) ((GET_UREG_NR(reg)<<T1_ADDRESS_REG_NR_SHIFT) | \ 556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (GET_UREG_TYPE(reg)<<T1_ADDRESS_REG_TYPE_SHIFT)) 566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* Macros for translating UREG's into the various register fields used 596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * by the I915 programmable unit. 606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A0_DEST_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_DEST_TYPE_SHIFT) 626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A0_SRC0_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_SRC0_TYPE_SHIFT) 636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A1_SRC0_SHIFT_RIGHT (A1_SRC0_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT) 646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A1_SRC1_SHIFT_LEFT (UREG_TYPE_SHIFT - A1_SRC1_TYPE_SHIFT) 656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A2_SRC1_SHIFT_RIGHT (A2_SRC1_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT) 666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_A2_SRC2_SHIFT_LEFT (UREG_TYPE_SHIFT - A2_SRC2_TYPE_SHIFT) 676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_MASK 0xffffff00 696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define UREG_TYPE_NR_MASK ((REG_TYPE_MASK << UREG_TYPE_SHIFT) | \ 706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (REG_NR_MASK << UREG_NR_SHIFT)) 716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CONSTFLAG_PARAM 0x1f 746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_get_temp(struct i915_fragment_program *p) 776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int bit = ffs(~p->temp_flag); 796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!bit) { 806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of temporaries\n", __FILE__); 816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell exit(1); 826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->temp_flag |= 1 << (bit - 1); 856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_R, (bit - 1)); 866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_get_utemp(struct i915_fragment_program * p) 916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int bit = ffs(~p->utemp_flag); 936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!bit) { 946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of temporaries\n", __FILE__); 956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell exit(1); 966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->utemp_flag |= 1 << (bit - 1); 996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_U, (bit - 1)); 1006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 1016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 1036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_release_utemps(struct i915_fragment_program *p) 1046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 1056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->utemp_flag = ~0x7; 1066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 1076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 1106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_decl(struct i915_fragment_program *p, 1116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint type, GLuint nr, GLuint d0_flags) 1126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 1136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint reg = UREG(type, nr); 1146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (type == REG_TYPE_T) { 1166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->decl_t & (1 << nr)) 1176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return reg; 1186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->decl_t |= (1 << nr); 1206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else if (type == REG_TYPE_S) { 1226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->decl_s & (1 << nr)) 1236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return reg; 1246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->decl_s |= (1 << nr); 1266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 1286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return reg; 1296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags); 1316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->decl++) = D1_MBZ; 1326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->decl++) = D2_MBZ; 13396a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt assert(p->decl <= p->declarations + ARRAY_SIZE(p->declarations)); 1346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_decl_insn++; 1366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return reg; 1376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 1386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 1406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_arith(struct i915_fragment_program * p, 1416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint op, 1426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint dest, 1436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint mask, 1446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint saturate, GLuint src0, GLuint src1, GLuint src2) 1456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 1466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint c[3]; 1476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_const = 0; 1486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); 1506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)); 1516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell assert(dest); 1526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (GET_UREG_TYPE(src0) == REG_TYPE_CONST) 1546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell c[nr_const++] = 0; 1556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (GET_UREG_TYPE(src1) == REG_TYPE_CONST) 1566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell c[nr_const++] = 1; 1576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (GET_UREG_TYPE(src2) == REG_TYPE_CONST) 1586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell c[nr_const++] = 2; 1596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Recursively call this function to MOV additional const values 1616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * into temporary registers. Use utemp registers for this - 1626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * currently shouldn't be possible to run out, but keep an eye on 1636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * this. 1646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (nr_const > 1) { 1666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint s[3], first, i, old_utemp_flag; 1676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s[0] = src0; 1696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s[1] = src1; 1706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s[2] = src2; 1716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell old_utemp_flag = p->utemp_flag; 1726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell first = GET_UREG_NR(s[c[0]]); 1746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (i = 1; i < nr_const; i++) { 1756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (GET_UREG_NR(s[c[i]]) != first) { 1766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint tmp = i915_get_utemp(p); 1776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0, 1796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s[c[i]], 0, 0); 1806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s[c[i]] = tmp; 1816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell src0 = s[0]; 1856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell src1 = s[1]; 1866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell src2 = s[2]; 1876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->utemp_flag = old_utemp_flag; /* restore */ 1886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 19096a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt if (p->csr >= p->program + ARRAY_SIZE(p->program)) { 1914ff816751f74b0645c198372937eec589c458a60Eric Anholt i915_program_error(p, "Program contains too many instructions"); 1924ff816751f74b0645c198372937eec589c458a60Eric Anholt return UREG_BAD; 1934ff816751f74b0645c198372937eec589c458a60Eric Anholt } 1944ff816751f74b0645c198372937eec589c458a60Eric Anholt 1956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0)); 1966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1)); 1976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2)); 1986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 19991d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt if (GET_UREG_TYPE(dest) == REG_TYPE_R) 20091d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt p->register_phases[GET_UREG_NR(dest)] = p->nr_tex_indirect; 20191d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt 2026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_alu_insn++; 2036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return dest; 2046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2063369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihaostatic GLuint get_free_rreg (struct i915_fragment_program *p, 2073369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao GLuint live_regs) 2083369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao{ 2093369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao int bit = ffs(~live_regs); 2103369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao if (!bit) { 2113369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao i915_program_error(p, "Can't find free R reg"); 2123369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao return UREG_BAD; 2133369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao } 2143369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao return UREG(REG_TYPE_R, bit - 1); 2153369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao} 2163369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao 2176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint i915_emit_texld( struct i915_fragment_program *p, 2183369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao GLuint live_regs, 2196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint dest, 2206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint destmask, 2216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint sampler, 2226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint coord, 2236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint op ) 2246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2253369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) { 2263369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao /* With the help of the "needed registers" table created earlier, pick 2273369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao * a register we can MOV the swizzled TC to (since TEX doesn't support 2283369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao * swizzled sources) */ 2293369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao GLuint swizCoord = get_free_rreg(p, live_regs); 2303369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao if (swizCoord == UREG_BAD) 2313369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao return 0; 2323369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao 2333369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao i915_emit_arith( p, A0_MOV, swizCoord, A0_DEST_CHANNEL_ALL, 0, coord, 0, 0 ); 2343369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao coord = swizCoord; 2353369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao } 2363369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao 2373369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao /* Don't worry about saturate as we only support texture formats 2383369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao * that are always in the 0..1 range. 2396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 2406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (destmask != A0_DEST_CHANNEL_ALL) { 2416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint tmp = i915_get_utemp(p); 2423369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao i915_emit_texld( p, 0, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op ); 2436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 ); 2446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return dest; 2456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 2466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 2476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); 248309c156bae59124be17137d0f559d2c054231f7cVinson Lee assert(dest == UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest))); 24991d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt /* Can't use unsaved temps for coords, as the phase boundary would result 25091d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt * in the contents becoming undefined. 25191d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt */ 25291d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt assert(GET_UREG_TYPE(coord) != REG_TYPE_U); 25391d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt 254c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao if ((GET_UREG_TYPE(coord) != REG_TYPE_R) && 255c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao (GET_UREG_TYPE(coord) != REG_TYPE_OC) && 256c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao (GET_UREG_TYPE(coord) != REG_TYPE_OD) && 257c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao (GET_UREG_TYPE(coord) != REG_TYPE_T)) { 258c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao GLuint tmpCoord = get_free_rreg(p, live_regs); 259c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao 260c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao if (tmpCoord == UREG_BAD) 261c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao return 0; 262c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao 263c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao i915_emit_arith(p, A0_MOV, tmpCoord, A0_DEST_CHANNEL_ALL, 0, coord, 0, 0); 264c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao coord = tmpCoord; 265c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao } 266c238098bbcfb644ea01b33d3274b949d84822512Xiang, Haihao 26791d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt /* Output register being oC or oD defines a phase boundary */ 26891d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt if (GET_UREG_TYPE(dest) == REG_TYPE_OC || 26991d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt GET_UREG_TYPE(dest) == REG_TYPE_OD) 27091d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt p->nr_tex_indirect++; 2716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 27291d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt /* Reading from an r# register whose contents depend on output of the 27391d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt * current phase defines a phase boundary. 27491d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt */ 27591d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt if (GET_UREG_TYPE(coord) == REG_TYPE_R && 27691d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt p->register_phases[GET_UREG_NR(coord)] == p->nr_tex_indirect) 2776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_tex_indirect++; 2786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 27996a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt if (p->csr >= p->program + ARRAY_SIZE(p->program)) { 2804ff816751f74b0645c198372937eec589c458a60Eric Anholt i915_program_error(p, "Program contains too many instructions"); 2814ff816751f74b0645c198372937eec589c458a60Eric Anholt return UREG_BAD; 2824ff816751f74b0645c198372937eec589c458a60Eric Anholt } 2834ff816751f74b0645c198372937eec589c458a60Eric Anholt 2846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = (op | 2856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell T0_DEST( dest ) | 2866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell T0_SAMPLER( sampler )); 2876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = T1_ADDRESS_REG( coord ); 2896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->csr++) = T2_MBZ; 2906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 29191d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt if (GET_UREG_TYPE(dest) == REG_TYPE_R) 29291d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt p->register_phases[GET_UREG_NR(dest)] = p->nr_tex_indirect; 29391d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt 2946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_tex_insn++; 2956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return dest; 2966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 2976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 3016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_const1f(struct i915_fragment_program * p, GLfloat c0) 3026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 3036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLint reg, idx; 3046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c0 == 0.0) 3066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO); 3076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c0 == 1.0) 3086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE); 3096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { 3116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->constant_flags[reg] == I915_CONSTFLAG_PARAM) 3126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell continue; 3136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (idx = 0; idx < 4; idx++) { 3146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!(p->constant_flags[reg] & (1 << idx)) || 3156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][idx] == c0) { 3166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][idx] = c0; 3176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant_flags[reg] |= 1 << idx; 3186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (reg + 1 > p->nr_constants) 3196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_constants = reg + 1; 3206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(UREG(REG_TYPE_CONST, reg), idx, ZERO, ZERO, ONE); 3216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of constants\n", __FUNCTION__); 3266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 1; 3276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return 0; 3286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 3316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_const2f(struct i915_fragment_program * p, GLfloat c0, GLfloat c1) 3326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 3336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLint reg, idx; 3346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c0 == 0.0) 3366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W); 3376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c0 == 1.0) 3386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W); 3396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c1 == 0.0) 3416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W); 3426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (c1 == 1.0) 3436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W); 3446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { 3466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->constant_flags[reg] == 0xf || 3476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant_flags[reg] == I915_CONSTFLAG_PARAM) 3486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell continue; 3496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (idx = 0; idx < 3; idx++) { 3506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!(p->constant_flags[reg] & (3 << idx))) { 3516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][idx] = c0; 3526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][idx + 1] = c1; 3536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant_flags[reg] |= 3 << idx; 3546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (reg + 1 > p->nr_constants) 3556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_constants = reg + 1; 3566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return swizzle(UREG(REG_TYPE_CONST, reg), idx, idx + 1, ZERO, 3576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ONE); 3586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of constants\n", __FUNCTION__); 3636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 1; 3646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return 0; 3656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 3706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_const4f(struct i915_fragment_program * p, 3716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLfloat c0, GLfloat c1, GLfloat c2, GLfloat c3) 3726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 3736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLint reg; 3746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { 3766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->constant_flags[reg] == 0xf && 3776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][0] == c0 && 3786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][1] == c1 && 3796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][2] == c2 && p->constant[reg][3] == c3) { 3806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_CONST, reg); 3816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else if (p->constant_flags[reg] == 0) { 3836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][0] = c0; 3846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][1] = c1; 3856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][2] = c2; 3866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant[reg][3] = c3; 3876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant_flags[reg] = 0xf; 3886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (reg + 1 > p->nr_constants) 3896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_constants = reg + 1; 3906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_CONST, reg); 3916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of constants\n", __FUNCTION__); 3956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 1; 3966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return 0; 3976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 4016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_const4fv(struct i915_fragment_program * p, const GLfloat * c) 4026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return i915_emit_const4f(p, c[0], c[1], c[2], c[3]); 4046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith WhitwellGLuint 4086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_emit_param4fv(struct i915_fragment_program * p, const GLfloat * values) 4096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLint reg, i; 4116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (i = 0; i < p->nr_params; i++) { 4136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->param[i].values == values) 4146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_CONST, p->param[i].reg); 4156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 4166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { 4196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->constant_flags[reg] == 0) { 4206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->constant_flags[reg] = I915_CONSTFLAG_PARAM; 4216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i = p->nr_params++; 4226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->param[i].values = values; 4246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->param[i].reg = reg; 4256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->params_uptodate = 0; 4266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (reg + 1 > p->nr_constants) 4286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_constants = reg + 1; 4296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return UREG(REG_TYPE_CONST, reg); 4306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 4316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 4326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "%s: out of constants\n", __FUNCTION__); 4346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 1; 4356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return 0; 4366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 438994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt/* Warning the user about program errors seems to be quite valuable, from 439994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt * our bug reports. It unfortunately means piglit reporting errors 440994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt * when we fall back to software due to an unsupportable program, though. 441994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt */ 4426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 443994d1db079b4947e6f10ab22a4b366a676382345Eric Anholti915_program_error(struct i915_fragment_program *p, const char *fmt, ...) 4446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 44579198063b8adb23536b291081f8df8571926950eEric Anholt if (unlikely((INTEL_DEBUG & (DEBUG_WM | DEBUG_PERF)) != 0)) { 4460290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick va_list args; 447994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt 4480290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick fprintf(stderr, "i915_program_error: "); 4490290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick va_start(args, fmt); 4500290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick vfprintf(stderr, fmt, args); 4510290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick va_end(args); 452994d1db079b4947e6f10ab22a4b366a676382345Eric Anholt 4530290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick fprintf(stderr, "\n"); 4540290a018a50bd4a3180af3233f145f4de7b63706Ian Romanick } 4556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 1; 4566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 45867a101759ec0b84e4f30fbb329e86ac5031cf7e7Brian Paul 4596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 4606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_init_program(struct i915_context *i915, struct i915_fragment_program *p) 4616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 462f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg struct gl_context *ctx = &i915->intel.ctx; 4636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->translated = 0; 4656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->params_uptodate = 0; 4666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->on_hardware = 0; 4676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->error = 0; 4686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 46991d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt memset(&p->register_phases, 0, sizeof(p->register_phases)); 47091d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt p->nr_tex_indirect = 1; 4716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_tex_insn = 0; 4726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_alu_insn = 0; 4736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_decl_insn = 0; 4746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->ctx = ctx; 4766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell memset(p->constant_flags, 0, sizeof(p->constant_flags)); 4776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_constants = 0; 4796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->csr = p->program; 4806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->decl = p->declarations; 4816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->decl_s = 0; 4826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->decl_t = 0; 4836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->temp_flag = 0xffff000; 4846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->utemp_flag = ~0x7; 4856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->wpos_tex = -1; 4866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->depth_written = 0; 4876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_params = 0; 4886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM; 4906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 4946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_fini_program(struct i915_fragment_program *p) 4956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint program_size = p->csr - p->program; 4976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint decl_size = p->decl - p->declarations; 4986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 499891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT) { 500891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt i915_program_error(p, "Exceeded max nr indirect texture lookups " 501891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt "(%d out of %d)", 502891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt p->nr_tex_indirect, I915_MAX_TEX_INDIRECT); 503891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt } 5046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 505891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt if (p->nr_tex_insn > I915_MAX_TEX_INSN) { 506891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt i915_program_error(p, "Exceeded max TEX instructions (%d out of %d)", 507891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt p->nr_tex_insn, I915_MAX_TEX_INSN); 508891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt } 5096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->nr_alu_insn > I915_MAX_ALU_INSN) 511891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt i915_program_error(p, "Exceeded max ALU instructions (%d out of %d)", 512891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt p->nr_alu_insn, I915_MAX_ALU_INSN); 5136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 514891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt if (p->nr_decl_insn > I915_MAX_DECL_INSN) { 515891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt i915_program_error(p, "Exceeded max DECL instructions (%d out of %d)", 516891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt p->nr_decl_insn, I915_MAX_DECL_INSN); 517891ad6ec1ad71d26e0d06fa620fe392d29de26c9Eric Anholt } 5186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (p->error) { 5206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->FragProg.Base.NumNativeInstructions = 0; 521064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeAluInstructions = 0; 522064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeTexInstructions = 0; 523064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeTexIndirections = 0; 5246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 5266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn + 5276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_tex_insn + 5286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->nr_decl_insn); 529064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn; 530064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn; 531064ae479a770bf434958d673baf6f7530f642697Brian p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect; 5326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->declarations[0] |= program_size + decl_size - 2; 5356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 5366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 5386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_upload_program(struct i915_context *i915, 5396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i915_fragment_program *p) 5406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 5416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint program_size = p->csr - p->program; 5426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint decl_size = p->decl - p->declarations; 5436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 54496a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt if (p->error) 54596a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt return; 54696a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt 5476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Could just go straight to the batchbuffer from here: 5486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 5496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (i915->state.ProgramSize != (program_size + decl_size) || 5506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell memcmp(i915->state.Program + decl_size, p->program, 5516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell program_size * sizeof(int)) != 0) { 5526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I915_STATECHANGE(i915, I915_UPLOAD_PROGRAM); 5536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell memcpy(i915->state.Program, p->declarations, decl_size * sizeof(int)); 5546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell memcpy(i915->state.Program + decl_size, p->program, 5556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell program_size * sizeof(int)); 5566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i915->state.ProgramSize = decl_size + program_size; 5576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5593c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin /* Always seemed to get a failure if I used memcmp() to 5603c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin * shortcircuit this state upload. Needs further investigation? 5613c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin */ 5623c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin if (p->nr_constants) { 5633c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin GLuint nr = p->nr_constants; 5643c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin 5653c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 1); 5663c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin I915_STATECHANGE(i915, I915_UPLOAD_CONSTANTS); 5673c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin 5683c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin i915->state.Constant[0] = _3DSTATE_PIXEL_SHADER_CONSTANTS | ((nr) * 4); 5693c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin i915->state.Constant[1] = (1 << (nr - 1)) | ((1 << (nr - 1)) - 1); 5703c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin 5713c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin memcpy(&i915->state.Constant[2], p->constant, 4 * sizeof(int) * (nr)); 5723c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin i915->state.ConstantSize = 2 + (nr) * 4; 5733c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin 5743c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin if (0) { 5753c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin GLuint i; 5763c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin for (i = 0; i < nr; i++) { 5773c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin fprintf(stderr, "const[%d]: %f %f %f %f\n", i, 5783c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin p->constant[i][0], 5793c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin p->constant[i][1], p->constant[i][2], p->constant[i][3]); 5803c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin } 5816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5833c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin else { 5843c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin I915_ACTIVESTATE(i915, I915_UPLOAD_CONSTANTS, 0); 5853c0c6248795806bb9e66bb89a7adc8fc0cf266d7Stéphane Marchesin } 5866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p->on_hardware = 1; 5886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 589