1fa225cbcSrjs/**************************************************************************
2fa225cbcSrjs *
3fa225cbcSrjs * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4fa225cbcSrjs * All Rights Reserved.
5fa225cbcSrjs *
6fa225cbcSrjs * Permission is hereby granted, free of charge, to any person obtaining a
7fa225cbcSrjs * copy of this software and associated documentation files (the
8fa225cbcSrjs * "Software"), to deal in the Software without restriction, including
9fa225cbcSrjs * without limitation the rights to use, copy, modify, merge, publish,
10fa225cbcSrjs * distribute, sub license, and/or sell copies of the Software, and to
11fa225cbcSrjs * permit persons to whom the Software is furnished to do so, subject to
12fa225cbcSrjs * the following conditions:
13fa225cbcSrjs *
14fa225cbcSrjs * The above copyright notice and this permission notice (including the
15fa225cbcSrjs * next paragraph) shall be included in all copies or substantial portions
16fa225cbcSrjs * of the Software.
17fa225cbcSrjs *
18fa225cbcSrjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19fa225cbcSrjs * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20fa225cbcSrjs * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21fa225cbcSrjs * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22fa225cbcSrjs * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23fa225cbcSrjs * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24fa225cbcSrjs * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25fa225cbcSrjs *
26fa225cbcSrjs **************************************************************************/
27fa225cbcSrjs
28fa225cbcSrjs#ifdef HAVE_CONFIG_H
29fa225cbcSrjs#include "config.h"
30fa225cbcSrjs#endif
31fa225cbcSrjs
32fa225cbcSrjs#include "xf86.h"
33fa225cbcSrjs#include "i830.h"
34fa225cbcSrjs
35fa225cbcSrjs#include "i915_reg.h"
36fa225cbcSrjs
37fa225cbcSrjsvoid I915EmitInvarientState( ScrnInfoPtr pScrn )
38fa225cbcSrjs{
39fa225cbcSrjs   I830Ptr pI830 = I830PTR(pScrn);
40fa225cbcSrjs
41fa225cbcSrjs   BEGIN_BATCH(24);
42fa225cbcSrjs
43fa225cbcSrjs   OUT_BATCH(_3DSTATE_AA_CMD |
44fa225cbcSrjs	     AA_LINE_ECAAR_WIDTH_ENABLE |
45fa225cbcSrjs	     AA_LINE_ECAAR_WIDTH_1_0 |
46fa225cbcSrjs	     AA_LINE_REGION_WIDTH_ENABLE |
47fa225cbcSrjs	     AA_LINE_REGION_WIDTH_1_0);
48fa225cbcSrjs
49fa225cbcSrjs   /* Disable independent alpha blend */
50fa225cbcSrjs   OUT_BATCH(_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |
51fa225cbcSrjs	     IAB_MODIFY_ENABLE |
52fa225cbcSrjs	     IAB_MODIFY_FUNC | (BLENDFUNC_ADD << IAB_FUNC_SHIFT) |
53fa225cbcSrjs	     IAB_MODIFY_SRC_FACTOR | (BLENDFACT_ONE << IAB_SRC_FACTOR_SHIFT) |
54fa225cbcSrjs	     IAB_MODIFY_DST_FACTOR | (BLENDFACT_ZERO << IAB_DST_FACTOR_SHIFT));
55fa225cbcSrjs
56fa225cbcSrjs   OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
57fa225cbcSrjs   OUT_BATCH(0);
58fa225cbcSrjs
59fa225cbcSrjs   OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
60fa225cbcSrjs   OUT_BATCH(0);
61fa225cbcSrjs
62fa225cbcSrjs   OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
63fa225cbcSrjs   OUT_BATCH(0);
64fa225cbcSrjs
65fa225cbcSrjs   /* Don't support texture crossbar yet */
66fa225cbcSrjs   OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS |
67fa225cbcSrjs	     CSB_TCB(0, 0) |
68fa225cbcSrjs	     CSB_TCB(1, 1) |
69fa225cbcSrjs	     CSB_TCB(2, 2) |
70fa225cbcSrjs	     CSB_TCB(3, 3) |
71fa225cbcSrjs	     CSB_TCB(4, 4) |
72fa225cbcSrjs	     CSB_TCB(5, 5) |
73fa225cbcSrjs	     CSB_TCB(6, 6) |
74fa225cbcSrjs	     CSB_TCB(7, 7));
75fa225cbcSrjs
76fa225cbcSrjs   OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
77fa225cbcSrjs	     ENABLE_POINT_RASTER_RULE |
78fa225cbcSrjs	     OGL_POINT_RASTER_RULE |
79fa225cbcSrjs	     ENABLE_LINE_STRIP_PROVOKE_VRTX |
80fa225cbcSrjs	     ENABLE_TRI_FAN_PROVOKE_VRTX |
81fa225cbcSrjs	     LINE_STRIP_PROVOKE_VRTX(1) |
82fa225cbcSrjs	     TRI_FAN_PROVOKE_VRTX(2) |
83fa225cbcSrjs	     ENABLE_TEXKILL_3D_4D |
84fa225cbcSrjs	     TEXKILL_4D);
85fa225cbcSrjs
86fa225cbcSrjs   OUT_BATCH(_3DSTATE_MODES_4_CMD |
87fa225cbcSrjs	     ENABLE_LOGIC_OP_FUNC | LOGIC_OP_FUNC(LOGICOP_COPY) |
88fa225cbcSrjs	     ENABLE_STENCIL_WRITE_MASK | STENCIL_WRITE_MASK(0xff) |
89fa225cbcSrjs	     ENABLE_STENCIL_TEST_MASK | STENCIL_TEST_MASK(0xff));
90fa225cbcSrjs
91fa225cbcSrjs   OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | 0);
92fa225cbcSrjs   OUT_BATCH(0x00000000);	/* Disable texture coordinate wrap-shortest */
93fa225cbcSrjs
94fa225cbcSrjs   OUT_BATCH(_3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT);
95fa225cbcSrjs   OUT_BATCH(_3DSTATE_SCISSOR_RECT_0_CMD);
96fa225cbcSrjs   OUT_BATCH(0);
97fa225cbcSrjs   OUT_BATCH(0);
98fa225cbcSrjs
99fa225cbcSrjs   OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE);
100fa225cbcSrjs
101fa225cbcSrjs   OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0); /* disable indirect state */
102fa225cbcSrjs   OUT_BATCH(0);
103fa225cbcSrjs
104fa225cbcSrjs   OUT_BATCH(_3DSTATE_STIPPLE);
105fa225cbcSrjs   OUT_BATCH(0x00000000);
106fa225cbcSrjs
107fa225cbcSrjs   OUT_BATCH(_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE | 0 );
108fa225cbcSrjs   OUT_BATCH(MI_NOOP);
109fa225cbcSrjs
110fa225cbcSrjs   ADVANCE_BATCH();
111fa225cbcSrjs}
112