i915_context.h revision c9886d535e4ac5ae108b1015a9682f4ddd297536
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#ifndef I915CONTEXT_INC 296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915CONTEXT_INC 306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "intel_context.h" 323369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao#include "i915_reg.h" 336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_TEXTURE 0x1000 356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_COLORMASK 0x2000 366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_STENCIL 0x4000 376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_STIPPLE 0x8000 386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_PROGRAM 0x10000 396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_LOGICOP 0x20000 406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_POLYGON_SMOOTH 0x40000 416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FALLBACK_POINT_SMOOTH 0x80000 42533b7660073f2c1cd1a19105d4989ec11bfdcd87Ian Romanick#define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN 0x100000 436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_CTX 0x1 456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_BUFFERS 0x2 466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_STIPPLE 0x4 476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_PROGRAM 0x8 486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_CONSTANTS 0x10 496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_FOG 0x20 506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_INVARIENT 0x40 516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_DEFAULTS 0x80 52de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt#define I915_UPLOAD_RASTER_RULES 0x100 536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_TEX(i) (0x00010000<<(i)) 546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_TEX_ALL (0x00ff0000) 556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_UPLOAD_TEX_0_SHIFT 16 566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* State structure offsets - these will probably disappear. 596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_CBUFADDR0 0 616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_CBUFADDR1 1 626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_DBUFADDR0 3 636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_DBUFADDR1 4 646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_DV0 6 656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_DV1 7 666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_SENABLE 8 676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_SR0 9 686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_SR1 10 696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DESTREG_SR2 11 700cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT0 12 710cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT1 13 720cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT2 14 730cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT3 15 740cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT4 16 750cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DESTREG_DRAWRECT5 17 760cade4de4f74f6b0e86fb6622e2fc370c73fd840Eric Anholt#define I915_DEST_SETUP_SIZE 18 776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_STATE4 0 796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_LI 1 806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_LIS2 2 816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_LIS4 3 826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_LIS5 4 836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_LIS6 5 846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_IAB 6 856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_BLENDCOLOR0 7 866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CTXREG_BLENDCOLOR1 8 87246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholt#define I915_CTXREG_BF_STENCIL_OPS 9 88246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholt#define I915_CTXREG_BF_STENCIL_MASKS 10 89246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholt#define I915_CTX_SETUP_SIZE 11 906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOGREG_COLOR 0 926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOGREG_MODE0 1 936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOGREG_MODE1 2 946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOGREG_MODE2 3 956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOGREG_MODE3 4 966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOG_SETUP_SIZE 5 976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_STPREG_ST0 0 996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_STPREG_ST1 1 1006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_STP_SETUP_SIZE 2 1016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEXREG_MS3 1 1036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEXREG_MS4 2 1046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEXREG_SS2 3 1056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEXREG_SS3 4 1066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEXREG_SS4 5 1076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEX_SETUP_SIZE 6 1086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_C0 0 1106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_C1 1 1116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_S0 2 1126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_S1 3 1136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_Z0 4 1146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEFREG_Z1 5 1156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_DEF_SETUP_SIZE 6 1166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 117de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholtenum { 118de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt I915_RASTER_RULES, 119de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt I915_RASTER_RULES_SETUP_SIZE, 120de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt}; 1216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_MAX_CONSTANT 32 1236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CONSTANT_SIZE (2+(4*I915_MAX_CONSTANT)) 1246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 12596a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt#define I915_MAX_INSN (I915_MAX_DECL_INSN + \ 12696a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt I915_MAX_TEX_INSN + \ 12796a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt I915_MAX_ALU_INSN) 1286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 12996a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt/* Maximum size of the program packet, which matches the limits on 13096a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt * decl, tex, and ALU instructions. 13196a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt */ 13296a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt#define I915_PROGRAM_SIZE (I915_MAX_INSN * 3 + 1) 1336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* Hardware version of a parsed fragment program. "Derived" from the 1356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * mesa fragment_program struct. 1366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstruct i915_fragment_program 1386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 1396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct gl_fragment_program FragProg; 1406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean translated; 1426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean params_uptodate; 1436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean on_hardware; 1446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean error; /* If program is malformed for any reason. */ 1456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 14691d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt /** Record of which phases R registers were last written in. */ 14791d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt GLuint register_phases[16]; 14891d0020eecb78ef2984fd0afafc5d555c0e957d8Eric Anholt GLuint indirections; 1496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_tex_indirect; 1506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_tex_insn; 1516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_alu_insn; 1526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_decl_insn; 1536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* TODO: split between the stored representation of a program and 1586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * the state used to build that representation. 1596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLcontext *ctx; 1616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 16296a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt /* declarations contains the packet header. */ 16396a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt GLuint declarations[I915_MAX_DECL_INSN * 3 + 1]; 16496a3c69d48bb7c021181e061d010cca08198ae4cEric Anholt GLuint program[(I915_MAX_TEX_INSN + I915_MAX_ALU_INSN) * 3]; 1656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLfloat constant[I915_MAX_CONSTANT][4]; 1676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint constant_flags[I915_MAX_CONSTANT]; 1686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_constants; 1696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint *csr; /* Cursor, points into program. 1716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint *decl; /* Cursor, points into declarations. 1746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint decl_s; /* flags for which s regs need to be decl'd */ 1776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint decl_t; /* flags for which t regs need to be decl'd */ 1786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint temp_flag; /* Tracks temporary regs which are in 1806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * use. 1816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint utemp_flag; /* Tracks TYPE_U temporary regs which are in 1846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * use. 1856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1883369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao /* Track which R registers are "live" for each instruction. 1893369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao * A register is live between the time it's written to and the last time 1903369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao * it's read. */ 1913369cd9a6f943365242d7832e69788d4aede9a8fXiang, Haihao GLuint usedRegs[I915_MAX_INSN]; 1926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Helpers for i915_fragprog.c: 1946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 1956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint wpos_tex; 1966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean depth_written; 1976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct 1996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell { 2006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint reg; /* Hardware constant idx */ 2016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell const GLfloat *values; /* Pointer to tracked values */ 2026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } param[I915_MAX_CONSTANT]; 2036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint nr_params; 2046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell}; 2056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_TEX_UNITS 8 2136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstruct i915_hw_state 2166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Ctx[I915_CTX_SETUP_SIZE]; 2186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Buffer[I915_DEST_SETUP_SIZE]; 2196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Stipple[I915_STP_SETUP_SIZE]; 2206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Fog[I915_FOG_SETUP_SIZE]; 2216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Defaults[I915_DEF_SETUP_SIZE]; 222de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt GLuint RasterRules[I915_RASTER_RULES_SETUP_SIZE]; 2236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Tex[I915_TEX_UNITS][I915_TEX_SETUP_SIZE]; 2246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Constant[I915_CONSTANT_SIZE]; 2256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint ConstantSize; 2266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint Program[I915_PROGRAM_SIZE]; 2276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint ProgramSize; 2286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Region pointers for relocation: 2306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 2316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_region *draw_region; 2326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_region *depth_region; 2336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* struct intel_region *tex_region[I915_TEX_UNITS]; */ 2346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Regions aren't actually that appropriate here as the memory may 236cfc21190af1038f204d38ab4764a9c731b0323a5Eric Anholt * be from a PBO or FBO. Will have to do this for draw and depth for 237cfc21190af1038f204d38ab4764a9c731b0323a5Eric Anholt * FBO's... 2386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 239cfc21190af1038f204d38ab4764a9c731b0323a5Eric Anholt dri_bo *tex_buffer[I915_TEX_UNITS]; 2406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint tex_offset[I915_TEX_UNITS]; 2416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint active; /* I915_UPLOAD_* */ 2446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint emitted; /* I915_UPLOAD_* */ 2456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell}; 2466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOG_PIXEL 2 2486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOG_VERTEX 1 2496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_FOG_NONE 0 2506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstruct i915_context 2526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_context intel; 2546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint last_ReallyEnabled; 2566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint vertex_fog; 2576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint lodbias_ss2[MAX_TEXTURE_UNITS]; 2586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i915_fragment_program *current_program; 2616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 262c9886d535e4ac5ae108b1015a9682f4ddd297536Eric Anholt struct i915_hw_state state; 2636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell}; 2646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_STATECHANGE(i915, flag) \ 2676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelldo { \ 2686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell INTEL_FIREVERTICES( &(i915)->intel ); \ 2696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (i915)->state.emitted &= ~(flag); \ 2706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} while (0) 2716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_ACTIVESTATE(i915, flag, mode) \ 2736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelldo { \ 2746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell INTEL_FIREVERTICES( &(i915)->intel ); \ 2756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (mode) \ 2766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (i915)->state.active |= (flag); \ 2776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else \ 2786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (i915)->state.active &= ~(flag); \ 2796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} while (0) 2806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 2836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_vtbl.c 2846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 2856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915InitVtbl(struct i915_context *i915); 2866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void 2886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_state_draw_region(struct intel_context *intel, 2896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i915_hw_state *state, 2906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_region *color_region, 2916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_region *depth_region); 2926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define SZ_TO_HW(sz) ((sz-2)&0x3) 2966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1) 2976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define EMIT_ATTR( ATTR, STYLE, S4, SZ ) \ 2986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelldo { \ 2996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attrs[intel->vertex_attr_count].attrib = (ATTR); \ 3006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attrs[intel->vertex_attr_count].format = (STYLE); \ 3016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s4 |= S4; \ 3026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attr_count++; \ 3036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell offset += (SZ); \ 3046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} while (0) 3056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define EMIT_PAD( N ) \ 3076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelldo { \ 3086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attrs[intel->vertex_attr_count].attrib = 0; \ 3096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attrs[intel->vertex_attr_count].format = EMIT_PAD; \ 3106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attrs[intel->vertex_attr_count].offset = (N); \ 3116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell intel->vertex_attr_count++; \ 3126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell offset += (N); \ 3136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} while (0) 3146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_context.c 3196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern GLboolean i915CreateContext(const __GLcontextModes * mesaVis, 321d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg __DRIcontext * driContextPriv, 3226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell void *sharedContextPrivate); 3236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_debug.c 3276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915_disassemble_program(const GLuint * program, GLuint sz); 3296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915_print_ureg(const char *msg, GLuint ureg); 3306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_state.c 3346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915InitStateFunctions(struct dd_function_table *functions); 3366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915InitState(struct i915_context *i915); 3376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915_update_fog(GLcontext * ctx); 338246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholtextern void i915_update_stencil(GLcontext * ctx); 339de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholtextern void i915_update_provoking_vertex(GLcontext *ctx); 3406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_tex.c 3446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915UpdateTextureState(struct intel_context *intel); 3466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915InitTextureFuncs(struct dd_function_table *functions); 3476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * i915_fragprog.c 3506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915ValidateFragmentProgram(struct i915_context *i915); 3526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellextern void i915InitFragProgFuncs(struct dd_function_table *functions); 3536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/*====================================================================== 3556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Inline conversion functions. These are better-typed than the 3566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * macros used previously: 3576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic INLINE struct i915_context * 3596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli915_context(GLcontext * ctx) 3606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 3616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return (struct i915_context *) ctx; 3626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define I915_CONTEXT(ctx) i915_context(ctx) 3676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#endif 371