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