summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/Makefile38
-rw-r--r--src/mesa/pipe/i915simple/SConscript29
-rw-r--r--src/mesa/pipe/i915simple/i915_batch.h54
-rw-r--r--src/mesa/pipe/i915simple/i915_blit.c162
-rw-r--r--src/mesa/pipe/i915simple/i915_blit.h55
-rw-r--r--src/mesa/pipe/i915simple/i915_clear.c47
-rw-r--r--src/mesa/pipe/i915simple/i915_context.c320
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h304
-rw-r--r--src/mesa/pipe/i915simple/i915_debug.c901
-rw-r--r--src/mesa/pipe/i915simple/i915_debug.h117
-rw-r--r--src/mesa/pipe/i915simple/i915_debug_fp.c366
-rw-r--r--src/mesa/pipe/i915simple/i915_flush.c81
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc.h213
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_emit.c375
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_translate.c1135
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_emit.c215
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_vbuf.c254
-rw-r--r--src/mesa/pipe/i915simple/i915_reg.h978
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c694
-rw-r--r--src/mesa/pipe/i915simple/i915_state.h50
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c177
-rw-r--r--src/mesa/pipe/i915simple/i915_state_dynamic.c308
-rw-r--r--src/mesa/pipe/i915simple/i915_state_emit.c374
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c221
-rw-r--r--src/mesa/pipe/i915simple/i915_state_inlines.h230
-rw-r--r--src/mesa/pipe/i915simple/i915_state_sampler.c231
-rw-r--r--src/mesa/pipe/i915simple/i915_strings.c83
-rw-r--r--src/mesa/pipe/i915simple/i915_surface.c191
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.c536
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.h17
-rw-r--r--src/mesa/pipe/i915simple/i915_winsys.h115
31 files changed, 0 insertions, 8871 deletions
diff --git a/src/mesa/pipe/i915simple/Makefile b/src/mesa/pipe/i915simple/Makefile
deleted file mode 100644
index 2f91de3afc6..00000000000
--- a/src/mesa/pipe/i915simple/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i915simple
-
-DRIVER_SOURCES = \
- i915_blit.c \
- i915_clear.c \
- i915_flush.c \
- i915_context.c \
- i915_context.c \
- i915_debug.c \
- i915_debug_fp.c \
- i915_state.c \
- i915_state_immediate.c \
- i915_state_dynamic.c \
- i915_state_derived.c \
- i915_state_emit.c \
- i915_state_sampler.c \
- i915_strings.c \
- i915_prim_emit.c \
- i915_prim_vbuf.c \
- i915_texture.c \
- i915_fpc_emit.c \
- i915_fpc_translate.c \
- i915_surface.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
-
diff --git a/src/mesa/pipe/i915simple/SConscript b/src/mesa/pipe/i915simple/SConscript
deleted file mode 100644
index f5fb96b995c..00000000000
--- a/src/mesa/pipe/i915simple/SConscript
+++ /dev/null
@@ -1,29 +0,0 @@
-Import('*')
-
-env = env.Clone()
-
-i915simple = env.ConvenienceLibrary(
- target = 'i915simple',
- source = [
- 'i915_blit.c',
- 'i915_clear.c',
- 'i915_context.c',
- 'i915_debug.c',
- 'i915_debug_fp.c',
- 'i915_flush.c',
- 'i915_fpc_emit.c',
- 'i915_fpc_translate.c',
- 'i915_prim_emit.c',
- 'i915_prim_vbuf.c',
- 'i915_state.c',
- 'i915_state_derived.c',
- 'i915_state_dynamic.c',
- 'i915_state_emit.c',
- 'i915_state_immediate.c',
- 'i915_state_sampler.c',
- 'i915_strings.c',
- 'i915_surface.c',
- 'i915_texture.c',
- ])
-
-Export('i915simple')
diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/mesa/pipe/i915simple/i915_batch.h
deleted file mode 100644
index fb88cd6db0d..00000000000
--- a/src/mesa/pipe/i915simple/i915_batch.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef I915_BATCH_H
-#define I915_BATCH_H
-
-#include "i915_winsys.h"
-#include "i915_debug.h"
-
-#define BATCH_LOCALS
-
-#define BEGIN_BATCH( dwords, relocs ) \
- (i915->batch_start = i915->winsys->batch_start( i915->winsys, dwords, relocs ))
-
-#define OUT_BATCH( dword ) \
- i915->winsys->batch_dword( i915->winsys, dword )
-
-#define OUT_RELOC( buf, flags, delta ) \
- i915->winsys->batch_reloc( i915->winsys, buf, flags, delta )
-
-#define ADVANCE_BATCH()
-
-#define FLUSH_BATCH() do { \
- if (0) i915_dump_batchbuffer( i915 ); \
- i915->winsys->batch_flush( i915->winsys ); \
- i915->batch_start = NULL; \
- i915->hardware_dirty = ~0; \
-} while (0)
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/mesa/pipe/i915simple/i915_blit.c
deleted file mode 100644
index db4671ff553..00000000000
--- a/src/mesa/pipe/i915simple/i915_blit.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "i915_context.h"
-#include "i915_winsys.h"
-#include "i915_blit.h"
-#include "i915_reg.h"
-#include "i915_batch.h"
-
-#define FILE_DEBUG_FLAG DEBUG_BLIT
-
-void
-i915_fill_blit(struct i915_context *i915,
- unsigned cpp,
- short dst_pitch,
- struct pipe_buffer *dst_buffer,
- unsigned dst_offset,
- short x, short y,
- short w, short h,
- unsigned color)
-{
- unsigned BR13, CMD;
- BATCH_LOCALS;
-
- dst_pitch *= (short) cpp;
-
- switch (cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = dst_pitch | (0xF0 << 16) | (1 << 24);
- CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = dst_pitch | (0xF0 << 16) | (1 << 24) | (1 << 25);
- CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
-// DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
-// __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h);
-
-
- if (!BEGIN_BATCH(6, 1)) {
- FLUSH_BATCH();
- assert(BEGIN_BATCH(6, 1));
- }
- OUT_BATCH(CMD);
- OUT_BATCH(BR13);
- OUT_BATCH((y << 16) | x);
- OUT_BATCH(((y + h) << 16) | (x + w));
- OUT_RELOC( dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
- OUT_BATCH(color);
- ADVANCE_BATCH();
-}
-
-
-void
-i915_copy_blit( struct i915_context *i915,
- unsigned do_flip,
- unsigned cpp,
- short src_pitch,
- struct pipe_buffer *src_buffer,
- unsigned src_offset,
- short dst_pitch,
- struct pipe_buffer *dst_buffer,
- unsigned dst_offset,
- short src_x, short src_y,
- short dst_x, short dst_y,
- short w, short h )
-{
- unsigned CMD, BR13;
- int dst_y2 = dst_y + h;
- int dst_x2 = dst_x + w;
- BATCH_LOCALS;
-
-
- I915_DBG(i915,
- "%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
- __FUNCTION__,
- src_buffer, src_pitch, src_offset, src_x, src_y,
- dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h);
-
- src_pitch *= (short) cpp;
- dst_pitch *= (short) cpp;
-
- switch (cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = (((int) dst_pitch) & 0xffff) |
- (0xCC << 16) | (1 << 24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- case 4:
- BR13 =
- (((int) dst_pitch) & 0xffff) |
- (0xCC << 16) | (1 << 24) | (1 << 25);
- CMD =
- (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
- if (dst_y2 < dst_y ||
- dst_x2 < dst_x) {
- return;
- }
-
- /* Hardware can handle negative pitches but loses the ability to do
- * proper overlapping blits in that case. We don't really have a
- * need for either at this stage.
- */
- assert (dst_pitch > 0 && src_pitch > 0);
-
-
- if (!BEGIN_BATCH(8, 2)) {
- FLUSH_BATCH();
- assert(BEGIN_BATCH(8, 2));
- }
- OUT_BATCH(CMD);
- OUT_BATCH(BR13);
- OUT_BATCH((dst_y << 16) | dst_x);
- OUT_BATCH((dst_y2 << 16) | dst_x2);
- OUT_RELOC(dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
- OUT_BATCH((src_y << 16) | src_x);
- OUT_BATCH(((int) src_pitch & 0xffff));
- OUT_RELOC(src_buffer, I915_BUFFER_ACCESS_READ, src_offset);
- ADVANCE_BATCH();
-}
-
-
diff --git a/src/mesa/pipe/i915simple/i915_blit.h b/src/mesa/pipe/i915simple/i915_blit.h
deleted file mode 100644
index 6e5b44e1247..00000000000
--- a/src/mesa/pipe/i915simple/i915_blit.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef I915_BLIT_H
-#define I915_BLIT_H
-
-#include "i915_context.h"
-
-extern void i915_copy_blit(struct i915_context *i915,
- unsigned do_flip,
- unsigned cpp,
- short src_pitch,
- struct pipe_buffer *src_buffer,
- unsigned src_offset,
- short dst_pitch,
- struct pipe_buffer *dst_buffer,
- unsigned dst_offset,
- short srcx, short srcy,
- short dstx, short dsty,
- short w, short h );
-
-extern void i915_fill_blit(struct i915_context *i915,
- unsigned cpp,
- short dst_pitch,
- struct pipe_buffer *dst_buffer,
- unsigned dst_offset,
- short x, short y,
- short w, short h, unsigned color);
-
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_clear.c b/src/mesa/pipe/i915simple/i915_clear.c
deleted file mode 100644
index cde69daacc0..00000000000
--- a/src/mesa/pipe/i915simple/i915_clear.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Author:
- * Brian Paul
- */
-
-
-#include "pipe/p_defines.h"
-#include "i915_context.h"
-#include "i915_state.h"
-
-
-/**
- * Clear the given surface to the specified value.
- * No masking, no scissor (clear entire buffer).
- */
-void
-i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue)
-{
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-}
diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c
deleted file mode 100644
index 497623a7006..00000000000
--- a/src/mesa/pipe/i915simple/i915_context.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "i915_context.h"
-#include "i915_winsys.h"
-#include "i915_state.h"
-#include "i915_batch.h"
-#include "i915_texture.h"
-#include "i915_reg.h"
-
-#include "pipe/draw/draw_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
-#include "pipe/p_util.h"
-
-
-/**
- * Query format support for creating a texture, drawing surface, etc.
- * \param format the format to test
- * \param type one of PIPE_TEXTURE, PIPE_SURFACE
- */
-static boolean
-i915_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format, uint type )
-{
- static const enum pipe_format tex_supported[] = {
- PIPE_FORMAT_R8G8B8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_U_L8,
- PIPE_FORMAT_U_A8,
- PIPE_FORMAT_U_I8,
- PIPE_FORMAT_U_A8_L8,
- PIPE_FORMAT_YCBCR,
- PIPE_FORMAT_YCBCR_REV,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_NONE /* list terminator */
- };
- static const enum pipe_format surface_supported[] = {
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- /*PIPE_FORMAT_R16G16B16A16_SNORM,*/
- PIPE_FORMAT_NONE /* list terminator */
- };
- const enum pipe_format *list;
- uint i;
-
- switch (type) {
- case PIPE_TEXTURE:
- list = tex_supported;
- break;
- case PIPE_SURFACE:
- list = surface_supported;
- break;
- default:
- assert(0);
- }
-
- for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {
- if (list[i] == format)
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static int
-i915_get_param(struct pipe_context *pipe, int param)
-{
- switch (param) {
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- return 8;
- case PIPE_CAP_NPOT_TEXTURES:
- return 1;
- case PIPE_CAP_TWO_SIDED_STENCIL:
- return 1;
- case PIPE_CAP_GLSL:
- return 0;
- case PIPE_CAP_S3TC:
- return 0;
- case PIPE_CAP_ANISOTROPIC_FILTER:
- return 0;
- case PIPE_CAP_POINT_SPRITE:
- return 0;
- case PIPE_CAP_MAX_RENDER_TARGETS:
- return 1;
- case PIPE_CAP_OCCLUSION_QUERY:
- return 0;
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
- return 1;
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 11; /* max 1024x1024 */
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 8; /* max 128x128x128 */
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 11; /* max 1024x1024 */
- default:
- return 0;
- }
-}
-
-
-static float
-i915_get_paramf(struct pipe_context *pipe, int param)
-{
- switch (param) {
- case PIPE_CAP_MAX_LINE_WIDTH:
- /* fall-through */
- case PIPE_CAP_MAX_LINE_WIDTH_AA:
- return 7.5;
-
- case PIPE_CAP_MAX_POINT_WIDTH:
- /* fall-through */
- case PIPE_CAP_MAX_POINT_WIDTH_AA:
- return 255.0;
-
- case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return 4.0;
-
- case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return 16.0;
-
- default:
- return 0;
- }
-}
-
-
-static void i915_destroy( struct pipe_context *pipe )
-{
- struct i915_context *i915 = i915_context( pipe );
-
- draw_destroy( i915->draw );
-
- FREE( i915 );
-}
-
-
-
-
-static boolean
-i915_draw_elements( struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
- unsigned indexSize,
- unsigned prim, unsigned start, unsigned count)
-{
- struct i915_context *i915 = i915_context( pipe );
- struct draw_context *draw = i915->draw;
- unsigned i;
-
- if (i915->dirty)
- i915_update_derived( i915 );
-
- /*
- * Map vertex buffers
- */
- for (i = 0; i < PIPE_ATTRIB_MAX; i++) {
- if (i915->vertex_buffer[i].buffer) {
- void *buf
- = pipe->winsys->buffer_map(pipe->winsys,
- i915->vertex_buffer[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_vertex_buffer(draw, i, buf);
- }
- }
- /* Map index buffer, if present */
- if (indexBuffer) {
- void *mapped_indexes
- = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
- }
- else {
- /* no index/element buffer */
- draw_set_mapped_element_buffer(draw, 0, NULL);
- }
-
-
- draw_set_mapped_constant_buffer(draw,
- i915->current.constants[PIPE_SHADER_VERTEX]);
-
- /* draw! */
- draw_arrays(i915->draw, prim, start, count);
-
- /*
- * unmap vertex/index buffers
- */
- for (i = 0; i < PIPE_ATTRIB_MAX; i++) {
- if (i915->vertex_buffer[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, i915->vertex_buffer[i].buffer);
- draw_set_mapped_vertex_buffer(draw, i, NULL);
- }
- }
- if (indexBuffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
- draw_set_mapped_element_buffer(draw, 0, NULL);
- }
-
- return TRUE;
-}
-
-
-static boolean i915_draw_arrays( struct pipe_context *pipe,
- unsigned prim, unsigned start, unsigned count)
-{
- return i915_draw_elements(pipe, NULL, 0, prim, start, count);
-}
-
-
-
-struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
- struct i915_winsys *i915_winsys,
- unsigned pci_id )
-{
- struct i915_context *i915;
- unsigned is_i945 = 0;
-
- switch (pci_id) {
- case PCI_CHIP_I915_G:
- case PCI_CHIP_I915_GM:
- break;
-
- case PCI_CHIP_I945_G:
- case PCI_CHIP_I945_GM:
- case PCI_CHIP_I945_GME:
- case PCI_CHIP_G33_G:
- case PCI_CHIP_Q33_G:
- case PCI_CHIP_Q35_G:
- is_i945 = 1;
- break;
-
- default:
- pipe_winsys->printf(pipe_winsys,
- "%s: unknown pci id 0x%x, cannot create context\n",
- __FUNCTION__, pci_id);
- return NULL;
- }
-
- i915 = CALLOC_STRUCT(i915_context);
- if (i915 == NULL)
- return NULL;
-
- i915->winsys = i915_winsys;
- i915->pipe.winsys = pipe_winsys;
-
- i915->pipe.destroy = i915_destroy;
- i915->pipe.is_format_supported = i915_is_format_supported;
- i915->pipe.get_param = i915_get_param;
- i915->pipe.get_paramf = i915_get_paramf;
-
- i915->pipe.clear = i915_clear;
-
-
- i915->pipe.draw_arrays = i915_draw_arrays;
- i915->pipe.draw_elements = i915_draw_elements;
-
- /*
- * Create drawing context and plug our rendering stage into it.
- */
- i915->draw = draw_create();
- assert(i915->draw);
- if (GETENV("I915_VBUF")) {
- draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915));
- }
- else {
- draw_set_rasterize_stage(i915->draw, i915_draw_render_stage(i915));
- }
-
- i915_init_surface_functions(i915);
- i915_init_state_functions(i915);
- i915_init_flush_functions(i915);
- i915_init_string_functions(i915);
-
- i915->pci_id = pci_id;
- i915->flags.is_i945 = is_i945;
-
- i915->pipe.texture_create = i915_texture_create;
- i915->pipe.texture_release = i915_texture_release;
-
- i915->dirty = ~0;
- i915->hardware_dirty = ~0;
-
- /* Batch stream debugging is a bit hacked up at the moment:
- */
- i915->batch_start = NULL;
-
- /*
- * XXX we could plug GL selection/feedback into the drawing pipeline
- * by specifying a different setup/render stage.
- */
-
- return &i915->pipe;
-}
-
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
deleted file mode 100644
index b4ea63c3e74..00000000000
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ /dev/null
@@ -1,304 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef I915_CONTEXT_H
-#define I915_CONTEXT_H
-
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-
-#include "pipe/draw/draw_vertex.h"
-
-
-#define I915_TEX_UNITS 8
-
-#define I915_DYNAMIC_MODES4 0
-#define I915_DYNAMIC_DEPTHSCALE_0 1 /* just the header */
-#define I915_DYNAMIC_DEPTHSCALE_1 2
-#define I915_DYNAMIC_IAB 3
-#define I915_DYNAMIC_BC_0 4 /* just the header */
-#define I915_DYNAMIC_BC_1 5
-#define I915_DYNAMIC_BFO_0 6
-#define I915_DYNAMIC_BFO_1 7
-#define I915_DYNAMIC_STP_0 8
-#define I915_DYNAMIC_STP_1 9
-#define I915_DYNAMIC_SC_ENA_0 10
-#define I915_DYNAMIC_SC_RECT_0 11
-#define I915_DYNAMIC_SC_RECT_1 12
-#define I915_DYNAMIC_SC_RECT_2 13
-#define I915_MAX_DYNAMIC 14
-
-
-#define I915_IMMEDIATE_S0 0
-#define I915_IMMEDIATE_S1 1
-#define I915_IMMEDIATE_S2 2
-#define I915_IMMEDIATE_S3 3
-#define I915_IMMEDIATE_S4 4
-#define I915_IMMEDIATE_S5 5
-#define I915_IMMEDIATE_S6 6
-#define I915_IMMEDIATE_S7 7
-#define I915_MAX_IMMEDIATE 8
-
-/* These must mach the order of LI0_STATE_* bits, as they will be used
- * to generate hardware packets:
- */
-#define I915_CACHE_STATIC 0
-#define I915_CACHE_DYNAMIC 1 /* handled specially */
-#define I915_CACHE_SAMPLER 2
-#define I915_CACHE_MAP 3
-#define I915_CACHE_PROGRAM 4
-#define I915_CACHE_CONSTANTS 5
-#define I915_MAX_CACHE 6
-
-#define I915_MAX_CONSTANT 32
-
-
-
-struct i915_cache_context;
-
-/* Use to calculate differences between state emitted to hardware and
- * current driver-calculated state.
- */
-struct i915_state
-{
- unsigned immediate[I915_MAX_IMMEDIATE];
- unsigned dynamic[I915_MAX_DYNAMIC];
-
- float constants[PIPE_SHADER_TYPES][I915_MAX_CONSTANT][4];
- /** number of constants passed in through a constant buffer */
- uint num_user_constants[PIPE_SHADER_TYPES];
- /** user constants, plus extra constants from shader translation */
- uint num_constants[PIPE_SHADER_TYPES];
-
- uint *program;
- uint program_len;
-
- /* texture sampler state */
- unsigned sampler[I915_TEX_UNITS][3];
- unsigned sampler_enable_flags;
- unsigned sampler_enable_nr;
-
- /* texture image buffers */
- unsigned texbuffer[I915_TEX_UNITS][2];
-
- /** Describes the current hardware vertex layout */
- struct vertex_info vertex_info;
-
- unsigned id; /* track lost context events */
-};
-
-struct i915_blend_state {
- unsigned iab;
- unsigned modes4;
- unsigned LIS5;
- unsigned LIS6;
-};
-
-struct i915_depth_stencil_state {
- unsigned stencil_modes4;
- unsigned bfo[2];
- unsigned stencil_LIS5;
- unsigned depth_LIS6;
-};
-
-struct i915_rasterizer_state {
- int light_twoside : 1;
- unsigned st;
- enum interp_mode color_interp;
-
- unsigned LIS4;
- unsigned LIS7;
- unsigned sc[1];
-
- const struct pipe_rasterizer_state *templ;
-
- union { float f; unsigned u; } ds[2];
-};
-
-struct i915_sampler_state {
- unsigned state[3];
- const struct pipe_sampler_state *templ;
-};
-
-
-struct i915_texture {
- struct pipe_texture base;
-
- /* Derived from the above:
- */
- unsigned pitch;
- unsigned depth_pitch; /* per-image on i945? */
- unsigned total_height;
-
- unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
-
- /* Explicitly store the offset of each image for each cube face or
- * depth value. Pretty much have to accept that hardware formats
- * are going to be so diverse that there is no unified way to
- * compute the offsets of depth/cube images within a mipmap level,
- * so have to store them as a lookup table:
- */
- unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */
-
- /* Includes image offset tables:
- */
- unsigned level_offset[PIPE_MAX_TEXTURE_LEVELS];
-
- /* The data is held here:
- */
- struct pipe_buffer *buffer;
-};
-
-struct i915_context
-{
- struct pipe_context pipe;
- struct i915_winsys *winsys;
- struct draw_context *draw;
-
- /* The most recent drawing state as set by the driver:
- */
- const struct i915_blend_state *blend;
- const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
- const struct i915_depth_stencil_state *depth_stencil;
- const struct i915_rasterizer_state *rasterizer;
- const struct pipe_shader_state *fs;
-
- struct pipe_blend_color blend_color;
- struct pipe_clip_state clip;
- struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
- struct pipe_framebuffer_state framebuffer;
- struct pipe_poly_stipple poly_stipple;
- struct pipe_scissor_state scissor;
- struct i915_texture *texture[PIPE_MAX_SAMPLERS];
- struct pipe_viewport_state viewport;
- struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
-
- unsigned dirty;
-
- unsigned *batch_start;
-
- /** Vertex buffer */
- struct pipe_buffer *vbo;
-
- struct i915_state current;
- unsigned hardware_dirty;
-
- unsigned debug;
- unsigned pci_id;
-
- struct {
- unsigned is_i945:1;
- } flags;
-};
-
-/* A flag for each state_tracker state object:
- */
-#define I915_NEW_VIEWPORT 0x1
-#define I915_NEW_RASTERIZER 0x2
-#define I915_NEW_FS 0x4
-#define I915_NEW_BLEND 0x8
-#define I915_NEW_CLIP 0x10
-#define I915_NEW_SCISSOR 0x20
-#define I915_NEW_STIPPLE 0x40
-#define I915_NEW_FRAMEBUFFER 0x80
-#define I915_NEW_ALPHA_TEST 0x100
-#define I915_NEW_DEPTH_STENCIL 0x200
-#define I915_NEW_SAMPLER 0x400
-#define I915_NEW_TEXTURE 0x800
-#define I915_NEW_CONSTANTS 0x1000
-#define I915_NEW_VBO 0x2000
-
-
-/* Driver's internally generated state flags:
- */
-#define I915_NEW_VERTEX_FORMAT 0x10000
-
-
-/* Dirty flags for hardware emit
- */
-#define I915_HW_STATIC (1<<I915_CACHE_STATIC)
-#define I915_HW_DYNAMIC (1<<I915_CACHE_DYNAMIC)
-#define I915_HW_SAMPLER (1<<I915_CACHE_SAMPLER)
-#define I915_HW_MAP (1<<I915_CACHE_MAP)
-#define I915_HW_PROGRAM (1<<I915_CACHE_PROGRAM)
-#define I915_HW_CONSTANTS (1<<I915_CACHE_CONSTANTS)
-#define I915_HW_IMMEDIATE (1<<(I915_MAX_CACHE+0))
-#define I915_HW_INVARIENT (1<<(I915_MAX_CACHE+1))
-
-
-/***********************************************************************
- * i915_prim_emit.c:
- */
-struct draw_stage *i915_draw_render_stage( struct i915_context *i915 );
-
-
-/***********************************************************************
- * i915_prim_vbuf.c:
- */
-struct draw_stage *i915_draw_vbuf_stage( struct i915_context *i915 );
-
-
-/***********************************************************************
- * i915_state_emit.c:
- */
-void i915_emit_hardware_state(struct i915_context *i915 );
-
-
-
-/***********************************************************************
- * i915_clear.c:
- */
-void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned clearValue);
-
-
-/***********************************************************************
- * i915_surface.c:
- */
-void i915_init_surface_functions( struct i915_context *i915 );
-
-void i915_init_state_functions( struct i915_context *i915 );
-void i915_init_flush_functions( struct i915_context *i915 );
-void i915_init_string_functions( struct i915_context *i915 );
-
-
-
-/***********************************************************************
- * Inline conversion functions. These are better-typed than the
- * macros used previously:
- */
-static INLINE struct i915_context *
-i915_context( struct pipe_context *pipe )
-{
- return (struct i915_context *)pipe;
-}
-
-
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c
deleted file mode 100644
index 94db44e1aaf..00000000000
--- a/src/mesa/pipe/i915simple/i915_debug.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-//#include "imports.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_winsys.h"
-#include "i915_debug.h"
-#include "pipe/p_winsys.h"
-
-
-static void
-PRINTF(
- struct debug_stream *stream,
- const char *fmt,
- ... )
-{
- va_list args;
- char buffer[256];
-
- va_start( args, fmt );
- vsprintf( buffer, fmt, args );
- stream->winsys->printf( stream->winsys, buffer );
- va_end( args );
-}
-
-
-static boolean debug( struct debug_stream *stream, const char *name, unsigned len )
-{
- unsigned i;
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
-
- if (len == 0) {
- PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
- assert(0);
- return FALSE;
- }
-
- if (stream->print_addresses)
- PRINTF(stream, "%08x: ", stream->offset);
-
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- for (i = 0; i < len; i++)
- PRINTF(stream, "\t0x%08x\n", ptr[i]);
- PRINTF(stream, "\n");
-
- stream->offset += len * sizeof(unsigned);
-
- return TRUE;
-}
-
-
-static const char *get_prim_name( unsigned val )
-{
- switch (val & PRIM3D_MASK) {
- case PRIM3D_TRILIST: return "TRILIST"; break;
- case PRIM3D_TRISTRIP: return "TRISTRIP"; break;
- case PRIM3D_TRISTRIP_RVRSE: return "TRISTRIP_RVRSE"; break;
- case PRIM3D_TRIFAN: return "TRIFAN"; break;
- case PRIM3D_POLY: return "POLY"; break;
- case PRIM3D_LINELIST: return "LINELIST"; break;
- case PRIM3D_LINESTRIP: return "LINESTRIP"; break;
- case PRIM3D_RECTLIST: return "RECTLIST"; break;
- case PRIM3D_POINTLIST: return "POINTLIST"; break;
- case PRIM3D_DIB: return "DIB"; break;
- case PRIM3D_CLEAR_RECT: return "CLEAR_RECT"; break;
- case PRIM3D_ZONE_INIT: return "ZONE_INIT"; break;
- default: return "????"; break;
- }
-}
-
-static boolean debug_prim( struct debug_stream *stream, const char *name,
- boolean dump_floats,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- const char *prim = get_prim_name( ptr[0] );
- unsigned i;
-
-
-
- PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len);
- PRINTF(stream, "\t0x%08x\n", ptr[0]);
- for (i = 1; i < len; i++) {
- if (dump_floats)
- PRINTF(stream, "\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]);
- else
- PRINTF(stream, "\t0x%08x\n", ptr[i]);
- }
-
-
- PRINTF(stream, "\n");
-
- stream->offset += len * sizeof(unsigned);
-
- return TRUE;
-}
-
-
-
-
-static boolean debug_program( struct debug_stream *stream, const char *name, unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
-
- if (len == 0) {
- PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
- assert(0);
- return FALSE;
- }
-
- if (stream->print_addresses)
- PRINTF(stream, "%08x: ", stream->offset);
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- i915_disassemble_program( stream, ptr, len );
-
- stream->offset += len * sizeof(unsigned);
- return TRUE;
-}
-
-
-static boolean debug_chain( struct debug_stream *stream, const char *name, unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned old_offset = stream->offset + len * sizeof(unsigned);
- unsigned i;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- for (i = 0; i < len; i++)
- PRINTF(stream, "\t0x%08x\n", ptr[i]);
-
- stream->offset = ptr[1] & ~0x3;
-
- if (stream->offset < old_offset)
- PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
- old_offset, stream->offset );
- else
- PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n",
- old_offset, stream->offset );
-
-
- return TRUE;
-}
-
-
-static boolean debug_variable_length_prim( struct debug_stream *stream )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- const char *prim = get_prim_name( ptr[0] );
- unsigned i, len;
-
- ushort *idx = (ushort *)(ptr+1);
- for (i = 0; idx[i] != 0xffff; i++)
- ;
-
- len = 1+(i+2)/2;
-
- PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
- for (i = 0; i < len; i++)
- PRINTF(stream, "\t0x%08x\n", ptr[i]);
- PRINTF(stream, "\n");
-
- stream->offset += len * sizeof(unsigned);
- return TRUE;
-}
-
-
-static void
-BITS(
- struct debug_stream *stream,
- unsigned dw,
- unsigned hi,
- unsigned lo,
- const char *fmt,
- ... )
-{
- va_list args;
- char buffer[256];
- unsigned himask = ~0UL >> (31 - (hi));
-
- PRINTF(stream, "\t\t ");
-
- va_start( args, fmt );
- vsprintf( buffer, fmt, args );
- stream->winsys->printf( stream->winsys, buffer );
- va_end( args );
-
- PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo));
-}
-
-#define MBZ( dw, hi, lo) do { \
- unsigned x = (dw) >> (lo); \
- unsigned lomask = (1 << (lo)) - 1; \
- unsigned himask; \
- himask = (1UL << (hi)) - 1; \
- assert ((x & himask & ~lomask) == 0); \
-} while (0)
-
-static void
-FLAG(
- struct debug_stream *stream,
- unsigned dw,
- unsigned bit,
- const char *fmt,
- ... )
-{
- if (((dw) >> (bit)) & 1) {
- va_list args;
- char buffer[256];
-
- PRINTF(stream, "\t\t ");
-
- va_start( args, fmt );
- vsprintf( buffer, fmt, args );
- stream->winsys->printf( stream->winsys, buffer );
- va_end( args );
-
- PRINTF(stream, "\n");
- }
-}
-
-static boolean debug_load_immediate( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned bits = (ptr[0] >> 4) & 0xff;
- unsigned j = 0;
-
- PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- if (bits & (1<<0)) {
- PRINTF(stream, "\t LIS0: 0x%08x\n", ptr[j]);
- PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3));
- BITS(stream, ptr[j], 0, 0, "vb invalidate disable");
- j++;
- }
- if (bits & (1<<1)) {
- PRINTF(stream, "\t LIS1: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 29, 24, "vb dword width");
- BITS(stream, ptr[j], 21, 16, "vb dword pitch");
- BITS(stream, ptr[j], 15, 0, "vb max index");
- j++;
- }
- if (bits & (1<<2)) {
- int i;
- PRINTF(stream, "\t LIS2: 0x%08x\n", ptr[j]);
- for (i = 0; i < 8; i++) {
- unsigned tc = (ptr[j] >> (i * 4)) & 0xf;
- if (tc != 0xf)
- BITS(stream, tc, 3, 0, "tex coord %d", i);
- }
- j++;
- }
- if (bits & (1<<3)) {
- PRINTF(stream, "\t LIS3: 0x%08x\n", ptr[j]);
- j++;
- }
- if (bits & (1<<4)) {
- PRINTF(stream, "\t LIS4: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 31, 23, "point width");
- BITS(stream, ptr[j], 22, 19, "line width");
- FLAG(stream, ptr[j], 18, "alpha flatshade");
- FLAG(stream, ptr[j], 17, "fog flatshade");
- FLAG(stream, ptr[j], 16, "spec flatshade");
- FLAG(stream, ptr[j], 15, "rgb flatshade");
- BITS(stream, ptr[j], 14, 13, "cull mode");
- FLAG(stream, ptr[j], 12, "vfmt: point width");
- FLAG(stream, ptr[j], 11, "vfmt: specular/fog");
- FLAG(stream, ptr[j], 10, "vfmt: rgba");
- FLAG(stream, ptr[j], 9, "vfmt: depth offset");
- BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)");
- FLAG(stream, ptr[j], 5, "force dflt diffuse");
- FLAG(stream, ptr[j], 4, "force dflt specular");
- FLAG(stream, ptr[j], 3, "local depth offset enable");
- FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord");
- FLAG(stream, ptr[j], 1, "sprite point");
- FLAG(stream, ptr[j], 0, "antialiasing");
- j++;
- }
- if (bits & (1<<5)) {
- PRINTF(stream, "\t LIS5: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 31, 28, "rgba write disables");
- FLAG(stream, ptr[j], 27, "force dflt point width");
- FLAG(stream, ptr[j], 26, "last pixel enable");
- FLAG(stream, ptr[j], 25, "global z offset enable");
- FLAG(stream, ptr[j], 24, "fog enable");
- BITS(stream, ptr[j], 23, 16, "stencil ref");
- BITS(stream, ptr[j], 15, 13, "stencil test");
- BITS(stream, ptr[j], 12, 10, "stencil fail op");
- BITS(stream, ptr[j], 9, 7, "stencil pass z fail op");
- BITS(stream, ptr[j], 6, 4, "stencil pass z pass op");
- FLAG(stream, ptr[j], 3, "stencil write enable");
- FLAG(stream, ptr[j], 2, "stencil test enable");
- FLAG(stream, ptr[j], 1, "color dither enable");
- FLAG(stream, ptr[j], 0, "logiop enable");
- j++;
- }
- if (bits & (1<<6)) {
- PRINTF(stream, "\t LIS6: 0x%08x\n", ptr[j]);
- FLAG(stream, ptr[j], 31, "alpha test enable");
- BITS(stream, ptr[j], 30, 28, "alpha func");
- BITS(stream, ptr[j], 27, 20, "alpha ref");
- FLAG(stream, ptr[j], 19, "depth test enable");
- BITS(stream, ptr[j], 18, 16, "depth func");
- FLAG(stream, ptr[j], 15, "blend enable");
- BITS(stream, ptr[j], 14, 12, "blend func");
- BITS(stream, ptr[j], 11, 8, "blend src factor");
- BITS(stream, ptr[j], 7, 4, "blend dst factor");
- FLAG(stream, ptr[j], 3, "depth write enable");
- FLAG(stream, ptr[j], 2, "color write enable");
- BITS(stream, ptr[j], 1, 0, "provoking vertex");
- j++;
- }
-
-
- PRINTF(stream, "\n");
-
- assert(j == len);
-
- stream->offset += len * sizeof(unsigned);
-
- return TRUE;
-}
-
-
-
-static boolean debug_load_indirect( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned bits = (ptr[0] >> 8) & 0x3f;
- unsigned i, j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- for (i = 0; i < 6; i++) {
- if (bits & (1<<i)) {
- switch (1<<(8+i)) {
- case LI0_STATE_STATIC_INDIRECT:
- PRINTF(stream, " STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
- break;
- case LI0_STATE_DYNAMIC_INDIRECT:
- PRINTF(stream, " DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- break;
- case LI0_STATE_SAMPLER:
- PRINTF(stream, " SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
- break;
- case LI0_STATE_MAP:
- PRINTF(stream, " MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
- break;
- case LI0_STATE_PROGRAM:
- PRINTF(stream, " PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
- break;
- case LI0_STATE_CONSTANTS:
- PRINTF(stream, " CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
- break;
- default:
- assert(0);
- break;
- }
- }
- }
-
- if (bits == 0) {
- PRINTF(stream, "\t DUMMY: 0x%08x\n", ptr[j++]);
- }
-
- PRINTF(stream, "\n");
-
-
- assert(j == len);
-
- stream->offset += len * sizeof(unsigned);
-
- return TRUE;
-}
-
-static void BR13( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x\n", val);
- FLAG(stream, val, 30, "clipping enable");
- BITS(stream, val, 25, 24, "color depth (3==32bpp)");
- BITS(stream, val, 23, 16, "raster op");
- BITS(stream, val, 15, 0, "dest pitch");
-}
-
-
-static void BR22( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x\n", val);
- BITS(stream, val, 31, 16, "dest y1");
- BITS(stream, val, 15, 0, "dest x1");
-}
-
-static void BR23( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x\n", val);
- BITS(stream, val, 31, 16, "dest y2");
- BITS(stream, val, 15, 0, "dest x2");
-}
-
-static void BR09( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x -- dest address\n", val);
-}
-
-static void BR26( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x\n", val);
- BITS(stream, val, 31, 16, "src y1");
- BITS(stream, val, 15, 0, "src x1");
-}
-
-static void BR11( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x\n", val);
- BITS(stream, val, 15, 0, "src pitch");
-}
-
-static void BR12( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x -- src address\n", val);
-}
-
-static void BR16( struct debug_stream *stream,
- unsigned val )
-{
- PRINTF(stream, "\t0x%08x -- color\n", val);
-}
-
-static boolean debug_copy_blit( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- int j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- BR13(stream, ptr[j++]);
- BR22(stream, ptr[j++]);
- BR23(stream, ptr[j++]);
- BR09(stream, ptr[j++]);
- BR26(stream, ptr[j++]);
- BR11(stream, ptr[j++]);
- BR12(stream, ptr[j++]);
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_color_blit( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- int j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- BR13(stream, ptr[j++]);
- BR22(stream, ptr[j++]);
- BR23(stream, ptr[j++]);
- BR09(stream, ptr[j++]);
- BR16(stream, ptr[j++]);
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_modes4( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- int j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 21, 18, "logicop func");
- FLAG(stream, ptr[j], 17, "stencil test mask modify-enable");
- FLAG(stream, ptr[j], 16, "stencil write mask modify-enable");
- BITS(stream, ptr[j], 15, 8, "stencil test mask");
- BITS(stream, ptr[j], 7, 0, "stencil write mask");
- j++;
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_map_state( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- {
- PRINTF(stream, "\t0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 15, 0, "map mask");
- j++;
- }
-
- while (j < len) {
- {
- PRINTF(stream, "\t TMn.0: 0x%08x\n", ptr[j]);
- PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3));
- FLAG(stream, ptr[j], 1, "vertical line stride");
- FLAG(stream, ptr[j], 0, "vertical line stride offset");
- j++;
- }
-
- {
- PRINTF(stream, "\t TMn.1: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 31, 21, "height");
- BITS(stream, ptr[j], 20, 10, "width");
- BITS(stream, ptr[j], 9, 7, "surface format");
- BITS(stream, ptr[j], 6, 3, "texel format");
- FLAG(stream, ptr[j], 2, "use fence regs");
- FLAG(stream, ptr[j], 1, "tiled surface");
- FLAG(stream, ptr[j], 0, "tile walk ymajor");
- j++;
- }
- {
- PRINTF(stream, "\t TMn.2: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 31, 21, "dword pitch");
- BITS(stream, ptr[j], 20, 15, "cube face enables");
- BITS(stream, ptr[j], 14, 9, "max lod");
- FLAG(stream, ptr[j], 8, "mip layout right");
- BITS(stream, ptr[j], 7, 0, "depth");
- j++;
- }
- }
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_sampler_state( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- {
- PRINTF(stream, "\t0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 15, 0, "sampler mask");
- j++;
- }
-
- while (j < len) {
- {
- PRINTF(stream, "\t TSn.0: 0x%08x\n", ptr[j]);
- FLAG(stream, ptr[j], 31, "reverse gamma");
- FLAG(stream, ptr[j], 30, "planar to packed");
- FLAG(stream, ptr[j], 29, "yuv->rgb");
- BITS(stream, ptr[j], 28, 27, "chromakey index");
- BITS(stream, ptr[j], 26, 22, "base mip level");
- BITS(stream, ptr[j], 21, 20, "mip mode filter");
- BITS(stream, ptr[j], 19, 17, "mag mode filter");
- BITS(stream, ptr[j], 16, 14, "min mode filter");
- BITS(stream, ptr[j], 13, 5, "lod bias (s4.4)");
- FLAG(stream, ptr[j], 4, "shadow enable");
- FLAG(stream, ptr[j], 3, "max-aniso-4");
- BITS(stream, ptr[j], 2, 0, "shadow func");
- j++;
- }
-
- {
- PRINTF(stream, "\t TSn.1: 0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 31, 24, "min lod");
- MBZ( ptr[j], 23, 18 );
- FLAG(stream, ptr[j], 17, "kill pixel enable");
- FLAG(stream, ptr[j], 16, "keyed tex filter mode");
- FLAG(stream, ptr[j], 15, "chromakey enable");
- BITS(stream, ptr[j], 14, 12, "tcx wrap mode");
- BITS(stream, ptr[j], 11, 9, "tcy wrap mode");
- BITS(stream, ptr[j], 8, 6, "tcz wrap mode");
- FLAG(stream, ptr[j], 5, "normalized coords");
- BITS(stream, ptr[j], 4, 1, "map (surface) index");
- FLAG(stream, ptr[j], 0, "EAST deinterlacer enable");
- j++;
- }
- {
- PRINTF(stream, "\t TSn.2: 0x%08x (default color)\n", ptr[j]);
- j++;
- }
- }
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_dest_vars( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- int j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- {
- PRINTF(stream, "\t0x%08x\n", ptr[j]);
- FLAG(stream, ptr[j], 31, "early classic ztest");
- FLAG(stream, ptr[j], 30, "opengl tex default color");
- FLAG(stream, ptr[j], 29, "bypass iz");
- FLAG(stream, ptr[j], 28, "lod preclamp");
- BITS(stream, ptr[j], 27, 26, "dither pattern");
- FLAG(stream, ptr[j], 25, "linear gamma blend");
- FLAG(stream, ptr[j], 24, "debug dither");
- BITS(stream, ptr[j], 23, 20, "dstorg x");
- BITS(stream, ptr[j], 19, 16, "dstorg y");
- MBZ (ptr[j], 15, 15 );
- BITS(stream, ptr[j], 14, 12, "422 write select");
- BITS(stream, ptr[j], 11, 8, "cbuf format");
- BITS(stream, ptr[j], 3, 2, "zbuf format");
- FLAG(stream, ptr[j], 1, "vert line stride");
- FLAG(stream, ptr[j], 1, "vert line stride offset");
- j++;
- }
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean debug_buf_info( struct debug_stream *stream,
- const char *name,
- unsigned len )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- int j = 0;
-
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t0x%08x\n", ptr[j++]);
-
- {
- PRINTF(stream, "\t0x%08x\n", ptr[j]);
- BITS(stream, ptr[j], 28, 28, "aux buffer id");
- BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)");
- FLAG(stream, ptr[j], 23, "use fence regs");
- FLAG(stream, ptr[j], 22, "tiled surface");
- FLAG(stream, ptr[j], 21, "tile walk ymajor");
- MBZ (ptr[j], 20, 14);
- BITS(stream, ptr[j], 13, 2, "dword pitch");
- MBZ (ptr[j], 2, 0);
- j++;
- }
-
- PRINTF(stream, "\t0x%08x -- buffer base address\n", ptr[j++]);
-
- stream->offset += len * sizeof(unsigned);
- assert(j == len);
- return TRUE;
-}
-
-static boolean i915_debug_packet( struct debug_stream *stream )
-{
- unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
- unsigned cmd = *ptr;
-
- switch (((cmd >> 29) & 0x7)) {
- case 0x0:
- switch ((cmd >> 23) & 0x3f) {
- case 0x0:
- return debug(stream, "MI_NOOP", 1);
- case 0x3:
- return debug(stream, "MI_WAIT_FOR_EVENT", 1);
- case 0x4:
- return debug(stream, "MI_FLUSH", 1);
- case 0xA:
- debug(stream, "MI_BATCH_BUFFER_END", 1);
- return FALSE;
- case 0x22:
- return debug(stream, "MI_LOAD_REGISTER_IMM", 3);
- case 0x31:
- return debug_chain(stream, "MI_BATCH_BUFFER_START", 2);
- default:
- (void)debug(stream, "UNKNOWN 0x0 case!", 1);
- assert(0);
- break;
- }
- break;
- case 0x1:
- (void) debug(stream, "UNKNOWN 0x1 case!", 1);
- assert(0);
- break;
- case 0x2:
- switch ((cmd >> 22) & 0xff) {
- case 0x50:
- return debug_color_blit(stream, "XY_COLOR_BLT", (cmd & 0xff) + 2);
- case 0x53:
- return debug_copy_blit(stream, "XY_SRC_COPY_BLT", (cmd & 0xff) + 2);
- default:
- return debug(stream, "blit command", (cmd & 0xff) + 2);
- }
- break;
- case 0x3:
- switch ((cmd >> 24) & 0x1f) {
- case 0x6:
- return debug(stream, "3DSTATE_ANTI_ALIASING", 1);
- case 0x7:
- return debug(stream, "3DSTATE_RASTERIZATION_RULES", 1);
- case 0x8:
- return debug(stream, "3DSTATE_BACKFACE_STENCIL_OPS", 2);
- case 0x9:
- return debug(stream, "3DSTATE_BACKFACE_STENCIL_MASKS", 1);
- case 0xb:
- return debug(stream, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1);
- case 0xc:
- return debug(stream, "3DSTATE_MODES5", 1);
- case 0xd:
- return debug_modes4(stream, "3DSTATE_MODES4", 1);
- case 0x15:
- return debug(stream, "3DSTATE_FOG_COLOR", 1);
- case 0x16:
- return debug(stream, "3DSTATE_COORD_SET_BINDINGS", 1);
- case 0x1c:
- /* 3DState16NP */
- switch((cmd >> 19) & 0x1f) {
- case 0x10:
- return debug(stream, "3DSTATE_SCISSOR_ENABLE", 1);
- case 0x11:
- return debug(stream, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1);
- default:
- (void) debug(stream, "UNKNOWN 0x1c case!", 1);
- assert(0);
- break;
- }
- break;
- case 0x1d:
- /* 3DStateMW */
- switch ((cmd >> 16) & 0xff) {
- case 0x0:
- return debug_map_state(stream, "3DSTATE_MAP_STATE", (cmd & 0x1f) + 2);
- case 0x1:
- return debug_sampler_state(stream, "3DSTATE_SAMPLER_STATE", (cmd & 0x1f) + 2);
- case 0x4:
- return debug_load_immediate(stream, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd & 0xf) + 2);
- case 0x5:
- return debug_program(stream, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd & 0x1ff) + 2);
- case 0x6:
- return debug(stream, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd & 0xff) + 2);
- case 0x7:
- return debug_load_indirect(stream, "3DSTATE_LOAD_INDIRECT", (cmd & 0xff) + 2);
- case 0x80:
- return debug(stream, "3DSTATE_DRAWING_RECTANGLE", (cmd & 0xffff) + 2);
- case 0x81:
- return debug(stream, "3DSTATE_SCISSOR_RECTANGLE", (cmd & 0xffff) + 2);
- case 0x83:
- return debug(stream, "3DSTATE_SPAN_STIPPLE", (cmd & 0xffff) + 2);
- case 0x85:
- return debug_dest_vars(stream, "3DSTATE_DEST_BUFFER_VARS", (cmd & 0xffff) + 2);
- case 0x88:
- return debug(stream, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd & 0xffff) + 2);
- case 0x89:
- return debug(stream, "3DSTATE_FOG_MODE", (cmd & 0xffff) + 2);
- case 0x8e:
- return debug_buf_info(stream, "3DSTATE_BUFFER_INFO", (cmd & 0xffff) + 2);
- case 0x97:
- return debug(stream, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd & 0xffff) + 2);
- case 0x98:
- return debug(stream, "3DSTATE_DEFAULT_Z", (cmd & 0xffff) + 2);
- case 0x99:
- return debug(stream, "3DSTATE_DEFAULT_DIFFUSE", (cmd & 0xffff) + 2);
- case 0x9a:
- return debug(stream, "3DSTATE_DEFAULT_SPECULAR", (cmd & 0xffff) + 2);
- case 0x9c:
- return debug(stream, "3DSTATE_CLEAR_PARAMETERS", (cmd & 0xffff) + 2);
- default:
- assert(0);
- return 0;
- }
- break;
- case 0x1e:
- if (cmd & (1 << 23))
- return debug(stream, "???", (cmd & 0xffff) + 1);
- else
- return debug(stream, "", 1);
- break;
- case 0x1f:
- if ((cmd & (1 << 23)) == 0)
- return debug_prim(stream, "3DPRIM (inline)", 1, (cmd & 0x1ffff) + 2);
- else if (cmd & (1 << 17))
- {
- if ((cmd & 0xffff) == 0)
- return debug_variable_length_prim(stream);
- else
- return debug_prim(stream, "3DPRIM (indexed)", 0, (((cmd & 0xffff) + 1) / 2) + 1);
- }
- else
- return debug_prim(stream, "3DPRIM (indirect sequential)", 0, 2);
- break;
- default:
- return debug(stream, "", 0);
- }
- default:
- assert(0);
- return 0;
- }
-
- assert(0);
- return 0;
-}
-
-
-
-void
-i915_dump_batchbuffer( struct i915_context *i915 )
-{
- struct debug_stream stream;
- unsigned *start = i915->batch_start;
- unsigned *end = i915->winsys->batch_start( i915->winsys, 0, 0 );
- unsigned long bytes = (unsigned long) (end - start) * 4;
- boolean done = FALSE;
-
- stream.offset = 0;
- stream.ptr = (char *)start;
- stream.print_addresses = 0;
- stream.winsys = i915->pipe.winsys;
-
- if (!start || !end) {
- stream.winsys->printf( stream.winsys, "\n\nBATCH: ???\n");
- return;
- }
-
- stream.winsys->printf( stream.winsys, "\n\nBATCH: (%d)\n", bytes / 4);
-
- while (!done &&
- stream.offset < bytes)
- {
- if (!i915_debug_packet( &stream ))
- break;
-
- assert(stream.offset <= bytes &&
- stream.offset >= 0);
- }
-
- stream.winsys->printf( stream.winsys, "END-BATCH\n\n\n");
-}
-
-
diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/mesa/pipe/i915simple/i915_debug.h
deleted file mode 100644
index 0bcd0942334..00000000000
--- a/src/mesa/pipe/i915simple/i915_debug.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Authors: Keith Whitwell <[email protected]>
- */
-
-#ifndef I915_DEBUG_H
-#define I915_DEBUG_H
-
-#include <stdarg.h>
-
-struct i915_context;
-
-struct debug_stream
-{
- unsigned offset; /* current gtt offset */
- char *ptr; /* pointer to gtt offset zero */
- char *end; /* pointer to gtt offset zero */
- unsigned print_addresses;
- struct pipe_winsys *winsys;
-};
-
-
-/* Internal functions
- */
-void i915_disassemble_program(struct debug_stream *stream,
- const unsigned *program, unsigned sz);
-
-void i915_print_ureg(const char *msg, unsigned ureg);
-
-
-#define DEBUG_BATCH 0x1
-#define DEBUG_BLIT 0x2
-#define DEBUG_BUFFER 0x4
-#define DEBUG_CONSTANTS 0x8
-#define DEBUG_CONTEXT 0x10
-#define DEBUG_DRAW 0x20
-#define DEBUG_DYNAMIC 0x40
-#define DEBUG_FLUSH 0x80
-#define DEBUG_MAP 0x100
-#define DEBUG_PROGRAM 0x200
-#define DEBUG_REGIONS 0x400
-#define DEBUG_SAMPLER 0x800
-#define DEBUG_STATIC 0x1000
-#define DEBUG_SURFACE 0x2000
-#define DEBUG_WINSYS 0x4000
-
-#include "pipe/p_compiler.h"
-
-#if defined(DEBUG) && defined(FILE_DEBUG_FLAG)
-
-#include "pipe/p_winsys.h"
-
-static INLINE void
-I915_DBG(
- struct i915_context *i915,
- const char *fmt,
- ... )
-{
- if ((i915)->debug & FILE_DEBUG_FLAG) {
- va_list args;
- char buffer[256];
-
- va_start( args, fmt );
- vsprintf( buffer, fmt, args );
- i915->pipe.winsys->printf( i915->pipe.winsys, buffer );
- va_end( args );
- }
-}
-
-#else
-
-static INLINE void
-I915_DBG(
- struct i915_context *i915,
- const char *fmt,
- ... )
-{
- (void) i915;
- (void) fmt;
-}
-
-#endif
-
-
-void i915_dump_batchbuffer( struct i915_context *i915 );
-
-
-
-void i915_debug_init( struct i915_context *i915 );
-
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/mesa/pipe/i915simple/i915_debug_fp.c
deleted file mode 100644
index ebfdb3d93c5..00000000000
--- a/src/mesa/pipe/i915simple/i915_debug_fp.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "i915_reg.h"
-#include "i915_debug.h"
-#include "pipe/p_winsys.h"
-#include "pipe/p_util.h"
-
-
-static void
-PRINTF(
- struct debug_stream *stream,
- const char *fmt,
- ... )
-{
- va_list args;
- char buffer[256];
-
- va_start( args, fmt );
- vsprintf( buffer, fmt, args );
- stream->winsys->printf( stream->winsys, buffer );
- va_end( args );
-}
-
-
-static const char *opcodes[0x20] = {
- "NOP",
- "ADD",
- "MOV",
- "MUL",
- "MAD",
- "DP2ADD",
- "DP3",
- "DP4",
- "FRC",
- "RCP",
- "RSQ",
- "EXP",
- "LOG",
- "CMP",
- "MIN",
- "MAX",
- "FLR",
- "MOD",
- "TRC",
- "SGE",
- "SLT",
- "TEXLD",
- "TEXLDP",
- "TEXLDB",
- "TEXKILL",
- "DCL",
- "0x1a",
- "0x1b",
- "0x1c",
- "0x1d",
- "0x1e",
- "0x1f",
-};
-
-
-static const int args[0x20] = {
- 0, /* 0 nop */
- 2, /* 1 add */
- 1, /* 2 mov */
- 2, /* 3 m ul */
- 3, /* 4 mad */
- 3, /* 5 dp2add */
- 2, /* 6 dp3 */
- 2, /* 7 dp4 */
- 1, /* 8 frc */
- 1, /* 9 rcp */
- 1, /* a rsq */
- 1, /* b exp */
- 1, /* c log */
- 3, /* d cmp */
- 2, /* e min */
- 2, /* f max */
- 1, /* 10 flr */
- 1, /* 11 mod */
- 1, /* 12 trc */
- 2, /* 13 sge */
- 2, /* 14 slt */
- 1,
- 1,
- 1,
- 1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-
-static const char *regname[0x8] = {
- "R",
- "T",
- "CONST",
- "S",
- "OC",
- "OD",
- "U",
- "UNKNOWN",
-};
-
-static void
-print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr)
-{
- switch (type) {
- case REG_TYPE_T:
- switch (nr) {
- case T_DIFFUSE:
- PRINTF(stream, "T_DIFFUSE");
- return;
- case T_SPECULAR:
- PRINTF(stream, "T_SPECULAR");
- return;
- case T_FOG_W:
- PRINTF(stream, "T_FOG_W");
- return;
- default:
- PRINTF(stream, "T_TEX%d", nr);
- return;
- }
- case REG_TYPE_OC:
- if (nr == 0) {
- PRINTF(stream, "oC");
- return;
- }
- break;
- case REG_TYPE_OD:
- if (nr == 0) {
- PRINTF(stream, "oD");
- return;
- }
- break;
- default:
- break;
- }
-
- PRINTF(stream, "%s[%d]", regname[type], nr);
-}
-
-#define REG_SWIZZLE_MASK 0x7777
-#define REG_NEGATE_MASK 0x8888
-
-#define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \
- (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
-
-
-static void
-print_reg_neg_swizzle(struct debug_stream *stream, unsigned reg)
-{
- int i;
-
- if ((reg & REG_SWIZZLE_MASK) == REG_SWIZZLE_XYZW &&
- (reg & REG_NEGATE_MASK) == 0)
- return;
-
- PRINTF(stream, ".");
-
- for (i = 3; i >= 0; i--) {
- if (reg & (1 << ((i * 4) + 3)))
- PRINTF(stream, "-");
-
- switch ((reg >> (i * 4)) & 0x7) {
- case 0:
- PRINTF(stream, "x");
- break;
- case 1:
- PRINTF(stream, "y");
- break;
- case 2:
- PRINTF(stream, "z");
- break;
- case 3:
- PRINTF(stream, "w");
- break;
- case 4:
- PRINTF(stream, "0");
- break;
- case 5:
- PRINTF(stream, "1");
- break;
- default:
- PRINTF(stream, "?");
- break;
- }
- }
-}
-
-
-static void
-print_src_reg(struct debug_stream *stream, unsigned dword)
-{
- unsigned nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
- unsigned type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr(stream, type, nr);
- print_reg_neg_swizzle(stream, dword);
-}
-
-
-static void
-print_dest_reg(struct debug_stream *stream, unsigned dword)
-{
- unsigned nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
- unsigned type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr(stream, type, nr);
- if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
- return;
- PRINTF(stream, ".");
- if (dword & A0_DEST_CHANNEL_X)
- PRINTF(stream, "x");
- if (dword & A0_DEST_CHANNEL_Y)
- PRINTF(stream, "y");
- if (dword & A0_DEST_CHANNEL_Z)
- PRINTF(stream, "z");
- if (dword & A0_DEST_CHANNEL_W)
- PRINTF(stream, "w");
-}
-
-
-#define GET_SRC0_REG(r0, r1) ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT))
-#define GET_SRC1_REG(r0, r1) ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT))
-#define GET_SRC2_REG(r) (r)
-
-
-static void
-print_arith_op(struct debug_stream *stream,
- unsigned opcode, const unsigned * program)
-{
- if (opcode != A0_NOP) {
- print_dest_reg(stream, program[0]);
- if (program[0] & A0_DEST_SATURATE)
- PRINTF(stream, " = SATURATE ");
- else
- PRINTF(stream, " = ");
- }
-
- PRINTF(stream, "%s ", opcodes[opcode]);
-
- print_src_reg(stream, GET_SRC0_REG(program[0], program[1]));
- if (args[opcode] == 1) {
- PRINTF(stream, "\n");
- return;
- }
-
- PRINTF(stream, ", ");
- print_src_reg(stream, GET_SRC1_REG(program[1], program[2]));
- if (args[opcode] == 2) {
- PRINTF(stream, "\n");
- return;
- }
-
- PRINTF(stream, ", ");
- print_src_reg(stream, GET_SRC2_REG(program[2]));
- PRINTF(stream, "\n");
- return;
-}
-
-
-static void
-print_tex_op(struct debug_stream *stream,
- unsigned opcode, const unsigned * program)
-{
- print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF(stream, " = ");
-
- PRINTF(stream, "%s ", opcodes[opcode]);
-
- PRINTF(stream, "S[%d],", program[0] & T0_SAMPLER_NR_MASK);
-
- print_reg_type_nr(stream,
- (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) &
- REG_TYPE_MASK,
- (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK);
- PRINTF(stream, "\n");
-}
-
-static void
-print_texkil_op(struct debug_stream *stream,
- unsigned opcode, const unsigned * program)
-{
- PRINTF(stream, "TEXKIL ");
-
- print_reg_type_nr(stream,
- (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) &
- REG_TYPE_MASK,
- (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK);
- PRINTF(stream, "\n");
-}
-
-static void
-print_dcl_op(struct debug_stream *stream,
- unsigned opcode, const unsigned * program)
-{
- PRINTF(stream, "%s ", opcodes[opcode]);
- print_dest_reg(stream,
- program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF(stream, "\n");
-}
-
-
-void
-i915_disassemble_program(struct debug_stream *stream,
- const unsigned * program, unsigned sz)
-{
- unsigned size = program[0] & 0x1ff;
- unsigned i;
-
- PRINTF(stream, "\t\tBEGIN\n");
-
- assert(size + 2 == sz);
-
- program++;
- for (i = 1; i < sz; i += 3, program += 3) {
- unsigned opcode = program[0] & (0x1f << 24);
-
- PRINTF(stream, "\t\t");
-
- if ((int) opcode >= A0_NOP && opcode <= A0_SLT)
- print_arith_op(stream, opcode >> 24, program);
- else if (opcode >= T0_TEXLD && opcode < T0_TEXKILL)
- print_tex_op(stream, opcode >> 24, program);
- else if (opcode == T0_TEXKILL)
- print_texkil_op(stream, opcode >> 24, program);
- else if (opcode == D0_DCL)
- print_dcl_op(stream, opcode >> 24, program);
- else
- PRINTF(stream, "Unknown opcode 0x%x\n", opcode);
- }
-
- PRINTF(stream, "\t\tEND\n\n");
-}
-
-
diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/mesa/pipe/i915simple/i915_flush.c
deleted file mode 100644
index 3c2069b8273..00000000000
--- a/src/mesa/pipe/i915simple/i915_flush.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Author:
- * Keith Whitwell <[email protected]>
- */
-
-
-#include "pipe/p_defines.h"
-#include "i915_context.h"
-#include "i915_reg.h"
-#include "i915_batch.h"
-
-
-/**
- * In future we may want a fence-like interface instead of finish.
- */
-static void i915_flush( struct pipe_context *pipe,
- unsigned flags )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- /* Do we need to emit an MI_FLUSH command to flush the hardware
- * caches?
- */
- if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) {
- unsigned flush = MI_FLUSH;
-
- if (!(flags & PIPE_FLUSH_RENDER_CACHE))
- flush |= INHIBIT_FLUSH_RENDER_CACHE;
-
- if (flags & PIPE_FLUSH_TEXTURE_CACHE)
- flush |= FLUSH_MAP_CACHE;
-
- if (!BEGIN_BATCH(1, 0)) {
- FLUSH_BATCH();
- assert(BEGIN_BATCH(1, 0));
- }
- OUT_BATCH( flush );
- ADVANCE_BATCH();
- }
-
- /* If there are no flags, just flush pending commands to hardware:
- */
- FLUSH_BATCH();
-
- if (flags & PIPE_FLUSH_WAIT) {
- i915->winsys->batch_finish(i915->winsys);
- }
-}
-
-
-
-void i915_init_flush_functions( struct i915_context *i915 )
-{
- i915->pipe.flush = i915_flush;
-}
diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/mesa/pipe/i915simple/i915_fpc.h
deleted file mode 100644
index 8c7b68aefb5..00000000000
--- a/src/mesa/pipe/i915simple/i915_fpc.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef I915_FPC_H
-#define I915_FPC_H
-
-#include "pipe/p_util.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-#define I915_PROGRAM_SIZE 192
-
-
-
-/**
- * Program translation state
- */
-struct i915_fp_compile {
- const struct pipe_shader_state *shader;
-
- struct vertex_info *vertex_info;
-
- uint declarations[I915_PROGRAM_SIZE];
- uint program[I915_PROGRAM_SIZE];
-
- uint input_semantic_name[PIPE_MAX_SHADER_INPUTS];
- uint input_semantic_index[PIPE_MAX_SHADER_INPUTS];
-
- uint output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
- uint output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
-
- /** points into the i915->current.constants array: */
- float (*constants)[4];
- uint num_constants;
- uint constant_flags[I915_MAX_CONSTANT]; /**< status of each constant */
-
- uint *csr; /**< Cursor, points into program. */
-
- uint *decl; /**< Cursor, points into declarations. */
-
- uint decl_s; /**< flags for which s regs need to be decl'd */
- uint decl_t; /**< flags for which t regs need to be decl'd */
-
- uint temp_flag; /**< Tracks temporary regs which are in use */
- uint utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */
-
- uint nr_tex_indirect;
- uint nr_tex_insn;
- uint nr_alu_insn;
- uint nr_decl_insn;
-
- boolean error; /**< Set if i915_program_error() is called */
- uint wpos_tex;
- uint NumNativeInstructions;
- uint NumNativeAluInstructions;
- uint NumNativeTexInstructions;
- uint NumNativeTexIndirections;
-};
-
-
-/* Having zero and one in here makes the definition of swizzle a lot
- * easier.
- */
-#define UREG_TYPE_SHIFT 29
-#define UREG_NR_SHIFT 24
-#define UREG_CHANNEL_X_NEGATE_SHIFT 23
-#define UREG_CHANNEL_X_SHIFT 20
-#define UREG_CHANNEL_Y_NEGATE_SHIFT 19
-#define UREG_CHANNEL_Y_SHIFT 16
-#define UREG_CHANNEL_Z_NEGATE_SHIFT 15
-#define UREG_CHANNEL_Z_SHIFT 12
-#define UREG_CHANNEL_W_NEGATE_SHIFT 11
-#define UREG_CHANNEL_W_SHIFT 8
-#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5
-#define UREG_CHANNEL_ZERO_SHIFT 4
-#define UREG_CHANNEL_ONE_NEGATE_MBZ 1
-#define UREG_CHANNEL_ONE_SHIFT 0
-
-#define UREG_BAD 0xffffffff /* not a valid ureg */
-
-#define X SRC_X
-#define Y SRC_Y
-#define Z SRC_Z
-#define W SRC_W
-#define ZERO SRC_ZERO
-#define ONE SRC_ONE
-
-/* Construct a ureg:
- */
-#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \
- ((nr) << UREG_NR_SHIFT) | \
- (X << UREG_CHANNEL_X_SHIFT) | \
- (Y << UREG_CHANNEL_Y_SHIFT) | \
- (Z << UREG_CHANNEL_Z_SHIFT) | \
- (W << UREG_CHANNEL_W_SHIFT) | \
- (ZERO << UREG_CHANNEL_ZERO_SHIFT) | \
- (ONE << UREG_CHANNEL_ONE_SHIFT))
-
-#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & (0xf<<20))
-#define CHANNEL_SRC( src, channel ) (src>>(channel*4))
-
-#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)&REG_TYPE_MASK)
-#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)&REG_NR_MASK)
-
-
-
-#define UREG_XYZW_CHANNEL_MASK 0x00ffff00
-
-/* One neat thing about the UREG representation:
- */
-static INLINE int
-swizzle(int reg, uint x, uint y, uint z, uint w)
-{
- assert(x <= SRC_ONE);
- assert(y <= SRC_ONE);
- assert(z <= SRC_ONE);
- assert(w <= SRC_ONE);
- return ((reg & ~UREG_XYZW_CHANNEL_MASK) |
- CHANNEL_SRC(GET_CHANNEL_SRC(reg, x), 0) |
- CHANNEL_SRC(GET_CHANNEL_SRC(reg, y), 1) |
- CHANNEL_SRC(GET_CHANNEL_SRC(reg, z), 2) |
- CHANNEL_SRC(GET_CHANNEL_SRC(reg, w), 3));
-}
-
-
-
-/***********************************************************************
- * Public interface for the compiler
- */
-extern void i915_translate_fragment_program( struct i915_context *i915 );
-
-
-
-extern uint i915_get_temp(struct i915_fp_compile *p);
-extern uint i915_get_utemp(struct i915_fp_compile *p);
-extern void i915_release_utemps(struct i915_fp_compile *p);
-
-
-extern uint i915_emit_texld(struct i915_fp_compile *p,
- uint dest,
- uint destmask,
- uint sampler, uint coord, uint op);
-
-extern uint i915_emit_arith(struct i915_fp_compile *p,
- uint op,
- uint dest,
- uint mask,
- uint saturate,
- uint src0, uint src1, uint src2);
-
-extern uint i915_emit_decl(struct i915_fp_compile *p,
- uint type, uint nr, uint d0_flags);
-
-
-extern uint i915_emit_const1f(struct i915_fp_compile *p, float c0);
-
-extern uint i915_emit_const2f(struct i915_fp_compile *p,
- float c0, float c1);
-
-extern uint i915_emit_const4fv(struct i915_fp_compile *p,
- const float * c);
-
-extern uint i915_emit_const4f(struct i915_fp_compile *p,
- float c0, float c1,
- float c2, float c3);
-
-
-/*======================================================================
- * i915_fpc_debug.c
- */
-extern void i915_disassemble_program(const uint * program, uint sz);
-
-
-/*======================================================================
- * i915_fpc_translate.c
- */
-
-extern void
-i915_program_error(struct i915_fp_compile *p, const char *msg, ...);
-
-extern void
-i915_translate_fragment_program(struct i915_context *i915);
-
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_fpc_emit.c b/src/mesa/pipe/i915simple/i915_fpc_emit.c
deleted file mode 100644
index 74924ff0a1d..00000000000
--- a/src/mesa/pipe/i915simple/i915_fpc_emit.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_fpc.h"
-
-
-#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT)
-#define A1_SRC0( reg ) (((reg)&UREG_MASK)<<UREG_A1_SRC0_SHIFT_RIGHT)
-#define A1_SRC1( reg ) (((reg)&UREG_MASK)>>UREG_A1_SRC1_SHIFT_LEFT)
-#define A2_SRC1( reg ) (((reg)&UREG_MASK)<<UREG_A2_SRC1_SHIFT_RIGHT)
-#define A2_SRC2( reg ) (((reg)&UREG_MASK)>>UREG_A2_SRC2_SHIFT_LEFT)
-
-/* These are special, and don't have swizzle/negate bits.
- */
-#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<<T0_SAMPLER_NR_SHIFT)
-#define T1_ADDRESS_REG( reg ) ((GET_UREG_NR(reg)<<T1_ADDRESS_REG_NR_SHIFT) | \
- (GET_UREG_TYPE(reg)<<T1_ADDRESS_REG_TYPE_SHIFT))
-
-
-/* Macros for translating UREG's into the various register fields used
- * by the I915 programmable unit.
- */
-#define UREG_A0_DEST_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_DEST_TYPE_SHIFT)
-#define UREG_A0_SRC0_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_SRC0_TYPE_SHIFT)
-#define UREG_A1_SRC0_SHIFT_RIGHT (A1_SRC0_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A1_SRC1_SHIFT_LEFT (UREG_TYPE_SHIFT - A1_SRC1_TYPE_SHIFT)
-#define UREG_A2_SRC1_SHIFT_RIGHT (A2_SRC1_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A2_SRC2_SHIFT_LEFT (UREG_TYPE_SHIFT - A2_SRC2_TYPE_SHIFT)
-
-#define UREG_MASK 0xffffff00
-#define UREG_TYPE_NR_MASK ((REG_TYPE_MASK << UREG_TYPE_SHIFT) | \
- (REG_NR_MASK << UREG_NR_SHIFT))
-
-
-#define I915_CONSTFLAG_PARAM 0x1f
-
-uint
-i915_get_temp(struct i915_fp_compile *p)
-{
- int bit = ffs(~p->temp_flag);
- if (!bit) {
- i915_program_error(p, "i915_get_temp: out of temporaries\n");
- return 0;
- }
-
- p->temp_flag |= 1 << (bit - 1);
- return UREG(REG_TYPE_R, (bit - 1));
-}
-
-
-uint
-i915_get_utemp(struct i915_fp_compile * p)
-{
- int bit = ffs(~p->utemp_flag);
- if (!bit) {
- i915_program_error(p, "i915_get_utemp: out of temporaries\n");
- return 0;
- }
-
- p->utemp_flag |= 1 << (bit - 1);
- return UREG(REG_TYPE_U, (bit - 1));
-}
-
-void
-i915_release_utemps(struct i915_fp_compile *p)
-{
- p->utemp_flag = ~0x7;
-}
-
-
-uint
-i915_emit_decl(struct i915_fp_compile *p,
- uint type, uint nr, uint d0_flags)
-{
- uint reg = UREG(type, nr);
-
- if (type == REG_TYPE_T) {
- if (p->decl_t & (1 << nr))
- return reg;
-
- p->decl_t |= (1 << nr);
- }
- else if (type == REG_TYPE_S) {
- if (p->decl_s & (1 << nr))
- return reg;
-
- p->decl_s |= (1 << nr);
- }
- else
- return reg;
-
- *(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags);
- *(p->decl++) = D1_MBZ;
- *(p->decl++) = D2_MBZ;
-
- p->nr_decl_insn++;
- return reg;
-}
-
-uint
-i915_emit_arith(struct i915_fp_compile * p,
- uint op,
- uint dest,
- uint mask,
- uint saturate, uint src0, uint src1, uint src2)
-{
- uint c[3];
- uint nr_const = 0;
-
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest));
- assert(dest);
-
- if (GET_UREG_TYPE(src0) == REG_TYPE_CONST)
- c[nr_const++] = 0;
- if (GET_UREG_TYPE(src1) == REG_TYPE_CONST)
- c[nr_const++] = 1;
- if (GET_UREG_TYPE(src2) == REG_TYPE_CONST)
- c[nr_const++] = 2;
-
- /* Recursively call this function to MOV additional const values
- * into temporary registers. Use utemp registers for this -
- * currently shouldn't be possible to run out, but keep an eye on
- * this.
- */
- if (nr_const > 1) {
- uint s[3], first, i, old_utemp_flag;
-
- s[0] = src0;
- s[1] = src1;
- s[2] = src2;
- old_utemp_flag = p->utemp_flag;
-
- first = GET_UREG_NR(s[c[0]]);
- for (i = 1; i < nr_const; i++) {
- if (GET_UREG_NR(s[c[i]]) != first) {
- uint tmp = i915_get_utemp(p);
-
- i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0,
- s[c[i]], 0, 0);
- s[c[i]] = tmp;
- }
- }
-
- src0 = s[0];
- src1 = s[1];
- src2 = s[2];
- p->utemp_flag = old_utemp_flag; /* restore */
- }
-
- *(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0));
- *(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1));
- *(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2));
-
- p->nr_alu_insn++;
- return dest;
-}
-
-uint i915_emit_texld( struct i915_fp_compile *p,
- uint dest,
- uint destmask,
- uint sampler,
- uint coord,
- uint op )
-{
- uint k = UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord));
- if (coord != k) {
- /* No real way to work around this in the general case - need to
- * allocate and declare a new temporary register (a utemp won't
- * do). Will fallback for now.
- */
- i915_program_error(p, "Can't (yet) swizzle TEX arguments");
- assert(0);
- return 0;
- }
-
- /* Don't worry about saturate as we only support
- */
- if (destmask != A0_DEST_CHANNEL_ALL) {
- uint tmp = i915_get_utemp(p);
- i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
- i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 );
- return dest;
- }
- else {
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
-
- if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
- p->nr_tex_indirect++;
- }
-
- *(p->csr++) = (op |
- T0_DEST( dest ) |
- T0_SAMPLER( sampler ));
-
- *(p->csr++) = T1_ADDRESS_REG( coord );
- *(p->csr++) = T2_MBZ;
-
- p->nr_tex_insn++;
- return dest;
- }
-}
-
-
-uint
-i915_emit_const1f(struct i915_fp_compile * p, float c0)
-{
- unsigned reg, idx;
-
- if (c0 == 0.0)
- return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO);
- if (c0 == 1.0)
- return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE);
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 4; idx++) {
- if (!(p->constant_flags[reg] & (1 << idx)) ||
- p->constants[reg][idx] == c0) {
- p->constants[reg][idx] = c0;
- p->constant_flags[reg] |= 1 << idx;
- if (reg + 1 > p->num_constants)
- p->num_constants = reg + 1;
- return swizzle(UREG(REG_TYPE_CONST, reg), idx, ZERO, ZERO, ONE);
- }
- }
- }
-
- i915_program_error(p, "i915_emit_const1f: out of constants\n");
- return 0;
-}
-
-uint
-i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1)
-{
- unsigned reg, idx;
-
- if (c0 == 0.0)
- return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W);
- if (c0 == 1.0)
- return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W);
-
- if (c1 == 0.0)
- return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W);
- if (c1 == 1.0)
- return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W);
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf ||
- p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 3; idx++) {
- if (!(p->constant_flags[reg] & (3 << idx))) {
- p->constants[reg][idx + 0] = c0;
- p->constants[reg][idx + 1] = c1;
- p->constant_flags[reg] |= 3 << idx;
- if (reg + 1 > p->num_constants)
- p->num_constants = reg + 1;
- return swizzle(UREG(REG_TYPE_CONST, reg), idx, idx + 1, ZERO, ONE);
- }
- }
- }
-
- i915_program_error(p, "i915_emit_const2f: out of constants\n");
- return 0;
-}
-
-
-
-uint
-i915_emit_const4f(struct i915_fp_compile * p,
- float c0, float c1, float c2, float c3)
-{
- unsigned reg;
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf &&
- p->constants[reg][0] == c0 &&
- p->constants[reg][1] == c1 &&
- p->constants[reg][2] == c2 &&
- p->constants[reg][3] == c3) {
- return UREG(REG_TYPE_CONST, reg);
- }
- else if (p->constant_flags[reg] == 0) {
-
- p->constants[reg][0] = c0;
- p->constants[reg][1] = c1;
- p->constants[reg][2] = c2;
- p->constants[reg][3] = c3;
- p->constant_flags[reg] = 0xf;
- if (reg + 1 > p->num_constants)
- p->num_constants = reg + 1;
- return UREG(REG_TYPE_CONST, reg);
- }
- }
-
- i915_program_error(p, "i915_emit_const4f: out of constants\n");
- return 0;
-}
-
-
-uint
-i915_emit_const4fv(struct i915_fp_compile * p, const float * c)
-{
- return i915_emit_const4f(p, c[0], c[1], c[2], c[3]);
-}
-
-
-#if 00000/*UNUSED*/
-/* Reserve a slot in the constant file for a Mesa state parameter.
- * These will later need to be tracked on statechanges, but that is
- * done elsewhere.
- */
-uint
-i915_emit_param4fv(struct i915_fp_compile * p, const float * values)
-{
- struct i915_fragment_program *fp = p->fp;
- int i;
-
- for (i = 0; i < fp->nr_params; i++) {
- if (fp->param[i].values == values)
- return UREG(REG_TYPE_CONST, fp->param[i].reg);
- }
-
- if (p->constants->nr_constants == I915_MAX_CONSTANT ||
- fp->nr_params == I915_MAX_CONSTANT) {
- i915_program_error(p, "i915_emit_param4fv: out of constants\n");
- return 0;
- }
-
- {
- int reg = p->constants->nr_constants++;
- int i = fp->nr_params++;
-
- assert (p->constant_flags[reg] == 0);
- p->constant_flags[reg] = I915_CONSTFLAG_PARAM;
-
- fp->param[i].values = values;
- fp->param[i].reg = reg;
-
- return UREG(REG_TYPE_CONST, reg);
- }
-}
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c
deleted file mode 100644
index 868f0c7e046..00000000000
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ /dev/null
@@ -1,1135 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <stdarg.h>
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_fpc.h"
-
-#include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_parse.h"
-
-#include "pipe/draw/draw_vertex.h"
-
-
-/**
- * Simple pass-through fragment shader to use when we don't have
- * a real shader (or it fails to compile for some reason).
- */
-static unsigned passthrough[] =
-{
- _3DSTATE_PIXEL_SHADER_PROGRAM | ((2*3)-1),
-
- /* declare input color:
- */
- (D0_DCL |
- (REG_TYPE_T << D0_TYPE_SHIFT) |
- (T_DIFFUSE << D0_NR_SHIFT) |
- D0_CHANNEL_ALL),
- 0,
- 0,
-
- /* move to output color:
- */
- (A0_MOV |
- (REG_TYPE_OC << A0_DEST_TYPE_SHIFT) |
- A0_DEST_CHANNEL_ALL |
- (REG_TYPE_T << A0_SRC0_TYPE_SHIFT) |
- (T_DIFFUSE << A0_SRC0_NR_SHIFT)),
- 0x01230000, /* .xyzw */
- 0
-};
-
-
-/* 1, -1/3!, 1/5!, -1/7! */
-static const float sin_constants[4] = { 1.0,
- -1.0f / (3 * 2 * 1),
- 1.0f / (5 * 4 * 3 * 2 * 1),
- -1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1)
-};
-
-/* 1, -1/2!, 1/4!, -1/6! */
-static const float cos_constants[4] = { 1.0,
- -1.0f / (2 * 1),
- 1.0f / (4 * 3 * 2 * 1),
- -1.0f / (6 * 5 * 4 * 3 * 2 * 1)
-};
-
-
-
-/**
- * component-wise negation of ureg
- */
-static INLINE int
-negate(int reg, int x, int y, int z, int w)
-{
- /* Another neat thing about the UREG representation */
- return reg ^ (((x & 1) << UREG_CHANNEL_X_NEGATE_SHIFT) |
- ((y & 1) << UREG_CHANNEL_Y_NEGATE_SHIFT) |
- ((z & 1) << UREG_CHANNEL_Z_NEGATE_SHIFT) |
- ((w & 1) << UREG_CHANNEL_W_NEGATE_SHIFT));
-}
-
-
-static void
-i915_use_passthrough_shader(struct i915_context *i915)
-{
- debug_printf("**** Using i915 pass-through fragment shader\n");
-
- i915->current.program = (uint *) MALLOC(sizeof(passthrough));
- if (i915->current.program) {
- memcpy(i915->current.program, passthrough, sizeof(passthrough));
- i915->current.program_len = Elements(passthrough);
- }
-
- i915->current.num_constants[PIPE_SHADER_FRAGMENT] = 0;
- i915->current.num_user_constants[PIPE_SHADER_FRAGMENT] = 0;
-}
-
-
-void
-i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
-{
- va_list args;
- char buffer[1024];
-
- debug_printf("i915_program_error: ");
- va_start( args, msg );
- vsprintf( buffer, msg, args );
- va_end( args );
- debug_printf(buffer);
- debug_printf("\n");
-
- p->error = 1;
-}
-
-
-
-/**
- * Construct a ureg for the given source register. Will emit
- * constants, apply swizzling and negation as needed.
- */
-static uint
-src_vector(struct i915_fp_compile *p,
- const struct tgsi_full_src_register *source)
-{
- uint index = source->SrcRegister.Index;
- uint src, sem_name, sem_ind;
-
- switch (source->SrcRegister.File) {
- case TGSI_FILE_TEMPORARY:
- if (source->SrcRegister.Index >= I915_MAX_TEMPORARY) {
- i915_program_error(p, "Exceeded max temporary reg");
- return 0;
- }
- src = UREG(REG_TYPE_R, index);
- break;
- case TGSI_FILE_INPUT:
- /* XXX: Packing COL1, FOGC into a single attribute works for
- * texenv programs, but will fail for real fragment programs
- * that use these attributes and expect them to be a full 4
- * components wide. Could use a texcoord to pass these
- * attributes if necessary, but that won't work in the general
- * case.
- *
- * We also use a texture coordinate to pass wpos when possible.
- */
-
- /* use vertex format info to map a slot number to a VF attrib */
- assert(index < p->vertex_info->num_attribs);
-
- sem_name = p->input_semantic_name[index];
- sem_ind = p->input_semantic_index[index];
-
- switch (sem_name) {
- case TGSI_SEMANTIC_POSITION:
- debug_printf("SKIP SEM POS\n");
- /*
- assert(p->wpos_tex != -1);
- src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
- */
- break;
- case TGSI_SEMANTIC_COLOR:
- if (sem_ind == 0) {
- src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
- }
- else {
- /* secondary color */
- assert(sem_ind == 1);
- src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ);
- src = swizzle(src, X, Y, Z, ONE);
- }
- break;
- case TGSI_SEMANTIC_FOG:
- src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W);
- src = swizzle(src, W, W, W, W);
- break;
- case TGSI_SEMANTIC_GENERIC:
- /* usually a texcoord */
- src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + sem_ind, D0_CHANNEL_ALL);
- break;
- default:
- i915_program_error(p, "Bad source->Index");
- return 0;
- }
- break;
-
- case TGSI_FILE_IMMEDIATE:
- /* XXX unfinished - need to append immediates onto const buffer */
- /* fall-through */
- case TGSI_FILE_CONSTANT:
- src = UREG(REG_TYPE_CONST, index);
- break;
-
- default:
- i915_program_error(p, "Bad source->File");
- return 0;
- }
-
- if (source->SrcRegister.Extended) {
- src = swizzle(src,
- source->SrcRegisterExtSwz.ExtSwizzleX,
- source->SrcRegisterExtSwz.ExtSwizzleY,
- source->SrcRegisterExtSwz.ExtSwizzleZ,
- source->SrcRegisterExtSwz.ExtSwizzleW);
- }
- else {
- src = swizzle(src,
- source->SrcRegister.SwizzleX,
- source->SrcRegister.SwizzleY,
- source->SrcRegister.SwizzleZ,
- source->SrcRegister.SwizzleW);
- }
-
-
- /* There's both negate-all-components and per-component negation.
- * Try to handle both here.
- */
- {
- int nx = source->SrcRegisterExtSwz.NegateX;
- int ny = source->SrcRegisterExtSwz.NegateY;
- int nz = source->SrcRegisterExtSwz.NegateZ;
- int nw = source->SrcRegisterExtSwz.NegateW;
- if (source->SrcRegister.Negate) {
- nx = !nx;
- ny = !ny;
- nz = !nz;
- nw = !nw;
- }
- src = negate(src, nx, ny, nz, nw);
- }
-
- /* no abs() or post-abs negation */
-#if 0
- /* XXX assertions disabled to allow arbfplight.c to run */
- /* XXX enable these assertions, or fix things */
- assert(!source->SrcRegisterExtMod.Absolute);
- assert(!source->SrcRegisterExtMod.Negate);
-#endif
- return src;
-}
-
-
-/**
- * Construct a ureg for a destination register.
- */
-static uint
-get_result_vector(struct i915_fp_compile *p,
- const struct tgsi_full_dst_register *dest)
-{
- switch (dest->DstRegister.File) {
- case TGSI_FILE_OUTPUT:
- {
- uint sem_name = p->output_semantic_name[dest->DstRegister.Index];
- switch (sem_name) {
- case TGSI_SEMANTIC_POSITION:
- return UREG(REG_TYPE_OD, 0);
- case TGSI_SEMANTIC_COLOR:
- return UREG(REG_TYPE_OC, 0);
- default:
- i915_program_error(p, "Bad inst->DstReg.Index/semantics");
- return 0;
- }
- }
- case TGSI_FILE_TEMPORARY:
- return UREG(REG_TYPE_R, dest->DstRegister.Index);
- default:
- i915_program_error(p, "Bad inst->DstReg.File");
- return 0;
- }
-}
-
-
-/**
- * Compute flags for saturation and writemask.
- */
-static uint
-get_result_flags(const struct tgsi_full_instruction *inst)
-{
- const uint writeMask
- = inst->FullDstRegisters[0].DstRegister.WriteMask;
- uint flags = 0x0;
-
- if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE)
- flags |= A0_DEST_SATURATE;
-
- if (writeMask & TGSI_WRITEMASK_X)
- flags |= A0_DEST_CHANNEL_X;
- if (writeMask & TGSI_WRITEMASK_Y)
- flags |= A0_DEST_CHANNEL_Y;
- if (writeMask & TGSI_WRITEMASK_Z)
- flags |= A0_DEST_CHANNEL_Z;
- if (writeMask & TGSI_WRITEMASK_W)
- flags |= A0_DEST_CHANNEL_W;
-
- return flags;
-}
-
-
-/**
- * Convert TGSI_TEXTURE_x token to DO_SAMPLE_TYPE_x token
- */
-static uint
-translate_tex_src_target(struct i915_fp_compile *p, uint tex)
-{
- switch (tex) {
- case TGSI_TEXTURE_1D:
- return D0_SAMPLE_TYPE_2D;
- case TGSI_TEXTURE_2D:
- return D0_SAMPLE_TYPE_2D;
- case TGSI_TEXTURE_RECT:
- return D0_SAMPLE_TYPE_2D;
- case TGSI_TEXTURE_3D:
- return D0_SAMPLE_TYPE_VOLUME;
- case TGSI_TEXTURE_CUBE:
- return D0_SAMPLE_TYPE_CUBE;
- default:
- i915_program_error(p, "TexSrc type");
- return 0;
- }
-}
-
-
-/**
- * Generate texel lookup instruction.
- */
-static void
-emit_tex(struct i915_fp_compile *p,
- const struct tgsi_full_instruction *inst,
- uint opcode)
-{
- uint texture = inst->InstructionExtTexture.Texture;
- uint unit = inst->FullSrcRegisters[1].SrcRegister.Index;
- uint tex = translate_tex_src_target( p, texture );
- uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex);
- uint coord = src_vector( p, &inst->FullSrcRegisters[0]);
-
- i915_emit_texld( p,
- get_result_vector( p, &inst->FullDstRegisters[0] ),
- get_result_flags( inst ),
- sampler,
- coord,
- opcode);
-}
-
-
-/**
- * Generate a simple arithmetic instruction
- * \param opcode the i915 opcode
- * \param numArgs the number of input/src arguments
- */
-static void
-emit_simple_arith(struct i915_fp_compile *p,
- const struct tgsi_full_instruction *inst,
- uint opcode, uint numArgs)
-{
- uint arg1, arg2, arg3;
-
- assert(numArgs <= 3);
-
- arg1 = (numArgs < 1) ? 0 : src_vector( p, &inst->FullSrcRegisters[0] );
- arg2 = (numArgs < 2) ? 0 : src_vector( p, &inst->FullSrcRegisters[1] );
- arg3 = (numArgs < 3) ? 0 : src_vector( p, &inst->FullSrcRegisters[2] );
-
- i915_emit_arith( p,
- opcode,
- get_result_vector( p, &inst->FullDstRegisters[0]),
- get_result_flags( inst ), 0,
- arg1,
- arg2,
- arg3 );
-}
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-/*
- * Translate TGSI instruction to i915 instruction.
- *
- * Possible concerns:
- *
- * SIN, COS -- could use another taylor step?
- * LIT -- results seem a little different to sw mesa
- * LOG -- different to mesa on negative numbers, but this is conformant.
- */
-static void
-i915_translate_instruction(struct i915_fp_compile *p,
- const struct tgsi_full_instruction *inst)
-{
- uint writemask;
- uint src0, src1, src2, flags;
- uint tmp = 0;
-
- switch (inst->Instruction.Opcode) {
- case TGSI_OPCODE_ABS:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- i915_emit_arith(p,
- A0_MAX,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- src0, negate(src0, 1, 1, 1, 1), 0);
- break;
-
- case TGSI_OPCODE_ADD:
- emit_simple_arith(p, inst, A0_ADD, 2);
- break;
-
- case TGSI_OPCODE_CMP:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
- src2 = src_vector(p, &inst->FullSrcRegisters[2]);
- i915_emit_arith(p, A0_CMP,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst),
- 0, src0, src2, src1); /* NOTE: order of src2, src1 */
- break;
-
- case TGSI_OPCODE_COS:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0);
-
- i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1
- * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * result = DP4 t0, cos_constants
- */
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X, X, ONE, ONE),
- swizzle(tmp, X, ONE, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X, Y, X, ONE),
- swizzle(tmp, X, X, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X, X, Z, ONE),
- swizzle(tmp, Z, ONE, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_DP4,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(tmp, ONE, Z, Y, X),
- i915_emit_const4fv(p, cos_constants), 0);
- break;
-
- case TGSI_OPCODE_DP3:
- emit_simple_arith(p, inst, A0_DP3, 2);
- break;
-
- case TGSI_OPCODE_DP4:
- emit_simple_arith(p, inst, A0_DP4, 2);
- break;
-
- case TGSI_OPCODE_DPH:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
-
- i915_emit_arith(p,
- A0_DP4,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, X, Y, Z, ONE), src1, 0);
- break;
-
- case TGSI_OPCODE_DST:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
-
- /* result[0] = 1 * 1;
- * result[1] = a[1] * b[1];
- * result[2] = a[2] * 1;
- * result[3] = 1 * b[3];
- */
- i915_emit_arith(p,
- A0_MUL,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, ONE, Y, Z, ONE),
- swizzle(src1, ONE, Y, ONE, W), 0);
- break;
-
- case TGSI_OPCODE_END:
- /* no-op */
- break;
-
- case TGSI_OPCODE_EX2:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
-
- i915_emit_arith(p,
- A0_EXP,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, X, X, X, X), 0, 0);
- break;
-
- case TGSI_OPCODE_FLR:
- emit_simple_arith(p, inst, A0_FLR, 1);
- break;
-
- case TGSI_OPCODE_FRC:
- emit_simple_arith(p, inst, A0_FRC, 1);
- break;
-
- case TGSI_OPCODE_KIL:
- /* unconditional kill */
- assert(0); /* not tested yet */
-#if 0
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- i915_emit_texld(p, tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
- 0, src0, T0_TEXKILL);
-#endif
- break;
-
- case TGSI_OPCODE_KILP:
- /* kill if src[0].x < 0 || src[0].y < 0 ... */
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- i915_emit_texld(p, tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
- 0, src0, T0_TEXKILL);
- break;
-
- case TGSI_OPCODE_LG2:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
-
- i915_emit_arith(p,
- A0_LOG,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, X, X, X, X), 0, 0);
- break;
-
- case TGSI_OPCODE_LIT:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- /* tmp = max( a.xyzw, a.00zw )
- * XXX: Clamp tmp.w to -128..128
- * tmp.y = log(tmp.y)
- * tmp.y = tmp.w * tmp.y
- * tmp.y = exp(tmp.y)
- * result = cmp (a.11-x1, a.1x01, a.1xy1 )
- */
- i915_emit_arith(p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0,
- src0, swizzle(src0, ZERO, ZERO, Z, W), 0);
-
- i915_emit_arith(p, A0_LOG, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0);
-
- i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, ZERO, Y, ZERO, ZERO),
- swizzle(tmp, ZERO, W, ZERO, ZERO), 0);
-
- i915_emit_arith(p, A0_EXP, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0);
-
- i915_emit_arith(p, A0_CMP,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- negate(swizzle(tmp, ONE, ONE, X, ONE), 0, 0, 1, 0),
- swizzle(tmp, ONE, X, ZERO, ONE),
- swizzle(tmp, ONE, X, Y, ONE));
-
- break;
-
- case TGSI_OPCODE_LRP:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
- src2 = src_vector(p, &inst->FullSrcRegisters[2]);
- flags = get_result_flags(inst);
- tmp = i915_get_utemp(p);
-
- /* b*a + c*(1-a)
- *
- * b*a + c - ca
- *
- * tmp = b*a + c,
- * result = (-c)*a + tmp
- */
- i915_emit_arith(p, A0_MAD, tmp,
- flags & A0_DEST_CHANNEL_ALL, 0, src1, src0, src2);
-
- i915_emit_arith(p, A0_MAD,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- flags, 0, negate(src2, 1, 1, 1, 1), src0, tmp);
- break;
-
- case TGSI_OPCODE_MAD:
- emit_simple_arith(p, inst, A0_MAD, 3);
- break;
-
- case TGSI_OPCODE_MAX:
- emit_simple_arith(p, inst, A0_MAX, 2);
- break;
-
- case TGSI_OPCODE_MIN:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
- tmp = i915_get_utemp(p);
- flags = get_result_flags(inst);
-
- i915_emit_arith(p,
- A0_MAX,
- tmp, flags & A0_DEST_CHANNEL_ALL, 0,
- negate(src0, 1, 1, 1, 1),
- negate(src1, 1, 1, 1, 1), 0);
-
- i915_emit_arith(p,
- A0_MOV,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- flags, 0, negate(tmp, 1, 1, 1, 1), 0, 0);
- break;
-
- case TGSI_OPCODE_MOV:
- /* aka TGSI_OPCODE_SWZ */
- emit_simple_arith(p, inst, A0_MOV, 1);
- break;
-
- case TGSI_OPCODE_MUL:
- emit_simple_arith(p, inst, A0_MUL, 2);
- break;
-
- case TGSI_OPCODE_POW:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
- tmp = i915_get_utemp(p);
- flags = get_result_flags(inst);
-
- /* XXX: masking on intermediate values, here and elsewhere.
- */
- i915_emit_arith(p,
- A0_LOG,
- tmp, A0_DEST_CHANNEL_X, 0,
- swizzle(src0, X, X, X, X), 0, 0);
-
- i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, tmp, src1, 0);
-
- i915_emit_arith(p,
- A0_EXP,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- flags, 0, swizzle(tmp, X, X, X, X), 0, 0);
- break;
-
- case TGSI_OPCODE_RET:
- /* XXX: no-op? */
- break;
-
- case TGSI_OPCODE_RCP:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
-
- i915_emit_arith(p,
- A0_RCP,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, X, X, X, X), 0, 0);
- break;
-
- case TGSI_OPCODE_RSQ:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
-
- i915_emit_arith(p,
- A0_RSQ,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, X, X, X, X), 0, 0);
- break;
-
- case TGSI_OPCODE_SCS:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * scs.x = DP4 t1, sin_constants
- * t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * scs.y = DP4 t1, cos_constants
- */
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(src0, X, X, ONE, ONE),
- swizzle(src0, X, ONE, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X, Y, X, Y),
- swizzle(tmp, X, X, ONE, ONE), 0);
-
- writemask = inst->FullDstRegisters[0].DstRegister.WriteMask;
-
- if (writemask & TGSI_WRITEMASK_Y) {
- uint tmp1;
-
- if (writemask & TGSI_WRITEMASK_X)
- tmp1 = i915_get_utemp(p);
- else
- tmp1 = tmp;
-
- i915_emit_arith(p,
- A0_MUL,
- tmp1, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X, Y, Y, W),
- swizzle(tmp, X, Z, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_DP4,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp1, W, Z, Y, X),
- i915_emit_const4fv(p, sin_constants), 0);
- }
-
- if (writemask & TGSI_WRITEMASK_X) {
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X, X, Z, ONE),
- swizzle(tmp, Z, ONE, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_DP4,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- A0_DEST_CHANNEL_X, 0,
- swizzle(tmp, ONE, Z, Y, X),
- i915_emit_const4fv(p, cos_constants), 0);
- }
- break;
-
- case TGSI_OPCODE_SGE:
- emit_simple_arith(p, inst, A0_SGE, 2);
- break;
-
- case TGSI_OPCODE_SIN:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- tmp = i915_get_utemp(p);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0);
-
- i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * result = DP4 t1.wzyx, sin_constants
- */
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X, X, ONE, ONE),
- swizzle(tmp, X, ONE, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X, Y, X, Y),
- swizzle(tmp, X, X, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X, Y, Y, W),
- swizzle(tmp, X, Z, ONE, ONE), 0);
-
- i915_emit_arith(p,
- A0_DP4,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(tmp, W, Z, Y, X),
- i915_emit_const4fv(p, sin_constants), 0);
- break;
-
- case TGSI_OPCODE_SLT:
- emit_simple_arith(p, inst, A0_SLT, 2);
- break;
-
- case TGSI_OPCODE_SUB:
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
-
- i915_emit_arith(p,
- A0_ADD,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- src0, negate(src1, 1, 1, 1, 1), 0);
- break;
-
- case TGSI_OPCODE_TEX:
- if (inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide
- == TGSI_EXTSWIZZLE_W) {
- emit_tex(p, inst, T0_TEXLDP);
- }
- else {
- emit_tex(p, inst, T0_TEXLD);
- }
- break;
-
- case TGSI_OPCODE_TXB:
- emit_tex(p, inst, T0_TEXLDB);
- break;
-
- case TGSI_OPCODE_XPD:
- /* Cross product:
- * result.x = src0.y * src1.z - src0.z * src1.y;
- * result.y = src0.z * src1.x - src0.x * src1.z;
- * result.z = src0.x * src1.y - src0.y * src1.x;
- * result.w = undef;
- */
- src0 = src_vector(p, &inst->FullSrcRegisters[0]);
- src1 = src_vector(p, &inst->FullSrcRegisters[1]);
- tmp = i915_get_utemp(p);
-
- i915_emit_arith(p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(src0, Z, X, Y, ONE),
- swizzle(src1, Y, Z, X, ONE), 0);
-
- i915_emit_arith(p,
- A0_MAD,
- get_result_vector(p, &inst->FullDstRegisters[0]),
- get_result_flags(inst), 0,
- swizzle(src0, Y, Z, X, ONE),
- swizzle(src1, Z, X, Y, ONE),
- negate(tmp, 1, 1, 1, 0));
- break;
-
- default:
- i915_program_error(p, "bad opcode %d", inst->Instruction.Opcode);
- return;
- }
-
- i915_release_utemps(p);
-}
-
-
-/**
- * Translate TGSI fragment shader into i915 hardware instructions.
- * \param p the translation state
- * \param tokens the TGSI token array
- */
-static void
-i915_translate_instructions(struct i915_fp_compile *p,
- const struct tgsi_token *tokens)
-{
- struct tgsi_parse_context parse;
-
- tgsi_parse_init( &parse, tokens );
-
- while( !tgsi_parse_end_of_tokens( &parse ) ) {
-
- tgsi_parse_token( &parse );
-
- switch( parse.FullToken.Token.Type ) {
- case TGSI_TOKEN_TYPE_DECLARATION:
- if (parse.FullToken.FullDeclaration.Declaration.File
- == TGSI_FILE_INPUT) {
- /* save input register info for use in src_vector() */
- uint ind, sem, semi;
- ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
- sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
- semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
- /*debug_printf("FS Input DECL [%u] sem %u\n", ind, sem);*/
- p->input_semantic_name[ind] = sem;
- p->input_semantic_index[ind] = semi;
- }
- else if (parse.FullToken.FullDeclaration.Declaration.File
- == TGSI_FILE_OUTPUT) {
- /* save output register info for use in get_result_vector() */
- uint ind, sem, semi;
- ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
- sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
- semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
- /*debug_printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
- p->output_semantic_name[ind] = sem;
- p->output_semantic_index[ind] = semi;
- }
- break;
-
- case TGSI_TOKEN_TYPE_IMMEDIATE:
- /* XXX append the immediate to the const buffer... */
- break;
-
- case TGSI_TOKEN_TYPE_INSTRUCTION:
- i915_translate_instruction(p, &parse.FullToken.FullInstruction);
- break;
-
- default:
- assert( 0 );
- }
-
- } /* while */
-
- tgsi_parse_free (&parse);
-}
-
-
-static struct i915_fp_compile *
-i915_init_compile(struct i915_context *i915,
- const struct pipe_shader_state *fs)
-{
- struct i915_fp_compile *p = CALLOC_STRUCT(i915_fp_compile);
-
- p->shader = i915->fs;
-
- p->vertex_info = &i915->current.vertex_info;
-
- /* new constants found during translation get appended after the
- * user-provided constants.
- */
- p->constants = i915->current.constants[PIPE_SHADER_FRAGMENT];
- p->num_constants = i915->current.num_user_constants[PIPE_SHADER_FRAGMENT];
-
- p->nr_tex_indirect = 1; /* correct? */
- p->nr_tex_insn = 0;
- p->nr_alu_insn = 0;
- p->nr_decl_insn = 0;
-
- memset(p->constant_flags, 0, sizeof(p->constant_flags));
-
- p->csr = p->program;
- p->decl = p->declarations;
- p->decl_s = 0;
- p->decl_t = 0;
- p->temp_flag = 0xffff000;
- p->utemp_flag = ~0x7;
-
- p->wpos_tex = -1;
-
- /* initialize the first program word */
- *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM;
-
- return p;
-}
-
-
-/* Copy compile results to the fragment program struct and destroy the
- * compilation context.
- */
-static void
-i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
-{
- unsigned long program_size = (unsigned long) (p->csr - p->program);
- unsigned long decl_size = (unsigned long) (p->decl - p->declarations);
-
- if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
- i915_program_error(p, "Exceeded max nr indirect texture lookups");
-
- if (p->nr_tex_insn > I915_MAX_TEX_INSN)
- i915_program_error(p, "Exceeded max TEX instructions");
-
- if (p->nr_alu_insn > I915_MAX_ALU_INSN)
- i915_program_error(p, "Exceeded max ALU instructions");
-
- if (p->nr_decl_insn > I915_MAX_DECL_INSN)
- i915_program_error(p, "Exceeded max DECL instructions");
-
- /* free old program, if present */
- if (i915->current.program) {
- FREE(i915->current.program);
- i915->current.program_len = 0;
- }
-
- if (p->error) {
- p->NumNativeInstructions = 0;
- p->NumNativeAluInstructions = 0;
- p->NumNativeTexInstructions = 0;
- p->NumNativeTexIndirections = 0;
-
- i915_use_passthrough_shader(i915);
- }
- else {
- p->NumNativeInstructions
- = p->nr_alu_insn + p->nr_tex_insn + p->nr_decl_insn;
- p->NumNativeAluInstructions = p->nr_alu_insn;
- p->NumNativeTexInstructions = p->nr_tex_insn;
- p->NumNativeTexIndirections = p->nr_tex_indirect;
-
- /* patch in the program length */
- p->declarations[0] |= program_size + decl_size - 2;
-
- /* Copy compilation results to fragment program struct:
- */
- i915->current.program
- = (uint *) MALLOC((program_size + decl_size) * sizeof(uint));
- if (i915->current.program) {
- i915->current.program_len = program_size + decl_size;
-
- memcpy(i915->current.program,
- p->declarations,
- decl_size * sizeof(uint));
-
- memcpy(i915->current.program + decl_size,
- p->program,
- program_size * sizeof(uint));
- }
-
- /* update number of constants */
- i915->current.num_constants[PIPE_SHADER_FRAGMENT] = p->num_constants;
- assert(i915->current.num_constants[PIPE_SHADER_FRAGMENT]
- >= i915->current.num_user_constants[PIPE_SHADER_FRAGMENT]);
- }
-
- /* Release the compilation struct:
- */
- FREE(p);
-}
-
-
-/**
- * Find an unused texture coordinate slot to use for fragment WPOS.
- * Update p->fp->wpos_tex with the result (-1 if no used texcoord slot is found).
- */
-static void
-i915_find_wpos_space(struct i915_fp_compile *p)
-{
-#if 0
- const uint inputs
- = p->shader->inputs_read | (1 << TGSI_ATTRIB_POS); /*XXX hack*/
- uint i;
-
- p->wpos_tex = -1;
-
- if (inputs & (1 << TGSI_ATTRIB_POS)) {
- for (i = 0; i < I915_TEX_UNITS; i++) {
- if ((inputs & (1 << (TGSI_ATTRIB_TEX0 + i))) == 0) {
- p->wpos_tex = i;
- return;
- }
- }
-
- i915_program_error(p, "No free texcoord for wpos value");
- }
-#else
- if (p->shader->input_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
- /* frag shader using the fragment position input */
-#if 0
- assert(0);
-#endif
- }
-#endif
-}
-
-
-
-
-/**
- * Rather than trying to intercept and jiggle depth writes during
- * emit, just move the value into its correct position at the end of
- * the program:
- */
-static void
-i915_fixup_depth_write(struct i915_fp_compile *p)
-{
- /* XXX assuming pos/depth is always in output[0] */
- if (p->shader->output_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
- const uint depth = UREG(REG_TYPE_OD, 0);
-
- i915_emit_arith(p,
- A0_MOV, /* opcode */
- depth, /* dest reg */
- A0_DEST_CHANNEL_W, /* write mask */
- 0, /* saturate? */
- swizzle(depth, X, Y, Z, Z), /* src0 */
- 0, 0 /* src1, src2 */);
- }
-}
-
-
-void
-i915_translate_fragment_program( struct i915_context *i915 )
-{
- struct i915_fp_compile *p = i915_init_compile(i915, i915->fs);
- const struct tgsi_token *tokens = i915->fs->tokens;
-
- i915_find_wpos_space(p);
-
- i915_translate_instructions(p, tokens);
- i915_fixup_depth_write(p);
-
- i915_fini_compile(i915, p);
-}
diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/mesa/pipe/i915simple/i915_prim_emit.c
deleted file mode 100644
index c4a706c37d8..00000000000
--- a/src/mesa/pipe/i915simple/i915_prim_emit.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "pipe/draw/draw_private.h"
-#include "pipe/p_util.h"
-
-#include "i915_context.h"
-#include "i915_winsys.h"
-#include "i915_reg.h"
-#include "i915_state.h"
-#include "i915_batch.h"
-
-
-
-/**
- * Primitive emit to hardware. No support for vertex buffers or any
- * nice fast paths.
- */
-struct setup_stage {
- struct draw_stage stage; /**< This must be first (base class) */
-
- struct i915_context *i915;
-};
-
-
-
-/**
- * Basically a cast wrapper.
- */
-static INLINE struct setup_stage *setup_stage( struct draw_stage *stage )
-{
- return (struct setup_stage *)stage;
-}
-
-
-/**
- * Extract the needed fields from vertex_header and emit i915 dwords.
- * Recall that the vertices are constructed by the 'draw' module and
- * have a couple of slots at the beginning (1-dword header, 4-dword
- * clip pos) that we ignore here.
- */
-static INLINE void
-emit_hw_vertex( struct i915_context *i915,
- const struct vertex_header *vertex)
-{
- const struct vertex_info *vinfo = &i915->current.vertex_info;
- uint i;
- uint count = 0; /* for debug/sanity */
-
- for (i = 0; i < vinfo->num_attribs; i++) {
- switch (vinfo->emit[i]) {
- case EMIT_OMIT:
- /* no-op */
- break;
- case EMIT_1F:
- OUT_BATCH( fui(vertex->data[i][0]) );
- count++;
- break;
- case EMIT_2F:
- OUT_BATCH( fui(vertex->data[i][0]) );
- OUT_BATCH( fui(vertex->data[i][1]) );
- count += 2;
- break;
- case EMIT_3F:
- OUT_BATCH( fui(vertex->data[i][0]) );
- OUT_BATCH( fui(vertex->data[i][1]) );
- OUT_BATCH( fui(vertex->data[i][2]) );
- count += 3;
- break;
- case EMIT_4F:
- OUT_BATCH( fui(vertex->data[i][0]) );
- OUT_BATCH( fui(vertex->data[i][1]) );
- OUT_BATCH( fui(vertex->data[i][2]) );
- OUT_BATCH( fui(vertex->data[i][3]) );
- count += 4;
- break;
- case EMIT_4UB:
- OUT_BATCH( pack_ub4(float_to_ubyte( vertex->data[i][2] ),
- float_to_ubyte( vertex->data[i][1] ),
- float_to_ubyte( vertex->data[i][0] ),
- float_to_ubyte( vertex->data[i][3] )) );
- count += 1;
- break;
- default:
- assert(0);
- }
- }
- assert(count == vinfo->size);
-}
-
-
-
-static INLINE void
-emit_prim( struct draw_stage *stage,
- struct prim_header *prim,
- unsigned hwprim,
- unsigned nr )
-{
- struct i915_context *i915 = setup_stage(stage)->i915;
- unsigned vertex_size = i915->current.vertex_info.size * 4; /* in bytes */
- unsigned i;
-
- assert(vertex_size >= 12); /* never smaller than 12 bytes */
-
- if (i915->dirty)
- i915_update_derived( i915 );
-
- if (i915->hardware_dirty)
- i915_emit_hardware_state( i915 );
-
- if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
- FLUSH_BATCH();
-
- /* Make sure state is re-emitted after a flush:
- */
- i915_update_derived( i915 );
- i915_emit_hardware_state( i915 );
-
- if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
- assert(0);
- return;
- }
- }
-
- /* Emit each triangle as a single primitive. I told you this was
- * simple.
- */
- OUT_BATCH(_3DPRIMITIVE |
- hwprim |
- ((4 + vertex_size * nr)/4 - 2));
-
- for (i = 0; i < nr; i++)
- emit_hw_vertex(i915, prim->v[i]);
-}
-
-
-static void
-setup_tri( struct draw_stage *stage, struct prim_header *prim )
-{
- emit_prim( stage, prim, PRIM3D_TRILIST, 3 );
-}
-
-
-static void
-setup_line(struct draw_stage *stage, struct prim_header *prim)
-{
- emit_prim( stage, prim, PRIM3D_LINELIST, 2 );
-}
-
-
-static void
-setup_point(struct draw_stage *stage, struct prim_header *prim)
-{
- emit_prim( stage, prim, PRIM3D_POINTLIST, 1 );
-}
-
-
-static void setup_flush( struct draw_stage *stage, unsigned flags )
-{
-}
-
-static void reset_stipple_counter( struct draw_stage *stage )
-{
-}
-
-static void render_destroy( struct draw_stage *stage )
-{
- FREE( stage );
-}
-
-
-/**
- * Create a new primitive setup/render stage. This gets plugged into
- * the 'draw' module's pipeline.
- */
-struct draw_stage *i915_draw_render_stage( struct i915_context *i915 )
-{
- struct setup_stage *setup = CALLOC_STRUCT(setup_stage);
-
- setup->i915 = i915;
- setup->stage.draw = i915->draw;
- setup->stage.point = setup_point;
- setup->stage.line = setup_line;
- setup->stage.tri = setup_tri;
- setup->stage.flush = setup_flush;
- setup->stage.reset_stipple_counter = reset_stipple_counter;
- setup->stage.destroy = render_destroy;
-
- return &setup->stage;
-}
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
deleted file mode 100644
index e069773fd4e..00000000000
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * \file
- * Build post-transformation, post-clipping vertex buffers and element
- * lists by hooking into the end of the primitive pipeline and
- * manipulating the vertex_id field in the vertex headers.
- *
- * XXX: work in progress
- *
- * \author José Fonseca <[email protected]>
- * \author Keith Whitwell <[email protected]>
- */
-
-
-#include "pipe/draw/draw_vbuf.h"
-#include "pipe/p_debug.h"
-#include "pipe/p_util.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-#include "i915_winsys.h"
-#include "i915_batch.h"
-#include "i915_state.h"
-
-
-/**
- * Primitive renderer for i915.
- */
-struct i915_vbuf_render {
- struct vbuf_render base;
-
- struct i915_context *i915;
-
- /** Vertex size in bytes */
- unsigned vertex_size;
-
- /** Hardware primitive */
- unsigned hwprim;
-};
-
-
-/**
- * Basically a cast wrapper.
- */
-static INLINE struct i915_vbuf_render *
-i915_vbuf_render( struct vbuf_render *render )
-{
- assert(render);
- return (struct i915_vbuf_render *)render;
-}
-
-
-static const struct vertex_info *
-i915_vbuf_render_get_vertex_info( struct vbuf_render *render )
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- struct i915_context *i915 = i915_render->i915;
- return &i915->current.vertex_info;
-}
-
-
-static void *
-i915_vbuf_render_allocate_vertices( struct vbuf_render *render,
- ushort vertex_size,
- ushort nr_vertices )
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- struct i915_context *i915 = i915_render->i915;
- struct pipe_winsys *winsys = i915->pipe.winsys;
- size_t size = (size_t)vertex_size * (size_t)nr_vertices;
-
- /* FIXME: handle failure */
- assert(!i915->vbo);
- i915->vbo = winsys->buffer_create(winsys, 64, I915_BUFFER_USAGE_LIT_VERTEX,
- size);
-
- i915->dirty |= I915_NEW_VBO;
-
- return winsys->buffer_map(winsys,
- i915->vbo,
- PIPE_BUFFER_USAGE_CPU_WRITE);
-}
-
-
-static void
-i915_vbuf_render_set_primitive( struct vbuf_render *render,
- unsigned prim )
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
-
- switch(prim) {
- case PIPE_PRIM_POINTS:
- i915_render->hwprim = PRIM3D_POINTLIST;
- break;
- case PIPE_PRIM_LINES:
- i915_render->hwprim = PRIM3D_LINELIST;
- break;
- case PIPE_PRIM_TRIANGLES:
- i915_render->hwprim = PRIM3D_TRILIST;
- break;
- default:
- assert(0);
- }
-}
-
-
-static void
-i915_vbuf_render_draw( struct vbuf_render *render,
- const ushort *indices,
- uint nr_indices)
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- struct i915_context *i915 = i915_render->i915;
- unsigned i;
-
- assert(nr_indices);
-
- assert((i915->dirty & ~I915_NEW_VBO) == 0);
-
- if (i915->dirty)
- i915_update_derived( i915 );
-
- if (i915->hardware_dirty)
- i915_emit_hardware_state( i915 );
-
- if (!BEGIN_BATCH( 1 + (nr_indices + 1)/2, 1 )) {
- FLUSH_BATCH();
-
- /* Make sure state is re-emitted after a flush:
- */
- i915_update_derived( i915 );
- i915_emit_hardware_state( i915 );
-
- if (!BEGIN_BATCH( 1 + (nr_indices + 1)/2, 1 )) {
- assert(0);
- return;
- }
- }
-
- OUT_BATCH( _3DPRIMITIVE |
- PRIM_INDIRECT |
- i915_render->hwprim |
- PRIM_INDIRECT_ELTS |
- nr_indices );
- for (i = 0; i + 1 < nr_indices; i += 2) {
- OUT_BATCH( indices[i] |
- (indices[i + 1] << 16) );
- }
- if (i < nr_indices) {
- OUT_BATCH( indices[i] );
- }
-}
-
-
-static void
-i915_vbuf_render_release_vertices( struct vbuf_render *render,
- void *vertices,
- unsigned vertex_size,
- unsigned vertices_used )
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- struct i915_context *i915 = i915_render->i915;
- struct pipe_winsys *winsys = i915->pipe.winsys;
-
- assert(i915->vbo);
- winsys->buffer_unmap(winsys, i915->vbo);
- pipe_buffer_reference(winsys, &i915->vbo, NULL);
-}
-
-
-static void
-i915_vbuf_render_destroy( struct vbuf_render *render )
-{
- struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- FREE(i915_render);
-}
-
-
-/**
- * Create a new primitive render.
- */
-static struct vbuf_render *
-i915_vbuf_render_create( struct i915_context *i915 )
-{
- struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render);
-
- i915_render->i915 = i915;
-
- i915_render->base.max_vertex_buffer_bytes = 128*1024;
-
- /* NOTE: it must be such that state and vertices indices fit in a single
- * batch buffer.
- */
- i915_render->base.max_indices = 16*1024;
-
- i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info;
- i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices;
- i915_render->base.set_primitive = i915_vbuf_render_set_primitive;
- i915_render->base.draw = i915_vbuf_render_draw;
- i915_render->base.release_vertices = i915_vbuf_render_release_vertices;
- i915_render->base.destroy = i915_vbuf_render_destroy;
-
- return &i915_render->base;
-}
-
-
-/**
- * Create a new primitive vbuf/render stage.
- */
-struct draw_stage *i915_draw_vbuf_stage( struct i915_context *i915 )
-{
- struct vbuf_render *render;
- struct draw_stage *stage;
-
- render = i915_vbuf_render_create(i915);
- if(!render)
- return NULL;
-
- stage = draw_vbuf_stage( i915->draw, render );
- if(!stage) {
- render->destroy(render);
- return NULL;
- }
-
- return stage;
-}
diff --git a/src/mesa/pipe/i915simple/i915_reg.h b/src/mesa/pipe/i915simple/i915_reg.h
deleted file mode 100644
index 04620fec681..00000000000
--- a/src/mesa/pipe/i915simple/i915_reg.h
+++ /dev/null
@@ -1,978 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef I915_REG_H
-#define I915_REG_H
-
-
-#define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define CMD_3D (0x3<<29)
-
-#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_CLEAR_RECT (0xa<<18)
-#define PRIM3D_ZONE_INIT (0xd<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-/* p137 */
-#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24))
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-
-/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/
-#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8<<24))
-#define BFO_ENABLE_STENCIL_REF (1<<23)
-#define BFO_STENCIL_REF_SHIFT 15
-#define BFO_STENCIL_REF_MASK (0xff<<15)
-#define BFO_ENABLE_STENCIL_FUNCS (1<<14)
-#define BFO_STENCIL_TEST_SHIFT 11
-#define BFO_STENCIL_TEST_MASK (0x7<<11)
-#define BFO_STENCIL_FAIL_SHIFT 8
-#define BFO_STENCIL_FAIL_MASK (0x7<<8)
-#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5
-#define BFO_STENCIL_PASS_Z_FAIL_MASK (0x7<<5)
-#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2
-#define BFO_STENCIL_PASS_Z_PASS_MASK (0x7<<2)
-#define BFO_ENABLE_STENCIL_TWO_SIDE (1<<1)
-#define BFO_STENCIL_TWO_SIDE (1<<0)
-
-
-/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */
-#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9<<24))
-#define BFM_ENABLE_STENCIL_TEST_MASK (1<<17)
-#define BFM_ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define BFM_STENCIL_TEST_MASK_SHIFT 8
-#define BFM_STENCIL_TEST_MASK_MASK (0xff<<8)
-#define BFM_STENCIL_WRITE_MASK_SHIFT 0
-#define BFM_STENCIL_WRITE_MASK_MASK (0xff<<0)
-
-
-
-/* 3DSTATE_BIN_CONTROL p141 */
-
-/* p143 */
-#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) (((x)/4)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-
-/* 3DSTATE_CHROMA_KEY */
-
-/* 3DSTATE_CLEAR_PARAMETERS, p150 */
-#define _3DSTATE_CLEAR_PARAMETERS (CMD_3D | (0x1d<<24) | (0x9c<<16) | 5)
-/* Dword 1 */
-#define CLEARPARAM_CLEAR_RECT (1 << 16)
-#define CLEARPARAM_ZONE_INIT (0 << 16)
-#define CLEARPARAM_WRITE_COLOR (1 << 2)
-#define CLEARPARAM_WRITE_DEPTH (1 << 1)
-#define CLEARPARAM_WRITE_STENCIL (1 << 0)
-
-/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */
-#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-
-
-/* 3DSTATE_COORD_SET_BINDINGS, p154 */
-#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16<<24))
-#define CSB_TCB(iunit, eunit) ((eunit)<<(iunit*3))
-
-/* p156 */
-#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-/* p157 */
-#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-/* p158 */
-#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-
-/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */
-#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d<<24) | (0x97<<16))
-/* scale in dword 1 */
-
-
-/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
-#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2)
-
-/* p161 */
-#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define TEX_DEFAULT_COLOR_OGL (0<<30)
-#define TEX_DEFAULT_COLOR_D3D (1<<30)
-#define ZR_EARLY_DEPTH (1<<29)
-#define LOD_PRECLAMP_OGL (1<<28)
-#define LOD_PRECLAMP_D3D (0<<28)
-#define DITHER_FULL_ALWAYS (0<<26)
-#define DITHER_FULL_ON_FB_BLEND (1<<26)
-#define DITHER_CLAMPED_ALWAYS (2<<26)
-#define LINEAR_GAMMA_BLEND_32BPP (1<<25)
-#define DEBUG_DISABLE_ENH_DITHER (1<<24)
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLOR_BUF_8BIT 0
-#define COLOR_BUF_RGB555 (1<<8)
-#define COLOR_BUF_RGB565 (2<<8)
-#define COLOR_BUF_ARGB8888 (3<<8)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 (0<<1)
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-/* p166 */
-#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-
-/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */
-
-/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */
-
-
-/* _3DSTATE_FOG_COLOR, p173 */
-#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* _3DSTATE_FOG_MODE, p174 */
-#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FMC1_FOGFUNC_MODIFY_ENABLE (1<<31)
-#define FMC1_FOGFUNC_VERTEX (0<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP (1<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FMC1_FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FMC1_FOGFUNC_MASK (3<<28)
-#define FMC1_FOGINDEX_MODIFY_ENABLE (1<<27)
-#define FMC1_FOGINDEX_Z (0<<25)
-#define FMC1_FOGINDEX_W (1<<25)
-#define FMC1_C1_C2_MODIFY_ENABLE (1<<24)
-#define FMC1_DENSITY_MODIFY_ENABLE (1<<23)
-#define FMC1_C1_ONE (1<<13)
-#define FMC1_C1_MASK (0xffff<<4)
-/* Dword 2 */
-#define FMC2_C2_ONE (1<<16)
-/* Dword 3 */
-#define FMC3_D_ONE (1<<16)
-
-
-
-/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */
-#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define IAB_MODIFY_ENABLE (1<<23)
-#define IAB_ENABLE (1<<22)
-#define IAB_MODIFY_FUNC (1<<21)
-#define IAB_FUNC_SHIFT 16
-#define IAB_MODIFY_SRC_FACTOR (1<<11)
-#define IAB_SRC_FACTOR_SHIFT 6
-#define IAB_SRC_FACTOR_MASK (BLENDFACT_MASK<<6)
-#define IAB_MODIFY_DST_FACTOR (1<<5)
-#define IAB_DST_FACTOR_SHIFT 0
-#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0)
-
-
-#define BLENDFUNC_ADD 0x0
-#define BLENDFUNC_SUBTRACT 0x1
-#define BLENDFUNC_REVERSE_SUBTRACT 0x2
-#define BLENDFUNC_MIN 0x3
-#define BLENDFUNC_MAX 0x4
-#define BLENDFUNC_MASK 0x7
-
-/* 3DSTATE_LOAD_INDIRECT, p180 */
-
-#define _3DSTATE_LOAD_INDIRECT (CMD_3D|(0x1d<<24)|(0x7<<16))
-#define LI0_STATE_STATIC_INDIRECT (0x01<<8)
-#define LI0_STATE_DYNAMIC_INDIRECT (0x02<<8)
-#define LI0_STATE_SAMPLER (0x04<<8)
-#define LI0_STATE_MAP (0x08<<8)
-#define LI0_STATE_PROGRAM (0x10<<8)
-#define LI0_STATE_CONSTANTS (0x20<<8)
-
-#define SIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SIS0_FORCE_LOAD (1<<1)
-#define SIS0_BUFFER_VALID (1<<0)
-#define SIS1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define DIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define DIS0_BUFFER_RESET (1<<1)
-#define DIS0_BUFFER_VALID (1<<0)
-
-#define SSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SSB0_FORCE_LOAD (1<<1)
-#define SSB0_BUFFER_VALID (1<<0)
-#define SSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define MSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define MSB0_FORCE_LOAD (1<<1)
-#define MSB0_BUFFER_VALID (1<<0)
-#define MSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSP0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSP0_FORCE_LOAD (1<<1)
-#define PSP0_BUFFER_VALID (1<<0)
-#define PSP1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSC0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSC0_FORCE_LOAD (1<<1)
-#define PSC0_BUFFER_VALID (1<<0)
-#define PSC1_BUFFER_LENGTH(x) ((x)&0xff)
-
-
-
-
-
-/* _3DSTATE_RASTERIZATION_RULES */
-#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_TEXKILL_3D_4D (1<<10)
-#define TEXKILL_3D (0<<9)
-#define TEXKILL_4D (1<<9)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-
-/* _3DSTATE_SCISSOR_ENABLE, p256 */
-#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */
-#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* p189 */
-#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 ((0x3<<29)|(0x1d<<24)|(0x04<<16))
-#define I1_LOAD_S(n) (1<<(4+n))
-
-#define S0_VB_OFFSET_MASK 0xffffffc
-#define S0_AUTO_CACHE_INV_DISABLE (1<<0)
-
-#define S1_VERTEX_WIDTH_SHIFT 24
-#define S1_VERTEX_WIDTH_MASK (0x3f<<24)
-#define S1_VERTEX_PITCH_SHIFT 16
-#define S1_VERTEX_PITCH_MASK (0x3f<<16)
-
-#define TEXCOORDFMT_2D 0x0
-#define TEXCOORDFMT_3D 0x1
-#define TEXCOORDFMT_4D 0x2
-#define TEXCOORDFMT_1D 0x3
-#define TEXCOORDFMT_2D_16 0x4
-#define TEXCOORDFMT_4D_16 0x5
-#define TEXCOORDFMT_NOT_PRESENT 0xf
-#define S2_TEXCOORD_FMT0_MASK 0xf
-#define S2_TEXCOORD_FMT1_SHIFT 4
-#define S2_TEXCOORD_FMT(unit, type) ((type)<<(unit*4))
-#define S2_TEXCOORD_NONE (~0)
-
-/* S3 not interesting */
-
-#define S4_POINT_WIDTH_SHIFT 23
-#define S4_POINT_WIDTH_MASK (0x1ff<<23)
-#define S4_LINE_WIDTH_SHIFT 19
-#define S4_LINE_WIDTH_ONE (0x2<<19)
-#define S4_LINE_WIDTH_MASK (0xf<<19)
-#define S4_FLATSHADE_ALPHA (1<<18)
-#define S4_FLATSHADE_FOG (1<<17)
-#define S4_FLATSHADE_SPECULAR (1<<16)
-#define S4_FLATSHADE_COLOR (1<<15)
-#define S4_CULLMODE_BOTH (0<<13)
-#define S4_CULLMODE_NONE (1<<13)
-#define S4_CULLMODE_CW (2<<13)
-#define S4_CULLMODE_CCW (3<<13)
-#define S4_CULLMODE_MASK (3<<13)
-#define S4_VFMT_POINT_WIDTH (1<<12)
-#define S4_VFMT_SPEC_FOG (1<<11)
-#define S4_VFMT_COLOR (1<<10)
-#define S4_VFMT_DEPTH_OFFSET (1<<9)
-#define S4_VFMT_XYZ (1<<6)
-#define S4_VFMT_XYZW (2<<6)
-#define S4_VFMT_XY (3<<6)
-#define S4_VFMT_XYW (4<<6)
-#define S4_VFMT_XYZW_MASK (7<<6)
-#define S4_FORCE_DEFAULT_DIFFUSE (1<<5)
-#define S4_FORCE_DEFAULT_SPECULAR (1<<4)
-#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1<<3)
-#define S4_VFMT_FOG_PARAM (1<<2)
-#define S4_SPRITE_POINT_ENABLE (1<<1)
-#define S4_LINE_ANTIALIAS_ENABLE (1<<0)
-
-#define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH | \
- S4_VFMT_SPEC_FOG | \
- S4_VFMT_COLOR | \
- S4_VFMT_DEPTH_OFFSET | \
- S4_VFMT_XYZW_MASK | \
- S4_VFMT_FOG_PARAM)
-
-
-#define S5_WRITEDISABLE_ALPHA (1<<31)
-#define S5_WRITEDISABLE_RED (1<<30)
-#define S5_WRITEDISABLE_GREEN (1<<29)
-#define S5_WRITEDISABLE_BLUE (1<<28)
-#define S5_WRITEDISABLE_MASK (0xf<<28)
-#define S5_FORCE_DEFAULT_POINT_SIZE (1<<27)
-#define S5_LAST_PIXEL_ENABLE (1<<26)
-#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1<<25)
-#define S5_FOG_ENABLE (1<<24)
-#define S5_STENCIL_REF_SHIFT 16
-#define S5_STENCIL_REF_MASK (0xff<<16)
-#define S5_STENCIL_TEST_FUNC_SHIFT 13
-#define S5_STENCIL_TEST_FUNC_MASK (0x7<<13)
-#define S5_STENCIL_FAIL_SHIFT 10
-#define S5_STENCIL_FAIL_MASK (0x7<<10)
-#define S5_STENCIL_PASS_Z_FAIL_SHIFT 7
-#define S5_STENCIL_PASS_Z_FAIL_MASK (0x7<<7)
-#define S5_STENCIL_PASS_Z_PASS_SHIFT 4
-#define S5_STENCIL_PASS_Z_PASS_MASK (0x7<<4)
-#define S5_STENCIL_WRITE_ENABLE (1<<3)
-#define S5_STENCIL_TEST_ENABLE (1<<2)
-#define S5_COLOR_DITHER_ENABLE (1<<1)
-#define S5_LOGICOP_ENABLE (1<<0)
-
-
-#define S6_ALPHA_TEST_ENABLE (1<<31)
-#define S6_ALPHA_TEST_FUNC_SHIFT 28
-#define S6_ALPHA_TEST_FUNC_MASK (0x7<<28)
-#define S6_ALPHA_REF_SHIFT 20
-#define S6_ALPHA_REF_MASK (0xff<<20)
-#define S6_DEPTH_TEST_ENABLE (1<<19)
-#define S6_DEPTH_TEST_FUNC_SHIFT 16
-#define S6_DEPTH_TEST_FUNC_MASK (0x7<<16)
-#define S6_CBUF_BLEND_ENABLE (1<<15)
-#define S6_CBUF_BLEND_FUNC_SHIFT 12
-#define S6_CBUF_BLEND_FUNC_MASK (0x7<<12)
-#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8
-#define S6_CBUF_SRC_BLEND_FACT_MASK (0xf<<8)
-#define S6_CBUF_DST_BLEND_FACT_SHIFT 4
-#define S6_CBUF_DST_BLEND_FACT_MASK (0xf<<4)
-#define S6_DEPTH_WRITE_ENABLE (1<<3)
-#define S6_COLOR_WRITE_ENABLE (1<<2)
-#define S6_TRISTRIP_PV_SHIFT 0
-#define S6_TRISTRIP_PV_MASK (0x3<<0)
-
-#define S7_DEPTH_OFFSET_CONST_MASK ~0
-
-
-
-#define DST_BLND_FACT(f) ((f)<<S6_CBUF_DST_BLEND_FACT_SHIFT)
-#define SRC_BLND_FACT(f) ((f)<<S6_CBUF_SRC_BLEND_FACT_SHIFT)
-#define DST_ABLND_FACT(f) ((f)<<IAB_DST_FACTOR_SHIFT)
-#define SRC_ABLND_FACT(f) ((f)<<IAB_SRC_FACTOR_SHIFT)
-
-
-
-
-/* 3DSTATE_MAP_DEINTERLACER_PARAMETERS */
-
-/* 3DSTATE_MAP_PALETTE_LOAD_32, p206 */
-#define _3DSTATE_MAP_PALETTE_LOAD_32 (CMD_3D|(0x1d<<24)|(0x8f<<16))
-/* subsequent dwords up to length (max 16) are ARGB8888 color values */
-
-/* _3DSTATE_MODES_4, p218 */
-#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x0d<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK (0xf<<18)
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) (((x)&0xff)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) ((x)&0xff)
-
-/* _3DSTATE_MODES_5, p220 */
-#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define PIPELINE_FLUSH_RENDER_CACHE (1<<18)
-#define PIPELINE_FLUSH_TEXTURE_CACHE (1<<16)
-
-
-/* p221 */
-#define _3DSTATE_PIXEL_SHADER_CONSTANTS (CMD_3D|(0x1d<<24)|(0x6<<16))
-#define PS1_REG(n) (1<<(n))
-#define PS2_CONST_X(n) (n)
-#define PS3_CONST_Y(n) (n)
-#define PS4_CONST_Z(n) (n)
-#define PS5_CONST_W(n) (n)
-
-/* p222 */
-
-
-#define I915_MAX_TEX_INDIRECT 4
-#define I915_MAX_TEX_INSN 32
-#define I915_MAX_ALU_INSN 64
-#define I915_MAX_DECL_INSN 27
-#define I915_MAX_TEMPORARY 16
-
-
-/* Each instruction is 3 dwords long, though most don't require all
- * this space. Maximum of 123 instructions. Smaller maxes per insn
- * type.
- */
-#define _3DSTATE_PIXEL_SHADER_PROGRAM (CMD_3D|(0x1d<<24)|(0x5<<16))
-
-#define REG_TYPE_R 0 /* temporary regs, no need to
- * dcl, must be written before
- * read -- Preserved between
- * phases.
- */
-#define REG_TYPE_T 1 /* Interpolated values, must be
- * dcl'ed before use.
- *
- * 0..7: texture coord,
- * 8: diffuse spec,
- * 9: specular color,
- * 10: fog parameter in w.
- */
-#define REG_TYPE_CONST 2 /* Restriction: only one const
- * can be referenced per
- * instruction, though it may be
- * selected for multiple inputs.
- * Constants not initialized
- * default to zero.
- */
-#define REG_TYPE_S 3 /* sampler */
-#define REG_TYPE_OC 4 /* output color (rgba) */
-#define REG_TYPE_OD 5 /* output depth (w), xyz are
- * temporaries. If not written,
- * interpolated depth is used?
- */
-#define REG_TYPE_U 6 /* unpreserved temporaries */
-#define REG_TYPE_MASK 0x7
-#define REG_NR_MASK 0xf
-
-
-/* REG_TYPE_T:
- */
-#define T_TEX0 0
-#define T_TEX1 1
-#define T_TEX2 2
-#define T_TEX3 3
-#define T_TEX4 4
-#define T_TEX5 5
-#define T_TEX6 6
-#define T_TEX7 7
-#define T_DIFFUSE 8
-#define T_SPECULAR 9
-#define T_FOG_W 10 /* interpolated fog is in W coord */
-
-/* Arithmetic instructions */
-
-/* .replicate_swizzle == selection and replication of a particular
- * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww
- */
-#define A0_NOP (0x0<<24) /* no operation */
-#define A0_ADD (0x1<<24) /* dst = src0 + src1 */
-#define A0_MOV (0x2<<24) /* dst = src0 */
-#define A0_MUL (0x3<<24) /* dst = src0 * src1 */
-#define A0_MAD (0x4<<24) /* dst = src0 * src1 + src2 */
-#define A0_DP2ADD (0x5<<24) /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
-#define A0_DP3 (0x6<<24) /* dst.xyzw = src0.xyz dot src1.xyz */
-#define A0_DP4 (0x7<<24) /* dst.xyzw = src0.xyzw dot src1.xyzw */
-#define A0_FRC (0x8<<24) /* dst = src0 - floor(src0) */
-#define A0_RCP (0x9<<24) /* dst.xyzw = 1/(src0.replicate_swizzle) */
-#define A0_RSQ (0xa<<24) /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
-#define A0_EXP (0xb<<24) /* dst.xyzw = exp2(src0.replicate_swizzle) */
-#define A0_LOG (0xc<<24) /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
-#define A0_CMP (0xd<<24) /* dst = (src0 >= 0.0) ? src1 : src2 */
-#define A0_MIN (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */
-#define A0_MAX (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */
-#define A0_FLR (0x10<<24) /* dst = floor(src0) */
-#define A0_MOD (0x11<<24) /* dst = src0 fmod 1.0 */
-#define A0_TRC (0x12<<24) /* dst = int(src0) */
-#define A0_SGE (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */
-#define A0_SLT (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */
-#define A0_DEST_SATURATE (1<<22)
-#define A0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-#define A0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define A0_DEST_CHANNEL_X (1<<10)
-#define A0_DEST_CHANNEL_Y (2<<10)
-#define A0_DEST_CHANNEL_Z (4<<10)
-#define A0_DEST_CHANNEL_W (8<<10)
-#define A0_DEST_CHANNEL_ALL (0xf<<10)
-#define A0_DEST_CHANNEL_SHIFT 10
-#define A0_SRC0_TYPE_SHIFT 7
-#define A0_SRC0_NR_SHIFT 2
-
-#define A0_DEST_CHANNEL_XY (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y)
-#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z)
-
-
-#define SRC_X 0
-#define SRC_Y 1
-#define SRC_Z 2
-#define SRC_W 3
-#define SRC_ZERO 4
-#define SRC_ONE 5
-
-#define A1_SRC0_CHANNEL_X_NEGATE (1<<31)
-#define A1_SRC0_CHANNEL_X_SHIFT 28
-#define A1_SRC0_CHANNEL_Y_NEGATE (1<<27)
-#define A1_SRC0_CHANNEL_Y_SHIFT 24
-#define A1_SRC0_CHANNEL_Z_NEGATE (1<<23)
-#define A1_SRC0_CHANNEL_Z_SHIFT 20
-#define A1_SRC0_CHANNEL_W_NEGATE (1<<19)
-#define A1_SRC0_CHANNEL_W_SHIFT 16
-#define A1_SRC1_TYPE_SHIFT 13
-#define A1_SRC1_NR_SHIFT 8
-#define A1_SRC1_CHANNEL_X_NEGATE (1<<7)
-#define A1_SRC1_CHANNEL_X_SHIFT 4
-#define A1_SRC1_CHANNEL_Y_NEGATE (1<<3)
-#define A1_SRC1_CHANNEL_Y_SHIFT 0
-
-#define A2_SRC1_CHANNEL_Z_NEGATE (1<<31)
-#define A2_SRC1_CHANNEL_Z_SHIFT 28
-#define A2_SRC1_CHANNEL_W_NEGATE (1<<27)
-#define A2_SRC1_CHANNEL_W_SHIFT 24
-#define A2_SRC2_TYPE_SHIFT 21
-#define A2_SRC2_NR_SHIFT 16
-#define A2_SRC2_CHANNEL_X_NEGATE (1<<15)
-#define A2_SRC2_CHANNEL_X_SHIFT 12
-#define A2_SRC2_CHANNEL_Y_NEGATE (1<<11)
-#define A2_SRC2_CHANNEL_Y_SHIFT 8
-#define A2_SRC2_CHANNEL_Z_NEGATE (1<<7)
-#define A2_SRC2_CHANNEL_Z_SHIFT 4
-#define A2_SRC2_CHANNEL_W_NEGATE (1<<3)
-#define A2_SRC2_CHANNEL_W_SHIFT 0
-
-
-
-/* Texture instructions */
-#define T0_TEXLD (0x15<<24) /* Sample texture using predeclared
- * sampler and address, and output
- * filtered texel data to destination
- * register */
-#define T0_TEXLDP (0x16<<24) /* Same as texld but performs a
- * perspective divide of the texture
- * coordinate .xyz values by .w before
- * sampling. */
-#define T0_TEXLDB (0x17<<24) /* Same as texld but biases the
- * computed LOD by w. Only S4.6 two's
- * comp is used. This implies that a
- * float to fixed conversion is
- * done. */
-#define T0_TEXKILL (0x18<<24) /* Does not perform a sampling
- * operation. Simply kills the pixel
- * if any channel of the address
- * register is < 0.0. */
-#define T0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-/* Note: U (unpreserved) regs do not retain their values between
- * phases (cannot be used for feedback)
- *
- * Note: oC and OD registers can only be used as the destination of a
- * texture instruction once per phase (this is an implementation
- * restriction).
- */
-#define T0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */
-#define T0_SAMPLER_NR_MASK (0xf<<0)
-
-#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */
-/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
-#define T1_ADDRESS_REG_NR_SHIFT 17
-#define T2_MBZ 0
-
-/* Declaration instructions */
-#define D0_DCL (0x19<<24) /* Declare a t (interpolated attrib)
- * register or an s (sampler)
- * register. */
-#define D0_SAMPLE_TYPE_SHIFT 22
-#define D0_SAMPLE_TYPE_2D (0x0<<22)
-#define D0_SAMPLE_TYPE_CUBE (0x1<<22)
-#define D0_SAMPLE_TYPE_VOLUME (0x2<<22)
-#define D0_SAMPLE_TYPE_MASK (0x3<<22)
-
-#define D0_TYPE_SHIFT 19
-/* Allow: T, S */
-#define D0_NR_SHIFT 14
-/* Allow T: 0..10, S: 0..15 */
-#define D0_CHANNEL_X (1<<10)
-#define D0_CHANNEL_Y (2<<10)
-#define D0_CHANNEL_Z (4<<10)
-#define D0_CHANNEL_W (8<<10)
-#define D0_CHANNEL_ALL (0xf<<10)
-#define D0_CHANNEL_NONE (0<<10)
-
-#define D0_CHANNEL_XY (D0_CHANNEL_X|D0_CHANNEL_Y)
-#define D0_CHANNEL_XYZ (D0_CHANNEL_XY|D0_CHANNEL_Z)
-
-/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
- * or specular declarations.
- *
- * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw)
- *
- * Must be zero for S (sampler) dcls
- */
-#define D1_MBZ 0
-#define D2_MBZ 0
-
-
-
-/* p207 */
-#define _3DSTATE_MAP_STATE (CMD_3D|(0x1d<<24)|(0x0<<16))
-
-#define MS1_MAPMASK_SHIFT 0
-#define MS1_MAPMASK_MASK (0x8fff<<0)
-
-#define MS2_UNTRUSTED_SURFACE (1<<31)
-#define MS2_ADDRESS_MASK 0xfffffffc
-#define MS2_VERTICAL_LINE_STRIDE (1<<1)
-#define MS2_VERTICAL_OFFSET (1<<1)
-
-#define MS3_HEIGHT_SHIFT 21
-#define MS3_WIDTH_SHIFT 10
-#define MS3_PALETTE_SELECT (1<<9)
-#define MS3_MAPSURF_FORMAT_SHIFT 7
-#define MS3_MAPSURF_FORMAT_MASK (0x7<<7)
-#define MAPSURF_8BIT (1<<7)
-#define MAPSURF_16BIT (2<<7)
-#define MAPSURF_32BIT (3<<7)
-#define MAPSURF_422 (5<<7)
-#define MAPSURF_COMPRESSED (6<<7)
-#define MAPSURF_4BIT_INDEXED (7<<7)
-#define MS3_MT_FORMAT_MASK (0x7 << 3)
-#define MS3_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_8BIT_A8 (4<<3)
-#define MT_8BIT_MONO8 (5<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_I16 (7<<3)
-#define MT_16BIT_L16 (8<<3)
-#define MT_16BIT_A16 (9<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_XRGB8888 (2<<3)
-#define MT_32BIT_XBGR8888 (3<<3)
-#define MT_32BIT_QWVU8888 (4<<3)
-#define MT_32BIT_AXVU8888 (5<<3)
-#define MT_32BIT_LXVU8888 (6<<3)
-#define MT_32BIT_XLVU8888 (7<<3)
-#define MT_32BIT_ARGB2101010 (8<<3)
-#define MT_32BIT_ABGR2101010 (9<<3)
-#define MT_32BIT_AWVU2101010 (0xA<<3)
-#define MT_32BIT_GR1616 (0xB<<3)
-#define MT_32BIT_VU1616 (0xC<<3)
-#define MT_32BIT_xI824 (0xD<<3)
-#define MT_32BIT_xA824 (0xE<<3)
-#define MT_32BIT_xL824 (0xF<<3)
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define MT_COMPRESS_DXT1_RGB (4<<3)
-#define MS3_USE_FENCE_REGS (1<<2)
-#define MS3_TILED_SURFACE (1<<1)
-#define MS3_TILE_WALK (1<<0)
-
-#define MS4_PITCH_SHIFT 21
-#define MS4_CUBE_FACE_ENA_NEGX (1<<20)
-#define MS4_CUBE_FACE_ENA_POSX (1<<19)
-#define MS4_CUBE_FACE_ENA_NEGY (1<<18)
-#define MS4_CUBE_FACE_ENA_POSY (1<<17)
-#define MS4_CUBE_FACE_ENA_NEGZ (1<<16)
-#define MS4_CUBE_FACE_ENA_POSZ (1<<15)
-#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15)
-#define MS4_MAX_LOD_SHIFT 9
-#define MS4_MAX_LOD_MASK (0x3f<<9)
-#define MS4_MIP_LAYOUT_LEGACY (0<<8)
-#define MS4_MIP_LAYOUT_BELOW_LPT (0<<8)
-#define MS4_MIP_LAYOUT_RIGHT_LPT (1<<8)
-#define MS4_VOLUME_DEPTH_SHIFT 0
-#define MS4_VOLUME_DEPTH_MASK (0xff<<0)
-
-/* p244 */
-#define _3DSTATE_SAMPLER_STATE (CMD_3D|(0x1d<<24)|(0x1<<16))
-
-#define SS1_MAPMASK_SHIFT 0
-#define SS1_MAPMASK_MASK (0x8fff<<0)
-
-#define SS2_REVERSE_GAMMA_ENABLE (1<<31)
-#define SS2_PACKED_TO_PLANAR_ENABLE (1<<30)
-#define SS2_COLORSPACE_CONVERSION (1<<29)
-#define SS2_CHROMAKEY_SHIFT 27
-#define SS2_BASE_MIP_LEVEL_SHIFT 22
-#define SS2_BASE_MIP_LEVEL_MASK (0x1f<<22)
-#define SS2_MIP_FILTER_SHIFT 20
-#define SS2_MIP_FILTER_MASK (0x3<<20)
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define SS2_MAG_FILTER_SHIFT 17
-#define SS2_MAG_FILTER_MASK (0x7<<17)
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-#define FILTER_4X4_1 3
-#define FILTER_4X4_2 4
-#define FILTER_4X4_FLAT 5
-#define FILTER_6X5_MONO 6 /* XXX - check */
-#define SS2_MIN_FILTER_SHIFT 14
-#define SS2_MIN_FILTER_MASK (0x7<<14)
-#define SS2_LOD_BIAS_SHIFT 5
-#define SS2_LOD_BIAS_ONE (0x10<<5)
-#define SS2_LOD_BIAS_MASK (0x1ff<<5)
-/* Shadow requires:
- * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
- * FILTER_4X4_x MIN and MAG filters
- */
-#define SS2_SHADOW_ENABLE (1<<4)
-#define SS2_MAX_ANISO_MASK (1<<3)
-#define SS2_MAX_ANISO_2 (0<<3)
-#define SS2_MAX_ANISO_4 (1<<3)
-#define SS2_SHADOW_FUNC_SHIFT 0
-#define SS2_SHADOW_FUNC_MASK (0x7<<0)
-/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
-
-#define SS3_MIN_LOD_SHIFT 24
-#define SS3_MIN_LOD_ONE (0x10<<24)
-#define SS3_MIN_LOD_MASK (0xff<<24)
-#define SS3_KILL_PIXEL_ENABLE (1<<17)
-#define SS3_TCX_ADDR_MODE_SHIFT 12
-#define SS3_TCX_ADDR_MODE_MASK (0x7<<12)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP_EDGE 2
-#define TEXCOORDMODE_CUBE 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORDMODE_MIRROR_ONCE 5
-#define SS3_TCY_ADDR_MODE_SHIFT 9
-#define SS3_TCY_ADDR_MODE_MASK (0x7<<9)
-#define SS3_TCZ_ADDR_MODE_SHIFT 6
-#define SS3_TCZ_ADDR_MODE_MASK (0x7<<6)
-#define SS3_NORMALIZED_COORDS (1<<5)
-#define SS3_TEXTUREMAP_INDEX_SHIFT 1
-#define SS3_TEXTUREMAP_INDEX_MASK (0xf<<1)
-#define SS3_DEINTERLACER_ENABLE (1<<0)
-
-#define SS4_BORDER_COLOR_MASK (~0)
-
-/* 3DSTATE_SPAN_STIPPLE, p258
- */
-#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-#define _3DSTATE_DEFAULT_Z ((0x3<<29)|(0x1d<<24)|(0x98<<16))
-#define _3DSTATE_DEFAULT_DIFFUSE ((0x3<<29)|(0x1d<<24)|(0x99<<16))
-#define _3DSTATE_DEFAULT_SPECULAR ((0x3<<29)|(0x1d<<24)|(0x9a<<16))
-
-
-#define MI_FLUSH ((0<<29)|(4<<23))
-#define FLUSH_MAP_CACHE (1<<0)
-#define INHIBIT_FLUSH_RENDER_CACHE (1<<2)
-
-
-#define CMD_3D (0x3<<29)
-
-
-#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24))
-#define PRIM_INDIRECT (1<<23)
-#define PRIM_INLINE (0<<23)
-#define PRIM_INDIRECT_SEQUENTIAL (0<<17)
-#define PRIM_INDIRECT_ELTS (1<<17)
-
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-#define I915PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define I915PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define I915PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define I915PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-
-
-#define BR00_BITBLT_CLIENT 0x40000000
-#define BR00_OP_COLOR_BLT 0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR13_SOLID_PATTERN 0x80000000
-
-#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4)
-#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
-#define XY_COLOR_BLT_WRITE_RGB (1<<20)
-
-#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
-#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
-#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
-
-#define MI_WAIT_FOR_EVENT ((0x3<<23))
-#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
-#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
-
-#define MI_BATCH_BUFFER (0x30<<23)
-#define MI_BATCH_BUFFER_START (0x31<<23)
-#define MI_BATCH_BUFFER_END (0xa<<23)
-
-
-
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#define BLENDFACT_MASK 0x0f
-
-#define PCI_CHIP_I915_G 0x2582
-#define PCI_CHIP_I915_GM 0x2592
-#define PCI_CHIP_I945_G 0x2772
-#define PCI_CHIP_I945_GM 0x27A2
-#define PCI_CHIP_I945_GME 0x27AE
-#define PCI_CHIP_G33_G 0x29C2
-#define PCI_CHIP_Q35_G 0x29B2
-#define PCI_CHIP_Q33_G 0x29D2
-
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
deleted file mode 100644
index abd5571b885..00000000000
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Authors: Keith Whitwell <[email protected]>
- */
-
-
-#include "pipe/draw/draw_context.h"
-#include "pipe/p_winsys.h"
-#include "pipe/p_util.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-#include "i915_state.h"
-#include "i915_state_inlines.h"
-
-
-/* The i915 (and related graphics cores) do not support GL_CLAMP. The
- * Intel drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- */
-static unsigned
-translate_wrap_mode(unsigned wrap)
-{
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- return TEXCOORDMODE_WRAP;
- case PIPE_TEX_WRAP_CLAMP:
- return TEXCOORDMODE_CLAMP_EDGE; /* not quite correct */
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- return TEXCOORDMODE_CLAMP_EDGE;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- return TEXCOORDMODE_CLAMP_BORDER;
-// case PIPE_TEX_WRAP_MIRRORED_REPEAT:
-// return TEXCOORDMODE_MIRROR;
- default:
- return TEXCOORDMODE_WRAP;
- }
-}
-
-static unsigned translate_img_filter( unsigned filter )
-{
- switch (filter) {
- case PIPE_TEX_FILTER_NEAREST:
- return FILTER_NEAREST;
- case PIPE_TEX_FILTER_LINEAR:
- return FILTER_LINEAR;
- default:
- assert(0);
- return FILTER_NEAREST;
- }
-}
-
-static unsigned translate_mip_filter( unsigned filter )
-{
- switch (filter) {
- case PIPE_TEX_MIPFILTER_NONE:
- return MIPFILTER_NONE;
- case PIPE_TEX_MIPFILTER_NEAREST:
- return MIPFILTER_NEAREST;
- case PIPE_TEX_FILTER_LINEAR:
- return MIPFILTER_LINEAR;
- default:
- assert(0);
- return MIPFILTER_NONE;
- }
-}
-
-
-/* None of this state is actually used for anything yet.
- */
-static void *
-i915_create_blend_state(struct pipe_context *pipe,
- const struct pipe_blend_state *blend)
-{
- struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state );
-
- {
- unsigned eqRGB = blend->rgb_func;
- unsigned srcRGB = blend->rgb_src_factor;
- unsigned dstRGB = blend->rgb_dst_factor;
-
- unsigned eqA = blend->alpha_func;
- unsigned srcA = blend->alpha_src_factor;
- unsigned dstA = blend->alpha_dst_factor;
-
- /* Special handling for MIN/MAX filter modes handled at
- * state_tracker level.
- */
-
- if (srcA != srcRGB ||
- dstA != dstRGB ||
- eqA != eqRGB) {
-
- cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |
- IAB_MODIFY_ENABLE |
- IAB_ENABLE |
- IAB_MODIFY_FUNC |
- IAB_MODIFY_SRC_FACTOR |
- IAB_MODIFY_DST_FACTOR |
- SRC_ABLND_FACT(i915_translate_blend_factor(srcA)) |
- DST_ABLND_FACT(i915_translate_blend_factor(dstA)) |
- (i915_translate_blend_func(eqA) << IAB_FUNC_SHIFT));
- }
- else {
- cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |
- IAB_MODIFY_ENABLE |
- 0);
- }
- }
-
- cso_data->modes4 |= (_3DSTATE_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(i915_translate_logic_op(blend->logicop_func)));
-
- if (blend->logicop_enable)
- cso_data->LIS5 |= S5_LOGICOP_ENABLE;
-
- if (blend->dither)
- cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE;
-
- if ((blend->colormask & PIPE_MASK_R) == 0)
- cso_data->LIS5 |= S5_WRITEDISABLE_RED;
-
- if ((blend->colormask & PIPE_MASK_G) == 0)
- cso_data->LIS5 |= S5_WRITEDISABLE_GREEN;
-
- if ((blend->colormask & PIPE_MASK_B) == 0)
- cso_data->LIS5 |= S5_WRITEDISABLE_BLUE;
-
- if ((blend->colormask & PIPE_MASK_A) == 0)
- cso_data->LIS5 |= S5_WRITEDISABLE_ALPHA;
-
- if (blend->blend_enable) {
- unsigned funcRGB = blend->rgb_func;
- unsigned srcRGB = blend->rgb_src_factor;
- unsigned dstRGB = blend->rgb_dst_factor;
-
- cso_data->LIS6 |= (S6_CBUF_BLEND_ENABLE |
- SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) |
- DST_BLND_FACT(i915_translate_blend_factor(dstRGB)) |
- (i915_translate_blend_func(funcRGB) << S6_CBUF_BLEND_FUNC_SHIFT));
- }
-
- return cso_data;
-}
-
-static void i915_bind_blend_state(struct pipe_context *pipe,
- void *blend)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->blend = (struct i915_blend_state*)blend;
-
- i915->dirty |= I915_NEW_BLEND;
-}
-
-
-static void i915_delete_blend_state(struct pipe_context *pipe, void *blend)
-{
- FREE(blend);
-}
-
-static void i915_set_blend_color( struct pipe_context *pipe,
- const struct pipe_blend_color *blend_color )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->blend_color = *blend_color;
-
- i915->dirty |= I915_NEW_BLEND;
-}
-
-static void *
-i915_create_sampler_state(struct pipe_context *pipe,
- const struct pipe_sampler_state *sampler)
-{
- struct i915_sampler_state *cso = CALLOC_STRUCT( i915_sampler_state );
- const unsigned ws = sampler->wrap_s;
- const unsigned wt = sampler->wrap_t;
- const unsigned wr = sampler->wrap_r;
- unsigned minFilt, magFilt;
- unsigned mipFilt;
-
- cso->templ = sampler;
-
- mipFilt = translate_mip_filter(sampler->min_mip_filter);
- if (sampler->max_anisotropy > 1.0) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- if (sampler->max_anisotropy > 2.0) {
- cso->state[0] |= SS2_MAX_ANISO_4;
- }
- }
- else {
- minFilt = translate_img_filter( sampler->min_img_filter );
- magFilt = translate_img_filter( sampler->mag_img_filter );
- }
-
- {
- int b = (int) (sampler->lod_bias * 16.0);
- b = CLAMP(b, -256, 255);
- cso->state[0] |= ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK);
- }
-
- /* Shadow:
- */
- if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
- {
- cso->state[0] |= (SS2_SHADOW_ENABLE |
- i915_translate_compare_func(sampler->compare_func));
-
- minFilt = FILTER_4X4_FLAT;
- magFilt = FILTER_4X4_FLAT;
- }
-
- cso->state[0] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
- (mipFilt << SS2_MIP_FILTER_SHIFT) |
- (magFilt << SS2_MAG_FILTER_SHIFT));
-
- cso->state[1] |=
- ((translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT) |
- (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) |
- (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT));
-
- if (sampler->normalized_coords)
- cso->state[1] |= SS3_NORMALIZED_COORDS;
-
- if (0) /* XXX not tested yet */
- {
- int minlod = (int) (16.0 * sampler->min_lod);
- minlod = CLAMP(minlod, 0, 16 * 11);
- cso->state[1] |= (minlod << SS3_MIN_LOD_SHIFT);
- }
-
- {
- ubyte r = float_to_ubyte(sampler->border_color[0]);
- ubyte g = float_to_ubyte(sampler->border_color[1]);
- ubyte b = float_to_ubyte(sampler->border_color[2]);
- ubyte a = float_to_ubyte(sampler->border_color[3]);
- cso->state[2] = I915PACKCOLOR8888(r, g, b, a);
- }
- return cso;
-}
-
-static void i915_bind_sampler_state(struct pipe_context *pipe,
- unsigned unit, void *sampler)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- assert(unit < PIPE_MAX_SAMPLERS);
- i915->sampler[unit] = (const struct i915_sampler_state*)sampler;
-
- i915->dirty |= I915_NEW_SAMPLER;
-}
-
-static void i915_delete_sampler_state(struct pipe_context *pipe,
- void *sampler)
-{
- FREE(sampler);
-}
-
-
-/** XXX move someday? Or consolidate all these simple state setters
- * into one file.
- */
-
-static void *
-i915_create_depth_stencil_state(struct pipe_context *pipe,
- const struct pipe_depth_stencil_alpha_state *depth_stencil)
-{
- struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state );
-
- {
- int testmask = depth_stencil->stencil[0].value_mask & 0xff;
- int writemask = depth_stencil->stencil[0].write_mask & 0xff;
-
- cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(testmask) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(writemask));
- }
-
- if (depth_stencil->stencil[0].enabled) {
- int test = i915_translate_compare_func(depth_stencil->stencil[0].func);
- int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op);
- int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op);
- int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op);
- int ref = depth_stencil->stencil[0].ref_value & 0xff;
-
- cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE |
- (ref << S5_STENCIL_REF_SHIFT) |
- (test << S5_STENCIL_TEST_FUNC_SHIFT) |
- (fop << S5_STENCIL_FAIL_SHIFT) |
- (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
- (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
- }
-
- if (depth_stencil->stencil[1].enabled) {
- int test = i915_translate_compare_func(depth_stencil->stencil[1].func);
- int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op);
- int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
- int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
- int ref = depth_stencil->stencil[1].ref_value & 0xff;
- int tmask = depth_stencil->stencil[1].value_mask & 0xff;
- int wmask = depth_stencil->stencil[1].write_mask & 0xff;
-
- cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
- BFO_ENABLE_STENCIL_FUNCS |
- BFO_ENABLE_STENCIL_TWO_SIDE |
- BFO_ENABLE_STENCIL_REF |
- BFO_STENCIL_TWO_SIDE |
- (ref << BFO_STENCIL_REF_SHIFT) |
- (test << BFO_STENCIL_TEST_SHIFT) |
- (fop << BFO_STENCIL_FAIL_SHIFT) |
- (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) |
- (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT));
-
- cso->bfo[1] = (_3DSTATE_BACKFACE_STENCIL_MASKS |
- BFM_ENABLE_STENCIL_TEST_MASK |
- BFM_ENABLE_STENCIL_WRITE_MASK |
- (tmask << BFM_STENCIL_TEST_MASK_SHIFT) |
- (wmask << BFM_STENCIL_WRITE_MASK_SHIFT));
- }
- else {
- /* This actually disables two-side stencil: The bit set is a
- * modify-enable bit to indicate we are changing the two-side
- * setting. Then there is a symbolic zero to show that we are
- * setting the flag to zero/off.
- */
- cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
- BFO_ENABLE_STENCIL_TWO_SIDE |
- 0);
- cso->bfo[1] = 0;
- }
-
- if (depth_stencil->depth.enabled) {
- int func = i915_translate_compare_func(depth_stencil->depth.func);
-
- cso->depth_LIS6 |= (S6_DEPTH_TEST_ENABLE |
- (func << S6_DEPTH_TEST_FUNC_SHIFT));
-
- if (depth_stencil->depth.writemask)
- cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE;
- }
-
- if (depth_stencil->alpha.enabled) {
- int test = i915_translate_compare_func(depth_stencil->alpha.func);
- ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref);
-
- cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE |
- (test << S6_ALPHA_TEST_FUNC_SHIFT) |
- (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
- }
-
- return cso;
-}
-
-static void i915_bind_depth_stencil_state(struct pipe_context *pipe,
- void *depth_stencil)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil;
-
- i915->dirty |= I915_NEW_DEPTH_STENCIL;
-}
-
-static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
- void *depth_stencil)
-{
- FREE(depth_stencil);
-}
-
-
-static void i915_set_scissor_state( struct pipe_context *pipe,
- const struct pipe_scissor_state *scissor )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- memcpy( &i915->scissor, scissor, sizeof(*scissor) );
- i915->dirty |= I915_NEW_SCISSOR;
-}
-
-
-static void i915_set_polygon_stipple( struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple )
-{
-}
-
-
-static void * i915_create_fs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *templ)
-{
- return 0;
-}
-
-static void i915_bind_fs_state(struct pipe_context *pipe, void *fs)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->fs = (struct pipe_shader_state *)fs;
-
- i915->dirty |= I915_NEW_FS;
-}
-
-static void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
-{
- /*do nothing*/
-}
-
-static void *
-i915_create_vs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *templ)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- /* just pass-through to draw module */
- return draw_create_vertex_shader(i915->draw, templ);
-}
-
-static void i915_bind_vs_state(struct pipe_context *pipe, void *shader)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- /* just pass-through to draw module */
- draw_bind_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader);
-}
-
-static void i915_delete_vs_state(struct pipe_context *pipe, void *shader)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- /* just pass-through to draw module */
- draw_delete_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader);
-}
-
-static void i915_set_constant_buffer(struct pipe_context *pipe,
- uint shader, uint index,
- const struct pipe_constant_buffer *buf)
-{
- struct i915_context *i915 = i915_context(pipe);
- struct pipe_winsys *ws = pipe->winsys;
-
- assert(shader < PIPE_SHADER_TYPES);
- assert(index == 0);
-
- /* Make a copy of shader constants.
- * During fragment program translation we may add additional
- * constants to the array.
- *
- * We want to consider the situation where some user constants
- * (ex: a material color) may change frequently but the shader program
- * stays the same. In that case we should only be updating the first
- * N constants, leaving any extras from shader translation alone.
- */
- {
- void *mapped;
- if (buf->size &&
- (mapped = ws->buffer_map(ws, buf->buffer,
- PIPE_BUFFER_USAGE_CPU_READ))) {
- memcpy(i915->current.constants[shader], mapped, buf->size);
- ws->buffer_unmap(ws, buf->buffer);
- i915->current.num_user_constants[shader]
- = buf->size / (4 * sizeof(float));
- }
- else {
- i915->current.num_user_constants[shader] = 0;
- }
- }
-
- i915->dirty |= I915_NEW_CONSTANTS;
-}
-
-
-static void i915_set_sampler_texture(struct pipe_context *pipe,
- unsigned sampler,
- struct pipe_texture *texture)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->texture[sampler] = (struct i915_texture*)texture; /* ptr, not struct */
-
- i915->dirty |= I915_NEW_TEXTURE;
-}
-
-
-
-static void i915_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->framebuffer = *fb; /* struct copy */
-
- i915->dirty |= I915_NEW_FRAMEBUFFER;
-}
-
-
-
-static void i915_set_clip_state( struct pipe_context *pipe,
- const struct pipe_clip_state *clip )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- draw_set_clip_state(i915->draw, clip);
-
- i915->dirty |= I915_NEW_CLIP;
-}
-
-
-
-/* Called when driver state tracker notices changes to the viewport
- * matrix:
- */
-static void i915_set_viewport_state( struct pipe_context *pipe,
- const struct pipe_viewport_state *viewport )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->viewport = *viewport; /* struct copy */
-
- /* pass the viewport info to the draw module */
- draw_set_viewport_state(i915->draw, &i915->viewport);
-
- i915->dirty |= I915_NEW_VIEWPORT;
-}
-
-
-static void *
-i915_create_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *rasterizer)
-{
- struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state );
-
- cso->templ = rasterizer;
- cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
- cso->light_twoside = rasterizer->light_twoside;
- cso->ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE;
- cso->ds[1].f = rasterizer->offset_scale;
- if (rasterizer->poly_stipple_enable) {
- cso->st |= ST1_ENABLE;
- }
-
- if (rasterizer->scissor)
- cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT;
- else
- cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT;
-
- switch (rasterizer->cull_mode) {
- case PIPE_WINDING_NONE:
- cso->LIS4 |= S4_CULLMODE_NONE;
- break;
- case PIPE_WINDING_CW:
- cso->LIS4 |= S4_CULLMODE_CW;
- break;
- case PIPE_WINDING_CCW:
- cso->LIS4 |= S4_CULLMODE_CCW;
- break;
- case PIPE_WINDING_BOTH:
- cso->LIS4 |= S4_CULLMODE_BOTH;
- break;
- }
-
- {
- int line_width = CLAMP((int)(rasterizer->line_width * 2), 1, 0xf);
-
- cso->LIS4 |= line_width << S4_LINE_WIDTH_SHIFT;
-
- if (rasterizer->line_smooth)
- cso->LIS4 |= S4_LINE_ANTIALIAS_ENABLE;
- }
-
- {
- int point_size = CLAMP((int) rasterizer->point_size, 1, 0xff);
-
- cso->LIS4 |= point_size << S4_POINT_WIDTH_SHIFT;
- }
-
- if (rasterizer->flatshade) {
- cso->LIS4 |= (S4_FLATSHADE_ALPHA |
- S4_FLATSHADE_COLOR |
- S4_FLATSHADE_SPECULAR);
- }
-
- cso->LIS7 = fui( rasterizer->offset_units );
-
-
- return cso;
-}
-
-static void i915_bind_rasterizer_state( struct pipe_context *pipe,
- void *setup )
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->rasterizer = (struct i915_rasterizer_state *)setup;
-
- /* pass-through to draw module */
- draw_set_rasterizer_state(i915->draw, i915->rasterizer->templ);
-
- i915->dirty |= I915_NEW_RASTERIZER;
-}
-
-static void i915_delete_rasterizer_state(struct pipe_context *pipe,
- void *setup)
-{
- FREE(setup);
-}
-
-static void i915_set_vertex_buffer( struct pipe_context *pipe,
- unsigned index,
- const struct pipe_vertex_buffer *buffer )
-{
- struct i915_context *i915 = i915_context(pipe);
- i915->vertex_buffer[index] = *buffer;
- /* pass-through to draw module */
- draw_set_vertex_buffer(i915->draw, index, buffer);
-}
-
-static void i915_set_vertex_element( struct pipe_context *pipe,
- unsigned index,
- const struct pipe_vertex_element *element)
-{
- struct i915_context *i915 = i915_context(pipe);
- /* pass-through to draw module */
- draw_set_vertex_element(i915->draw, index, element);
-}
-
-
-
-void
-i915_init_state_functions( struct i915_context *i915 )
-{
- i915->pipe.create_blend_state = i915_create_blend_state;
- i915->pipe.bind_blend_state = i915_bind_blend_state;
- i915->pipe.delete_blend_state = i915_delete_blend_state;
-
- i915->pipe.create_sampler_state = i915_create_sampler_state;
- i915->pipe.bind_sampler_state = i915_bind_sampler_state;
- i915->pipe.delete_sampler_state = i915_delete_sampler_state;
-
- i915->pipe.create_depth_stencil_alpha_state = i915_create_depth_stencil_state;
- i915->pipe.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state;
- i915->pipe.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state;
-
- i915->pipe.create_rasterizer_state = i915_create_rasterizer_state;
- i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state;
- i915->pipe.delete_rasterizer_state = i915_delete_rasterizer_state;
- i915->pipe.create_fs_state = i915_create_fs_state;
- i915->pipe.bind_fs_state = i915_bind_fs_state;
- i915->pipe.delete_fs_state = i915_delete_fs_state;
- i915->pipe.create_vs_state = i915_create_vs_state;
- i915->pipe.bind_vs_state = i915_bind_vs_state;
- i915->pipe.delete_vs_state = i915_delete_vs_state;
-
- i915->pipe.set_blend_color = i915_set_blend_color;
- i915->pipe.set_clip_state = i915_set_clip_state;
- i915->pipe.set_constant_buffer = i915_set_constant_buffer;
- i915->pipe.set_framebuffer_state = i915_set_framebuffer_state;
-
- i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
- i915->pipe.set_scissor_state = i915_set_scissor_state;
- i915->pipe.set_sampler_texture = i915_set_sampler_texture;
- i915->pipe.set_viewport_state = i915_set_viewport_state;
- i915->pipe.set_vertex_buffer = i915_set_vertex_buffer;
- i915->pipe.set_vertex_element = i915_set_vertex_element;
-}
diff --git a/src/mesa/pipe/i915simple/i915_state.h b/src/mesa/pipe/i915simple/i915_state.h
deleted file mode 100644
index 86c6b0027d5..00000000000
--- a/src/mesa/pipe/i915simple/i915_state.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Authors: Keith Whitwell <[email protected]>
- */
-
-#ifndef I915_STATE_H
-#define I915_STATE_H
-
-struct i915_context;
-
-
-struct i915_tracked_state {
- unsigned dirty;
- void (*update)( struct i915_context * );
-};
-
-void i915_update_immediate( struct i915_context *i915 );
-void i915_update_dynamic( struct i915_context *i915 );
-void i915_update_derived( struct i915_context *i915 );
-void i915_update_samplers( struct i915_context *i915 );
-void i915_update_textures(struct i915_context *i915);
-
-void i915_emit_hardware_state( struct i915_context *i915 );
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
deleted file mode 100644
index 653983e4a99..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "pipe/p_util.h"
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_vertex.h"
-#include "i915_context.h"
-#include "i915_state.h"
-#include "i915_reg.h"
-#include "i915_fpc.h"
-#include "pipe/p_shader_tokens.h"
-
-
-/**
- * Determine which post-transform / pre-rasterization vertex attributes
- * we need.
- * Derived from: fs, setup states.
- */
-static void calculate_vertex_layout( struct i915_context *i915 )
-{
- const struct pipe_shader_state *fs = i915->fs;
- const enum interp_mode colorInterp = i915->rasterizer->color_interp;
- struct vertex_info vinfo;
- uint front0 = 0, back0 = 0, front1 = 0, back1 = 0;
- boolean needW = 0;
- uint i;
- boolean texCoords[8];
- uint src = 0;
-
- memset(texCoords, 0, sizeof(texCoords));
- memset(&vinfo, 0, sizeof(vinfo));
-
- /* pos */
- draw_emit_vertex_attr(&vinfo, EMIT_3F, INTERP_LINEAR, src++);
- /* Note: we'll set the S4_VFMT_XYZ[W] bits below */
-
- for (i = 0; i < fs->num_inputs; i++) {
- switch (fs->input_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- break;
- case TGSI_SEMANTIC_COLOR:
- if (fs->input_semantic_index[i] == 0) {
- front0 = draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src++);
- vinfo.hwfmt[0] |= S4_VFMT_COLOR;
- }
- else {
- assert(fs->input_semantic_index[i] == 1);
- front1 = draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src++);
- vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG;
- }
- break;
- case TGSI_SEMANTIC_GENERIC:
- /* usually a texcoord */
- {
- const uint unit = fs->input_semantic_index[i];
- uint hwtc;
- texCoords[unit] = TRUE;
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src++);
- hwtc = TEXCOORDFMT_4D;
- needW = TRUE;
- vinfo.hwfmt[1] |= hwtc << (unit * 4);
- }
- break;
- case TGSI_SEMANTIC_FOG:
- debug_printf("i915 fogcoord not implemented yet\n");
- draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src++);
- break;
- default:
- assert(0);
- }
-
- }
-
- /* finish up texcoord fields */
- for (i = 0; i < 8; i++) {
- if (!texCoords[i]) {
- const uint hwtc = TEXCOORDFMT_NOT_PRESENT;
- vinfo.hwfmt[1] |= hwtc << (i* 4);
- }
- }
-
- /* go back and fill in the vertex position info now that we have needW */
- if (needW) {
- vinfo.hwfmt[0] |= S4_VFMT_XYZW;
- vinfo.emit[0] = EMIT_4F;
- }
- else {
- vinfo.hwfmt[0] |= S4_VFMT_XYZ;
- vinfo.emit[0] = EMIT_3F;
- }
-
- /* Additional attributes required for setup: Just twosided
- * lighting. Edgeflag is dealt with specially by setting bits in
- * the vertex header.
- */
- if (i915->rasterizer->light_twoside) {
- if (front0) {
- back0 = draw_emit_vertex_attr(&vinfo, EMIT_OMIT, colorInterp, src++);
- }
- if (back0) {
- back1 = draw_emit_vertex_attr(&vinfo, EMIT_OMIT, colorInterp, src++);
- }
- }
-
- draw_compute_vertex_size(&vinfo);
-
- if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) {
- /* Need to set this flag so that the LIS2/4 registers get set.
- * It also means the i915_update_immediate() function must be called
- * after this one, in i915_update_derived().
- */
- i915->dirty |= I915_NEW_VERTEX_FORMAT;
-
- memcpy(&i915->current.vertex_info, &vinfo, sizeof(vinfo));
- }
-}
-
-
-
-
-/* Hopefully this will remain quite simple, otherwise need to pull in
- * something like the state tracker mechanism.
- */
-void i915_update_derived( struct i915_context *i915 )
-{
- if (i915->dirty & (I915_NEW_RASTERIZER | I915_NEW_FS))
- calculate_vertex_layout( i915 );
-
- if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_TEXTURE))
- i915_update_samplers(i915);
-
- if (i915->dirty & I915_NEW_TEXTURE)
- i915_update_textures(i915);
-
- if (i915->dirty)
- i915_update_immediate( i915 );
-
- if (i915->dirty)
- i915_update_dynamic( i915 );
-
- if (i915->dirty & I915_NEW_FS) {
- i915_translate_fragment_program(i915);
- i915->hardware_dirty |= I915_HW_PROGRAM; /* XXX right? */
- }
-
- /* HW emit currently references framebuffer state directly:
- */
- if (i915->dirty & I915_NEW_FRAMEBUFFER)
- i915->hardware_dirty |= I915_HW_STATIC;
-
- i915->dirty = 0;
-}
diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/mesa/pipe/i915simple/i915_state_dynamic.c
deleted file mode 100644
index 8cfbdddd19b..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_dynamic.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "i915_batch.h"
-#include "i915_state_inlines.h"
-#include "i915_context.h"
-#include "i915_reg.h"
-#include "i915_state.h"
-#include "pipe/p_util.h"
-
-#define FILE_DEBUG_FLAG DEBUG_STATE
-
-/* State that we have chosen to store in the DYNAMIC segment of the
- * i915 indirect state mechanism.
- *
- * Can't cache these in the way we do the static state, as there is no
- * start/size in the command packet, instead an 'end' value that gets
- * incremented.
- *
- * Additionally, there seems to be a requirement to re-issue the full
- * (active) state every time a 4kb boundary is crossed.
- */
-
-static INLINE void set_dynamic_indirect( struct i915_context *i915,
- unsigned offset,
- const unsigned *src,
- unsigned dwords )
-{
- unsigned i;
-
- for (i = 0; i < dwords; i++)
- i915->current.dynamic[offset + i] = src[i];
-
- i915->hardware_dirty |= I915_HW_DYNAMIC;
-}
-
-
-/***********************************************************************
- * Modes4: stencil masks and logicop
- */
-static void upload_MODES4( struct i915_context *i915 )
-{
- unsigned modes4 = 0;
-
- /* I915_NEW_STENCIL */
- modes4 |= i915->depth_stencil->stencil_modes4;
- /* I915_NEW_BLEND */
- modes4 |= i915->blend->modes4;
-
- /* Always, so that we know when state is in-active:
- */
- set_dynamic_indirect( i915,
- I915_DYNAMIC_MODES4,
- &modes4,
- 1 );
-}
-
-const struct i915_tracked_state i915_upload_MODES4 = {
- I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
- upload_MODES4
-};
-
-
-
-
-/***********************************************************************
- */
-
-static void upload_BFO( struct i915_context *i915 )
-{
- set_dynamic_indirect( i915,
- I915_DYNAMIC_BFO_0,
- &(i915->depth_stencil->bfo[0]),
- 2 );
-}
-
-const struct i915_tracked_state i915_upload_BFO = {
- I915_NEW_DEPTH_STENCIL,
- upload_BFO
-};
-
-
-/***********************************************************************
- */
-
-
-static void upload_BLENDCOLOR( struct i915_context *i915 )
-{
- unsigned bc[2];
-
- memset( bc, 0, sizeof(bc) );
-
- /* I915_NEW_BLEND {_COLOR}
- */
- {
- const float *color = i915->blend_color.color;
-
- bc[0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
- bc[1] = pack_ui32_float4( color[0],
- color[1],
- color[2],
- color[3] );
- }
-
- set_dynamic_indirect( i915,
- I915_DYNAMIC_BC_0,
- bc,
- 2 );
-}
-
-const struct i915_tracked_state i915_upload_BLENDCOLOR = {
- I915_NEW_BLEND,
- upload_BLENDCOLOR
-};
-
-/***********************************************************************
- */
-
-
-static void upload_IAB( struct i915_context *i915 )
-{
- unsigned iab = i915->blend->iab;
-
-
- set_dynamic_indirect( i915,
- I915_DYNAMIC_IAB,
- &iab,
- 1 );
-}
-
-const struct i915_tracked_state i915_upload_IAB = {
- I915_NEW_BLEND,
- upload_IAB
-};
-
-
-/***********************************************************************
- */
-
-
-
-static void upload_DEPTHSCALE( struct i915_context *i915 )
-{
- set_dynamic_indirect( i915,
- I915_DYNAMIC_DEPTHSCALE_0,
- &(i915->rasterizer->ds[0].u),
- 2 );
-}
-
-const struct i915_tracked_state i915_upload_DEPTHSCALE = {
- I915_NEW_RASTERIZER,
- upload_DEPTHSCALE
-};
-
-
-
-/***********************************************************************
- * Polygon stipple
- *
- * The i915 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- *
- * XXX: does stipple pattern need to be adjusted according to
- * the window position?
- *
- * XXX: possibly need workaround for conform paths test.
- */
-
-static void upload_STIPPLE( struct i915_context *i915 )
-{
- unsigned st[2];
-
- st[0] = _3DSTATE_STIPPLE;
- st[1] = 0;
-
- /* I915_NEW_RASTERIZER
- */
- st[1] |= i915->rasterizer->st;
-
-
- /* I915_NEW_STIPPLE
- */
- {
- const ubyte *mask = (const ubyte *)i915->poly_stipple.stipple;
- ubyte p[4];
-
- p[0] = mask[12] & 0xf;
- p[1] = mask[8] & 0xf;
- p[2] = mask[4] & 0xf;
- p[3] = mask[0] & 0xf;
-
- /* Not sure what to do about fallbacks, so for now just dont:
- */
- st[1] |= ((p[0] << 0) |
- (p[1] << 4) |
- (p[2] << 8) |
- (p[3] << 12));
- }
-
-
- set_dynamic_indirect( i915,
- I915_DYNAMIC_STP_0,
- &st[0],
- 2 );
-}
-
-
-const struct i915_tracked_state i915_upload_STIPPLE = {
- I915_NEW_RASTERIZER | I915_NEW_STIPPLE,
- upload_STIPPLE
-};
-
-
-
-/***********************************************************************
- * Scissor.
- */
-static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
-{
- set_dynamic_indirect( i915,
- I915_DYNAMIC_SC_ENA_0,
- &(i915->rasterizer->sc[0]),
- 1 );
-}
-
-const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = {
- I915_NEW_RASTERIZER,
- upload_SCISSOR_ENABLE
-};
-
-
-
-static void upload_SCISSOR_RECT( struct i915_context *i915 )
-{
- unsigned x1 = i915->scissor.minx;
- unsigned y1 = i915->scissor.miny;
- unsigned x2 = i915->scissor.maxx;
- unsigned y2 = i915->scissor.maxy;
- unsigned sc[3];
-
- sc[0] = _3DSTATE_SCISSOR_RECT_0_CMD;
- sc[1] = (y1 << 16) | (x1 & 0xffff);
- sc[2] = (y2 << 16) | (x2 & 0xffff);
-
- set_dynamic_indirect( i915,
- I915_DYNAMIC_SC_RECT_0,
- &sc[0],
- 3 );
-}
-
-
-const struct i915_tracked_state i915_upload_SCISSOR_RECT = {
- I915_NEW_SCISSOR,
- upload_SCISSOR_RECT
-};
-
-
-
-
-
-
-static const struct i915_tracked_state *atoms[] = {
- &i915_upload_MODES4,
- &i915_upload_BFO,
- &i915_upload_BLENDCOLOR,
- &i915_upload_IAB,
- &i915_upload_DEPTHSCALE,
- &i915_upload_STIPPLE,
- &i915_upload_SCISSOR_ENABLE,
- &i915_upload_SCISSOR_RECT
-};
-
-/* These will be dynamic indirect state commands, but for now just end
- * up on the batch buffer with everything else.
- */
-void i915_update_dynamic( struct i915_context *i915 )
-{
- int i;
-
- for (i = 0; i < Elements(atoms); i++)
- if (i915->dirty & atoms[i]->dirty)
- atoms[i]->update( i915 );
-}
-
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c
deleted file mode 100644
index 3339287f498..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_winsys.h"
-#include "i915_batch.h"
-#include "i915_reg.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-
-static unsigned translate_format( enum pipe_format format )
-{
- switch (format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- return COLOR_BUF_ARGB8888;
- case PIPE_FORMAT_R5G6B5_UNORM:
- return COLOR_BUF_RGB565;
- default:
- assert(0);
- return 0;
- }
-}
-
-static unsigned translate_depth_format( enum pipe_format zformat )
-{
- switch (zformat) {
- case PIPE_FORMAT_S8Z24_UNORM:
- return DEPTH_FRMT_24_FIXED_8_OTHER;
- case PIPE_FORMAT_Z16_UNORM:
- return DEPTH_FRMT_16_FIXED;
- default:
- assert(0);
- return 0;
- }
-}
-
-
-/**
- * Examine framebuffer state to determine width, height.
- */
-static boolean
-framebuffer_size(const struct pipe_framebuffer_state *fb,
- uint *width, uint *height)
-{
- if (fb->cbufs[0]) {
- *width = fb->cbufs[0]->width;
- *height = fb->cbufs[0]->height;
- return TRUE;
- }
- else if (fb->zsbuf) {
- *width = fb->zsbuf->width;
- *height = fb->zsbuf->height;
- return TRUE;
- }
- else {
- *width = *height = 0;
- return FALSE;
- }
-}
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-void
-i915_emit_hardware_state(struct i915_context *i915 )
-{
- /* XXX: there must be an easier way */
- const unsigned dwords = ( 14 +
- 7 +
- I915_MAX_DYNAMIC +
- 8 +
- 2 + I915_TEX_UNITS*3 +
- 2 + I915_TEX_UNITS*3 +
- 2 + I915_MAX_CONSTANT*4 +
- i915->current.program_len +
- 6
- ) * 3/2; /* plus 50% margin */
- const unsigned relocs = ( I915_TEX_UNITS +
- 3
- ) * 3/2; /* plus 50% margin */
-
-#if 0
- debug_printf("i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs);
-#endif
-
- if(!BEGIN_BATCH(dwords, relocs)) {
- FLUSH_BATCH();
- assert(BEGIN_BATCH(dwords, relocs));
- }
-
- /* 14 dwords, 0 relocs */
- if (i915->hardware_dirty & I915_HW_INVARIENT)
- {
- OUT_BATCH(_3DSTATE_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE | AA_LINE_REGION_WIDTH_1_0);
-
- OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS |
- CSB_TCB(0, 0) |
- CSB_TCB(1, 1) |
- CSB_TCB(2, 2) |
- CSB_TCB(3, 3) |
- CSB_TCB(4, 4) |
- CSB_TCB(5, 5) |
- CSB_TCB(6, 6) |
- CSB_TCB(7, 7));
-
- OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
- ENABLE_POINT_RASTER_RULE |
- OGL_POINT_RASTER_RULE |
- ENABLE_LINE_STRIP_PROVOKE_VRTX |
- ENABLE_TRI_FAN_PROVOKE_VRTX |
- LINE_STRIP_PROVOKE_VRTX(1) |
- TRI_FAN_PROVOKE_VRTX(2) |
- ENABLE_TEXKILL_3D_4D |
- TEXKILL_4D);
-
- /* Need to initialize this to zero.
- */
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | (0));
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE);
-
- /* disable indirect state for now
- */
- OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0);
- OUT_BATCH(0);
- }
-
- /* 7 dwords, 1 relocs */
- if (i915->hardware_dirty & I915_HW_IMMEDIATE)
- {
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
- I1_LOAD_S(0) |
- I1_LOAD_S(1) |
- I1_LOAD_S(2) |
- I1_LOAD_S(4) |
- I1_LOAD_S(5) |
- I1_LOAD_S(6) |
- (5));
-
- if(i915->vbo)
- OUT_RELOC(i915->vbo,
- I915_BUFFER_ACCESS_READ,
- i915->current.immediate[I915_IMMEDIATE_S0]);
- else
- /* FIXME: we should not do this */
- OUT_BATCH(0);
- OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S1]);
- OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S2]);
- OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S4]);
- OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S5]);
- OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S6]);
- }
-
- /* I915_MAX_DYNAMIC dwords, 0 relocs */
- if (i915->hardware_dirty & I915_HW_DYNAMIC)
- {
- int i;
- for (i = 0; i < I915_MAX_DYNAMIC; i++) {
- OUT_BATCH(i915->current.dynamic[i]);
- }
- }
-
- /* 8 dwords, 2 relocs */
- if (i915->hardware_dirty & I915_HW_STATIC)
- {
- struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
- struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
-
- if (cbuf_surface) {
- unsigned pitch = (cbuf_surface->pitch * cbuf_surface->cpp);
-
- OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
-
- OUT_BATCH(BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
- OUT_RELOC(cbuf_surface->buffer,
- I915_BUFFER_ACCESS_WRITE,
- 0);
- }
-
- /* What happens if no zbuf??
- */
- if (depth_surface) {
- unsigned zpitch = (depth_surface->pitch * depth_surface->cpp);
-
- OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
-
- OUT_BATCH(BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(zpitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
- OUT_RELOC(depth_surface->buffer,
- I915_BUFFER_ACCESS_WRITE,
- 0);
- }
-
- {
- unsigned cformat, zformat = 0;
-
- if (cbuf_surface)
- cformat = cbuf_surface->format;
- else
- cformat = PIPE_FORMAT_A8R8G8B8_UNORM; /* arbitrary */
- cformat = translate_format(cformat);
-
- if (depth_surface)
- zformat = translate_depth_format( i915->framebuffer.zsbuf->format );
-
- OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD);
- OUT_BATCH(DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- cformat |
- zformat );
- }
- }
-
-#if 01
- /* texture images */
- /* 2 + I915_TEX_UNITS*3 dwords, I915_TEX_UNITS relocs */
- if (i915->hardware_dirty & (I915_HW_MAP | I915_HW_SAMPLER))
- {
- /* XXX: we were refering to sampler state
- * (current.sampler_enable_nr) below, but only checking
- * I915_HW_MAP above. Should probably calculate the enabled
- * flags separately - but there will be further rework of
- * state so perhaps not necessary yet.
- */
- const uint nr = i915->current.sampler_enable_nr;
- if (nr) {
- const uint enabled = i915->current.sampler_enable_flags;
- uint unit;
- uint count = 0;
- OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr));
- OUT_BATCH(enabled);
- for (unit = 0; unit < I915_TEX_UNITS; unit++) {
- if (enabled & (1 << unit)) {
- struct pipe_buffer *buf =
- i915->texture[unit]->buffer;
- uint offset = 0;
- assert(buf);
-
- count++;
-
- OUT_RELOC(buf,
- I915_BUFFER_ACCESS_READ,
- offset);
- OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */
- OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */
- }
- }
- assert(count == nr);
- }
- }
-#endif
-
-#if 01
- /* samplers */
- /* 2 + I915_TEX_UNITS*3 dwords, 0 relocs */
- if (i915->hardware_dirty & I915_HW_SAMPLER)
- {
- if (i915->current.sampler_enable_nr) {
- int i;
-
- OUT_BATCH( _3DSTATE_SAMPLER_STATE |
- (3 * i915->current.sampler_enable_nr) );
-
- OUT_BATCH( i915->current.sampler_enable_flags );
-
- for (i = 0; i < I915_TEX_UNITS; i++) {
- if (i915->current.sampler_enable_flags & (1<<i)) {
- OUT_BATCH( i915->current.sampler[i][0] );
- OUT_BATCH( i915->current.sampler[i][1] );
- OUT_BATCH( i915->current.sampler[i][2] );
- }
- }
- }
- }
-#endif
-
- /* constants */
- /* 2 + I915_MAX_CONSTANT*4 dwords, 0 relocs */
- if (i915->hardware_dirty & I915_HW_PROGRAM)
- {
- const uint nr = i915->current.num_constants[PIPE_SHADER_FRAGMENT];
- assert(nr <= I915_MAX_CONSTANT);
- if (nr > 0) {
- const uint *c
- = (const uint *) i915->current.constants[PIPE_SHADER_FRAGMENT];
- uint i;
- OUT_BATCH( _3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4) );
- OUT_BATCH( (1 << (nr - 1)) | ((1 << (nr - 1)) - 1) );
- for (i = 0; i < nr; i++) {
- OUT_BATCH(*c++);
- OUT_BATCH(*c++);
- OUT_BATCH(*c++);
- OUT_BATCH(*c++);
- }
- }
- }
-
- /* Fragment program */
- /* i915->current.program_len dwords, 0 relocs */
- if (i915->hardware_dirty & I915_HW_PROGRAM)
- {
- uint i;
- /* we should always have, at least, a pass-through program */
- assert(i915->current.program_len > 0);
- for (i = 0; i < i915->current.program_len; i++) {
- OUT_BATCH(i915->current.program[i]);
- }
- }
-
- /* drawing surface size */
- /* 6 dwords, 0 relocs */
- {
- uint w, h;
- boolean k = framebuffer_size(&i915->framebuffer, &w, &h);
- assert(k);
-
- OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(((w - 1) & 0xffff) | ((h - 1) << 16));
- OUT_BATCH(0);
- OUT_BATCH(0);
- }
-
-
- i915->hardware_dirty = 0;
-}
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
deleted file mode 100644
index 07031fc6c5b..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
- /*
- * Authors:
- * Keith Whitwell <[email protected]>
- */
-
-#include "i915_state_inlines.h"
-#include "i915_context.h"
-#include "i915_state.h"
-#include "i915_reg.h"
-#include "p_util.h"
-
-
-/* All state expressable with the LOAD_STATE_IMMEDIATE_1 packet.
- * Would like to opportunistically recombine all these fragments into
- * a single packet containing only what has changed, but for now emit
- * as multiple packets.
- */
-
-
-
-
-/***********************************************************************
- * S0,S1: Vertex buffer state.
- */
-static void upload_S0S1(struct i915_context *i915)
-{
- unsigned LIS0, LIS1;
-
- /* INTEL_NEW_VBO */
- /* TODO: re-use vertex buffers here? */
- LIS0 = 0;
-
- /* INTEL_NEW_VERTEX_SIZE -- do this where the vertex size is calculated!
- */
- {
- unsigned vertex_size = i915->current.vertex_info.size;
-
- LIS1 = ((vertex_size << 24) |
- (vertex_size << 16));
- }
-
- /* INTEL_NEW_VBO */
- /* TODO: use a vertex generation number to track vbo changes */
- if (1 ||
- i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 ||
- i915->current.immediate[I915_IMMEDIATE_S1] != LIS1)
- {
- i915->current.immediate[I915_IMMEDIATE_S0] = LIS0;
- i915->current.immediate[I915_IMMEDIATE_S1] = LIS1;
- i915->hardware_dirty |= I915_HW_IMMEDIATE;
- }
-}
-
-const struct i915_tracked_state i915_upload_S0S1 = {
- I915_NEW_VBO | I915_NEW_VERTEX_FORMAT,
- upload_S0S1
-};
-
-
-
-
-/***********************************************************************
- * S4: Vertex format, rasterization state
- */
-static void upload_S2S4(struct i915_context *i915)
-{
- unsigned LIS2, LIS4;
-
- /* I915_NEW_VERTEX_FORMAT */
- {
- LIS2 = i915->current.vertex_info.hwfmt[1];
- LIS4 = i915->current.vertex_info.hwfmt[0];
- /*
- debug_printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4);
- */
- assert(LIS4); /* should never be zero? */
- }
-
- LIS4 |= i915->rasterizer->LIS4;
-
- if (LIS2 != i915->current.immediate[I915_IMMEDIATE_S2] ||
- LIS4 != i915->current.immediate[I915_IMMEDIATE_S4]) {
-
- i915->current.immediate[I915_IMMEDIATE_S2] = LIS2;
- i915->current.immediate[I915_IMMEDIATE_S4] = LIS4;
- i915->hardware_dirty |= I915_HW_IMMEDIATE;
- }
-}
-
-
-const struct i915_tracked_state i915_upload_S2S4 = {
- I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT,
- upload_S2S4
-};
-
-
-
-/***********************************************************************
- *
- */
-static void upload_S5( struct i915_context *i915 )
-{
- unsigned LIS5 = 0;
-
- LIS5 |= i915->depth_stencil->stencil_LIS5;
-
- LIS5 |= i915->blend->LIS5;
-
-#if 0
- /* I915_NEW_RASTERIZER */
- if (i915->state.Polygon->OffsetFill) {
- LIS5 |= S5_GLOBAL_DEPTH_OFFSET_ENABLE;
- }
-#endif
-
-
- if (LIS5 != i915->current.immediate[I915_IMMEDIATE_S5]) {
- i915->current.immediate[I915_IMMEDIATE_S5] = LIS5;
- i915->hardware_dirty |= I915_HW_IMMEDIATE;
- }
-}
-
-const struct i915_tracked_state i915_upload_S5 = {
- (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER),
- upload_S5
-};
-
-
-/***********************************************************************
- */
-static void upload_S6( struct i915_context *i915 )
-{
- unsigned LIS6 = (S6_COLOR_WRITE_ENABLE |
- (2 << S6_TRISTRIP_PV_SHIFT));
-
- /* I915_NEW_BLEND
- */
- LIS6 |= i915->blend->LIS6;
-
- /* I915_NEW_DEPTH
- */
- LIS6 |= i915->depth_stencil->depth_LIS6;
-
- if (LIS6 != i915->current.immediate[I915_IMMEDIATE_S6]) {
- i915->current.immediate[I915_IMMEDIATE_S6] = LIS6;
- i915->hardware_dirty |= I915_HW_IMMEDIATE;
- }
-}
-
-const struct i915_tracked_state i915_upload_S6 = {
- I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
- upload_S6
-};
-
-
-/***********************************************************************
- */
-static void upload_S7( struct i915_context *i915 )
-{
- unsigned LIS7;
-
- /* I915_NEW_RASTERIZER
- */
- LIS7 = i915->rasterizer->LIS7;
-
- if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) {
- i915->current.immediate[I915_IMMEDIATE_S7] = LIS7;
- i915->hardware_dirty |= I915_HW_IMMEDIATE;
- }
-}
-
-const struct i915_tracked_state i915_upload_S7 = {
- I915_NEW_RASTERIZER,
- upload_S7
-};
-
-
-static const struct i915_tracked_state *atoms[] = {
- &i915_upload_S0S1,
- &i915_upload_S2S4,
- &i915_upload_S5,
- &i915_upload_S6,
- &i915_upload_S7
-};
-
-/*
- */
-void i915_update_immediate( struct i915_context *i915 )
-{
- int i;
-
- for (i = 0; i < Elements(atoms); i++)
- if (i915->dirty & atoms[i]->dirty)
- atoms[i]->update( i915 );
-}
diff --git a/src/mesa/pipe/i915simple/i915_state_inlines.h b/src/mesa/pipe/i915simple/i915_state_inlines.h
deleted file mode 100644
index 0934ac79a41..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_inlines.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef I915_STATE_INLINES_H
-#define I915_STATE_INLINES_H
-
-#include "p_compiler.h"
-#include "p_defines.h"
-#include "i915_reg.h"
-
-
-static INLINE unsigned
-i915_translate_compare_func(unsigned func)
-{
- switch (func) {
- case PIPE_FUNC_NEVER:
- return COMPAREFUNC_NEVER;
- case PIPE_FUNC_LESS:
- return COMPAREFUNC_LESS;
- case PIPE_FUNC_LEQUAL:
- return COMPAREFUNC_LEQUAL;
- case PIPE_FUNC_GREATER:
- return COMPAREFUNC_GREATER;
- case PIPE_FUNC_GEQUAL:
- return COMPAREFUNC_GEQUAL;
- case PIPE_FUNC_NOTEQUAL:
- return COMPAREFUNC_NOTEQUAL;
- case PIPE_FUNC_EQUAL:
- return COMPAREFUNC_EQUAL;
- case PIPE_FUNC_ALWAYS:
- return COMPAREFUNC_ALWAYS;
- default:
- return COMPAREFUNC_ALWAYS;
- }
-}
-
-static INLINE unsigned
-i915_translate_stencil_op(unsigned op)
-{
- switch (op) {
- case PIPE_STENCIL_OP_KEEP:
- return STENCILOP_KEEP;
- case PIPE_STENCIL_OP_ZERO:
- return STENCILOP_ZERO;
- case PIPE_STENCIL_OP_REPLACE:
- return STENCILOP_REPLACE;
- case PIPE_STENCIL_OP_INCR:
- return STENCILOP_INCRSAT;
- case PIPE_STENCIL_OP_DECR:
- return STENCILOP_DECRSAT;
- case PIPE_STENCIL_OP_INCR_WRAP:
- return STENCILOP_INCR;
- case PIPE_STENCIL_OP_DECR_WRAP:
- return STENCILOP_DECR;
- case PIPE_STENCIL_OP_INVERT:
- return STENCILOP_INVERT;
- default:
- return STENCILOP_ZERO;
- }
-}
-
-static INLINE unsigned
-i915_translate_blend_factor(unsigned factor)
-{
- switch (factor) {
- case PIPE_BLENDFACTOR_ZERO:
- return BLENDFACT_ZERO;
- case PIPE_BLENDFACTOR_SRC_ALPHA:
- return BLENDFACT_SRC_ALPHA;
- case PIPE_BLENDFACTOR_ONE:
- return BLENDFACT_ONE;
- case PIPE_BLENDFACTOR_SRC_COLOR:
- return BLENDFACT_SRC_COLR;
- case PIPE_BLENDFACTOR_INV_SRC_COLOR:
- return BLENDFACT_INV_SRC_COLR;
- case PIPE_BLENDFACTOR_DST_COLOR:
- return BLENDFACT_DST_COLR;
- case PIPE_BLENDFACTOR_INV_DST_COLOR:
- return BLENDFACT_INV_DST_COLR;
- case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
- return BLENDFACT_INV_SRC_ALPHA;
- case PIPE_BLENDFACTOR_DST_ALPHA:
- return BLENDFACT_DST_ALPHA;
- case PIPE_BLENDFACTOR_INV_DST_ALPHA:
- return BLENDFACT_INV_DST_ALPHA;
- case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- return BLENDFACT_SRC_ALPHA_SATURATE;
- case PIPE_BLENDFACTOR_CONST_COLOR:
- return BLENDFACT_CONST_COLOR;
- case PIPE_BLENDFACTOR_INV_CONST_COLOR:
- return BLENDFACT_INV_CONST_COLOR;
- case PIPE_BLENDFACTOR_CONST_ALPHA:
- return BLENDFACT_CONST_ALPHA;
- case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
- return BLENDFACT_INV_CONST_ALPHA;
- default:
- return BLENDFACT_ZERO;
- }
-}
-
-static INLINE unsigned
-i915_translate_blend_func(unsigned mode)
-{
- switch (mode) {
- case PIPE_BLEND_ADD:
- return BLENDFUNC_ADD;
- case PIPE_BLEND_MIN:
- return BLENDFUNC_MIN;
- case PIPE_BLEND_MAX:
- return BLENDFUNC_MAX;
- case PIPE_BLEND_SUBTRACT:
- return BLENDFUNC_SUBTRACT;
- case PIPE_BLEND_REVERSE_SUBTRACT:
- return BLENDFUNC_REVERSE_SUBTRACT;
- default:
- return 0;
- }
-}
-
-
-static INLINE unsigned
-i915_translate_logic_op(unsigned opcode)
-{
- switch (opcode) {
- case PIPE_LOGICOP_CLEAR:
- return LOGICOP_CLEAR;
- case PIPE_LOGICOP_AND:
- return LOGICOP_AND;
- case PIPE_LOGICOP_AND_REVERSE:
- return LOGICOP_AND_RVRSE;
- case PIPE_LOGICOP_COPY:
- return LOGICOP_COPY;
- case PIPE_LOGICOP_COPY_INVERTED:
- return LOGICOP_COPY_INV;
- case PIPE_LOGICOP_AND_INVERTED:
- return LOGICOP_AND_INV;
- case PIPE_LOGICOP_NOOP:
- return LOGICOP_NOOP;
- case PIPE_LOGICOP_XOR:
- return LOGICOP_XOR;
- case PIPE_LOGICOP_OR:
- return LOGICOP_OR;
- case PIPE_LOGICOP_OR_INVERTED:
- return LOGICOP_OR_INV;
- case PIPE_LOGICOP_NOR:
- return LOGICOP_NOR;
- case PIPE_LOGICOP_EQUIV:
- return LOGICOP_EQUIV;
- case PIPE_LOGICOP_INVERT:
- return LOGICOP_INV;
- case PIPE_LOGICOP_OR_REVERSE:
- return LOGICOP_OR_RVRSE;
- case PIPE_LOGICOP_NAND:
- return LOGICOP_NAND;
- case PIPE_LOGICOP_SET:
- return LOGICOP_SET;
- default:
- return LOGICOP_SET;
- }
-}
-
-
-
-static INLINE boolean i915_validate_vertices( unsigned hw_prim, unsigned nr )
-{
- boolean ok;
-
- switch (hw_prim) {
- case PRIM3D_POINTLIST:
- ok = (nr >= 1);
- assert(ok);
- break;
- case PRIM3D_LINELIST:
- ok = (nr >= 2) && (nr % 2) == 0;
- assert(ok);
- break;
- case PRIM3D_LINESTRIP:
- ok = (nr >= 2);
- assert(ok);
- break;
- case PRIM3D_TRILIST:
- ok = (nr >= 3) && (nr % 3) == 0;
- assert(ok);
- break;
- case PRIM3D_TRISTRIP:
- ok = (nr >= 3);
- assert(ok);
- break;
- case PRIM3D_TRIFAN:
- ok = (nr >= 3);
- assert(ok);
- break;
- case PRIM3D_POLY:
- ok = (nr >= 3);
- assert(ok);
- break;
- default:
- assert(0);
- ok = 0;
- break;
- }
-
- return ok;
-}
-
-#endif
diff --git a/src/mesa/pipe/i915simple/i915_state_sampler.c b/src/mesa/pipe/i915simple/i915_state_sampler.c
deleted file mode 100644
index 9c1a5bbbd65..00000000000
--- a/src/mesa/pipe/i915simple/i915_state_sampler.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "pipe/p_util.h"
-
-#include "i915_state_inlines.h"
-#include "i915_context.h"
-#include "i915_reg.h"
-#include "i915_state.h"
-
-
-/**
- * Compute i915 texture sampling state.
- *
- * Recalculate all state from scratch. Perhaps not the most
- * efficient, but this has gotten complex enough that we need
- * something which is understandable and reliable.
- * \param state returns the 3 words of compute state
- */
-static void update_sampler(struct i915_context *i915,
- uint unit,
- const struct i915_sampler_state *sampler,
- const struct i915_texture *tex,
- unsigned state[3] )
-{
- const struct pipe_texture *pt = &tex->base;
-
- /* Need to do this after updating the maps, which call the
- * intel_finalize_mipmap_tree and hence can update firstLevel:
- */
- state[0] = sampler->state[0];
- state[1] = sampler->state[1];
- state[2] = sampler->state[2];
-
- if (pt->format == PIPE_FORMAT_YCBCR ||
- pt->format == PIPE_FORMAT_YCBCR_REV)
- state[0] |= SS2_COLORSPACE_CONVERSION;
-
- /* 3D textures don't seem to respect the border color.
- * Fallback if there's ever a danger that they might refer to
- * it.
- *
- * Effectively this means fallback on 3D clamp or
- * clamp_to_border.
- *
- * XXX: Check if this is true on i945.
- * XXX: Check if this bug got fixed in release silicon.
- */
-#if 0
- {
- const unsigned ws = sampler->templ->wrap_s;
- const unsigned wt = sampler->templ->wrap_t;
- const unsigned wr = sampler->templ->wrap_r;
- if (pt->target == PIPE_TEXTURE_3D &&
- (sampler->templ->min_img_filter != PIPE_TEX_FILTER_NEAREST ||
- sampler->templ->mag_img_filter != PIPE_TEX_FILTER_NEAREST) &&
- (ws == PIPE_TEX_WRAP_CLAMP ||
- wt == PIPE_TEX_WRAP_CLAMP ||
- wr == PIPE_TEX_WRAP_CLAMP ||
- ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
- wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
- wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) {
- if (i915->strict_conformance) {
- assert(0);
- /* sampler->fallback = true; */
- /* TODO */
- }
- }
- }
-#endif
-
- state[1] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
-}
-
-
-void i915_update_samplers( struct i915_context *i915 )
-{
- uint unit;
-
- i915->current.sampler_enable_nr = 0;
- i915->current.sampler_enable_flags = 0x0;
-
- for (unit = 0; unit < I915_TEX_UNITS; unit++) {
- /* determine unit enable/disable by looking for a bound texture */
- /* could also examine the fragment program? */
- if (i915->texture[unit]) {
- update_sampler( i915,
- unit,
- i915->sampler[unit], /* sampler state */
- i915->texture[unit], /* texture */
- i915->current.sampler[unit] /* the result */
- );
-
- i915->current.sampler_enable_nr++;
- i915->current.sampler_enable_flags |= (1 << unit);
- }
- }
-
- i915->hardware_dirty |= I915_HW_SAMPLER;
-}
-
-
-static uint
-translate_texture_format(enum pipe_format pipeFormat)
-{
- switch (pipeFormat) {
- case PIPE_FORMAT_U_L8:
- return MAPSURF_8BIT | MT_8BIT_L8;
- case PIPE_FORMAT_U_I8:
- return MAPSURF_8BIT | MT_8BIT_I8;
- case PIPE_FORMAT_U_A8:
- return MAPSURF_8BIT | MT_8BIT_A8;
- case PIPE_FORMAT_U_A8_L8:
- return MAPSURF_16BIT | MT_16BIT_AY88;
- case PIPE_FORMAT_R5G6B5_UNORM:
- return MAPSURF_16BIT | MT_16BIT_RGB565;
- case PIPE_FORMAT_A1R5G5B5_UNORM:
- return MAPSURF_16BIT | MT_16BIT_ARGB1555;
- case PIPE_FORMAT_A4R4G4B4_UNORM:
- return MAPSURF_16BIT | MT_16BIT_ARGB4444;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- return MAPSURF_32BIT | MT_32BIT_ARGB8888;
- case PIPE_FORMAT_YCBCR_REV:
- return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
- case PIPE_FORMAT_YCBCR:
- return (MAPSURF_422 | MT_422_YCRCB_SWAPY);
-#if 0
- case PIPE_FORMAT_RGB_FXT1:
- case PIPE_FORMAT_RGBA_FXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
-#endif
- case PIPE_FORMAT_Z16_UNORM:
- return (MAPSURF_16BIT | MT_16BIT_L16);
-#if 0
- case PIPE_FORMAT_RGBA_DXT1:
- case PIPE_FORMAT_RGB_DXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- case PIPE_FORMAT_RGBA_DXT3:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- case PIPE_FORMAT_RGBA_DXT5:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
-#endif
- case PIPE_FORMAT_S8Z24_UNORM:
- return (MAPSURF_32BIT | MT_32BIT_xL824);
- default:
- debug_printf("i915: translate_texture_format() bad image format %x\n",
- pipeFormat);
- assert(0);
- return 0;
- }
-}
-
-
-static void
-i915_update_texture(struct i915_context *i915, uint unit,
- uint state[6])
-{
- const struct i915_texture *tex = i915->texture[unit];
- const struct pipe_texture *pt = &tex->base;
- uint format, pitch;
- const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
- const uint num_levels = pt->last_level;
-
- assert(tex);
- assert(width);
- assert(height);
- assert(depth);
-
- format = translate_texture_format(pt->format);
- pitch = tex->pitch * pt->cpp;
-
- assert(format);
- assert(pitch);
-
- /* MS3 state */
- state[0] =
- (((height - 1) << MS3_HEIGHT_SHIFT)
- | ((width - 1) << MS3_WIDTH_SHIFT)
- | format
- | MS3_USE_FENCE_REGS);
-
- /* MS4 state */
- state[1] =
- ((((pitch / 4) - 1) << MS4_PITCH_SHIFT)
- | MS4_CUBE_FACE_ENA_MASK
- | ((num_levels * 4) << MS4_MAX_LOD_SHIFT)
- | ((depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
-}
-
-
-void
-i915_update_textures(struct i915_context *i915)
-{
- uint unit;
-
- for (unit = 0; unit < I915_TEX_UNITS; unit++) {
- /* determine unit enable/disable by looking for a bound texture */
- /* could also examine the fragment program? */
- if (i915->texture[unit]) {
- i915_update_texture(i915, unit, i915->current.texbuffer[unit]);
- }
- }
-
- i915->hardware_dirty |= I915_HW_MAP;
-}
diff --git a/src/mesa/pipe/i915simple/i915_strings.c b/src/mesa/pipe/i915simple/i915_strings.c
deleted file mode 100644
index c713bf72086..00000000000
--- a/src/mesa/pipe/i915simple/i915_strings.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-static const char *i915_get_vendor( struct pipe_context *pipe )
-{
- return "Tungsten Graphics, Inc.";
-}
-
-
-static const char *i915_get_name( struct pipe_context *pipe )
-{
- static char buffer[128];
- const char *chipset;
-
- switch (i915_context(pipe)->pci_id) {
- case PCI_CHIP_I915_G:
- chipset = "915G";
- break;
- case PCI_CHIP_I915_GM:
- chipset = "915GM";
- break;
- case PCI_CHIP_I945_G:
- chipset = "945G";
- break;
- case PCI_CHIP_I945_GM:
- chipset = "945GM";
- break;
- case PCI_CHIP_I945_GME:
- chipset = "945GME";
- break;
- case PCI_CHIP_G33_G:
- chipset = "G33";
- break;
- case PCI_CHIP_Q35_G:
- chipset = "Q35";
- break;
- case PCI_CHIP_Q33_G:
- chipset = "Q33";
- break;
- default:
- chipset = "unknown";
- break;
- }
-
- sprintf(buffer, "pipe/i915 (chipset: %s)", chipset);
- return buffer;
-}
-
-
-void
-i915_init_string_functions(struct i915_context *i915)
-{
- i915->pipe.get_name = i915_get_name;
- i915->pipe.get_vendor = i915_get_vendor;
-}
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c
deleted file mode 100644
index 6d4b8a0aa9f..00000000000
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "i915_context.h"
-#include "i915_blit.h"
-#include "i915_state.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_util.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
-#include "pipe/util/p_tile.h"
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static struct pipe_surface *
-i915_get_tex_surface(struct pipe_context *pipe,
- struct pipe_texture *pt,
- unsigned face, unsigned level, unsigned zslice)
-{
- struct i915_texture *tex = (struct i915_texture *)pt;
- struct pipe_surface *ps;
- unsigned offset; /* in bytes */
-
- offset = tex->level_offset[level];
-
- if (pt->target == PIPE_TEXTURE_CUBE) {
- offset += tex->image_offset[level][face] * pt->cpp;
- }
- else if (pt->target == PIPE_TEXTURE_3D) {
- offset += tex->image_offset[level][zslice] * pt->cpp;
- }
- else {
- assert(face == 0);
- assert(zslice == 0);
- }
-
- ps = pipe->winsys->surface_alloc(pipe->winsys);
- if (ps) {
- assert(ps->refcount);
- assert(ps->winsys);
- pipe_buffer_reference(pipe->winsys, &ps->buffer, tex->buffer);
- ps->format = pt->format;
- ps->cpp = pt->cpp;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
- ps->pitch = tex->pitch;
- ps->offset = offset;
- }
- return ps;
-}
-
-
-
-/* Assumes all values are within bounds -- no checking at this level -
- * do it higher up if required.
- */
-static void
-i915_surface_copy(struct pipe_context *pipe,
- unsigned do_flip,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- struct pipe_surface *src,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- assert( dst != src );
- assert( dst->cpp == src->cpp );
-
- if (0) {
- pipe_copy_rect(pipe_surface_map(dst),
- dst->cpp,
- dst->pitch,
- dstx, dsty,
- width, height,
- pipe_surface_map(src),
- do_flip ? -src->pitch : src->pitch,
- srcx, do_flip ? 1 - srcy - height : srcy);
-
- pipe_surface_unmap(src);
- pipe_surface_unmap(dst);
- }
- else {
- i915_copy_blit( i915_context(pipe),
- do_flip,
- dst->cpp,
- (short) src->pitch, src->buffer, src->offset,
- (short) dst->pitch, dst->buffer, dst->offset,
- (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
- }
-}
-
-/* Fill a rectangular sub-region. Need better logic about when to
- * push buffers into AGP - will currently do so whenever possible.
- */
-static void *
-get_pointer(struct pipe_surface *dst, void *dst_map, unsigned x, unsigned y)
-{
- return (char *)dst_map + (y * dst->pitch + x) * dst->cpp;
-}
-
-
-static void
-i915_surface_fill(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height, unsigned value)
-{
- if (0) {
- unsigned i, j;
- void *dst_map = pipe_surface_map(dst);
-
- switch (dst->cpp) {
- case 1: {
- ubyte *row = get_pointer(dst, dst_map, dstx, dsty);
- for (i = 0; i < height; i++) {
- memset(row, value, width);
- row += dst->pitch;
- }
- }
- break;
- case 2: {
- ushort *row = get_pointer(dst, dst_map, dstx, dsty);
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++)
- row[j] = (ushort) value;
- row += dst->pitch;
- }
- }
- break;
- case 4: {
- unsigned *row = get_pointer(dst, dst_map, dstx, dsty);
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++)
- row[j] = value;
- row += dst->pitch;
- }
- }
- break;
- default:
- assert(0);
- break;
- }
-
- pipe_surface_unmap( dst );
- }
- else {
- i915_fill_blit( i915_context(pipe),
- dst->cpp,
- (short) dst->pitch,
- dst->buffer, dst->offset,
- (short) dstx, (short) dsty,
- (short) width, (short) height,
- value );
- }
-}
-
-
-void
-i915_init_surface_functions(struct i915_context *i915)
-{
- i915->pipe.get_tex_surface = i915_get_tex_surface;
-
- i915->pipe.surface_copy = i915_surface_copy;
- i915->pipe.surface_fill = i915_surface_fill;
-}
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c
deleted file mode 100644
index 6d37ae3d747..00000000000
--- a/src/mesa/pipe/i915simple/i915_texture.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
- /*
- * Authors:
- * Keith Whitwell <[email protected]>
- * Michel Dänzer <[email protected]>
- */
-
-#include "pipe/p_state.h"
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_util.h"
-#include "pipe/p_winsys.h"
-
-#include "i915_context.h"
-#include "i915_texture.h"
-#include "i915_debug.h"
-
-
-static unsigned minify( unsigned d )
-{
- return MAX2(1, d>>1);
-}
-
-
-
-static void
-i915_miptree_set_level_info(struct i915_texture *tex,
- unsigned level,
- unsigned nr_images,
- unsigned x, unsigned y, unsigned w, unsigned h, unsigned d)
-{
- struct pipe_texture *pt = &tex->base;
-
- assert(level < PIPE_MAX_TEXTURE_LEVELS);
-
- pt->width[level] = w;
- pt->height[level] = h;
- pt->depth[level] = d;
-
- tex->level_offset[level] = (x + y * tex->pitch) * pt->cpp;
- tex->nr_images[level] = nr_images;
-
- /*
- DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- level, w, h, d, x, y, tex->level_offset[level]);
- */
-
- /* Not sure when this would happen, but anyway:
- */
- if (tex->image_offset[level]) {
- FREE(tex->image_offset[level]);
- tex->image_offset[level] = NULL;
- }
-
- assert(nr_images);
- assert(!tex->image_offset[level]);
-
- tex->image_offset[level] = (unsigned *) MALLOC(nr_images * sizeof(unsigned));
- tex->image_offset[level][0] = 0;
-}
-
-
-static void
-i915_miptree_set_image_offset(struct i915_texture *tex,
- unsigned level, unsigned img, unsigned x, unsigned y)
-{
- if (img == 0 && level == 0)
- assert(x == 0 && y == 0);
-
- assert(img < tex->nr_images[level]);
-
- tex->image_offset[level][img] = (x + y * tex->pitch);
-
- /*
- DBG("%s level %d img %d pos %d,%d image_offset %x\n",
- __FUNCTION__, level, img, x, y, tex->image_offset[level][img]);
- */
-}
-
-
-static void
-i945_miptree_layout_2d( struct i915_texture *tex )
-{
- struct pipe_texture *pt = &tex->base;
- int align_h = 2, align_w = 4;
- unsigned level;
- unsigned x = 0;
- unsigned y = 0;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
-
- tex->pitch = pt->width[0];
-
- /* May need to adjust pitch to accomodate the placement of
- * the 2nd mipmap level. This occurs when the alignment
- * constraints of mipmap placement push the right edge of the
- * 2nd mipmap level out past the width of its parent.
- */
- if (pt->last_level > 0) {
- unsigned mip1_width = align_int(minify(pt->width[0]), align_w)
- + minify(minify(pt->width[0]));
-
- if (mip1_width > pt->width[0])
- tex->pitch = mip1_width;
- }
-
- /* Pitch must be a whole number of dwords, even though we
- * express it in texels.
- */
- tex->pitch = align_int(tex->pitch * pt->cpp, 4) / pt->cpp;
- tex->total_height = 0;
-
- for (level = 0; level <= pt->last_level; level++) {
- unsigned img_height;
-
- i915_miptree_set_level_info(tex, level, 1, x, y, width, height, 1);
-
- if (pt->compressed)
- img_height = MAX2(1, height/4);
- else
- img_height = align_int(height, align_h);
-
-
- /* Because the images are packed better, the final offset
- * might not be the maximal one:
- */
- tex->total_height = MAX2(tex->total_height, y + img_height);
-
- /* Layout_below: step right after second mipmap level.
- */
- if (level == 1) {
- x += align_int(width, align_w);
- }
- else {
- y += img_height;
- }
-
- width = minify(width);
- height = minify(height);
- }
-}
-
-
-static const int initial_offsets[6][2] = {
- {0, 0},
- {0, 2},
- {1, 0},
- {1, 2},
- {1, 1},
- {1, 3}
-};
-
-static const int step_offsets[6][2] = {
- {0, 2},
- {0, 2},
- {-1, 2},
- {-1, 2},
- {-1, 1},
- {-1, 1}
-};
-
-
-static boolean
-i915_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
-{
- struct pipe_texture *pt = &tex->base;
- unsigned level;
-
- switch (pt->target) {
- case PIPE_TEXTURE_CUBE: {
- const unsigned dim = pt->width[0];
- unsigned face;
- unsigned lvlWidth = pt->width[0], lvlHeight = pt->height[0];
-
- assert(lvlWidth == lvlHeight); /* cubemap images are square */
-
- /* double pitch for cube layouts */
- tex->pitch = ((dim * pt->cpp * 2 + 3) & ~3) / pt->cpp;
- tex->total_height = dim * 4;
-
- for (level = 0; level <= pt->last_level; level++) {
- i915_miptree_set_level_info(tex, level, 6,
- 0, 0,
- /*OLD: tex->pitch, tex->total_height,*/
- lvlWidth, lvlHeight,
- 1);
- lvlWidth /= 2;
- lvlHeight /= 2;
- }
-
- for (face = 0; face < 6; face++) {
- unsigned x = initial_offsets[face][0] * dim;
- unsigned y = initial_offsets[face][1] * dim;
- unsigned d = dim;
-
- for (level = 0; level <= pt->last_level; level++) {
- i915_miptree_set_image_offset(tex, level, face, x, y);
- d >>= 1;
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- }
- }
- break;
- }
- case PIPE_TEXTURE_3D:{
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
- unsigned stack_height = 0;
-
- /* Calculate the size of a single slice.
- */
- tex->pitch = ((pt->width[0] * pt->cpp + 3) & ~3) / pt->cpp;
-
- /* XXX: hardware expects/requires 9 levels at minimum.
- */
- for (level = 0; level <= MAX2(8, pt->last_level);
- level++) {
- i915_miptree_set_level_info(tex, level, depth, 0, tex->total_height,
- width, height, depth);
-
-
- stack_height += MAX2(2, height);
-
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
- }
-
- /* Fixup depth image_offsets:
- */
- depth = pt->depth[0];
- for (level = 0; level <= pt->last_level; level++) {
- unsigned i;
- for (i = 0; i < depth; i++)
- i915_miptree_set_image_offset(tex, level, i,
- 0, i * stack_height);
-
- depth = minify(depth);
- }
-
-
- /* Multiply slice size by texture depth for total size. It's
- * remarkable how wasteful of memory the i915 texture layouts
- * are. They are largely fixed in the i945.
- */
- tex->total_height = stack_height * pt->depth[0];
- break;
- }
-
- default:{
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned img_height;
-
- tex->pitch = ((pt->width[0] * pt->cpp + 3) & ~3) / pt->cpp;
- tex->total_height = 0;
-
- for (level = 0; level <= pt->last_level; level++) {
- i915_miptree_set_level_info(tex, level, 1,
- 0, tex->total_height,
- width, height, 1);
-
- if (pt->compressed)
- img_height = MAX2(1, height / 4);
- else
- img_height = (MAX2(2, height) + 1) & ~1;
-
- tex->total_height += img_height;
-
- width = minify(width);
- height = minify(height);
- }
- break;
- }
- }
- /*
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- tex->pitch,
- tex->total_height, pt->cpp, tex->pitch * tex->total_height * pt->cpp);
- */
-
- return TRUE;
-}
-
-
-static boolean
-i945_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
-{
- struct pipe_texture *pt = &tex->base;
- unsigned level;
-
- switch (pt->target) {
- case PIPE_TEXTURE_CUBE:{
- const unsigned dim = pt->width[0];
- unsigned face;
- unsigned lvlWidth = pt->width[0], lvlHeight = pt->height[0];
-
- assert(lvlWidth == lvlHeight); /* cubemap images are square */
-
- /* Depending on the size of the largest images, pitch can be
- * determined either by the old-style packing of cubemap faces,
- * or the final row of 4x4, 2x2 and 1x1 faces below this.
- */
- if (dim > 32)
- tex->pitch = ((dim * pt->cpp * 2 + 3) & ~3) / pt->cpp;
- else
- tex->pitch = 14 * 8;
-
- tex->total_height = dim * 4 + 4;
-
- /* Set all the levels to effectively occupy the whole rectangular region.
- */
- for (level = 0; level <= pt->last_level; level++) {
- i915_miptree_set_level_info(tex, level, 6,
- 0, 0,
- lvlWidth, lvlHeight, 1);
- lvlWidth /= 2;
- lvlHeight /= 2;
- }
-
-
- for (face = 0; face < 6; face++) {
- unsigned x = initial_offsets[face][0] * dim;
- unsigned y = initial_offsets[face][1] * dim;
- unsigned d = dim;
-
- if (dim == 4 && face >= 4) {
- y = tex->total_height - 4;
- x = (face - 4) * 8;
- }
- else if (dim < 4 && (face > 0)) {
- y = tex->total_height - 4;
- x = face * 8;
- }
-
- for (level = 0; level <= pt->last_level; level++) {
- i915_miptree_set_image_offset(tex, level, face, x, y);
-
- d >>= 1;
-
- switch (d) {
- case 4:
- switch (face) {
- case PIPE_TEX_FACE_POS_X:
- case PIPE_TEX_FACE_NEG_X:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- case PIPE_TEX_FACE_POS_Y:
- case PIPE_TEX_FACE_NEG_Y:
- y += 12;
- x -= 8;
- break;
- case PIPE_TEX_FACE_POS_Z:
- case PIPE_TEX_FACE_NEG_Z:
- y = tex->total_height - 4;
- x = (face - 4) * 8;
- break;
- }
-
- case 2:
- y = tex->total_height - 4;
- x = 16 + face * 8;
- break;
-
- case 1:
- x += 48;
- break;
-
- default:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- }
- }
- }
- break;
- }
- case PIPE_TEXTURE_3D:{
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
- unsigned pack_x_pitch, pack_x_nr;
- unsigned pack_y_pitch;
- unsigned level;
-
- tex->pitch = ((pt->width[0] * pt->cpp + 3) & ~3) / pt->cpp;
- tex->total_height = 0;
-
- pack_y_pitch = MAX2(pt->height[0], 2);
- pack_x_pitch = tex->pitch;
- pack_x_nr = 1;
-
- for (level = 0; level <= pt->last_level; level++) {
- unsigned nr_images = pt->target == PIPE_TEXTURE_3D ? depth : 6;
- int x = 0;
- int y = 0;
- unsigned q, j;
-
- i915_miptree_set_level_info(tex, level, nr_images,
- 0, tex->total_height,
- width, height, depth);
-
- for (q = 0; q < nr_images;) {
- for (j = 0; j < pack_x_nr && q < nr_images; j++, q++) {
- i915_miptree_set_image_offset(tex, level, q, x, y);
- x += pack_x_pitch;
- }
-
- x = 0;
- y += pack_y_pitch;
- }
-
-
- tex->total_height += y;
-
- if (pack_x_pitch > 4) {
- pack_x_pitch >>= 1;
- pack_x_nr <<= 1;
- assert(pack_x_pitch * pack_x_nr <= tex->pitch);
- }
-
- if (pack_y_pitch > 2) {
- pack_y_pitch >>= 1;
- }
-
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
- }
- break;
- }
-
- case PIPE_TEXTURE_1D:
- case PIPE_TEXTURE_2D:
-// case PIPE_TEXTURE_RECTANGLE:
- i945_miptree_layout_2d(tex);
- break;
- default:
- assert(0);
- return FALSE;
- }
-
- /*
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- tex->pitch,
- tex->total_height, pt->cpp, tex->pitch * tex->total_height * pt->cpp);
- */
-
- return TRUE;
-}
-
-
-struct pipe_texture *
-i915_texture_create(struct pipe_context *pipe,
- const struct pipe_texture *templat)
-{
- struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
-
- if (tex) {
- struct i915_context *i915 = i915_context(pipe);
-
- tex->base = *templat;
-
- if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
- i915_miptree_layout(pipe, tex))
- tex->buffer = pipe->winsys->buffer_create(pipe->winsys, 64,
- PIPE_BUFFER_USAGE_PIXEL,
- tex->pitch * tex->base.cpp *
- tex->total_height);
-
- if (!tex->buffer) {
- FREE(tex);
- return NULL;
- }
- }
-
- return &tex->base;
-}
-
-
-void
-i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
-{
- if (!*pt)
- return;
-
- /*
- DBG("%s %p refcount will be %d\n",
- __FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
- */
- if (--(*pt)->refcount <= 0) {
- struct i915_texture *tex = (struct i915_texture *)*pt;
- uint i;
-
- /*
- DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
- */
-
- pipe_buffer_reference(pipe->winsys, &tex->buffer, NULL);
-
- for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
- if (tex->image_offset[i])
- FREE(tex->image_offset[i]);
-
- FREE(tex);
- }
- *pt = NULL;
-}
diff --git a/src/mesa/pipe/i915simple/i915_texture.h b/src/mesa/pipe/i915simple/i915_texture.h
deleted file mode 100644
index 330d111dc78..00000000000
--- a/src/mesa/pipe/i915simple/i915_texture.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#ifndef I915_TEXTURE_H
-#define I915_TEXTURE_H
-
-struct pipe_context;
-struct pipe_texture;
-
-
-struct pipe_texture *
-i915_texture_create(struct pipe_context *pipe,
- const struct pipe_texture *templat);
-
-extern void
-i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
-
-
-#endif /* I915_TEXTURE_H */
diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h
deleted file mode 100644
index fe49710852b..00000000000
--- a/src/mesa/pipe/i915simple/i915_winsys.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * \file
- * This is the interface that i915simple requires any window system
- * hosting it to implement. This is the only include file in i915simple
- * which is public.
- *
- */
-
-#ifndef I915_WINSYS_H
-#define I915_WINSYS_H
-
-
-#include "pipe/p_defines.h"
-
-
-/* Pipe drivers are (meant to be!) independent of both GL and the
- * window system. The window system provides a buffer manager and a
- * set of additional hooks for things like command buffer submission,
- * etc.
- *
- * There clearly has to be some agreement between the window system
- * driver and the hardware driver about the format of command buffers,
- * etc.
- */
-
-struct pipe_buffer;
-struct pipe_winsys;
-
-
-/**
- * Additional winsys interface for i915simple.
- *
- * It is an over-simple batchbuffer mechanism. Will want to improve the
- * performance of this, perhaps based on the cmdstream stuff. It
- * would be pretty impossible to implement swz on top of this
- * interface.
- *
- * Will also need additions/changes to implement static/dynamic
- * indirect state.
- */
-struct i915_winsys {
-
- /**
- * Reserve space on batch buffer.
- *
- * Returns a null pointer if there is insufficient space in the batch buffer
- * to hold the requested number of dwords and relocations.
- *
- * The number of dwords should also include the number of relocations.
- */
- unsigned *(*batch_start)( struct i915_winsys *sws,
- unsigned dwords,
- unsigned relocs );
-
- void (*batch_dword)( struct i915_winsys *sws,
- unsigned dword );
-
- /**
- * Emit a relocation to a buffer.
- *
- * Used not only when the buffer addresses are not pinned, but also to
- * ensure refered buffers will not be destroyed until the current batch
- * buffer execution is finished.
- *
- * The access flags is a combination of I915_BUFFER_ACCESS_WRITE and
- * I915_BUFFER_ACCESS_READ macros.
- */
- void (*batch_reloc)( struct i915_winsys *sws,
- struct pipe_buffer *buf,
- unsigned access_flags,
- unsigned delta );
-
- void (*batch_flush)( struct i915_winsys *sws );
- void (*batch_finish)( struct i915_winsys *sws );
-};
-
-#define I915_BUFFER_ACCESS_WRITE 0x1
-#define I915_BUFFER_ACCESS_READ 0x2
-
-#define I915_BUFFER_USAGE_LIT_VERTEX (PIPE_BUFFER_USAGE_CUSTOM << 0)
-
-
-struct pipe_context *i915_create( struct pipe_winsys *,
- struct i915_winsys *,
- unsigned pci_id );
-
-
-#endif