diff options
author | Eric Anholt <[email protected]> | 2011-10-20 15:06:54 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-10-28 11:20:30 -0700 |
commit | de22b9018f2516a3948d920c6bb1ffe659d7f230 (patch) | |
tree | 670f04a88927f5c3bbae66054d0c926d06308d1d /src/mesa/drivers/dri/r600 | |
parent | 2f4c7ebea683de1d84501cfd11dbb963e7c027f6 (diff) |
r300c, r600c: Remove these DRI drivers.
They have been superseded by the gallium equivalents.
Acked-by: Michel Dänzer <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Acked-by: Corbin Simpson <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/r600')
111 files changed, 0 insertions, 42923 deletions
diff --git a/src/mesa/drivers/dri/r600/Lindent b/src/mesa/drivers/dri/r600/Lindent deleted file mode 100755 index 7d8d8896e30..00000000000 --- a/src/mesa/drivers/dri/r600/Lindent +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile deleted file mode 100644 index 7c15795014e..00000000000 --- a/src/mesa/drivers/dri/r600/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# src/mesa/drivers/dri/r300/Makefile - -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = r600_dri.so - -include ../Makefile.defines - -ifeq ($(RADEON_LDFLAGS),) -CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c -endif - -RADEON_COMMON_SOURCES = \ - radeon_bo_legacy.c \ - radeon_common_context.c \ - radeon_buffer_objects.c \ - radeon_common.c \ - radeon_cs_legacy.c \ - radeon_dma.c \ - radeon_debug.c \ - radeon_fbo.c \ - radeon_lock.c \ - radeon_mipmap_tree.c \ - radeon_pixel_read.c \ - radeon_queryobj.c \ - radeon_span.c \ - radeon_texture.c \ - radeon_tex_copy.c \ - radeon_tile.c - -DRIVER_SOURCES = \ - radeon_screen.c \ - r600_context.c \ - r600_cmdbuf.c \ - r600_emit.c \ - r700_assembler.c \ - r700_fragprog.c \ - r700_vertprog.c \ - r700_shader.c \ - r700_shaderinst.c \ - r700_ioctl.c \ - r700_oglprog.c \ - r700_chip.c \ - r700_state.c \ - r700_clear.c \ - r700_render.c \ - r600_tex.c \ - r600_texstate.c \ - r600_blit.c \ - r700_debug.c \ - evergreen_context.c \ - evergreen_state.c \ - evergreen_tex.c \ - evergreen_ioctl.c \ - evergreen_render.c \ - evergreen_chip.c \ - evergreen_vertprog.c \ - evergreen_fragprog.c \ - evergreen_oglprog.c \ - evergreen_blit.c \ - $(RADEON_COMMON_SOURCES) \ - $(EGL_SOURCES) \ - $(CS_SOURCES) - -C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES) - -DRIVER_DEFINES = -DRADEON_R600 -# -DRADEON_BO_TRACK \ - -INCLUDES += $(RADEON_CFLAGS) -DRI_LIB_DEPS += $(RADEON_LDFLAGS) - -##### TARGETS ##### - -include ../Makefile.targets - diff --git a/src/mesa/drivers/dri/r600/defaultendian.h b/src/mesa/drivers/dri/r600/defaultendian.h deleted file mode 100644 index 75bd61c3cd4..00000000000 --- a/src/mesa/drivers/dri/r600/defaultendian.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#ifndef _DEFINEENDIAN_H_ -#define _DEFINEENDIAN_H_ - -//We have to choose a reg bits orientation if there is no compile flag for it. -#ifdef MESA_BIG_ENDIAN -#define BIGENDIAN_CPU -#else -#define LITTLEENDIAN_CPU -#endif - -#endif //_DEFINEENDIAN_H_ diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.c b/src/mesa/drivers/dri/r600/evergreen_blit.c deleted file mode 100644 index f51bbc602a0..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_blit.c +++ /dev/null @@ -1,2014 +0,0 @@ -/* - * Copyright (C) 2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_common.h" -#include "r600_context.h" - -#include "evergreen_off.h" -#include "evergreen_diff.h" - -#include "evergreen_blit.h" -#include "evergreen_blit_shaders.h" -#include "r600_cmdbuf.h" - -/* common formats supported as both textures and render targets */ -unsigned evergreen_check_blit(gl_format mesa_format) -{ - switch (mesa_format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - case MESA_FORMAT_RGB332: - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: - case MESA_FORMAT_L8: - case MESA_FORMAT_RGBA_FLOAT32: - case MESA_FORMAT_RGBA_FLOAT16: - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z16: - case MESA_FORMAT_Z32: - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SLA8: - case MESA_FORMAT_SL8: - break; - default: - return 0; - } - - /* ??? */ - /* not sure blit to depth works or not yet */ - if (_mesa_get_format_bits(mesa_format, GL_DEPTH_BITS) > 0) - return 0; - - return 1; -} - -static inline void -eg_set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_format, - int nPitchInPixel, int w, int h, intptr_t dst_offset) -{ - uint32_t cb_color0_base, cb_color0_info = 0; - uint32_t cb_color0_pitch = 0, cb_color0_slice = 0, cb_color0_attrib = 0; - int id = 0; - uint32_t endian, comp_swap, format, source_format, number_type; - BATCH_LOCALS(&context->radeon); - - cb_color0_base = dst_offset / 256; - endian = ENDIAN_NONE; - - /* pitch */ - SETfield(cb_color0_pitch, (nPitchInPixel / 8) - 1, - EG_CB_COLOR0_PITCH__TILE_MAX_shift, - EG_CB_COLOR0_PITCH__TILE_MAX_mask); - - /* slice */ - SETfield(cb_color0_slice, - ((nPitchInPixel * h) / 64) - 1, - EG_CB_COLOR0_SLICE__TILE_MAX_shift, - EG_CB_COLOR0_SLICE__TILE_MAX_mask); - - /* CB_COLOR0_ATTRIB */ /* TODO : for z clear, this should be set to 0 */ - SETbit(cb_color0_attrib, - EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit); - - SETfield(cb_color0_info, - ARRAY_LINEAR_GENERAL, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - - SETbit(cb_color0_info, EG_CB_COLOR0_INFO__BLEND_BYPASS_bit); - - switch(mesa_format) { - case MESA_FORMAT_RGBA8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_SIGNED_RGBA8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_SNORM; - source_format = 1; - break; - case MESA_FORMAT_RGBA8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_SIGNED_RGBA8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_SNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB565: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_5_6_5; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB565_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_5_6_5; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB4444: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB4444_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB1555: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB1555_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_AL88: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_AL88_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB332: - format = COLOR_3_3_2; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_A8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_I8: - format = COLOR_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_L8: - format = COLOR_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGBA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_32_32_32_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_RGBA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_16_16_16_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_ALPHA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_ALPHA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 0; - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_24; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(cb_color0_info, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z24_S8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_24_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(cb_color0_info, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(cb_color0_info, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(cb_color0_info, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_SARGB8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_SRGB; - source_format = 1; - break; - case MESA_FORMAT_SLA8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - source_format = 1; - break; - case MESA_FORMAT_SL8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - source_format = 1; - break; - default: - fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format)); - assert("Invalid format for US output\n"); - return; - } - - SETfield(cb_color0_info, - endian, - EG_CB_COLOR0_INFO__ENDIAN_shift, - EG_CB_COLOR0_INFO__ENDIAN_mask); - SETfield(cb_color0_info, - format, - EG_CB_COLOR0_INFO__FORMAT_shift, - EG_CB_COLOR0_INFO__FORMAT_mask); - SETfield(cb_color0_info, - comp_swap, - EG_CB_COLOR0_INFO__COMP_SWAP_shift, - EG_CB_COLOR0_INFO__COMP_SWAP_mask); - SETfield(cb_color0_info, - number_type, - EG_CB_COLOR0_INFO__NUMBER_TYPE_shift, - EG_CB_COLOR0_INFO__NUMBER_TYPE_mask); - SETfield(cb_color0_info, - source_format, - EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift, - EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_BASE + (4 * id), 1); - R600_OUT_BATCH(cb_color0_base); - R600_OUT_BATCH_RELOC(cb_color0_base, - bo, - cb_color0_base, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR0_INFO, cb_color0_info); - R600_OUT_BATCH_RELOC(cb_color0_info, - bo, - cb_color0_info, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(5); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_PITCH, 3); - R600_OUT_BATCH(cb_color0_pitch); - R600_OUT_BATCH(cb_color0_slice); - R600_OUT_BATCH(0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2); - R600_OUT_BATCH(cb_color0_attrib); - R600_OUT_BATCH(0); - /* - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK_SLICE.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All); - */ - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void eg_load_shaders(struct gl_context * ctx) -{ - - radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); - context_t *context = EVERGREEN_CONTEXT(ctx); - int i, size; - uint32_t *shader; - - if (context->blit_bo_loaded == 1) - return; - - size = 4096; - context->blit_bo = radeon_bo_open(radeonctx->radeonScreen->bom, 0, - size, 256, RADEON_GEM_DOMAIN_GTT, 0); - radeon_bo_map(context->blit_bo, 1); - shader = context->blit_bo->ptr; - - for(i=0; i<sizeof(evergreen_vs)/4; i++) { - shader[128+i] = CPU_TO_LE32(evergreen_vs[i]); - } - for(i=0; i<sizeof(evergreen_ps)/4; i++) { - shader[256+i] = CPU_TO_LE32(evergreen_ps[i]); - } - - radeon_bo_unmap(context->blit_bo); - context->blit_bo_loaded = 1; - -} - -static inline void -eg_set_shaders(context_t *context) -{ - struct radeon_bo * pbo = context->blit_bo; - uint32_t sq_pgm_start_fs = (512 >> 8); - uint32_t sq_pgm_resources_fs = 0; - - uint32_t sq_pgm_start_vs = (512 >> 8); - uint32_t sq_pgm_resources_vs = (2 << NUM_GPRS_shift); - - uint32_t sq_pgm_start_ps = (1024 >> 8); - uint32_t sq_pgm_resources_ps = (1 << NUM_GPRS_shift); - uint32_t sq_pgm_exports_ps = (1 << 1); - BATCH_LOCALS(&context->radeon); - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - /* FS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_FS, 1); - R600_OUT_BATCH(sq_pgm_start_fs); - R600_OUT_BATCH_RELOC(sq_pgm_start_fs, - pbo, - sq_pgm_start_fs, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_PGM_RESOURCES_FS, sq_pgm_resources_fs); - END_BATCH(); - - /* VS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_VS, 1); - R600_OUT_BATCH(sq_pgm_start_vs); - R600_OUT_BATCH_RELOC(sq_pgm_start_vs, - pbo, - sq_pgm_start_vs, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_VS, 2); - R600_OUT_BATCH(sq_pgm_resources_vs); - R600_OUT_BATCH(0); - END_BATCH(); - - /* PS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_PS, 1); - R600_OUT_BATCH(sq_pgm_start_ps); - R600_OUT_BATCH_RELOC(sq_pgm_start_ps, - pbo, - sq_pgm_start_ps, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(5); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_PS, 3); - R600_OUT_BATCH(sq_pgm_resources_ps); - R600_OUT_BATCH(0); - R600_OUT_BATCH(sq_pgm_exports_ps); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void -eg_set_vtx_resource(context_t *context) -{ - struct radeon_bo *bo = context->blit_bo; - uint32_t sq_vtx_constant_word3 = 0; - uint32_t sq_vtx_constant_word2 = 0; - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - END_BATCH(); - - if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR) - r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); - else - r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - - SETfield(sq_vtx_constant_word3, SQ_SEL_X, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask); - SETfield(sq_vtx_constant_word3, SQ_SEL_Y, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask); - SETfield(sq_vtx_constant_word3, SQ_SEL_Z, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask); - SETfield(sq_vtx_constant_word3, SQ_SEL_W, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask); - - sq_vtx_constant_word2 = 0 -#ifdef MESA_BIG_ENDIAN - | (SQ_ENDIAN_8IN32 << SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift) -#endif - | (16 << SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift); - - BEGIN_BATCH_NO_AUTOSTATE(10 + 2); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); - R600_OUT_BATCH(EG_SQ_FETCH_RESOURCE_VS_OFFSET * EG_FETCH_RESOURCE_STRIDE); - R600_OUT_BATCH(0); - R600_OUT_BATCH(48 - 1); - R600_OUT_BATCH(sq_vtx_constant_word2); - R600_OUT_BATCH(sq_vtx_constant_word3); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(SQ_TEX_VTX_VALID_BUFFER << SQ_TEX_RESOURCE_WORD6_0__TYPE_shift); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - -} - -static inline void -eg_set_tex_resource(context_t * context, - gl_format mesa_format, struct radeon_bo *bo, int w, int h, - int TexelPitch, intptr_t src_offset) -{ - uint32_t sq_tex_resource0, sq_tex_resource1, sq_tex_resource2, sq_tex_resource4, sq_tex_resource7; - - sq_tex_resource0 = sq_tex_resource1 = sq_tex_resource2 = sq_tex_resource4 = sq_tex_resource7 = 0; - BATCH_LOCALS(&context->radeon); - - SETfield(sq_tex_resource0, SQ_TEX_DIM_2D, DIM_shift, DIM_mask); - SETfield(sq_tex_resource0, ARRAY_LINEAR_GENERAL, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - - switch (mesa_format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_ARGB8888: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_XRGB8888: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB8888_REV: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_XRGB8888_REV: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB565: - SETfield(sq_tex_resource7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB565_REV: - SETfield(sq_tex_resource7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB4444: - SETfield(sq_tex_resource7, FMT_4_4_4_4, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB4444_REV: - SETfield(sq_tex_resource7, FMT_4_4_4_4, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB1555: - SETfield(sq_tex_resource7, FMT_1_5_5_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB1555_REV: - SETfield(sq_tex_resource7, FMT_1_5_5_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: /* TODO : Check this. */ - SETfield(sq_tex_resource7, FMT_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB332: - SETfield(sq_tex_resource7, FMT_3_3_2, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_L8: /* X, X, X, ONE */ - SETfield(sq_tex_resource7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_I8: /* X, X, X, X */ - SETfield(sq_tex_resource7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT32: - SETfield(sq_tex_resource7, FMT_32_32_32_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT16: - SETfield(sq_tex_resource7, FMT_16_16_16_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */ - SETfield(sq_tex_resource7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */ - SETfield(sq_tex_resource7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - SETfield(sq_tex_resource7, FMT_32_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - SETfield(sq_tex_resource7, FMT_16_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - SETfield(sq_tex_resource7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - SETfield(sq_tex_resource7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z16: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETfield(sq_tex_resource7, FMT_16, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_X8_Z24: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETfield(sq_tex_resource7, FMT_8_24, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_S8_Z24: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource7, FMT_8_24, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z24_S8: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource7, FMT_24_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z32: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource7, FMT_32, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_S8: - /* ??? */ - CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - SETfield(sq_tex_resource7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_SARGB8: - SETfield(sq_tex_resource7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SLA8: - SETfield(sq_tex_resource7, FMT_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SL8: /* X, X, X, ONE */ - SETfield(sq_tex_resource7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - default: - fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format)); - assert("Invalid format for US output\n"); - return; - }; - - SETfield(sq_tex_resource0, (TexelPitch/8)-1, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); - SETfield(sq_tex_resource0, w - 1, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask); - SETfield(sq_tex_resource1, h - 1, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask); - - sq_tex_resource2 = src_offset / 256; - - SETfield(sq_tex_resource7, SQ_TEX_VTX_VALID_TEXTURE, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, - SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - r700SyncSurf(context, bo, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, - 0, TC_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(10 + 4); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); - R600_OUT_BATCH(0 * 7); - R600_OUT_BATCH(sq_tex_resource0); - R600_OUT_BATCH(sq_tex_resource1); - R600_OUT_BATCH(sq_tex_resource2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(sq_tex_resource4); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(sq_tex_resource7); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - END_BATCH(); - COMMIT_BATCH(); -} - -static inline void -eg_set_tex_sampler(context_t * context) -{ - uint32_t sq_tex_sampler_word0 = 0, sq_tex_sampler_word1 = 0, sq_tex_sampler_word2 = 0; - int i = 0; - - SETbit(sq_tex_sampler_word2, EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit); - - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(5); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); - R600_OUT_BATCH(i * 3); - R600_OUT_BATCH(sq_tex_sampler_word0); - R600_OUT_BATCH(sq_tex_sampler_word1); - R600_OUT_BATCH(sq_tex_sampler_word2); - END_BATCH(); - -} - -static inline void -eg_set_scissors(context_t *context, int x1, int y1, int x2, int y2) -{ - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(17); - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_SCREEN_SCISSOR_TL, 2); - R600_OUT_BATCH((x1 << 0) | (y1 << 16)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_WINDOW_OFFSET, 3); - R600_OUT_BATCH(0); //PA_SC_WINDOW_OFFSET - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); //PA_SC_WINDOW_SCISSOR_TL - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_GENERIC_SCISSOR_TL, 2); - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - /* XXX 16 of these PA_SC_VPORT_SCISSOR_0_TL_num ... */ - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_SCISSOR_0_TL, 2); - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void -eg_set_vb_data(context_t * context, int src_x, int src_y, int dst_x, int dst_y, - int w, int h, int src_h, unsigned flip_y) -{ - float *vb; - radeon_bo_map(context->blit_bo, 1); - vb = context->blit_bo->ptr; - - vb[0] = (float)(dst_x); - vb[1] = (float)(dst_y); - vb[2] = (float)(src_x); - vb[3] = (flip_y) ? (float)(src_h - src_y) : (float)src_y; - - vb[4] = (float)(dst_x); - vb[5] = (float)(dst_y + h); - vb[6] = (float)(src_x); - vb[7] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h); - - vb[8] = (float)(dst_x + w); - vb[9] = (float)(dst_y + h); - vb[10] = (float)(src_x + w); - vb[11] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h); - - radeon_bo_unmap(context->blit_bo); - -} - -static inline void -eg_draw_auto(context_t *context) -{ - BATCH_LOCALS(&context->radeon); - uint32_t vgt_primitive_type = 0, vgt_index_type = 0, vgt_draw_initiator = 0, vgt_num_indices; - - SETfield(vgt_primitive_type, DI_PT_RECTLIST, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, - INDEX_TYPE_mask); - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, - MAJOR_MODE_mask); - SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, - SOURCE_SELECT_mask); - - vgt_num_indices = 3; - - BEGIN_BATCH_NO_AUTOSTATE(10); - // prim - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - // - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - - END_BATCH(); - COMMIT_BATCH(); -} - -static inline void -eg_set_default_state(context_t *context) -{ - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_hs_gprs; - int num_ls_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_hs_threads; - int num_ls_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - int num_hs_stack_entries; - int num_ls_stack_entries; - uint32_t sq_config = 0, sq_gpr_resource_mgmt_1 = 0, sq_gpr_resource_mgmt_2 = 0; - uint32_t sq_gpr_resource_mgmt_3 = 0; - uint32_t sq_thread_resource_mgmt = 0, sq_thread_resource_mgmt_2 = 0; - uint32_t sq_stack_resource_mgmt_1 = 0, sq_stack_resource_mgmt_2 = 0, sq_stack_resource_mgmt_3 = 0; - BATCH_LOCALS(&context->radeon); - - switch (context->radeon.radeonScreen->chip_family) { - case CHIP_FAMILY_CEDAR: - default: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 96; - num_vs_threads = 16; - num_gs_threads = 16; - num_es_threads = 16; - num_hs_threads = 16; - num_ls_threads = 16; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_FAMILY_REDWOOD: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_FAMILY_JUNIPER: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - case CHIP_FAMILY_CYPRESS: - case CHIP_FAMILY_HEMLOCK: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - case CHIP_FAMILY_PALM: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 96; - num_vs_threads = 16; - num_gs_threads = 16; - num_es_threads = 16; - num_hs_threads = 16; - num_ls_threads = 16; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_FAMILY_SUMO: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 96; - num_vs_threads = 25; - num_gs_threads = 25; - num_es_threads = 25; - num_hs_threads = 25; - num_ls_threads = 25; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_FAMILY_SUMO2: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 96; - num_vs_threads = 25; - num_gs_threads = 25; - num_es_threads = 25; - num_hs_threads = 25; - num_ls_threads = 25; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - case CHIP_FAMILY_BARTS: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - case CHIP_FAMILY_TURKS: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_FAMILY_CAICOS: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 10; - num_gs_threads = 10; - num_es_threads = 10; - num_hs_threads = 10; - num_ls_threads = 10; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - } - - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_PALM) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_SUMO) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_SUMO2) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CAICOS)) - CLEARbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit); - else - SETbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit); - SETbit(sq_config, EG_SQ_CONFIG__EXPORT_SRC_C_bit); - - SETfield(sq_config, 0, - EG_SQ_CONFIG__PS_PRIO_shift, - EG_SQ_CONFIG__PS_PRIO_mask); - SETfield(sq_config, 1, - EG_SQ_CONFIG__VS_PRIO_shift, - EG_SQ_CONFIG__VS_PRIO_mask); - SETfield(sq_config, 2, - EG_SQ_CONFIG__GS_PRIO_shift, - EG_SQ_CONFIG__GS_PRIO_mask); - SETfield(sq_config, 3, - EG_SQ_CONFIG__ES_PRIO_shift, - EG_SQ_CONFIG__ES_PRIO_mask); - - - SETfield(sq_gpr_resource_mgmt_1, num_ps_gprs, - NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_1, num_vs_gprs, - NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_1, num_temp_gprs, - NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_2, num_gs_gprs, - NUM_GS_GPRS_shift, NUM_GS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_2, num_es_gprs, - NUM_ES_GPRS_shift, NUM_ES_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_3, num_hs_gprs, - NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_3, num_ls_gprs, - NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - - SETfield(sq_thread_resource_mgmt, num_ps_threads, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_vs_threads, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_gs_threads, - NUM_GS_THREADS_shift, NUM_GS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_es_threads, - NUM_ES_THREADS_shift, NUM_ES_THREADS_mask); - SETfield(sq_thread_resource_mgmt_2, num_hs_threads, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(sq_thread_resource_mgmt_2, num_ls_threads, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - - SETfield(sq_stack_resource_mgmt_1, num_ps_stack_entries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_1, num_vs_stack_entries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_2, num_gs_stack_entries, - NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_2, num_es_stack_entries, - NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_3, num_hs_stack_entries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_3, num_ls_stack_entries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - - - BEGIN_BATCH_NO_AUTOSTATE(196); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0); - //6 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_CONFIG, 4); - R600_OUT_BATCH(sq_config); - R600_OUT_BATCH(sq_gpr_resource_mgmt_1); - R600_OUT_BATCH(sq_gpr_resource_mgmt_2); - R600_OUT_BATCH(sq_gpr_resource_mgmt_3); - //7 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_THREAD_RESOURCE_MGMT, 5); - R600_OUT_BATCH(sq_thread_resource_mgmt); - R600_OUT_BATCH(sq_thread_resource_mgmt_2); - R600_OUT_BATCH(sq_stack_resource_mgmt_1); - R600_OUT_BATCH(sq_stack_resource_mgmt_2); - R600_OUT_BATCH(sq_stack_resource_mgmt_3); - //3 - R600_OUT_BATCH(CP_PACKET3(R600_IT_CONTEXT_CONTROL, 1)); - R600_OUT_BATCH(0x80000000); - R600_OUT_BATCH(0x80000000); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_LDS_ALLOC_PS, 0); - //8 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ESGS_RING_ITEMSIZE, 6); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //6 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_GS_VERT_ITEMSIZE, 4); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_DEPTH_CONTROL, 0); - //7 - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_RENDER_CONTROL, 5); - R600_OUT_BATCH(0x00000060); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x0000002a); - R600_OUT_BATCH(0); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_STENCIL_CLEAR, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_ALPHA_TO_MASK, 0x0000aa00); - //15 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_CLIPRECT_RULE, 13); - R600_OUT_BATCH(0x0000ffff); - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH(0x20002000); - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH(0x20002000); - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH(0x20002000); - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH(0x20002000); - R600_OUT_BATCH(0xaaaaaaaa); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x0000000f); - R600_OUT_BATCH(0x0000000f); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_ZMIN_0, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x3f800000); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SX_MISC, 0); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_MODE_CNTL_0, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //18 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_LINE_CNTL, 16); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x00000005); - R600_OUT_BATCH(0x3f800000); - R600_OUT_BATCH(0x3f800000); - R600_OUT_BATCH(0x3f800000); - R600_OUT_BATCH(0x3f800000); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0xffffffff); - //15 - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR_CONTROL, 13); - R600_OUT_BATCH(0x00cc0010); - R600_OUT_BATCH(0x00000210); - R600_OUT_BATCH(0x00010000); - R600_OUT_BATCH(0x00000004); - R600_OUT_BATCH(0x00000100); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //8 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 6); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //11 - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_MAX_VTX_INDX, 9); - R600_OUT_BATCH(0x00ffffff); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_INSTANCE_STEP_RATE_0, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_REUSE_OFF, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //19 - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POINT_SIZE, 17); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x00000008); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_PRIMITIVEID_EN, 0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_MULTI_PRIM_IB_RESET_EN, 0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_SHADER_STAGES_EN, 0); - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_STRMOUT_CONFIG, 2); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND0_CONTROL, 0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_VS_OUT_CONFIG, 0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_VS_OUT_ID_0, 0); - //3 - EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_PS_INPUT_CNTL_0, 0); - //13 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_PS_IN_CONTROL_0, 11); - R600_OUT_BATCH(0x20000001); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0x00100000); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - - END_BATCH(); - COMMIT_BATCH(); -} - -static GLboolean eg_validate_buffers(context_t *rmesa, - struct radeon_bo *src_bo, - struct radeon_bo *dst_bo) -{ - int ret; - - radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT); - if (ret) - return GL_FALSE; - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - rmesa->blit_bo, - RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - - return GL_TRUE; -} - -unsigned evergreen_blit(struct gl_context *ctx, - struct radeon_bo *src_bo, - intptr_t src_offset, - gl_format src_mesaformat, - unsigned src_pitch, - unsigned src_width, - unsigned src_height, - unsigned src_x, - unsigned src_y, - struct radeon_bo *dst_bo, - intptr_t dst_offset, - gl_format dst_mesaformat, - unsigned dst_pitch, - unsigned dst_width, - unsigned dst_height, - unsigned dst_x, - unsigned dst_y, - unsigned w, - unsigned h, - unsigned flip_y) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - int id = 0; - - if (!evergreen_check_blit(dst_mesaformat)) - return GL_FALSE; - - if (src_bo == dst_bo) { - return GL_FALSE; - } - - if (src_offset % 256 || dst_offset % 256) { - return GL_FALSE; - } - - if (0) { - fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n", - src_width, src_height, src_pitch, - _mesa_format_row_stride(src_mesaformat, src_width), - _mesa_get_format_name(src_mesaformat)); - fprintf(stderr, "dst: width %d, height %d, pitch %d, format %s\n", - dst_width, dst_height, - _mesa_format_row_stride(dst_mesaformat, dst_width), - _mesa_get_format_name(dst_mesaformat)); - } - - /* Flush is needed to make sure that source buffer has correct data */ - radeonFlush(ctx); - - rcommonEnsureCmdBufSpace(&context->radeon, 327, __FUNCTION__); - - /* load shaders */ - eg_load_shaders(context->radeon.glCtx); - - if (!eg_validate_buffers(context, src_bo, dst_bo)) - return GL_FALSE; - - /* set clear state */ - /* 196 */ - eg_set_default_state(context); - - /* shaders */ - /* 34 */ - eg_set_shaders(context); - - /* src */ - /* 21 */ - eg_set_tex_resource(context, src_mesaformat, src_bo, - src_width, src_height, src_pitch, src_offset); - - /* 5 */ - eg_set_tex_sampler(context); - - /* dst */ - /* 19 */ - eg_set_render_target(context, dst_bo, dst_mesaformat, - dst_pitch, dst_width, dst_height, dst_offset); - /* scissors */ - /* 17 */ - eg_set_scissors(context, dst_x, dst_y, dst_x + dst_width, dst_y + dst_height); - - eg_set_vb_data(context, src_x, src_y, dst_x, dst_y, w, h, src_height, flip_y); - /* Vertex buffer setup */ - /* 18 */ - eg_set_vtx_resource(context); - - /* draw */ - /* 10 */ - eg_draw_auto(context); - - /* 7 */ - r700SyncSurf(context, dst_bo, 0, - RADEON_GEM_DOMAIN_VRAM|RADEON_GEM_DOMAIN_GTT, - CB_ACTION_ENA_bit | (1 << (id + 6))); - - radeonFlush(ctx); - - return GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.h b/src/mesa/drivers/dri/r600/evergreen_blit.h deleted file mode 100644 index 783f83f0899..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_blit.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 EVERGREEN_BLIT_H -#define EVERGREEN_BLIT_H - -unsigned evergreen_check_blit(gl_format mesa_format); - -unsigned evergreen_blit(struct gl_context *ctx, - struct radeon_bo *src_bo, - intptr_t src_offset, - gl_format src_mesaformat, - unsigned src_pitch, - unsigned src_width, - unsigned src_height, - unsigned src_x_offset, - unsigned src_y_offset, - struct radeon_bo *dst_bo, - intptr_t dst_offset, - gl_format dst_mesaformat, - unsigned dst_pitch, - unsigned dst_width, - unsigned dst_height, - unsigned dst_x_offset, - unsigned dst_y_offset, - unsigned w, - unsigned h, - unsigned flip_y); - -#endif // EVERGREEN_BLIT_H diff --git a/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h b/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h deleted file mode 100644 index 84f20f8cafb..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - */ - -const uint32_t evergreen_vs[] = -{ - 0x00000004, - 0x80800400, - 0x0000a03c, - 0x95000688, - 0x00004000, - 0x15200688, - 0x00000000, - 0x00000000, - 0x3c000000, - 0x67961001, -#ifdef MESA_BIG_ENDIAN - 0x000a0000, -#else - 0x00080000, -#endif - 0x00000000, - 0x1c000000, - 0x67961000, -#ifdef MESA_BIG_ENDIAN - 0x00020008, -#else - 0x00000008, -#endif - 0x00000000, -}; - -const uint32_t evergreen_ps[] = -{ - 0x00000003, - 0xa00c0000, - 0x00000008, - 0x80400000, - 0x00000000, - 0x95200688, - 0x00380400, - 0x00146b10, - 0x00380000, - 0x20146b10, - 0x00380400, - 0x40146b00, - 0x80380000, - 0x60146b00, - 0x00000000, - 0x00000000, - 0x00000010, - 0x000d1000, - 0xb0800000, - 0x00000000, -}; - diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c deleted file mode 100644 index 42ecd2d8276..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ /dev/null @@ -1,1552 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/imports.h" -#include "main/glheader.h" -#include "main/simple_list.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" - -#include "evergreen_chip.h" -#include "evergreen_off.h" -#include "evergreen_diff.h" -#include "evergreen_fragprog.h" -#include "evergreen_vertprog.h" - -#include "radeon_mipmap_tree.h" - -void evergreenCreateChip(context_t *context) -{ - EVERGREEN_CHIP_CONTEXT * evergreen = - (EVERGREEN_CHIP_CONTEXT*) CALLOC(sizeof(EVERGREEN_CHIP_CONTEXT)); - - context->pChip = (void*)evergreen; -} - -#define EVERGREEN_ALLOC_STATE( ATOM, CHK, SZ, EMIT ) \ -do { \ - context->evergreen_atoms.ATOM.cmd_size = (SZ); \ - context->evergreen_atoms.ATOM.cmd = NULL; \ - context->evergreen_atoms.ATOM.name = #ATOM; \ - context->evergreen_atoms.ATOM.idx = 0; \ - context->evergreen_atoms.ATOM.check = check_##CHK; \ - context->evergreen_atoms.ATOM.dirty = GL_FALSE; \ - context->evergreen_atoms.ATOM.emit = (EMIT); \ - context->radeon.hw.max_state_size += (SZ); \ - insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \ -} while (0) - -static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - struct radeon_query_object *query = radeon->query.current; - int count; - - if (!query || query->emitted_begin) - count = 0; - else - count = atom->cmd_size; - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count; -} - -static void evergreenSendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - struct radeon_query_object *query = radeon->query.current; - BATCH_LOCALS(radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - /* clear the buffer */ - radeon_bo_map(query->bo, GL_FALSE); - memset(query->bo->ptr, 0, 8 * 2 * sizeof(uint64_t)); /* 8 DBs, 2 qwords each */ - radeon_bo_unmap(query->bo); - - radeon_cs_space_check_with_bo(radeon->cmdbuf.cs, - query->bo, - 0, RADEON_GEM_DOMAIN_GTT); - - BEGIN_BATCH_NO_AUTOSTATE(4 + 2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); - R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1)); - R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */ - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - query->emitted_begin = GL_TRUE; -} - -static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ) -{ - radeon->query.queryobj.cmd_size = (SZ); - radeon->query.queryobj.cmd = NULL; - radeon->query.queryobj.name = "queryobj"; - radeon->query.queryobj.idx = 0; - radeon->query.queryobj.check = check_queryobj; - radeon->query.queryobj.dirty = GL_FALSE; - radeon->query.queryobj.emit = evergreenSendQueryBegin; - radeon->hw.max_state_size += (SZ); - insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj); -} - - -static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - return atom->cmd_size; -} - -static void evergreenSendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *) context->selected_vp; - - struct radeon_bo *bo = NULL; - unsigned int i; - unsigned int nBorderSet = 0; - BATCH_LOCALS(&context->radeon); - - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = evergreen->textures[i]; - - if (t) { - /* Tex resource */ - if (!t->image_override) { - bo = t->mt->bo; - } else { - bo = t->bo; - } - if (bo) - { - - r700SyncSurf(context, bo, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, - 0, TC_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(10 + 4); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); - - if( (1<<i) & vp->r700AsmCode.unVetTexBits ) - { /* vs texture */ - R600_OUT_BATCH((i + VERT_ATTRIB_MAX + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * EG_FETCH_RESOURCE_STRIDE); - } - else - { - R600_OUT_BATCH(i * EG_FETCH_RESOURCE_STRIDE); - } - - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE0); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE1); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE2); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE3); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE4); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE5); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE6); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_RESOURCE7); - - R600_OUT_BATCH_RELOC(evergreen->textures[i]->SQ_TEX_RESOURCE2, - bo, - evergreen->textures[i]->SQ_TEX_RESOURCE2, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - R600_OUT_BATCH_RELOC(evergreen->textures[i]->SQ_TEX_RESOURCE3, - bo, - evergreen->textures[i]->SQ_TEX_RESOURCE3, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - } - /* Tex sampler */ - BEGIN_BATCH_NO_AUTOSTATE(5); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); - - if( (1<<i) & vp->r700AsmCode.unVetTexBits ) - { /* vs texture */ - R600_OUT_BATCH((i+SQ_TEX_SAMPLER_VS_OFFSET) * 3); - } - else - { - R600_OUT_BATCH(i * 3); - } - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER0); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER1); - R600_OUT_BATCH(evergreen->textures[i]->SQ_TEX_SAMPLER2); - - END_BATCH(); - COMMIT_BATCH(); - - /* Tex border color */ - if(0 == nBorderSet) - { - BEGIN_BATCH_NO_AUTOSTATE(2 + 4); - R600_OUT_BATCH_REGSEQ(EG_TD_PS_BORDER_COLOR_RED, 4); - R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_RED); - R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN); - R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE); - R600_OUT_BATCH(evergreen->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA); - END_BATCH(); - COMMIT_BATCH(); - - nBorderSet = 1; - } - } - } - } -} - -static int check_evergreen_tx(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - unsigned int i, count = 0; - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = evergreen->textures[i]; - if (t) - count++; - } - } - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count * 37 + 6; -} - -static void evergreenSendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(19); - //6 - EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_CONFIG_CNTL, evergreen->evergreen_config.SPI_CONFIG_CNTL.u32All); - EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_CONFIG_CNTL_1, evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All); - //6 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_CONFIG, 4); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_CONFIG.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All); - //7 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_THREAD_RESOURCE_MGMT, 5); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All); - R600_OUT_BATCH(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All); - - END_BATCH(); - - COMMIT_BATCH(); -} - -extern int evergreen_getTypeSize(GLenum type); -static void evergreenSetupVTXConstants(struct gl_context * ctx, - void * pAos, - StreamDesc * pStreamDesc) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct radeon_aos * paos = (struct radeon_aos *)pAos; - BATCH_LOCALS(&context->radeon); - - unsigned int uSQ_VTX_CONSTANT_WORD0_0; - unsigned int uSQ_VTX_CONSTANT_WORD1_0; - unsigned int uSQ_VTX_CONSTANT_WORD2_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD3_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD7_0 = 0; - - if (!paos->bo) - return; - - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_PALM) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_SUMO) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_SUMO2)) - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); - else - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - - //uSQ_VTX_CONSTANT_WORD0_0 - uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; - - //uSQ_VTX_CONSTANT_WORD1_0 - uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1; - - //uSQ_VTX_CONSTANT_WORD2_0 - SETfield(uSQ_VTX_CONSTANT_WORD2_0, - pStreamDesc->stride, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask); - SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(pStreamDesc->type, pStreamDesc->size, NULL), - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); // TODO : trace back api for initial data type, not only GL_FLOAT - SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); // TODO - - SETfield(uSQ_VTX_CONSTANT_WORD2_0, -#ifdef MESA_BIG_ENDIAN - SQ_ENDIAN_8IN32, -#else - SQ_ENDIAN_NONE, -#endif - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_mask); - - if(GL_TRUE == pStreamDesc->normalize) - { - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - } - else - { - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - } - if(1 == pStreamDesc->_signed) - { - SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); - } - - //uSQ_VTX_CONSTANT_WORD3_0 - SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_X, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask); - SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_Y, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask); - SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_Z, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask); - SETfield(uSQ_VTX_CONSTANT_WORD3_0, SQ_SEL_W, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask); - - //uSQ_VTX_CONSTANT_WORD7_0 - SETfield(uSQ_VTX_CONSTANT_WORD7_0, SQ_TEX_VTX_VALID_BUFFER, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - BEGIN_BATCH_NO_AUTOSTATE(10 + 2); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8)); - R600_OUT_BATCH((pStreamDesc->element + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * EG_FETCH_RESOURCE_STRIDE); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD0_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD1_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD2_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD3_0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD7_0); - R600_OUT_BATCH_RELOC(uSQ_VTX_CONSTANT_WORD0_0, - paos->bo, - uSQ_VTX_CONSTANT_WORD0_0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - COMMIT_BATCH(); -} - -static int check_evergreen_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - int count = context->radeon.tcl.aos_count * 12; - - if (count) - count += 6; - - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count; -} - -static void evergreenSendVTX(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *)(context->selected_vp); - unsigned int i, j = 0; - BATCH_LOCALS(&context->radeon); - (void) b_l_rmesa; /* silence unused var warning */ - - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (context->radeon.tcl.aos_count == 0) - return; - - for(i=0; i<VERT_ATTRIB_MAX; i++) { - if(vp->mesa_program->Base.InputsRead & (1 << i)) - { - evergreenSetupVTXConstants(ctx, - (void*)(&context->radeon.tcl.aos[j]), - &(context->stream_desc[j])); - j++; - } - } -} -static void evergreenSendPA(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - int id = 0; - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_PA_SU_HARDWARE_SCREEN_OFFSET, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(22); - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_SCREEN_SCISSOR_TL, 2); - R600_OUT_BATCH(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_WINDOW_OFFSET, 12); - R600_OUT_BATCH(evergreen->PA_SC_WINDOW_OFFSET.u32All); - R600_OUT_BATCH(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_RULE.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_0_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_0_BR.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_1_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_1_BR.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_2_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_2_BR.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_3_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_CLIPRECT_3_BR.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_GENERIC_SCISSOR_TL, 2); - R600_OUT_BATCH(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_PA_SC_EDGERULE, evergreen->PA_SC_EDGERULE.u32All); - END_BATCH(); - - - BEGIN_BATCH_NO_AUTOSTATE(18); - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_SCISSOR_0_TL, 4); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_ZMIN_0, 2); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_VPORT_XSCALE, 6); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_XSCALE.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_XOFFSET.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_YSCALE.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_YOFFSET.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_ZSCALE.u32All); - R600_OUT_BATCH(evergreen->viewport[id].PA_CL_VPORT_ZOFFSET.u32All); - END_BATCH(); - - - for (id = 0; id < EVERGREEN_MAX_UCP; id++) { - if (evergreen->ucp[id].enabled) { - BEGIN_BATCH_NO_AUTOSTATE(6); - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_UCP_0_X + (4 * id), 4); - R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_X.u32All); - R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_Y.u32All); - R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_Z.u32All); - R600_OUT_BATCH(evergreen->ucp[id].PA_CL_UCP_0_W.u32All); - END_BATCH(); - } - } - - BEGIN_BATCH_NO_AUTOSTATE(42); - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_CL_CLIP_CNTL, 5); - R600_OUT_BATCH(evergreen->PA_CL_CLIP_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_SU_SC_MODE_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_CL_VTE_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_CL_VS_OUT_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_CL_NANINF_CNTL.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POINT_SIZE, 3); - R600_OUT_BATCH(evergreen->PA_SU_POINT_SIZE.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POINT_MINMAX.u32All); - R600_OUT_BATCH(evergreen->PA_SU_LINE_CNTL.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_MODE_CNTL_0, 2); - R600_OUT_BATCH(evergreen->PA_SC_MODE_CNTL_0.u32All); - R600_OUT_BATCH(evergreen->PA_SC_MODE_CNTL_1.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 6); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_CLAMP.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_FRONT_SCALE.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_FRONT_OFFSET.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_BACK_SCALE.u32All); - R600_OUT_BATCH(evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_LINE_CNTL, 16); - R600_OUT_BATCH(evergreen->PA_SC_LINE_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_CONFIG.u32All); - R600_OUT_BATCH(evergreen->PA_SU_VTX_CNTL.u32All); - R600_OUT_BATCH(evergreen->PA_CL_GB_VERT_CLIP_ADJ.u32All); - R600_OUT_BATCH(evergreen->PA_CL_GB_VERT_DISC_ADJ.u32All); - R600_OUT_BATCH(evergreen->PA_CL_GB_HORZ_CLIP_ADJ.u32All); - R600_OUT_BATCH(evergreen->PA_CL_GB_HORZ_DISC_ADJ.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_0.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_1.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_2.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_3.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_4.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_5.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_6.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_SAMPLE_LOCS_7.u32All); - R600_OUT_BATCH(evergreen->PA_SC_AA_MASK.u32All); - - END_BATCH(); - - COMMIT_BATCH(); -} -static void evergreenSendTP(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - /* - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - COMMIT_BATCH(); - */ -} - -static void evergreenSendPSresource(struct gl_context *ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct radeon_bo * pbo; - struct radeon_bo * pbo_const; - /* const size reg is in units of 16 consts */ - int const_size = ((evergreen->ps.num_consts * 4) + 15) & ~15; - - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - pbo = (struct radeon_bo *)evergreenGetActiveFpShaderBo(GL_CONTEXT(context)); - - if (!pbo) - return; - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_PS, 1); - R600_OUT_BATCH(evergreen->ps.SQ_PGM_START_PS.u32All); - R600_OUT_BATCH_RELOC(evergreen->ps.SQ_PGM_START_PS.u32All, - pbo, - evergreen->ps.SQ_PGM_START_PS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_LOOP_CONST_0, 0x01000FFF); - END_BATCH(); - - pbo_const = (struct radeon_bo *)(context->fp_Constbo); - - if(NULL != pbo_const) - { - r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, const_size / 16); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ALU_CONST_CACHE_PS_0, 1); - R600_OUT_BATCH(context->fp_bo_offset >> 8); - R600_OUT_BATCH_RELOC(0, - pbo_const, - 0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - } - - COMMIT_BATCH(); -} - -static void evergreenSendVSresource(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct radeon_bo * pbo; - struct radeon_bo * pbo_const; - /* const size reg is in units of 16 consts */ - int const_size = ((evergreen->vs.num_consts * 4) + 15) & ~15; - - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - pbo = (struct radeon_bo *)evergreenGetActiveVpShaderBo(GL_CONTEXT(context)); - - if (!pbo) - return; - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_VS, 1); - R600_OUT_BATCH(evergreen->vs.SQ_PGM_START_VS.u32All); - R600_OUT_BATCH_RELOC(evergreen->vs.SQ_PGM_START_VS.u32All, - pbo, - evergreen->vs.SQ_PGM_START_VS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL((EG_SQ_LOOP_CONST_0 + 32*1), 0x0100000F); //consts == 1 - //EVERGREEN_OUT_BATCH_REGVAL((EG_SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F); - END_BATCH(); - - pbo_const = (struct radeon_bo *)(context->vp_Constbo); - - if(NULL != pbo_const) - { - r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, const_size / 16); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ALU_CONST_CACHE_VS_0, 1); - R600_OUT_BATCH(context->vp_bo_offset >> 8); - R600_OUT_BATCH_RELOC(0, - pbo_const, - 0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - } - - COMMIT_BATCH(); -} - -static void evergreenSendSQ(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - evergreenSendPSresource(ctx); //16 entries now - - BEGIN_BATCH_NO_AUTOSTATE(77); - - //34 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_VTX_SEMANTIC_0, 32); - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_0.u32All); //// // = 0x28380, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_1.u32All); //// // = 0x28384, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_2.u32All); //// // = 0x28388, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_3.u32All); //// // = 0x2838C, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_4.u32All); //// // = 0x28390, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_5.u32All); //// // = 0x28394, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_6.u32All); //// // = 0x28398, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_7.u32All); //// // = 0x2839C, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_8.u32All); //// // = 0x283A0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_9.u32All); //// // = 0x283A4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_10.u32All); //// // = 0x283A8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_11.u32All); //// // = 0x283AC, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_12.u32All); //// // = 0x283B0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_13.u32All); //// // = 0x283B4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_14.u32All); //// // = 0x283B8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_15.u32All); //// // = 0x283BC, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_16.u32All); //// // = 0x283C0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_17.u32All); //// // = 0x283C4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_18.u32All); //// // = 0x283C8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_19.u32All); //// // = 0x283CC, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_20.u32All); //// // = 0x283D0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_21.u32All); //// // = 0x283D4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_22.u32All); //// // = 0x283D8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_23.u32All); //// // = 0x283DC, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_24.u32All); //// // = 0x283E0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_25.u32All); //// // = 0x283E4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_26.u32All); //// // = 0x283E8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_27.u32All); //// // = 0x283EC, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_28.u32All); //// // = 0x283F0, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_29.u32All); //// // = 0x283F4, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_30.u32All); //// // = 0x283F8, // SAME - R600_OUT_BATCH(evergreen->SQ_VTX_SEMANTIC_31.u32All); //// // = 0x283FC, // SAME - - - //3 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_DYN_GPR_RESOURCE_LIMIT_1, 1); - R600_OUT_BATCH(evergreen->SQ_DYN_GPR_RESOURCE_LIMIT_1.u32All);//// // = 0x28838, // - - //5 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_PS, 3); - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_PS.u32All); //// // = 0x28844, // DIFF 0x28850 - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_PS.u32All); //// // = 0x28848, // - R600_OUT_BATCH(evergreen->SQ_PGM_EXPORTS_PS.u32All); //// // = 0x2884C, // SAME 0x28854 - - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_VS, 2); - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_VS.u32All);//// // = 0x28860, // DIFF 0x28868 - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_VS.u32All); //// // = 0x28864, // - - //5 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_GS, 2); - /* - R600_OUT_BATCH(evergreen->SQ_PGM_START_GS.u32All); //// // = 0x28874, // SAME 0x2886C - */ - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_GS.u32All); //// // = 0x28878, // DIFF 0x2887C - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_GS.u32All); //// // = 0x2887C, // - - //5 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_ES, 2); - /* - R600_OUT_BATCH(evergreen->SQ_PGM_START_ES.u32All); //// // = 0x2888C, // SAME 0x28880 - */ - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_ES.u32All); //// // = 0x28890, // DIFF - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_ES.u32All); //// // = 0x28894, // - - //4 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_FS, 1); - /* - R600_OUT_BATCH(evergreen->SQ_PGM_START_FS.u32All); //// // = 0x288A4, // SAME 0x28894 - */ - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_FS.u32All); //// // = 0x288A8, // DIFF 0x288A4 - - //3 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_2_HS, 1); - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_HS.u32All);//// // = 0x288C0, // - - //3 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_2_LS, 1); - R600_OUT_BATCH(evergreen->SQ_PGM_RESOURCES_2_LS.u32All); //// // = 0x288D8, // - - //3 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_LDS_ALLOC_PS, 1); - R600_OUT_BATCH(evergreen->SQ_LDS_ALLOC_PS.u32All); //// // = 0x288EC, // - - //8 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ESGS_RING_ITEMSIZE, 6); - R600_OUT_BATCH(evergreen->SQ_ESGS_RING_ITEMSIZE.u32All); //// // = 0x28900, // SAME 0x288A8 - R600_OUT_BATCH(evergreen->SQ_GSVS_RING_ITEMSIZE.u32All); //// // = 0x28904, // SAME 0x288AC - R600_OUT_BATCH(evergreen->SQ_ESTMP_RING_ITEMSIZE.u32All); //// // = 0x28908, // SAME 0x288B0 - R600_OUT_BATCH(evergreen->SQ_GSTMP_RING_ITEMSIZE.u32All); //// // = 0x2890C, // SAME 0x288B4 - R600_OUT_BATCH(evergreen->SQ_VSTMP_RING_ITEMSIZE.u32All); //// // = 0x28910, // SAME 0x288B8 - R600_OUT_BATCH(evergreen->SQ_PSTMP_RING_ITEMSIZE.u32All); //// // = 0x28914, // SAME 0x288BC - - //3 - EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_GS_VERT_ITEMSIZE, 1); - R600_OUT_BATCH(evergreen->SQ_GS_VERT_ITEMSIZE.u32All); //// // = 0x2891C, // SAME 0x288C8 - - END_BATCH(); - - COMMIT_BATCH(); - -} -static void evergreenSendSPI(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(59); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_VS_OUT_ID_0, 10); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_0.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_1.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_2.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_3.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_4.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_5.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_6.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_7.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_8.u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_ID_9.u32All); - - EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_PS_INPUT_CNTL_0, 45); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[0].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[1].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[2].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[3].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[4].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[5].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[6].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[7].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[8].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[9].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[10].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[11].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[12].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[13].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[14].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[15].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[16].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[17].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[18].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[19].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[20].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[21].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[22].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[23].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[24].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[25].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[26].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[27].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[28].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[29].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[30].u32All); - R600_OUT_BATCH(evergreen->SPI_PS_INPUT_CNTL[31].u32All); - R600_OUT_BATCH(evergreen->SPI_VS_OUT_CONFIG.u32All); - R600_OUT_BATCH(evergreen->SPI_THREAD_GROUPING.u32All); - R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_0.u32All); - R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_1.u32All); - R600_OUT_BATCH(evergreen->SPI_INTERP_CONTROL_0.u32All); - R600_OUT_BATCH(evergreen->SPI_INPUT_Z.u32All); - R600_OUT_BATCH(evergreen->SPI_FOG_CNTL.u32All); - R600_OUT_BATCH(evergreen->SPI_BARYC_CNTL.u32All); - R600_OUT_BATCH(evergreen->SPI_PS_IN_CONTROL_2.u32All); - R600_OUT_BATCH(evergreen->SPI_COMPUTE_INPUT_CNTL.u32All); - R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_X.u32All); - R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_Y.u32All); - R600_OUT_BATCH(evergreen->SPI_COMPUTE_NUM_THREAD_Z.u32All); - - END_BATCH(); - - COMMIT_BATCH(); -} -static void evergreenSendSX(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(9); - - EVERGREEN_OUT_BATCH_REGVAL(EG_SX_MISC, evergreen->SX_MISC.u32All); - EVERGREEN_OUT_BATCH_REGVAL(EG_SX_ALPHA_TEST_CONTROL, evergreen->SX_ALPHA_TEST_CONTROL.u32All); - EVERGREEN_OUT_BATCH_REGVAL(EG_SX_ALPHA_REF, evergreen->SX_ALPHA_REF.u32All); - - END_BATCH(); - - COMMIT_BATCH(); -} - -static void evergreenSetDepthTarget(context_t *context) -{ - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height, offtostencil; - - rrb = radeon_get_depthbuffer(&context->radeon); - if (!rrb) - { - return; - } - - EVERGREEN_STATECHANGE(context, db); - - evergreen->DB_DEPTH_SIZE.u32All = 0; - - nPitchInPixel = rrb->pitch/rrb->cpp; - - if (context->radeon.radeonScreen->driScreen->dri2.enabled) - { - height = rrb->base.Height; - } - else - { - height = context->radeon.radeonScreen->driScreen->fbHeight; - } - - SETfield(evergreen->DB_DEPTH_SIZE.u32All, (nPitchInPixel/8)-1, - EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_shift, - EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_mask); - SETfield(evergreen->DB_DEPTH_SIZE.u32All, (height/8)-1, - EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_shift, - EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_mask); - evergreen->DB_DEPTH_SLICE.u32All = ( (nPitchInPixel * height)/64 )-1; - - if(4 == rrb->cpp) - { - SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_24, - EG_DB_Z_INFO__FORMAT_shift, - EG_DB_Z_INFO__FORMAT_mask); - } - else - { - SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_16, - EG_DB_Z_INFO__FORMAT_shift, - EG_DB_Z_INFO__FORMAT_mask); - } - SETfield(evergreen->DB_Z_INFO.u32All, ARRAY_1D_TILED_THIN1, - EG_DB_Z_INFO__ARRAY_MODE_shift, - EG_DB_Z_INFO__ARRAY_MODE_mask); - - - offtostencil = ((height * rrb->pitch) + 255) & ~255; - evergreen->DB_STENCIL_WRITE_BASE.u32All = offtostencil >> 8; - evergreen->DB_STENCIL_READ_BASE.u32All = offtostencil >> 8; - -} - -static void evergreenSendDB(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct radeon_renderbuffer *rrb; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - evergreenSetDepthTarget(context); - - //8 - BEGIN_BATCH_NO_AUTOSTATE(7); - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_RENDER_CONTROL, 5); - R600_OUT_BATCH(evergreen->DB_RENDER_CONTROL.u32All); - R600_OUT_BATCH(evergreen->DB_COUNT_CONTROL.u32All); - R600_OUT_BATCH(evergreen->DB_DEPTH_VIEW.u32All); - R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE.u32All); - R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE2.u32All); - END_BATCH(); - - //4 - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_STENCIL_CLEAR, 2); - R600_OUT_BATCH(evergreen->DB_STENCIL_CLEAR.u32All); - R600_OUT_BATCH(evergreen->DB_DEPTH_CLEAR.u32All); - END_BATCH(); - - //4 - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_DEPTH_SIZE, 2); - R600_OUT_BATCH(evergreen->DB_DEPTH_SIZE.u32All); - R600_OUT_BATCH(evergreen->DB_DEPTH_SLICE.u32All); - END_BATCH(); - - //3 - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_DEPTH_CONTROL, evergreen->DB_DEPTH_CONTROL.u32All); - END_BATCH(); - - //3 - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_SHADER_CONTROL, evergreen->DB_SHADER_CONTROL.u32All); - END_BATCH(); - - //5 - BEGIN_BATCH_NO_AUTOSTATE(5); - EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_SRESULTS_COMPARE_STATE0, 3); - R600_OUT_BATCH(evergreen->DB_SRESULTS_COMPARE_STATE0.u32All); - R600_OUT_BATCH(evergreen->DB_SRESULTS_COMPARE_STATE1.u32All); - R600_OUT_BATCH(evergreen->DB_PRELOAD_CONTROL.u32All); - END_BATCH(); - - //3 - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_ALPHA_TO_MASK, evergreen->DB_ALPHA_TO_MASK.u32All); - END_BATCH(); - - rrb = radeon_get_depthbuffer(&context->radeon); - - if( (rrb != NULL) && (rrb->bo != NULL) ) - { - - /* make the hw happy */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All, - rrb->bo, - evergreen->DB_HTILE_DATA_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - //5 - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_INFO, evergreen->DB_Z_INFO.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_Z_INFO.u32All, - rrb->bo, - evergreen->DB_Z_INFO.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - //5 - if((evergreen->DB_DEPTH_CONTROL.u32All & Z_ENABLE_bit) > 0) - { - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_READ_BASE, evergreen->DB_Z_READ_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_Z_READ_BASE.u32All, - rrb->bo, - evergreen->DB_Z_READ_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - } - //5 - if((evergreen->DB_DEPTH_CONTROL.u32All & Z_WRITE_ENABLE_bit) > 0) - { - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_WRITE_BASE, evergreen->DB_Z_READ_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_Z_WRITE_BASE.u32All, - rrb->bo, - evergreen->DB_Z_WRITE_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - } - } - - if (ctx->DrawBuffer) - { - rrb = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - - if((rrb != NULL) && (rrb->bo != NULL)) - { - //5 - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_STENCIL_INFO.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_INFO.u32All, - rrb->bo, - evergreen->DB_STENCIL_INFO.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - //4 - BEGIN_BATCH_NO_AUTOSTATE(4); - R600_OUT_BATCH_REGSEQ(DB_STENCILREFMASK, 2); - R600_OUT_BATCH(evergreen->DB_STENCILREFMASK.u32All); - R600_OUT_BATCH(evergreen->DB_STENCILREFMASK_BF.u32All); - END_BATCH(); - //------------------------ - - //10 - if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0) - { - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All, - rrb->bo, - evergreen->DB_STENCIL_READ_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, evergreen->DB_STENCIL_WRITE_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_WRITE_BASE.u32All, - rrb->bo, - evergreen->DB_STENCIL_WRITE_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - } - } - } - - COMMIT_BATCH(); -} - -static void evergreenSetRenderTarget(context_t *context, int id) -{ - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - uint32_t format = COLOR_8_8_8_8, comp_swap = SWAP_ALT, number_type = NUMBER_UNORM, source_format = 1; - struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height; - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - - EVERGREEN_STATECHANGE(context, cb); - - /* addr */ - evergreen->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset / 256; - - /* pitch */ - nPitchInPixel = rrb->pitch/rrb->cpp; - - if (context->radeon.radeonScreen->driScreen->dri2.enabled) - { - height = rrb->base.Height; - } - else - { - height = context->radeon.radeonScreen->driScreen->fbHeight; - } - - SETfield(evergreen->render_target[id].CB_COLOR0_PITCH.u32All, (nPitchInPixel/8)-1, - EG_CB_COLOR0_PITCH__TILE_MAX_shift, - EG_CB_COLOR0_PITCH__TILE_MAX_mask); - - /* slice */ - SETfield(evergreen->render_target[id].CB_COLOR0_SLICE.u32All, - ( (nPitchInPixel * height)/64 )-1, - EG_CB_COLOR0_SLICE__TILE_MAX_shift, - EG_CB_COLOR0_SLICE__TILE_MAX_mask); - - /* CB_COLOR0_ATTRIB */ /* TODO : for z clear, this should be set to 0 */ - SETbit(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All, - EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit); - - /* CB_COLOR0_INFO */ - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ENDIAN_NONE, - EG_CB_COLOR0_INFO__ENDIAN_shift, - EG_CB_COLOR0_INFO__ENDIAN_mask); - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ARRAY_LINEAR_GENERAL, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - - switch (rrb->base.Format) { - case MESA_FORMAT_RGBA8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_SIGNED_RGBA8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_SNORM; - source_format = 1; - break; - case MESA_FORMAT_RGBA8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_SIGNED_RGBA8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_SNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB565: - format = COLOR_5_6_5; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB565_REV: - format = COLOR_5_6_5; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB4444: - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB4444_REV: - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB1555: - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_ARGB1555_REV: - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_AL88: - format = COLOR_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_AL88_REV: - format = COLOR_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGB332: - format = COLOR_3_3_2; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_A8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_I8: - format = COLOR_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_L8: - format = COLOR_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - source_format = 1; - break; - case MESA_FORMAT_RGBA_FLOAT32: - format = COLOR_32_32_32_32_FLOAT; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_RGBA_FLOAT16: - format = COLOR_16_16_16_16_FLOAT; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_ALPHA_FLOAT32: - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_ALPHA_FLOAT16: - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - format = COLOR_32_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - format = COLOR_16_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - format = COLOR_32_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_FLOAT; - source_format = 0; - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - format = COLOR_16_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - source_format = 0; - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - format = COLOR_8_24; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z24_S8: - format = COLOR_24_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z16: - format = COLOR_16; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_Z32: - format = COLOR_32; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - ARRAY_1D_TILED_THIN1, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift, - EG_CB_COLOR0_INFO__ARRAY_MODE_mask); - source_format = 0; - break; - case MESA_FORMAT_SARGB8: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_SRGB; - source_format = 1; - break; - case MESA_FORMAT_SLA8: - format = COLOR_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - source_format = 1; - break; - case MESA_FORMAT_SL8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - source_format = 1; - break; - default: - _mesa_problem(context->radeon.glCtx, "unexpected format in evergreenSetRenderTarget()"); - break; - } - - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - format, - EG_CB_COLOR0_INFO__FORMAT_shift, - EG_CB_COLOR0_INFO__FORMAT_mask); - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - comp_swap, - EG_CB_COLOR0_INFO__COMP_SWAP_shift, - EG_CB_COLOR0_INFO__COMP_SWAP_mask); - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - number_type, - EG_CB_COLOR0_INFO__NUMBER_TYPE_shift, - EG_CB_COLOR0_INFO__NUMBER_TYPE_mask); - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - source_format, - EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift, - EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask); - SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - EG_CB_COLOR0_INFO__BLEND_CLAMP_bit); - - evergreen->render_target[id].CB_COLOR0_VIEW.u32All = 0; - evergreen->render_target[id].CB_COLOR0_CMASK.u32All = 0; - evergreen->render_target[id].CB_COLOR0_FMASK.u32All = 0; - evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0; - - evergreen->render_target[id].enabled = GL_TRUE; -} - -static void evergreenSendCB(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct radeon_renderbuffer *rrb; - BATCH_LOCALS(&context->radeon); - int id = 0; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - - evergreenSetRenderTarget(context, 0); - - if (!evergreen->render_target[id].enabled) - return; - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_BASE + (4 * id), 1); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->render_target[id].CB_COLOR0_BASE.u32All, - rrb->bo, - evergreen->render_target[id].CB_COLOR0_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR0_INFO, evergreen->render_target[id].CB_COLOR0_INFO.u32All); - R600_OUT_BATCH_RELOC(evergreen->render_target[id].CB_COLOR0_INFO.u32All, - rrb->bo, - evergreen->render_target[id].CB_COLOR0_INFO.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(5); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_PITCH, 3); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_PITCH.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_SLICE.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_VIEW.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 1); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All); - R600_OUT_BATCH_RELOC(0, - rrb->bo, - 0, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_DIM, 1); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_DIM.u32All); - /* - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK_SLICE.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK.u32All); - R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All); - */ - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_TARGET_MASK, 2); - R600_OUT_BATCH(evergreen->CB_TARGET_MASK.u32All); - R600_OUT_BATCH(evergreen->CB_SHADER_MASK.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_BLEND_RED, 4); - R600_OUT_BATCH(evergreen->CB_BLEND_RED.u32All); - R600_OUT_BATCH(evergreen->CB_BLEND_GREEN.u32All); - R600_OUT_BATCH(evergreen->CB_BLEND_BLUE.u32All); - R600_OUT_BATCH(evergreen->CB_BLEND_ALPHA.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND0_CONTROL, evergreen->CB_BLEND0_CONTROL.u32All); - EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR_CONTROL, evergreen->CB_COLOR_CONTROL.u32All); - END_BATCH(); - - COMMIT_BATCH(); -} - -static void evergreenSendVGT(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - -/* moved to draw: - VGT_DRAW_INITIATOR - VGT_INDEX_TYPE - VGT_PRIMITIVE_TYPE -*/ - BEGIN_BATCH_NO_AUTOSTATE(5); - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_MAX_VTX_INDX, 3); - R600_OUT_BATCH(evergreen->VGT_MAX_VTX_INDX.u32All); - R600_OUT_BATCH(evergreen->VGT_MIN_VTX_INDX.u32All); - R600_OUT_BATCH(evergreen->VGT_INDX_OFFSET.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_OUTPUT_PATH_CNTL, evergreen->VGT_OUTPUT_PATH_CNTL.u32All); - - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_GS_MODE, evergreen->VGT_GS_MODE.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_PRIMITIVEID_EN, 1); - R600_OUT_BATCH(evergreen->VGT_PRIMITIVEID_EN.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_INSTANCE_STEP_RATE_0, 2); - R600_OUT_BATCH(evergreen->VGT_INSTANCE_STEP_RATE_0.u32All); - R600_OUT_BATCH(evergreen->VGT_INSTANCE_STEP_RATE_1.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_REUSE_OFF, 2); - R600_OUT_BATCH(evergreen->VGT_REUSE_OFF.u32All); - R600_OUT_BATCH(evergreen->VGT_VTX_CNT_EN.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_SHADER_STAGES_EN, evergreen->VGT_SHADER_STAGES_EN.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_STRMOUT_CONFIG, 2); - R600_OUT_BATCH(evergreen->VGT_STRMOUT_CONFIG.u32All); - R600_OUT_BATCH(evergreen->VGT_STRMOUT_BUFFER_CONFIG.u32All); - END_BATCH(); - - COMMIT_BATCH(); -} - -void evergreenInitAtoms(context_t *context) -{ - radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); - context->radeon.hw.max_state_size = 10 + 5 + 14 + 3; /* start 3d, idle, cb/db flush, 3 for time stamp */ - - /* Setup the atom linked list */ - make_empty_list(&context->radeon.hw.atomlist); - context->radeon.hw.atomlist.name = "atom-list"; - - EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig); - EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (VERT_ATTRIB_MAX * 12), evergreenSendVTX); - EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA); - EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP); - EVERGREEN_ALLOC_STATE(sq, always, 86, evergreenSendSQ); /* 85 */ - EVERGREEN_ALLOC_STATE(vs, always, 16, evergreenSendVSresource); - EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI); - EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX); - EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */ - EVERGREEN_ALLOC_STATE(db, always, 69, evergreenSendDB); - EVERGREEN_ALLOC_STATE(cb, always, 37, evergreenSendCB); - EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT); - - evergreen_init_query_stateobj(&context->radeon, 6 * 2); - - context->radeon.hw.is_dirty = GL_TRUE; - context->radeon.hw.all_dirty = GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.h b/src/mesa/drivers/dri/r600/evergreen_chip.h deleted file mode 100644 index 2ea5cd213c7..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_chip.h +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_CHIP_H_ -#define _EVERGREEN_CHIP_H_ - -#include "r700_chip.h" - -#define EVERGREEN_MAX_DX9_CONSTS 256 -#define EVERGREEN_MAX_SHADER_EXPORTS 32 -#define EVERGREEN_MAX_VIEWPORTS 16 - -typedef struct _EVERGREEN_VIEWPORT_STATE -{ - union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_TL; ////0,1 // = 0x28250, // DIFF - union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_BR; ////0,1 // = 0x28254, // DIFF - union UINT_FLOAT PA_SC_VPORT_ZMIN_0; ////0 // = 0x282D0, // SAME - union UINT_FLOAT PA_SC_VPORT_ZMAX_0; ////0 // = 0x282D4, // SAME - union UINT_FLOAT PA_CL_VPORT_XSCALE; //// // = 0x2843C, // SAME - union UINT_FLOAT PA_CL_VPORT_XOFFSET; //// // = 0x28440, // SAME - union UINT_FLOAT PA_CL_VPORT_YSCALE; //// // = 0x28444, // SAME - union UINT_FLOAT PA_CL_VPORT_YOFFSET; //// // = 0x28448, // SAME - union UINT_FLOAT PA_CL_VPORT_ZSCALE; //// // = 0x2844C, // SAME - union UINT_FLOAT PA_CL_VPORT_ZOFFSET; //// // = 0x28450, // SAME - GLboolean enabled; - GLboolean dirty; -} EVERGREEN_VIEWPORT_STATE; - -#define EVERGREEN_MAX_UCP 6 - -typedef struct _EVERGREEN_UCP_STATE -{ - union UINT_FLOAT PA_CL_UCP_0_X; // = 0x285BC, // SAME 0x28E20 - union UINT_FLOAT PA_CL_UCP_0_Y; // = 0x285C0, // SAME 0x28E24 - union UINT_FLOAT PA_CL_UCP_0_Z; // = 0x285C4, // SAME 0x28E28 - union UINT_FLOAT PA_CL_UCP_0_W; // = 0x285C8, // SAME 0x28E2C - GLboolean enabled; - GLboolean dirty; -} EVERGREEN_UCP_STATE; - -#define EVERGREEN_MAX_RENDER_TARGETS 12 - -typedef struct _EVERGREEN_RENDER_TARGET_STATE -{ - union UINT_FLOAT CB_COLOR0_BASE; ////0 // = 0x28C60, // SAME 0x28040 - union UINT_FLOAT CB_COLOR0_PITCH; ////0 // = 0x28C64, // - union UINT_FLOAT CB_COLOR0_SLICE; ////0 // = 0x28C68, // - union UINT_FLOAT CB_COLOR0_VIEW; ////0 // = 0x28C6C, // SAME 0x28080 - union UINT_FLOAT CB_COLOR0_INFO; ////0,1,2,3,4,5,6,78,9,10,11 // = 0x28C70, // DIFF 0x280A0 - union UINT_FLOAT CB_COLOR0_ATTRIB; ////0 // = 0x28C74, // - union UINT_FLOAT CB_COLOR0_DIM; // = 0x28C78, // - union UINT_FLOAT CB_COLOR0_CMASK; ////0 // = 0x28C7C, // - union UINT_FLOAT CB_COLOR0_CMASK_SLICE; ////0 // = 0x28C80, // - union UINT_FLOAT CB_COLOR0_FMASK; ////0 // = 0x28C84, // - union UINT_FLOAT CB_COLOR0_FMASK_SLICE; ////0 // = 0x28C88, // - union UINT_FLOAT CB_COLOR0_CLEAR_WORD0; // = 0x28C8C, // - union UINT_FLOAT CB_COLOR0_CLEAR_WORD1; // = 0x28C90, // - union UINT_FLOAT CB_COLOR0_CLEAR_WORD2; // = 0x28C94, // - union UINT_FLOAT CB_COLOR0_CLEAR_WORD3; // = 0x28C98, // - GLboolean enabled; - GLboolean dirty; -} EVERGREEN_RENDER_TARGET_STATE; - -typedef struct _EVERGREEN_CONFIG -{ - union UINT_FLOAT SPI_CONFIG_CNTL; // = 0x9100, // DIFF - union UINT_FLOAT SPI_CONFIG_CNTL_1; // = 0x913C, // DIFF - union UINT_FLOAT CP_PERFMON_CNTL; // = 0x87FC, // SAME - union UINT_FLOAT SQ_MS_FIFO_SIZES; // = 0x8CF0, // SAME - - union UINT_FLOAT SQ_CONFIG; // = 0x8C00, // DIFF - union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_1; // = 0x8C04, // SAME - union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_2; // = 0x8C08, // SAME - union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_3; // = 0x8C0C, // - - union UINT_FLOAT SQ_THREAD_RESOURCE_MGMT; // = 0x8C18, // SAME 0x8C0C - union UINT_FLOAT SQ_THREAD_RESOURCE_MGMT_2; // = 0x8C1C, // - union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_1; // = 0x8C20, // SAME 0x8C10 - union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_2; // = 0x8C24, // SAME 0x8C14 - union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_3; // = 0x8C28, // - - union UINT_FLOAT SQ_DYN_GPR_CNTL_PS_FLUSH_REQ; // = 0x8D8C, // DIFF - union UINT_FLOAT SQ_LDS_RESOURCE_MGMT; // = 0x8E2C, // - union UINT_FLOAT VGT_CACHE_INVALIDATION; // = 0x88C4, // DIFF - union UINT_FLOAT VGT_GS_VERTEX_REUSE; // = 0x88D4, // SAME - union UINT_FLOAT PA_SC_FORCE_EOV_MAX_CNTS; // = 0x8B24, // SAME - union UINT_FLOAT PA_SC_LINE_STIPPLE_STATE; // = 0x8B10, // SAME - union UINT_FLOAT PA_CL_ENHANCE; // = 0x8A14, // SAME -} EVERGREEN_CONFIG; - -typedef struct _EVERGREEN_PS_RES -{ - union UINT_FLOAT SQ_PGM_START_PS; //// // = 0x28840, // SAME - GLboolean dirty; - - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_0; // = 0x28940, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_1; // = 0x28944, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_2; // = 0x28948, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_3; // = 0x2894C, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_4; // = 0x28950, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_5; // = 0x28954, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_6; // = 0x28958, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_7; // = 0x2895C, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_8; // = 0x28960, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_9; // = 0x28964, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_10; // = 0x28968, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_11; // = 0x2896C, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_12; // = 0x28970, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_13; // = 0x28974, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_14; // = 0x28978, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_PS_15; // = 0x2897C, // SAME - - int num_consts; - union UINT_FLOAT consts[EVERGREEN_MAX_DX9_CONSTS][4]; -} EVERGREEN_PS_RES; - -typedef struct _EVERGREEN_VS_RES -{ - union UINT_FLOAT SQ_PGM_START_VS; //// // = 0x2885C, // SAME 0x28858 - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_VS_0; //// // = 0x28180, //? - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_0; //// // = 0x28980, // SAME - - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_1; // = 0x28984, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_2; // = 0x28988, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_3; // = 0x2898C, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_4; // = 0x28990, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_5; // = 0x28994, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_6; // = 0x28998, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_7; // = 0x2899C, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_8; // = 0x289A0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_9; // = 0x289A4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_10; // = 0x289A8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_11; // = 0x289AC, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_12; // = 0x289B0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_13; // = 0x289B4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_14; // = 0x289B8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_15; // = 0x289BC, // SAME - - GLboolean dirty; - int num_consts; - union UINT_FLOAT consts[EVERGREEN_MAX_DX9_CONSTS][4]; -} EVERGREEN_VS_RES; - -typedef struct _EVERGREEN_CHIP_CONTEXT -{ -/* Registers from PA block: */ - union UINT_FLOAT PA_SC_SCREEN_SCISSOR_TL; //// // = 0x28030, // DIFF - union UINT_FLOAT PA_SC_SCREEN_SCISSOR_BR; //// // = 0x28034, // DIFF - union UINT_FLOAT PA_SC_WINDOW_OFFSET; //// // = 0x28200, // DIFF - union UINT_FLOAT PA_SC_WINDOW_SCISSOR_TL; //// // = 0x28204, // DIFF - union UINT_FLOAT PA_SC_WINDOW_SCISSOR_BR; //// // = 0x28208, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_RULE; //// // = 0x2820C, // SAME - union UINT_FLOAT PA_SC_CLIPRECT_0_TL; //// // = 0x28210, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_0_BR; //// // = 0x28214, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_1_TL; //// // = 0x28218, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_1_BR; //// // = 0x2821C, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_2_TL; //// // = 0x28220, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_2_BR; //// // = 0x28224, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_3_TL; //// // = 0x28228, // DIFF - union UINT_FLOAT PA_SC_CLIPRECT_3_BR; //// // = 0x2822C, // DIFF - union UINT_FLOAT PA_SC_EDGERULE; // = 0x28230, // SAME - union UINT_FLOAT PA_SU_HARDWARE_SCREEN_OFFSET; // = 0x28234, // - union UINT_FLOAT PA_SC_GENERIC_SCISSOR_TL; //// // = 0x28240, // DIFF - union UINT_FLOAT PA_SC_GENERIC_SCISSOR_BR; //// // = 0x28244, // DIFF - - EVERGREEN_VIEWPORT_STATE viewport[EVERGREEN_MAX_VIEWPORTS]; - EVERGREEN_UCP_STATE ucp[EVERGREEN_MAX_UCP]; - - union UINT_FLOAT PA_CL_POINT_X_RAD; // = 0x287D4, // SAME 0x28E10 - union UINT_FLOAT PA_CL_POINT_Y_RAD; // = 0x287D8, // SAME 0x28E14 - union UINT_FLOAT PA_CL_POINT_SIZE; // = 0x287DC, // SAME 0x28E18 - union UINT_FLOAT PA_CL_POINT_CULL_RAD; // = 0x287E0, // SAME 0x28E1C - union UINT_FLOAT PA_CL_CLIP_CNTL; //// // = 0x28810, // SAME - union UINT_FLOAT PA_SU_SC_MODE_CNTL; //// // = 0x28814, // SAME - union UINT_FLOAT PA_CL_VTE_CNTL; //// // = 0x28818, // SAME - union UINT_FLOAT PA_CL_VS_OUT_CNTL; //// // = 0x2881C, // SAME - union UINT_FLOAT PA_CL_NANINF_CNTL; //// // = 0x28820, // SAME - union UINT_FLOAT PA_SU_LINE_STIPPLE_CNTL; // = 0x28824, // - union UINT_FLOAT PA_SU_LINE_STIPPLE_SCALE; // = 0x28828, // - union UINT_FLOAT PA_SU_PRIM_FILTER_CNTL; // = 0x2882C, // - union UINT_FLOAT PA_SU_POINT_SIZE; //// // = 0x28A00, // SAME - union UINT_FLOAT PA_SU_POINT_MINMAX; //// // = 0x28A04, // SAME - union UINT_FLOAT PA_SU_LINE_CNTL; //// // = 0x28A08, // SAME - union UINT_FLOAT PA_SC_LINE_STIPPLE; // = 0x28A0C, // SAME - union UINT_FLOAT PA_SC_MODE_CNTL_0; //// // = 0x28A48, // - union UINT_FLOAT PA_SC_MODE_CNTL_1; //// // = 0x28A4C, // - union UINT_FLOAT PA_SU_POLY_OFFSET_DB_FMT_CNTL; //// // = 0x28B78, // SAME 0x28DF8 - union UINT_FLOAT PA_SU_POLY_OFFSET_CLAMP; //// // = 0x28B7C, // SAME 0x28DFC - union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_SCALE;//// // = 0x28B80, // SAME 0x28E00 - union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_OFFSET; //// // = 0x28B84, // SAME 0x28E04 - union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_SCALE; //// // = 0x28B88, // SAME 0x28E08 - union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_OFFSET; //// // = 0x28B8C, // SAME 0x28E0C - union UINT_FLOAT PA_SC_LINE_CNTL; //// // = 0x28C00, // DIFF - union UINT_FLOAT PA_SC_AA_CONFIG; //// // = 0x28C04, // SAME - union UINT_FLOAT PA_SU_VTX_CNTL; //// // = 0x28C08, // SAME - union UINT_FLOAT PA_CL_GB_VERT_CLIP_ADJ; //// // = 0x28C0C, // SAME - union UINT_FLOAT PA_CL_GB_VERT_DISC_ADJ; //// // = 0x28C10, // SAME - union UINT_FLOAT PA_CL_GB_HORZ_CLIP_ADJ; //// // = 0x28C14, // SAME - union UINT_FLOAT PA_CL_GB_HORZ_DISC_ADJ; //// // = 0x28C18, // SAME - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_0; //// // = 0x28C1C, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_1; //// // = 0x28C20, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_2; //// // = 0x28C24, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_3; //// // = 0x28C28, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_4; //// // = 0x28C2C, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_5; //// // = 0x28C30, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_6; //// // = 0x28C34, // - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_7; //// // = 0x28C38, // - union UINT_FLOAT PA_SC_AA_MASK; //// // = 0x28C3C, // SAME 0x28C48 - -/* Registers from VGT block: */ - union UINT_FLOAT VGT_INDEX_TYPE; // = 0x895C, // SAME - union UINT_FLOAT VGT_PRIMITIVE_TYPE; // = 0x8958, // SAME - union UINT_FLOAT VGT_MAX_VTX_INDX; //// // = 0x28400, // SAME - union UINT_FLOAT VGT_MIN_VTX_INDX; //// // = 0x28404, // SAME - union UINT_FLOAT VGT_INDX_OFFSET; //// // = 0x28408, // SAME - union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_INDX; // = 0x2840C, // SAME - - union UINT_FLOAT VGT_DRAW_INITIATOR; // = 0x287F0, // SAME - union UINT_FLOAT VGT_IMMED_DATA; // = 0x287F4, // SAME - - union UINT_FLOAT VGT_OUTPUT_PATH_CNTL; //// // = 0x28A10, // DIFF - union UINT_FLOAT VGT_HOS_CNTL; // = 0x28A14, // SAME - union UINT_FLOAT VGT_HOS_MAX_TESS_LEVEL; // = 0x28A18, // SAME - union UINT_FLOAT VGT_HOS_MIN_TESS_LEVEL; // = 0x28A1C, // SAME - union UINT_FLOAT VGT_HOS_REUSE_DEPTH; // = 0x28A20, // SAME - union UINT_FLOAT VGT_GROUP_PRIM_TYPE; // = 0x28A24, // SAME - union UINT_FLOAT VGT_GROUP_FIRST_DECR; // = 0x28A28, // SAME - union UINT_FLOAT VGT_GROUP_DECR; // = 0x28A2C, // SAME - union UINT_FLOAT VGT_GROUP_VECT_0_CNTL; // = 0x28A30, // SAME - union UINT_FLOAT VGT_GROUP_VECT_1_CNTL; // = 0x28A34, // SAME - union UINT_FLOAT VGT_GROUP_VECT_0_FMT_CNTL; // = 0x28A38, // SAME - union UINT_FLOAT VGT_GROUP_VECT_1_FMT_CNTL; // = 0x28A3C, // SAME - union UINT_FLOAT VGT_GS_MODE; //// // = 0x28A40, // DIFF - - union UINT_FLOAT VGT_PRIMITIVEID_EN; //// // = 0x28A84, // SAME - union UINT_FLOAT VGT_DMA_NUM_INSTANCES; //// // = 0x28A88, // SAME - union UINT_FLOAT VGT_EVENT_INITIATOR; // = 0x28A90, // SAME - union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_EN; // = 0x28A94, // SAME - union UINT_FLOAT VGT_INSTANCE_STEP_RATE_0; //// // = 0x28AA0, // SAME - union UINT_FLOAT VGT_INSTANCE_STEP_RATE_1; //// // = 0x28AA4, // SAME - union UINT_FLOAT VGT_REUSE_OFF; //// // = 0x28AB4, // SAME - union UINT_FLOAT VGT_VTX_CNT_EN; //// // = 0x28AB8, // SAME - - union UINT_FLOAT VGT_SHADER_STAGES_EN; //// // = 0x28B54, // - - union UINT_FLOAT VGT_STRMOUT_CONFIG; //// // = 0x28B94, // - union UINT_FLOAT VGT_STRMOUT_BUFFER_CONFIG; //// // = 0x28B98, // - union UINT_FLOAT VGT_VERTEX_REUSE_BLOCK_CNTL;//// // = 0x28C58, // SAME - union UINT_FLOAT VGT_OUT_DEALLOC_CNTL; //// // = 0x28C5C, // SAME - -/* Registers from SQ block: */ - union UINT_FLOAT SQ_VTX_SEMANTIC_0; //// // = 0x28380, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_1; //// // = 0x28384, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_2; //// // = 0x28388, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_3; //// // = 0x2838C, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_4; //// // = 0x28390, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_5; //// // = 0x28394, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_6; //// // = 0x28398, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_7; //// // = 0x2839C, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_8; //// // = 0x283A0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_9; //// // = 0x283A4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_10; //// // = 0x283A8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_11; //// // = 0x283AC, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_12; //// // = 0x283B0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_13; //// // = 0x283B4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_14; //// // = 0x283B8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_15; //// // = 0x283BC, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_16; //// // = 0x283C0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_17; //// // = 0x283C4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_18; //// // = 0x283C8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_19; //// // = 0x283CC, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_20; //// // = 0x283D0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_21; //// // = 0x283D4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_22; //// // = 0x283D8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_23; //// // = 0x283DC, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_24; //// // = 0x283E0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_25; //// // = 0x283E4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_26; //// // = 0x283E8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_27; //// // = 0x283EC, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_28; //// // = 0x283F0, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_29; //// // = 0x283F4, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_30; //// // = 0x283F8, // SAME - union UINT_FLOAT SQ_VTX_SEMANTIC_31; //// // = 0x283FC, // SAME - union UINT_FLOAT SQ_DYN_GPR_RESOURCE_LIMIT_1;//// // = 0x28838, // - - union UINT_FLOAT SQ_PGM_RESOURCES_PS; //// // = 0x28844, // DIFF 0x28850 - union UINT_FLOAT SQ_PGM_RESOURCES_2_PS; //// // = 0x28848, // - union UINT_FLOAT SQ_PGM_EXPORTS_PS; //// // = 0x2884C, // SAME 0x28854 - - union UINT_FLOAT SQ_PGM_RESOURCES_VS;//// // = 0x28860, // DIFF 0x28868 - union UINT_FLOAT SQ_PGM_RESOURCES_2_VS; //// // = 0x28864, // - union UINT_FLOAT SQ_PGM_START_GS; //// // = 0x28874, // SAME 0x2886C - union UINT_FLOAT SQ_PGM_RESOURCES_GS; //// // = 0x28878, // DIFF 0x2887C - union UINT_FLOAT SQ_PGM_RESOURCES_2_GS; //// // = 0x2887C, // - union UINT_FLOAT SQ_PGM_START_ES; //// // = 0x2888C, // SAME 0x28880 - union UINT_FLOAT SQ_PGM_RESOURCES_ES; //// // = 0x28890, // DIFF - union UINT_FLOAT SQ_PGM_RESOURCES_2_ES; //// // = 0x28894, // - union UINT_FLOAT SQ_PGM_START_FS; //// // = 0x288A4, // SAME 0x28894 - union UINT_FLOAT SQ_PGM_RESOURCES_FS; //// // = 0x288A8, // DIFF 0x288A4 - union UINT_FLOAT SQ_PGM_START_HS; // = 0x288B8, // - union UINT_FLOAT SQ_PGM_RESOURCES_HS; // = 0x288BC, // - union UINT_FLOAT SQ_PGM_RESOURCES_2_HS;//// // = 0x288C0, // - union UINT_FLOAT SQ_PGM_START_LS; // = 0x288D0, // - union UINT_FLOAT SQ_PGM_RESOURCES_LS; // = 0x288D4, // - union UINT_FLOAT SQ_PGM_RESOURCES_2_LS; //// // = 0x288D8, // - union UINT_FLOAT SQ_LDS_ALLOC_PS; //// // = 0x288EC, // - union UINT_FLOAT SQ_ESGS_RING_ITEMSIZE; //// // = 0x28900, // SAME 0x288A8 - union UINT_FLOAT SQ_GSVS_RING_ITEMSIZE; //// // = 0x28904, // SAME 0x288AC - union UINT_FLOAT SQ_ESTMP_RING_ITEMSIZE; //// // = 0x28908, // SAME 0x288B0 - union UINT_FLOAT SQ_GSTMP_RING_ITEMSIZE; //// // = 0x2890C, // SAME 0x288B4 - union UINT_FLOAT SQ_VSTMP_RING_ITEMSIZE; //// // = 0x28910, // SAME 0x288B8 - union UINT_FLOAT SQ_PSTMP_RING_ITEMSIZE; //// // = 0x28914, // SAME 0x288BC - union UINT_FLOAT SQ_GS_VERT_ITEMSIZE; //// // = 0x2891C, // SAME 0x288C8 - union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_1; // = 0x28920, // - union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_2; // = 0x28924, // - union UINT_FLOAT SQ_GS_VERT_ITEMSIZE_3; // = 0x28928, // - - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_0; // = 0x289C0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_1; // = 0x289C4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_2; // = 0x289C8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_3; // = 0x289CC, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_4; // = 0x289D0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_5; // = 0x289D4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_6; // = 0x289D8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_7; // = 0x289DC, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_8; // = 0x289E0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_9; // = 0x289E4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_10; // = 0x289E8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_11; // = 0x289EC, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_12; // = 0x289F0, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_13; // = 0x289F4, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_14; // = 0x289F8, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_GS_15; // = 0x289FC, // SAME - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_0; // = 0x28F00, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_1; // = 0x28F04, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_2; // = 0x28F08, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_3; // = 0x28F0C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_4; // = 0x28F10, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_5; // = 0x28F14, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_6; // = 0x28F18, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_7; // = 0x28F1C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_8; // = 0x28F20, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_9; // = 0x28F24, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_10; // = 0x28F28, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_11; // = 0x28F2C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_12; // = 0x28F30, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_13; // = 0x28F34, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_14; // = 0x28F38, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_HS_15; // = 0x28F3C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_0; // = 0x28F40, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_1; // = 0x28F44, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_2; // = 0x28F48, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_3; // = 0x28F4C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_4; // = 0x28F50, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_5; // = 0x28F54, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_6; // = 0x28F58, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_7; // = 0x28F5C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_8; // = 0x28F60, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_9; // = 0x28F64, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_10; // = 0x28F68, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_11; // = 0x28F6C, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_12; // = 0x28F70, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_13; // = 0x28F74, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_14; // = 0x28F78, // - union UINT_FLOAT SQ_ALU_CONST_CACHE_LS_15; // = 0x28F7C, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_0; // = 0x28F80, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_1; // = 0x28F84, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_2; // = 0x28F88, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_3; // = 0x28F8C, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_4; // = 0x28F90, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_5; // = 0x28F94, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_6; // = 0x28F98, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_7; // = 0x28F9C, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_8; // = 0x28FA0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_9; // = 0x28FA4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_10; // = 0x28FA8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_11; // = 0x28FAC, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_12; // = 0x28FB0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_13; // = 0x28FB4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_14; // = 0x28FB8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_HS_15; // = 0x28FBC, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_0; // = 0x28FC0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_1; // = 0x28FC4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_2; // = 0x28FC8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_3; // = 0x28FCC, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_4; // = 0x28FD0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_5; // = 0x28FD4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_6; // = 0x28FD8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_7; // = 0x28FDC, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_8; // = 0x28FE0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_9; // = 0x28FE4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_10; // = 0x28FE8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_11; // = 0x28FEC, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_12; // = 0x28FF0, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_13; // = 0x28FF4, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_14; // = 0x28FF8, // - union UINT_FLOAT SQ_ALU_CONST_BUFFER_SIZE_LS_15; // = 0x28FFC, // - - EVERGREEN_PS_RES ps; - EVERGREEN_VS_RES vs; - -/* Registers from SPI block: */ - union UINT_FLOAT SPI_VS_OUT_ID_0; //// // = 0x2861C, // SAME 0x28614 - union UINT_FLOAT SPI_VS_OUT_ID_1; //// // = 0x28620, // SAME 0x28618 - union UINT_FLOAT SPI_VS_OUT_ID_2; //// // = 0x28624, // SAME 0x2861C - union UINT_FLOAT SPI_VS_OUT_ID_3; //// // = 0x28628, // SAME 0x28620 - union UINT_FLOAT SPI_VS_OUT_ID_4; //// // = 0x2862C, // SAME 0x28624 - union UINT_FLOAT SPI_VS_OUT_ID_5; //// // = 0x28630, // SAME 0x28628 - union UINT_FLOAT SPI_VS_OUT_ID_6; //// // = 0x28634, // SAME 0x2862C - union UINT_FLOAT SPI_VS_OUT_ID_7; //// // = 0x28638, // SAME 0x28630 - union UINT_FLOAT SPI_VS_OUT_ID_8; //// // = 0x2863C, // SAME 0x28634 - union UINT_FLOAT SPI_VS_OUT_ID_9; //// // = 0x28640, // SAME 0x28638 - union UINT_FLOAT SPI_PS_INPUT_CNTL[32]; //// // = 0x28644, // SAME - - union UINT_FLOAT SPI_VS_OUT_CONFIG; //// // = 0x286C4, // SAME - union UINT_FLOAT SPI_THREAD_GROUPING; //// // = 0x286C8, // DIFF - union UINT_FLOAT SPI_PS_IN_CONTROL_0; //// // = 0x286CC, // SAME - union UINT_FLOAT SPI_PS_IN_CONTROL_1; //// // = 0x286D0, // SAME - union UINT_FLOAT SPI_INTERP_CONTROL_0; //// // = 0x286D4, // SAME - union UINT_FLOAT SPI_INPUT_Z; //// // = 0x286D8, // SAME - union UINT_FLOAT SPI_FOG_CNTL; //// // = 0x286DC, // SAME - union UINT_FLOAT SPI_BARYC_CNTL; //// // = 0x286E0, // - union UINT_FLOAT SPI_PS_IN_CONTROL_2; //// // = 0x286E4, // - union UINT_FLOAT SPI_COMPUTE_INPUT_CNTL; // = 0x286E8, // - union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_X; // = 0x286EC, // - union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_Y; // = 0x286F0, // - union UINT_FLOAT SPI_COMPUTE_NUM_THREAD_Z; // = 0x286F4, // - -/* Registers from SX block: */ - union UINT_FLOAT SX_MISC; // = 0x28350, // SAME - union UINT_FLOAT SX_SURFACE_SYNC; // = 0x28354, // DIFF - union UINT_FLOAT SX_ALPHA_TEST_CONTROL; //// // = 0x28410, // SAME - union UINT_FLOAT SX_ALPHA_REF; // = 0x28438, // SAME - -/* Registers from DB block: */ - union UINT_FLOAT DB_RENDER_CONTROL; //// // = 0x28000, // DIFF 0x28D0C - union UINT_FLOAT DB_COUNT_CONTROL; //// // = 0x28004, // - union UINT_FLOAT DB_DEPTH_VIEW; //// // = 0x28008, // DIFF 0x28004 - union UINT_FLOAT DB_RENDER_OVERRIDE; //// // = 0x2800C, // DIFF 0x28D10 - union UINT_FLOAT DB_RENDER_OVERRIDE2; //// // = 0x28010, // - union UINT_FLOAT DB_HTILE_DATA_BASE; //// // = 0x28014, // SAME - union UINT_FLOAT DB_STENCIL_CLEAR; //// // = 0x28028, // SAME - union UINT_FLOAT DB_DEPTH_CLEAR; //// // = 0x2802C, // SAME - union UINT_FLOAT DB_Z_INFO; //// // = 0x28040, // - union UINT_FLOAT DB_STENCIL_INFO; //// // = 0x28044, // - union UINT_FLOAT DB_Z_READ_BASE; //// // = 0x28048, // - union UINT_FLOAT DB_STENCIL_READ_BASE;//// // = 0x2804C, // - union UINT_FLOAT DB_Z_WRITE_BASE; //// // = 0x28050, // - union UINT_FLOAT DB_STENCIL_WRITE_BASE; //// // = 0x28054, // - union UINT_FLOAT DB_DEPTH_SIZE; //// // = 0x28058, // DIFF 0x28000 - union UINT_FLOAT DB_DEPTH_SLICE; //// // = 0x2805C, // - union UINT_FLOAT DB_STENCILREFMASK; // = 0x28430, // SAME - union UINT_FLOAT DB_STENCILREFMASK_BF; // = 0x28434, // SAME - union UINT_FLOAT DB_DEPTH_CONTROL; //// // = 0x28800, // SAME - union UINT_FLOAT DB_SHADER_CONTROL;//// // = 0x2880C, // DIFF - union UINT_FLOAT DB_HTILE_SURFACE; //// // = 0x28ABC, // SAME 0x28D24 - union UINT_FLOAT DB_SRESULTS_COMPARE_STATE0; //// // = 0x28AC0, // SAME 0x28D28 - union UINT_FLOAT DB_SRESULTS_COMPARE_STATE1; //// // = 0x28AC4, // SAME 0x28D2C - union UINT_FLOAT DB_PRELOAD_CONTROL; //// // = 0x28AC8, // SAME 0x28D30 - union UINT_FLOAT DB_ALPHA_TO_MASK; //// // = 0x28B70, // SAME 0x28D44 - -/* Registers from CB block: */ - union UINT_FLOAT CB_TARGET_MASK; //// // = 0x28238, // SAME - union UINT_FLOAT CB_SHADER_MASK; //// // = 0x2823C, // SAME - union UINT_FLOAT CB_BLEND_RED; //// // = 0x28414, // SAME - union UINT_FLOAT CB_BLEND_GREEN; //// // = 0x28418, // SAME - union UINT_FLOAT CB_BLEND_BLUE; //// // = 0x2841C, // SAME - union UINT_FLOAT CB_BLEND_ALPHA; //// // = 0x28420, // SAME - union UINT_FLOAT CB_BLEND0_CONTROL; //// // = 0x28780, // DIFF - union UINT_FLOAT CB_BLEND1_CONTROL; // = 0x28784, // DIFF - union UINT_FLOAT CB_BLEND2_CONTROL; // = 0x28788, // DIFF - union UINT_FLOAT CB_BLEND3_CONTROL; // = 0x2878C, // DIFF - union UINT_FLOAT CB_BLEND4_CONTROL; // = 0x28790, // DIFF - union UINT_FLOAT CB_BLEND5_CONTROL; // = 0x28794, // DIFF - union UINT_FLOAT CB_BLEND6_CONTROL; // = 0x28798, // DIFF - union UINT_FLOAT CB_BLEND7_CONTROL; // = 0x2879C, // DIFF - union UINT_FLOAT CB_COLOR_CONTROL; //// // = 0x28808, // DIFF - union UINT_FLOAT CB_CLRCMP_CONTROL; //// // = 0x28C40, // SAME 0x28C30 - union UINT_FLOAT CB_CLRCMP_SRC; //// // = 0x28C44, // SAME 0x28C34 - union UINT_FLOAT CB_CLRCMP_DST; //// // = 0x28C48, // SAME 0x28C38 - union UINT_FLOAT CB_CLRCMP_MSK; //// // = 0x28C4C, // SAME 0x28C3C - - EVERGREEN_RENDER_TARGET_STATE render_target[EVERGREEN_MAX_RENDER_TARGETS]; - - radeonTexObj* textures[R700_TEXTURE_NUMBERUNITS]; - - EVERGREEN_CONFIG evergreen_config; - - GLboolean bEnablePerspective; - -} EVERGREEN_CHIP_CONTEXT; - -#endif /* _EVERGREEN_CHIP_H_ */
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c deleted file mode 100644 index 911775f590f..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_context.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/api_arrayelt.h" -#include "main/context.h" -#include "main/simple_list.h" -#include "main/imports.h" -#include "main/bufferobj.h" -#include "main/texobj.h" - -#include "radeon_common_context.h" -#include "evergreen_context.h" -#include "evergreen_state.h" -#include "evergreen_blit.h" -#include "r600_cmdbuf.h" -#include "radeon_queryobj.h" - -static void evergreen_get_lock(radeonContextPtr rmesa) -{ - drm_radeon_sarea_t *sarea = rmesa->sarea; - - if (sarea->ctx_owner != rmesa->dri.hwContext) { - sarea->ctx_owner = rmesa->dri.hwContext; - if (!rmesa->radeonScreen->kernel_mm) - radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom); - } -} - -static void evergreen_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa) -{ - /* please flush pipe do all pending work */ - /* to be enabled */ -} - -static void evergreen_vtbl_pre_emit_atoms(radeonContextPtr radeon) -{ - r700Start3D((context_t *)radeon); -} - -static void evergreen_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - if (mode) - context->radeon.Fallback |= bit; - else - context->radeon.Fallback &= ~bit; -} - -static void evergreen_emit_query_finish(radeonContextPtr radeon) -{ - context_t *context = (context_t*) radeon; - BATCH_LOCALS(&context->radeon); - - struct radeon_query_object *query = radeon->query.current; - - BEGIN_BATCH_NO_AUTOSTATE(4 + 2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); - R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1)); - R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */ - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE); - query->emitted_begin = GL_FALSE; -} - -void evergreen_init_vtbl(radeonContextPtr radeon) -{ - radeon->vtbl.get_lock = evergreen_get_lock; - radeon->vtbl.update_viewport_offset = evergreenUpdateViewportOffset; - radeon->vtbl.emit_cs_header = evergreen_vtbl_emit_cs_header; - radeon->vtbl.swtcl_flush = NULL; - radeon->vtbl.pre_emit_atoms = evergreen_vtbl_pre_emit_atoms; - radeon->vtbl.fallback = evergreen_fallback; - radeon->vtbl.emit_query_finish = evergreen_emit_query_finish; - radeon->vtbl.check_blit = evergreen_check_blit; - radeon->vtbl.blit = evergreen_blit; - radeon->vtbl.is_format_renderable = r600IsFormatRenderable; -} - - - diff --git a/src/mesa/drivers/dri/r600/evergreen_context.h b/src/mesa/drivers/dri/r600/evergreen_context.h deleted file mode 100644 index 4e50999c98f..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_context.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_CONTEXT_H_ -#define _EVERGREEN_CONTEXT_H_ - -extern void evergreen_init_vtbl(radeonContextPtr radeon); - -#endif //_EVERGREEN_CONTEXT_H_ - - - - - - diff --git a/src/mesa/drivers/dri/r600/evergreen_diff.h b/src/mesa/drivers/dri/r600/evergreen_diff.h deleted file mode 100644 index c3a5fd0a38a..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_diff.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_DIFF_H_ -#define _EVERGREEN_DIFF_H_ - -enum { - /* CB_BLEND_CONTROL */ - EG_CB_BLENDX_CONTROL_ENABLE_bit = 1 << 30, - /* PA_SC_SCREEN_SCISSOR_TL */ - EG_PA_SC_SCREEN_SCISSOR_TL__TL_X_mask = 0xffff << 0, - EG_PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask = 0xffff << 16, - /* PA_SC_SCREEN_SCISSOR_BR */ - EG_PA_SC_SCREEN_SCISSOR_BR__BR_X_mask = 0xffff << 0, - EG_PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask = 0xffff << 16, - /* PA_SC_WINDOW_SCISSOR_TL */ - EG_PA_SC_WINDOW_SCISSOR_TL__TL_X_mask = 0x7fff << 0, - EG_PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, - /* PA_SC_WINDOW_SCISSOR_BR */ - EG_PA_SC_WINDOW_SCISSOR_BR__BR_X_mask = 0x7fff << 0, - EG_PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, - /* PA_SC_CLIPRECT_0_TL */ - EG_PA_SC_CLIPRECT_0_TL__TL_X_mask = 0x7fff << 0, - EG_PA_SC_CLIPRECT_0_TL__TL_Y_mask = 0x7fff << 16, - /* PA_SC_CLIPRECT_0_BR */ - EG_PA_SC_CLIPRECT_0_BR__BR_X_mask = 0x7fff << 0, - EG_PA_SC_CLIPRECT_0_BR__BR_Y_mask = 0x7fff << 16, - /* PA_SC_GENERIC_SCISSOR_TL */ - EG_PA_SC_GENERIC_SCISSOR_TL__TL_X_mask = 0x7fff << 0, - EG_PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, - /* PA_SC_GENERIC_SCISSOR_BR */ - EG_PA_SC_GENERIC_SCISSOR_BR__BR_X_mask = 0x7fff << 0, - EG_PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, - /* PA_SC_VPORT_SCISSOR_0_TL */ - EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask = 0x7fff << 0, - EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask = 0x7fff << 16, - /* PA_SC_VPORT_SCISSOR_0_BR */ - EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask = 0x7fff << 0, - EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask = 0x7fff << 16, - /* PA_SC_WINDOW_OFFSET */ - EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_shift = 0, - EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_mask = 0xffff << 0, - EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_shift = 16, - EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_mask = 0xffff << 16, - /* SPI_BARYC_CNTL */ - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift = 4, - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask = 0x3 << 4, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift = 20, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask = 0x3 << 20, - /* DB_SHADER_CONTROL */ - EG_DB_SHADER_CONTROL__DUAL_EXPORT_ENABLE_bit = 1 << 9, - - /* DB_Z_INFO */ - EG_DB_Z_INFO__FORMAT_shift = 0, //2; - EG_DB_Z_INFO__FORMAT_mask = 0x3, - //2; - EG_DB_Z_INFO__ARRAY_MODE_shift = 4, //4; - EG_DB_Z_INFO__ARRAY_MODE_mask = 0xf << 4, - EG_DB_Z_INFO__TILE_SPLIT_shift = 8, //3; - EG_DB_Z_INFO__TILE_SPLIT_mask = 0x7 << 8, - //1; - EG_DB_Z_INFO__NUM_BANKS_shift = 12, //2; - EG_DB_Z_INFO__NUM_BANKS_mask = 0x3 << 12, - //2; - EG_DB_Z_INFO__BANK_WIDTH_shift = 16, //2; - EG_DB_Z_INFO__BANK_WIDTH_mask = 0x3 << 16, - //2; - EG_DB_Z_INFO__BANK_HEIGHT_shift = 20, //2; - EG_DB_Z_INFO__BANK_HEIGHT_mask = 0x3 << 20, - - EG_Z_INVALID = 0x00000000, - EG_Z_16 = 0x00000001, - EG_Z_24 = 0x00000002, - EG_Z_32_FLOAT = 0x00000003, - EG_ADDR_SURF_TILE_SPLIT_256B = 0x00000002, - EG_ADDR_SURF_8_BANK = 0x00000002, - EG_ADDR_SURF_BANK_WIDTH_1 = 0x00000000, - EG_ADDR_SURF_BANK_HEIGHT_1 = 0x00000000, - /* DB_STENCIL_INFO */ - EG_DB_STENCIL_INFO__FORMAT_bit = 1, //1; - //7; - EG_DB_STENCIL_INFO__TILE_SPLIT_shift = 8, //3; - EG_DB_STENCIL_INFO__TILE_SPLIT_mask = 0x7 << 8, - - /* DB_DEPTH_SIZE */ - EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_shift = 0, // 11; - EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_mask = 0x7ff, - EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_shift = 11, // 11; - EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_mask = 0x7ff << 11, - - /* DB_COUNT_CONTROL */ - EG_DB_COUNT_CONTROL__ZPASS_INCREMENT_DISABLE_shift = 0, //1 - EG_DB_COUNT_CONTROL__ZPASS_INCREMENT_DISABLE_bit = 1, - EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_shift = 1, //1 - EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit = 1 << 1, - - /* CB_COLOR_CONTROL */ - //3; - EG_CB_COLOR_CONTROL__DEGAMMA_ENABLE_bit = 1 << 3,//1; - EG_CB_COLOR_CONTROL__MODE_shift = 4, //3; - EG_CB_COLOR_CONTROL__MODE_mask = 0x7 << 4, - //9; - EG_CB_COLOR_CONTROL__ROP3_shift = 16, //8; - EG_CB_COLOR_CONTROL__ROP3_mask = 0xff << 16, - EG_CB_NORMAL = 0x00000001, - - /* CB_COLOR0_INFO */ - EG_CB_COLOR0_INFO__ENDIAN_shift = 0, //2; - EG_CB_COLOR0_INFO__ENDIAN_mask = 0x3, - EG_CB_COLOR0_INFO__FORMAT_shift = 2, //6; - EG_CB_COLOR0_INFO__FORMAT_mask = 0x3f << 2, - EG_CB_COLOR0_INFO__ARRAY_MODE_shift = 8, //4; - EG_CB_COLOR0_INFO__ARRAY_MODE_mask = 0xf << 8, - EG_CB_COLOR0_INFO__NUMBER_TYPE_shift = 12, //3; - EG_CB_COLOR0_INFO__NUMBER_TYPE_mask = 0x7 << 12, - EG_CB_COLOR0_INFO__COMP_SWAP_shift = 15, //2; - EG_CB_COLOR0_INFO__COMP_SWAP_mask = 0x3 << 15, - EG_CB_COLOR0_INFO__FAST_CLEAR_bit = 1 << 17,//1; - EG_CB_COLOR0_INFO__COMPRESSION_bit = 1 << 18,//1; - EG_CB_COLOR0_INFO__BLEND_CLAMP_bit = 1 << 19,//1; - EG_CB_COLOR0_INFO__BLEND_BYPASS_bit = 1 << 20,//1; - EG_CB_COLOR0_INFO__SIMPLE_FLOAT_bit = 1 << 21,//1; - EG_CB_COLOR0_INFO__ROUND_MODE_bit = 1 << 22,//1; - EG_CB_COLOR0_INFO__TILE_COMPACT_bit = 1 << 23,//1; - EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift = 24, //2; - EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask = 0x3 << 24, - EG_CB_COLOR0_INFO__RAT_bit = 1 << 26,//1; - EG_CB_COLOR0_INFO__RESOURCE_TYPE_shift = 27, //3; - EG_CB_COLOR0_INFO__RESOURCE_TYPE_mask = 0x7 << 27, - - /* CB_COLOR0_ATTRIB */ - EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_shift = 4, - EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit = 1 << 4, - - /* SPI_CONFIG_CNTL_1 */ - EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_shift = 0, - EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_mask = 0xf, - /* SQ_MS_FIFO_SIZES */ - EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_shift = 0, - EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_mask = 0xff, - EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_shift = 8, - EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_mask = 0x1f << 8, - EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_shift = 16, - EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_mask = 0xff << 16, - EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_shift = 24, - EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_mask = 0x1f << 24, - /* SQ_CONFIG */ - EG_SQ_CONFIG__VC_ENABLE_bit = 1, - EG_SQ_CONFIG__EXPORT_SRC_C_bit = 1 << 1, - EG_SQ_CONFIG__PS_PRIO_shift = 24, - EG_SQ_CONFIG__PS_PRIO_mask = 0x3 << 24, - EG_SQ_CONFIG__VS_PRIO_shift = 26, - EG_SQ_CONFIG__VS_PRIO_mask = 0x3 << 26, - EG_SQ_CONFIG__GS_PRIO_shift = 28, - EG_SQ_CONFIG__GS_PRIO_mask = 0x3 << 28, - EG_SQ_CONFIG__ES_PRIO_shift = 30, - EG_SQ_CONFIG__ES_PRIO_mask = 0x3 << 30, - /* PA_SC_FORCE_EOV_MAX_CNTS */ - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_shift = 0, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_mask = 0x3fff, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_shift = 16, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_mask = 0x3fff << 16, - /* VGT_CACHE_INVALIDATION */ - EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_shift = 0, - EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_mask = 0x3, - /* CB_COLOR0_PITCH */ - EG_CB_COLOR0_PITCH__TILE_MAX_shift = 0, - EG_CB_COLOR0_PITCH__TILE_MAX_mask = 0x7ff, - /* CB_COLOR0_SLICE */ - EG_CB_COLOR0_SLICE__TILE_MAX_shift = 0, - EG_CB_COLOR0_SLICE__TILE_MAX_mask = 0x3fffff, - /* SQ_VTX_CONSTANT_WORD3_0 */ - EG_SQ_VTX_CONSTANT_WORD3_0__UNCACHED_shift = 2, - EG_SQ_VTX_CONSTANT_WORD3_0__UNCACHED_bit = 1 << 2, - - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift = 3, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask = 0x7 << 3, - - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift = 6, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask = 0x7 << 6, - - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift = 9, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask = 0x7 << 9, - - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift = 12, - EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask = 0x7 << 12, - /* SQ_VTX_CONSTANT_WORD4_0 */ - EG_SQ_VTX_CONSTANT_WORD4_0__NUM_ELEMENTS_shift = 0, - EG_SQ_VTX_CONSTANT_WORD4_0__NUM_ELEMENTS_mask = 0xFFFFFFFF, - /* SQ_VTX_CONSTANT_WORD7_0 */ - EG_SQ_VTX_CONSTANT_WORD7_0__TYPE_shift = 30, - EG_SQ_VTX_CONSTANT_WORD7_0__TYPE_mask = 0x3 << 30, - /* SQ_TEX_SAMPLER_WORD0_0 */ - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift = 0, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask = 0x7, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_shift = 3, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_mask = 0x7 << 3, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_shift = 6, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_mask = 0x7 << 6, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift = 9, // 2; - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask = 0x3 << 9, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift = 11, // 2; - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask = 0x3 << 11, - EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_shift = 13, // 2; - EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_mask = 0x3 << 13, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift = 15, // 2; - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask = 0x3 << 15, - EG_SQ_TEX_SAMPLER_WORD0_0__MAX_ANISO_RATIO_shift = 17, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__MAX_ANISO_RATIO_mask = 0x7 << 17, - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift = 20,//2; - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask = 0x3 << 20, - EG_SQ_TEX_SAMPLER_WORD0_0__DCF_shift = 22, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask = 0x7 << 22, - EG_SQ_TEX_SAMPLER_WORD0_0__CHROMA_KEY_shift = 25, // 2; - EG_SQ_TEX_SAMPLER_WORD0_0__CHROMA_KEY_mask = 0x3 << 25, - EG_SQ_TEX_SAMPLER_WORD0_0__ANISO_THRESHOLD_shift = 27, // 3; - EG_SQ_TEX_SAMPLER_WORD0_0__ANISO_THRESHOLD_mask = 0x7 << 27, - EG_SQ_TEX_SAMPLER_WORD0_0__Reserved_shift = 30, // 2 - EG_SQ_TEX_SAMPLER_WORD0_0__Reserved_mask = 0x3 << 30, - /* SQ_TEX_SAMPLER_WORD1_0 */ - EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_shift = 0, // 12; - EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_mask = 0xfff, - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift = 12,// 12; - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask = 0xfff << 12, - /* SQ_TEX_SAMPLER_WORD2_0 */ - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_shift = 0, //14; - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_mask = 0x3fff, - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_SEC_shift = 14,//6; - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_SEC_mask = 0x3f << 14, - EG_SQ_TEX_SAMPLER_WORD2_0__MC_COORD_TRUNCATE_shift = 20,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__MC_COORD_TRUNCATE_bit = 1 << 20, - EG_SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_shift = 21,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_bit = 1 << 21, - EG_SQ_TEX_SAMPLER_WORD2_0__ANISO_BIAS_shift = 22,//6; - EG_SQ_TEX_SAMPLER_WORD2_0__ANISO_BIAS_mask = 0x3f << 22, - EG_SQ_TEX_SAMPLER_WORD2_0__TRUNCATE_COORD_shift = 28,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__TRUNCATE_COORD_bit = 1 << 28, - EG_SQ_TEX_SAMPLER_WORD2_0__DISABLE_CUBE_WRAP_shift = 29,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__DISABLE_CUBE_WRAP_bit = 1 << 29, - EG_SQ_TEX_SAMPLER_WORD2_0__Reserved_shift = 30,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__Reserved_bit = 1 << 30, - EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_shift = 31,//1; - EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit = 1 << 31, - /* SQ_TEX_RESOURCE_WORD0_0 */ - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift = 0, // 3; - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask = 0x7, - EG_SQ_TEX_RESOURCE_WORD0_0__ISET_shift = 3, // 1; - EG_SQ_TEX_RESOURCE_WORD0_0__ISET_bit = 1 << 3, - EG_SQ_TEX_RESOURCE_WORD0_0__Reserve_shift = 4, // 1; - EG_SQ_TEX_RESOURCE_WORD0_0__Reserve_bit = 1 << 4, - EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_shift = 5, // 1; - EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit = 1 << 5, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift = 6, // 12; - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask = 0xfff << 6, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift = 18,// 14; - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask = 0x3fff << 18, - /* SQ_TEX_RESOURCE_WORD1_0 */ - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift = 0, // 14; - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask = 0x3fff, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift = 14,// 13; - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask = 0x1fff << 14, - EG_SQ_TEX_RESOURCE_WORD1_0__Reserved_shift = 27,// 1; - EG_SQ_TEX_RESOURCE_WORD1_0__Reserved_bit = 1 << 27, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift = 28,// 4; - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask = 0xf << 28, - /* SQ_TEX_RESOURCE_WORD6_0 */ - EG_SQ_TEX_RESOURCE_WORD6_0__MAX_ANISO_RATIO_shift = 0, //: 3; - EG_SQ_TEX_RESOURCE_WORD6_0__MAX_ANISO_RATIO_mask = 0x7, - EG_SQ_TEX_RESOURCE_WORD6_0__INTERLACED_shift = 6, //1; - EG_SQ_TEX_RESOURCE_WORD6_0__INTERLACED_bit = 1 << 6, - EG_SQ_TEX_RESOURCE_WORD6_0__MIN_LOD_shift = 8, //12; - EG_SQ_TEX_RESOURCE_WORD6_0__MIN_LOD_mask = 0xfff << 8, - EG_SQ_TEX_RESOURCE_WORD6_0__TILE_SPLIT_shift = 29,// 3; - EG_SQ_TEX_RESOURCE_WORD6_0__TILE_SPLIT_mask = 0x7 << 29, - /* SQ_TEX_RESOURCE_WORD7_0 */ - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift = 0, // 6; - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask = 0x3f, - EG_SQ_TEX_RESOURCE_WORD7_0__MACRO_TILE_ASPECT_shift = 6, // 2; - EG_SQ_TEX_RESOURCE_WORD7_0__MACRO_TILE_ASPECT_mask = 0x3 << 6, - EG_SQ_TEX_RESOURCE_WORD7_0__BANK_WIDTH_shift = 8, // 2; - EG_SQ_TEX_RESOURCE_WORD7_0__BANK_WIDTH_mask = 0x3 << 8, - EG_SQ_TEX_RESOURCE_WORD7_0__BANK_HEIGHT_shift = 10,// 2; - EG_SQ_TEX_RESOURCE_WORD7_0__BANK_HEIGHT_mask = 0x3 << 10, - EG_SQ_TEX_RESOURCE_WORD7_0__DEPTH_SAMPLE_ORDER_shift = 15,// 1; - EG_SQ_TEX_RESOURCE_WORD7_0__DEPTH_SAMPLE_ORDER_bit = 1 << 15, - EG_SQ_TEX_RESOURCE_WORD7_0__NUM_BANKS_shift = 16,// 2; - EG_SQ_TEX_RESOURCE_WORD7_0__NUM_BANKS_mask = 0x3 << 16, - EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_shift = 30,// 2; - EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_mask = 0x3 << 30, -}; - -/* */ - -#define EG_SQ_FETCH_RESOURCE_COUNT 0x00000400 -#define EG_SQ_TEX_SAMPLER_COUNT 0x0000006c -#define EG_SQ_LOOP_CONST_COUNT 0x000000c0 - -#define EG_SET_RESOURCE_OFFSET 0x30000 -#define EG_SET_RESOURCE_END 0x30400 //r600 := offset + 0x4000 - -#define EG_SET_LOOP_CONST_OFFSET 0x3A200 -#define EG_SET_LOOP_CONST_END 0x3A26C //r600 := offset + 0x180 - - -#define EG_SQ_FETCH_RESOURCE_VS_OFFSET 0x000000b0 -#define EG_FETCH_RESOURCE_STRIDE 8 - -#define EG_SET_BOOL_CONST_OFFSET 0x3A500 -#define EG_SET_BOOL_CONST_END 0x3A506 - - -#endif //_EVERGREEN_DIFF_H_ diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c deleted file mode 100644 index cc584ca2b35..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ /dev/null @@ -1,802 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/imports.h" - -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" -#include "program/program.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" -#include "r600_emit.h" - -#include "evergreen_vertprog.h" -#include "evergreen_fragprog.h" - -void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) -{ - static const gl_state_index winstate[STATE_LENGTH] - = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; - struct prog_instruction *newInst, *inst; - GLint win_size; /* state reference */ - GLuint wpos_temp; /* temp register */ - int i, j; - - /* PARAM win_size = STATE_FB_SIZE */ - win_size = _mesa_add_state_reference(fprog->Base.Parameters, winstate); - - wpos_temp = fprog->Base.NumTemporaries++; - - /* scan program where WPOS is used and replace with wpos_temp */ - inst = fprog->Base.Instructions; - for (i = 0; i < fprog->Base.NumInstructions; i++) { - for (j=0; j < 3; j++) { - if(inst->SrcReg[j].File == PROGRAM_INPUT && - inst->SrcReg[j].Index == FRAG_ATTRIB_WPOS) { - inst->SrcReg[j].File = PROGRAM_TEMPORARY; - inst->SrcReg[j].Index = wpos_temp; - } - } - inst++; - } - - _mesa_insert_instructions(&(fprog->Base), 0, 1); - - newInst = fprog->Base.Instructions; - /* invert wpos.y - * wpos_temp.xyzw = wpos.x-yzw + winsize.0y00 */ - newInst[0].Opcode = OPCODE_ADD; - newInst[0].DstReg.File = PROGRAM_TEMPORARY; - newInst[0].DstReg.Index = wpos_temp; - newInst[0].DstReg.WriteMask = WRITEMASK_XYZW; - - newInst[0].SrcReg[0].File = PROGRAM_INPUT; - newInst[0].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - newInst[0].SrcReg[0].Swizzle = SWIZZLE_XYZW; - newInst[0].SrcReg[0].Negate = NEGATE_Y; - - newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR; - newInst[0].SrcReg[1].Index = win_size; - newInst[0].SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ZERO); - -} - -//TODO : Validate FP input with VP output. -void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx) -{ - unsigned int unBit; - unsigned int i; - - /* match fp inputs with vp exports. */ - struct evergreen_vertex_program_cont *vpc = - (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; - GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; - - pAsm->number_used_registers = 0; - -//Input mapping : mesa_fp->Base.InputsRead set the flag, set in - //The flags parsed in parse_attrib_binding. FRAG_ATTRIB_COLx, FRAG_ATTRIB_TEXx, ... - //MUST match order in Map_Vertex_Output - unBit = 1 << FRAG_ATTRIB_WPOS; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_COL0; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_COL1; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_FOGC; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i] = pAsm->number_used_registers++; - } - } - -/* order has been taken care of */ -#if 1 - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0] = pAsm->number_used_registers++; - } - } -#else - if( (mesa_fp->Base.InputsRead >> FRAG_ATTRIB_VAR0) > 0 ) - { - struct evergreen_vertex_program_cont *vpc = - (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; - struct gl_program_parameter_list * VsVarying = vpc->mesa_program.Base.Varying; - struct gl_program_parameter_list * PsVarying = mesa_fp->Base.Varying; - struct gl_program_parameter * pVsParam; - struct gl_program_parameter * pPsParam; - GLuint j, k; - GLuint unMaxVarying = 0; - - for(i=0; i<VsVarying->NumParameters; i++) - { - pAsm->uiFP_AttributeMap[i + FRAG_ATTRIB_VAR0] = 0; - } - - for(i=FRAG_ATTRIB_VAR0; i<FRAG_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_fp->Base.InputsRead & unBit) - { - j = i - FRAG_ATTRIB_VAR0; - pPsParam = PsVarying->Parameters + j; - - for(k=0; k<VsVarying->NumParameters; k++) - { - pVsParam = VsVarying->Parameters + k; - - if( strcmp(pPsParam->Name, pVsParam->Name) == 0) - { - pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers + k; - if(k > unMaxVarying) - { - unMaxVarying = k; - } - break; - } - } - } - } - - pAsm->number_used_registers += unMaxVarying + 1; - } -#endif - unBit = 1 << FRAG_ATTRIB_FACE; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE] = pAsm->number_used_registers++; - } - - unBit = 1 << FRAG_ATTRIB_PNTC; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC] = pAsm->number_used_registers++; - } - - pAsm->uIIns = pAsm->number_used_registers; - -/* Map temporary registers (GPRs) */ - pAsm->starting_temp_register_number = pAsm->number_used_registers; - - if(mesa_fp->Base.NumNativeTemporaries >= mesa_fp->Base.NumTemporaries) - { - pAsm->number_used_registers += mesa_fp->Base.NumNativeTemporaries; - } - else - { - pAsm->number_used_registers += mesa_fp->Base.NumTemporaries; - } - -/* Output mapping */ - pAsm->number_of_exports = 0; - pAsm->number_of_colorandz_exports = 0; /* don't include stencil and mask out. */ - pAsm->starting_export_register_number = pAsm->number_used_registers; - unBit = 1 << FRAG_RESULT_COLOR; - if(mesa_fp->Base.OutputsWritten & unBit) - { - pAsm->uiFP_OutputMap[FRAG_RESULT_COLOR] = pAsm->number_used_registers++; - pAsm->number_of_exports++; - pAsm->number_of_colorandz_exports++; - } - unBit = 1 << FRAG_RESULT_DEPTH; - if(mesa_fp->Base.OutputsWritten & unBit) - { - pAsm->depth_export_register_number = pAsm->number_used_registers; - pAsm->uiFP_OutputMap[FRAG_RESULT_DEPTH] = pAsm->number_used_registers++; - pAsm->number_of_exports++; - pAsm->number_of_colorandz_exports++; - pAsm->pR700Shader->depthIsExported = 1; - } - - pAsm->flag_reg_index = pAsm->number_used_registers++; - - pAsm->uFirstHelpReg = pAsm->number_used_registers; -} - -GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, - struct gl_fragment_program *mesa_fp) -{ - GLuint i, j; - GLint * puiTEMPwrites; - GLint * puiTEMPreads; - struct prog_instruction * pILInst; - InstDeps *pInstDeps; - struct prog_instruction * texcoord_DepInst; - GLint nDepInstID; - - puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); - puiTEMPreads = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); - - for(i=0; i<mesa_fp->Base.NumTemporaries; i++) - { - puiTEMPwrites[i] = -1; - puiTEMPreads[i] = -1; - } - - pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_fp->Base.NumInstructions); - - for(i=0; i<mesa_fp->Base.NumInstructions; i++) - { - pInstDeps[i].nDstDep = -1; - pILInst = &(mesa_fp->Base.Instructions[i]); - - //Dst - if(pILInst->DstReg.File == PROGRAM_TEMPORARY) - { - //Set lastwrite for the temp - puiTEMPwrites[pILInst->DstReg.Index] = i; - } - - //Src - for(j=0; j<3; j++) - { - if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) - { - //Set dep. - pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; - //Set first read - if(puiTEMPreads[pILInst->SrcReg[j].Index] < 0 ) - { - puiTEMPreads[pILInst->SrcReg[j].Index] = i; - } - } - else - { - pInstDeps[i].nSrcDeps[j] = -1; - } - } - } - - fp->r700AsmCode.pInstDeps = pInstDeps; - - //Find dep for tex inst - for(i=0; i<mesa_fp->Base.NumInstructions; i++) - { - pILInst = &(mesa_fp->Base.Instructions[i]); - - if(GL_TRUE == IsTex(pILInst->Opcode)) - { //src0 is the tex coord register, src1 is texunit, src2 is textype - nDepInstID = pInstDeps[i].nSrcDeps[0]; - if(nDepInstID >= 0) - { - texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); - if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) - { - pInstDeps[nDepInstID].nDstDep = i; - pInstDeps[i].nDstDep = i; - } - else if(GL_TRUE == IsTex(texcoord_DepInst->Opcode) ) - { - pInstDeps[i].nDstDep = i; - } - else - { //... other deps? - } - } - // make sure that we dont overwrite src used earlier - nDepInstID = puiTEMPreads[pILInst->DstReg.Index]; - if(nDepInstID < i) - { - pInstDeps[i].nDstDep = puiTEMPreads[pILInst->DstReg.Index]; - texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); - if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) - { - pInstDeps[nDepInstID].nDstDep = i; - } - - } - - } - } - - FREE(puiTEMPwrites); - FREE(puiTEMPreads); - - return GL_TRUE; -} - -GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx) -{ - GLuint number_of_colors_exported; - GLboolean z_enabled = GL_FALSE; - GLuint unBit, shadow_unit; - int i; - struct prog_instruction *inst; - gl_state_index shadow_ambient[STATE_LENGTH] - = { STATE_INTERNAL, STATE_SHADOW_AMBIENT, 0, 0, 0}; - - //Init_Program - Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); - - fp->constbo0 = NULL; - fp->r700AsmCode.bUseMemConstant = GL_TRUE; - fp->r700AsmCode.unAsic = 8; - - if(mesa_fp->Base.InputsRead & FRAG_BIT_WPOS) - { - evergreen_insert_wpos_code(ctx, mesa_fp); - } - - /* add/map consts for ARB_shadow_ambient */ - if(mesa_fp->Base.ShadowSamplers) - { - inst = mesa_fp->Base.Instructions; - for (i = 0; i < mesa_fp->Base.NumInstructions; i++) - { - if(inst->TexShadow == 1) - { - shadow_unit = inst->TexSrcUnit; - shadow_ambient[2] = shadow_unit; - fp->r700AsmCode.shadow_regs[shadow_unit] = - _mesa_add_state_reference(mesa_fp->Base.Parameters, shadow_ambient); - } - inst++; - } - } - - evergreen_Map_Fragment_Program(&(fp->r700AsmCode), mesa_fp, ctx); - - if( GL_FALSE == evergreen_Find_Instruction_Dependencies_fp(fp, mesa_fp) ) - { - return GL_FALSE; - } - - InitShaderProgram(&(fp->r700AsmCode)); - - for(i=0; i < MAX_SAMPLERS; i++) - { - fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i]; - } - - fp->r700AsmCode.unCurNumILInsts = mesa_fp->Base.NumInstructions; - - if( GL_FALSE == AssembleInstr(0, - 0, - mesa_fp->Base.NumInstructions, - &(mesa_fp->Base.Instructions[0]), - &(fp->r700AsmCode)) ) - { - return GL_FALSE; - } - - if(GL_FALSE == Process_Fragment_Exports(&(fp->r700AsmCode), mesa_fp->Base.OutputsWritten) ) - { - return GL_FALSE; - } - - if( GL_FALSE == RelocProgram(&(fp->r700AsmCode), &(mesa_fp->Base)) ) - { - return GL_FALSE; - } - - fp->r700Shader.nRegs = (fp->r700AsmCode.number_used_registers == 0) ? 0 - : (fp->r700AsmCode.number_used_registers - 1); - - fp->r700Shader.nParamExports = fp->r700AsmCode.number_of_exports; - - number_of_colors_exported = fp->r700AsmCode.number_of_colorandz_exports; - - unBit = 1 << FRAG_RESULT_DEPTH; - if(mesa_fp->Base.OutputsWritten & unBit) - { - z_enabled = GL_TRUE; - number_of_colors_exported--; - } - - /* illegal to set this to 0 */ - if(number_of_colors_exported || z_enabled) - { - fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled; - } - else - { - fp->r700Shader.exportMode = (1 << 1); - } - - fp->translated = GL_TRUE; - - return GL_TRUE; -} - -void evergreenSelectFragmentShader(struct gl_context *ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) - (ctx->FragmentProgram._Current); - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - { - fp->r700AsmCode.bR6xx = 1; - } - - if (GL_FALSE == fp->translated) - evergreenTranslateFragmentShader(fp, &(fp->mesa_program), ctx); -} - -void * evergreenGetActiveFpShaderBo(struct gl_context * ctx) -{ - struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) - (ctx->FragmentProgram._Current); - - return fp->shaderbo; -} - -void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx) -{ - struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) - (ctx->FragmentProgram._Current); - - return fp->constbo0; -} - -GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) - (ctx->FragmentProgram._Current); - r700_AssemblerBase *pAsm = &(fp->r700AsmCode); - struct gl_fragment_program *mesa_fp = &(fp->mesa_program); - unsigned int ui, i; - unsigned int unNumOfReg; - unsigned int unBit; - GLuint exportCount; - GLboolean point_sprite = GL_FALSE; - - if(GL_FALSE == fp->loaded) - { - if(fp->r700Shader.bNeedsAssembly == GL_TRUE) - { - Assemble( &(fp->r700Shader) ); - } - - r600EmitShader(ctx, - &(fp->shaderbo), - (GLvoid *)(fp->r700Shader.pProgram), - fp->r700Shader.uShaderBinaryDWORDSize, - "FS"); - - fp->loaded = GL_TRUE; - } - - /* TODO : enable this after MemUse fixed *= - (context->chipobj.MemUse)(context, fp->shadercode.buf->id); - */ - - EVERGREEN_STATECHANGE(context, sq); - - evergreen->SQ_PGM_RESOURCES_PS.u32All = 0; - SETbit(evergreen->SQ_PGM_RESOURCES_PS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); - - evergreen->ps.SQ_ALU_CONST_CACHE_PS_0.u32All = 0; - evergreen->ps.SQ_PGM_START_PS.u32All = 0; - - EVERGREEN_STATECHANGE(context, spi); - - unNumOfReg = fp->r700Shader.nRegs + 1; - - ui = (evergreen->SPI_PS_IN_CONTROL_0.u32All & NUM_INTERP_mask) / (1 << NUM_INTERP_shift); - - /* PS uses fragment.position */ - if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) - { - ui += 1; - SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, CENTERS_ONLY, BARYC_SAMPLE_CNTL_shift, BARYC_SAMPLE_CNTL_mask); - SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); - SETbit(evergreen->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); - } - else - { - CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); - CLEARbit(evergreen->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); - } - - if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_FACE)) - { - ui += 1; - SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - SETbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); - SETbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ALL_BITS_bit); - SETfield(evergreen->SPI_PS_IN_CONTROL_1.u32All, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE], FRONT_FACE_ADDR_shift, FRONT_FACE_ADDR_mask); - } - else - { - CLEARbit(evergreen->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); - } - - /* see if we need any point_sprite replacements */ - for (i = VERT_RESULT_TEX0; i<= VERT_RESULT_TEX7; i++) - { - if(ctx->Point.CoordReplace[i - VERT_RESULT_TEX0] == GL_TRUE) - point_sprite = GL_TRUE; - } - - if ((mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) || point_sprite) - { - /* for FRAG_ATTRIB_PNTC we need to increase num_interp */ - if(mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) - { - ui++; - SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - } - SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); - SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_S, PNT_SPRITE_OVRD_X_shift, PNT_SPRITE_OVRD_X_mask); - SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_T, PNT_SPRITE_OVRD_Y_shift, PNT_SPRITE_OVRD_Y_mask); - SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_0, PNT_SPRITE_OVRD_Z_shift, PNT_SPRITE_OVRD_Z_mask); - SETfield(evergreen->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_1, PNT_SPRITE_OVRD_W_shift, PNT_SPRITE_OVRD_W_mask); - if(ctx->Point.SpriteOrigin == GL_LOWER_LEFT) - SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); - else - CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); - } - else - { - CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); - } - - - ui = (unNumOfReg < ui) ? ui : unNumOfReg; - - SETfield(evergreen->SQ_PGM_RESOURCES_PS.u32All, ui, NUM_GPRS_shift, NUM_GPRS_mask); - - CLEARbit(evergreen->SQ_PGM_RESOURCES_PS.u32All, UNCACHED_FIRST_INST_bit); - - if(fp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ - { - SETfield(evergreen->SQ_PGM_RESOURCES_PS.u32All, fp->r700Shader.uStackSize, - STACK_SIZE_shift, STACK_SIZE_mask); - } - - SETfield(evergreen->SQ_PGM_EXPORTS_PS.u32All, fp->r700Shader.exportMode, - EXPORT_MODE_shift, EXPORT_MODE_mask); - - // emit ps input map - struct evergreen_vertex_program_cont *vpc = - (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; - GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; - - for(ui = 0; ui < EVERGREEN_MAX_SHADER_EXPORTS; ui++) - evergreen->SPI_PS_INPUT_CNTL[ui].u32All = 0; - - unBit = 1 << FRAG_ATTRIB_WPOS; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_COL0; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - else - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_COL1; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - if (evergreen->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - else - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_FOGC; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - /* ARB_point_sprite */ - if(ctx->Point.CoordReplace[i] == GL_TRUE) - { - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); - } - } - } - - unBit = 1 << FRAG_ATTRIB_FACE; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - unBit = 1 << FRAG_ATTRIB_PNTC; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); - } - - - - - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0]; - SETbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(evergreen->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - } - - exportCount = (evergreen->SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); - - return GL_TRUE; -} - -GLboolean evergreenSetupFPconstants(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) - (ctx->FragmentProgram._Current); - r700_AssemblerBase *pAsm = &(fp->r700AsmCode); - - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui; - int alloc_size; - - /* sent out shader constants. */ - paramList = fp->mesa_program.Base.Parameters; - - if(NULL != paramList) - { - _mesa_load_state_parameters(ctx, paramList); - - if (paramList->NumParameters > EVERGREEN_MAX_DX9_CONSTS) - return GL_FALSE; - - EVERGREEN_STATECHANGE(context, sq); - - evergreen->ps.num_consts = paramList->NumParameters; - - unNumParamData = paramList->NumParameters; - - for(ui=0; ui<unNumParamData; ui++) { - evergreen->ps.consts[ui][0].f32All = paramList->ParameterValues[ui][0].f; - evergreen->ps.consts[ui][1].f32All = paramList->ParameterValues[ui][1].f; - evergreen->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2].f; - evergreen->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3].f; - } - - /* alloc multiple of 16 constants */ - alloc_size = ((unNumParamData * 4 * 4) + 255) & ~255; - - /* Load fp constants to gpu */ - if(unNumParamData > 0) - { - radeonAllocDmaRegion(&context->radeon, - &context->fp_Constbo, - &context->fp_bo_offset, - alloc_size, - 256); - r600EmitShaderConsts(ctx, - context->fp_Constbo, - context->fp_bo_offset, - (GLvoid *)&(evergreen->ps.consts[0][0]), - unNumParamData * 4 * 4); - } - } else - evergreen->ps.num_consts = 0; - - COMPILED_SUB * pCompiledSub; - GLuint uj; - GLuint unConstOffset = evergreen->ps.num_consts; - for(ui=0; ui<pAsm->unNumPresub; ui++) - { - pCompiledSub = pAsm->presubs[ui].pCompiledSub; - - evergreen->ps.num_consts += pCompiledSub->NumParameters; - - for(uj=0; uj<pCompiledSub->NumParameters; uj++) - { - evergreen->ps.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; - evergreen->ps.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; - evergreen->ps.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; - evergreen->ps.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; - } - unConstOffset += pCompiledSub->NumParameters; - } - - return GL_TRUE; -} - diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h deleted file mode 100644 index 97f06a75fc0..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_FRAGPROG_H_ -#define _EVERGREEN_FRAGPROG_H_ - -#include "r600_context.h" -#include "r700_assembler.h" - -struct evergreen_fragment_program -{ - struct gl_fragment_program mesa_program; - - r700_AssemblerBase r700AsmCode; - R700_Shader r700Shader; - - GLboolean translated; - GLboolean loaded; - GLboolean error; - - void * shaderbo; - - GLuint k0used; - void * constbo0; - - GLboolean WritesDepth; - GLuint optimization; -}; - -/* Internal */ -void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); - -void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx); -GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, - struct gl_fragment_program *mesa_fp); - -GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, - struct gl_fragment_program *mesa_vp, - struct gl_context *ctx); - -/* Interface */ -extern void evergreenSelectFragmentShader(struct gl_context *ctx); - -extern GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx); - -extern GLboolean evergreenSetupFPconstants(struct gl_context * ctx); - -extern void * evergreenGetActiveFpShaderBo(struct gl_context * ctx); - -extern void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx); - -#endif /*_EVERGREEN_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.c b/src/mesa/drivers/dri/r600/evergreen_ioctl.c deleted file mode 100644 index 19f8e6b3ec3..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <sched.h> -#include <errno.h> - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/simple_list.h" - -#include "radeon_common.h" -#include "r600_context.h" - -#include "evergreen_ioctl.h" - -#include "r700_clear.h" - -void evergreenClear(struct gl_context * ctx, GLbitfield mask) -{ - r700Clear(ctx, mask); -} - -void evergreenInitIoctlFuncs(struct dd_function_table *functions) -{ - functions->Clear = evergreenClear; - functions->Finish = radeonFinish; - functions->Flush = radeonFlush; -} diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.h b/src/mesa/drivers/dri/r600/evergreen_ioctl.h deleted file mode 100644 index a41b5b60333..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_IOCTL_H_ -#define _EVERGREEN_IOCTL_H_ - -#include "r600_context.h" -#include "radeon_drm.h" - -extern void evergreenClear(struct gl_context * ctx, GLbitfield mask); -extern void evergreenInitIoctlFuncs(struct dd_function_table *functions); - -#endif /* _EVERGREEN_IOCTL_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_off.h b/src/mesa/drivers/dri/r600/evergreen_off.h deleted file mode 100644 index 8c250699ec6..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_off.h +++ /dev/null @@ -1,881 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_OFF_H_ -#define _EVERGREEN_OFF_H_ - -enum -{ -/* Registers from PA block: */ - EG_PA_SC_SCREEN_SCISSOR_TL = 0x28030, // DIFF - EG_PA_SC_SCREEN_SCISSOR_BR = 0x28034, // DIFF - EG_PA_SC_WINDOW_OFFSET = 0x28200, // DIFF - EG_PA_SC_WINDOW_SCISSOR_TL = 0x28204, // DIFF - EG_PA_SC_WINDOW_SCISSOR_BR = 0x28208, // DIFF - EG_PA_SC_CLIPRECT_RULE = 0x2820C, // SAME - EG_PA_SC_CLIPRECT_0_TL = 0x28210, // DIFF - EG_PA_SC_CLIPRECT_0_BR = 0x28214, // DIFF - EG_PA_SC_CLIPRECT_1_TL = 0x28218, // DIFF - EG_PA_SC_CLIPRECT_1_BR = 0x2821C, // DIFF - EG_PA_SC_CLIPRECT_2_TL = 0x28220, // DIFF - EG_PA_SC_CLIPRECT_2_BR = 0x28224, // DIFF - EG_PA_SC_CLIPRECT_3_TL = 0x28228, // DIFF - EG_PA_SC_CLIPRECT_3_BR = 0x2822C, // DIFF - EG_PA_SC_EDGERULE = 0x28230, // SAME - EG_PA_SU_HARDWARE_SCREEN_OFFSET = 0x28234, // - EG_PA_SC_GENERIC_SCISSOR_TL = 0x28240, // DIFF - EG_PA_SC_GENERIC_SCISSOR_BR = 0x28244, // DIFF - EG_PA_SC_VPORT_SCISSOR_0_TL = 0x28250, // DIFF - EG_PA_SC_VPORT_SCISSOR_0_BR = 0x28254, // DIFF - EG_PA_SC_VPORT_SCISSOR_1_TL = 0x28258, // DIFF - EG_PA_SC_VPORT_SCISSOR_1_BR = 0x2825C, // DIFF - EG_PA_SC_VPORT_SCISSOR_2_TL = 0x28260, // DIFF - EG_PA_SC_VPORT_SCISSOR_2_BR = 0x28264, // DIFF - EG_PA_SC_VPORT_SCISSOR_3_TL = 0x28268, // DIFF - EG_PA_SC_VPORT_SCISSOR_3_BR = 0x2826C, // DIFF - EG_PA_SC_VPORT_SCISSOR_4_TL = 0x28270, // DIFF - EG_PA_SC_VPORT_SCISSOR_4_BR = 0x28274, // DIFF - EG_PA_SC_VPORT_SCISSOR_5_TL = 0x28278, // DIFF - EG_PA_SC_VPORT_SCISSOR_5_BR = 0x2827C, // DIFF - EG_PA_SC_VPORT_SCISSOR_6_TL = 0x28280, // DIFF - EG_PA_SC_VPORT_SCISSOR_6_BR = 0x28284, // DIFF - EG_PA_SC_VPORT_SCISSOR_7_TL = 0x28288, // DIFF - EG_PA_SC_VPORT_SCISSOR_7_BR = 0x2828C, // DIFF - EG_PA_SC_VPORT_SCISSOR_8_TL = 0x28290, // DIFF - EG_PA_SC_VPORT_SCISSOR_8_BR = 0x28294, // DIFF - EG_PA_SC_VPORT_SCISSOR_9_TL = 0x28298, // DIFF - EG_PA_SC_VPORT_SCISSOR_9_BR = 0x2829C, // DIFF - EG_PA_SC_VPORT_SCISSOR_10_TL = 0x282A0, // DIFF - EG_PA_SC_VPORT_SCISSOR_10_BR = 0x282A4, // DIFF - EG_PA_SC_VPORT_SCISSOR_11_TL = 0x282A8, // DIFF - EG_PA_SC_VPORT_SCISSOR_11_BR = 0x282AC, // DIFF - EG_PA_SC_VPORT_SCISSOR_12_TL = 0x282B0, // DIFF - EG_PA_SC_VPORT_SCISSOR_12_BR = 0x282B4, // DIFF - EG_PA_SC_VPORT_SCISSOR_13_TL = 0x282B8, // DIFF - EG_PA_SC_VPORT_SCISSOR_13_BR = 0x282BC, // DIFF - EG_PA_SC_VPORT_SCISSOR_14_TL = 0x282C0, // DIFF - EG_PA_SC_VPORT_SCISSOR_14_BR = 0x282C4, // DIFF - EG_PA_SC_VPORT_SCISSOR_15_TL = 0x282C8, // DIFF - EG_PA_SC_VPORT_SCISSOR_15_BR = 0x282CC, // DIFF - EG_PA_SC_VPORT_ZMIN_0 = 0x282D0, // SAME - EG_PA_SC_VPORT_ZMAX_0 = 0x282D4, // SAME - EG_PA_SC_VPORT_ZMIN_1 = 0x282D8, // SAME - EG_PA_SC_VPORT_ZMAX_1 = 0x282DC, // SAME - EG_PA_SC_VPORT_ZMIN_2 = 0x282E0, // SAME - EG_PA_SC_VPORT_ZMAX_2 = 0x282E4, // SAME - EG_PA_SC_VPORT_ZMIN_3 = 0x282E8, // SAME - EG_PA_SC_VPORT_ZMAX_3 = 0x282EC, // SAME - EG_PA_SC_VPORT_ZMIN_4 = 0x282F0, // SAME - EG_PA_SC_VPORT_ZMAX_4 = 0x282F4, // SAME - EG_PA_SC_VPORT_ZMIN_5 = 0x282F8, // SAME - EG_PA_SC_VPORT_ZMAX_5 = 0x282FC, // SAME - EG_PA_SC_VPORT_ZMIN_6 = 0x28300, // SAME - EG_PA_SC_VPORT_ZMAX_6 = 0x28304, // SAME - EG_PA_SC_VPORT_ZMIN_7 = 0x28308, // SAME - EG_PA_SC_VPORT_ZMAX_7 = 0x2830C, // SAME - EG_PA_SC_VPORT_ZMIN_8 = 0x28310, // SAME - EG_PA_SC_VPORT_ZMAX_8 = 0x28314, // SAME - EG_PA_SC_VPORT_ZMIN_9 = 0x28318, // SAME - EG_PA_SC_VPORT_ZMAX_9 = 0x2831C, // SAME - EG_PA_SC_VPORT_ZMIN_10 = 0x28320, // SAME - EG_PA_SC_VPORT_ZMAX_10 = 0x28324, // SAME - EG_PA_SC_VPORT_ZMIN_11 = 0x28328, // SAME - EG_PA_SC_VPORT_ZMAX_11 = 0x2832C, // SAME - EG_PA_SC_VPORT_ZMIN_12 = 0x28330, // SAME - EG_PA_SC_VPORT_ZMAX_12 = 0x28334, // SAME - EG_PA_SC_VPORT_ZMIN_13 = 0x28338, // SAME - EG_PA_SC_VPORT_ZMAX_13 = 0x2833C, // SAME - EG_PA_SC_VPORT_ZMIN_14 = 0x28340, // SAME - EG_PA_SC_VPORT_ZMAX_14 = 0x28344, // SAME - EG_PA_SC_VPORT_ZMIN_15 = 0x28348, // SAME - EG_PA_SC_VPORT_ZMAX_15 = 0x2834C, // SAME - EG_PA_CL_VPORT_XSCALE = 0x2843C, // SAME - EG_PA_CL_VPORT_XOFFSET = 0x28440, // SAME - EG_PA_CL_VPORT_YSCALE = 0x28444, // SAME - EG_PA_CL_VPORT_YOFFSET = 0x28448, // SAME - EG_PA_CL_VPORT_ZSCALE = 0x2844C, // SAME - EG_PA_CL_VPORT_ZOFFSET = 0x28450, // SAME - EG_PA_CL_VPORT_XSCALE_1 = 0x28454, // SAME - EG_PA_CL_VPORT_XOFFSET_1 = 0x28458, // SAME - EG_PA_CL_VPORT_YSCALE_1 = 0x2845C, // SAME - EG_PA_CL_VPORT_YOFFSET_1 = 0x28460, // SAME - EG_PA_CL_VPORT_ZSCALE_1 = 0x28464, // SAME - EG_PA_CL_VPORT_ZOFFSET_1 = 0x28468, // SAME - EG_PA_CL_VPORT_XSCALE_2 = 0x2846C, // SAME - EG_PA_CL_VPORT_XOFFSET_2 = 0x28470, // SAME - EG_PA_CL_VPORT_YSCALE_2 = 0x28474, // SAME - EG_PA_CL_VPORT_YOFFSET_2 = 0x28478, // SAME - EG_PA_CL_VPORT_ZSCALE_2 = 0x2847C, // SAME - EG_PA_CL_VPORT_ZOFFSET_2 = 0x28480, // SAME - EG_PA_CL_VPORT_XSCALE_3 = 0x28484, // SAME - EG_PA_CL_VPORT_XOFFSET_3 = 0x28488, // SAME - EG_PA_CL_VPORT_YSCALE_3 = 0x2848C, // SAME - EG_PA_CL_VPORT_YOFFSET_3 = 0x28490, // SAME - EG_PA_CL_VPORT_ZSCALE_3 = 0x28494, // SAME - EG_PA_CL_VPORT_ZOFFSET_3 = 0x28498, // SAME - EG_PA_CL_VPORT_XSCALE_4 = 0x2849C, // SAME - EG_PA_CL_VPORT_XOFFSET_4 = 0x284A0, // SAME - EG_PA_CL_VPORT_YSCALE_4 = 0x284A4, // SAME - EG_PA_CL_VPORT_YOFFSET_4 = 0x284A8, // SAME - EG_PA_CL_VPORT_ZSCALE_4 = 0x284AC, // SAME - EG_PA_CL_VPORT_ZOFFSET_4 = 0x284B0, // SAME - EG_PA_CL_VPORT_XSCALE_5 = 0x284B4, // SAME - EG_PA_CL_VPORT_XOFFSET_5 = 0x284B8, // SAME - EG_PA_CL_VPORT_YSCALE_5 = 0x284BC, // SAME - EG_PA_CL_VPORT_YOFFSET_5 = 0x284C0, // SAME - EG_PA_CL_VPORT_ZSCALE_5 = 0x284C4, // SAME - EG_PA_CL_VPORT_ZOFFSET_5 = 0x284C8, // SAME - EG_PA_CL_VPORT_XSCALE_6 = 0x284CC, // SAME - EG_PA_CL_VPORT_XOFFSET_6 = 0x284D0, // SAME - EG_PA_CL_VPORT_YSCALE_6 = 0x284D4, // SAME - EG_PA_CL_VPORT_YOFFSET_6 = 0x284D8, // SAME - EG_PA_CL_VPORT_ZSCALE_6 = 0x284DC, // SAME - EG_PA_CL_VPORT_ZOFFSET_6 = 0x284E0, // SAME - EG_PA_CL_VPORT_XSCALE_7 = 0x284E4, // SAME - EG_PA_CL_VPORT_XOFFSET_7 = 0x284E8, // SAME - EG_PA_CL_VPORT_YSCALE_7 = 0x284EC, // SAME - EG_PA_CL_VPORT_YOFFSET_7 = 0x284F0, // SAME - EG_PA_CL_VPORT_ZSCALE_7 = 0x284F4, // SAME - EG_PA_CL_VPORT_ZOFFSET_7 = 0x284F8, // SAME - EG_PA_CL_VPORT_XSCALE_8 = 0x284FC, // SAME - EG_PA_CL_VPORT_XOFFSET_8 = 0x28500, // SAME - EG_PA_CL_VPORT_YSCALE_8 = 0x28504, // SAME - EG_PA_CL_VPORT_YOFFSET_8 = 0x28508, // SAME - EG_PA_CL_VPORT_ZSCALE_8 = 0x2850C, // SAME - EG_PA_CL_VPORT_ZOFFSET_8 = 0x28510, // SAME - EG_PA_CL_VPORT_XSCALE_9 = 0x28514, // SAME - EG_PA_CL_VPORT_XOFFSET_9 = 0x28518, // SAME - EG_PA_CL_VPORT_YSCALE_9 = 0x2851C, // SAME - EG_PA_CL_VPORT_YOFFSET_9 = 0x28520, // SAME - EG_PA_CL_VPORT_ZSCALE_9 = 0x28524, // SAME - EG_PA_CL_VPORT_ZOFFSET_9 = 0x28528, // SAME - EG_PA_CL_VPORT_XSCALE_10 = 0x2852C, // SAME - EG_PA_CL_VPORT_XOFFSET_10 = 0x28530, // SAME - EG_PA_CL_VPORT_YSCALE_10 = 0x28534, // SAME - EG_PA_CL_VPORT_YOFFSET_10 = 0x28538, // SAME - EG_PA_CL_VPORT_ZSCALE_10 = 0x2853C, // SAME - EG_PA_CL_VPORT_ZOFFSET_10 = 0x28540, // SAME - EG_PA_CL_VPORT_XSCALE_11 = 0x28544, // SAME - EG_PA_CL_VPORT_XOFFSET_11 = 0x28548, // SAME - EG_PA_CL_VPORT_YSCALE_11 = 0x2854C, // SAME - EG_PA_CL_VPORT_YOFFSET_11 = 0x28550, // SAME - EG_PA_CL_VPORT_ZSCALE_11 = 0x28554, // SAME - EG_PA_CL_VPORT_ZOFFSET_11 = 0x28558, // SAME - EG_PA_CL_VPORT_XSCALE_12 = 0x2855C, // SAME - EG_PA_CL_VPORT_XOFFSET_12 = 0x28560, // SAME - EG_PA_CL_VPORT_YSCALE_12 = 0x28564, // SAME - EG_PA_CL_VPORT_YOFFSET_12 = 0x28568, // SAME - EG_PA_CL_VPORT_ZSCALE_12 = 0x2856C, // SAME - EG_PA_CL_VPORT_ZOFFSET_12 = 0x28570, // SAME - EG_PA_CL_VPORT_XSCALE_13 = 0x28574, // SAME - EG_PA_CL_VPORT_XOFFSET_13 = 0x28578, // SAME - EG_PA_CL_VPORT_YSCALE_13 = 0x2857C, // SAME - EG_PA_CL_VPORT_YOFFSET_13 = 0x28580, // SAME - EG_PA_CL_VPORT_ZSCALE_13 = 0x28584, // SAME - EG_PA_CL_VPORT_ZOFFSET_13 = 0x28588, // SAME - EG_PA_CL_VPORT_XSCALE_14 = 0x2858C, // SAME - EG_PA_CL_VPORT_XOFFSET_14 = 0x28590, // SAME - EG_PA_CL_VPORT_YSCALE_14 = 0x28594, // SAME - EG_PA_CL_VPORT_YOFFSET_14 = 0x28598, // SAME - EG_PA_CL_VPORT_ZSCALE_14 = 0x2859C, // SAME - EG_PA_CL_VPORT_ZOFFSET_14 = 0x285A0, // SAME - EG_PA_CL_VPORT_XSCALE_15 = 0x285A4, // SAME - EG_PA_CL_VPORT_XOFFSET_15 = 0x285A8, // SAME - EG_PA_CL_VPORT_YSCALE_15 = 0x285AC, // SAME - EG_PA_CL_VPORT_YOFFSET_15 = 0x285B0, // SAME - EG_PA_CL_VPORT_ZSCALE_15 = 0x285B4, // SAME - EG_PA_CL_VPORT_ZOFFSET_15 = 0x285B8, // SAME - EG_PA_CL_UCP_0_X = 0x285BC, // SAME 0x28E20 - EG_PA_CL_UCP_0_Y = 0x285C0, // SAME 0x28E24 - EG_PA_CL_UCP_0_Z = 0x285C4, // SAME 0x28E28 - EG_PA_CL_UCP_0_W = 0x285C8, // SAME 0x28E2C - EG_PA_CL_UCP_1_X = 0x285CC, // SAME 0x28E30 - EG_PA_CL_UCP_1_Y = 0x285D0, // SAME 0x28E34 - EG_PA_CL_UCP_1_Z = 0x285D4, // SAME 0x28E38 - EG_PA_CL_UCP_1_W = 0x285D8, // SAME 0x28E3C - EG_PA_CL_UCP_2_X = 0x285DC, // SAME 0x28E40 - EG_PA_CL_UCP_2_Y = 0x285E0, // SAME 0x28E44 - EG_PA_CL_UCP_2_Z = 0x285E4, // SAME 0x28E48 - EG_PA_CL_UCP_2_W = 0x285E8, // SAME 0x28E4C - EG_PA_CL_UCP_3_X = 0x285EC, // SAME 0x28E50 - EG_PA_CL_UCP_3_Y = 0x285F0, // SAME 0x28E54 - EG_PA_CL_UCP_3_Z = 0x285F4, // SAME 0x28E58 - EG_PA_CL_UCP_3_W = 0x285F8, // SAME 0x28E5C - EG_PA_CL_UCP_4_X = 0x285FC, // SAME 0x28E60 - EG_PA_CL_UCP_4_Y = 0x28600, // SAME 0x28E64 - EG_PA_CL_UCP_4_Z = 0x28604, // SAME 0x28E68 - EG_PA_CL_UCP_4_W = 0x28608, // SAME 0x28E6C - EG_PA_CL_UCP_5_X = 0x2860C, // SAME 0x28E70 - EG_PA_CL_UCP_5_Y = 0x28610, // SAME 0x28E74 - EG_PA_CL_UCP_5_Z = 0x28614, // SAME 0x28E78 - EG_PA_CL_UCP_5_W = 0x28618, // SAME 0x28E7C - EG_PA_CL_POINT_X_RAD = 0x287D4, // SAME 0x28E10 - EG_PA_CL_POINT_Y_RAD = 0x287D8, // SAME 0x28E14 - EG_PA_CL_POINT_SIZE = 0x287DC, // SAME 0x28E18 - EG_PA_CL_POINT_CULL_RAD = 0x287E0, // SAME 0x28E1C - EG_PA_CL_CLIP_CNTL = 0x28810, // SAME - EG_PA_SU_SC_MODE_CNTL = 0x28814, // SAME - EG_PA_CL_VTE_CNTL = 0x28818, // SAME - EG_PA_CL_VS_OUT_CNTL = 0x2881C, // SAME - EG_PA_CL_NANINF_CNTL = 0x28820, // SAME - EG_PA_SU_LINE_STIPPLE_CNTL = 0x28824, // - EG_PA_SU_LINE_STIPPLE_SCALE = 0x28828, // - EG_PA_SU_PRIM_FILTER_CNTL = 0x2882C, // - EG_PA_SU_POINT_SIZE = 0x28A00, // SAME - EG_PA_SU_POINT_MINMAX = 0x28A04, // SAME - EG_PA_SU_LINE_CNTL = 0x28A08, // SAME - EG_PA_SC_LINE_STIPPLE = 0x28A0C, // SAME - EG_PA_SC_MODE_CNTL_0 = 0x28A48, // - EG_PA_SC_MODE_CNTL_1 = 0x28A4C, // - EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL = 0x28B78, // SAME 0x28DF8 - EG_PA_SU_POLY_OFFSET_CLAMP = 0x28B7C, // SAME 0x28DFC - EG_PA_SU_POLY_OFFSET_FRONT_SCALE = 0x28B80, // SAME 0x28E00 - EG_PA_SU_POLY_OFFSET_FRONT_OFFSET = 0x28B84, // SAME 0x28E04 - EG_PA_SU_POLY_OFFSET_BACK_SCALE = 0x28B88, // SAME 0x28E08 - EG_PA_SU_POLY_OFFSET_BACK_OFFSET = 0x28B8C, // SAME 0x28E0C - EG_PA_SC_LINE_CNTL = 0x28C00, // DIFF - EG_PA_SC_AA_CONFIG = 0x28C04, // SAME - EG_PA_SU_VTX_CNTL = 0x28C08, // SAME - EG_PA_CL_GB_VERT_CLIP_ADJ = 0x28C0C, // SAME - EG_PA_CL_GB_VERT_DISC_ADJ = 0x28C10, // SAME - EG_PA_CL_GB_HORZ_CLIP_ADJ = 0x28C14, // SAME - EG_PA_CL_GB_HORZ_DISC_ADJ = 0x28C18, // SAME - EG_PA_SC_AA_SAMPLE_LOCS_0 = 0x28C1C, // - EG_PA_SC_AA_SAMPLE_LOCS_1 = 0x28C20, // - EG_PA_SC_AA_SAMPLE_LOCS_2 = 0x28C24, // - EG_PA_SC_AA_SAMPLE_LOCS_3 = 0x28C28, // - EG_PA_SC_AA_SAMPLE_LOCS_4 = 0x28C2C, // - EG_PA_SC_AA_SAMPLE_LOCS_5 = 0x28C30, // - EG_PA_SC_AA_SAMPLE_LOCS_6 = 0x28C34, // - EG_PA_SC_AA_SAMPLE_LOCS_7 = 0x28C38, // - EG_PA_SC_AA_MASK = 0x28C3C, // SAME 0x28C48 - -/* Registers from VGT block: */ - EG_VGT_INDEX_TYPE = 0x895C, //? config space - EG_VGT_PRIMITIVE_TYPE = 0x8958, //? config space - - EG_VGT_MAX_VTX_INDX = 0x28400, // SAME - EG_VGT_MIN_VTX_INDX = 0x28404, // SAME - EG_VGT_INDX_OFFSET = 0x28408, // SAME - EG_VGT_MULTI_PRIM_IB_RESET_INDX = 0x2840C, // SAME - EG_CS_COPY_STATE = 0x287CC, // - EG_GFX_COPY_STATE = 0x287D0, // SAME - EG_VGT_DMA_BASE_HI = 0x287E4, // SAME - EG_VGT_DMA_BASE = 0x287E8, // SAME - EG_VGT_DRAW_INITIATOR = 0x287F0, // SAME - EG_VGT_IMMED_DATA = 0x287F4, // SAME - EG_VGT_EVENT_ADDRESS_REG = 0x287F8, // SAME - EG_VGT_OUTPUT_PATH_CNTL = 0x28A10, // DIFF - EG_VGT_HOS_CNTL = 0x28A14, // SAME - EG_VGT_HOS_MAX_TESS_LEVEL = 0x28A18, // SAME - EG_VGT_HOS_MIN_TESS_LEVEL = 0x28A1C, // SAME - EG_VGT_HOS_REUSE_DEPTH = 0x28A20, // SAME - EG_VGT_GROUP_PRIM_TYPE = 0x28A24, // SAME - EG_VGT_GROUP_FIRST_DECR = 0x28A28, // SAME - EG_VGT_GROUP_DECR = 0x28A2C, // SAME - EG_VGT_GROUP_VECT_0_CNTL = 0x28A30, // SAME - EG_VGT_GROUP_VECT_1_CNTL = 0x28A34, // SAME - EG_VGT_GROUP_VECT_0_FMT_CNTL = 0x28A38, // SAME - EG_VGT_GROUP_VECT_1_FMT_CNTL = 0x28A3C, // SAME - EG_VGT_GS_MODE = 0x28A40, // DIFF - EG_VGT_ENHANCE = 0x28A50, // DIFF - EG_VGT_GS_PER_ES = 0x28A54, // DIFF 0x88C8 - EG_VGT_ES_PER_GS = 0x28A58, // DIFF 0x88CC - EG_VGT_GS_PER_VS = 0x28A5C, // SAME 0x88E8 - EG_VGT_GS_OUT_PRIM_TYPE = 0x28A6C, // SAME - EG_VGT_DMA_SIZE = 0x28A74, // SAME - EG_VGT_DMA_MAX_SIZE = 0x28A78, // SAME - EG_VGT_DMA_INDEX_TYPE = 0x28A7C, // SAME - EG_VGT_PRIMITIVEID_EN = 0x28A84, // SAME - EG_VGT_DMA_NUM_INSTANCES = 0x28A88, // SAME - EG_VGT_EVENT_INITIATOR = 0x28A90, // SAME - EG_VGT_MULTI_PRIM_IB_RESET_EN = 0x28A94, // SAME - EG_VGT_INSTANCE_STEP_RATE_0 = 0x28AA0, // SAME - EG_VGT_INSTANCE_STEP_RATE_1 = 0x28AA4, // SAME - EG_VGT_REUSE_OFF = 0x28AB4, // SAME - EG_VGT_VTX_CNT_EN = 0x28AB8, // SAME - EG_VGT_STRMOUT_BUFFER_SIZE_0 = 0x28AD0, // SAME - EG_VGT_STRMOUT_VTX_STRIDE_0 = 0x28AD4, // SAME - EG_VGT_STRMOUT_BUFFER_BASE_0 = 0x28AD8, // SAME - EG_VGT_STRMOUT_BUFFER_OFFSET_0 = 0x28ADC, // SAME - EG_VGT_STRMOUT_BUFFER_SIZE_1 = 0x28AE0, // SAME - EG_VGT_STRMOUT_VTX_STRIDE_1 = 0x28AE4, // SAME - EG_VGT_STRMOUT_BUFFER_BASE_1 = 0x28AE8, // SAME - EG_VGT_STRMOUT_BUFFER_OFFSET_1 = 0x28AEC, // SAME - EG_VGT_STRMOUT_BUFFER_SIZE_2 = 0x28AF0, // SAME - EG_VGT_STRMOUT_VTX_STRIDE_2 = 0x28AF4, // SAME - EG_VGT_STRMOUT_BUFFER_BASE_2 = 0x28AF8, // SAME - EG_VGT_STRMOUT_BUFFER_OFFSET_2 = 0x28AFC, // SAME - EG_VGT_STRMOUT_BUFFER_SIZE_3 = 0x28B00, // SAME - EG_VGT_STRMOUT_VTX_STRIDE_3 = 0x28B04, // SAME - EG_VGT_STRMOUT_BUFFER_BASE_3 = 0x28B08, // SAME - EG_VGT_STRMOUT_BUFFER_OFFSET_3 = 0x28B0C, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_0 = 0x28B10, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_1 = 0x28B14, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_2 = 0x28B18, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_3 = 0x28B1C, // SAME - EG_VGT_STRMOUT_DRAW_OPAQUE_OFFSET = 0x28B28, // SAME - EG_VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE = 0x28B2C, // SAME - EG_VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE = 0x28B30, // DIFF - EG_VGT_GS_MAX_VERT_OUT = 0x28B38, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_HI_0 = 0x28B44, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_HI_1 = 0x28B48, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_HI_2 = 0x28B4C, // SAME - EG_VGT_STRMOUT_BASE_OFFSET_HI_3 = 0x28B50, // SAME - EG_VGT_SHADER_STAGES_EN = 0x28B54, // - EG_VGT_LS_HS_CONFIG = 0x28B58, // - EG_VGT_LS_SIZE = 0x28B5C, // - EG_VGT_HS_SIZE = 0x28B60, // - EG_VGT_LS_HS_ALLOC = 0x28B64, // - EG_VGT_HS_PATCH_CONST = 0x28B68, // - EG_VGT_TF_PARAM = 0x28B6C, // - EG_VGT_DISPATCH_INITIATOR = 0x28B74, // - EG_VGT_GS_INSTANCE_CNT = 0x28B90, // - EG_VGT_STRMOUT_CONFIG = 0x28B94, // - EG_VGT_STRMOUT_BUFFER_CONFIG = 0x28B98, // - EG_VGT_VERTEX_REUSE_BLOCK_CNTL = 0x28C58, // SAME - EG_VGT_OUT_DEALLOC_CNTL = 0x28C5C, // SAME - -/* Registers from TP block: */ - EG_GDS_ADDR_BASE = 0x28720, // - EG_GDS_ADDR_SIZE = 0x28724, // - EG_GDS_ORDERED_WAVE_PER_SE = 0x28728, // - EG_GDS_APPEND_CONSUME_UAV0 = 0x2872C, // - EG_GDS_APPEND_CONSUME_UAV1 = 0x28730, // - EG_GDS_APPEND_CONSUME_UAV2 = 0x28734, // - EG_GDS_APPEND_CONSUME_UAV3 = 0x28738, // - EG_GDS_APPEND_CONSUME_UAV4 = 0x2873C, // - EG_GDS_APPEND_CONSUME_UAV5 = 0x28740, // - EG_GDS_APPEND_CONSUME_UAV6 = 0x28744, // - EG_GDS_APPEND_CONSUME_UAV7 = 0x28748, // - EG_GDS_APPEND_CONSUME_UAV8 = 0x2874C, // - EG_GDS_APPEND_CONSUME_UAV9 = 0x28750, // - EG_GDS_APPEND_CONSUME_UAV10 = 0x28754, // - EG_GDS_APPEND_CONSUME_UAV11 = 0x28758, // - -/* Registers from SQ block: */ - EG_SQ_LOOP_CONST_0 = 0x3A200, // 0x3E200 - EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0 = 0x28180, // ? - EG_SQ_VTX_SEMANTIC_0 = 0x28380, // SAME - EG_SQ_VTX_SEMANTIC_1 = 0x28384, // SAME - EG_SQ_VTX_SEMANTIC_2 = 0x28388, // SAME - EG_SQ_VTX_SEMANTIC_3 = 0x2838C, // SAME - EG_SQ_VTX_SEMANTIC_4 = 0x28390, // SAME - EG_SQ_VTX_SEMANTIC_5 = 0x28394, // SAME - EG_SQ_VTX_SEMANTIC_6 = 0x28398, // SAME - EG_SQ_VTX_SEMANTIC_7 = 0x2839C, // SAME - EG_SQ_VTX_SEMANTIC_8 = 0x283A0, // SAME - EG_SQ_VTX_SEMANTIC_9 = 0x283A4, // SAME - EG_SQ_VTX_SEMANTIC_10 = 0x283A8, // SAME - EG_SQ_VTX_SEMANTIC_11 = 0x283AC, // SAME - EG_SQ_VTX_SEMANTIC_12 = 0x283B0, // SAME - EG_SQ_VTX_SEMANTIC_13 = 0x283B4, // SAME - EG_SQ_VTX_SEMANTIC_14 = 0x283B8, // SAME - EG_SQ_VTX_SEMANTIC_15 = 0x283BC, // SAME - EG_SQ_VTX_SEMANTIC_16 = 0x283C0, // SAME - EG_SQ_VTX_SEMANTIC_17 = 0x283C4, // SAME - EG_SQ_VTX_SEMANTIC_18 = 0x283C8, // SAME - EG_SQ_VTX_SEMANTIC_19 = 0x283CC, // SAME - EG_SQ_VTX_SEMANTIC_20 = 0x283D0, // SAME - EG_SQ_VTX_SEMANTIC_21 = 0x283D4, // SAME - EG_SQ_VTX_SEMANTIC_22 = 0x283D8, // SAME - EG_SQ_VTX_SEMANTIC_23 = 0x283DC, // SAME - EG_SQ_VTX_SEMANTIC_24 = 0x283E0, // SAME - EG_SQ_VTX_SEMANTIC_25 = 0x283E4, // SAME - EG_SQ_VTX_SEMANTIC_26 = 0x283E8, // SAME - EG_SQ_VTX_SEMANTIC_27 = 0x283EC, // SAME - EG_SQ_VTX_SEMANTIC_28 = 0x283F0, // SAME - EG_SQ_VTX_SEMANTIC_29 = 0x283F4, // SAME - EG_SQ_VTX_SEMANTIC_30 = 0x283F8, // SAME - EG_SQ_VTX_SEMANTIC_31 = 0x283FC, // SAME - EG_SQ_LSTMP_RING_ITEMSIZE = 0x28830, // - EG_SQ_HSTMP_RING_ITEMSIZE = 0x28834, // - EG_SQ_DYN_GPR_RESOURCE_LIMIT_1 = 0x28838, // - EG_SQ_PGM_START_PS = 0x28840, // SAME - EG_SQ_PGM_RESOURCES_PS = 0x28844, // DIFF 0x28850 - EG_SQ_PGM_RESOURCES_2_PS = 0x28848, // - EG_SQ_PGM_EXPORTS_PS = 0x2884C, // SAME 0x28854 - EG_SQ_PGM_START_VS = 0x2885C, // SAME 0x28858 - EG_SQ_PGM_RESOURCES_VS = 0x28860, // DIFF 0x28868 - EG_SQ_PGM_RESOURCES_2_VS = 0x28864, // - EG_SQ_PGM_START_GS = 0x28874, // SAME 0x2886C - EG_SQ_PGM_RESOURCES_GS = 0x28878, // DIFF 0x2887C - EG_SQ_PGM_RESOURCES_2_GS = 0x2887C, // - EG_SQ_PGM_START_ES = 0x2888C, // SAME 0x28880 - EG_SQ_PGM_RESOURCES_ES = 0x28890, // DIFF - EG_SQ_PGM_RESOURCES_2_ES = 0x28894, // - EG_SQ_PGM_START_FS = 0x288A4, // SAME 0x28894 - EG_SQ_PGM_RESOURCES_FS = 0x288A8, // DIFF 0x288A4 - EG_SQ_PGM_START_HS = 0x288B8, // - EG_SQ_PGM_RESOURCES_HS = 0x288BC, // - EG_SQ_PGM_RESOURCES_2_HS = 0x288C0, // - EG_SQ_PGM_START_LS = 0x288D0, // - EG_SQ_PGM_RESOURCES_LS = 0x288D4, // - EG_SQ_PGM_RESOURCES_2_LS = 0x288D8, // - EG_SQ_THREAD_TRACE_USERDATA = 0x288DC, // - EG_SQ_LDS_ALLOC = 0x288E8, // - EG_SQ_LDS_ALLOC_PS = 0x288EC, // - EG_SQ_VTX_SEMANTIC_CLEAR = 0x288F0, // SAME 0x288E0 - EG_SQ_THREAD_TRACE_CTRL = 0x288F8, // - EG_SQ_ESGS_RING_ITEMSIZE = 0x28900, // SAME 0x288A8 - EG_SQ_GSVS_RING_ITEMSIZE = 0x28904, // SAME 0x288AC - EG_SQ_ESTMP_RING_ITEMSIZE = 0x28908, // SAME 0x288B0 - EG_SQ_GSTMP_RING_ITEMSIZE = 0x2890C, // SAME 0x288B4 - EG_SQ_VSTMP_RING_ITEMSIZE = 0x28910, // SAME 0x288B8 - EG_SQ_PSTMP_RING_ITEMSIZE = 0x28914, // SAME 0x288BC - EG_SQ_GS_VERT_ITEMSIZE = 0x2891C, // SAME 0x288C8 - EG_SQ_GS_VERT_ITEMSIZE_1 = 0x28920, // - EG_SQ_GS_VERT_ITEMSIZE_2 = 0x28924, // - EG_SQ_GS_VERT_ITEMSIZE_3 = 0x28928, // - EG_SQ_GSVS_RING_OFFSET_1 = 0x2892C, // - EG_SQ_GSVS_RING_OFFSET_2 = 0x28930, // - EG_SQ_GSVS_RING_OFFSET_3 = 0x28934, // - EG_SQ_ALU_CONST_CACHE_PS_0 = 0x28940, // SAME - EG_SQ_ALU_CONST_CACHE_PS_1 = 0x28944, // SAME - EG_SQ_ALU_CONST_CACHE_PS_2 = 0x28948, // SAME - EG_SQ_ALU_CONST_CACHE_PS_3 = 0x2894C, // SAME - EG_SQ_ALU_CONST_CACHE_PS_4 = 0x28950, // SAME - EG_SQ_ALU_CONST_CACHE_PS_5 = 0x28954, // SAME - EG_SQ_ALU_CONST_CACHE_PS_6 = 0x28958, // SAME - EG_SQ_ALU_CONST_CACHE_PS_7 = 0x2895C, // SAME - EG_SQ_ALU_CONST_CACHE_PS_8 = 0x28960, // SAME - EG_SQ_ALU_CONST_CACHE_PS_9 = 0x28964, // SAME - EG_SQ_ALU_CONST_CACHE_PS_10 = 0x28968, // SAME - EG_SQ_ALU_CONST_CACHE_PS_11 = 0x2896C, // SAME - EG_SQ_ALU_CONST_CACHE_PS_12 = 0x28970, // SAME - EG_SQ_ALU_CONST_CACHE_PS_13 = 0x28974, // SAME - EG_SQ_ALU_CONST_CACHE_PS_14 = 0x28978, // SAME - EG_SQ_ALU_CONST_CACHE_PS_15 = 0x2897C, // SAME - EG_SQ_ALU_CONST_CACHE_VS_0 = 0x28980, // SAME - EG_SQ_ALU_CONST_CACHE_VS_1 = 0x28984, // SAME - EG_SQ_ALU_CONST_CACHE_VS_2 = 0x28988, // SAME - EG_SQ_ALU_CONST_CACHE_VS_3 = 0x2898C, // SAME - EG_SQ_ALU_CONST_CACHE_VS_4 = 0x28990, // SAME - EG_SQ_ALU_CONST_CACHE_VS_5 = 0x28994, // SAME - EG_SQ_ALU_CONST_CACHE_VS_6 = 0x28998, // SAME - EG_SQ_ALU_CONST_CACHE_VS_7 = 0x2899C, // SAME - EG_SQ_ALU_CONST_CACHE_VS_8 = 0x289A0, // SAME - EG_SQ_ALU_CONST_CACHE_VS_9 = 0x289A4, // SAME - EG_SQ_ALU_CONST_CACHE_VS_10 = 0x289A8, // SAME - EG_SQ_ALU_CONST_CACHE_VS_11 = 0x289AC, // SAME - EG_SQ_ALU_CONST_CACHE_VS_12 = 0x289B0, // SAME - EG_SQ_ALU_CONST_CACHE_VS_13 = 0x289B4, // SAME - EG_SQ_ALU_CONST_CACHE_VS_14 = 0x289B8, // SAME - EG_SQ_ALU_CONST_CACHE_VS_15 = 0x289BC, // SAME - EG_SQ_ALU_CONST_CACHE_GS_0 = 0x289C0, // SAME - EG_SQ_ALU_CONST_CACHE_GS_1 = 0x289C4, // SAME - EG_SQ_ALU_CONST_CACHE_GS_2 = 0x289C8, // SAME - EG_SQ_ALU_CONST_CACHE_GS_3 = 0x289CC, // SAME - EG_SQ_ALU_CONST_CACHE_GS_4 = 0x289D0, // SAME - EG_SQ_ALU_CONST_CACHE_GS_5 = 0x289D4, // SAME - EG_SQ_ALU_CONST_CACHE_GS_6 = 0x289D8, // SAME - EG_SQ_ALU_CONST_CACHE_GS_7 = 0x289DC, // SAME - EG_SQ_ALU_CONST_CACHE_GS_8 = 0x289E0, // SAME - EG_SQ_ALU_CONST_CACHE_GS_9 = 0x289E4, // SAME - EG_SQ_ALU_CONST_CACHE_GS_10 = 0x289E8, // SAME - EG_SQ_ALU_CONST_CACHE_GS_11 = 0x289EC, // SAME - EG_SQ_ALU_CONST_CACHE_GS_12 = 0x289F0, // SAME - EG_SQ_ALU_CONST_CACHE_GS_13 = 0x289F4, // SAME - EG_SQ_ALU_CONST_CACHE_GS_14 = 0x289F8, // SAME - EG_SQ_ALU_CONST_CACHE_GS_15 = 0x289FC, // SAME - EG_SQ_ALU_CONST_CACHE_HS_0 = 0x28F00, // - EG_SQ_ALU_CONST_CACHE_HS_1 = 0x28F04, // - EG_SQ_ALU_CONST_CACHE_HS_2 = 0x28F08, // - EG_SQ_ALU_CONST_CACHE_HS_3 = 0x28F0C, // - EG_SQ_ALU_CONST_CACHE_HS_4 = 0x28F10, // - EG_SQ_ALU_CONST_CACHE_HS_5 = 0x28F14, // - EG_SQ_ALU_CONST_CACHE_HS_6 = 0x28F18, // - EG_SQ_ALU_CONST_CACHE_HS_7 = 0x28F1C, // - EG_SQ_ALU_CONST_CACHE_HS_8 = 0x28F20, // - EG_SQ_ALU_CONST_CACHE_HS_9 = 0x28F24, // - EG_SQ_ALU_CONST_CACHE_HS_10 = 0x28F28, // - EG_SQ_ALU_CONST_CACHE_HS_11 = 0x28F2C, // - EG_SQ_ALU_CONST_CACHE_HS_12 = 0x28F30, // - EG_SQ_ALU_CONST_CACHE_HS_13 = 0x28F34, // - EG_SQ_ALU_CONST_CACHE_HS_14 = 0x28F38, // - EG_SQ_ALU_CONST_CACHE_HS_15 = 0x28F3C, // - EG_SQ_ALU_CONST_CACHE_LS_0 = 0x28F40, // - EG_SQ_ALU_CONST_CACHE_LS_1 = 0x28F44, // - EG_SQ_ALU_CONST_CACHE_LS_2 = 0x28F48, // - EG_SQ_ALU_CONST_CACHE_LS_3 = 0x28F4C, // - EG_SQ_ALU_CONST_CACHE_LS_4 = 0x28F50, // - EG_SQ_ALU_CONST_CACHE_LS_5 = 0x28F54, // - EG_SQ_ALU_CONST_CACHE_LS_6 = 0x28F58, // - EG_SQ_ALU_CONST_CACHE_LS_7 = 0x28F5C, // - EG_SQ_ALU_CONST_CACHE_LS_8 = 0x28F60, // - EG_SQ_ALU_CONST_CACHE_LS_9 = 0x28F64, // - EG_SQ_ALU_CONST_CACHE_LS_10 = 0x28F68, // - EG_SQ_ALU_CONST_CACHE_LS_11 = 0x28F6C, // - EG_SQ_ALU_CONST_CACHE_LS_12 = 0x28F70, // - EG_SQ_ALU_CONST_CACHE_LS_13 = 0x28F74, // - EG_SQ_ALU_CONST_CACHE_LS_14 = 0x28F78, // - EG_SQ_ALU_CONST_CACHE_LS_15 = 0x28F7C, // - EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0 = 0x28140, - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_0 = 0x28F80, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_1 = 0x28F84, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_2 = 0x28F88, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_3 = 0x28F8C, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_4 = 0x28F90, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_5 = 0x28F94, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_6 = 0x28F98, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_7 = 0x28F9C, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_8 = 0x28FA0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_9 = 0x28FA4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_10 = 0x28FA8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_11 = 0x28FAC, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_12 = 0x28FB0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_13 = 0x28FB4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_14 = 0x28FB8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_HS_15 = 0x28FBC, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_0 = 0x28FC0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_1 = 0x28FC4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_2 = 0x28FC8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_3 = 0x28FCC, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_4 = 0x28FD0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_5 = 0x28FD4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_6 = 0x28FD8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_7 = 0x28FDC, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_8 = 0x28FE0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_9 = 0x28FE4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_10 = 0x28FE8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_11 = 0x28FEC, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_12 = 0x28FF0, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_13 = 0x28FF4, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_14 = 0x28FF8, // - EG_SQ_ALU_CONST_BUFFER_SIZE_LS_15 = 0x28FFC, // - -/* Registers from SPI block: */ - EG_SPI_VS_OUT_ID_0 = 0x2861C, // SAME 0x28614 - EG_SPI_VS_OUT_ID_1 = 0x28620, // SAME 0x28618 - EG_SPI_VS_OUT_ID_2 = 0x28624, // SAME 0x2861C - EG_SPI_VS_OUT_ID_3 = 0x28628, // SAME 0x28620 - EG_SPI_VS_OUT_ID_4 = 0x2862C, // SAME 0x28624 - EG_SPI_VS_OUT_ID_5 = 0x28630, // SAME 0x28628 - EG_SPI_VS_OUT_ID_6 = 0x28634, // SAME 0x2862C - EG_SPI_VS_OUT_ID_7 = 0x28638, // SAME 0x28630 - EG_SPI_VS_OUT_ID_8 = 0x2863C, // SAME 0x28634 - EG_SPI_VS_OUT_ID_9 = 0x28640, // SAME 0x28638 - EG_SPI_PS_INPUT_CNTL_0 = 0x28644, // SAME - EG_SPI_PS_INPUT_CNTL_1 = 0x28648, // SAME - EG_SPI_PS_INPUT_CNTL_2 = 0x2864C, // SAME - EG_SPI_PS_INPUT_CNTL_3 = 0x28650, // SAME - EG_SPI_PS_INPUT_CNTL_4 = 0x28654, // SAME - EG_SPI_PS_INPUT_CNTL_5 = 0x28658, // SAME - EG_SPI_PS_INPUT_CNTL_6 = 0x2865C, // SAME - EG_SPI_PS_INPUT_CNTL_7 = 0x28660, // SAME - EG_SPI_PS_INPUT_CNTL_8 = 0x28664, // SAME - EG_SPI_PS_INPUT_CNTL_9 = 0x28668, // SAME - EG_SPI_PS_INPUT_CNTL_10 = 0x2866C, // SAME - EG_SPI_PS_INPUT_CNTL_11 = 0x28670, // SAME - EG_SPI_PS_INPUT_CNTL_12 = 0x28674, // SAME - EG_SPI_PS_INPUT_CNTL_13 = 0x28678, // SAME - EG_SPI_PS_INPUT_CNTL_14 = 0x2867C, // SAME - EG_SPI_PS_INPUT_CNTL_15 = 0x28680, // SAME - EG_SPI_PS_INPUT_CNTL_16 = 0x28684, // SAME - EG_SPI_PS_INPUT_CNTL_17 = 0x28688, // SAME - EG_SPI_PS_INPUT_CNTL_18 = 0x2868C, // SAME - EG_SPI_PS_INPUT_CNTL_19 = 0x28690, // SAME - EG_SPI_PS_INPUT_CNTL_20 = 0x28694, // SAME - EG_SPI_PS_INPUT_CNTL_21 = 0x28698, // SAME - EG_SPI_PS_INPUT_CNTL_22 = 0x2869C, // SAME - EG_SPI_PS_INPUT_CNTL_23 = 0x286A0, // SAME - EG_SPI_PS_INPUT_CNTL_24 = 0x286A4, // SAME - EG_SPI_PS_INPUT_CNTL_25 = 0x286A8, // SAME - EG_SPI_PS_INPUT_CNTL_26 = 0x286AC, // SAME - EG_SPI_PS_INPUT_CNTL_27 = 0x286B0, // SAME - EG_SPI_PS_INPUT_CNTL_28 = 0x286B4, // SAME - EG_SPI_PS_INPUT_CNTL_29 = 0x286B8, // SAME - EG_SPI_PS_INPUT_CNTL_30 = 0x286BC, // SAME - EG_SPI_PS_INPUT_CNTL_31 = 0x286C0, // SAME - EG_SPI_VS_OUT_CONFIG = 0x286C4, // SAME - EG_SPI_THREAD_GROUPING = 0x286C8, // DIFF - EG_SPI_PS_IN_CONTROL_0 = 0x286CC, // SAME - EG_SPI_PS_IN_CONTROL_1 = 0x286D0, // SAME - EG_SPI_INTERP_CONTROL_0 = 0x286D4, // SAME - EG_SPI_INPUT_Z = 0x286D8, // SAME - EG_SPI_FOG_CNTL = 0x286DC, // SAME - EG_SPI_BARYC_CNTL = 0x286E0, // - EG_SPI_PS_IN_CONTROL_2 = 0x286E4, // - EG_SPI_COMPUTE_INPUT_CNTL = 0x286E8, // - EG_SPI_COMPUTE_NUM_THREAD_X = 0x286EC, // - EG_SPI_COMPUTE_NUM_THREAD_Y = 0x286F0, // - EG_SPI_COMPUTE_NUM_THREAD_Z = 0x286F4, // - -/* Registers from SX block: */ - EG_SX_MISC = 0x28350, // SAME - EG_SX_SURFACE_SYNC = 0x28354, // DIFF - EG_SX_ALPHA_TEST_CONTROL = 0x28410, // SAME - EG_SX_ALPHA_REF = 0x28438, // SAME - -/* Registers from DB block: */ - EG_DB_RENDER_CONTROL = 0x28000, // DIFF 0x28D0C - EG_DB_COUNT_CONTROL = 0x28004, // - EG_DB_DEPTH_VIEW = 0x28008, // DIFF 0x28004 - EG_DB_RENDER_OVERRIDE = 0x2800C, // DIFF 0x28D10 - EG_DB_RENDER_OVERRIDE2 = 0x28010, // - EG_DB_HTILE_DATA_BASE = 0x28014, // SAME - - EG_DB_STENCIL_CLEAR = 0x28028, // SAME - EG_DB_DEPTH_CLEAR = 0x2802C, // SAME - - EG_DB_Z_INFO = 0x28040, // - EG_DB_STENCIL_INFO = 0x28044, // - EG_DB_Z_READ_BASE = 0x28048, // - EG_DB_STENCIL_READ_BASE = 0x2804C, // - EG_DB_Z_WRITE_BASE = 0x28050, // - EG_DB_STENCIL_WRITE_BASE = 0x28054, // - EG_DB_DEPTH_SIZE = 0x28058, // DIFF 0x28000 - EG_DB_DEPTH_SLICE = 0x2805C, // - - EG_DB_STENCILREFMASK = 0x28430, // SAME - EG_DB_STENCILREFMASK_BF = 0x28434, // SAME - EG_DB_DEPTH_CONTROL = 0x28800, // SAME - EG_DB_SHADER_CONTROL = 0x2880C, // DIFF - EG_DB_HTILE_SURFACE = 0x28ABC, // SAME 0x28D24 - EG_DB_SRESULTS_COMPARE_STATE0 = 0x28AC0, // SAME 0x28D28 - EG_DB_SRESULTS_COMPARE_STATE1 = 0x28AC4, // SAME 0x28D2C - EG_DB_PRELOAD_CONTROL = 0x28AC8, // SAME 0x28D30 - EG_DB_ALPHA_TO_MASK = 0x28B70, // SAME 0x28D44 - -/* Registers from CB block: */ - EG_CB_TARGET_MASK = 0x28238, // SAME - EG_CB_SHADER_MASK = 0x2823C, // SAME - EG_CB_BLEND_RED = 0x28414, // SAME - EG_CB_BLEND_GREEN = 0x28418, // SAME - EG_CB_BLEND_BLUE = 0x2841C, // SAME - EG_CB_BLEND_ALPHA = 0x28420, // SAME - EG_CB_BLEND0_CONTROL = 0x28780, // DIFF - EG_CB_BLEND1_CONTROL = 0x28784, // DIFF - EG_CB_BLEND2_CONTROL = 0x28788, // DIFF - EG_CB_BLEND3_CONTROL = 0x2878C, // DIFF - EG_CB_BLEND4_CONTROL = 0x28790, // DIFF - EG_CB_BLEND5_CONTROL = 0x28794, // DIFF - EG_CB_BLEND6_CONTROL = 0x28798, // DIFF - EG_CB_BLEND7_CONTROL = 0x2879C, // DIFF - EG_CB_COLOR_CONTROL = 0x28808, // DIFF - EG_CB_IMMED0_BASE = 0x28B9C, // - EG_CB_IMMED1_BASE = 0x28BA0, // - EG_CB_IMMED2_BASE = 0x28BA4, // - EG_CB_IMMED3_BASE = 0x28BA8, // - EG_CB_IMMED4_BASE = 0x28BAC, // - EG_CB_IMMED5_BASE = 0x28BB0, // - EG_CB_IMMED6_BASE = 0x28BB4, // - EG_CB_IMMED7_BASE = 0x28BB8, // - EG_CB_IMMED8_BASE = 0x28BBC, // - EG_CB_IMMED9_BASE = 0x28BC0, // - EG_CB_IMMED10_BASE = 0x28BC4, // - EG_CB_IMMED11_BASE = 0x28BC8, // - EG_CB_CLRCMP_CONTROL = 0x28C40, // SAME 0x28C30 - EG_CB_CLRCMP_SRC = 0x28C44, // SAME 0x28C34 - EG_CB_CLRCMP_DST = 0x28C48, // SAME 0x28C38 - EG_CB_CLRCMP_MSK = 0x28C4C, // SAME 0x28C3C - EG_CB_COLOR0_BASE = 0x28C60, // SAME 0x28040 - EG_CB_COLOR0_PITCH = 0x28C64, // - EG_CB_COLOR0_SLICE = 0x28C68, // - EG_CB_COLOR0_VIEW = 0x28C6C, // SAME 0x28080 - EG_CB_COLOR0_INFO = 0x28C70, // DIFF 0x280A0 - EG_CB_COLOR0_ATTRIB = 0x28C74, // - EG_CB_COLOR0_DIM = 0x28C78, // - EG_CB_COLOR0_CMASK = 0x28C7C, // - EG_CB_COLOR0_CMASK_SLICE = 0x28C80, // - EG_CB_COLOR0_FMASK = 0x28C84, // - EG_CB_COLOR0_FMASK_SLICE = 0x28C88, // - EG_CB_COLOR0_CLEAR_WORD0 = 0x28C8C, // - EG_CB_COLOR0_CLEAR_WORD1 = 0x28C90, // - EG_CB_COLOR0_CLEAR_WORD2 = 0x28C94, // - EG_CB_COLOR0_CLEAR_WORD3 = 0x28C98, // - EG_CB_COLOR1_BASE = 0x28C9C, // SAME 0x28044 - EG_CB_COLOR1_PITCH = 0x28CA0, // - EG_CB_COLOR1_SLICE = 0x28CA4, // - EG_CB_COLOR1_VIEW = 0x28CA8, // SAME 0x28084 - EG_CB_COLOR1_INFO = 0x28CAC, // DIFF 0x280A4 - EG_CB_COLOR1_ATTRIB = 0x28CB0, // - EG_CB_COLOR1_DIM = 0x28CB4, // - EG_CB_COLOR1_CMASK = 0x28CB8, // - EG_CB_COLOR1_CMASK_SLICE = 0x28CBC, // - EG_CB_COLOR1_FMASK = 0x28CC0, // - EG_CB_COLOR1_FMASK_SLICE = 0x28CC4, // - EG_CB_COLOR1_CLEAR_WORD0 = 0x28CC8, // - EG_CB_COLOR1_CLEAR_WORD1 = 0x28CCC, // - EG_CB_COLOR1_CLEAR_WORD2 = 0x28CD0, // - EG_CB_COLOR1_CLEAR_WORD3 = 0x28CD4, // - EG_CB_COLOR2_BASE = 0x28CD8, // SAME 0x28048 - EG_CB_COLOR2_PITCH = 0x28CDC, // - EG_CB_COLOR2_SLICE = 0x28CE0, // - EG_CB_COLOR2_VIEW = 0x28CE4, // SAME 0x28088 - EG_CB_COLOR2_INFO = 0x28CE8, // DIFF 0x280A8 - EG_CB_COLOR2_ATTRIB = 0x28CEC, // - EG_CB_COLOR2_DIM = 0x28CF0, // - EG_CB_COLOR2_CMASK = 0x28CF4, // - EG_CB_COLOR2_CMASK_SLICE = 0x28CF8, // - EG_CB_COLOR2_FMASK = 0x28CFC, // - EG_CB_COLOR2_FMASK_SLICE = 0x28D00, // - EG_CB_COLOR2_CLEAR_WORD0 = 0x28D04, // - EG_CB_COLOR2_CLEAR_WORD1 = 0x28D08, // - EG_CB_COLOR2_CLEAR_WORD2 = 0x28D0C, // - EG_CB_COLOR2_CLEAR_WORD3 = 0x28D10, // - EG_CB_COLOR3_BASE = 0x28D14, // SAME 0x2804C - EG_CB_COLOR3_PITCH = 0x28D18, // - EG_CB_COLOR3_SLICE = 0x28D1C, // - EG_CB_COLOR3_VIEW = 0x28D20, // SAME 0x2808C - EG_CB_COLOR3_INFO = 0x28D24, // DIFF 0x280AC - EG_CB_COLOR3_ATTRIB = 0x28D28, // - EG_CB_COLOR3_DIM = 0x28D2C, // - EG_CB_COLOR3_CMASK = 0x28D30, // - EG_CB_COLOR3_CMASK_SLICE = 0x28D34, // - EG_CB_COLOR3_FMASK = 0x28D38, // - EG_CB_COLOR3_FMASK_SLICE = 0x28D3C, // - EG_CB_COLOR3_CLEAR_WORD0 = 0x28D40, // - EG_CB_COLOR3_CLEAR_WORD1 = 0x28D44, // - EG_CB_COLOR3_CLEAR_WORD2 = 0x28D48, // - EG_CB_COLOR3_CLEAR_WORD3 = 0x28D4C, // - EG_CB_COLOR4_BASE = 0x28D50, // SAME 0x28050 - EG_CB_COLOR4_PITCH = 0x28D54, // - EG_CB_COLOR4_SLICE = 0x28D58, // - EG_CB_COLOR4_VIEW = 0x28D5C, // SAME 0x28090 - EG_CB_COLOR4_INFO = 0x28D60, // DIFF 0x280B0 - EG_CB_COLOR4_ATTRIB = 0x28D64, // - EG_CB_COLOR4_DIM = 0x28D68, // - EG_CB_COLOR4_CMASK = 0x28D6C, // - EG_CB_COLOR4_CMASK_SLICE = 0x28D70, // - EG_CB_COLOR4_FMASK = 0x28D74, // - EG_CB_COLOR4_FMASK_SLICE = 0x28D78, // - EG_CB_COLOR4_CLEAR_WORD0 = 0x28D7C, // - EG_CB_COLOR4_CLEAR_WORD1 = 0x28D80, // - EG_CB_COLOR4_CLEAR_WORD2 = 0x28D84, // - EG_CB_COLOR4_CLEAR_WORD3 = 0x28D88, // - EG_CB_COLOR5_BASE = 0x28D8C, // SAME 0x28054 - EG_CB_COLOR5_PITCH = 0x28D90, // - EG_CB_COLOR5_SLICE = 0x28D94, // - EG_CB_COLOR5_VIEW = 0x28D98, // SAME 0x28094 - EG_CB_COLOR5_INFO = 0x28D9C, // DIFF 0x280B4 - EG_CB_COLOR5_ATTRIB = 0x28DA0, // - EG_CB_COLOR5_DIM = 0x28DA4, // - EG_CB_COLOR5_CMASK = 0x28DA8, // - EG_CB_COLOR5_CMASK_SLICE = 0x28DAC, // - EG_CB_COLOR5_FMASK = 0x28DB0, // - EG_CB_COLOR5_FMASK_SLICE = 0x28DB4, // - EG_CB_COLOR5_CLEAR_WORD0 = 0x28DB8, // - EG_CB_COLOR5_CLEAR_WORD1 = 0x28DBC, // - EG_CB_COLOR5_CLEAR_WORD2 = 0x28DC0, // - EG_CB_COLOR5_CLEAR_WORD3 = 0x28DC4, // - EG_CB_COLOR6_BASE = 0x28DC8, // SAME 0x28058 - EG_CB_COLOR6_PITCH = 0x28DCC, // - EG_CB_COLOR6_SLICE = 0x28DD0, // - EG_CB_COLOR6_VIEW = 0x28DD4, // SAME 0x28098 - EG_CB_COLOR6_INFO = 0x28DD8, // DIFF 0x280B8 - EG_CB_COLOR6_ATTRIB = 0x28DDC, // - EG_CB_COLOR6_DIM = 0x28DE0, // - EG_CB_COLOR6_CMASK = 0x28DE4, // - EG_CB_COLOR6_CMASK_SLICE = 0x28DE8, // - EG_CB_COLOR6_FMASK = 0x28DEC, // - EG_CB_COLOR6_FMASK_SLICE = 0x28DF0, // - EG_CB_COLOR6_CLEAR_WORD0 = 0x28DF4, // - EG_CB_COLOR6_CLEAR_WORD1 = 0x28DF8, // - EG_CB_COLOR6_CLEAR_WORD2 = 0x28DFC, // - EG_CB_COLOR6_CLEAR_WORD3 = 0x28E00, // - EG_CB_COLOR7_BASE = 0x28E04, // SAME 0x2805C - EG_CB_COLOR7_PITCH = 0x28E08, // - EG_CB_COLOR7_SLICE = 0x28E0C, // - EG_CB_COLOR7_VIEW = 0x28E10, // SAME 0x2809C - EG_CB_COLOR7_INFO = 0x28E14, // DIFF 0x280BC - EG_CB_COLOR7_ATTRIB = 0x28E18, // - EG_CB_COLOR7_DIM = 0x28E1C, // - EG_CB_COLOR7_CMASK = 0x28E20, // - EG_CB_COLOR7_CMASK_SLICE = 0x28E24, // - EG_CB_COLOR7_FMASK = 0x28E28, // - EG_CB_COLOR7_FMASK_SLICE = 0x28E2C, // - EG_CB_COLOR7_CLEAR_WORD0 = 0x28E30, // - EG_CB_COLOR7_CLEAR_WORD1 = 0x28E34, // - EG_CB_COLOR7_CLEAR_WORD2 = 0x28E38, // - EG_CB_COLOR7_CLEAR_WORD3 = 0x28E3C, // - EG_CB_COLOR8_BASE = 0x28E40, // - EG_CB_COLOR8_PITCH = 0x28E44, // - EG_CB_COLOR8_SLICE = 0x28E48, // - EG_CB_COLOR8_VIEW = 0x28E4C, // - EG_CB_COLOR8_INFO = 0x28E50, // - EG_CB_COLOR8_ATTRIB = 0x28E54, // - EG_CB_COLOR8_DIM = 0x28E58, // - EG_CB_COLOR9_BASE = 0x28E5C, // - EG_CB_COLOR9_PITCH = 0x28E60, // - EG_CB_COLOR9_SLICE = 0x28E64, // - EG_CB_COLOR9_VIEW = 0x28E68, // - EG_CB_COLOR9_INFO = 0x28E6C, // - EG_CB_COLOR9_ATTRIB = 0x28E70, // - EG_CB_COLOR9_DIM = 0x28E74, // - EG_CB_COLOR10_BASE = 0x28E78, // - EG_CB_COLOR10_PITCH = 0x28E7C, // - EG_CB_COLOR10_SLICE = 0x28E80, // - EG_CB_COLOR10_VIEW = 0x28E84, // - EG_CB_COLOR10_INFO = 0x28E88, // - EG_CB_COLOR10_ATTRIB = 0x28E8C, // - EG_CB_COLOR10_DIM = 0x28E90, // - EG_CB_COLOR11_BASE = 0x28E94, // - EG_CB_COLOR11_PITCH = 0x28E98, // - EG_CB_COLOR11_SLICE = 0x28E9C, // - EG_CB_COLOR11_VIEW = 0x28EA0, // - EG_CB_COLOR11_INFO = 0x28EA4, // - EG_CB_COLOR11_ATTRIB = 0x28EA8, // - EG_CB_COLOR11_DIM = 0x28EAC, // - -/* Registers from CP block: */ - EG_COHER_DEST_BASE_0 = 0x28248, // SAME - EG_COHER_DEST_BASE_1 = 0x2824C, // SAME - EG_CP_PERFMON_CNTX_CNTL = 0x28358, // - -/* Config: */ - EG_SPI_CONFIG_CNTL = 0x9100, // DIFF - EG_SPI_CONFIG_CNTL_1 = 0x913C, // DIFF - EG_CP_PERFMON_CNTL = 0x87FC, // SAME - EG_SQ_MS_FIFO_SIZES = 0x8CF0, // SAME - EG_SQ_CONFIG = 0x8C00, // DIFF - EG_SQ_GPR_RESOURCE_MGMT_1 = 0x8C04, // SAME - EG_SQ_GPR_RESOURCE_MGMT_2 = 0x8C08, // SAME - EG_SQ_THREAD_RESOURCE_MGMT = 0x8C18, // SAME 0x8C0C, - EG_SQ_STACK_RESOURCE_MGMT_1 = 0x8C20, // SAME 0x8C10, - EG_SQ_STACK_RESOURCE_MGMT_2 = 0x8C24, // SAME 0x8C14, - EG_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ = 0x8D8C, // DIFF - EG_SQ_LDS_RESOURCE_MGMT = 0x8E2C, // - EG_SQ_GPR_RESOURCE_MGMT_3 = 0x8C0C, // - EG_SQ_STACK_RESOURCE_MGMT_3 = 0x8C28, // - EG_SQ_THREAD_RESOURCE_MGMT_2 = 0x8C1C, // - EG_VGT_CACHE_INVALIDATION = 0x88C4, // DIFF - EG_VGT_GS_VERTEX_REUSE = 0x88D4, // SAME - EG_PA_SC_FORCE_EOV_MAX_CNTS = 0x8B24, // SAME - EG_PA_SC_LINE_STIPPLE_STATE = 0x8B10, // SAME - EG_PA_CL_ENHANCE = 0x8A14, // SAME - -/* Tex border color */ - EG_TD_PS_BORDER_COLOR_RED = 0xA404, - EG_TD_PS_BORDER_COLOR_GREEN = 0xA408, - EG_TD_PS_BORDER_COLOR_BLUE = 0xA40C, - EG_TD_PS_BORDER_COLOR_ALPHA = 0xA410, - -/* const */ - EG_SQ_VTX_CONSTANT_WORD0_0 = 0x30000, // 0x38000 -}; - -#endif /* _EVERGREEN_OFF_H_ */
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.c b/src/mesa/drivers/dri/r600/evergreen_oglprog.c deleted file mode 100644 index 1fd655e85f8..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_oglprog.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <string.h> - -#include "main/glheader.h" -#include "main/imports.h" -#include "program/program.h" - -#include "tnl/tnl.h" - -#include "r600_context.h" -#include "r600_emit.h" - -#include "evergreen_oglprog.h" -#include "evergreen_fragprog.h" -#include "evergreen_vertprog.h" - - -static void evergreen_freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) -{ - struct evergreen_vertex_program *tmp, *vp = (struct evergreen_vertex_program *) cache->progs; - - while (vp) { - tmp = vp->next; - /* Release DMA region */ - r600DeleteShader(ctx, vp->shaderbo); - - if(NULL != vp->constbo0) - { - r600DeleteShader(ctx, vp->constbo0); - } - - /* Clean up */ - Clean_Up_Assembler(&(vp->r700AsmCode)); - Clean_Up_Shader(&(vp->r700Shader)); - - _mesa_reference_vertprog(ctx, &vp->mesa_program, NULL); - free(vp); - vp = tmp; - } -} - -static struct gl_program *evergreenNewProgram(struct gl_context * ctx, - GLenum target, - GLuint id) -{ - struct gl_program *pProgram = NULL; - - struct evergreen_vertex_program_cont *vpc; - struct evergreen_fragment_program *fp; - - radeon_print(RADEON_SHADER, RADEON_VERBOSE, - "%s %u, %u\n", __func__, target, id); - - switch (target) - { - case GL_VERTEX_STATE_PROGRAM_NV: - case GL_VERTEX_PROGRAM_ARB: - vpc = CALLOC_STRUCT(evergreen_vertex_program_cont); - pProgram = _mesa_init_vertex_program(ctx, - &vpc->mesa_program, - target, - id); - - break; - case GL_FRAGMENT_PROGRAM_NV: - case GL_FRAGMENT_PROGRAM_ARB: - fp = CALLOC_STRUCT(evergreen_fragment_program); - pProgram = _mesa_init_fragment_program(ctx, - &fp->mesa_program, - target, - id); - fp->translated = GL_FALSE; - fp->loaded = GL_FALSE; - - fp->shaderbo = NULL; - - fp->constbo0 = NULL; - - break; - default: - _mesa_problem(ctx, "Bad target in evergreenNewProgram"); - } - - return pProgram; -} - -static void evergreenDeleteProgram(struct gl_context * ctx, struct gl_program *prog) -{ - struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; - struct evergreen_fragment_program * fp; - - radeon_print(RADEON_SHADER, RADEON_VERBOSE, - "%s %p\n", __func__, prog); - - switch (prog->Target) - { - case GL_VERTEX_STATE_PROGRAM_NV: - case GL_VERTEX_PROGRAM_ARB: - evergreen_freeVertProgCache(ctx, (struct r700_vertex_program_cont *) vpc); - break; - case GL_FRAGMENT_PROGRAM_NV: - case GL_FRAGMENT_PROGRAM_ARB: - fp = (struct evergreen_fragment_program*)prog; - /* Release DMA region */ - - r600DeleteShader(ctx, fp->shaderbo); - - if(NULL != fp->constbo0) - { - r600DeleteShader(ctx, fp->constbo0); - } - - /* Clean up */ - Clean_Up_Assembler(&(fp->r700AsmCode)); - Clean_Up_Shader(&(fp->r700Shader)); - break; - default: - _mesa_problem(ctx, "Bad target in evergreenNewProgram"); - } - - _mesa_delete_program(ctx, prog); -} - -static GLboolean -evergreenProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) -{ - struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; - struct evergreen_fragment_program * fp = (struct evergreen_fragment_program*)prog; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - evergreen_freeVertProgCache(ctx, (struct r700_vertex_program_cont *) vpc); - vpc->progs = NULL; - break; - case GL_FRAGMENT_PROGRAM_ARB: - r600DeleteShader(ctx, fp->shaderbo); - - if(NULL != fp->constbo0) - { - r600DeleteShader(ctx, fp->constbo0); - fp->constbo0 = NULL; - } - - Clean_Up_Assembler(&(fp->r700AsmCode)); - Clean_Up_Shader(&(fp->r700Shader)); - fp->translated = GL_FALSE; - fp->loaded = GL_FALSE; - fp->shaderbo = NULL; - break; - } - - /* XXX check if program is legal, within limits */ - return GL_TRUE; -} - -static GLboolean evergreenIsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) -{ - - return GL_TRUE; -} - -void evergreenInitShaderFuncs(struct dd_function_table *functions) -{ - functions->NewProgram = evergreenNewProgram; - functions->DeleteProgram = evergreenDeleteProgram; - functions->ProgramStringNotify = evergreenProgramStringNotify; - functions->IsProgramNative = evergreenIsProgramNative; -} diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.h b/src/mesa/drivers/dri/r600/evergreen_oglprog.h deleted file mode 100644 index 1cf3e79d05c..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_oglprog.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_OGLPROG_H_ -#define _EVERGREEN_OGLPROG_H_ -#include "r600_context.h" - -extern void evergreenInitShaderFuncs(struct dd_function_table *functions); - -#endif /*_EVERGREEN_OGLPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c deleted file mode 100644 index 74563caf47c..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ /dev/null @@ -1,971 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/state.h" -#include "main/imports.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/dd.h" -#include "main/simple_list.h" -#include "main/api_arrayelt.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_vp_build.h" -#include "tnl/t_context.h" -#include "tnl/t_vertex.h" -#include "vbo/vbo_context.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" - -#include "evergreen_fragprog.h" -#include "evergreen_vertprog.h" - -#include "evergreen_state.h" -#include "evergreen_tex.h" - -#include "radeon_buffer_objects.h" -#include "radeon_common_context.h" - -static unsigned int evergreenPrimitiveType(int prim) //same -{ - switch (prim & PRIM_MODE_MASK) - { - case GL_POINTS: - return DI_PT_POINTLIST; - break; - case GL_LINES: - return DI_PT_LINELIST; - break; - case GL_LINE_STRIP: - return DI_PT_LINESTRIP; - break; - case GL_LINE_LOOP: - return DI_PT_LINELOOP; - break; - case GL_TRIANGLES: - return DI_PT_TRILIST; - break; - case GL_TRIANGLE_STRIP: - return DI_PT_TRISTRIP; - break; - case GL_TRIANGLE_FAN: - return DI_PT_TRIFAN; - break; - case GL_QUADS: - return DI_PT_QUADLIST; - break; - case GL_QUAD_STRIP: - return DI_PT_QUADSTRIP; - break; - case GL_POLYGON: - return DI_PT_POLYGON; - break; - default: - assert(0); - return -1; - break; - } -} - -static int evergreenNumVerts(int num_verts, int prim) //same -{ - int verts_off = 0; - - switch (prim & PRIM_MODE_MASK) { - case GL_POINTS: - verts_off = 0; - break; - case GL_LINES: - verts_off = num_verts % 2; - break; - case GL_LINE_STRIP: - if (num_verts < 2) - verts_off = num_verts; - break; - case GL_LINE_LOOP: - if (num_verts < 2) - verts_off = num_verts; - break; - case GL_TRIANGLES: - verts_off = num_verts % 3; - break; - case GL_TRIANGLE_STRIP: - if (num_verts < 3) - verts_off = num_verts; - break; - case GL_TRIANGLE_FAN: - if (num_verts < 3) - verts_off = num_verts; - break; - case GL_QUADS: - verts_off = num_verts % 4; - break; - case GL_QUAD_STRIP: - if (num_verts < 4) - verts_off = num_verts; - else - verts_off = num_verts % 2; - break; - case GL_POLYGON: - if (num_verts < 3) - verts_off = num_verts; - break; - default: - assert(0); - return -1; - break; - } - - return num_verts - verts_off; -} - -static void evergreenRunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim, - GLint basevertex) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - BATCH_LOCALS(&context->radeon); - int type, total_emit; - int num_indices; - uint32_t vgt_draw_initiator = 0; - uint32_t vgt_index_type = 0; - uint32_t vgt_primitive_type = 0; - uint32_t vgt_num_indices = 0; - - type = evergreenPrimitiveType(prim); - num_indices = evergreenNumVerts(end - start, prim); - - radeon_print(RADEON_RENDER, RADEON_TRACE, - "%s type %x num_indices %d\n", - __func__, type, num_indices); - - if (type < 0 || num_indices <= 0) - return; - - SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - - SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - - if(GL_TRUE != context->ind_buf.is_32bit) - { - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - - /* 16-bit indexes are packed in a 32-bit value */ - SETfield(vgt_index_type, -#if MESA_BIG_ENDIAN - VGT_DMA_SWAP_32_BIT, -#else - VGT_DMA_SWAP_NONE, -#endif - SWAP_MODE_shift, SWAP_MODE_mask); - - vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ - + 5 + 2; /* DRAW_INDEX */ - - BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim - R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - /* offset */ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(basevertex); //VTX_BASE_VTX_LOC - R600_OUT_BATCH(0); //VTX_START_INST_LOC - // draw packet - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); - R600_OUT_BATCH(context->ind_buf.bo_offset); - R600_OUT_BATCH(0); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, - context->ind_buf.bo, - context->ind_buf.bo_offset, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); -} - -static void evergreenRunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - BATCH_LOCALS(&context->radeon); - int type, i; - uint32_t num_indices, total_emit = 0; - uint32_t vgt_draw_initiator = 0; - uint32_t vgt_index_type = 0; - uint32_t vgt_primitive_type = 0; - uint32_t vgt_num_indices = 0; - - type = evergreenPrimitiveType(prim); - num_indices = evergreenNumVerts(end - start, prim); - - radeon_print(RADEON_RENDER, RADEON_TRACE, - "%s type %x num_indices %d\n", - __func__, type, num_indices); - - if (type < 0 || num_indices <= 0) - return; - - SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - - if (num_indices > 0xffff) - { - SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - else - { - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - - /* 16-bit indexes are packed in a 32-bit value */ - SETfield(vgt_index_type, -#if MESA_BIG_ENDIAN - VGT_DMA_SWAP_32_BIT, -#else - VGT_DMA_SWAP_NONE, -#endif - SWAP_MODE_shift, SWAP_MODE_mask); - - vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - - if (start == 0) - { - SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); - } - else - { - if (num_indices > 0xffff) - { - total_emit += num_indices; - } - else - { - total_emit += (num_indices + 1) / 2; - } - SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); - } - - total_emit += 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ - + 3; /* DRAW */ - - BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim - R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - /* offset */ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); //VTX_BASE_VTX_LOC - R600_OUT_BATCH(0); //VTX_START_INST_LOC - // draw packet - if(start == 0) - { - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - } - else - { - if (num_indices > 0xffff) - { - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - for (i = start; i < (start + num_indices); i++) - { - R600_OUT_BATCH(i); - } - } - else - { - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (((num_indices + 1) / 2) + 1))); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - for (i = start; i < (start + num_indices); i += 2) - { - if ((i + 1) == (start + num_indices)) - { - R600_OUT_BATCH(i); - } - else - { - R600_OUT_BATCH(((i + 1) << 16) | (i)); - } - } - } - } - - END_BATCH(); - COMMIT_BATCH(); -} - -#define CONVERT( TYPE, MACRO ) do { \ - GLuint i, j, sz; \ - sz = input->Size; \ - if (input->Normalized) { \ - for (i = 0; i < count; i++) { \ - const TYPE *in = (TYPE *)src_ptr; \ - for (j = 0; j < sz; j++) { \ - *dst_ptr++ = MACRO(*in); \ - in++; \ - } \ - src_ptr += stride; \ - } \ - } else { \ - for (i = 0; i < count; i++) { \ - const TYPE *in = (TYPE *)src_ptr; \ - for (j = 0; j < sz; j++) { \ - *dst_ptr++ = (GLfloat)(*in); \ - in++; \ - } \ - src_ptr += stride; \ - } \ - } \ -} while (0) - -/** - * Convert attribute data type to float - * If the attribute uses named buffer object replace the bo with newly allocated bo - */ -static void evergreenConvertAttrib(struct gl_context *ctx, int count, - const struct gl_client_array *input, - struct StreamDesc *attr) -{ - context_t *context = R700_CONTEXT(ctx); - const GLvoid *src_ptr; - GLboolean mapped_named_bo = GL_FALSE; - GLfloat *dst_ptr; - GLuint stride; - - stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size : input->StrideB; - - /* Convert value for first element only */ - if (input->StrideB == 0) - { - count = 1; - } - - if (input->BufferObj->Name) - { - if (!input->BufferObj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size, - GL_MAP_READ_BIT, input->BufferObj); - mapped_named_bo = GL_TRUE; - } - - src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); - } - else - { - src_ptr = input->Ptr; - } - - radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, - sizeof(GLfloat) * input->Size * count, 32); - - radeon_bo_map(attr->bo, 1); - - dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); - - assert(src_ptr != NULL); - - switch (input->Type) - { - case GL_DOUBLE: - CONVERT(GLdouble, (GLfloat)); - break; - case GL_UNSIGNED_INT: - CONVERT(GLuint, UINT_TO_FLOAT); - break; - case GL_INT: - CONVERT(GLint, INT_TO_FLOAT); - break; - case GL_UNSIGNED_SHORT: - CONVERT(GLushort, USHORT_TO_FLOAT); - break; - case GL_SHORT: - CONVERT(GLshort, SHORT_TO_FLOAT); - break; - case GL_UNSIGNED_BYTE: - assert(input->Format != GL_BGRA); - CONVERT(GLubyte, UBYTE_TO_FLOAT); - break; - case GL_BYTE: - CONVERT(GLbyte, BYTE_TO_FLOAT); - break; - default: - assert(0); - break; - } - - radeon_bo_unmap(attr->bo); - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, input->BufferObj); - } -} - -static void evergreenFixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - GLvoid *src_ptr; - GLuint *out; - int i; - GLboolean mapped_named_bo = GL_FALSE; - - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size, - GL_MAP_READ_BIT, mesa_ind_buf->obj); - mapped_named_bo = GL_TRUE; - assert(mesa_ind_buf->obj->Pointer != NULL); - } - src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); - - if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) - { - GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); - GLubyte *in = (GLubyte *)src_ptr; - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) - { - *out++ = in[i] | in[i + 1] << 16; - } - - if (i < mesa_ind_buf->count) - { - *out++ = in[i]; - } - - radeon_bo_unmap(context->ind_buf.bo); -#if MESA_BIG_ENDIAN - } - else - { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ - GLushort *in = (GLushort *)src_ptr; - GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) - { - *out++ = in[i] | in[i + 1] << 16; - } - - if (i < mesa_ind_buf->count) - { - *out++ = in[i]; - } - radeon_bo_unmap(context->ind_buf.bo); -#endif - } - - context->ind_buf.is_32bit = GL_FALSE; - context->ind_buf.count = mesa_ind_buf->count; - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, mesa_ind_buf->obj); - } -} - -static GLboolean evergreen_check_fallbacks(struct gl_context *ctx) //same -{ - if (ctx->RenderMode != GL_RENDER) - return GL_TRUE; - - return GL_FALSE; -} - -/* start 3d, idle, cb/db flush */ -#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 - -static GLuint evergreenPredictRenderSize(struct gl_context* ctx, - const struct _mesa_prim *prim, - const struct _mesa_index_buffer *ib, - GLuint nr_prims) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - GLboolean flushed; - GLuint dwords, i; - GLuint state_size; - - dwords = PRE_EMIT_STATE_BUFSZ; - if (ib) - dwords += nr_prims * 18; - else { - for (i = 0; i < nr_prims; ++i) - { - if (prim[i].start == 0) - dwords += 14; - else if (prim[i].count > 0xffff) - dwords += prim[i].count + 14; - else - dwords += ((prim[i].count + 1) / 2) + 14; - } - } - - state_size = radeonCountStateEmitSize(&context->radeon); - flushed = rcommonEnsureCmdBufSpace(&context->radeon, - dwords + state_size, - __FUNCTION__); - if (flushed) - dwords += radeonCountStateEmitSize(&context->radeon); - else - dwords += state_size; - - radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s: total prediction size is %d.\n", __FUNCTION__, dwords); - return dwords; - -} - -static void evergreenSetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - if (!mesa_ind_buf) { - context->ind_buf.bo = NULL; - return; - } - -#if MESA_BIG_ENDIAN - if (mesa_ind_buf->type == GL_UNSIGNED_INT) -#else - if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) -#endif - { - const GLvoid *src_ptr; - GLvoid *dst_ptr; - GLboolean mapped_named_bo = GL_FALSE; - - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size, - GL_MAP_READ_BIT, mesa_ind_buf->obj); - assert(mesa_ind_buf->obj->Pointer != NULL); - mapped_named_bo = GL_TRUE; - } - - src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); - - const GLuint size = mesa_ind_buf->count * getTypeSize(mesa_ind_buf->type); - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - memcpy(dst_ptr, src_ptr, size); - - radeon_bo_unmap(context->ind_buf.bo); - context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); - context->ind_buf.count = mesa_ind_buf->count; - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, mesa_ind_buf->obj); - } - } - else - { - evergreenFixupIndexBuffer(ctx, mesa_ind_buf); - } -} - -#if 0 /* unused */ -static void evergreenAlignDataToDword(struct gl_context *ctx, - const struct gl_client_array *input, - int count, - struct StreamDesc *attr) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - const int dst_stride = (input->StrideB + 3) & ~3; - const int size = getTypeSize(input->Type) * input->Size * count; - GLboolean mapped_named_bo = GL_FALSE; - - radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32); - - radeon_bo_map(attr->bo, 1); - - if (!input->BufferObj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size, - GL_MAP_READ_BIT, input->BufferObj->obj); - mapped_named_bo = GL_TRUE; - } - - { - GLvoid *src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); - GLvoid *dst_ptr = ADD_POINTERS(attr->bo->ptr, attr->bo_offset); - int i; - - for (i = 0; i < count; ++i) - { - memcpy(dst_ptr, src_ptr, input->StrideB); - src_ptr += input->StrideB; - dst_ptr += dst_stride; - } - } - - radeon_bo_unmap(attr->bo); - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, input->BufferObj); - } - - attr->stride = dst_stride; -} -#endif - -static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - GLuint stride; - int ret; - int i, index; - - EVERGREEN_STATECHANGE(context, vtx); - - for(index = 0; index < context->nNumActiveAos; index++) - { - struct radeon_aos *aos = &context->radeon.tcl.aos[index]; - i = context->stream_desc[index].element; - - stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; - - if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT -#if MESA_BIG_ENDIAN - || getTypeSize(input[i]->Type) != 4 -#endif - ) - { - evergreenConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); - } - else - { - if (input[i]->BufferObj->Name) - { - context->stream_desc[index].stride = input[i]->StrideB; - context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; - context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; - context->stream_desc[index].is_named_bo = GL_TRUE; - } - else - { - int size; - int local_count = count; - uint32_t *dst; - - if (input[i]->StrideB == 0) - { - size = getTypeSize(input[i]->Type) * input[i]->Size; - local_count = 1; - } - else - { - size = getTypeSize(input[i]->Type) * input[i]->Size * local_count; - } - - radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo, - &context->stream_desc[index].bo_offset, size, 32); - - radeon_bo_map(context->stream_desc[index].bo, 1); - assert(context->stream_desc[index].bo->ptr != NULL); - - - dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr, - context->stream_desc[index].bo_offset); - - switch (context->stream_desc[index].dwords) - { - case 1: - radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 2: - radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 3: - radeonEmitVec12(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 4: - radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - default: - assert(0); - break; - } - - radeon_bo_unmap(context->stream_desc[index].bo); - } - } - - aos->count = context->stream_desc[index].stride == 0 ? 1 : count; - aos->stride = context->stream_desc[index].stride / sizeof(float); - aos->components = context->stream_desc[index].dwords; - aos->bo = context->stream_desc[index].bo; - aos->offset = context->stream_desc[index].bo_offset; - - if(context->stream_desc[index].is_named_bo) - { - radeon_cs_space_add_persistent_bo(context->radeon.cmdbuf.cs, - context->stream_desc[index].bo, - RADEON_GEM_DOMAIN_GTT, 0); - } - } - - ret = radeon_cs_space_check_with_bo(context->radeon.cmdbuf.cs, - first_elem(&context->radeon.dma.reserved)->bo, - RADEON_GEM_DOMAIN_GTT, 0); -} - -static void evergreenFreeData(struct gl_context *ctx) -{ - /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo - * to prevent double unref in radeonReleaseArrays - * called during context destroy - */ - context_t *context = EVERGREEN_CONTEXT(ctx); - - int i; - - for (i = 0; i < context->nNumActiveAos; i++) - { - if (!context->stream_desc[i].is_named_bo) - { - radeon_bo_unref(context->stream_desc[i].bo); - } - context->radeon.tcl.aos[i].bo = NULL; - } - - if(context->vp_Constbo != NULL) - { - radeon_bo_unref(context->vp_Constbo); - context->vp_Constbo = NULL; - } - if(context->fp_Constbo != NULL) - { - radeon_bo_unref(context->fp_Constbo); - context->fp_Constbo = NULL; - } - - if (context->ind_buf.bo != NULL) - { - radeon_bo_unref(context->ind_buf.bo); - } -} - -static GLboolean evergreenTryDrawPrims(struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index ) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - GLuint i, id = 0; - struct radeon_renderbuffer *rrb; - - if (ctx->NewState) - _mesa_update_state( ctx ); - - if (evergreen_check_fallbacks(ctx)) - return GL_FALSE; - - _tnl_UpdateFixedFunctionProgram(ctx); - evergreenSetVertexFormat(ctx, arrays, max_index + 1); - - - /* shaders need to be updated before buffers are validated */ - evergreenUpdateShaders(ctx); - if (!evergreenValidateBuffers(ctx)) - return GL_FALSE; - - /* always emit CB base to prevent - * lock ups on some chips. - */ - EVERGREEN_STATECHANGE(context, cb); - /* mark vtx as dirty since it changes per-draw */ - EVERGREEN_STATECHANGE(context, vtx); - - evergreenSetScissor(context); - - evergreenSetupVertexProgram(ctx); - evergreenSetupFragmentProgram(ctx); - evergreenUpdateShaderStates(ctx); - - GLuint emit_end = evergreenPredictRenderSize(ctx, prim, ib, nr_prims) - + context->radeon.cmdbuf.cs->cdw; - - /* evergreenPredictRenderSize will call radeonReleaseDmaRegions, so update VP/FP const buf after it. */ - evergreenSetupVPconstants(ctx); - evergreenSetupFPconstants(ctx); - - evergreenSetupIndexBuffer(ctx, ib); - - evergreenSetupStreams(ctx, arrays, max_index + 1); - - radeonEmitState(radeon); - - radeon_debug_add_indent(); - - for (i = 0; i < nr_prims; ++i) - { - if (context->ind_buf.bo) - evergreenRunRenderPrimitive(ctx, - prim[i].start, - prim[i].start + prim[i].count, - prim[i].mode, - prim[i].basevertex); - else - evergreenRunRenderPrimitiveImmediate(ctx, - prim[i].start, - prim[i].start + prim[i].count, - prim[i].mode); - } - - radeon_debug_remove_indent(); - - /* Flush render op cached for last several quads. */ - /* XXX drm should handle this in fence submit */ - - //evergreeWaitForIdleClean(context); - - rrb = radeon_get_colorbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - CB_ACTION_ENA_bit | (1 << (id + 6))); - - rrb = radeon_get_depthbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - DB_ACTION_ENA_bit | DB_DEST_BASE_ENA_bit); - - evergreenFreeData(ctx); - - if (emit_end < context->radeon.cmdbuf.cs->cdw) - { - WARN_ONCE("Rendering was %d commands larger than predicted size." - " We might overflow command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end); - } - - return GL_TRUE; -} - -static void evergreenDrawPrims(struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index) -{ - GLboolean retval = GL_FALSE; - - context_t *context = EVERGREEN_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - radeon_prepare_render(radeon); - - /* This check should get folded into just the places that - * min/max index are really needed. - */ - if (!vbo_all_varyings_in_vbos(arrays)) { - if (!index_bounds_valid) - vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); - /* do we want to rebase, minimizes the - * amount of data to upload? */ - if (min_index) { - vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); - return; - } - } - /* Make an attempt at drawing */ - retval = evergreenTryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); - - /* If failed run tnl pipeline - it should take care of fallbacks */ - if (!retval) { - _swsetup_Wakeup(ctx); - _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); - } -} - -void evergreenInitDraw(struct gl_context *ctx) -{ - struct vbo_context *vbo = vbo_context(ctx); - - /* to be enabled */ - vbo->draw_prims = evergreenDrawPrims; -} - - diff --git a/src/mesa/drivers/dri/r600/evergreen_sq.h b/src/mesa/drivers/dri/r600/evergreen_sq.h deleted file mode 100644 index b1a536e76f6..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_sq.h +++ /dev/null @@ -1,735 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_SQ_H_ -#define _EVERGREEN_SQ_H_ - -enum{ -//CF - EG_CF_WORD0__ADDR_shift = 0, - EG_CF_WORD0__ADDR_mask = 0xFFFFFF, - EG_CF_WORD0__JUMPTABLE_SEL_shift = 24, - EG_CF_WORD0__JUMPTABLE_SEL_mask = 0x7 << 24, - - EG_CF_WORD1__POP_COUNT_shift = 0, //3 bits - EG_CF_WORD1__POP_COUNT_mask = 0x7, - EG_CF_WORD1__CF_CONST_shift = 3, //5 bits - EG_CF_WORD1__CF_CONST_mask = 0x1F << 3, - EG_CF_WORD1__COND_shift = 8, //2 bits - EG_CF_WORD1__COND_mask = 0x3 << 8, - EG_CF_WORD1__COUNT_shift = 10,//6 bits - EG_CF_WORD1__COUNT_mask = 0x3F << 10, - EG_CF_WORD1__reserved_shift = 16,//4 bits - EG_CF_WORD1__VPM_shift = 20,//1 bit - EG_CF_WORD1__VPM_bit = 1 << 20, - EG_CF_WORD1__EOP_shift = 21,//1 bit - EG_CF_WORD1__EOP_bit = 1 << 21, - EG_CF_WORD1__CF_INST_shift = 22,//8 bits - EG_CF_WORD1__CF_INST_mask = 0xFF << 22, - EG_CF_WORD1__WQM_shift = 30,//1 bit - EG_CF_WORD1__WQM_bit = 1 << 30, - EG_CF_WORD1__BARRIER_shift = 31,//1 bit - EG_CF_WORD1__BARRIER_bit = 1 << 31, - - EG_CF_INST_NOP = 0, - EG_CF_INST_TC = 1, - EG_CF_INST_VC = 2, - EG_CF_INST_GDS = 3, - EG_CF_INST_LOOP_START = 4, - EG_CF_INST_LOOP_END = 5, - EG_CF_INST_LOOP_START_DX10 = 6, - EG_CF_INST_LOOP_START_NO_AL = 7, - EG_CF_INST_LOOP_CONTINUE = 8, - EG_CF_INST_LOOP_BREAK = 9, - EG_CF_INST_JUMP = 10, - EG_CF_INST_PUSH = 11, - EG_CF_INST_Reserved_12 = 12, - EG_CF_INST_ELSE = 13, - EG_CF_INST_POP = 14, - EG_CF_INST_Reserved_15 = 15, - EG_CF_INST_Reserved_16 = 16, - EG_CF_INST_Reserved_17 = 17, - EG_CF_INST_CALL = 18, - EG_CF_INST_CALL_FS = 19, - EG_CF_INST_RETURN = 20, - EG_CF_INST_EMIT_VERTEX = 21, - EG_CF_INST_EMIT_CUT_VERTEX = 22, - EG_CF_INST_CUT_VERTEX = 23, - EG_CF_INST_KILL = 24, - EG_CF_INST_Reserved_25 = 25, - EG_CF_INST_WAIT_ACK = 26, - EG_CF_INST_TC_ACK = 27, - EG_CF_INST_VC_ACK = 28, - EG_CF_INST_JUMPTABLE = 29, - EG_CF_INST_GLOBAL_WAVE_SYNC = 30, - EG_CF_INST_HALT = 31, - -//TEX - EG_TEX_WORD0__TEX_INST_shift = 0, //5 bits - EG_TEX_WORD0__TEX_INST_mask = 0x1F, - EG_TEX_WORD0__INST_MOD_shift = 5, //2 bits - EG_TEX_WORD0__INST_MOD_mask = 0x3 << 5, - EG_TEX_WORD0__FWQ_shift = 7, //1 bit - EG_TEX_WORD0__FWQ_bit = 1 << 7, - EG_TEX_WORD0__RESOURCE_ID_shift = 8, //8 bits - EG_TEX_WORD0__RESOURCE_ID_mask = 0xFF << 8, - EG_TEX_WORD0__SRC_GPR_shift = 16,//7 bits - EG_TEX_WORD0__SRC_GPR_mask = 0x7F << 16, - EG_TEX_WORD0__SRC_REL_shift = 23,//1 bit - EG_TEX_WORD0__SRC_REL_bit = 1 << 23, - EG_TEX_WORD0__ALT_CONST_shift = 24,//1 bit - EG_TEX_WORD0__ALT_CONST_bit = 1 << 24, - EG_TEX_WORD0__RIM_shift = 25,//2 bits - EG_TEX_WORD0__RIM_mask = 0x3 << 25, - EG_TEX_WORD0__SIM_shift = 27,//2 bits - EG_TEX_WORD0__SIM_mask = 0x3 << 27, - EG_TEX_WORD0__Reserved_shift = 29,//3 bits - EG_TEX_WORD0__Reserved_mask = 0x7 << 29, - - EG_TEX_INST_Reserved_0 = 0, - EG_TEX_INST_Reserved_1 = 1, - EG_TEX_INST_Reserved_2 = 2, - EG_TEX_INST_LD = 3, - EG_TEX_INST_GET_TEXTURE_RESINFO = 4, - EG_TEX_INST_GET_NUMBER_OF_SAMPLES= 5, - EG_TEX_INST_GET_COMP_TEX_LOD = 6, - EG_TEX_INST_GET_GRADIENTS_H = 7, - EG_TEX_INST_GET_GRADIENTS_V = 8, - EG_TEX_INST_SET_TEXTURE_OFFSETS = 9, - EG_TEX_INST_KEEP_GRADIENTS = 10, - EG_TEX_INST_SET_GRADIENTS_H = 11, - EG_TEX_INST_SET_GRADIENTS_V = 12, - EG_TEX_INST_Reserved_13 = 13, - EG_TEX_INST_Reserved_14 = 14, - EG_TEX_INST_Reserved_15 = 15, - EG_TEX_INST_SAMPLE = 16, - EG_TEX_INST_SAMPLE_L = 17, - EG_TEX_INST_SAMPLE_LB = 18, - EG_TEX_INST_SAMPLE_LZ = 19, - EG_TEX_INST_SAMPLE_G = 20, - EG_TEX_INST_GATHER4 = 21, - EG_TEX_INST_SAMPLE_G_LB = 22, - EG_TEX_INST_GATHER4_O = 23, - EG_TEX_INST_SAMPLE_C = 24, - EG_TEX_INST_SAMPLE_C_L = 25, - EG_TEX_INST_SAMPLE_C_LB = 26, - EG_TEX_INST_SAMPLE_C_LZ = 27, - EG_TEX_INST_SAMPLE_C_G = 28, - EG_TEX_INST_GATHER4_C = 29, - EG_TEX_INST_SAMPLE_C_G_LB = 30, - EG_TEX_INST_GATHER4_C_O = 31, - - EG_TEX_WORD1__DST_GPR_shift = 0, //7 bits - EG_TEX_WORD1__DST_GPR_mask = 0x7F, - EG_TEX_WORD1__DST_REL_shift = 7, //1 bit - EG_TEX_WORD1__DST_REL_bit = 1 << 7, - EG_TEX_WORD1__Reserved_shift = 8, //1 bit - EG_TEX_WORD1__Reserved_bit = 1 << 8, - EG_TEX_WORD1__DST_SEL_X_shift = 9, //3 bits - EG_TEX_WORD1__DST_SEL_X_mask = 0x7 << 9, - EG_TEX_WORD1__DST_SEL_Y_shift = 12,//3 bits - EG_TEX_WORD1__DST_SEL_Y_mask = 0x7 << 12, - EG_TEX_WORD1__DST_SEL_Z_shift = 15,//3 bits - EG_TEX_WORD1__DST_SEL_Z_mask = 0x7 << 15, - EG_TEX_WORD1__DST_SEL_W_shift = 18,//3 bits - EG_TEX_WORD1__DST_SEL_W_mask = 0x7 << 18, - EG_TEX_WORD1__LOD_BIAS_shift = 21,//7 bits - EG_TEX_WORD1__LOD_BIAS_mask = 0x7F << 21, - EG_TEX_WORD1__COORD_TYPE_X_shift = 28,//1 bit - EG_TEX_WORD1__COORD_TYPE_X_bit = 1 << 28, - EG_TEX_WORD1__COORD_TYPE_Y_shift = 29,//1 bit - EG_TEX_WORD1__COORD_TYPE_Y_bit = 1 << 29, - EG_TEX_WORD1__COORD_TYPE_Z_shift = 30,//1 bit - EG_TEX_WORD1__COORD_TYPE_Z_bit = 1 << 30, - EG_TEX_WORD1__COORD_TYPE_W_shift = 31,//1 bit - EG_TEX_WORD1__COORD_TYPE_W_bit = 1 << 31, - - EG_TEX_WORD2__OFFSET_X_shift = 0, //5 bits - EG_TEX_WORD2__OFFSET_X_mask = 0x1F, - EG_TEX_WORD2__OFFSET_Y_shift = 5, //5 bits - EG_TEX_WORD2__OFFSET_Y_mask = 0x1F << 5, - EG_TEX_WORD2__OFFSET_Z_shift = 10,//5 bits - EG_TEX_WORD2__OFFSET_Z_mask = 0x1F << 10, - EG_TEX_WORD2__SAMPLER_ID_shift = 15,//5 bits - EG_TEX_WORD2__SAMPLER_ID_mask = 0x1F << 15, - EG_TEX_WORD2__SRC_SEL_X_shift = 20,//3 bits - EG_TEX_WORD2__SRC_SEL_X_mask = 0x7 << 20, - EG_TEX_WORD2__SRC_SEL_Y_shift = 23,//3 bits - EG_TEX_WORD2__SRC_SEL_Y_mask = 0x7 << 23, - EG_TEX_WORD2__SRC_SEL_Z_shift = 26,//3 bits - EG_TEX_WORD2__SRC_SEL_Z_mask = 0x7 << 26, - EG_TEX_WORD2__SRC_SEL_W_shift = 29,//3 bits - EG_TEX_WORD2__SRC_SEL_W_mask = 0x7 << 29, - -//VTX - EG_VTX_WORD0__VC_INST_shift = 0, //5 bits - EG_VTX_WORD0__VC_INST_mask = 0x1F, - EG_VTX_WORD0__FETCH_TYPE_shift = 5, //2 bits - EG_VTX_WORD0__FETCH_TYPE_mask = 0x3 << 5, - EG_VTX_WORD0__FWQ_shift = 7, //1 bit - EG_VTX_WORD0__FWQ_bit = 1 << 7, - EG_VTX_WORD0__BUFFER_ID_shift = 8, //8 bits - EG_VTX_WORD0__BUFFER_ID_mask = 0xFF << 8, - EG_VTX_WORD0__SRC_GPR_shift = 16,//7 bits - EG_VTX_WORD0__SRC_GPR_mask = 0x7F << 16, - EG_VTX_WORD0__SRC_REL_shift = 23,//1 bit - EG_VTX_WORD0__SRC_REL_bit = 1 << 23, - EG_VTX_WORD0__SRC_SEL_X_shift = 24,//2 bits - EG_VTX_WORD0__SRC_SEL_X_mask = 0x3 << 24, - EG_VTX_WORD0__MFC_shift = 26,//6 bits - EG_VTX_WORD0__MFC_mask = 0x3F << 26, - - EG_VC_INST_FETCH = 0, - EG_VC_INST_SEMANTIC = 1, - EG_VC_INST_Reserved_2 = 2, - EG_VC_INST_Reserved_3 = 3, - EG_VC_INST_Reserved_4 = 4, - EG_VC_INST_Reserved_5 = 5, - EG_VC_INST_Reserved_6 = 6, - EG_VC_INST_Reserved_7 = 7, - EG_VC_INST_Reserved_8 = 8, - EG_VC_INST_Reserved_9 = 9, - EG_VC_INST_Reserved_10 = 10, - EG_VC_INST_Reserved_11 = 11, - EG_VC_INST_Reserved_12 = 12, - EG_VC_INST_Reserved_13 = 13, - EG_VC_INST_GET_BUFFER_RESINFO = 14, - - EG_VTX_FETCH_VERTEX_DATA = 0, - EG_VTX_FETCH_INSTANCE_DATA = 1, - EG_VTX_FETCH_NO_INDEX_OFFSET = 2, - - EG_VTX_WORD1_SEM__SEMANTIC_ID_shift = 0, //8 bits - EG_VTX_WORD1_SEM__SEMANTIC_ID_mask = 0xFF, - EG_VTX_WORD1_GPR__DST_GPR_shift = 0, //7 bits - EG_VTX_WORD1_GPR__DST_GPR_mask = 0x7F, - EG_VTX_WORD1_GPR__DST_REL_shift = 7, //1 bit - EG_VTX_WORD1_GPR__DST_REL_bit = 1 << 7, - EG_VTX_WORD1__Reserved_shift = 8, //1 bit - EG_VTX_WORD1__Reserved_bit = 1 << 8, - EG_VTX_WORD1__DST_SEL_X_shift = 9, //3 bits - EG_VTX_WORD1__DST_SEL_X_mask = 0x7 << 9, - EG_VTX_WORD1__DST_SEL_Y_shift = 12,//3 bits - EG_VTX_WORD1__DST_SEL_Y_mask = 0x7 << 12, - EG_VTX_WORD1__DST_SEL_Z_shift = 15,//3 bits - EG_VTX_WORD1__DST_SEL_Z_mask = 0x7 << 15, - EG_VTX_WORD1__DST_SEL_W_shift = 18,//3 bits - EG_VTX_WORD1__DST_SEL_W_mask = 0x7 << 18, - EG_VTX_WORD1__UCF_shift = 21,//1 bit - EG_VTX_WORD1__UCF_bit = 1 << 21, - EG_VTX_WORD1__DATA_FORMAT_shift = 22,//6 bits - EG_VTX_WORD1__DATA_FORMAT_mask = 0x3F << 22, - EG_VTX_WORD1__NFA_shift = 28,//2 bits - EG_VTX_WORD1__NFA_mask = 0x3 << 28, - EG_VTX_WORD1__FCA_shift = 30,//1 bit - EG_VTX_WORD1__FCA_bit = 1 << 30, - EG_VTX_WORD1__SMA_shift = 31,//1 bit - EG_VTX_WORD1__SMA_bit = 1 << 31, - - EG_VTX_WORD2__OFFSET_shift = 0, //16 bits - EG_VTX_WORD2__OFFSET_mask = 0xFFFF, - EG_VTX_WORD2__ENDIAN_SWAP_shift = 16,//2 bits - EG_VTX_WORD2__ENDIAN_SWAP_mask = 0x3 << 16, - EG_VTX_WORD2__CBNS_shift = 18,//1 bit - EG_VTX_WORD2__CBNS_bit = 1 << 18, - EG_VTX_WORD2__MEGA_FETCH_shift = 19,//1 bit - EG_VTX_WORD2__MEGA_FETCH_mask = 1 << 19, - EG_VTX_WORD2__ALT_CONST_shift = 20,//1 bit - EG_VTX_WORD2__ALT_CONST_mask = 1 << 20, - EG_VTX_WORD2__BIM_shift = 21,//2 bits - EG_VTX_WORD2__BIM_mask = 0x3 << 21, - EG_VTX_WORD2__Reserved_shift = 23,//9 bits - EG_VTX_WORD2__Reserved_mask = 0x1FF << 23, - -//CF_ALU - EG_CF_ALU_WORD0__ADDR_shift = 0, //22 bits - EG_CF_ALU_WORD0__ADDR_mask = 0x3FFFFF, - EG_CF_ALU_WORD0__KCACHE_BANK0_shift = 22,//4 bits - EG_CF_ALU_WORD0__KCACHE_BANK0_mask = 0xF << 22, - EG_CF_ALU_WORD0__KCACHE_BANK1_shift = 26,//4 bits - EG_CF_ALU_WORD0__KCACHE_BANK1_mask = 0xF << 26, - EG_CF_ALU_WORD0__KCACHE_MODE0_shift = 30,//2 bits - EG_CF_ALU_WORD0__KCACHE_MODE0_mask = 0x3 << 30, - - EG_CF_ALU_WORD1__KCACHE_MODE1_shift = 0, //2 bits - EG_CF_ALU_WORD1__KCACHE_MODE1_mask = 0x3, - EG_CF_ALU_WORD1__KCACHE_ADDR0_shift = 2, //8 bits - EG_CF_ALU_WORD1__KCACHE_ADDR0_mask = 0xFF << 2, - EG_CF_ALU_WORD1__KCACHE_ADDR1_shift = 10, //8 bits - EG_CF_ALU_WORD1__KCACHE_ADDR1_mask = 0xFF << 10, - EG_CF_ALU_WORD1__COUNT_shift = 18, //7 bits - EG_CF_ALU_WORD1__COUNT_mask = 0x7F << 18, - EG_CF_ALU_WORD1__ALT_CONST_shift = 25, //1 bit - EG_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, - EG_CF_ALU_WORD1__CF_INST_shift = 26, //4 bits - EG_CF_ALU_WORD1__CF_INST_mask = 0xF << 26, - EG_CF_ALU_WORD1__WQM_shift = 30, //1 bit - EG_CF_ALU_WORD1__WQM_bit = 1 << 30, - EG_CF_ALU_WORD1__BARRIER_shift = 31, //1 bit - EG_CF_ALU_WORD1__BARRIER_bit = 1 << 31, - - EG_CF_INST_ALU = 8, - EG_CF_INST_ALU_PUSH_BEFORE = 9, - EG_CF_INST_ALU_POP_AFTER = 10, - EG_CF_INST_ALU_POP2_AFTER = 11, - EG_CF_INST_ALU_EXTENDED = 12, - EG_CF_INST_ALU_CONTINUE = 13, - EG_CF_INST_ALU_BREAK = 14, - EG_CF_INST_ALU_ELSE_AFTER = 15, - - EG_CF_ALU_WORD0_EXT__Reserved0_shift = 0, //4 bits - EG_CF_ALU_WORD0_EXT__Reserved0_mask = 0xF, - EG_CF_ALU_WORD0_EXT__KBIM0_shift = 4, //2 bits - EG_CF_ALU_WORD0_EXT__KBIM0_mask = 0x3 << 4, - EG_CF_ALU_WORD0_EXT__KBIM1_shift = 6, //2 bits - EG_CF_ALU_WORD0_EXT__KBIM1_mask = 0x3 << 6, - EG_CF_ALU_WORD0_EXT__KBIM2_shift = 8, //2 bits - EG_CF_ALU_WORD0_EXT__KBIM2_mask = 0x3 << 8, - EG_CF_ALU_WORD0_EXT__KBIM3_shift = 10,//2 bits - EG_CF_ALU_WORD0_EXT__KBIM3_mask = 0x3 << 10, - EG_CF_ALU_WORD0_EXT__Reserved12_shift = 12,//10 bits - EG_CF_ALU_WORD0_EXT__Reserved12_mask = 0x3FF << 12, - EG_CF_ALU_WORD0_EXT__KCACHE_BANK2_shift = 22,//4 bits - EG_CF_ALU_WORD0_EXT__KCACHE_BANK2_mask = 0xF << 22, - EG_CF_ALU_WORD0_EXT__KCACHE_BANK3_shift = 26,//4 bits - EG_CF_ALU_WORD0_EXT__KCACHE_BANK3_mask = 0xF << 26, - EG_CF_ALU_WORD0_EXT__KCACHE_MODE2_shift = 30,//2 btis - EG_CF_ALU_WORD0_EXT__KCACHE_MODE2_mask = 0x3 << 30, - - EG_CF_ALU_WORD1_EXT__KCACHE_MODE3_shift = 0, //2 bits - EG_CF_ALU_WORD1_EXT__KCACHE_MODE3_mask = 0x3, - EG_CF_ALU_WORD1_EXT__KCACHE_ADDR2_shift = 2, //8 bits - EG_CF_ALU_WORD1_EXT__KCACHE_ADDR2_mask = 0xFF << 2, - EG_CF_ALU_WORD1_EXT__KCACHE_ADDR3_shift = 10, //8 bits - EG_CF_ALU_WORD1_EXT__KCACHE_ADDR3_mask = 0xFF << 10, - EG_CF_ALU_WORD1_EXT__Reserved18_shift = 18, //8 bits - EG_CF_ALU_WORD1_EXT__Reserved18_mask = 0xFF << 18, - EG_CF_ALU_WORD1_EXT__CF_INST_shift = 26, //4 bits - EG_CF_ALU_WORD1_EXT__CF_INST_mask = 0xF << 26, - EG_CF_ALU_WORD1_EXT__Reserved30_shift = 30, //1 bit - EG_CF_ALU_WORD1_EXT__Reserved30_bit = 1 << 30, - EG_CF_ALU_WORD1_EXT__BARRIER_shift = 31, //1 bit - EG_CF_ALU_WORD1_EXT__BARRIER_bit = 1 << 31, - -//ALU - EG_ALU_WORD0__SRC0_SEL_shift = 0, //9 bits - EG_ALU_WORD0__SRC0_SEL_mask = 0x1FF, - EG_ALU_WORD0__SRC1_SEL_shift = 13,//9 bits - EG_ALU_WORD0__SRC1_SEL_mask = 0x1FF << 13, - EG_ALU_WORD0__SRC0_REL_shift = 9, //1 bit - EG_ALU_WORD0__SRC0_REL_bit = 1 << 9, - EG_ALU_WORD0__SRC1_REL_shift = 22,//1 bit - EG_ALU_WORD0__SRC1_REL_bit = 1 << 22, - EG_ALU_WORD0__SRC0_CHAN_shift = 10,//2 bits - EG_ALU_WORD0__SRC0_CHAN_mask = 0x3 << 10, - EG_ALU_WORD0__SRC1_CHAN_shift = 23,//2 bits - EG_ALU_WORD0__SRC1_CHAN_mask = 0x3 << 23, - EG_ALU_WORD0__SRC0_NEG_shift = 12,//1 bit - EG_ALU_WORD0__SRC0_NEG_bit = 1 << 12, - EG_ALU_WORD0__SRC1_NEG_shift = 25,//1 bit - EG_ALU_WORD0__SRC1_NEG_bit = 1 << 25, - EG_ALU_WORD0__INDEX_MODE_shift = 26,//3 bits - EG_ALU_WORD0__INDEX_MODE_mask = 0x7 << 26, - EG_ALU_WORD0__PRED_SEL_shift = 29,//2 bits - EG_ALU_WORD0__PRED_SEL_mask = 0x3 << 29, - EG_ALU_WORD0__LAST_shift = 31,//1 bit - EG_ALU_WORD0__LAST_bit = 1 << 31, - - EG_ALU_WORD1_OP2__SRC0_ABS_shift = 0, //1 bit - EG_ALU_WORD1_OP2__SRC0_ABS_bit = 1, - EG_ALU_WORD1_OP2__SRC1_ABS_shift = 1, //1 bit - EG_ALU_WORD1_OP2__SRC1_ABS_bit = 1 << 1, - EG_ALU_WORD1_OP2__UEM_shift = 2, //1 bit - EG_ALU_WORD1_OP2__UEM_bit = 1 << 2, - EG_ALU_WORD1_OP2__UPDATE_PRED_shift = 3, //1 bit - EG_ALU_WORD1_OP2__UPDATE_PRED_bit = 1 << 3, - EG_ALU_WORD1_OP2__WRITE_MASK_shift = 4, //1 bit - EG_ALU_WORD1_OP2__WRITE_MASK_bit = 1 << 4, - EG_ALU_WORD1_OP2__OMOD_shift = 5, //2 bits - EG_ALU_WORD1_OP2__OMOD_mask = 0x3 << 5, - EG_ALU_WORD1_OP2__ALU_INST_shift = 7, //11 bits - EG_ALU_WORD1_OP2__ALU_INST_mask = 0x7FF << 7, - - EG_ALU_WORD1__BANK_SWIZZLE_shift = 18,//3 bits - EG_ALU_WORD1__BANK_SWIZZLE_mask = 0x7 << 18, - EG_ALU_WORD1__DST_GPR_shift = 21,//7 bits - EG_ALU_WORD1__DST_GPR_mask = 0x7F << 21, - EG_ALU_WORD1__DST_REL_shift = 28,//1 bit - EG_ALU_WORD1__DST_REL_mask = 1 << 28, - EG_ALU_WORD1__DST_CHAN_shift = 29,//2 bits - EG_ALU_WORD1__DST_CHAN_mask = 0x3 << 29, - EG_ALU_WORD1__CLAMP_shift = 31,//1 bits - EG_ALU_WORD1__CLAMP_mask = 1 << 31, - - EG_ALU_WORD1_OP3__SRC2_SEL_shift = 0, //9 bits - EG_ALU_WORD1_OP3__SRC2_SEL_mask = 0x1FF, - EG_ALU_WORD1_OP3__SRC2_REL_shift = 9, //1 bit - EG_ALU_WORD1_OP3__SRC2_REL_bit = 1 << 9, - EG_ALU_WORD1_OP3__SRC2_CHAN_shift = 10,//2 bits - EG_ALU_WORD1_OP3__SRC2_CHAN_mask = 0x3 << 10, - EG_ALU_WORD1_OP3__SRC2_NEG_shift = 12,//1 bit - EG_ALU_WORD1_OP3__SRC2_NEG_bit = 1 << 12, - EG_ALU_WORD1_OP3__ALU_INST_shift = 13,//5 bits - EG_ALU_WORD1_OP3__ALU_INST_mask = 0x1F << 13, - - EG_OP3_INST_BFE_UINT = 4, - EG_OP3_INST_BFE_INT = 5, - EG_OP3_INST_BFI_INT = 6, - EG_OP3_INST_FMA = 7, - EG_OP3_INST_CNDNE_64 = 9, - EG_OP3_INST_FMA_64 = 10, - EG_OP3_INST_LERP_UINT = 11, - EG_OP3_INST_BIT_ALIGN_INT = 12, - EG_OP3_INST_BYTE_ALIGN_INT = 13, - EG_OP3_INST_SAD_ACCUM_UINT = 14, - EG_OP3_INST_SAD_ACCUM_HI_UINT = 15, - EG_OP3_INST_MULADD_UINT24 = 16, - EG_OP3_INST_LDS_IDX_OP = 17, - EG_OP3_INST_MULADD = 20, - EG_OP3_INST_MULADD_M2 = 21, - EG_OP3_INST_MULADD_M4 = 22, - EG_OP3_INST_MULADD_D2 = 23, - EG_OP3_INST_MULADD_IEEE = 24, - EG_OP3_INST_CNDE = 25, - EG_OP3_INST_CNDGT = 26, - EG_OP3_INST_CNDGE = 27, - EG_OP3_INST_CNDE_INT = 28, - EG_OP3_INST_CMNDGT_INT = 29, - EG_OP3_INST_CMNDGE_INT = 30, - EG_OP3_INST_MUL_LIT = 31, - - EG_OP2_INST_ADD = 0, - EG_OP2_INST_MUL = 1, - EG_OP2_INST_MUL_IEEE = 2, - EG_OP2_INST_MAX = 3, - EG_OP2_INST_MIN = 4, - EG_OP2_INST_MAX_DX10 = 5, - EG_OP2_INST_MIN_DX10 = 6, - EG_OP2_INST_SETE = 8, - EG_OP2_INST_SETGT = 9, - EG_OP2_INST_SETGE = 10, - EG_OP2_INST_SETNE = 11, - EG_OP2_INST_SETE_DX10 = 12, - EG_OP2_INST_SETGT_DX10 = 13, - EG_OP2_INST_SETGE_DX10 = 14, - EG_OP2_INST_SETNE_DX10 = 15, - EG_OP2_INST_FRACT = 16, - EG_OP2_INST_TRUNC = 17, - EG_OP2_INST_CEIL = 18, - EG_OP2_INST_RNDNE = 19, - EG_OP2_INST_FLOOR = 20, - EG_OP2_INST_ASHR_INT = 21, - EG_OP2_INST_LSHR_INT = 22, - EG_OP2_INST_LSHL_INT = 23, - EG_OP2_INST_MOV = 25, - EG_OP2_INST_NOP = 26, - EG_OP2_INST_MUL_64 = 27, - EG_OP2_INST_FLT64_TO_FLT32 = 28, - EG_OP2_INST_FLT32_TO_FLT64 = 29, - EG_OP2_INST_PRED_SETGT_UINT = 30, - EG_OP2_INST_PRED_SETGE_UINT = 31, - EG_OP2_INST_PRED_SETE = 32, - EG_OP2_INST_PRED_SETGT = 33, - EG_OP2_INST_PRED_SETGE = 34, - EG_OP2_INST_PRED_SETNE = 35, - EG_OP2_INST_PRED_SET_INV = 36, - EG_OP2_INST_PRED_SET_POP = 37, - EG_OP2_INST_PRED_SET_CLR = 38, - EG_OP2_INST_PRED_SET_RESTORE = 39, - EG_OP2_INST_PRED_SETE_PUSH = 40, - EG_OP2_INST_PRED_SETGT_PUSH = 41, - EG_OP2_INST_PRED_SETGE_PUSH = 42, - EG_OP2_INST_PRED_SETNE_PUSH = 43, - EG_OP2_INST_KILLE = 44, - EG_OP2_INST_KILLGT = 45, - EG_OP2_INST_KILLGE = 46, - EG_OP2_INST_KILLNE = 47, - EG_OP2_INST_AND_INT = 48, - EG_OP2_INST_OR_INT = 49, - EG_OP2_INST_XOR_INT = 50, - EG_OP2_INST_NOT_INT = 51, - EG_OP2_INST_ADD_INT = 52, - EG_OP2_INST_SUB_INT = 53, - EG_OP2_INST_MAX_INT = 54, - EG_OP2_INST_MIN_INT = 55, - EG_OP2_INST_MAX_UINT = 56, - EG_OP2_INST_MIN_UINT = 57, - EG_OP2_INST_SETE_INT = 58, - EG_OP2_INST_SETGT_INT = 59, - EG_OP2_INST_SETGE_INT = 60, - EG_OP2_INST_SETNE_INT = 61, - EG_OP2_INST_SETGT_UINT = 62, - EG_OP2_INST_SETGE_UINT = 63, - EG_OP2_INST_KILLGT_UINT = 64, - EG_OP2_INST_KILLGE_UINT = 65, - EG_OP2_INST_PREDE_INT = 66, - EG_OP2_INST_PRED_SETGT_INT = 67, - EG_OP2_INST_PRED_SETGE_INT = 68, - EG_OP2_INST_PRED_SETNE_INT = 69, - EG_OP2_INST_KILLE_INT = 70, - EG_OP2_INST_KILLGT_INT = 71, - EG_OP2_INST_KILLGE_INT = 72, - EG_OP2_INST_KILLNE_INT = 73, - EG_OP2_INST_PRED_SETE_PUSH_INT = 74, - EG_OP2_INST_PRED_SETGT_PUSH_INT = 75, - EG_OP2_INST_PRED_SETGE_PUSH_INT = 76, - EG_OP2_INST_PRED_SETNE_PUSH_INT = 77, - EG_OP2_INST_PRED_SETLT_PUSH_INT = 78, - EG_OP2_INST_PRED_SETLE_PUSH_INT = 79, - EG_OP2_INST_FLT_TO_INT = 80, - EG_OP2_INST_BFREV_INT = 81, - EG_OP2_INST_ADDC_UINT = 82, - EG_OP2_INST_SUBB_UINT = 83, - EG_OP2_INST_GROUP_BARRIER = 84, - EG_OP2_INST_GROUP_SEQ_BEGIN = 85, - EG_OP2_INST_GROUP_SEQ_END = 86, - EG_OP2_INST_SET_MODE = 87, - EG_OP2_INST_SET_CF_IDX0 = 88, - EG_OP2_INST_SET_CF_IDX1 = 89, - EG_OP2_INST_SET_LDS_SIZE = 90, - EG_OP2_INST_EXP_IEEE = 129, - EG_OP2_INST_LOG_CLAMPED = 130, - EG_OP2_INST_LOG_IEEE = 131, - EG_OP2_INST_RECIP_CLAMPED = 132, - EG_OP2_INST_RECIP_FF = 133, - EG_OP2_INST_RECIP_IEEE = 134, - EG_OP2_INST_RECIPSQRT_CLAMPED = 135, - EG_OP2_INST_RECIPSQRT_FF = 136, - EG_OP2_INST_RECIPSQRT_IEEE = 137, - EG_OP2_INST_SQRT_IEEE = 138, - EG_OP2_INST_SIN = 141, - EG_OP2_INST_COS = 142, - EG_OP2_INST_MULLO_INT = 143, - EG_OP2_INST_MULHI_INT = 144, - EG_OP2_INST_MULLO_UINT = 145, - EG_OP2_INST_MULHI_UINT = 146, - EG_OP2_INST_RECIP_INT = 147, - EG_OP2_INST_RECIP_UINT = 148, - EG_OP2_INST_RECIP_64 = 149, - EG_OP2_INST_RECIP_CLAMPED_64 = 150, - EG_OP2_INST_RECIPSQRT_64 = 151, - EG_OP2_INST_RECIPSQRT_CLAMPED_64 = 152, - EG_OP2_INST_SQRT_64 = 153, - EG_OP2_INST_FLT_TO_UINT = 154, - EG_OP2_INST_INT_TO_FLT = 155, - EG_OP2_INST_UINT_TO_FLT = 156, - EG_OP2_INST_BFM_INT = 160, - EG_OP2_INST_FLT32_TO_FLT16 = 162, - EG_OP2_INST_FLT16_TO_FLT32 = 163, - EG_OP2_INST_UBYTE0_FLT = 164, - EG_OP2_INST_UBYTE1_FLT = 165, - EG_OP2_INST_UBYTE2_FLT = 166, - EG_OP2_INST_UBYTE3_FLT = 167, - EG_OP2_INST_BCNT_INT = 170, - EG_OP2_INST_FFBH_UINT = 171, - EG_OP2_INST_FFBL_INT = 172, - EG_OP2_INST_FFBH_INT = 173, - EG_OP2_INST_FLT_TO_UINT4 = 174, - EG_OP2_INST_DOT_IEEE = 175, - EG_OP2_INST_FLT_TO_INT_RPI = 176, - EG_OP2_INST_FLT_TO_INT_FLOOR = 177, - EG_OP2_INST_MULHI_UINT24 = 178, - EG_OP2_INST_MBCNT_32HI_INT = 179, - EG_OP2_INST_OFFSET_TO_FLT = 180, - EG_OP2_INST_MUL_UINT24 = 181, - EG_OP2_INST_BCNT_ACCUM_PREV_INT = 182, - EG_OP2_INST_MBCNT_32LO_ACCUM_PREV_INT = 183, - EG_OP2_INST_SETE_64 = 184, - EG_OP2_INST_SETNE_64 = 185, - EG_OP2_INST_SETGT_64 = 186, - EG_OP2_INST_SETGE_64 = 187, - EG_OP2_INST_MIN_64 = 188, - EG_OP2_INST_MAX_64 = 189, - EG_OP2_INST_DOT4 = 190, - EG_OP2_INST_DOT4_IEEE = 191, - EG_OP2_INST_CUBE = 192, - EG_OP2_INST_MAX4 = 193, - EG_OP2_INST_FREXP_64 = 196, - EG_OP2_INST_LDEXP_64 = 197, - EG_OP2_INST_FRACT_64 = 198, - EG_OP2_INST_PRED_SETGT_64 = 199, - EG_OP2_INST_PRED_SETE_64 = 200, - EG_OP2_INST_PRED_SETGE_64 = 201, - EG_OP2_INST_MUL_64_2 = 202, //same as prev? - EG_OP2_INST_ADD_64 = 203, - EG_OP2_INST_MOVA_INT = 204, - EG_OP2_INST_FLT64_TO_FLT32_2 = 205, //same as prev? - EG_OP2_INST_FLT32_TO_FLT64_2 = 206, //same as prev? - EG_OP2_INST_SAD_ACCUM_PREV_UINT = 207, - EG_OP2_INST_DOT = 208, - EG_OP2_INST_MUL_PREV = 209, - EG_OP2_INST_MUL_IEEE_PREV = 210, - EG_OP2_INST_ADD_PREV = 211, - EG_OP2_INST_MULADD_PREV = 212, - EG_OP2_INST_MULADD_IEEE_PREV = 213, - EG_OP2_INST_INTERP_XY = 214, - EG_OP2_INST_INTERP_ZW = 215, - EG_OP2_INST_INTERP_X = 216, - EG_OP2_INST_INTERP_Z = 217, - EG_OP2_INST_STORE_FLAGS = 218, - EG_OP2_INST_LOAD_STORE_FLAGS = 219, - EG_OP2_INST_LDS_1A = 220, - EG_OP2_INST_LDS_1A1D = 221, - EG_OP2_INST_LDS_2A = 223, - EG_OP2_INST_INTERP_LOAD_P0 = 224, - EG_OP2_INST_INTERP_LOAD_P10 = 225, - EG_OP2_INST_INTERP_LOAD_P20 = 226, - - EG_SRC_SEL__GPR_start = 0, - EG_SRC_SEL__GPR_end = 127, - EG_SRC_SEL__KCONST_BANK0_start = 128, - EG_SRC_SEL__KCONST_BANK0_end = 159, - EG_SRC_SEL__KCONST_BANK1_start = 160, - EG_SRC_SEL__KCONST_BANK1_end = 191, - EG_SRC_SEL__INLINE_satrt = 192, - EG_SRC_SEL__INLINE_end = 255, - EG_SRC_SEL__KCONST_BANK2_start = 256, - EG_SRC_SEL__KCONST_BANK2_end = 287, - EG_SRC_SEL__KCONST_BANK3_start = 288, - EG_SRC_SEL__KCONST_BANK3_end = 319, - EG_SRC_SEL__ALU_SRC_LDS_OQ_A = 219, - EG_SRC_SEL__ALU_SRC_LDS_OQ_B = 220, - EG_SRC_SEL__ALU_SRC_LDS_OQ_A_POP = 221, - EG_SRC_SEL__ALU_SRC_LDS_OQ_B_POP = 222, - EG_SRC_SEL__ALU_SRC_LDS_DIRECT_A = 223, - EG_SRC_SEL__ALU_SRC_LDS_DIRECT_B = 224, - EG_SRC_SEL__ALU_SRC_TIME_HI = 227, - EG_SRC_SEL__ALU_SRC_TIME_LO = 228, - EG_SRC_SEL__ALU_SRC_MASK_HI = 229, - EG_SRC_SEL__ALU_SRC_MASK_LO = 230, - EG_SRC_SEL__ALU_SRC_HW_WAVE_ID = 231, - EG_SRC_SEL__ALU_SRC_SIMD_ID = 232, - EG_SRC_SEL__ALU_SRC_SE_ID = 233, - EG_SRC_SEL__ALU_SRC_HW_THREADGRP_ID = 234, - EG_SRC_SEL__ALU_SRC_WAVE_ID_IN_GRP = 235, - EG_SRC_SEL__ALU_SRC_NUM_THREADGRP_WAVES = 236, - EG_SRC_SEL__ALU_SRC_HW_ALU_ODD = 237, - EG_SRC_SEL__ALU_SRC_LOOP_IDX = 238, - EG_SRC_SEL__ALU_SRC_PARAM_BASE_ADDR = 240, - EG_SRC_SEL__ALU_SRC_NEW_PRIM_MASK = 241, - EG_SRC_SEL__ALU_SRC_PRIM_MASK_HI = 242, - EG_SRC_SEL__ALU_SRC_PRIM_MASK_LO = 243, - EG_SRC_SEL__ALU_SRC_1_DBL_L = 244, - EG_SRC_SEL__ALU_SRC_1_DBL_M = 245, - EG_SRC_SEL__ALU_SRC_0_5_DBL_L = 246, - EG_SRC_SEL__ALU_SRC_0_5_DBL_M = 247, - EG_SRC_SEL__ALU_SRC_0 = 248, - EG_SRC_SEL__ALU_SRC_1 = 249, - EG_SRC_SEL__ALU_SRC_1_INT = 250, - EG_SRC_SEL__ALU_SRC_M_1_INT = 251, - EG_SRC_SEL__ALU_SRC_0_5 = 252, - EG_SRC_SEL__ALU_SRC_LITERAL = 253, - EG_SRC_SEL__ALU_SRC_PV = 254, - EG_SRC_SEL__ALU_SRC_PS = 255, - -//ALLOC_EXPORT - EG_CF_ALLOC_EXPORT_WORD0__ARRAY_BASE_shift = 0, //13 bits - EG_CF_ALLOC_EXPORT_WORD0__ARRAY_BASE_mask = 0x1FFF, - EG_CF_ALLOC_EXPORT_WORD0__TYPE_shift = 13,//2 bits - EG_CF_ALLOC_EXPORT_WORD0__TYPE_mask = 0x3 << 13, - EG_CF_ALLOC_EXPORT_WORD0__RW_GPR_shift = 15,//7 bits - EG_CF_ALLOC_EXPORT_WORD0__RW_GPR_mask = 0x7F << 15, - EG_CF_ALLOC_EXPORT_WORD0__RW_REL_shift = 22,//1 bit - EG_CF_ALLOC_EXPORT_WORD0__RW_REL_bit = 1 << 22, - EG_CF_ALLOC_EXPORT_WORD0__INDEX_GPR_shift = 23,//7 bits - EG_CF_ALLOC_EXPORT_WORD0__INDEX_GPR_mask = 0x7F << 23, - EG_CF_ALLOC_EXPORT_WORD0__ELEM_SIZE_shift = 30,//2 bits - EG_CF_ALLOC_EXPORT_WORD0__ELEM_SIZE_mask = 0x3 << 30, - - EG_CF_ALLOC_EXPORT_WORD1_BUF__ARRAY_SIZE_shift = 0, //12 bits - EG_CF_ALLOC_EXPORT_WORD1_BUF__ARRAY_SIZE_mask = 0xFFF, - EG_CF_ALLOC_EXPORT_WORD1_BUF__COMP_MASK_shift = 12, //4 bits - EG_CF_ALLOC_EXPORT_WORD1_BUF__COMP_MASK_mask = 0xF << 12, - - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_X_shift = 0, //3 bits - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_X_mask = 0x7, - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Y_shift = 3, //3 bits - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Y_mask = 0x7 << 3, - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Z_shift = 6, //3 bits - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_Z_mask = 0x7 << 6, - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_W_shift = 9, //3 bits - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__SEL_W_mask = 0x7 << 9, - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__Resreve_shift = 12,//4 bits - EG_CF_ALLOC_EXPORT_WORD1_SWIZ__Resreve_mask = 0xF << 12, - - EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_shift = 16, //4 bits - EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_mask = 0xF << 16, - EG_CF_ALLOC_EXPORT_WORD1__VPM_shift = 20, //1 bit - EG_CF_ALLOC_EXPORT_WORD1__VPM_bit = 1 << 20, - EG_CF_ALLOC_EXPORT_WORD1__EOP_shift = 21, //1 bit - EG_CF_ALLOC_EXPORT_WORD1__EOP_bit = 1 << 21, - EG_CF_ALLOC_EXPORT_WORD1__CF_INST_shift = 22, //8 bits - EG_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0xFF << 22, - EG_CF_ALLOC_EXPORT_WORD1__MARK_shift = 30, //1 bit - EG_CF_ALLOC_EXPORT_WORD1__MARK_bit = 1 << 30, - EG_CF_ALLOC_EXPORT_WORD1__BARRIER_shift = 31, //1 bit - EG_CF_ALLOC_EXPORT_WORD1__BARRIER_bit = 1 << 31, - - EG_CF_INST_MEM_STREAM0_BUF0 = 64 , - EG_CF_INST_MEM_STREAM0_BUF1 = 65, - EG_CF_INST_MEM_STREAM0_BUF2 = 66, - EG_CF_INST_MEM_STREAM0_BUF3 = 67, - EG_CF_INST_MEM_STREAM1_BUF0 = 68, - EG_CF_INST_MEM_STREAM1_BUF1 = 69, - EG_CF_INST_MEM_STREAM1_BUF2 = 70, - EG_CF_INST_MEM_STREAM1_BUF3 = 71, - EG_CF_INST_MEM_STREAM2_BUF0 = 72, - EG_CF_INST_MEM_STREAM2_BUF1 = 73, - EG_CF_INST_MEM_STREAM2_BUF2 = 74, - EG_CF_INST_MEM_STREAM2_BUF3 = 75, - EG_CF_INST_MEM_STREAM3_BUF0 = 76, - EG_CF_INST_MEM_STREAM3_BUF1 = 77, - EG_CF_INST_MEM_STREAM3_BUF2 = 78, - EG_CF_INST_MEM_STREAM3_BUF3 = 79, - EG_CF_INST_MEM_WR_SCRATCH = 80, - EG_CF_INST_MEM_RING = 82, - EG_CF_INST_EXPORT = 83, - EG_CF_INST_EXPORT_DONE = 84, - EG_CF_INST_MEM_EXPORT = 85, - EG_CF_INST_MEM_RAT = 86, - EG_CF_INST_MEM_RAT_CACHELESS = 87, - EG_CF_INST_MEM_RING1 = 88, - EG_CF_INST_MEM_RING2 = 89, - EG_CF_INST_MEM_RING3 = 90, - EG_CF_INST_MEM_EXPORT_COMBINED = 91, - EG_CF_INST_MEM_RAT_COMBINED_CACHELESS = 92, - - EG_EXPORT_PIXEL = 0, - EG_EXPORT_WRITE = 0, - EG_EXPORT_POS = 1, - EG_EXPORT_WRITE_IND = 1, - EG_EXPORT_PARAM = 2, - EG_EXPORT_WRITE_ACK = 2, - EG_EXPORT_WRITE_IND_ACK = 3, - - /* PS interp param source */ - EG_ALU_SRC_PARAM_BASE = 0x000001c0, - EG_ALU_SRC_PARAM_SIZE = 0x00000021, -}; - -#endif //_EVERGREEN_SQ_H_ - - diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c deleted file mode 100644 index a908af4e12f..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ /dev/null @@ -1,1937 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/imports.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/dd.h" -#include "main/simple_list.h" -#include "main/state.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "main/api_arrayelt.h" -#include "main/framebuffer.h" -#include "drivers/common/meta.h" -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" - -#include "vbo/vbo.h" - -#include "r600_context.h" - -#include "evergreen_state.h" -#include "evergreen_diff.h" -#include "evergreen_vertprog.h" -#include "evergreen_fragprog.h" -#include "evergreen_tex.h" - -void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); //same - -void evergreenUpdateShaders(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - /* should only happenen once, just after context is created */ - /* TODO: shouldn't we fallback to sw here? */ - if (!ctx->FragmentProgram._Current) { - fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; - } - - evergreenSelectFragmentShader(ctx); - - evergreenSelectVertexShader(ctx); - evergreenUpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - context->radeon.NewGLState = 0; -} - -void evergreeUpdateShaders(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - - /* should only happenen once, just after context is created */ - /* TODO: shouldn't we fallback to sw here? */ - if (!ctx->FragmentProgram._Current) { - fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; - } - - evergreenSelectFragmentShader(ctx); - - evergreenSelectVertexShader(ctx); - evergreenUpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - context->radeon.NewGLState = 0; -} - -/* - * To correctly position primitives: - */ -void evergreenUpdateViewportOffset(struct gl_context * ctx) //------------------ -{ - context_t *context = R700_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); - GLfloat xoffset = (GLfloat) dPriv->x; - GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - int id = 0; - - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat ty = (-v[MAT_TY]) + yoffset; - - if (evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All != tx || - evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All != ty) { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - EVERGREEN_STATECHANGE(context, pa); - evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; - evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; - } - - radeonUpdateScissor(ctx); -} - -void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state) //same -{ - struct evergreen_fragment_program *fp = - (struct evergreen_fragment_program *)ctx->FragmentProgram._Current; - struct gl_program_parameter_list *paramList; - - if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) - return; - - if (!ctx->FragmentProgram._Current || !fp) - return; - - paramList = ctx->FragmentProgram._Current->Base.Parameters; - - if (!paramList) - return; - - _mesa_load_state_parameters(ctx, paramList); - -} - -/** - * Called by Mesa after an internal state update. - */ -static void evergreenInvalidateState(struct gl_context * ctx, GLuint new_state) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - _swrast_InvalidateState(ctx, new_state); - _swsetup_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); - _tnl_InvalidateState(ctx, new_state); - _ae_invalidate_state(ctx, new_state); - - if (new_state & _NEW_BUFFERS) { - _mesa_update_framebuffer(ctx); - /* this updates the DrawBuffer's Width/Height if it's a FBO */ - _mesa_update_draw_buffer_bounds(ctx); - - EVERGREEN_STATECHANGE(context, cb); - EVERGREEN_STATECHANGE(context, db); - } - - if (new_state & (_NEW_LIGHT)) { - EVERGREEN_STATECHANGE(context, pa); - if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); - else - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); - } - - evergreenUpdateStateParameters(ctx, new_state); - - EVERGREEN_STATECHANGE(context, pa); - EVERGREEN_STATECHANGE(context, spi); - - if(GL_TRUE == evergreen->bEnablePerspective) - { - /* Do scale XY and Z by 1/W0 for perspective correction on pos. For orthogonal case, set both to one. */ - CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - - SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift, - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask); - } - else - { - /* For orthogonal case. */ - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - - SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask); - } - - context->radeon.NewGLState |= new_state; -} - -static void evergreenSetAlphaState(struct gl_context * ctx) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - uint32_t alpha_func = REF_ALWAYS; - GLboolean really_enabled = ctx->Color.AlphaEnabled; - - EVERGREEN_STATECHANGE(context, sx); - - switch (ctx->Color.AlphaFunc) { - case GL_NEVER: - alpha_func = REF_NEVER; - break; - case GL_LESS: - alpha_func = REF_LESS; - break; - case GL_EQUAL: - alpha_func = REF_EQUAL; - break; - case GL_LEQUAL: - alpha_func = REF_LEQUAL; - break; - case GL_GREATER: - alpha_func = REF_GREATER; - break; - case GL_NOTEQUAL: - alpha_func = REF_NOTEQUAL; - break; - case GL_GEQUAL: - alpha_func = REF_GEQUAL; - break; - case GL_ALWAYS: - /*alpha_func = REF_ALWAYS; */ - really_enabled = GL_FALSE; - break; - } - - if (really_enabled) { - SETfield(evergreen->SX_ALPHA_TEST_CONTROL.u32All, alpha_func, - ALPHA_FUNC_shift, ALPHA_FUNC_mask); - SETbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); - evergreen->SX_ALPHA_REF.f32All = ctx->Color.AlphaRef; - } else { - CLEARbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); - } -} - -static void evergreenAlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //same -{ - (void)func; - (void)ref; - evergreenSetAlphaState(ctx); -} - -static void evergreenBlendColor(struct gl_context * ctx, const GLfloat cf[4]) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, cb); - - evergreen->CB_BLEND_RED.f32All = cf[0]; - evergreen->CB_BLEND_GREEN.f32All = cf[1]; - evergreen->CB_BLEND_BLUE.f32All = cf[2]; - evergreen->CB_BLEND_ALPHA.f32All = cf[3]; -} - -static int evergreenblend_factor(GLenum factor, GLboolean is_src) //same -{ - switch (factor) { - case GL_ZERO: - return BLEND_ZERO; - break; - case GL_ONE: - return BLEND_ONE; - break; - case GL_DST_COLOR: - return BLEND_DST_COLOR; - break; - case GL_ONE_MINUS_DST_COLOR: - return BLEND_ONE_MINUS_DST_COLOR; - break; - case GL_SRC_COLOR: - return BLEND_SRC_COLOR; - break; - case GL_ONE_MINUS_SRC_COLOR: - return BLEND_ONE_MINUS_SRC_COLOR; - break; - case GL_SRC_ALPHA: - return BLEND_SRC_ALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: - return BLEND_ONE_MINUS_SRC_ALPHA; - break; - case GL_DST_ALPHA: - return BLEND_DST_ALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: - return BLEND_ONE_MINUS_DST_ALPHA; - break; - case GL_SRC_ALPHA_SATURATE: - return (is_src) ? BLEND_SRC_ALPHA_SATURATE : BLEND_ZERO; - break; - case GL_CONSTANT_COLOR: - return BLEND_CONSTANT_COLOR; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - return BLEND_ONE_MINUS_CONSTANT_COLOR; - break; - case GL_CONSTANT_ALPHA: - return BLEND_CONSTANT_ALPHA; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - return BLEND_ONE_MINUS_CONSTANT_ALPHA; - break; - default: - fprintf(stderr, "unknown blend factor %x\n", factor); - return (is_src) ? BLEND_ONE : BLEND_ZERO; - break; - } -} - -static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - uint32_t blend_reg = 0, eqn, eqnA; - - EVERGREEN_STATECHANGE(context, cb); - - if (ctx->Color.ColorLogicOpEnabled || !ctx->Color.BlendEnabled) { - SETfield(blend_reg, - BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ZERO, COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - SETfield(blend_reg, - COMB_DST_PLUS_SRC, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); - SETfield(blend_reg, - BLEND_ONE, ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ZERO, ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - SETfield(blend_reg, - COMB_DST_PLUS_SRC, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); - //if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_R600) - // evergreen->CB_BLEND_CONTROL.u32All = blend_reg; - //else - evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; - return; - } - - SETfield(blend_reg, - evergreenblend_factor(ctx->Color.Blend[0].SrcRGB, GL_TRUE), - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - evergreenblend_factor(ctx->Color.Blend[0].DstRGB, GL_FALSE), - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - - switch (ctx->Color.Blend[0].EquationRGB) { - case GL_FUNC_ADD: - eqn = COMB_DST_PLUS_SRC; - break; - case GL_FUNC_SUBTRACT: - eqn = COMB_SRC_MINUS_DST; - break; - case GL_FUNC_REVERSE_SUBTRACT: - eqn = COMB_DST_MINUS_SRC; - break; - case GL_MIN: - eqn = COMB_MIN_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - break; - case GL_MAX: - eqn = COMB_MAX_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - break; - - default: - fprintf(stderr, - "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); - return; - } - SETfield(blend_reg, - eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); - - SETfield(blend_reg, - evergreenblend_factor(ctx->Color.Blend[0].SrcA, GL_TRUE), - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - evergreenblend_factor(ctx->Color.Blend[0].DstA, GL_FALSE), - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - - switch (ctx->Color.Blend[0].EquationA) { - case GL_FUNC_ADD: - eqnA = COMB_DST_PLUS_SRC; - break; - case GL_FUNC_SUBTRACT: - eqnA = COMB_SRC_MINUS_DST; - break; - case GL_FUNC_REVERSE_SUBTRACT: - eqnA = COMB_DST_MINUS_SRC; - break; - case GL_MIN: - eqnA = COMB_MIN_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - break; - case GL_MAX: - eqnA = COMB_MAX_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - break; - default: - fprintf(stderr, - "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); - return; - } - - SETfield(blend_reg, - eqnA, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); - - SETbit(blend_reg, SEPARATE_ALPHA_BLEND_bit); - - SETbit(blend_reg, EG_CB_BLENDX_CONTROL_ENABLE_bit); - - evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; -} - -static void evergreenBlendEquationSeparate(struct gl_context * ctx, - GLenum modeRGB, GLenum modeA) //same -{ - evergreenSetBlendState(ctx); -} - -static void evergreenBlendFuncSeparate(struct gl_context * ctx, - GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA) //same -{ - evergreenSetBlendState(ctx); -} - -static GLuint evergreen_translate_logicop(GLenum logicop) //same -{ - switch (logicop) { - case GL_CLEAR: - return 0x00; - case GL_SET: - return 0xff; - case GL_COPY: - return 0xcc; - case GL_COPY_INVERTED: - return 0x33; - case GL_NOOP: - return 0xaa; - case GL_INVERT: - return 0x55; - case GL_AND: - return 0x88; - case GL_NAND: - return 0x77; - case GL_OR: - return 0xee; - case GL_NOR: - return 0x11; - case GL_XOR: - return 0x66; - case GL_EQUIV: - return 0x99; - case GL_AND_REVERSE: - return 0x44; - case GL_AND_INVERTED: - return 0x22; - case GL_OR_REVERSE: - return 0xdd; - case GL_OR_INVERTED: - return 0xbb; - default: - fprintf(stderr, "unknown blend logic operation %x\n", logicop); - return 0xcc; - } -} - -static void evergreenSetLogicOpState(struct gl_context *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, cb); - - if (ctx->Color.ColorLogicOpEnabled) - SETfield(evergreen->CB_COLOR_CONTROL.u32All, - evergreen_translate_logicop(ctx->Color.LogicOp), - EG_CB_COLOR_CONTROL__ROP3_shift, - EG_CB_COLOR_CONTROL__ROP3_mask); - else - SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, - EG_CB_COLOR_CONTROL__ROP3_shift, - EG_CB_COLOR_CONTROL__ROP3_mask); -} - -static void evergreenClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLint p; - GLint *ip; - - p = (GLint) plane - (GLint) GL_CLIP_PLANE0; - ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - - EVERGREEN_STATECHANGE(context, pa); - - evergreen->ucp[p].PA_CL_UCP_0_X.u32All = ip[0]; - evergreen->ucp[p].PA_CL_UCP_0_Y.u32All = ip[1]; - evergreen->ucp[p].PA_CL_UCP_0_Z.u32All = ip[2]; - evergreen->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; -} - -static void evergreenSetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLuint p; - - p = cap - GL_CLIP_PLANE0; - - EVERGREEN_STATECHANGE(context, pa); - - if (state) { - evergreen->PA_CL_CLIP_CNTL.u32All |= (UCP_ENA_0_bit << p); - evergreen->ucp[p].enabled = GL_TRUE; - evergreenClipPlane(ctx, cap, NULL); - } else { - evergreen->PA_CL_CLIP_CNTL.u32All &= ~(UCP_ENA_0_bit << p); - evergreen->ucp[p].enabled = GL_FALSE; - } -} - -static void evergreenSetDBRenderState(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct evergreen_fragment_program *fp = - (struct evergreen_fragment_program *)(ctx->FragmentProgram._Current); - - EVERGREEN_STATECHANGE(context, db); - - SETbit(evergreen->DB_SHADER_CONTROL.u32All, - DUAL_EXPORT_ENABLE_bit); - SETfield(evergreen->DB_SHADER_CONTROL.u32All, EARLY_Z_THEN_LATE_Z, - Z_ORDER_shift, - Z_ORDER_mask); - /* XXX need to enable htile for hiz/s */ - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, - FORCE_HIZ_ENABLE_shift, - FORCE_HIZ_ENABLE_mask); - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, - FORCE_HIS_ENABLE0_shift, - FORCE_HIS_ENABLE0_mask); - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, - FORCE_HIS_ENABLE1_shift, - FORCE_HIS_ENABLE1_mask); - - if (context->radeon.query.current) - { - SETbit(evergreen->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); - SETbit(evergreen->DB_COUNT_CONTROL.u32All, - EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit); - } - else - { - CLEARbit(evergreen->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); - CLEARbit(evergreen->DB_COUNT_CONTROL.u32All, - EG_DB_COUNT_CONTROL__PERFECT_ZPASS_COUNTS_bit); - } - - if (fp) - { - if (fp->r700Shader.killIsUsed) - { - SETbit(evergreen->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - else - { - CLEARbit(evergreen->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - - if (fp->r700Shader.depthIsExported) - { - SETbit(evergreen->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - else - { - CLEARbit(evergreen->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - } -} - -void evergreenUpdateShaderStates(struct gl_context * ctx) -{ - evergreenSetDBRenderState(ctx); - evergreenUpdateTextureState(ctx); -} - -static void evergreenSetDepthState(struct gl_context * ctx) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, db); - - if (ctx->Depth.Test) - { - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); - if (ctx->Depth.Mask) - { - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } - else - { - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } - - switch (ctx->Depth.Func) - { - case GL_NEVER: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_NEVER, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_LESS: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_LESS, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_EQUAL: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_EQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_LEQUAL: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_LEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_GREATER: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_GREATER, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_NOTEQUAL: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_NOTEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_GEQUAL: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_GEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_ALWAYS: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, - ZFUNC_shift, ZFUNC_mask); - break; - default: - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, - ZFUNC_shift, ZFUNC_mask); - break; - } - } - else - { - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } -} - -static void evergreenSetStencilState(struct gl_context * ctx, GLboolean state) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLboolean hw_stencil = GL_FALSE; - - if (ctx->DrawBuffer) { - struct radeon_renderbuffer *rrbStencil - = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (rrbStencil && rrbStencil->bo); - } - - if (hw_stencil) { - EVERGREEN_STATECHANGE(context, db); - if (state) { - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); - SETbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); - } else - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - } -} - -static void evergreenUpdateCulling(struct gl_context * ctx) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - - if (ctx->Polygon.CullFlag) - { - switch (ctx->Polygon.CullFaceMode) - { - case GL_FRONT: - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - case GL_BACK: - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - case GL_FRONT_AND_BACK: - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - default: - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - } - } - - switch (ctx->Polygon.FrontFace) - { - case GL_CW: - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - break; - case GL_CCW: - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - break; - default: - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */ - break; - } - - /* Winding is inverted when rendering to FBO */ - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) - evergreen->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; -} - -static void evergreenSetPolygonOffsetState(struct gl_context * ctx, GLboolean state) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - if (state) { - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); - SETbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); - } else { - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); - CLEARbit(evergreen->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); - } -} - -static void evergreenUpdateLineStipple(struct gl_context * ctx) //diff -{ - /* TODO */ -} - -void evergreenSetScissor(context_t *context) //diff -{ - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - unsigned x1, y1, x2, y2; - int id = 0; - struct radeon_renderbuffer *rrb; - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - if (context->radeon.state.scissor.enabled) { - x1 = context->radeon.state.scissor.rect.x1; - y1 = context->radeon.state.scissor.rect.y1; - x2 = context->radeon.state.scissor.rect.x2; - y2 = context->radeon.state.scissor.rect.y2; - /* r600 has exclusive BR scissors */ - if (context->radeon.radeonScreen->kernel_mm) { - x2++; - y2++; - } - } else { - if (context->radeon.radeonScreen->driScreen->dri2.enabled) { - x1 = 0; - y1 = 0; - x2 = rrb->base.Width; - y2 = rrb->base.Height; - } else { - x1 = rrb->dPriv->x; - y1 = rrb->dPriv->y; - x2 = rrb->dPriv->x + rrb->dPriv->w; - y2 = rrb->dPriv->y + rrb->dPriv->h; - } - } - - EVERGREEN_STATECHANGE(context, pa); - - /* screen */ - /* TODO : check WINDOW_OFFSET_DISABLE */ - //SETbit(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, x1, - PA_SC_SCREEN_SCISSOR_TL__TL_X_shift, EG_PA_SC_SCREEN_SCISSOR_TL__TL_X_mask); - SETfield(evergreen->PA_SC_SCREEN_SCISSOR_TL.u32All, y1, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_shift, EG_PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask); - - SETfield(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All, x2, - PA_SC_SCREEN_SCISSOR_BR__BR_X_shift, EG_PA_SC_SCREEN_SCISSOR_BR__BR_X_mask); - SETfield(evergreen->PA_SC_SCREEN_SCISSOR_BR.u32All, y2, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_shift, EG_PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask); - - /* window */ - SETbit(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, x1, - PA_SC_WINDOW_SCISSOR_TL__TL_X_shift, EG_PA_SC_WINDOW_SCISSOR_TL__TL_X_mask); - SETfield(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, y1, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_shift, EG_PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask); - - SETfield(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All, x2, - PA_SC_WINDOW_SCISSOR_BR__BR_X_shift, EG_PA_SC_WINDOW_SCISSOR_BR__BR_X_mask); - SETfield(evergreen->PA_SC_WINDOW_SCISSOR_BR.u32All, y2, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_shift, EG_PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask); - - - SETfield(evergreen->PA_SC_CLIPRECT_0_TL.u32All, x1, - PA_SC_CLIPRECT_0_TL__TL_X_shift, EG_PA_SC_CLIPRECT_0_TL__TL_X_mask); - SETfield(evergreen->PA_SC_CLIPRECT_0_TL.u32All, y1, - PA_SC_CLIPRECT_0_TL__TL_Y_shift, EG_PA_SC_CLIPRECT_0_TL__TL_Y_mask); - SETfield(evergreen->PA_SC_CLIPRECT_0_BR.u32All, x2, - PA_SC_CLIPRECT_0_BR__BR_X_shift, EG_PA_SC_CLIPRECT_0_BR__BR_X_mask); - SETfield(evergreen->PA_SC_CLIPRECT_0_BR.u32All, y2, - PA_SC_CLIPRECT_0_BR__BR_Y_shift, EG_PA_SC_CLIPRECT_0_BR__BR_Y_mask); - - evergreen->PA_SC_CLIPRECT_1_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; - evergreen->PA_SC_CLIPRECT_1_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; - evergreen->PA_SC_CLIPRECT_2_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; - evergreen->PA_SC_CLIPRECT_2_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; - evergreen->PA_SC_CLIPRECT_3_TL.u32All = evergreen->PA_SC_CLIPRECT_0_TL.u32All; - evergreen->PA_SC_CLIPRECT_3_BR.u32All = evergreen->PA_SC_CLIPRECT_0_BR.u32All; - - /* more....2d clip */ - SETbit(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, x1, - PA_SC_GENERIC_SCISSOR_TL__TL_X_shift, EG_PA_SC_GENERIC_SCISSOR_TL__TL_X_mask); - SETfield(evergreen->PA_SC_GENERIC_SCISSOR_TL.u32All, y1, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_shift, EG_PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask); - SETfield(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All, x2, - PA_SC_GENERIC_SCISSOR_BR__BR_X_shift, EG_PA_SC_GENERIC_SCISSOR_BR__BR_X_mask); - SETfield(evergreen->PA_SC_GENERIC_SCISSOR_BR.u32All, y2, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_shift, EG_PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask); - - SETbit(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, x1, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, y1, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, x2, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); - - id = 1; - SETbit(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, x1, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, y1, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, x2, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask); - SETfield(evergreen->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, EG_PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); - - evergreen->viewport[id].enabled = GL_TRUE; -} - -static void evergreenUpdateWindow(struct gl_context * ctx, int id) //diff in calling evergreenSetScissor -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); - GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; - GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; - const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; - const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); - GLfloat y_scale, y_bias; - - if (render_to_fbo) { - y_scale = 1.0; - y_bias = 0; - } else { - y_scale = -1.0; - y_bias = yoffset; - } - - GLfloat sx = v[MAT_SX]; - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat sy = v[MAT_SY] * y_scale; - GLfloat ty = (v[MAT_TY] * y_scale) + y_bias; - GLfloat sz = v[MAT_SZ] * depthScale; - GLfloat tz = v[MAT_TZ] * depthScale; - - EVERGREEN_STATECHANGE(context, pa); - - - evergreen->viewport[id].PA_CL_VPORT_XSCALE.f32All = sx; - evergreen->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; - - evergreen->viewport[id].PA_CL_VPORT_YSCALE.f32All = sy; - evergreen->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; - - evergreen->viewport[id].PA_CL_VPORT_ZSCALE.f32All = sz; - evergreen->viewport[id].PA_CL_VPORT_ZOFFSET.f32All = tz; - - if (ctx->Transform.DepthClamp) { - evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); - evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); - SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); - SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); - } else { - evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; - evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; - CLEARbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); - CLEARbit(evergreen->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); - } - - evergreen->viewport[id].enabled = GL_TRUE; - - evergreenSetScissor(context); -} - -static void evergreenEnable(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - switch (cap) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - /* empty */ - break; - case GL_FOG: - /* empty */ - break; - case GL_ALPHA_TEST: - evergreenSetAlphaState(ctx); - break; - case GL_COLOR_LOGIC_OP: - evergreenSetLogicOpState(ctx); - /* fall-through, because logic op overrides blending */ - case GL_BLEND: - evergreenSetBlendState(ctx); - break; - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - evergreenSetClipPlaneState(ctx, cap, state); - break; - case GL_DEPTH_TEST: - evergreenSetDepthState(ctx); - break; - case GL_STENCIL_TEST: - evergreenSetStencilState(ctx, state); - break; - case GL_CULL_FACE: - evergreenUpdateCulling(ctx); - break; - case GL_POLYGON_OFFSET_POINT: - case GL_POLYGON_OFFSET_LINE: - case GL_POLYGON_OFFSET_FILL: - evergreenSetPolygonOffsetState(ctx, state); - break; - case GL_SCISSOR_TEST: - radeon_firevertices(&context->radeon); - context->radeon.state.scissor.enabled = state; - radeonUpdateScissor(ctx); - break; - case GL_LINE_STIPPLE: - evergreenUpdateLineStipple(ctx); - break; - case GL_DEPTH_CLAMP: - evergreenUpdateWindow(ctx, 0); - break; - default: - break; - } - -} - -static void evergreenColorMask(struct gl_context * ctx, - GLboolean r, GLboolean g, GLboolean b, GLboolean a) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - unsigned int mask = ((r ? 1 : 0) | - (g ? 2 : 0) | - (b ? 4 : 0) | - (a ? 8 : 0)); - - if (mask != evergreen->CB_TARGET_MASK.u32All) { - EVERGREEN_STATECHANGE(context, cb); - SETfield(evergreen->CB_TARGET_MASK.u32All, mask, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); - } -} - -static void evergreenDepthFunc(struct gl_context * ctx, GLenum func) //same -{ - evergreenSetDepthState(ctx); -} - -static void evergreenDepthMask(struct gl_context * ctx, GLboolean mask) //same -{ - evergreenSetDepthState(ctx); -} - -static void evergreenCullFace(struct gl_context * ctx, GLenum mode) //same -{ - evergreenUpdateCulling(ctx); -} - -static void evergreenFogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same -{ -} - -static void evergreenUpdatePolygonMode(struct gl_context * ctx) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DISABLE_POLY_MODE, POLY_MODE_shift, POLY_MODE_mask); - - /* Only do something if a polygon mode is wanted, default is GL_FILL */ - if (ctx->Polygon.FrontMode != GL_FILL || - ctx->Polygon.BackMode != GL_FILL) { - GLenum f, b; - - /* Handle GL_CW (clock wise and GL_CCW (counter clock wise) - * correctly by selecting the correct front and back face - */ - f = ctx->Polygon.FrontMode; - b = ctx->Polygon.BackMode; - - /* Enable polygon mode */ - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DUAL_MODE, POLY_MODE_shift, POLY_MODE_mask); - - switch (f) { - case GL_LINE: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - case GL_POINT: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - case GL_FILL: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - } - - switch (b) { - case GL_LINE: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - case GL_POINT: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - case GL_FILL: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - } - } -} - -static void evergreenFrontFace(struct gl_context * ctx, GLenum mode) //same -{ - evergreenUpdateCulling(ctx); - evergreenUpdatePolygonMode(ctx); -} - -static void evergreenShadeModel(struct gl_context * ctx, GLenum mode) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, spi); - - /* also need to set/clear FLAT_SHADE bit per param in SPI_PS_INPUT_CNTL_[0-31] */ - switch (mode) { - case GL_FLAT: - SETbit(evergreen->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); - break; - case GL_SMOOTH: - CLEARbit(evergreen->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); - break; - default: - return; - } -} - -static void evergreenLogicOpcode(struct gl_context *ctx, GLenum logicop) //diff -{ - if (ctx->Color.ColorLogicOpEnabled) - evergreenSetLogicOpState(ctx); -} - -static void evergreenPointSize(struct gl_context * ctx, GLfloat size) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - /* We need to clamp to user defined range here, because - * the HW clamping happens only for per vertex point size. */ - size = CLAMP(size, ctx->Point.MinSize, ctx->Point.MaxSize); - - /* same size limits for AA, non-AA points */ - size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); - - /* format is 12.4 fixed point */ - SETfield(evergreen->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), - PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); - SETfield(evergreen->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), - PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); - -} - -static void evergreenPointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - /* format is 12.4 fixed point */ - switch (pname) { - case GL_POINT_SIZE_MIN: - SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0), - MIN_SIZE_shift, MIN_SIZE_mask); - evergreenPointSize(ctx, ctx->Point.Size); - break; - case GL_POINT_SIZE_MAX: - SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0), - MAX_SIZE_shift, MAX_SIZE_mask); - evergreenPointSize(ctx, ctx->Point.Size); - break; - case GL_POINT_DISTANCE_ATTENUATION: - break; - case GL_POINT_FADE_THRESHOLD_SIZE: - break; - default: - break; - } -} - -static int evergreen_translate_stencil_func(int func) //same -{ - switch (func) { - case GL_NEVER: - return REF_NEVER; - case GL_LESS: - return REF_LESS; - case GL_EQUAL: - return REF_EQUAL; - case GL_LEQUAL: - return REF_LEQUAL; - case GL_GREATER: - return REF_GREATER; - case GL_NOTEQUAL: - return REF_NOTEQUAL; - case GL_GEQUAL: - return REF_GEQUAL; - case GL_ALWAYS: - return REF_ALWAYS; - } - return 0; -} - -static void evergreenStencilFuncSeparate(struct gl_context * ctx, GLenum face, - GLenum func, GLint ref, GLuint mask) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - const unsigned back = ctx->Stencil._BackFace; - - - EVERGREEN_STATECHANGE(context, db); - - //front - SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.Ref[0], - STENCILREF_shift, STENCILREF_mask); - SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.ValueMask[0], - STENCILMASK_shift, STENCILMASK_mask); - - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_func(ctx->Stencil.Function[0]), - STENCILFUNC_shift, STENCILFUNC_mask); - - //back - SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.Ref[back], - STENCILREF_BF_shift, STENCILREF_BF_mask); - SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.ValueMask[back], - STENCILMASK_BF_shift, STENCILMASK_BF_mask); - - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_func(ctx->Stencil.Function[back]), - STENCILFUNC_BF_shift, STENCILFUNC_BF_mask); -} - -static void evergreenStencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - const unsigned back = ctx->Stencil._BackFace; - - EVERGREEN_STATECHANGE(context, db); - - // front - SETfield(evergreen->DB_STENCILREFMASK.u32All, ctx->Stencil.WriteMask[0], - STENCILWRITEMASK_shift, STENCILWRITEMASK_mask); - - // back - SETfield(evergreen->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.WriteMask[back], - STENCILWRITEMASK_BF_shift, STENCILWRITEMASK_BF_mask); - -} - -static int evergreen_translate_stencil_op(int op) //same -{ - switch (op) { - case GL_KEEP: - return STENCIL_KEEP; - case GL_ZERO: - return STENCIL_ZERO; - case GL_REPLACE: - return STENCIL_REPLACE; - case GL_INCR: - return STENCIL_INCR_CLAMP; - case GL_DECR: - return STENCIL_DECR_CLAMP; - case GL_INCR_WRAP_EXT: - return STENCIL_INCR_WRAP; - case GL_DECR_WRAP_EXT: - return STENCIL_DECR_WRAP; - case GL_INVERT: - return STENCIL_INVERT; - default: - WARN_ONCE("Do not know how to translate stencil op"); - return STENCIL_KEEP; - } - return 0; -} - -static void evergreenStencilOpSeparate(struct gl_context * ctx, GLenum face, - GLenum fail, GLenum zfail, GLenum zpass) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - const unsigned back = ctx->Stencil._BackFace; - - EVERGREEN_STATECHANGE(context, db); - - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.FailFunc[0]), - STENCILFAIL_shift, STENCILFAIL_mask); - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZFailFunc[0]), - STENCILZFAIL_shift, STENCILZFAIL_mask); - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZPassFunc[0]), - STENCILZPASS_shift, STENCILZPASS_mask); - - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.FailFunc[back]), - STENCILFAIL_BF_shift, STENCILFAIL_BF_mask); - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZFailFunc[back]), - STENCILZFAIL_BF_shift, STENCILZFAIL_BF_mask); - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, evergreen_translate_stencil_op(ctx->Stencil.ZPassFunc[back]), - STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); -} - -static void evergreenViewport(struct gl_context * ctx, - GLint x, - GLint y, - GLsizei width, - GLsizei height) //diff in evergreenUpdateWindow -{ - evergreenUpdateWindow(ctx, 0); - - radeon_viewport(ctx, x, y, width, height); -} - -static void evergreenDepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow -{ - evergreenUpdateWindow(ctx, 0); -} - -static void evergreenLineWidth(struct gl_context * ctx, GLfloat widthf) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - uint32_t lineWidth = (uint32_t)((widthf * 0.5) * (1 << 4)); - - EVERGREEN_STATECHANGE(context, pa); - - if (lineWidth > 0xFFFF) - lineWidth = 0xFFFF; - SETfield(evergreen->PA_SU_LINE_CNTL.u32All,(uint16_t)lineWidth, - PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); -} - -static void evergreenLineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) //same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - EVERGREEN_STATECHANGE(context, pa); - - SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, pattern, LINE_PATTERN_shift, LINE_PATTERN_mask); - SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, (factor-1), REPEAT_COUNT_shift, REPEAT_COUNT_mask); - SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); -} - -static void evergreenPolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //diff : - //all register here offset diff, bits same -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLfloat constant = units; - GLchar depth = 0; - - EVERGREEN_STATECHANGE(context, pa); - - switch (ctx->Visual.depthBits) { - case 16: - constant *= 4.0; - depth = -16; - break; - case 24: - constant *= 2.0; - depth = -24; - break; - } - - factor *= 12.0; - SETfield(evergreen->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth, - POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask); - //evergreen->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //??? - evergreen->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor; - evergreen->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant; - evergreen->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor; - evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; -} - -static void evergreenPolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //same -{ - (void)face; - (void)mode; - - evergreenUpdatePolygonMode(ctx); -} - -static void evergreenRenderMode(struct gl_context * ctx, GLenum mode) //same -{ -} - -//TODO : move to kernel. -static void evergreenInitSQConfig(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - uint32_t uSqNumCfInsts, uMaxGPRs, uMaxThreads, uMaxStackEntries, uPSThreadCount, uOtherThreadCount; - uint32_t NUM_PS_GPRS, NUM_VS_GPRS, NUM_GS_GPRS, NUM_ES_GPRS, NUM_HS_GPRS, NUM_LS_GPRS, NUM_CLAUSE_TEMP_GPRS; - GLboolean bVC_ENABLE = GL_TRUE; - - R600_STATECHANGE(context, sq); - - switch (context->radeon.radeonScreen->chip_family) - { - case CHIP_FAMILY_CEDAR: - uSqNumCfInsts = 1; - bVC_ENABLE = GL_FALSE; - uMaxGPRs = 256; - uPSThreadCount = 96; - uMaxThreads = 192; - uMaxStackEntries = 256; - break; - case CHIP_FAMILY_REDWOOD: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 256; - break; - case CHIP_FAMILY_JUNIPER: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - case CHIP_FAMILY_CYPRESS: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - case CHIP_FAMILY_HEMLOCK: - uSqNumCfInsts = 2;//? - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - case CHIP_FAMILY_PALM: - uSqNumCfInsts = 1; - bVC_ENABLE = GL_FALSE; - uMaxGPRs = 256; - uPSThreadCount = 96; - uMaxThreads = 192; - uMaxStackEntries = 256; - break; - case CHIP_FAMILY_SUMO: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_FALSE; - uMaxGPRs = 256; - uPSThreadCount = 96; - uMaxThreads = 248; - uMaxStackEntries = 256; - break; - case CHIP_FAMILY_SUMO2: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_FALSE; - uMaxGPRs = 256; - uPSThreadCount = 96; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - case CHIP_FAMILY_BARTS: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - case CHIP_FAMILY_TURKS: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 256; - break; - case CHIP_FAMILY_CAICOS: - uSqNumCfInsts = 1; - bVC_ENABLE = GL_FALSE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 192; - uMaxStackEntries = 256; - break; - default: - uSqNumCfInsts = 2; - bVC_ENABLE = GL_TRUE; - uMaxGPRs = 256; - uPSThreadCount = 128; - uMaxThreads = 248; - uMaxStackEntries = 512; - break; - } - - evergreen->evergreen_config.SQ_DYN_GPR_CNTL_PS_FLUSH_REQ.u32All = 0; - - evergreen->evergreen_config.SPI_CONFIG_CNTL.u32All = 0; - evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All = 0; - SETfield(evergreen->evergreen_config.SPI_CONFIG_CNTL_1.u32All, 4, - EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_shift, - EG_SPI_CONFIG_CNTL_1__VTX_DONE_DELAY_mask); - - evergreen->evergreen_config.CP_PERFMON_CNTL.u32All = 0; - - evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All = 0; - SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 16 * uSqNumCfInsts, - EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_shift, - EG_SQ_MS_FIFO_SIZES__CACHE_FIFO_SIZE_mask); - SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0x4, - EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_shift, - EG_SQ_MS_FIFO_SIZES__FETCH_FIFO_HIWATER_mask); - SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0xE0, - EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_shift, - EG_SQ_MS_FIFO_SIZES__DONE_FIFO_HIWATER_mask); - SETfield(evergreen->evergreen_config.SQ_MS_FIFO_SIZES.u32All, 0x8, - EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_shift, - EG_SQ_MS_FIFO_SIZES__ALU_UPDATE_FIFO_HIWATER_mask); - - if(bVC_ENABLE == GL_TRUE) - { - SETbit(evergreen->evergreen_config.SQ_CONFIG.u32All, - EG_SQ_CONFIG__VC_ENABLE_bit); - } - else - { - CLEARbit(evergreen->evergreen_config.SQ_CONFIG.u32All, - EG_SQ_CONFIG__VC_ENABLE_bit); - } - SETbit(evergreen->evergreen_config.SQ_CONFIG.u32All, - EG_SQ_CONFIG__EXPORT_SRC_C_bit); - SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 0, - EG_SQ_CONFIG__PS_PRIO_shift, - EG_SQ_CONFIG__PS_PRIO_mask); - SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 1, - EG_SQ_CONFIG__VS_PRIO_shift, - EG_SQ_CONFIG__VS_PRIO_mask); - SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 2, - EG_SQ_CONFIG__GS_PRIO_shift, - EG_SQ_CONFIG__GS_PRIO_mask); - SETfield(evergreen->evergreen_config.SQ_CONFIG.u32All, 3, - EG_SQ_CONFIG__ES_PRIO_shift, - EG_SQ_CONFIG__ES_PRIO_mask); - - NUM_CLAUSE_TEMP_GPRS = 4; - NUM_PS_GPRS = ((uMaxGPRs-(4*2))*12/32); // 93 - NUM_VS_GPRS = ((uMaxGPRs-(4*2))*6/32); // 46 - NUM_GS_GPRS = ((uMaxGPRs-(4*2))*4/32); // 31 - NUM_ES_GPRS = ((uMaxGPRs-(4*2))*4/32); // 31 - NUM_HS_GPRS = ((uMaxGPRs-(4*2))*3/32); // 23 - NUM_LS_GPRS = ((uMaxGPRs-(4*2))*3/32); // 23 - - evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All = 0; - evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All = 0; - evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All = 0; - - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_PS_GPRS, - NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_VS_GPRS, - NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_1.u32All, NUM_CLAUSE_TEMP_GPRS, - NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All, NUM_GS_GPRS, - NUM_GS_GPRS_shift, NUM_GS_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_2.u32All, NUM_ES_GPRS, - NUM_ES_GPRS_shift, NUM_ES_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All, NUM_HS_GPRS, - NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(evergreen->evergreen_config.SQ_GPR_RESOURCE_MGMT_3.u32All, NUM_LS_GPRS, - NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - - uOtherThreadCount = (((uMaxThreads-uPSThreadCount)/6)/8)*8; - evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All = 0; - evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All = 0; - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uPSThreadCount, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, - NUM_GS_THREADS_shift, NUM_GS_THREADS_mask); - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT.u32All, uOtherThreadCount, - NUM_ES_THREADS_shift, NUM_ES_THREADS_mask); - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All, uOtherThreadCount, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(evergreen->evergreen_config.SQ_THREAD_RESOURCE_MGMT_2.u32All, uOtherThreadCount, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - - uMaxStackEntries = ((uMaxStackEntries*1)/6); - evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All = 0; - evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All = 0; - evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All = 0; - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All, uMaxStackEntries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_1.u32All, uMaxStackEntries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All, uMaxStackEntries, - NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask); - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_2.u32All, uMaxStackEntries, - NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask); - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All, uMaxStackEntries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(evergreen->evergreen_config.SQ_STACK_RESOURCE_MGMT_3.u32All, uMaxStackEntries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - - evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All = 0; - SETfield(evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All, 4095, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_shift, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_CLK_CNT_mask); - SETfield(evergreen->evergreen_config.PA_SC_FORCE_EOV_MAX_CNTS.u32All, 255, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_shift, - EG_PA_SC_FORCE_EOV_MAX_CNTS__FORCE_EOV_MAX_REZ_CNT_mask); - - evergreen->evergreen_config.VGT_CACHE_INVALIDATION.u32All = 0; - SETfield(evergreen->evergreen_config.VGT_CACHE_INVALIDATION.u32All, 2, - EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_shift, - EG_VGT_CACHE_INVALIDATION__CACHE_INVALIDATION_mask); - - evergreen->evergreen_config.VGT_GS_VERTEX_REUSE.u32All = 0; - SETfield(evergreen->evergreen_config.VGT_GS_VERTEX_REUSE.u32All, 16, - VERT_REUSE_shift, - VERT_REUSE_mask); - - evergreen->evergreen_config.PA_SC_LINE_STIPPLE_STATE.u32All = 0; - - evergreen->evergreen_config.PA_CL_ENHANCE.u32All = 0; - SETbit(evergreen->evergreen_config.PA_CL_ENHANCE.u32All, - CLIP_VTX_REORDER_ENA_bit); - SETfield(evergreen->evergreen_config.PA_CL_ENHANCE.u32All, 3, - NUM_CLIP_SEQ_shift, - NUM_CLIP_SEQ_mask); -} - -void evergreenInitState(struct gl_context * ctx) //diff -{ - context_t *context = R700_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - - int id = 0; - - //calloc should have done this - memset(evergreen, 0, sizeof(EVERGREEN_CHIP_CONTEXT)); - - // Disable window clipping and offset: - SETfield(evergreen->PA_SC_WINDOW_OFFSET.u32All, 0, - EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_shift, EG_PA_SC_WINDOW_OFFSET__WINDOW_X_OFFSET_mask); - SETfield(evergreen->PA_SC_WINDOW_OFFSET.u32All, 0, - EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_shift, EG_PA_SC_WINDOW_OFFSET__WINDOW_Y_OFFSET_mask); - - SETbit(evergreen->PA_SC_WINDOW_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - - evergreen->PA_SC_CLIPRECT_RULE.u32All = 0x0000FFFF; - - evergreen->PA_SC_EDGERULE.u32All = 0xAAAAAAAA; - - // Set up Z min/max: - evergreen->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; - evergreen->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; - - SETfield(evergreen->CB_TARGET_MASK.u32All, 0xF, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); - SETfield(evergreen->CB_SHADER_MASK.u32All, 0xF, OUTPUT0_ENABLE_shift, OUTPUT0_ENABLE_mask); - - SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_shift, - EG_SPI_BARYC_CNTL__PERSP_CENTROID_ENA_mask); - SETfield(evergreen->SPI_BARYC_CNTL.u32All, 1, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_shift, - EG_SPI_BARYC_CNTL__LINEAR_CENTROID_ENA_mask); - - // Turn off vgt reuse: - evergreen->VGT_REUSE_OFF.u32All = 0; - SETbit(evergreen->VGT_REUSE_OFF.u32All, REUSE_OFF_bit); - - // Specify offsetting and clamp values for vertices: - evergreen->VGT_MAX_VTX_INDX.u32All = 0xFFFFFF; - evergreen->VGT_MIN_VTX_INDX.u32All = 0; - evergreen->VGT_INDX_OFFSET.u32All = 0; - - evergreen->VGT_DMA_NUM_INSTANCES.u32All = 1; - - // Do not alpha blend: - SETfield(evergreen->SX_ALPHA_TEST_CONTROL.u32All, REF_NEVER, - ALPHA_FUNC_shift, ALPHA_FUNC_mask); - CLEARbit(evergreen->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); - - evergreen->SPI_VS_OUT_ID_0.u32All = 0x03020100; - evergreen->SPI_VS_OUT_ID_1.u32All = 0x07060504; - - evergreen->SPI_PS_INPUT_CNTL[0].u32All = 0x00000800; - evergreen->SPI_PS_INPUT_CNTL[1].u32All = 0x00000801; - evergreen->SPI_PS_INPUT_CNTL[2].u32All = 0x00000802; - - - // Depth buffer currently disabled: - evergreen->DB_DEPTH_CONTROL.u32All = 0; - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - SETfield(evergreen->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, - ZFUNC_shift, ZFUNC_mask); - - evergreen->DB_Z_READ_BASE.u32All = 0; - evergreen->DB_Z_WRITE_BASE.u32All = 0; - - evergreen->DB_DEPTH_CLEAR.f32All = 1.0; - - evergreen->DB_DEPTH_VIEW.u32All = 0; - - evergreen->DB_SHADER_CONTROL.u32All = 0; - SETbit(evergreen->DB_SHADER_CONTROL.u32All, EG_DB_SHADER_CONTROL__DUAL_EXPORT_ENABLE_bit); - - evergreen->DB_Z_INFO.u32All = 0; - SETfield(evergreen->DB_Z_INFO.u32All , ARRAY_1D_TILED_THIN1, - EG_DB_Z_INFO__ARRAY_MODE_shift, EG_DB_Z_INFO__ARRAY_MODE_mask); - SETfield(evergreen->DB_Z_INFO.u32All , EG_Z_24, - EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); - SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_TILE_SPLIT_256B, - EG_DB_Z_INFO__TILE_SPLIT_shift, EG_DB_Z_INFO__TILE_SPLIT_mask); - SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_8_BANK, - EG_DB_Z_INFO__NUM_BANKS_shift, EG_DB_Z_INFO__NUM_BANKS_mask); - SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_BANK_WIDTH_1, - EG_DB_Z_INFO__BANK_WIDTH_shift, EG_DB_Z_INFO__BANK_WIDTH_mask); - SETfield(evergreen->DB_Z_INFO.u32All , EG_ADDR_SURF_BANK_HEIGHT_1, - EG_DB_Z_INFO__BANK_HEIGHT_shift, EG_DB_Z_INFO__BANK_HEIGHT_mask); - - evergreen->DB_STENCIL_INFO.u32All = 0; - CLEARbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); - SETfield(evergreen->DB_STENCIL_INFO.u32All, 0, - EG_DB_STENCIL_INFO__TILE_SPLIT_shift, EG_DB_STENCIL_INFO__TILE_SPLIT_mask); - - evergreen->DB_RENDER_CONTROL.u32All = 0; - - evergreen->DB_RENDER_OVERRIDE.u32All = 0; - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); - SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); - - /* stencil */ - evergreenEnable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); - evergreenStencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]); - evergreenStencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], - ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); - evergreenStencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], - ctx->Stencil.ZFailFunc[0], - ctx->Stencil.ZPassFunc[0]); - - // Disable ROP3 modes by setting src to dst copy: - SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, - EG_CB_COLOR_CONTROL__ROP3_shift, - EG_CB_COLOR_CONTROL__ROP3_mask); - SETfield(evergreen->CB_COLOR_CONTROL.u32All, EG_CB_NORMAL, - EG_CB_COLOR_CONTROL__MODE_shift, - EG_CB_COLOR_CONTROL__MODE_mask); - - SETfield(evergreen->CB_BLEND0_CONTROL.u32All, - BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - - SETfield(evergreen->CB_BLEND0_CONTROL.u32All, - BLEND_ONE, ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - - //evergreen->PA_CL_CLIP_CNTL.CLIP_DISABLE = 1; - - SETbit(evergreen->PA_CL_CLIP_CNTL.u32All, DX_LINEAR_ATTR_CLIP_ENA_bit); - - // Set up the culling control register: - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, 2, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); // draw using triangles - SETfield(evergreen->PA_SU_SC_MODE_CNTL.u32All, 2, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); // draw using triangles - - // Do scale XY or X by 1/W0. eg: - evergreen->bEnablePerspective = GL_TRUE; - - CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - CLEARbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - // Enable viewport scaling for all three axis: - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_X_SCALE_ENA_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_X_OFFSET_ENA_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Y_SCALE_ENA_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Y_OFFSET_ENA_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Z_SCALE_ENA_bit); - SETbit(evergreen->PA_CL_VTE_CNTL.u32All, VPORT_Z_OFFSET_ENA_bit); - - // Set up point sizes and min/max values: - SETfield(evergreen->PA_SU_POINT_SIZE.u32All, 0x8, - PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); - SETfield(evergreen->PA_SU_POINT_SIZE.u32All, 0x8, - PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); - CLEARfield(evergreen->PA_SU_POINT_MINMAX.u32All, MIN_SIZE_mask); - SETfield(evergreen->PA_SU_POINT_MINMAX.u32All, 0x8000, MAX_SIZE_shift, MAX_SIZE_mask); - SETfield(evergreen->PA_SU_LINE_CNTL.u32All,0x8, - PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); - - // Set up line control: - evergreen->PA_SC_LINE_CNTL.u32All = 0; - CLEARbit(evergreen->PA_SC_LINE_CNTL.u32All, EXPAND_LINE_WIDTH_bit); - SETbit(evergreen->PA_SC_LINE_CNTL.u32All, LAST_PIXEL_bit); - - // Set up vertex control: - evergreen->PA_SU_VTX_CNTL.u32All = 0; - CLEARfield(evergreen->PA_SU_VTX_CNTL.u32All, QUANT_MODE_mask); - SETbit(evergreen->PA_SU_VTX_CNTL.u32All, PIX_CENTER_bit); - SETfield(evergreen->PA_SU_VTX_CNTL.u32All, X_ROUND_TO_EVEN, - PA_SU_VTX_CNTL__ROUND_MODE_shift, PA_SU_VTX_CNTL__ROUND_MODE_mask); - - // to 1.0 = no guard band: - evergreen->PA_CL_GB_VERT_CLIP_ADJ.u32All = 0x3F800000; // 1.0 - evergreen->PA_CL_GB_VERT_DISC_ADJ.u32All = 0x3F800000; // 1.0 - evergreen->PA_CL_GB_HORZ_CLIP_ADJ.u32All = 0x3F800000; // 1.0 - evergreen->PA_CL_GB_HORZ_DISC_ADJ.u32All = 0x3F800000; // 1.0 - - // Diable color compares: - SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, - CLRCMP_FCN_SRC_shift, CLRCMP_FCN_SRC_mask); - SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, - CLRCMP_FCN_DST_shift, CLRCMP_FCN_DST_mask); - SETfield(evergreen->CB_CLRCMP_CONTROL.u32All, CLRCMP_SEL_SRC, - CLRCMP_FCN_SEL_shift, CLRCMP_FCN_SEL_mask); - - // Zero out source: - evergreen->CB_CLRCMP_SRC.u32All = 0x00000000; - - // Put a compare color in for error checking: - evergreen->CB_CLRCMP_DST.u32All = 0x000000FF; - - // Set up color compare mask: - evergreen->CB_CLRCMP_MSK.u32All = 0xFFFFFFFF; - - // Enable all samples for multi-sample anti-aliasing: - evergreen->PA_SC_AA_MASK.u32All = 0xFFFFFFFF; - // Turn off AA: - evergreen->PA_SC_AA_CONFIG.u32All = 0; - - SETfield(evergreen->VGT_OUT_DEALLOC_CNTL.u32All, 16, - DEALLOC_DIST_shift, DEALLOC_DIST_mask); - SETfield(evergreen->VGT_VERTEX_REUSE_BLOCK_CNTL.u32All, 14, - VTX_REUSE_DEPTH_shift, VTX_REUSE_DEPTH_mask); - - evergreen->SX_MISC.u32All = 0; - - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, 1, - EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift, EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask); - SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All, EG_CB_COLOR0_INFO__BLEND_CLAMP_bit); - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, 0, - EG_CB_COLOR0_INFO__NUMBER_TYPE_shift, EG_CB_COLOR0_INFO__NUMBER_TYPE_mask); - - SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All, SWAP_STD, - EG_CB_COLOR0_INFO__COMP_SWAP_shift, EG_CB_COLOR0_INFO__COMP_SWAP_mask); - - evergreen->render_target[id].CB_COLOR0_VIEW.u32All = 0; - evergreen->render_target[id].CB_COLOR0_CMASK.u32All = 0; - evergreen->render_target[id].CB_COLOR0_FMASK.u32All = 0; - evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0; - - evergreenInitSQConfig(ctx); - - context->radeon.hw.all_dirty = GL_TRUE; -} - -void evergreenInitStateFuncs(radeonContextPtr radeon, struct dd_function_table *functions) -{ - functions->UpdateState = evergreenInvalidateState; - functions->AlphaFunc = evergreenAlphaFunc; - functions->BlendColor = evergreenBlendColor; - functions->BlendEquationSeparate = evergreenBlendEquationSeparate; - functions->BlendFuncSeparate = evergreenBlendFuncSeparate; - functions->Enable = evergreenEnable; - functions->ColorMask = evergreenColorMask; - functions->DepthFunc = evergreenDepthFunc; - functions->DepthMask = evergreenDepthMask; - functions->CullFace = evergreenCullFace; - functions->Fogfv = evergreenFogfv; - functions->FrontFace = evergreenFrontFace; - functions->ShadeModel = evergreenShadeModel; - functions->LogicOpcode = evergreenLogicOpcode; - - /* ARB_point_parameters */ - functions->PointParameterfv = evergreenPointParameter; - - /* Stencil related */ - functions->StencilFuncSeparate = evergreenStencilFuncSeparate; - functions->StencilMaskSeparate = evergreenStencilMaskSeparate; - functions->StencilOpSeparate = evergreenStencilOpSeparate; - - /* Viewport related */ - functions->Viewport = evergreenViewport; - functions->DepthRange = evergreenDepthRange; - functions->PointSize = evergreenPointSize; - functions->LineWidth = evergreenLineWidth; - functions->LineStipple = evergreenLineStipple; - - functions->PolygonOffset = evergreenPolygonOffset; - functions->PolygonMode = evergreenPolygonMode; - - functions->RenderMode = evergreenRenderMode; - - functions->ClipPlane = evergreenClipPlane; - - functions->Scissor = radeonScissor; - - functions->DrawBuffer = radeonDrawBuffer; - functions->ReadBuffer = radeonReadBuffer; - - if (radeon->radeonScreen->kernel_mm) { - functions->CopyPixels = _mesa_meta_CopyPixels; - functions->DrawPixels = _mesa_meta_DrawPixels; - functions->ReadPixels = radeonReadPixels; - } -} - - diff --git a/src/mesa/drivers/dri/r600/evergreen_state.h b/src/mesa/drivers/dri/r600/evergreen_state.h deleted file mode 100644 index 2f350e90faa..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_state.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_STATE_H_ -#define _EVERGREEN_STATE_H_ - -#include "main/mtypes.h" - -#include "r600_context.h" - -extern void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); -extern void evergreenUpdateShaders(struct gl_context * ctx); -extern void evergreenUpdateShaderStates(struct gl_context * ctx); - -extern void evergreeUpdateShaders(struct gl_context * ctx); - -extern void evergreenUpdateViewportOffset(struct gl_context * ctx); - -extern void evergreenInitState(struct gl_context * ctx); -extern void evergreenInitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); - -extern void evergreenSetScissor(context_t *context); - -#endif /* _EVERGREEN_STATE_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c deleted file mode 100644 index c94a717c0ae..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_tex.c +++ /dev/null @@ -1,1667 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/colormac.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/image.h" -#include "main/teximage.h" -#include "main/simple_list.h" -#include "main/texobj.h" - -#include "texmem.h" - -#include "r600_context.h" -#include "radeon_mipmap_tree.h" -#include "evergreen_diff.h" -#include "evergreen_tex.h" -#include "evergreen_fragprog.h" -#include "evergreen_vertprog.h" - -#include "r600_tex.h" - -static unsigned int evergreen_translate_wrap_mode(GLenum wrapmode) -{ - switch(wrapmode) { - case GL_REPEAT: return SQ_TEX_WRAP; - case GL_CLAMP: return SQ_TEX_CLAMP_HALF_BORDER; - case GL_CLAMP_TO_EDGE: return SQ_TEX_CLAMP_LAST_TEXEL; - case GL_CLAMP_TO_BORDER: return SQ_TEX_CLAMP_BORDER; - case GL_MIRRORED_REPEAT: return SQ_TEX_MIRROR; - case GL_MIRROR_CLAMP_EXT: return SQ_TEX_MIRROR_ONCE_HALF_BORDER; - case GL_MIRROR_CLAMP_TO_EDGE_EXT: return SQ_TEX_MIRROR_ONCE_LAST_TEXEL; - case GL_MIRROR_CLAMP_TO_BORDER_EXT: return SQ_TEX_MIRROR_ONCE_BORDER; - default: - radeon_error("bad wrap mode in %s", __FUNCTION__); - return 0; - } -} - -static GLboolean evergreenGetTexFormat(struct gl_texture_object *tObj, gl_format mesa_format) -{ - radeonTexObj *t = radeon_tex_obj(tObj); - - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_X_shift, - FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Y_shift, - FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Z_shift, - FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_W_shift, - FORMAT_COMP_W_mask); - - SETfield(t->SQ_TEX_RESOURCE1, ARRAY_LINEAR_GENERAL, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - - switch (mesa_format) /* This is mesa format. */ - { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_ARGB8888: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_XRGB8888: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_XRGB8888_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB8888_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_RGB888: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_RGB565: - SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_RGB565_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB4444: - SETfield(t->SQ_TEX_RESOURCE7, FMT_4_4_4_4, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB4444_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_4_4_4_4, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB1555: - SETfield(t->SQ_TEX_RESOURCE7, FMT_1_5_5_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB1555_REV: - SETfield(t->SQ_TEX_RESOURCE7, FMT_1_5_5_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: /* TODO : Check this. */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB332: - SETfield(t->SQ_TEX_RESOURCE7, FMT_3_3_2, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_L8: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_I8: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB_DXT1: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT1: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT3: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT5: /* not supported yet */ - return GL_FALSE; - - case MESA_FORMAT_RGBA_FLOAT32: - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_32_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_16_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB_FLOAT32: /* X, Y, Z, ONE */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_32_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_16_FLOAT, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z16: - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: - case MESA_FORMAT_S8: - CLEARbit(t->SQ_TEX_RESOURCE0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - SETfield(t->SQ_TEX_RESOURCE1, ARRAY_1D_TILED_THIN1, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - switch (mesa_format) { - case MESA_FORMAT_Z16: - SETfield(t->SQ_TEX_RESOURCE7, FMT_16, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_24, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_Z24_S8: - SETfield(t->SQ_TEX_RESOURCE7, FMT_24_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_Z32: - SETfield(t->SQ_TEX_RESOURCE7, FMT_32, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_S8: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - break; - default: - break; - }; - switch (tObj->Sampler.DepthMode) { - case GL_LUMINANCE: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case GL_INTENSITY: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case GL_ALPHA: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - default: - return GL_FALSE; - } - break; - /* EXT_texture_sRGB */ - case MESA_FORMAT_SRGBA8: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SLA8: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SL8: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE7, FMT_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - default: - /* Not supported format */ - return GL_FALSE; - }; - - return GL_TRUE; -} - -static GLuint evergreen_translate_shadow_func(GLenum func) -{ - switch (func) { - case GL_NEVER: - return SQ_TEX_DEPTH_COMPARE_NEVER; - case GL_LESS: - return SQ_TEX_DEPTH_COMPARE_LESS; - case GL_LEQUAL: - return SQ_TEX_DEPTH_COMPARE_LESSEQUAL; - case GL_GREATER: - return SQ_TEX_DEPTH_COMPARE_GREATER; - case GL_GEQUAL: - return SQ_TEX_DEPTH_COMPARE_GREATEREQUAL; - case GL_NOTEQUAL: - return SQ_TEX_DEPTH_COMPARE_NOTEQUAL; - case GL_EQUAL: - return SQ_TEX_DEPTH_COMPARE_EQUAL; - case GL_ALWAYS: - return SQ_TEX_DEPTH_COMPARE_ALWAYS; - default: - WARN_ONCE("Unknown shadow compare function! %d", func); - return 0; - } -} - -static void evergreenUpdateTexWrap(radeonTexObjPtr t) -{ - struct gl_texture_object *tObj = &t->base; - - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapS), - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - - if (tObj->Target != GL_TEXTURE_1D) - { - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapT), - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Y_mask); - - if (tObj->Target == GL_TEXTURE_3D) - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_wrap_mode(tObj->Sampler.WrapR), - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_Z_mask); - } -} - -static void evergreenSetTexDefaultState(radeonTexObjPtr t) -{ - /* Init text object to default states. */ - t->SQ_TEX_RESOURCE0 = 0; - t->SQ_TEX_RESOURCE1 = 0; - t->SQ_TEX_RESOURCE2 = 0; - t->SQ_TEX_RESOURCE3 = 0; - t->SQ_TEX_RESOURCE4 = 0; - t->SQ_TEX_RESOURCE5 = 0; - t->SQ_TEX_RESOURCE6 = 0; - t->SQ_TEX_RESOURCE7 = 0; - - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); - - CLEARbit(t->SQ_TEX_RESOURCE0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit); - - SETfield(t->SQ_TEX_RESOURCE1, ARRAY_LINEAR_GENERAL, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_NUM_FORMAT_NORM, - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_shift, SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_mask); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__SRF_MODE_ALL_bit); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - SETfield(t->SQ_TEX_RESOURCE4, SQ_ENDIAN_NONE, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_shift, SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETfield(t->SQ_TEX_RESOURCE4, 0, - BASE_LEVEL_shift, - BASE_LEVEL_mask); /* mip-maps */ - - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - SETfield(t->SQ_TEX_RESOURCE7, SQ_TEX_VTX_VALID_TEXTURE, - EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__TYPE_mask); - - /* Initialize sampler registers */ - t->SQ_TEX_SAMPLER0 = 0; - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, - EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__Z_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_TRANS_BLACK, - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask); - - t->SQ_TEX_SAMPLER1 = 0; - SETfield(t->SQ_TEX_SAMPLER1, 0x7ff, - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift, - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask); - - t->SQ_TEX_SAMPLER2 = 0; - SETbit(t->SQ_TEX_SAMPLER2, EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit); -} - -static void evergreenSetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloat anisotropy) -{ - /* Force revalidation to account for switches from/to mipmapping. */ - t->validated = GL_FALSE; - - /* Note that EXT_texture_filter_anisotropic is extremely vague about - * how anisotropic filtering interacts with the "normal" filter modes. - * When anisotropic filtering is enabled, we override min and mag - * filter settings completely. This includes driconf's settings. - */ - if (anisotropy >= 2.0 && (minf != GL_NEAREST) && (magf != GL_NEAREST)) { - /*t->pp_txfilter |= R300_TX_MAG_FILTER_ANISO - | R300_TX_MIN_FILTER_ANISO - | R300_TX_MIN_FILTER_MIP_LINEAR - | aniso_filter(anisotropy);*/ - radeon_print(RADEON_TEXTURE, RADEON_NORMAL, "Using maximum anisotropy of %f\n", anisotropy); - return; - } - - switch (minf) - { - case GL_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - case GL_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - case GL_NEAREST_MIPMAP_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - case GL_NEAREST_MIPMAP_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - case GL_LINEAR_MIPMAP_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - case GL_LINEAR_MIPMAP_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__MIP_FILTER_mask); - break; - } - - /* Note we don't have 3D mipmaps so only use the mag filter setting - * to set the 3D texture filter mode. - */ - switch (magf) - { - case GL_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); - break; - case GL_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__XY_MAG_FILTER_mask); - break; - } -} - -static void evergreenSetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) -{ - t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3])); - t->TD_PS_SAMPLER0_BORDER_RED = *((uint32_t*)&(color[2])); - t->TD_PS_SAMPLER0_BORDER_GREEN = *((uint32_t*)&(color[1])); - t->TD_PS_SAMPLER0_BORDER_BLUE = *((uint32_t*)&(color[0])); - - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_REGISTER, - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__BORDER_COLOR_TYPE_mask); -} - -static void evergreenSetDepthTexMode(struct gl_texture_object *tObj) -{ - radeonTexObjPtr t; - - if (!tObj) - return; - - t = radeon_tex_obj(tObj); - - if(!evergreenGetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat)) - t->validated = GL_FALSE; -} - -static INLINE uint32_t -EG_S_FIXED(float value, uint32_t frac_bits) -{ - return value * (1 << frac_bits); -} - -static GLboolean evergreen_setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - radeonTexObj *t = radeon_tex_obj(texObj); - const struct gl_texture_image *firstImage; - GLuint uTexelPitch, row_align; - - if (context->radeon.radeonScreen->driScreen->dri2.enabled && - t->image_override && - t->bo) - return GL_TRUE; - - firstImage = t->base.Image[0][t->minLod]; - - if (!t->image_override) { - if (!evergreenGetTexFormat(texObj, firstImage->TexFormat)) { - radeon_warning("unsupported texture format in %s\n", - __FUNCTION__); - return GL_FALSE; - } - } - - switch (texObj->Target) - { - case GL_TEXTURE_1D: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_1D, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); - break; - case GL_TEXTURE_2D: - case GL_TEXTURE_RECTANGLE_NV: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); - break; - case GL_TEXTURE_3D: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_3D, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, (firstImage->Depth - 1), // ??? - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); - break; - case GL_TEXTURE_CUBE_MAP: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_CUBEMAP, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_DEPTH_mask); - break; - default: - radeon_error("unexpected texture target type in %s\n", __FUNCTION__); - return GL_FALSE; - } - - row_align = context->radeon.texture_row_align - 1; - uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align; - uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat); - uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (uTexelPitch < 8) - uTexelPitch = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (uTexelPitch/8)-1, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); - SETfield(t->SQ_TEX_RESOURCE0, firstImage->Width - 1, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask); - SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask); - - t->SQ_TEX_RESOURCE2 = get_base_teximage_offset(t) / 256; - - t->SQ_TEX_RESOURCE3 = radeon_miptree_image_offset(t->mt, 0, t->minLod + 1) / 256; - - SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); - SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask); - - SETfield(t->SQ_TEX_SAMPLER1, - EG_S_FIXED(CLAMP(t->base.Sampler.MinLod - t->minLod, 0, 15), 8), - EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_shift, - EG_SQ_TEX_SAMPLER_WORD1_0__MIN_LOD_mask); - SETfield(t->SQ_TEX_SAMPLER1, - EG_S_FIXED(CLAMP(t->base.Sampler.MaxLod - t->minLod, 0, 15), 8), - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_shift, - EG_SQ_TEX_SAMPLER_WORD1_0__MAX_LOD_mask); - SETfield(t->SQ_TEX_SAMPLER2, - EG_S_FIXED(CLAMP(ctx->Texture.Unit[unit].LodBias + t->base.Sampler.LodBias, -16, 16), 8), - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_shift, - EG_SQ_TEX_SAMPLER_WORD2_0__LOD_BIAS_mask); - - if(texObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) - { - SETfield(t->SQ_TEX_SAMPLER0, evergreen_translate_shadow_func(texObj->Sampler.CompareFunc), - EG_SQ_TEX_SAMPLER_WORD0_0__DCF_shift, - EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask); - } - else - { - CLEARfield(t->SQ_TEX_SAMPLER0, EG_SQ_TEX_SAMPLER_WORD0_0__DCF_mask); - } - - return GL_TRUE; -} - -void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, - unsigned long long offset, GLint depth, GLuint pitch) -{ - context_t *rmesa = pDRICtx->driverPrivate; - struct gl_texture_object *tObj = - _mesa_lookup_texture(rmesa->radeon.glCtx, texname); - radeonTexObjPtr t = radeon_tex_obj(tObj); - const struct gl_texture_image *firstImage; - uint32_t pitch_val, size, row_align; - - if (!tObj) - return; - - t->image_override = GL_TRUE; - - if (!offset) - return; - - firstImage = t->base.Image[0][t->minLod]; - row_align = rmesa->radeon.texture_row_align - 1; - size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height; - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - t->bo = radeon_legacy_bo_alloc_fake(rmesa->radeon.radeonScreen->bom, size, offset); - t->override_offset = offset; - pitch_val = pitch; - switch (depth) { - case 32: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 24: - default: - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 16: - SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 2; - break; - } - - pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (pitch_val < 8) - pitch_val = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); -} - -void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - struct radeon_renderbuffer *rb; - radeon_texture_image *rImage; - radeonContextPtr radeon; - struct radeon_framebuffer *rfb; - radeonTexObjPtr t; - uint32_t pitch_val; - gl_format texFormat; - - radeon = pDRICtx->driverPrivate; - - rfb = dPriv->driverPrivate; - texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); - texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0); - - rImage = get_radeon_texture_image(texImage); - t = radeon_tex_obj(texObj); - if (t == NULL) { - return; - } - - radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); - rb = rfb->color_rb[0]; - if (rb->bo == NULL) { - /* Failed to BO for the buffer */ - return; - } - - _mesa_lock_texture(radeon->glCtx, texObj); - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - if (rImage->bo) { - radeon_bo_unref(rImage->bo); - rImage->bo = NULL; - } - - radeon_miptree_unreference(&t->mt); - radeon_miptree_unreference(&rImage->mt); - - rImage->bo = rb->bo; - radeon_bo_ref(rImage->bo); - t->bo = rb->bo; - radeon_bo_ref(t->bo); - t->image_override = GL_TRUE; - t->override_offset = 0; - pitch_val = rb->pitch; - switch (rb->cpp) { - case 4: - if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texFormat = MESA_FORMAT_RGB888; - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - } else { - texFormat = MESA_FORMAT_ARGB8888; - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - } - pitch_val /= 4; - break; - case 3: - default: - // FMT_8_8_8 ??? - texFormat = MESA_FORMAT_RGB888; - SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 2: - texFormat = MESA_FORMAT_RGB565; - SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, - EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 2; - break; - } - - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, - rb->cpp, texFormat); - rImage->base.RowStride = rb->pitch / rb->cpp; - - pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (pitch_val < 8) - pitch_val = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask); - SETfield(t->SQ_TEX_RESOURCE0, rb->base.Width - 1, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift, - EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask); - SETfield(t->SQ_TEX_RESOURCE1, rb->base.Height - 1, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift, - EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask); - - t->validated = GL_TRUE; - _mesa_unlock_texture(radeon->glCtx, texObj); - return; -} - -void evergreenUpdateTextureState(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(context); - struct gl_texture_unit *texUnit; - struct radeon_tex_obj *t; - GLuint unit; - - EVERGREEN_STATECHANGE(context, tx); - - for (unit = 0; unit < R700_MAX_TEXTURE_UNITS; unit++) { - texUnit = &ctx->Texture.Unit[unit]; - t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); - evergreen->textures[unit] = NULL; - if (texUnit->_ReallyEnabled) { - if (!t) - continue; - evergreen->textures[unit] = t; - } - } -} - -static GLboolean evergreen_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) -{ - radeonTexObj *t = radeon_tex_obj(texObj); - - if (!radeon_validate_texture_miptree(ctx, texObj)) - return GL_FALSE; - - /* Configure the hardware registers (more precisely, the cached version - * of the hardware registers). */ - if (!evergreen_setup_hardware_state(ctx, texObj, unit)) - return GL_FALSE; - - t->validated = GL_TRUE; - return GL_TRUE; -} - -GLboolean evergreenValidateBuffers(struct gl_context * ctx) -{ - context_t *rmesa = EVERGREEN_CONTEXT(ctx); - struct radeon_renderbuffer *rrb; - struct radeon_bo *pbo; - int i; - int ret; - - radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); - - rrb = radeon_get_colorbuffer(&rmesa->radeon); - /* color buffer */ - if (rrb && rrb->bo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - rrb->bo, 0, - RADEON_GEM_DOMAIN_VRAM); - } - - /* depth buffer */ - rrb = radeon_get_depthbuffer(&rmesa->radeon); - if (rrb && rrb->bo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - rrb->bo, 0, - RADEON_GEM_DOMAIN_VRAM); - } - - for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { - radeonTexObj *t; - - if (!ctx->Texture.Unit[i]._ReallyEnabled) - continue; - - if (!evergreen_validate_texture(ctx, ctx->Texture.Unit[i]._Current, i)) { - radeon_warning("failed to validate texture for unit %d.\n", i); - } - t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); - if (t->image_override && t->bo) - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - t->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - else if (t->mt->bo) - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - t->mt->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - } - - pbo = (struct radeon_bo *)evergreenGetActiveFpShaderBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)evergreenGetActiveVpShaderBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)evergreenGetActiveFpShaderConstBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)evergreenGetActiveVpShaderConstBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, first_elem(&rmesa->radeon.dma.reserved)->bo, RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - return GL_TRUE; -} - -static struct gl_texture_object *evergreenNewTextureObject(struct gl_context * ctx, - GLuint name, - GLenum target) -{ - context_t* rmesa = EVERGREEN_CONTEXT(ctx); - radeonTexObj * t = CALLOC_STRUCT(radeon_tex_obj); - - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, - "%s( %p (target = %s) )\n", __FUNCTION__, - t, _mesa_lookup_enum_by_nr(target)); - - _mesa_initialize_texture_object(&t->base, name, target); - t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; - - evergreenSetTexDefaultState(t); - evergreenUpdateTexWrap(t); - evergreenSetTexFilter(t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter, t->base.Sampler.MaxAnisotropy); - evergreenSetTexBorderColor(t, t->base.Sampler.BorderColor.f); - - return &t->base; -} - -static void evergreenDeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) -{ - context_t * rmesa = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(rmesa); - radeonTexObj* t = radeon_tex_obj(texObj); - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, - "%s( %p (target = %s) )\n", __FUNCTION__, - (void *)texObj, - _mesa_lookup_enum_by_nr(texObj->Target)); - - if (rmesa) { - int i; - radeon_firevertices(&rmesa->radeon); - - for(i = 0; i < R700_MAX_TEXTURE_UNITS; ++i) - if (evergreen->textures[i] == t) - evergreen->textures[i] = 0; - } - - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - - radeon_miptree_unreference(&t->mt); - - _mesa_delete_texture_object(ctx, texObj); -} - -static void evergreenTexParameter(struct gl_context * ctx, GLenum target, - struct gl_texture_object *texObj, - GLenum pname, const GLfloat * params) -{ - radeonTexObj* t = radeon_tex_obj(texObj); - GLenum baseFormat; - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_VERBOSE, - "%s( %s )\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(pname)); - - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - evergreenSetTexFilter(t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, texObj->Sampler.MaxAnisotropy); - break; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_WRAP_R: - evergreenUpdateTexWrap(t); - break; - - case GL_TEXTURE_BORDER_COLOR: - evergreenSetTexBorderColor(t, texObj->Sampler.BorderColor.f); - break; - - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - t->validated = GL_FALSE; - break; - - case GL_DEPTH_TEXTURE_MODE: - if (!texObj->Image[0][texObj->BaseLevel]) - return; - baseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat; - if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH_STENCIL) { - evergreenSetDepthTexMode(texObj); - break; - } else { - /* If the texture isn't a depth texture, changing this - * state won't cause any changes to the hardware. - * Don't force a flush of texture state. - */ - return; - } - - default: - return; - } -} - -void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions) -{ - /* Note: we only plug in the functions we implement in the driver - * since _mesa_init_driver_functions() was already called. - */ - - radeon_init_common_texture_funcs(radeon, functions); - - functions->NewTextureObject = evergreenNewTextureObject; - functions->DeleteTexture = evergreenDeleteTexture; - functions->IsTextureResident = driIsTextureResident; - - functions->TexParameter = evergreenTexParameter; -} diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.h b/src/mesa/drivers/dri/r600/evergreen_tex.h deleted file mode 100644 index 982a087f8ed..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_tex.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2010 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _EVERGREEN_TEX_H_ -#define _EVERGREEN_TEX_H_ - -extern GLboolean evergreenValidateBuffers(struct gl_context * ctx); - -extern void evergreenUpdateTextureState(struct gl_context * ctx); -extern void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); -extern void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, - unsigned long long offset, GLint depth, GLuint pitch); -extern void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv); - -#endif /* _EVERGREEN_TEX_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c deleted file mode 100644 index 117916ac78f..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ /dev/null @@ -1,735 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/imports.h" -#include "main/mtypes.h" - -#include "tnl/t_context.h" -#include "program/program.h" -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" - -#include "radeon_debug.h" -#include "r600_context.h" -#include "r600_cmdbuf.h" -#include "r600_emit.h" -#include "program/programopt.h" - -#include "evergreen_vertprog.h" - -unsigned int evergreen_Map_Vertex_Output(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart) -{ - unsigned int i; - unsigned int unBit; - unsigned int unTotal = unStart; - - //!!!!!!! THE ORDER MATCH FS INPUT - - unBit = 1 << VERT_RESULT_HPOS; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_HPOS] = unTotal++; - } - - unBit = 1 << VERT_RESULT_COL0; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_COL0] = unTotal++; - } - - unBit = 1 << VERT_RESULT_COL1; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_COL1] = unTotal++; - } - - //TODO : dealing back face. - unBit = 1 << VERT_RESULT_BFC0; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_BFC0] = unTotal++; - } - - unBit = 1 << VERT_RESULT_BFC1; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_BFC1] = unTotal++; - } - - //TODO : dealing fog. - unBit = 1 << VERT_RESULT_FOGC; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_FOGC] = unTotal++; - } - - //TODO : dealing point size. - unBit = 1 << VERT_RESULT_PSIZ; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_PSIZ] = unTotal++; - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_TEX0 + i] = unTotal++; - } - } - - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[i] = unTotal++; - } - } - - return (unTotal - unStart); -} - -unsigned int evergreen_Map_Vertex_Input(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart) -{ - int i; - unsigned int unBit; - unsigned int unTotal = unStart; - for(i=0; i<VERT_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.InputsRead & unBit) - { - pAsm->ucVP_AttributeMap[i] = unTotal++; - } - } - return (unTotal - unStart); -} - -GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - int i; - unsigned int unBit; - VTX_FETCH_METHOD vtxFetchMethod; - vtxFetchMethod.bEnableMini = GL_FALSE; - vtxFetchMethod.mega_fetch_remainder = 0; - - for(i=0; i<VERT_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.InputsRead & unBit) - { - assemble_vfetch_instruction(&vp->r700AsmCode, - i, - vp->r700AsmCode.ucVP_AttributeMap[i], - vp->aos_desc[i].size, - vp->aos_desc[i].type, - &vtxFetchMethod); - } - } - - return GL_TRUE; -} - -GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - struct gl_context *ctx, - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - int i; - context_t *context = R700_CONTEXT(ctx); - - VTX_FETCH_METHOD vtxFetchMethod; - vtxFetchMethod.bEnableMini = GL_FALSE; - vtxFetchMethod.mega_fetch_remainder = 0; - - for(i=0; i<context->nNumActiveAos; i++) - { - EG_assemble_vfetch_instruction(&vp->r700AsmCode, - vp->r700AsmCode.ucVP_AttributeMap[context->stream_desc[i].element], - context->stream_desc[i].type, - context->stream_desc[i].size, - context->stream_desc[i].element, - context->stream_desc[i]._signed, - context->stream_desc[i].normalize, - context->stream_desc[i].format, - &vtxFetchMethod); - } - - return GL_TRUE; -} - -void evergreen_Map_Vertex_Program(struct gl_context *ctx, - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - r700_AssemblerBase *pAsm = &(vp->r700AsmCode); - unsigned int num_inputs; - - // R0 will always be used for index into vertex buffer - pAsm->number_used_registers = 1; - pAsm->starting_vfetch_register_number = pAsm->number_used_registers; - - // Map Inputs: Add 1 to mapping since R0 is used for index - num_inputs = evergreen_Map_Vertex_Input(pAsm, mesa_vp, pAsm->number_used_registers); - pAsm->number_used_registers += num_inputs; - - // Create VFETCH instructions for inputs - if (GL_TRUE != evergreen_Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) - { - radeon_error("Calling evergreen_Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); - return; - } - - // Map Outputs - pAsm->number_of_exports = evergreen_Map_Vertex_Output(pAsm, mesa_vp, pAsm->number_used_registers); - - pAsm->starting_export_register_number = pAsm->number_used_registers; - - pAsm->number_used_registers += pAsm->number_of_exports; - - /* Map temporary registers (GPRs) */ - pAsm->starting_temp_register_number = pAsm->number_used_registers; - - if(mesa_vp->Base.NumNativeTemporaries >= mesa_vp->Base.NumTemporaries) - { /* arb uses NumNativeTemporaries */ - pAsm->number_used_registers += mesa_vp->Base.NumNativeTemporaries; - } - else - { /* fix func t_vp uses NumTemporaries */ - pAsm->number_used_registers += mesa_vp->Base.NumTemporaries; - } - - pAsm->flag_reg_index = pAsm->number_used_registers++; - - pAsm->uFirstHelpReg = pAsm->number_used_registers; -} - -GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - GLuint i, j; - GLint * puiTEMPwrites; - struct prog_instruction *pILInst; - InstDeps *pInstDeps; - - puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_vp->Base.NumTemporaries); - for(i=0; i<mesa_vp->Base.NumTemporaries; i++) - { - puiTEMPwrites[i] = -1; - } - - pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_vp->Base.NumInstructions); - - for(i=0; i<mesa_vp->Base.NumInstructions; i++) - { - pInstDeps[i].nDstDep = -1; - pILInst = &(mesa_vp->Base.Instructions[i]); - - //Dst - if(pILInst->DstReg.File == PROGRAM_TEMPORARY) - { - //Set lastwrite for the temp - puiTEMPwrites[pILInst->DstReg.Index] = i; - } - - //Src - for(j=0; j<3; j++) - { - if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) - { - //Set dep. - pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; - } - else - { - pInstDeps[i].nSrcDeps[j] = -1; - } - } - } - - vp->r700AsmCode.pInstDeps = pInstDeps; - - FREE(puiTEMPwrites); - - return GL_TRUE; -} - -struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, - struct gl_vertex_program *mesa_vp) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - struct evergreen_vertex_program *vp; - unsigned int i; - - vp = calloc(1, sizeof(*vp)); - vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp); - - vp->constbo0 = NULL; - - if (mesa_vp->IsPositionInvariant) - { - _mesa_insert_mvp_code(ctx, vp->mesa_program); - } - - for(i=0; i<context->nNumActiveAos; i++) - { - vp->aos_desc[i].size = context->stream_desc[i].size; - vp->aos_desc[i].stride = context->stream_desc[i].stride; - vp->aos_desc[i].type = context->stream_desc[i].type; - vp->aos_desc[i].format = context->stream_desc[i].format; - } - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - { - vp->r700AsmCode.bR6xx = 1; - } - - //Init_Program - Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); - - vp->r700AsmCode.bUseMemConstant = GL_TRUE; - vp->r700AsmCode.unAsic = 8; - - evergreen_Map_Vertex_Program(ctx, vp, vp->mesa_program ); - - if(GL_FALSE == evergreen_Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) - { - return NULL; - } - - InitShaderProgram(&(vp->r700AsmCode)); - - for(i=0; i < MAX_SAMPLERS; i++) - { - vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i]; - } - - vp->r700AsmCode.unCurNumILInsts = vp->mesa_program->Base.NumInstructions; - - if(GL_FALSE == AssembleInstr(0, - 0, - vp->mesa_program->Base.NumInstructions, - &(vp->mesa_program->Base.Instructions[0]), - &(vp->r700AsmCode)) ) - { - return NULL; - } - - if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), vp->mesa_program->Base.OutputsWritten) ) - { - return NULL; - } - - if( GL_FALSE == RelocProgram(&(vp->r700AsmCode), &(vp->mesa_program->Base)) ) - { - return GL_FALSE; - } - - vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0 - : (vp->r700AsmCode.number_used_registers - 1); - - vp->r700Shader.nParamExports = vp->r700AsmCode.number_of_exports; - - vp->translated = GL_TRUE; - - return vp; -} - -void evergreenSelectVertexShader(struct gl_context *ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_vertex_program_cont *vpc; - struct evergreen_vertex_program *vp; - unsigned int i; - GLboolean match; - GLbitfield InputsRead; - - vpc = (struct evergreen_vertex_program_cont *)ctx->VertexProgram._Current; - - InputsRead = vpc->mesa_program.Base.InputsRead; - if (vpc->mesa_program.IsPositionInvariant) - { - InputsRead |= VERT_BIT_POS; - } - - for (vp = vpc->progs; vp; vp = vp->next) - { - match = GL_TRUE; - for(i=0; i<context->nNumActiveAos; i++) - { - if (vp->aos_desc[i].size != context->stream_desc[i].size || - vp->aos_desc[i].format != context->stream_desc[i].format) - { - match = GL_FALSE; - break; - } - } - if (match) - { - context->selected_vp = (struct r700_vertex_program *) vp; - return; - } - } - - vp = evergreenTranslateVertexShader(ctx, &(vpc->mesa_program)); - if(!vp) - { - radeon_error("Failed to translate vertex shader. \n"); - return; - } - vp->next = vpc->progs; - vpc->progs = vp; - context->selected_vp = (struct r700_vertex_program *) vp; - return; -} - -int evergreen_getTypeSize(GLenum type) -{ - switch (type) - { - case GL_DOUBLE: - return sizeof(GLdouble); - case GL_FLOAT: - return sizeof(GLfloat); - case GL_INT: - return sizeof(GLint); - case GL_UNSIGNED_INT: - return sizeof(GLuint); - case GL_SHORT: - return sizeof(GLshort); - case GL_UNSIGNED_SHORT: - return sizeof(GLushort); - case GL_BYTE: - return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: - return sizeof(GLubyte); - default: - assert(0); - return 0; - } -} - -static void evergreenTranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - - StreamDesc * pStreamDesc = &(context->stream_desc[context->nNumActiveAos]); - - GLuint stride; - - stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size - : input->StrideB; - - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT -#if MESA_BIG_ENDIAN - || evergreen_getTypeSize(input->Type) != 4 -#endif - ) - { - pStreamDesc->type = GL_FLOAT; - - if (input->StrideB == 0) - { - pStreamDesc->stride = 0; - } - else - { - pStreamDesc->stride = sizeof(GLfloat) * input->Size; - } - pStreamDesc->dwords = input->Size; - pStreamDesc->is_named_bo = GL_FALSE; - } - else - { - pStreamDesc->type = input->Type; - pStreamDesc->dwords = (evergreen_getTypeSize(input->Type) * input->Size + 3)/ 4; - if (!input->BufferObj->Name) - { - if (input->StrideB == 0) - { - pStreamDesc->stride = 0; - } - else - { - pStreamDesc->stride = (evergreen_getTypeSize(pStreamDesc->type) * input->Size + 3) & ~3; - } - - pStreamDesc->is_named_bo = GL_FALSE; - } - } - - pStreamDesc->size = input->Size; - pStreamDesc->dst_loc = context->nNumActiveAos; - pStreamDesc->element = unLoc; - pStreamDesc->format = input->Format; - - switch (pStreamDesc->type) - { //GetSurfaceFormat - case GL_FLOAT: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = GL_FALSE; - break; - case GL_SHORT: - pStreamDesc->_signed = 1; - pStreamDesc->normalize = input->Normalized; - break; - case GL_BYTE: - pStreamDesc->_signed = 1; - pStreamDesc->normalize = input->Normalized; - break; - case GL_UNSIGNED_SHORT: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = input->Normalized; - break; - case GL_UNSIGNED_BYTE: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = input->Normalized; - break; - default: - case GL_INT: - case GL_UNSIGNED_INT: - case GL_DOUBLE: - assert(0); - break; - } - context->nNumActiveAos++; -} - -void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_vertex_program *vpc - = (struct evergreen_vertex_program *)ctx->VertexProgram._Current; - - struct gl_vertex_program * mesa_vp = (struct gl_vertex_program *)&(vpc->mesa_program); - unsigned int unLoc = 0; - unsigned int unBit = mesa_vp->Base.InputsRead; - context->nNumActiveAos = 0; - - if (mesa_vp->IsPositionInvariant) - { - unBit |= VERT_BIT_POS; - } - - while(unBit) - { - if(unBit & 1) - { - evergreenTranslateAttrib(ctx, unLoc, count, arrays[unLoc]); - } - - unBit >>= 1; - ++unLoc; - } - context->radeon.tcl.aos_count = context->nNumActiveAos; -} - -void * evergreenGetActiveVpShaderBo(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *) context->selected_vp; - - if (vp) - return vp->shaderbo; - else - return NULL; -} - -void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *) context->selected_vp; - - if (vp) - return vp->constbo0; - else - return NULL; -} - -GLboolean evergreenSetupVertexProgram(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *) context->selected_vp; - - if(GL_FALSE == vp->loaded) - { - if(vp->r700Shader.bNeedsAssembly == GL_TRUE) - { - Assemble( &(vp->r700Shader) ); - } - - /* Load vp to gpu */ - r600EmitShader(ctx, - &(vp->shaderbo), - (GLvoid *)(vp->r700Shader.pProgram), - vp->r700Shader.uShaderBinaryDWORDSize, - "VS"); - - vp->loaded = GL_TRUE; - } - - EVERGREEN_STATECHANGE(context, vs); - - /* TODO : enable this after MemUse fixed *= - (context->chipobj.MemUse)(context, vp->shadercode.buf->id); - */ - - evergreen->SQ_PGM_RESOURCES_VS.u32All = 0; - SETbit(evergreen->SQ_PGM_RESOURCES_VS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); - - evergreen->vs.SQ_ALU_CONST_CACHE_VS_0.u32All = 0; /* set from buffer object. */ - - evergreen->vs.SQ_PGM_START_VS.u32All = 0; - - SETfield(evergreen->SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.nRegs + 1, - NUM_GPRS_shift, NUM_GPRS_mask); - - if(vp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ - { - SETfield(evergreen->SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.uStackSize, - STACK_SIZE_shift, STACK_SIZE_mask); - } - - EVERGREEN_STATECHANGE(context, spi); - - SETfield(evergreen->SPI_VS_OUT_CONFIG.u32All, - vp->r700Shader.nParamExports ? (vp->r700Shader.nParamExports - 1) : 0, - VS_EXPORT_COUNT_shift, VS_EXPORT_COUNT_mask); - SETfield(evergreen->SPI_PS_IN_CONTROL_0.u32All, vp->r700Shader.nParamExports, - NUM_INTERP_shift, NUM_INTERP_mask); - - /* - SETbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - */ - - return GL_TRUE; -} - -GLboolean evergreenSetupVPconstants(struct gl_context * ctx) -{ - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *) context->selected_vp; - - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui; - int alloc_size; - - /* sent out shader constants. */ - paramList = vp->mesa_program->Base.Parameters; - - if(NULL != paramList) { - /* vp->mesa_program was cloned, not updated by glsl shader api. */ - /* _mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current */ - /* so, use ctx->VertexProgem._Current */ - struct gl_program_parameter_list *paramListOrginal = - ctx->VertexProgram._Current->Base.Parameters; - - _mesa_load_state_parameters(ctx, paramList); - - if (paramList->NumParameters > EVERGREEN_MAX_DX9_CONSTS) - return GL_FALSE; - - EVERGREEN_STATECHANGE(context, vs); - - evergreen->vs.num_consts = paramList->NumParameters; - - unNumParamData = paramList->NumParameters; - - /* alloc multiple of 16 constants */ - alloc_size = ((unNumParamData * 4 * 4) + 255) & ~255; - - for(ui=0; ui<unNumParamData; ui++) { - if(paramList->Parameters[ui].Type == PROGRAM_UNIFORM) - { - evergreen->vs.consts[ui][0].f32All = paramListOrginal->ParameterValues[ui][0].f; - evergreen->vs.consts[ui][1].f32All = paramListOrginal->ParameterValues[ui][1].f; - evergreen->vs.consts[ui][2].f32All = paramListOrginal->ParameterValues[ui][2].f; - evergreen->vs.consts[ui][3].f32All = paramListOrginal->ParameterValues[ui][3].f; - } - else - { - evergreen->vs.consts[ui][0].f32All = paramList->ParameterValues[ui][0].f; - evergreen->vs.consts[ui][1].f32All = paramList->ParameterValues[ui][1].f; - evergreen->vs.consts[ui][2].f32All = paramList->ParameterValues[ui][2].f; - evergreen->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3].f; - } - } - - radeonAllocDmaRegion(&context->radeon, - &context->vp_Constbo, - &context->vp_bo_offset, - alloc_size, - 256); - r600EmitShaderConsts(ctx, - context->vp_Constbo, - context->vp_bo_offset, - (GLvoid *)&(evergreen->vs.consts[0][0]), - unNumParamData * 4 * 4); - } else - evergreen->vs.num_consts = 0; - - COMPILED_SUB * pCompiledSub; - GLuint uj; - GLuint unConstOffset = evergreen->vs.num_consts; - for(ui=0; ui<vp->r700AsmCode.unNumPresub; ui++) - { - pCompiledSub = vp->r700AsmCode.presubs[ui].pCompiledSub; - - evergreen->vs.num_consts += pCompiledSub->NumParameters; - - for(uj=0; uj<pCompiledSub->NumParameters; uj++) - { - evergreen->vs.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; - evergreen->vs.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; - evergreen->vs.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; - evergreen->vs.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; - } - unConstOffset += pCompiledSub->NumParameters; - } - - return GL_TRUE; -} - diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h deleted file mode 100644 index 8163e369277..00000000000 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#ifndef _EVERGREEN_VERTPROG_H_ -#define _EVERGREEN_VERTPROG_H_ - -#include "main/glheader.h" -#include "main/mtypes.h" - -#include "r700_shader.h" -#include "r700_assembler.h" - -typedef struct evergreenArrayDesc //TEMP -{ - GLint size; //number of data element - GLenum type; //data element type - GLsizei stride; - GLenum format; //GL_RGBA or GL_BGRA -} evergreenArrayDesc; - -struct evergreen_vertex_program -{ - struct gl_vertex_program *mesa_program; /* Must be first */ - - struct evergreen_vertex_program *next; - - r700_AssemblerBase r700AsmCode; - R700_Shader r700Shader; - - GLboolean translated; - GLboolean loaded; - - void * shaderbo; - - GLuint K0used; - void * constbo0; - - evergreenArrayDesc aos_desc[VERT_ATTRIB_MAX]; -}; - -struct evergreen_vertex_program_cont -{ - struct gl_vertex_program mesa_program; - - struct evergreen_vertex_program *progs; -}; - -//Internal -unsigned int evergreen_Map_Vertex_Output(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart); -unsigned int evergreen_Map_Vertex_Input(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart); -GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - struct gl_context *ctx, - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -void evergreen_Map_Vertex_Program(struct gl_context *ctx, - struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, - struct gl_vertex_program *mesa_vp); - -struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, - struct gl_vertex_program *mesa_vp); - -/* Interface */ -extern void evergreenSelectVertexShader(struct gl_context *ctx); -extern void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); - -extern GLboolean evergreenSetupVertexProgram(struct gl_context * ctx); - -extern GLboolean evergreenSetupVPconstants(struct gl_context * ctx); - -extern void * evergreenGetActiveVpShaderBo(struct gl_context * ctx); - -extern void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx); - -extern int evergreen_getTypeSize(GLenum type); - -#endif /* _EVERGREEN_VERTPROG_H_ */ diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c deleted file mode 100644 index a84f119e49a..00000000000 --- a/src/mesa/drivers/dri/r600/r600_blit.c +++ /dev/null @@ -1,1767 +0,0 @@ -/* - * Copyright (C) 2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_common.h" -#include "r600_context.h" - -#include "r600_blit.h" -#include "r600_blit_shaders.h" -#include "r600_cmdbuf.h" - -/* common formats supported as both textures and render targets */ -unsigned r600_check_blit(gl_format mesa_format) -{ - switch (mesa_format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - case MESA_FORMAT_RGB332: - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: - case MESA_FORMAT_L8: - case MESA_FORMAT_RGBA_FLOAT32: - case MESA_FORMAT_RGBA_FLOAT16: - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z16: - case MESA_FORMAT_Z32: - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SLA8: - case MESA_FORMAT_SL8: - break; - default: - return 0; - } - - /* ??? */ - /* not sure blit to depth works or not yet */ - if (_mesa_get_format_bits(mesa_format, GL_DEPTH_BITS) > 0) - return 0; - - return 1; -} - -static inline void -set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_format, - int nPitchInPixel, int w, int h, intptr_t dst_offset) -{ - uint32_t cb_color0_base, cb_color0_size = 0, cb_color0_info = 0, cb_color0_view = 0; - int id = 0; - uint32_t endian, comp_swap, format; - BATCH_LOCALS(&context->radeon); - - cb_color0_base = dst_offset / 256; - endian = ENDIAN_NONE; - - SETfield(cb_color0_size, (nPitchInPixel / 8) - 1, - PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask); - SETfield(cb_color0_size, ((nPitchInPixel * h) / 64) - 1, - SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask); - - SETfield(cb_color0_info, ARRAY_LINEAR_GENERAL, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - - SETbit(cb_color0_info, BLEND_BYPASS_bit); - - switch(mesa_format) { - case MESA_FORMAT_RGBA8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_SIGNED_RGBA8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_SNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGBA8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_SIGNED_RGBA8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_SNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGB565: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - comp_swap = SWAP_STD_REV; - format = COLOR_5_6_5; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGB565_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - comp_swap = SWAP_STD; - format = COLOR_5_6_5; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB4444: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB4444_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB1555: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ARGB1555_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_AL88: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_AL88_REV: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_STD_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGB332: - format = COLOR_3_3_2; - comp_swap = SWAP_STD_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_A8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_I8: - format = COLOR_8; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_L8: - format = COLOR_8; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGBA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_32_32_32_FLOAT; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, BLEND_FLOAT32_bit); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_RGBA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_16_16_16_FLOAT; - comp_swap = SWAP_STD; - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, BLEND_FLOAT32_bit); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT_REV; - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, BLEND_FLOAT32_bit); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT; - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_32_FLOAT; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, BLEND_FLOAT32_bit); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_16_FLOAT; - comp_swap = SWAP_ALT_REV; - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32_FLOAT; - comp_swap = SWAP_STD; - SETbit(cb_color0_info, BLEND_FLOAT32_bit); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16_FLOAT; - comp_swap = SWAP_STD; - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_24; - comp_swap = SWAP_STD; - SETfield(cb_color0_info, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_Z24_S8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_24_8; - comp_swap = SWAP_STD; - SETfield(cb_color0_info, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_Z16: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_16; - comp_swap = SWAP_STD; - SETfield(cb_color0_info, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_Z32: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_32; - comp_swap = SWAP_STD; - SETfield(cb_color0_info, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_SARGB8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN32; -#endif - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_SRGB, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_SLA8: -#ifdef MESA_BIG_ENDIAN - endian = ENDIAN_8IN16; -#endif - format = COLOR_8_8; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_SRGB, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - case MESA_FORMAT_SL8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - SETbit(cb_color0_info, SOURCE_FORMAT_bit); - SETfield(cb_color0_info, NUMBER_SRGB, NUMBER_TYPE_shift, NUMBER_TYPE_mask); - break; - default: - fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format)); - assert("Invalid format for US output\n"); - return; - } - - /* must be 0 on r7xx */ - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - CLEARbit(cb_color0_info, BLEND_FLOAT32_bit); - - SETfield(cb_color0_info, endian, ENDIAN_shift, ENDIAN_mask); - SETfield(cb_color0_info, format, CB_COLOR0_INFO__FORMAT_shift, - CB_COLOR0_INFO__FORMAT_mask); - SETfield(cb_color0_info, comp_swap, COMP_SWAP_shift, COMP_SWAP_mask); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_BASE + (4 * id), 1); - R600_OUT_BATCH(cb_color0_base); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - - if ((context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) && - (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)) { - BEGIN_BATCH_NO_AUTOSTATE(2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SURFACE_BASE_UPDATE, 0)); - R600_OUT_BATCH((2 << id)); - END_BATCH(); - } - - /* Set CMASK & TILE buffer to the offset of color buffer as - * we don't use those this shouldn't cause any issue and we - * then have a valid cmd stream - */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_TILE + (4 * id), 1); - R600_OUT_BATCH(cb_color0_base); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_FRAG + (4 * id), 1); - R600_OUT_BATCH(cb_color0_base); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(CB_COLOR0_SIZE + (4 * id), cb_color0_size); - R600_OUT_BATCH_REGVAL(CB_COLOR0_VIEW + (4 * id), cb_color0_view); - R600_OUT_BATCH_REGVAL(CB_COLOR0_MASK + (4 * id), 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGVAL(CB_COLOR0_INFO + (4 * id), cb_color0_info); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void load_shaders(struct gl_context * ctx) -{ - - radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); - context_t *context = R700_CONTEXT(ctx); - int i, size; - uint32_t *shader; - - if (context->blit_bo_loaded == 1) - return; - - size = 4096; - context->blit_bo = radeon_bo_open(radeonctx->radeonScreen->bom, 0, - size, 256, RADEON_GEM_DOMAIN_GTT, 0); - radeon_bo_map(context->blit_bo, 1); - shader = context->blit_bo->ptr; - - for(i=0; i<sizeof(r6xx_vs)/4; i++) { - shader[128+i] = CPU_TO_LE32(r6xx_vs[i]); - } - for(i=0; i<sizeof(r6xx_ps)/4; i++) { - shader[256+i] = CPU_TO_LE32(r6xx_ps[i]); - } - - radeon_bo_unmap(context->blit_bo); - context->blit_bo_loaded = 1; - -} - -static inline void -set_shaders(context_t *context) -{ - struct radeon_bo * pbo = context->blit_bo; - BATCH_LOCALS(&context->radeon); - - uint32_t sq_pgm_start_fs = (512 >> 8); - uint32_t sq_pgm_resources_fs = 0; - uint32_t sq_pgm_cf_offset_fs = 0; - - uint32_t sq_pgm_start_vs = (512 >> 8); - uint32_t sq_pgm_resources_vs = (1 << NUM_GPRS_shift); - uint32_t sq_pgm_cf_offset_vs = 0; - - uint32_t sq_pgm_start_ps = (1024 >> 8); - uint32_t sq_pgm_resources_ps = (1 << NUM_GPRS_shift); - uint32_t sq_pgm_cf_offset_ps = 0; - uint32_t sq_pgm_exports_ps = (1 << 1); - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - /* FS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_FS, 1); - R600_OUT_BATCH(sq_pgm_start_fs); - R600_OUT_BATCH_RELOC(sq_pgm_start_fs, - pbo, - sq_pgm_start_fs, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_FS, sq_pgm_resources_fs); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_FS, sq_pgm_cf_offset_fs); - END_BATCH(); - - /* VS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1); - R600_OUT_BATCH(sq_pgm_start_vs); - R600_OUT_BATCH_RELOC(sq_pgm_start_vs, - pbo, - sq_pgm_start_vs, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, sq_pgm_resources_vs); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, sq_pgm_cf_offset_vs); - END_BATCH(); - - /* PS */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1); - R600_OUT_BATCH(sq_pgm_start_ps); - R600_OUT_BATCH_RELOC(sq_pgm_start_ps, - pbo, - sq_pgm_start_ps, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, sq_pgm_resources_ps); - R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, sq_pgm_exports_ps); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, sq_pgm_cf_offset_ps); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(18); - R600_OUT_BATCH_REGVAL(SPI_VS_OUT_CONFIG, 0); //EXPORT_COUNT is - 1 - R600_OUT_BATCH_REGVAL(SPI_VS_OUT_ID_0, 0); - R600_OUT_BATCH_REGVAL(SPI_PS_INPUT_CNTL_0, SEL_CENTROID_bit); - R600_OUT_BATCH_REGVAL(SPI_PS_IN_CONTROL_0, (1 << NUM_INTERP_shift)); - R600_OUT_BATCH_REGVAL(SPI_PS_IN_CONTROL_1, 0); - R600_OUT_BATCH_REGVAL(SPI_INTERP_CONTROL_0, 0); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void -set_vtx_resource(context_t *context) -{ - struct radeon_bo *bo = context->blit_bo; - uint32_t sq_vtx_constant_word2 = 0; - - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - END_BATCH(); - COMMIT_BATCH(); - - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) - r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); - else - r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - - sq_vtx_constant_word2 = 0 -#ifdef MESA_BIG_ENDIAN - | (SQ_ENDIAN_8IN32 << SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift) -#endif - | (16 << SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 2); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - R600_OUT_BATCH(SQ_FETCH_RESOURCE_VS_OFFSET * FETCH_RESOURCE_STRIDE); - R600_OUT_BATCH(0); - R600_OUT_BATCH(48 - 1); - R600_OUT_BATCH(sq_vtx_constant_word2); - R600_OUT_BATCH(1 << MEM_REQUEST_SIZE_shift); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(SQ_TEX_VTX_VALID_BUFFER << SQ_TEX_RESOURCE_WORD6_0__TYPE_shift); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - -} - -static inline void -set_tex_resource(context_t * context, - gl_format mesa_format, struct radeon_bo *bo, int w, int h, - int TexelPitch, intptr_t src_offset) -{ - uint32_t sq_tex_resource0, sq_tex_resource1, sq_tex_resource2, sq_tex_resource4, sq_tex_resource6; - - sq_tex_resource0 = sq_tex_resource1 = sq_tex_resource2 = sq_tex_resource4 = sq_tex_resource6 = 0; - BATCH_LOCALS(&context->radeon); - - SETfield(sq_tex_resource0, SQ_TEX_DIM_2D, DIM_shift, DIM_mask); - SETfield(sq_tex_resource0, ARRAY_LINEAR_GENERAL, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - - switch (mesa_format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_ARGB8888: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_XRGB8888: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB8888_REV: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_XRGB8888_REV: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB565: - SETfield(sq_tex_resource1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB565_REV: - SETfield(sq_tex_resource1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB4444: - SETfield(sq_tex_resource1, FMT_4_4_4_4, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB4444_REV: - SETfield(sq_tex_resource1, FMT_4_4_4_4, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB1555: - SETfield(sq_tex_resource1, FMT_1_5_5_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ARGB1555_REV: - SETfield(sq_tex_resource1, FMT_1_5_5_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: /* TODO : Check this. */ - SETfield(sq_tex_resource1, FMT_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB332: - SETfield(sq_tex_resource1, FMT_3_3_2, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_L8: /* X, X, X, ONE */ - SETfield(sq_tex_resource1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_I8: /* X, X, X, X */ - SETfield(sq_tex_resource1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT32: - SETfield(sq_tex_resource1, FMT_32_32_32_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT16: - SETfield(sq_tex_resource1, FMT_16_16_16_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */ - SETfield(sq_tex_resource1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */ - SETfield(sq_tex_resource1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */ - SETfield(sq_tex_resource1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - SETfield(sq_tex_resource1, FMT_32_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - SETfield(sq_tex_resource1, FMT_16_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - SETfield(sq_tex_resource1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - SETfield(sq_tex_resource1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z16: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_16, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_X8_Z24: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_8_24, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_S8_Z24: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_8_24, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z24_S8: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_24_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z32: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_32, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_S8: - SETbit(sq_tex_resource0, TILE_TYPE_bit); - SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - SETfield(sq_tex_resource1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_SARGB8: - SETfield(sq_tex_resource1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SLA8: - SETfield(sq_tex_resource1, FMT_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SL8: /* X, X, X, ONE */ - SETfield(sq_tex_resource1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(sq_tex_resource4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(sq_tex_resource4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - default: - fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format)); - assert("Invalid format for US output\n"); - return; - }; - - SETfield(sq_tex_resource0, (TexelPitch/8)-1, PITCH_shift, PITCH_mask); - SETfield(sq_tex_resource0, w - 1, TEX_WIDTH_shift, TEX_WIDTH_mask); - SETfield(sq_tex_resource1, h - 1, TEX_HEIGHT_shift, TEX_HEIGHT_mask); - - sq_tex_resource2 = src_offset / 256; - - SETfield(sq_tex_resource6, SQ_TEX_VTX_VALID_TEXTURE, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, - SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - r700SyncSurf(context, bo, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, - 0, TC_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 4); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - R600_OUT_BATCH(0 * 7); - - R600_OUT_BATCH(sq_tex_resource0); - R600_OUT_BATCH(sq_tex_resource1); - R600_OUT_BATCH(sq_tex_resource2); - R600_OUT_BATCH(0); //SQ_TEX_RESOURCE3 - R600_OUT_BATCH(sq_tex_resource4); - R600_OUT_BATCH(0); //SQ_TEX_RESOURCE5 - R600_OUT_BATCH(sq_tex_resource6); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - R600_OUT_BATCH_RELOC(0, - bo, - 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - END_BATCH(); - COMMIT_BATCH(); -} - -static inline void -set_tex_sampler(context_t * context) -{ - uint32_t sq_tex_sampler_word0 = 0, sq_tex_sampler_word1 = 0, sq_tex_sampler_word2 = 0; - int i = 0; - - SETbit(sq_tex_sampler_word2, SQ_TEX_SAMPLER_WORD2_0__TYPE_bit); - - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(5); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); - R600_OUT_BATCH(i * 3); - R600_OUT_BATCH(sq_tex_sampler_word0); - R600_OUT_BATCH(sq_tex_sampler_word1); - R600_OUT_BATCH(sq_tex_sampler_word2); - END_BATCH(); - -} - -static inline void -set_scissors(context_t *context, int x1, int y1, int x2, int y2) -{ - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(17); - R600_OUT_BATCH_REGSEQ(PA_SC_SCREEN_SCISSOR_TL, 2); - R600_OUT_BATCH((x1 << 0) | (y1 << 16)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - R600_OUT_BATCH_REGSEQ(PA_SC_WINDOW_OFFSET, 3); - R600_OUT_BATCH(0); //PA_SC_WINDOW_OFFSET - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); //PA_SC_WINDOW_SCISSOR_TL - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - R600_OUT_BATCH_REGSEQ(PA_SC_GENERIC_SCISSOR_TL, 2); - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - - /* XXX 16 of these PA_SC_VPORT_SCISSOR_0_TL_num ... */ - R600_OUT_BATCH_REGSEQ(PA_SC_VPORT_SCISSOR_0_TL, 2 ); - R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); - R600_OUT_BATCH((x2 << 0) | (y2 << 16)); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static inline void -set_vb_data(context_t * context, int src_x, int src_y, int dst_x, int dst_y, - int w, int h, int src_h, unsigned flip_y) -{ - float *vb; - radeon_bo_map(context->blit_bo, 1); - vb = context->blit_bo->ptr; - - vb[0] = (float)(dst_x); - vb[1] = (float)(dst_y); - vb[2] = (float)(src_x); - vb[3] = (flip_y) ? (float)(src_h - src_y) : (float)src_y; - - vb[4] = (float)(dst_x); - vb[5] = (float)(dst_y + h); - vb[6] = (float)(src_x); - vb[7] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h); - - vb[8] = (float)(dst_x + w); - vb[9] = (float)(dst_y + h); - vb[10] = (float)(src_x + w); - vb[11] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h); - - radeon_bo_unmap(context->blit_bo); - -} - -static inline void -draw_auto(context_t *context) -{ - BATCH_LOCALS(&context->radeon); - uint32_t vgt_primitive_type = 0, vgt_index_type = 0, vgt_draw_initiator = 0, vgt_num_indices; - - SETfield(vgt_primitive_type, DI_PT_RECTLIST, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, - INDEX_TYPE_mask); - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, - MAJOR_MODE_mask); - SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, - SOURCE_SELECT_mask); - - vgt_num_indices = 3; - - BEGIN_BATCH_NO_AUTOSTATE(10); - // prim - R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - // - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - - END_BATCH(); - COMMIT_BATCH(); -} - -static inline void -set_default_state(context_t *context) -{ - int ps_prio = 0; - int vs_prio = 1; - int gs_prio = 2; - int es_prio = 3; - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - uint32_t sq_config, sq_gpr_resource_mgmt_1, sq_gpr_resource_mgmt_2; - uint32_t sq_thread_resource_mgmt, sq_stack_resource_mgmt_1, sq_stack_resource_mgmt_2; - uint32_t ta_cntl_aux, db_watermarks, sq_dyn_gpr_cntl_ps_flush_req, db_debug; - BATCH_LOCALS(&context->radeon); - - switch (context->radeon.radeonScreen->chip_family) { - case CHIP_FAMILY_R600: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV630: - case CHIP_FAMILY_RV635: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 40; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV610: - case CHIP_FAMILY_RV620: - case CHIP_FAMILY_RS780: - case CHIP_FAMILY_RS880: - default: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV670: - num_ps_gprs = 144; - num_vs_gprs = 40; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV770: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 256; - num_vs_stack_entries = 256; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV730: - case CHIP_FAMILY_RV740: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV710: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 48; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - } - - sq_config = 0; - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) - CLEARbit(sq_config, VC_ENABLE_bit); - else - SETbit(sq_config, VC_ENABLE_bit); - SETbit(sq_config, DX9_CONSTS_bit); - SETbit(sq_config, ALU_INST_PREFER_VECTOR_bit); - SETfield(sq_config, ps_prio, PS_PRIO_shift, PS_PRIO_mask); - SETfield(sq_config, vs_prio, VS_PRIO_shift, VS_PRIO_mask); - SETfield(sq_config, gs_prio, GS_PRIO_shift, GS_PRIO_mask); - SETfield(sq_config, es_prio, ES_PRIO_shift, ES_PRIO_mask); - - sq_gpr_resource_mgmt_1 = 0; - SETfield(sq_gpr_resource_mgmt_1, num_ps_gprs, NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_1, num_vs_gprs, NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_1, num_temp_gprs, - NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask); - - sq_gpr_resource_mgmt_2 = 0; - SETfield(sq_gpr_resource_mgmt_2, num_gs_gprs, NUM_GS_GPRS_shift, NUM_GS_GPRS_mask); - SETfield(sq_gpr_resource_mgmt_2, num_es_gprs, NUM_ES_GPRS_shift, NUM_ES_GPRS_mask); - - sq_thread_resource_mgmt = 0; - SETfield(sq_thread_resource_mgmt, num_ps_threads, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_vs_threads, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_gs_threads, - NUM_GS_THREADS_shift, NUM_GS_THREADS_mask); - SETfield(sq_thread_resource_mgmt, num_es_threads, - NUM_ES_THREADS_shift, NUM_ES_THREADS_mask); - - sq_stack_resource_mgmt_1 = 0; - SETfield(sq_stack_resource_mgmt_1, num_ps_stack_entries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_1, num_vs_stack_entries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - - sq_stack_resource_mgmt_2 = 0; - SETfield(sq_stack_resource_mgmt_2, num_gs_stack_entries, - NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask); - SETfield(sq_stack_resource_mgmt_2, num_es_stack_entries, - NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask); - - ta_cntl_aux = 0; - SETfield(ta_cntl_aux, 28, TD_FIFO_CREDIT_shift, TD_FIFO_CREDIT_mask); - db_watermarks = 0; - SETfield(db_watermarks, 4, DEPTH_FREE_shift, DEPTH_FREE_mask); - SETfield(db_watermarks, 16, DEPTH_FLUSH_shift, DEPTH_FLUSH_mask); - SETfield(db_watermarks, 0, FORCE_SUMMARIZE_shift, FORCE_SUMMARIZE_mask); - SETfield(db_watermarks, 4, DEPTH_PENDING_FREE_shift, DEPTH_PENDING_FREE_mask); - sq_dyn_gpr_cntl_ps_flush_req = 0; - db_debug = 0; - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { - SETfield(ta_cntl_aux, 3, GRADIENT_CREDIT_shift, GRADIENT_CREDIT_mask); - db_debug = 0x82000000; - SETfield(db_watermarks, 16, DEPTH_CACHELINE_FREE_shift, DEPTH_CACHELINE_FREE_mask); - } else { - SETfield(ta_cntl_aux, 2, GRADIENT_CREDIT_shift, GRADIENT_CREDIT_mask); - SETfield(db_watermarks, 4, DEPTH_CACHELINE_FREE_shift, DEPTH_CACHELINE_FREE_mask); - SETbit(sq_dyn_gpr_cntl_ps_flush_req, VS_PC_LIMIT_ENABLE_bit); - } - - BEGIN_BATCH_NO_AUTOSTATE(120); - R600_OUT_BATCH_REGSEQ(SQ_CONFIG, 6); - R600_OUT_BATCH(sq_config); - R600_OUT_BATCH(sq_gpr_resource_mgmt_1); - R600_OUT_BATCH(sq_gpr_resource_mgmt_2); - R600_OUT_BATCH(sq_thread_resource_mgmt); - R600_OUT_BATCH(sq_stack_resource_mgmt_1); - R600_OUT_BATCH(sq_stack_resource_mgmt_2); - - R600_OUT_BATCH_REGVAL(TA_CNTL_AUX, ta_cntl_aux); - R600_OUT_BATCH_REGVAL(VC_ENHANCE, 0); - R600_OUT_BATCH_REGVAL(R7xx_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, sq_dyn_gpr_cntl_ps_flush_req); - R600_OUT_BATCH_REGVAL(DB_DEBUG, db_debug); - R600_OUT_BATCH_REGVAL(DB_WATERMARKS, db_watermarks); - - R600_OUT_BATCH_REGSEQ(SQ_ESGS_RING_ITEMSIZE, 9); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - - R600_OUT_BATCH_REGVAL(CB_CLRCMP_CONTROL, - (CLRCMP_SEL_SRC << CLRCMP_FCN_SEL_shift)); - R600_OUT_BATCH_REGVAL(SQ_VTX_BASE_VTX_LOC, 0); - R600_OUT_BATCH_REGVAL(SQ_VTX_START_INST_LOC, 0); - R600_OUT_BATCH_REGVAL(DB_DEPTH_CONTROL, 0); - R600_OUT_BATCH_REGVAL(CB_SHADER_MASK, (OUTPUT0_ENABLE_mask)); - R600_OUT_BATCH_REGVAL(CB_TARGET_MASK, (TARGET0_ENABLE_mask)); - R600_OUT_BATCH_REGVAL(R7xx_CB_SHADER_CONTROL, (RT0_ENABLE_bit)); - R600_OUT_BATCH_REGVAL(CB_COLOR_CONTROL, (0xcc << ROP3_shift)); - - R600_OUT_BATCH_REGVAL(PA_CL_VTE_CNTL, VTX_XY_FMT_bit); - R600_OUT_BATCH_REGVAL(PA_CL_VS_OUT_CNTL, 0); - R600_OUT_BATCH_REGVAL(PA_CL_CLIP_CNTL, CLIP_DISABLE_bit); - R600_OUT_BATCH_REGVAL(PA_SU_SC_MODE_CNTL, (FACE_bit) | - (POLYMODE_PTYPE__TRIANGLES << POLYMODE_FRONT_PTYPE_shift) | - (POLYMODE_PTYPE__TRIANGLES << POLYMODE_BACK_PTYPE_shift)); - R600_OUT_BATCH_REGVAL(PA_SU_VTX_CNTL, (PIX_CENTER_bit) | - (X_ROUND_TO_EVEN << PA_SU_VTX_CNTL__ROUND_MODE_shift) | - (X_1_256TH << QUANT_MODE_shift)); - R600_OUT_BATCH_REGVAL(PA_SC_AA_CONFIG, 0); - - R600_OUT_BATCH_REGSEQ(VGT_MAX_VTX_INDX, 4); - R600_OUT_BATCH(0xffffff); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - - R600_OUT_BATCH_REGSEQ(VGT_OUTPUT_PATH_CNTL, 13); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - - R600_OUT_BATCH_REGVAL(VGT_PRIMITIVEID_EN, 0); - R600_OUT_BATCH_REGVAL(VGT_MULTI_PRIM_IB_RESET_EN, 0); - R600_OUT_BATCH_REGVAL(VGT_INSTANCE_STEP_RATE_0, 0); - R600_OUT_BATCH_REGVAL(VGT_INSTANCE_STEP_RATE_1, 0); - - R600_OUT_BATCH_REGSEQ(VGT_STRMOUT_EN, 3); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - - R600_OUT_BATCH_REGVAL(VGT_STRMOUT_BUFFER_EN, 0); - R600_OUT_BATCH_REGVAL(SX_ALPHA_TEST_CONTROL, 0); - - END_BATCH(); - COMMIT_BATCH(); -} - -static GLboolean validate_buffers(context_t *rmesa, - struct radeon_bo *src_bo, - struct radeon_bo *dst_bo) -{ - int ret; - - radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT); - if (ret) - return GL_FALSE; - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, - rmesa->blit_bo, - RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - - return GL_TRUE; -} - -unsigned r600_blit(struct gl_context *ctx, - struct radeon_bo *src_bo, - intptr_t src_offset, - gl_format src_mesaformat, - unsigned src_pitch, - unsigned src_width, - unsigned src_height, - unsigned src_x, - unsigned src_y, - struct radeon_bo *dst_bo, - intptr_t dst_offset, - gl_format dst_mesaformat, - unsigned dst_pitch, - unsigned dst_width, - unsigned dst_height, - unsigned dst_x, - unsigned dst_y, - unsigned w, - unsigned h, - unsigned flip_y) -{ - context_t *context = R700_CONTEXT(ctx); - int id = 0; - - if (!r600_check_blit(dst_mesaformat)) - return GL_FALSE; - - if (src_bo == dst_bo) { - return GL_FALSE; - } - - if (src_offset % 256 || dst_offset % 256) { - return GL_FALSE; - } - - if (0) { - fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n", - src_width, src_height, src_pitch, - _mesa_format_row_stride(src_mesaformat, src_width), - _mesa_get_format_name(src_mesaformat)); - fprintf(stderr, "dst: width %d, height %d, pitch %d, format %s\n", - dst_width, dst_height, - _mesa_format_row_stride(dst_mesaformat, dst_width), - _mesa_get_format_name(dst_mesaformat)); - } - - /* Flush is needed to make sure that source buffer has correct data */ - radeonFlush(ctx); - - rcommonEnsureCmdBufSpace(&context->radeon, 311, __FUNCTION__); - - /* load shaders */ - load_shaders(context->radeon.glCtx); - - if (!validate_buffers(context, src_bo, dst_bo)) - return GL_FALSE; - - /* set clear state */ - /* 120 */ - set_default_state(context); - - /* shaders */ - /* 72 */ - set_shaders(context); - - /* src */ - /* 20 */ - set_tex_resource(context, src_mesaformat, src_bo, - src_width, src_height, src_pitch, src_offset); - - /* 5 */ - set_tex_sampler(context); - - /* dst */ - /* 31 */ - set_render_target(context, dst_bo, dst_mesaformat, - dst_pitch, dst_width, dst_height, dst_offset); - /* scissors */ - /* 17 */ - set_scissors(context, dst_x, dst_y, dst_x + dst_width, dst_y + dst_height); - - set_vb_data(context, src_x, src_y, dst_x, dst_y, w, h, src_height, flip_y); - /* Vertex buffer setup */ - /* 24 */ - set_vtx_resource(context); - - /* draw */ - /* 10 */ - draw_auto(context); - - /* 7 */ - r700SyncSurf(context, dst_bo, 0, - RADEON_GEM_DOMAIN_VRAM|RADEON_GEM_DOMAIN_GTT, - CB_ACTION_ENA_bit | (1 << (id + 6))); - - /* 5 */ - /* XXX drm should handle this in fence submit */ - r700WaitForIdleClean(context); - - radeonFlush(ctx); - - return GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/r600_blit.h b/src/mesa/drivers/dri/r600/r600_blit.h deleted file mode 100644 index 9dc8e2fec64..00000000000 --- a/src/mesa/drivers/dri/r600/r600_blit.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 R600_BLIT_H -#define R600_BLIT_H - -unsigned r600_check_blit(gl_format mesa_format); - -unsigned r600_blit(struct gl_context *ctx, - struct radeon_bo *src_bo, - intptr_t src_offset, - gl_format src_mesaformat, - unsigned src_pitch, - unsigned src_width, - unsigned src_height, - unsigned src_x_offset, - unsigned src_y_offset, - struct radeon_bo *dst_bo, - intptr_t dst_offset, - gl_format dst_mesaformat, - unsigned dst_pitch, - unsigned dst_width, - unsigned dst_height, - unsigned dst_x_offset, - unsigned dst_y_offset, - unsigned w, - unsigned h, - unsigned flip_y); - -#endif // R600_BLIT_H diff --git a/src/mesa/drivers/dri/r600/r600_blit_shaders.h b/src/mesa/drivers/dri/r600/r600_blit_shaders.h deleted file mode 100644 index 2124f7673d7..00000000000 --- a/src/mesa/drivers/dri/r600/r600_blit_shaders.h +++ /dev/null @@ -1,32 +0,0 @@ -const uint32_t r6xx_vs[] = -{ - 0x00000004, // CF_DWORD0(ADDR(4)) - 0x81000000, // SQ_CF_INST_VTX COUNT(1) - 0x0000203c, // CF_EXP_IMP CF_POS0 SQ_EXPORT_POS RW_GPR(0) ELEM_SIZE(0) - 0x94000b08, // SQ_CF_INST_EXPORT_DONE SWZ XY01 BARRIER(1) - 0x00004000, // CF_EXP_IMP 0 SQ_EXPORT_PARAM RW_GPR(0) ELEM_SIZE(0) - 0x14200b1a, // SQ_CF_INST_EXPORT_DONE SWZ ZW01 EOP(1) BARRIER(0) - 0x00000000, - 0x00000000, - 0x3c000000, // SQ_VTX_INST_FETCH BUFFER_ID(0) MEGA_FETCH_COUNT(16) - 0x68cd1000, // DST_GPR(0) DST_SWZ: XYZW DATA_FORMAT(35) SQ_NUM_FORMAT_SCALED SQ_FORMAT_COMP_SIGNED -#ifdef MESA_BIG_ENDIAN - 0x000a0000, // ENDIAN_SWAP(SQ_ENDIAN_8IN32) MEGA_FETCH(1) -#else - 0x00080000, // ENDIAN_SWAP(SQ_ENDIAN_NONE) MEGA_FETCH(1) -#endif - 0x00000000, // VTX_DWORD_PAD -}; - -const uint32_t r6xx_ps[] = -{ - 0x00000002, // CF_DWORD0 AADR(2) - 0x80800000, // SQ_CF_INST_TEX COUNT(1) - 0x00000000, // CF_ALLOC_IMP_EXP0 SQ_EXPORT_PIXEL RW_GPR(0) ELEM_SIZE(0) - 0x94200688, // SQ_CF_INST_EXPORT_DONE EOP(1) BARRIER(1) SWZ: XYZW - 0x00000010, // SQ_TEX_INST_SAMPLE SRC_GPR(0) RESOURCE_ID(0) - 0x000d1000, // DST_GPR(0) SWZ: XYZW TEX_UNNORMALIZED - 0xb0800000, // SAMPLER_ID(0) SRC_SWZ XYZW - 0x00000000, // TEX_DWORD_PAD -}; - diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c deleted file mode 100644 index 74f048b1062..00000000000 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c +++ /dev/null @@ -1,521 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - -**************************************************************************/ - -/** - * Mostly coppied from \radeon\radeon_cs_legacy.c - */ - -#include <errno.h> - -#include "main/glheader.h" -#include "main/state.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/simple_list.h" - -#include "drm.h" -#include "radeon_drm.h" - -#include "r600_context.h" -#include "radeon_reg.h" -#include "r600_cmdbuf.h" -#include "radeon_bocs_wrapper.h" - -#ifdef HAVE_LIBDRM_RADEON -#include "radeon_cs_int.h" -#else -#include "radeon_cs_int_drm.h" -#endif - -struct r600_cs_manager_legacy -{ - struct radeon_cs_manager base; - struct radeon_context *ctx; - /* hack for scratch stuff */ - uint32_t pending_age; - uint32_t pending_count; -}; - -struct r600_cs_reloc_legacy { - struct radeon_cs_reloc base; - uint32_t cindices; - uint32_t *indices; - uint32_t *reloc_indices; -}; - -static struct radeon_cs_int *r600_cs_create(struct radeon_cs_manager *csm, - uint32_t ndw) -{ - struct radeon_cs_int *csi; - - csi = (struct radeon_cs_int*)calloc(1, sizeof(struct radeon_cs_int)); - if (csi == NULL) { - return NULL; - } - csi->csm = csm; - csi->ndw = (ndw + 0x3FF) & (~0x3FF); - csi->packets = (uint32_t*)malloc(4*csi->ndw); - if (csi->packets == NULL) { - free(csi); - return NULL; - } - csi->relocs_total_size = 0; - return csi; -} - -static int r600_cs_write_reloc(struct radeon_cs_int *csi, - struct radeon_bo *bo, - uint32_t read_domain, - uint32_t write_domain, - uint32_t flags) -{ - struct r600_cs_reloc_legacy *relocs; - int i; - - relocs = (struct r600_cs_reloc_legacy *)csi->relocs; - /* check domains */ - if ((read_domain && write_domain) || (!read_domain && !write_domain)) { - /* in one CS a bo can only be in read or write domain but not - * in read & write domain at the same sime - */ - return -EINVAL; - } - if (read_domain == RADEON_GEM_DOMAIN_CPU) { - return -EINVAL; - } - if (write_domain == RADEON_GEM_DOMAIN_CPU) { - return -EINVAL; - } - /* check if bo is already referenced */ - for(i = 0; i < csi->crelocs; i++) { - uint32_t *indices; - uint32_t *reloc_indices; - - if (relocs[i].base.bo->handle == bo->handle) { - /* Check domains must be in read or write. As we check already - * checked that in argument one of the read or write domain was - * set we only need to check that if previous reloc as the read - * domain set then the read_domain should also be set for this - * new relocation. - */ - if (relocs[i].base.read_domain && !read_domain) { - return -EINVAL; - } - if (relocs[i].base.write_domain && !write_domain) { - return -EINVAL; - } - relocs[i].base.read_domain |= read_domain; - relocs[i].base.write_domain |= write_domain; - /* save indice */ - relocs[i].cindices++; - indices = (uint32_t*)realloc(relocs[i].indices, - relocs[i].cindices * 4); - reloc_indices = (uint32_t*)realloc(relocs[i].reloc_indices, - relocs[i].cindices * 4); - if ( (indices == NULL) || (reloc_indices == NULL) ) { - relocs[i].cindices -= 1; - return -ENOMEM; - } - relocs[i].indices = indices; - relocs[i].reloc_indices = reloc_indices; - relocs[i].indices[relocs[i].cindices - 1] = csi->cdw; - relocs[i].reloc_indices[relocs[i].cindices - 1] = csi->cdw; - csi->section_cdw += 2; - csi->cdw += 2; - - return 0; - } - } - /* add bo to reloc */ - relocs = (struct r600_cs_reloc_legacy*) - realloc(csi->relocs, - sizeof(struct r600_cs_reloc_legacy) * (csi->crelocs + 1)); - if (relocs == NULL) { - return -ENOMEM; - } - csi->relocs = relocs; - relocs[csi->crelocs].base.bo = bo; - relocs[csi->crelocs].base.read_domain = read_domain; - relocs[csi->crelocs].base.write_domain = write_domain; - relocs[csi->crelocs].base.flags = flags; - relocs[csi->crelocs].indices = (uint32_t*)malloc(4); - relocs[csi->crelocs].reloc_indices = (uint32_t*)malloc(4); - if ( (relocs[csi->crelocs].indices == NULL) || (relocs[csi->crelocs].reloc_indices == NULL) ) - { - return -ENOMEM; - } - - relocs[csi->crelocs].indices[0] = csi->cdw; - relocs[csi->crelocs].reloc_indices[0] = csi->cdw; - csi->section_cdw += 2; - csi->cdw += 2; - relocs[csi->crelocs].cindices = 1; - csi->relocs_total_size += radeon_bo_legacy_relocs_size(bo); - csi->crelocs++; - - radeon_bo_ref(bo); - - return 0; -} - -static int r600_cs_begin(struct radeon_cs_int *csi, - uint32_t ndw, - const char *file, - const char *func, - int line) -{ - if (csi->section_ndw) { - fprintf(stderr, "CS already in a section(%s,%s,%d)\n", - csi->section_file, csi->section_func, csi->section_line); - fprintf(stderr, "CS can't start section(%s,%s,%d)\n", - file, func, line); - return -EPIPE; - } - - csi->section_ndw = ndw; - csi->section_cdw = 0; - csi->section_file = file; - csi->section_func = func; - csi->section_line = line; - - if (csi->cdw + ndw > csi->ndw) { - uint32_t tmp, *ptr; - int num = (ndw > 0x400) ? ndw : 0x400; - - tmp = (csi->cdw + num + 0x3FF) & (~0x3FF); - ptr = (uint32_t*)realloc(csi->packets, 4 * tmp); - if (ptr == NULL) { - return -ENOMEM; - } - csi->packets = ptr; - csi->ndw = tmp; - } - - return 0; -} - -static int r600_cs_end(struct radeon_cs_int *csi, - const char *file, - const char *func, - int line) - -{ - if (!csi->section_ndw) { - fprintf(stderr, "CS no section to end at (%s,%s,%d)\n", - file, func, line); - return -EPIPE; - } - - if ( csi->section_ndw != csi->section_cdw ) { - fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n", - csi->section_file, csi->section_func, csi->section_line, csi->section_ndw, csi->section_cdw); - fprintf(stderr, "csi->section_ndw = %d, csi->cdw = %d, csi->section_cdw = %d \n", - csi->section_ndw, csi->cdw, csi->section_cdw); - fprintf(stderr, "CS section end at (%s,%s,%d)\n", - file, func, line); - return -EPIPE; - } - csi->section_ndw = 0; - - if (csi->cdw > csi->ndw) { - fprintf(stderr, "CS section overflow at (%s,%s,%d) cdw %d ndw %d\n", - csi->section_file, csi->section_func, csi->section_line,csi->cdw,csi->ndw); - fprintf(stderr, "CS section end at (%s,%s,%d)\n", - file, func, line); - assert(0); - } - - return 0; -} - -static int r600_cs_process_relocs(struct radeon_cs_int *csi, - uint32_t * reloc_chunk, - uint32_t * length_dw_reloc_chunk) -{ - struct r600_cs_reloc_legacy *relocs; - int i, j, r; - - uint32_t offset_dw = 0; - - relocs = (struct r600_cs_reloc_legacy *)csi->relocs; -restart: - for (i = 0; i < csi->crelocs; i++) { - uint32_t soffset, eoffset; - - r = radeon_bo_legacy_validate(relocs[i].base.bo, - &soffset, &eoffset); - if (r == -EAGAIN) { - goto restart; - } - if (r) { - fprintf(stderr, "invalid bo(%p) [0x%08X, 0x%08X]\n", - relocs[i].base.bo, soffset, eoffset); - return r; - } - - for (j = 0; j < relocs[i].cindices; j++) { - /* pkt3 nop header in ib chunk */ - csi->packets[relocs[i].reloc_indices[j]] = 0xC0001000; - /* reloc index in ib chunk */ - csi->packets[relocs[i].reloc_indices[j] + 1] = offset_dw; - } - - /* asic offset in reloc chunk */ /* see alex drm r600_nomm_relocate */ - reloc_chunk[offset_dw] = soffset; - reloc_chunk[offset_dw + 3] = 0; - - offset_dw += 4; - } - - *length_dw_reloc_chunk = offset_dw; - - return 0; -} - -static int r600_cs_set_age(struct radeon_cs_int *csi) /* -------------- */ -{ - struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)csi->csm; - struct r600_cs_reloc_legacy *relocs; - int i; - - relocs = (struct r600_cs_reloc_legacy *)csi->relocs; - for (i = 0; i < csi->crelocs; i++) { - radeon_bo_legacy_pending(relocs[i].base.bo, csm->pending_age); - radeon_bo_unref(relocs[i].base.bo); - } - return 0; -} - -#if 0 -static void dump_cmdbuf(struct radeon_cs_int *csi) -{ - int i; - fprintf(stderr,"--start--\n"); - for (i = 0; i < csi->cdw; i++){ - fprintf(stderr,"0x%08x\n", csi->packets[i]); - } - fprintf(stderr,"--end--\n"); - -} -#endif - -static int r600_cs_emit(struct radeon_cs_int *csi) -{ - struct r600_cs_manager_legacy *csm = (struct r600_cs_manager_legacy*)csi->csm; - struct drm_radeon_cs cs_cmd; - struct drm_radeon_cs_chunk cs_chunk[2]; - uint32_t length_dw_reloc_chunk; - uint64_t chunk_ptrs[2]; - uint32_t *reloc_chunk; - int r; - int retry = 0; - - /* TODO : put chip level things here if need. */ - /* csm->ctx->vtbl.emit_cs_header(cs, csm->ctx); */ - - csm->pending_count = 1; - - reloc_chunk = (uint32_t*)calloc(1, csi->crelocs * 4 * 4); - - r = r600_cs_process_relocs(csi, reloc_chunk, &length_dw_reloc_chunk); - if (r) { - free(reloc_chunk); - return 0; - } - - /* raw ib chunk */ - cs_chunk[0].chunk_id = RADEON_CHUNK_ID_IB; - cs_chunk[0].length_dw = csi->cdw; - cs_chunk[0].chunk_data = (unsigned long)(csi->packets); - - /* reloc chaunk */ - cs_chunk[1].chunk_id = RADEON_CHUNK_ID_RELOCS; - cs_chunk[1].length_dw = length_dw_reloc_chunk; - cs_chunk[1].chunk_data = (unsigned long)reloc_chunk; - - chunk_ptrs[0] = (uint64_t)(unsigned long)&(cs_chunk[0]); - chunk_ptrs[1] = (uint64_t)(unsigned long)&(cs_chunk[1]); - - cs_cmd.num_chunks = 2; - /* cs_cmd.cs_id = 0; */ - cs_cmd.chunks = (uint64_t)(unsigned long)chunk_ptrs; - - //dump_cmdbuf(cs); - - do - { - r = drmCommandWriteRead(csi->csm->fd, DRM_RADEON_CS, &cs_cmd, sizeof(cs_cmd)); - retry++; - } while (r == -EAGAIN && retry < 1000); - - if (r) { - free(reloc_chunk); - return r; - } - - csm->pending_age = cs_cmd.cs_id; - - r600_cs_set_age(csi); - - csi->csm->read_used = 0; - csi->csm->vram_write_used = 0; - csi->csm->gart_write_used = 0; - - free(reloc_chunk); - - return 0; -} - -static void inline r600_cs_free_reloc(void *relocs_p, int crelocs) -{ - struct r600_cs_reloc_legacy *relocs = relocs_p; - int i; - if (!relocs_p) - return; - for (i = 0; i < crelocs; i++) - { - free(relocs[i].indices); - free(relocs[i].reloc_indices); - } -} - -static int r600_cs_destroy(struct radeon_cs_int *csi) -{ - r600_cs_free_reloc(csi->relocs, csi->crelocs); - free(csi->relocs); - free(csi->packets); - free(csi); - return 0; -} - -static int r600_cs_erase(struct radeon_cs_int *csi) -{ - r600_cs_free_reloc(csi->relocs, csi->crelocs); - free(csi->relocs); - csi->relocs_total_size = 0; - csi->relocs = NULL; - csi->crelocs = 0; - csi->cdw = 0; - return 0; -} - -static int r600_cs_need_flush(struct radeon_cs_int *csi) -{ - /* this function used to flush when the BO usage got to - * a certain size, now the higher levels handle this better */ - return 0; -} - -static void r600_cs_print(struct radeon_cs_int *csi, FILE *file) -{ -} - -static struct radeon_cs_funcs r600_cs_funcs = { - r600_cs_create, - r600_cs_write_reloc, - r600_cs_begin, - r600_cs_end, - r600_cs_emit, - r600_cs_destroy, - r600_cs_erase, - r600_cs_need_flush, - r600_cs_print -}; - -struct radeon_cs_manager * r600_radeon_cs_manager_legacy_ctor(struct radeon_context *ctx) -{ - struct r600_cs_manager_legacy *csm; - - csm = (struct r600_cs_manager_legacy*) - calloc(1, sizeof(struct r600_cs_manager_legacy)); - if (csm == NULL) { - return NULL; - } - csm->base.funcs = &r600_cs_funcs; - csm->base.fd = ctx->dri.fd; - csm->ctx = ctx; - csm->pending_age = 1; - return (struct radeon_cs_manager*)csm; -} - -void r600InitCmdBuf(context_t *r600) /* from rcommonInitCmdBuf */ -{ - radeonContextPtr rmesa = &r600->radeon; - GLuint size; - - if(r600->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenInitAtoms(r600); - } - else - { - r600InitAtoms(r600); - } - - /* Initialize command buffer */ - size = 256 * driQueryOptioni(&rmesa->optionCache, - "command_buffer_size"); - if (size < 2 * rmesa->hw.max_state_size) { - size = 2 * rmesa->hw.max_state_size + 65535; - } - if (size > 64 * 256) - size = 64 * 256; - - if (rmesa->radeonScreen->kernel_mm) { - int fd = rmesa->radeonScreen->driScreen->fd; - rmesa->cmdbuf.csm = radeon_cs_manager_gem_ctor(fd); - } else { - rmesa->cmdbuf.csm = r600_radeon_cs_manager_legacy_ctor(rmesa); - } - if (rmesa->cmdbuf.csm == NULL) { - /* FIXME: fatal error */ - return; - } - rmesa->cmdbuf.cs = radeon_cs_create(rmesa->cmdbuf.csm, size); - assert(rmesa->cmdbuf.cs != NULL); - rmesa->cmdbuf.size = size; - - radeon_cs_space_set_flush(rmesa->cmdbuf.cs, - (void (*)(void *))rmesa->glCtx->Driver.Flush, rmesa->glCtx); - - if (!rmesa->radeonScreen->kernel_mm) { - radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, rmesa->radeonScreen->texSize[0]); - radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_GTT, rmesa->radeonScreen->gartTextures.size); - } else { - struct drm_radeon_gem_info mminfo; - - if (!drmCommandWriteRead(rmesa->dri.fd, DRM_RADEON_GEM_INFO, &mminfo, sizeof(mminfo))) - { - radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, mminfo.vram_visible); - radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_GTT, mminfo.gart_size); - } - } -} - diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.h b/src/mesa/drivers/dri/r600/r600_cmdbuf.h deleted file mode 100644 index ffd6c8b0921..00000000000 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.h +++ /dev/null @@ -1,237 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Nicolai Haehnle <[email protected]> - */ - -#ifndef __R600_CMDBUF_H__ -#define __R600_CMDBUF_H__ - -#include "r600_context.h" - -#define RADEON_CP_PACKET3_NOP 0xC0001000 -#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900 -#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00 -#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00 -#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300 -#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400 -#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600 -#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800 -#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900 -#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00 -#define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00 -#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00 -#define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100 -#define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200 -#define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300 -#define RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400 -#define RADEON_CP_PACKET3_CNTL_POLYLINE 0xC0009500 -#define RADEON_CP_PACKET3_CNTL_POLYSCANLINES 0xC0009800 -#define RADEON_CP_PACKET3_CNTL_PAINT_MULTI 0xC0009A00 -#define RADEON_CP_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00 -#define RADEON_CP_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00 - -/* r6xx/r7xx packet 3 type offsets */ -#define R600_SET_CONFIG_REG_OFFSET 0x00008000 -#define R600_SET_CONFIG_REG_END 0x0000ac00 -#define R600_SET_CONTEXT_REG_OFFSET 0x00028000 -#define R600_SET_CONTEXT_REG_END 0x00029000 -#define R600_SET_ALU_CONST_OFFSET 0x00030000 -#define R600_SET_ALU_CONST_END 0x00032000 -#define R600_SET_RESOURCE_OFFSET 0x00038000 -#define R600_SET_RESOURCE_END 0x0003c000 -#define R600_SET_SAMPLER_OFFSET 0x0003c000 -#define R600_SET_SAMPLER_END 0x0003cff0 -#define R600_SET_CTL_CONST_OFFSET 0x0003cff0 -#define R600_SET_CTL_CONST_END 0x0003e200 -#define R600_SET_LOOP_CONST_OFFSET 0x0003e200 -#define R600_SET_LOOP_CONST_END 0x0003e380 -#define R600_SET_BOOL_CONST_OFFSET 0x0003e380 -#define R600_SET_BOOL_CONST_END 0x00040000 - -/* r6xx/r7xx packet 3 types */ -#define R600_IT_INDIRECT_BUFFER_END 0x00001700 -#define R600_IT_SET_PREDICATION 0x00002000 -#define R600_IT_REG_RMW 0x00002100 -#define R600_IT_COND_EXEC 0x00002200 -#define R600_IT_PRED_EXEC 0x00002300 -#define R600_IT_START_3D_CMDBUF 0x00002400 -#define R600_IT_DRAW_INDEX_2 0x00002700 -#define R600_IT_CONTEXT_CONTROL 0x00002800 -#define R600_IT_DRAW_INDEX_IMMD_BE 0x00002900 -#define R600_IT_INDEX_TYPE 0x00002A00 -#define R600_IT_DRAW_INDEX 0x00002B00 -#define R600_IT_DRAW_INDEX_AUTO 0x00002D00 -#define R600_IT_DRAW_INDEX_IMMD 0x00002E00 -#define R600_IT_NUM_INSTANCES 0x00002F00 -#define R600_IT_STRMOUT_BUFFER_UPDATE 0x00003400 -#define R600_IT_INDIRECT_BUFFER_MP 0x00003800 -#define R600_IT_MEM_SEMAPHORE 0x00003900 -#define R600_IT_MPEG_INDEX 0x00003A00 -#define R600_IT_WAIT_REG_MEM 0x00003C00 -#define R600_IT_MEM_WRITE 0x00003D00 -#define R600_IT_INDIRECT_BUFFER 0x00003200 -#define R600_IT_CP_INTERRUPT 0x00004000 -#define R600_IT_SURFACE_SYNC 0x00004300 -#define R600_IT_ME_INITIALIZE 0x00004400 -#define R600_IT_COND_WRITE 0x00004500 -#define R600_IT_EVENT_WRITE 0x00004600 -# define R600_EVENT_TYPE(x) ((x) << 0) -# define R600_EVENT_INDEX(x) ((x) << 8) -#define R600_IT_EVENT_WRITE_EOP 0x00004700 -#define R600_IT_ONE_REG_WRITE 0x00005700 -#define R600_IT_SET_CONFIG_REG 0x00006800 -#define R600_IT_SET_CONTEXT_REG 0x00006900 -#define R600_IT_SET_ALU_CONST 0x00006A00 -#define R600_IT_SET_BOOL_CONST 0x00006B00 -#define R600_IT_SET_LOOP_CONST 0x00006C00 -#define R600_IT_SET_RESOURCE 0x00006D00 -#define R600_IT_SET_SAMPLER 0x00006E00 -#define R600_IT_SET_CTL_CONST 0x00006F00 -#define R600_IT_SURFACE_BASE_UPDATE 0x00007300 - -struct radeon_cs_manager * r600_radeon_cs_manager_legacy_ctor(struct radeon_context *ctx); - -/** - * Write one dword to the command buffer. - */ -#define R600_OUT_BATCH(data) \ -do { \ - radeon_cs_write_dword(b_l_rmesa->cmdbuf.cs, data); \ -} while(0) - -/** - * Write n dwords from ptr to the command buffer. - */ -#define R600_OUT_BATCH_TABLE(ptr,n) \ -do { \ - radeon_cs_write_table(b_l_rmesa->cmdbuf.cs, ptr, n); \ -} while(0) - -/** - * Write a relocated dword to the command buffer. - */ -#define R600_OUT_BATCH_RELOC(data, bo, offset, rd, wd, flags) \ - do { \ - if (0 && offset) { \ - fprintf(stderr, "(%s:%s:%d) offset : %d\n", \ - __FILE__, __FUNCTION__, __LINE__, offset); \ - } \ - radeon_cs_write_reloc(b_l_rmesa->cmdbuf.cs, \ - bo, rd, wd, flags); \ - } while(0) - -/* R600/R700 */ -#define R600_OUT_BATCH_REGS(reg, num) \ -do { \ - if ((reg) >= R600_SET_CONFIG_REG_OFFSET && (reg) < R600_SET_CONFIG_REG_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CONFIG_REG_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_CONTEXT_REG_OFFSET && (reg) < R600_SET_CONTEXT_REG_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONTEXT_REG, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CONTEXT_REG_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_ALU_CONST_OFFSET && (reg) < R600_SET_ALU_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_ALU_CONST, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_ALU_CONST_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_RESOURCE_OFFSET && (reg) < R600_SET_RESOURCE_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_RESOURCE_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_SAMPLER_OFFSET && (reg) < R600_SET_SAMPLER_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_SAMPLER_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_CTL_CONST_OFFSET && (reg) < R600_SET_CTL_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CTL_CONST_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_LOOP_CONST_OFFSET && (reg) < R600_SET_LOOP_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_LOOP_CONST, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_LOOP_CONST_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_BOOL_CONST_OFFSET && (reg) < R600_SET_BOOL_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_BOOL_CONST, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_BOOL_CONST_OFFSET) >> 2); \ - } else { \ - R600_OUT_BATCH(CP_PACKET0((reg), (num))); \ - } \ -} while (0) - -/** Single register write to command buffer; requires 3 dwords for most things. */ -#define R600_OUT_BATCH_REGVAL(reg, val) \ - R600_OUT_BATCH_REGS((reg), 1); \ - R600_OUT_BATCH((val)) - -/** Continuous register range write to command buffer; requires 1 dword, - * expects count dwords afterwards for register contents. */ -#define R600_OUT_BATCH_REGSEQ(reg, count) \ - R600_OUT_BATCH_REGS((reg), (count)) - -/* evergreen */ -#define EVERGREEN_OUT_BATCH_REGS(reg, num) \ -do { \ - if ((reg) >= R600_SET_CONFIG_REG_OFFSET && (reg) < R600_SET_CONFIG_REG_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CONFIG_REG_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_CONTEXT_REG_OFFSET && (reg) < R600_SET_CONTEXT_REG_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONTEXT_REG, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CONTEXT_REG_OFFSET) >> 2); \ - } else if ((reg) >= EG_SET_RESOURCE_OFFSET && (reg) < EG_SET_RESOURCE_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, (num))); \ - R600_OUT_BATCH(((reg) - EG_SET_RESOURCE_OFFSET) >> 2); \ - } else if ((reg) >= EG_SET_LOOP_CONST_OFFSET && (reg) < EG_SET_LOOP_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_LOOP_CONST, (num))); \ - R600_OUT_BATCH(((reg) - EG_SET_LOOP_CONST_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_SAMPLER_OFFSET && (reg) < R600_SET_SAMPLER_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_SAMPLER_OFFSET) >> 2); \ - } else if ((reg) >= R600_SET_CTL_CONST_OFFSET && (reg) < R600_SET_CTL_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, (num))); \ - R600_OUT_BATCH(((reg) - R600_SET_CTL_CONST_OFFSET) >> 2); \ - } else if ((reg) >= EG_SET_BOOL_CONST_OFFSET && (reg) < EG_SET_BOOL_CONST_END) { \ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_BOOL_CONST, (num))); \ - R600_OUT_BATCH(((reg) - EG_SET_BOOL_CONST_OFFSET) >> 2); \ - } else { \ - R600_OUT_BATCH(CP_PACKET0((reg), (num))); \ - } \ -} while (0) - -/** Single register write to command buffer; requires 3 dwords for most things. */ -#define EVERGREEN_OUT_BATCH_REGVAL(reg, val) \ - EVERGREEN_OUT_BATCH_REGS((reg), 1); \ - R600_OUT_BATCH((val)) - -/** Continuous register range write to command buffer; requires 1 dword, - * expects count dwords afterwards for register contents. */ -#define EVERGREEN_OUT_BATCH_REGSEQ(reg, count) \ - EVERGREEN_OUT_BATCH_REGS((reg), (count)) - - -extern void r600InitCmdBuf(context_t *r600); - -#endif /* __R600_CMDBUF_H__ */ diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c deleted file mode 100644 index 19d69c682ba..00000000000 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ /dev/null @@ -1,492 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Keith Whitwell <[email protected]> - * - * \author Nicolai Haehnle <[email protected]> - */ - -#include <stdbool.h> -#include "main/glheader.h" -#include "main/api_arrayelt.h" -#include "main/context.h" -#include "main/simple_list.h" -#include "main/imports.h" -#include "main/extensions.h" -#include "main/bufferobj.h" -#include "main/texobj.h" -#include "main/points.h" -#include "main/mfeatures.h" -#include "main/version.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" - -#include "drivers/common/driverfuncs.h" - -#include "radeon_debug.h" -#include "r600_context.h" -#include "radeon_common_context.h" -#include "radeon_buffer_objects.h" -#include "radeon_span.h" -#include "r600_cmdbuf.h" -#include "radeon_bocs_wrapper.h" -#include "radeon_queryobj.h" -#include "r600_blit.h" - -#include "r700_state.h" -#include "r700_ioctl.h" - -#include "evergreen_context.h" -#include "evergreen_state.h" -#include "evergreen_tex.h" -#include "evergreen_ioctl.h" -#include "evergreen_oglprog.h" - -#include "utils.h" - -#define R600_ENABLE_GLSL_TEST 1 - -static const struct tnl_pipeline_stage *r600_pipeline[] = { - /* Catch any t&l fallbacks - */ - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, - &_tnl_vertex_program_stage, - &_tnl_render_stage, - 0, -}; - -static void r600_get_lock(radeonContextPtr rmesa) -{ - drm_radeon_sarea_t *sarea = rmesa->sarea; - - if (sarea->ctx_owner != rmesa->dri.hwContext) { - sarea->ctx_owner = rmesa->dri.hwContext; - if (!rmesa->radeonScreen->kernel_mm) - radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom); - } -} - -static void r600_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa) -{ - /* please flush pipe do all pending work */ - /* to be enabled */ -} - -static void r600_vtbl_pre_emit_atoms(radeonContextPtr radeon) -{ - r700Start3D((context_t *)radeon); -} - -static void r600_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) -{ - context_t *context = R700_CONTEXT(ctx); - if (mode) - context->radeon.Fallback |= bit; - else - context->radeon.Fallback &= ~bit; -} - -static void r600_emit_query_finish(radeonContextPtr radeon) -{ - context_t *context = (context_t*) radeon; - BATCH_LOCALS(&context->radeon); - - struct radeon_query_object *query = radeon->query.current; - - BEGIN_BATCH_NO_AUTOSTATE(4 + 2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); - R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1)); - R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */ - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE); - query->emitted_begin = GL_FALSE; -} - -static void r600_init_vtbl(radeonContextPtr radeon) -{ - radeon->vtbl.get_lock = r600_get_lock; - radeon->vtbl.update_viewport_offset = r700UpdateViewportOffset; - radeon->vtbl.emit_cs_header = r600_vtbl_emit_cs_header; - radeon->vtbl.swtcl_flush = NULL; - radeon->vtbl.pre_emit_atoms = r600_vtbl_pre_emit_atoms; - radeon->vtbl.fallback = r600_fallback; - radeon->vtbl.emit_query_finish = r600_emit_query_finish; - radeon->vtbl.check_blit = r600_check_blit; - radeon->vtbl.blit = r600_blit; - radeon->vtbl.is_format_renderable = r600IsFormatRenderable; -} - -static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - if( (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) - &&(context->radeon.radeonScreen->chip_family <= CHIP_FAMILY_CAICOS) ) - { - r700->bShaderUseMemConstant = GL_TRUE; - } - else - { - r700->bShaderUseMemConstant = GL_FALSE; - } - - ctx->Const.GLSLVersion = 120; - _mesa_override_glsl_version(ctx); - - ctx->Const.MaxTextureImageUnits = 16; - /* 8 per clause on r6xx, 16 on r7xx - * but I think mesa only supports 8 at the moment - */ - ctx->Const.MaxTextureCoordUnits = 8; - ctx->Const.MaxTextureUnits = - MIN2(ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxTextureCoordUnits); - ctx->Const.MaxCombinedTextureImageUnits = - ctx->Const.MaxVertexTextureImageUnits + - ctx->Const.MaxTextureImageUnits; - - ctx->Const.MaxTextureMaxAnisotropy = 16.0; - ctx->Const.MaxTextureLodBias = 16.0; - - if (screen->chip_family >= CHIP_FAMILY_CEDAR) { - ctx->Const.MaxTextureLevels = 15; - ctx->Const.MaxTextureRectSize = 16384; - } else { - ctx->Const.MaxTextureLevels = 14; - ctx->Const.MaxTextureRectSize = 8192; - } - - ctx->Const.MinPointSize = 0x0001 / 8.0; - ctx->Const.MinPointSizeAA = 0x0001 / 8.0; - ctx->Const.MaxPointSize = 0xffff / 8.0; - ctx->Const.MaxPointSizeAA = 0xffff / 8.0; - - ctx->Const.MinLineWidth = 0x0001 / 8.0; - ctx->Const.MinLineWidthAA = 0x0001 / 8.0; - ctx->Const.MaxLineWidth = 0xffff / 8.0; - ctx->Const.MaxLineWidthAA = 0xffff / 8.0; - - ctx->Const.MaxDrawBuffers = 1; /* hw supports 8 */ - ctx->Const.MaxColorAttachments = 1; - ctx->Const.MaxRenderbufferSize = 4096; - - /* 256 for reg-based consts, inline consts also supported */ - ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ - ctx->Const.VertexProgram.MaxNativeInstructions = 8192; - ctx->Const.VertexProgram.MaxNativeAttribs = 160; - ctx->Const.VertexProgram.MaxTemps = 128; - ctx->Const.VertexProgram.MaxNativeTemps = 128; - ctx->Const.VertexProgram.MaxNativeParameters = 256; - ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ - - ctx->Const.FragmentProgram.MaxNativeTemps = 128; - ctx->Const.FragmentProgram.MaxNativeAttribs = 32; - ctx->Const.FragmentProgram.MaxNativeParameters = 256; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; - /* 8 per clause on r6xx, 16 on r7xx */ - if (screen->chip_family >= CHIP_FAMILY_RV770) - ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16; - else - ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8; - ctx->Const.FragmentProgram.MaxNativeInstructions = 8192; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = 8; /* ??? */ - ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ -} - -static void r600ParseOptions(context_t *r600, radeonScreenPtr screen) -{ - /* Parse configuration files. - * Do this here so that initialMaxAnisotropy is set before we create - * the default textures. - */ - driParseConfigFiles(&r600->radeon.optionCache, &screen->optionCache, - screen->driScreen->myNum, "r600"); - - r600->radeon.initialMaxAnisotropy = driQueryOptionf(&r600->radeon.optionCache, - "def_max_anisotropy"); - -} - -static void r600InitGLExtensions(struct gl_context *ctx) -{ - context_t *r600 = R700_CONTEXT(ctx); -#ifdef R600_ENABLE_GLSL_TEST - unsigned i; -#endif - - ctx->Extensions.ARB_depth_clamp = true; - ctx->Extensions.ARB_depth_texture = true; - ctx->Extensions.ARB_draw_elements_base_vertex = true; - ctx->Extensions.ARB_fragment_program = true; - ctx->Extensions.ARB_fragment_program_shadow = true; - ctx->Extensions.ARB_occlusion_query = true; - ctx->Extensions.ARB_shadow = true; - ctx->Extensions.ARB_shadow_ambient = true; - ctx->Extensions.ARB_texture_border_clamp = true; - ctx->Extensions.ARB_texture_cube_map = true; - ctx->Extensions.ARB_texture_env_combine = true; - ctx->Extensions.ARB_texture_env_crossbar = true; - ctx->Extensions.ARB_texture_env_dot3 = true; - ctx->Extensions.ARB_texture_non_power_of_two = true; - ctx->Extensions.ARB_vertex_program = true; - ctx->Extensions.EXT_blend_color = true; - ctx->Extensions.EXT_blend_equation_separate = true; - ctx->Extensions.EXT_blend_func_separate = true; - ctx->Extensions.EXT_blend_minmax = true; - ctx->Extensions.EXT_packed_depth_stencil = true; - ctx->Extensions.EXT_fog_coord = true; - ctx->Extensions.EXT_gpu_program_parameters = true; - ctx->Extensions.EXT_pixel_buffer_object = true; - ctx->Extensions.EXT_point_parameters = true; - ctx->Extensions.EXT_provoking_vertex = true; - ctx->Extensions.EXT_secondary_color = true; - ctx->Extensions.EXT_shadow_funcs = true; - ctx->Extensions.EXT_stencil_two_side = true; - ctx->Extensions.EXT_texture_env_dot3 = true; - ctx->Extensions.EXT_texture_filter_anisotropic = true; - ctx->Extensions.EXT_texture_mirror_clamp = true; - ctx->Extensions.EXT_vertex_array_bgra = true; - ctx->Extensions.EXT_texture_sRGB = true; - ctx->Extensions.ATI_separate_stencil = true; - ctx->Extensions.ATI_texture_env_combine3 = true; - ctx->Extensions.ATI_texture_mirror_once = true; - ctx->Extensions.MESA_pack_invert = true; - ctx->Extensions.MESA_ycbcr_texture = true; - ctx->Extensions.NV_blend_square = true; - ctx->Extensions.NV_texture_rectangle = true; - ctx->Extensions.NV_vertex_program = true; -#if FEATURE_OES_EGL_image - ctx->Extensions.OES_EGL_image = true; -#endif - - if (r600->radeon.radeonScreen->kernel_mm) - ctx->Extensions.EXT_framebuffer_object = true; - -#ifdef R600_ENABLE_GLSL_TEST - ctx->Extensions.ARB_shading_language_100 = true; - _mesa_enable_2_0_extensions(ctx); - - /* glsl compiler has problem if this is not GL_TRUE */ - for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) - ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE; -#endif /* R600_ENABLE_GLSL_TEST */ - - if (driQueryOptionb - (&r600->radeon.optionCache, "disable_stencil_two_side")) - ctx->Extensions.EXT_stencil_two_side = false; - - if (r600->radeon.glCtx->Mesa_DXTn - && !driQueryOptionb(&r600->radeon.optionCache, "disable_s3tc")) { - ctx->Extensions.EXT_texture_compression_s3tc = true; - ctx->Extensions.S3_s3tc = true; - } else - if (driQueryOptionb(&r600->radeon.optionCache, "force_s3tc_enable")) - { - ctx->Extensions.EXT_texture_compression_s3tc = true; - } - - /* RV740 had a broken pipe config prior to drm 1.32 */ - if (!r600->radeon.radeonScreen->kernel_mm) { - if ((r600->radeon.dri.drmMinor < 32) && - (r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740)) - ctx->Extensions.ARB_occlusion_query = false; - } -} - -/* Create the device specific rendering context. - */ -GLboolean r600CreateContext(gl_api api, - const struct gl_config * glVisual, - __DRIcontext * driContextPriv, - void *sharedContextPrivate) -{ - __DRIscreen *sPriv = driContextPriv->driScreenPriv; - radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); - struct dd_function_table functions; - context_t *r600; - struct gl_context *ctx; - - assert(glVisual); - assert(driContextPriv); - assert(screen); - - /* Allocate the R600 context */ - r600 = (context_t*) CALLOC(sizeof(*r600)); - if (!r600) { - radeon_error("Failed to allocate memory for context.\n"); - return GL_FALSE; - } - - r600ParseOptions(r600, screen); - - r600->radeon.radeonScreen = screen; - - if(screen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreen_init_vtbl(&r600->radeon); - } - else - { - r600_init_vtbl(&r600->radeon); - } - - /* Init default driver functions then plug in our R600-specific functions - * (the texture functions are especially important) - */ - _mesa_init_driver_functions(&functions); - - if(screen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenCreateChip(r600); - evergreenInitStateFuncs(&r600->radeon, &functions); - evergreenInitTextureFuncs(&r600->radeon, &functions); - evergreenInitShaderFuncs(&functions); - } - else - { - r700InitStateFuncs(&r600->radeon, &functions); - r600InitTextureFuncs(&r600->radeon, &functions); - r700InitShaderFuncs(&functions); - } - - radeonInitQueryObjFunctions(&functions); - - if(screen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenInitIoctlFuncs(&functions); - } - else - { - r700InitIoctlFuncs(&functions); - } - radeonInitBufferObjectFuncs(&functions); - - if (!radeonInitContext(&r600->radeon, &functions, - glVisual, driContextPriv, - sharedContextPrivate)) { - radeon_error("Initializing context failed.\n"); - FREE(r600); - return GL_FALSE; - } - - ctx = r600->radeon.glCtx; - - ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; - ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - - r600InitConstValues(ctx, screen); - - /* reinit, it depends on consts above */ - _mesa_init_point(ctx); - - _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); - - /* Initialize the software rasterizer and helper modules. - */ - _swrast_CreateContext(ctx); - _vbo_CreateContext(ctx); - _tnl_CreateContext(ctx); - _swsetup_CreateContext(ctx); - _swsetup_Wakeup(ctx); - - /* Install the customized pipeline: - */ - _tnl_destroy_pipeline(ctx); - _tnl_install_pipeline(ctx, r600_pipeline); - TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; - - /* Configure swrast and TNL to match hardware characteristics: - */ - _swrast_allow_pixel_fog(ctx, GL_FALSE); - _swrast_allow_vertex_fog(ctx, GL_TRUE); - _tnl_allow_pixel_fog(ctx, GL_FALSE); - _tnl_allow_vertex_fog(ctx, GL_TRUE); - - radeon_init_debug(); - - if(screen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenInitDraw(ctx); - } - else - { - r700InitDraw(ctx); - } - - radeon_fbo_init(&r600->radeon); - radeonInitSpanFuncs( ctx ); - r600InitCmdBuf(r600); - - if(screen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenInitState(r600->radeon.glCtx); - } - else - { - r700InitState(r600->radeon.glCtx); - } - - r600InitGLExtensions(ctx); - - return GL_TRUE; -} - -void r600DestroyContext(__DRIcontext *driContextPriv ) -{ - void *pChip; - context_t *context = (context_t *) driContextPriv->driverPrivate; - - assert(context); - - pChip = context->pChip; - - /* destroy context first, free pChip, in case there are things flush to asic. */ - radeonDestroyContext(driContextPriv); - - FREE(pChip); -} - - diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h deleted file mode 100644 index d3dc901acf8..00000000000 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ /dev/null @@ -1,245 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Keith Whitwell <[email protected]> - * \author Nicolai Haehnle <[email protected]> - */ - -#ifndef __R600_CONTEXT_H__ -#define __R600_CONTEXT_H__ - -#include "tnl/t_vertex.h" -#include "drm.h" -#include "radeon_drm.h" -#include "dri_util.h" -#include "texmem.h" -#include "radeon_common.h" - -#include "main/macros.h" -#include "main/mtypes.h" -#include "main/colormac.h" - -#include "r700_chip.h" -#include "r600_tex.h" -#include "r700_oglprog.h" -#include "r700_vertprog.h" - -#include "evergreen_chip.h" - -struct r600_context; -typedef struct r600_context context_t; - -#include "main/mm.h" - -#define COLOR_IS_RGBA -#define TAG(x) r600##x -#include "tnl_dd/t_dd_vertex.h" -#undef TAG - -#define FORCE_CF_TEX_BARRIER 1 - -/* #define GENERATE_SHADER_FOR_2D 1 */ - -#define R600_FALLBACK_NONE 0 -#define R600_FALLBACK_TCL 1 -#define R600_FALLBACK_RAST 2 - -struct r600_hw_state { - struct radeon_state_atom sq; - struct radeon_state_atom db; - struct radeon_state_atom stencil; - struct radeon_state_atom db_target; - struct radeon_state_atom sc; - struct radeon_state_atom scissor; - struct radeon_state_atom aa; - struct radeon_state_atom cl; - struct radeon_state_atom gb; - struct radeon_state_atom ucp; - struct radeon_state_atom su; - struct radeon_state_atom poly; - struct radeon_state_atom cb; - struct radeon_state_atom clrcmp; - struct radeon_state_atom blnd; - struct radeon_state_atom blnd_clr; - struct radeon_state_atom cb_target; - struct radeon_state_atom sx; - struct radeon_state_atom vgt; - struct radeon_state_atom spi; - struct radeon_state_atom vpt; - - struct radeon_state_atom fs; - struct radeon_state_atom vs; - struct radeon_state_atom ps; - - struct radeon_state_atom vs_consts; - struct radeon_state_atom ps_consts; - - struct radeon_state_atom vtx; - struct radeon_state_atom tx; - struct radeon_state_atom tx_smplr; - struct radeon_state_atom tx_brdr_clr; -}; - -struct evergreen_hw_state { - struct radeon_state_atom one_time_init; - struct radeon_state_atom init; - struct radeon_state_atom pa; - struct radeon_state_atom vgt; - struct radeon_state_atom tp; - struct radeon_state_atom sq; - struct radeon_state_atom vs; - struct radeon_state_atom spi; - struct radeon_state_atom sx; - struct radeon_state_atom tx; - struct radeon_state_atom db; - struct radeon_state_atom cb; - struct radeon_state_atom vtx; - struct radeon_state_atom cp; - struct radeon_state_atom timestamp; -}; - -typedef struct StreamDesc -{ - GLint size; //number of data element - GLenum type; //data element type - GLsizei stride; - GLenum format; // GL_RGBA,GLBGRA - - struct radeon_bo *bo; - GLint bo_offset; - - GLuint dwords; - GLuint dst_loc; - GLuint _signed; - GLboolean normalize; - GLboolean is_named_bo; - GLubyte element; -} StreamDesc; - -typedef struct r700_index_buffer -{ - struct radeon_bo *bo; - int bo_offset; - - GLboolean is_32bit; - GLuint count; -} r700_index_buffer; - -/** - * \brief R600 context structure. - */ -struct r600_context { - struct radeon_context radeon; /* parent class, must be first */ - - /* ------ */ - R700_CHIP_CONTEXT hw; - - struct r600_hw_state atoms; - - struct evergreen_hw_state evergreen_atoms; - void * pChip; - - struct r700_vertex_program *selected_vp; - - /* Vertex buffers - */ - GLint nNumActiveAos; - StreamDesc stream_desc[VERT_ATTRIB_MAX]; - struct r700_index_buffer ind_buf; - struct radeon_bo *blit_bo; - GLboolean blit_bo_loaded; - - /* Shader const buffer */ - struct radeon_bo * vp_Constbo; - int vp_bo_offset; - struct radeon_bo * fp_Constbo; - int fp_bo_offset; -}; - -#define EVERGREEN_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) - -#define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) -#define GL_CONTEXT(context) ((struct gl_context *)(context->radeon.glCtx)) - -#define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip)) - -extern GLboolean r600CreateContext(gl_api api, - const struct gl_config * glVisual, - __DRIcontext * driContextPriv, - void *sharedContextPrivate); - -extern void r600DestroyContext(__DRIcontext *driContextPriv ); -extern void evergreenCreateChip(context_t *context); - -#define R700_CONTEXT_STATES(context) ((R700_CHIP_CONTEXT *)(&context->hw)) - -#define R600_NEWPRIM( rmesa ) \ -do { \ - if ( rmesa->radeon.dma.flush ) \ - rmesa->radeon.dma.flush( rmesa->radeon.glCtx ); \ -} while (0) - -#define R600_STATECHANGE(r600, ATOM) \ -do { \ - R600_NEWPRIM(r600); \ - r600->atoms.ATOM.dirty = GL_TRUE; \ - r600->radeon.hw.is_dirty = GL_TRUE; \ -} while(0) - -#define EVERGREEN_STATECHANGE(r600, ATOM) \ -do { \ - R600_NEWPRIM(r600); \ - r600->evergreen_atoms.ATOM.dirty = GL_TRUE; \ - r600->radeon.hw.is_dirty = GL_TRUE; \ -} while(0) - -extern GLboolean r700SyncSurf(context_t *context, - struct radeon_bo *pbo, - uint32_t read_domain, - uint32_t write_domain, - uint32_t sync_type); - -extern void r700WaitForIdleClean(context_t *context); - -extern void r700Start3D(context_t *context); -extern void r600InitAtoms(context_t *context); -extern void r700InitDraw(struct gl_context *ctx); - -extern void evergreenInitAtoms(context_t *context); -extern void evergreenInitDraw(struct gl_context *ctx); - -#define RADEON_D_CAPTURE 0 -#define RADEON_D_PLAYBACK 1 -#define RADEON_D_PLAYBACK_RAW 2 -#define RADEON_D_T 3 - -#endif /* __R600_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c deleted file mode 100644 index c6916ed98a3..00000000000 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************** - -Copyright 2008, 2009 Advanced Micro Devices Inc. (AMD) - -Copyright (C) Advanced Micro Devices Inc. (AMD) 2009. 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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/colormac.h" -#include "main/imports.h" -#include "main/macros.h" - -#include "swrast_setup/swrast_setup.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" - -#include "r600_context.h" -#include "r600_emit.h" - -void r600EmitCacheFlush(context_t *rmesa) -{ -} - -GLboolean r600AllocShaderConsts(struct gl_context * ctx, - void ** constbo, - int sizeinBYTE, - char * szShaderUsage) -{ - radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); - struct radeon_bo * pbo; - - if(sizeinBYTE < 64) /* SQ_ALU_CONST_BUFFER_SIZE need 64 bytes at least to be non 0 */ - { - sizeinBYTE = 64; - } - -shader_again_alloc: - pbo = radeon_bo_open(radeonctx->radeonScreen->bom, - 0, - sizeinBYTE, - 256, - RADEON_GEM_DOMAIN_GTT, - 0); - - radeon_print(RADEON_SHADER, RADEON_NORMAL, "%s %p size %d: %s\n", __func__, pbo, sizeinBYTE, szShaderUsage); - - if (!pbo) { - radeon_print(RADEON_MEMORY | RADEON_CS, RADEON_IMPORTANT, "No memory for buffer object. Flushing command buffer.\n"); - rcommonFlushCmdBuf(radeonctx, __FUNCTION__); - goto shader_again_alloc; - } - - radeon_cs_space_add_persistent_bo(radeonctx->cmdbuf.cs, - pbo, - RADEON_GEM_DOMAIN_GTT, 0); - - if (radeon_cs_space_check_with_bo(radeonctx->cmdbuf.cs, - pbo, - RADEON_GEM_DOMAIN_GTT, 0)) { - radeon_error("failure to revalidate BOs - badness\n"); - return GL_FALSE; - } - - *constbo = (void*)pbo; - - return GL_TRUE; -} -GLboolean r600EmitShaderConsts(struct gl_context * ctx, - void * constbo, - int bo_offset, - GLvoid * data, - int sizeinBYTE) -{ - struct radeon_bo * pbo = (struct radeon_bo *)constbo; - uint32_t *out; - int i; - - radeon_bo_map(pbo, 1); - - out = (uint32_t*)(pbo->ptr); - out = (uint32_t*)ADD_POINTERS(pbo->ptr, bo_offset); - - for(i = 0; i < sizeinBYTE / 4; i++) { - out[i] = CPU_TO_LE32(*((uint32_t *)data + i)); - } - - radeon_bo_unmap(pbo); - - return GL_TRUE; -} - -GLboolean r600EmitShader(struct gl_context * ctx, - void ** shaderbo, - GLvoid * data, - int sizeinDWORD, - char * szShaderUsage) -{ - radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); - struct radeon_bo * pbo; - uint32_t *out; - int i; -shader_again_alloc: - pbo = radeon_bo_open(radeonctx->radeonScreen->bom, - 0, - sizeinDWORD * 4, - 256, - RADEON_GEM_DOMAIN_GTT, - 0); - - radeon_print(RADEON_SHADER, RADEON_NORMAL, "%s %p size %d: %s\n", __func__, pbo, sizeinDWORD, szShaderUsage); - - if (!pbo) { - radeon_print(RADEON_MEMORY | RADEON_CS, RADEON_IMPORTANT, "No memory for buffer object. Flushing command buffer.\n"); - rcommonFlushCmdBuf(radeonctx, __FUNCTION__); - goto shader_again_alloc; - } - - radeon_cs_space_add_persistent_bo(radeonctx->cmdbuf.cs, - pbo, - RADEON_GEM_DOMAIN_GTT, 0); - - if (radeon_cs_space_check_with_bo(radeonctx->cmdbuf.cs, - pbo, - RADEON_GEM_DOMAIN_GTT, 0)) { - radeon_error("failure to revalidate BOs - badness\n"); - return GL_FALSE; - } - - radeon_bo_map(pbo, 1); - - out = (uint32_t*)(pbo->ptr); - - for(i = 0; i < sizeinDWORD; i++) { - out[i] = CPU_TO_LE32(*((uint32_t *)data + i)); - } - - radeon_bo_unmap(pbo); - - *shaderbo = (void*)pbo; - - return GL_TRUE; -} - -GLboolean r600DeleteShader(struct gl_context * ctx, - void * shaderbo) -{ - struct radeon_bo * pbo = (struct radeon_bo *)shaderbo; - - radeon_print(RADEON_SHADER, RADEON_NORMAL, "%s: %p\n", __func__, pbo); - - if (pbo) { - if (pbo->ptr) - radeon_bo_unmap(pbo); - radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */ - } - - return GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/r600_emit.h b/src/mesa/drivers/dri/r600/r600_emit.h deleted file mode 100644 index c50b6060ca9..00000000000 --- a/src/mesa/drivers/dri/r600/r600_emit.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** - -Copyright 2008, 2009 Advanced Micro Devices Inc. (AMD) - -Copyright (C) Advanced Micro Devices Inc. (AMD) 2009. 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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - - -#ifndef __R600_EMIT_H__ -#define __R600_EMIT_H__ - -#include "main/glheader.h" -#include "r600_context.h" -#include "r600_cmdbuf.h" -#include "radeon_reg.h" - -void r600EmitCacheFlush(context_t *rmesa); - -extern GLboolean r600EmitShader(struct gl_context * ctx, - void ** shaderbo, - GLvoid * data, - int sizeinDWORD, - char * szShaderUsage); - -extern GLboolean r600DeleteShader(struct gl_context * ctx, - void * shaderbo); - -extern GLboolean r600AllocShaderConsts(struct gl_context * ctx, - void ** constbo, - int sizeinBYTE, - char * szShaderUsage); -GLboolean r600EmitShaderConsts(struct gl_context * ctx, - void * constbo, - int bo_offset, - GLvoid * data, - int sizeinBYTE); - -#endif diff --git a/src/mesa/drivers/dri/r600/r600_reg.h b/src/mesa/drivers/dri/r600/r600_reg.h deleted file mode 100644 index ffe5ee4f74c..00000000000 --- a/src/mesa/drivers/dri/r600/r600_reg.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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 _R600_REG_H_ -#define _R600_REG_H_ - -/* - * Register definitions - */ - -#include "r600_reg_auto_r6xx.h" -#include "r600_reg_r6xx.h" -#include "r600_reg_r7xx.h" - - -/* SET_*_REG offsets + ends */ -enum -{ - SET_CONFIG_REG_offset = 0x00008000, - SET_CONFIG_REG_end = 0x0000ac00, - SET_CONTEXT_REG_offset = 0x00028000, - SET_CONTEXT_REG_end = 0x00029000, - SET_ALU_CONST_offset = 0x00030000, - SET_ALU_CONST_end = 0x00032000, - SET_RESOURCE_offset = 0x00038000, - SET_RESOURCE_end = 0x0003c000, - SET_SAMPLER_offset = 0x0003c000, - SET_SAMPLER_end = 0x0003cff0, - SET_CTL_CONST_offset = 0x0003cff0, - SET_CTL_CONST_end = 0x0003e200, - SET_LOOP_CONST_offset = 0x0003e200, - SET_LOOP_CONST_end = 0x0003e380, - SET_BOOL_CONST_offset = 0x0003e380, - SET_BOOL_CONST_end = 0x00040000, -}; - -/* packet3 IT_SURFACE_BASE_UPDATE bits */ -enum -{ - DEPTH_BASE = (1 << 0), - COLOR0_BASE = (1 << 1), - COLOR1_BASE = (1 << 2), - COLOR2_BASE = (1 << 3), - COLOR3_BASE = (1 << 4), - COLOR4_BASE = (1 << 5), - COLOR5_BASE = (1 << 6), - COLOR6_BASE = (1 << 7), - COLOR7_BASE = (1 << 8), - STRMOUT_BASE0 = (1 << 9), - STRMOUT_BASE1 = (1 << 10), - STRMOUT_BASE2 = (1 << 11), - STRMOUT_BASE3 = (1 << 12), - COHER_BASE0 = (1 << 13), - COHER_BASE1 = (1 << 14), -}; - -/* Packet3 commands */ -enum -{ - IT_NOP = 0x10, - IT_INDIRECT_BUFFER_END = 0x17, - IT_SET_PREDICATION = 0x20, - IT_REG_RMW = 0x21, - IT_COND_EXEC = 0x22, - IT_PRED_EXEC = 0x23, - IT_START_3D_CMDBUF = 0x24, - IT_DRAW_INDEX_2 = 0x27, - IT_CONTEXT_CONTROL = 0x28, - IT_DRAW_INDEX_IMMD_BE = 0x29, - IT_INDEX_TYPE = 0x2A, - IT_DRAW_INDEX = 0x2B, - IT_DRAW_INDEX_AUTO = 0x2D, - IT_DRAW_INDEX_IMMD = 0x2E, - IT_NUM_INSTANCES = 0x2F, - IT_STRMOUT_BUFFER_UPDATE = 0x34, - IT_INDIRECT_BUFFER_MP = 0x38, - IT_MEM_SEMAPHORE = 0x39, - IT_MPEG_INDEX = 0x3A, - IT_WAIT_REG_MEM = 0x3C, - IT_MEM_WRITE = 0x3D, - IT_INDIRECT_BUFFER = 0x32, - IT_CP_INTERRUPT = 0x40, - IT_SURFACE_SYNC = 0x43, - IT_ME_INITIALIZE = 0x44, - IT_COND_WRITE = 0x45, - IT_EVENT_WRITE = 0x46, - IT_EVENT_WRITE_EOP = 0x47, - IT_ONE_REG_WRITE = 0x57, - IT_SET_CONFIG_REG = 0x68, - IT_SET_CONTEXT_REG = 0x69, - IT_SET_ALU_CONST = 0x6A, - IT_SET_BOOL_CONST = 0x6B, - IT_SET_LOOP_CONST = 0x6C, - IT_SET_RESOURCE = 0x6D, - IT_SET_SAMPLER = 0x6E, - IT_SET_CTL_CONST = 0x6F, - IT_SURFACE_BASE_UPDATE = 0x73, -}; - -#endif diff --git a/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h b/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h deleted file mode 100644 index edd85b0facc..00000000000 --- a/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h +++ /dev/null @@ -1,3089 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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 _AUTOREGS -#define _AUTOREGS - -enum { - - VGT_VTX_VECT_EJECT_REG = 0x000088b0, - PRIM_COUNT_mask = 0x3ff << 0, - PRIM_COUNT_shift = 0, - VGT_LAST_COPY_STATE = 0x000088c0, - SRC_STATE_ID_mask = 0x07 << 0, - SRC_STATE_ID_shift = 0, - DST_STATE_ID_mask = 0x07 << 16, - DST_STATE_ID_shift = 16, - VGT_CACHE_INVALIDATION = 0x000088c4, - CACHE_INVALIDATION_mask = 0x03 << 0, - CACHE_INVALIDATION_shift = 0, - VC_ONLY = 0x00, - TC_ONLY = 0x01, - VC_AND_TC = 0x02, - VS_NO_EXTRA_BUFFER_bit = 1 << 5, - VGT_GS_PER_ES = 0x000088c8, - VGT_ES_PER_GS = 0x000088cc, - VGT_GS_VERTEX_REUSE = 0x000088d4, - VERT_REUSE_mask = 0x1f << 0, - VERT_REUSE_shift = 0, - VGT_MC_LAT_CNTL = 0x000088d8, - MC_TIME_STAMP_RES_mask = 0x03 << 0, - MC_TIME_STAMP_RES_shift = 0, - X_0_992_MAX_LATENCY = 0x00, - X_0_496_MAX_LATENCY = 0x01, - X_0_248_MAX_LATENCY = 0x02, - X_0_124_MAX_LATENCY = 0x03, - VGT_GS_PER_VS = 0x000088e8, - GS_PER_VS_mask = 0x0f << 0, - GS_PER_VS_shift = 0, - VGT_CNTL_STATUS = 0x000088f0, - VGT_OUT_INDX_BUSY_bit = 1 << 0, - VGT_OUT_BUSY_bit = 1 << 1, - VGT_PT_BUSY_bit = 1 << 2, - VGT_TE_BUSY_bit = 1 << 3, - VGT_VR_BUSY_bit = 1 << 4, - VGT_GRP_BUSY_bit = 1 << 5, - VGT_DMA_REQ_BUSY_bit = 1 << 6, - VGT_DMA_BUSY_bit = 1 << 7, - VGT_GS_BUSY_bit = 1 << 8, - VGT_BUSY_bit = 1 << 9, - VGT_PRIMITIVE_TYPE = 0x00008958, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask = 0x3f << 0, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift = 0, - DI_PT_NONE = 0x00, - DI_PT_POINTLIST = 0x01, - DI_PT_LINELIST = 0x02, - DI_PT_LINESTRIP = 0x03, - DI_PT_TRILIST = 0x04, - DI_PT_TRIFAN = 0x05, - DI_PT_TRISTRIP = 0x06, - DI_PT_UNUSED_0 = 0x07, - DI_PT_UNUSED_1 = 0x08, - DI_PT_UNUSED_2 = 0x09, - DI_PT_LINELIST_ADJ = 0x0a, - DI_PT_LINESTRIP_ADJ = 0x0b, - DI_PT_TRILIST_ADJ = 0x0c, - DI_PT_TRISTRIP_ADJ = 0x0d, - DI_PT_UNUSED_3 = 0x0e, - DI_PT_UNUSED_4 = 0x0f, - DI_PT_TRI_WITH_WFLAGS = 0x10, - DI_PT_RECTLIST = 0x11, - DI_PT_LINELOOP = 0x12, - DI_PT_QUADLIST = 0x13, - DI_PT_QUADSTRIP = 0x14, - DI_PT_POLYGON = 0x15, - DI_PT_2D_COPY_RECT_LIST_V0 = 0x16, - DI_PT_2D_COPY_RECT_LIST_V1 = 0x17, - DI_PT_2D_COPY_RECT_LIST_V2 = 0x18, - DI_PT_2D_COPY_RECT_LIST_V3 = 0x19, - DI_PT_2D_FILL_RECT_LIST = 0x1a, - DI_PT_2D_LINE_STRIP = 0x1b, - DI_PT_2D_TRI_STRIP = 0x1c, - VGT_INDEX_TYPE = 0x0000895c, - INDEX_TYPE_mask = 0x03 << 0, - INDEX_TYPE_shift = 0, - DI_INDEX_SIZE_16_BIT = 0x00, - DI_INDEX_SIZE_32_BIT = 0x01, - VGT_STRMOUT_BUFFER_FILLED_SIZE_0 = 0x00008960, - VGT_STRMOUT_BUFFER_FILLED_SIZE_1 = 0x00008964, - VGT_STRMOUT_BUFFER_FILLED_SIZE_2 = 0x00008968, - VGT_STRMOUT_BUFFER_FILLED_SIZE_3 = 0x0000896c, - VGT_NUM_INDICES = 0x00008970, - VGT_NUM_INSTANCES = 0x00008974, - PA_CL_CNTL_STATUS = 0x00008a10, - CL_BUSY_bit = 1 << 31, - PA_CL_ENHANCE = 0x00008a14, - CLIP_VTX_REORDER_ENA_bit = 1 << 0, - NUM_CLIP_SEQ_mask = 0x03 << 1, - NUM_CLIP_SEQ_shift = 1, - CLIPPED_PRIM_SEQ_STALL_bit = 1 << 3, - VE_NAN_PROC_DISABLE_bit = 1 << 4, - PA_SU_CNTL_STATUS = 0x00008a50, - SU_BUSY_bit = 1 << 31, - PA_SC_LINE_STIPPLE_STATE = 0x00008b10, - CURRENT_PTR_mask = 0x0f << 0, - CURRENT_PTR_shift = 0, - CURRENT_COUNT_mask = 0xff << 8, - CURRENT_COUNT_shift = 8, - PA_SC_MULTI_CHIP_CNTL = 0x00008b20, - LOG2_NUM_CHIPS_mask = 0x07 << 0, - LOG2_NUM_CHIPS_shift = 0, - MULTI_CHIP_TILE_SIZE_mask = 0x03 << 3, - MULTI_CHIP_TILE_SIZE_shift = 3, - X_16_X_16_PIXEL_TILE_PER_CHIP = 0x00, - X_32_X_32_PIXEL_TILE_PER_CHIP = 0x01, - X_64_X_64_PIXEL_TILE_PER_CHIP = 0x02, - X_128X128_PIXEL_TILE_PER_CHIP = 0x03, - CHIP_TILE_X_LOC_mask = 0x07 << 5, - CHIP_TILE_X_LOC_shift = 5, - CHIP_TILE_Y_LOC_mask = 0x07 << 8, - CHIP_TILE_Y_LOC_shift = 8, - CHIP_SUPER_TILE_B_bit = 1 << 11, - PA_SC_AA_SAMPLE_LOCS_2S = 0x00008b40, - S0_X_mask = 0x0f << 0, - S0_X_shift = 0, - S0_Y_mask = 0x0f << 4, - S0_Y_shift = 4, - S1_X_mask = 0x0f << 8, - S1_X_shift = 8, - S1_Y_mask = 0x0f << 12, - S1_Y_shift = 12, - PA_SC_AA_SAMPLE_LOCS_4S = 0x00008b44, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ - S2_X_mask = 0x0f << 16, - S2_X_shift = 16, - S2_Y_mask = 0x0f << 20, - S2_Y_shift = 20, - S3_X_mask = 0x0f << 24, - S3_X_shift = 24, - S3_Y_mask = 0x0f << 28, - S3_Y_shift = 28, - PA_SC_AA_SAMPLE_LOCS_8S_WD0 = 0x00008b48, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ -/* S2_X_mask = 0x0f << 16, */ -/* S2_X_shift = 16, */ -/* S2_Y_mask = 0x0f << 20, */ -/* S2_Y_shift = 20, */ -/* S3_X_mask = 0x0f << 24, */ -/* S3_X_shift = 24, */ -/* S3_Y_mask = 0x0f << 28, */ -/* S3_Y_shift = 28, */ - PA_SC_AA_SAMPLE_LOCS_8S_WD1 = 0x00008b4c, - S4_X_mask = 0x0f << 0, - S4_X_shift = 0, - S4_Y_mask = 0x0f << 4, - S4_Y_shift = 4, - S5_X_mask = 0x0f << 8, - S5_X_shift = 8, - S5_Y_mask = 0x0f << 12, - S5_Y_shift = 12, - S6_X_mask = 0x0f << 16, - S6_X_shift = 16, - S6_Y_mask = 0x0f << 20, - S6_Y_shift = 20, - S7_X_mask = 0x0f << 24, - S7_X_shift = 24, - S7_Y_mask = 0x0f << 28, - S7_Y_shift = 28, - PA_SC_CNTL_STATUS = 0x00008be0, - MPASS_OVERFLOW_bit = 1 << 30, - PA_SC_ENHANCE = 0x00008bf0, - FORCE_EOV_MAX_CLK_CNT_mask = 0xfff << 0, - FORCE_EOV_MAX_CLK_CNT_shift = 0, - FORCE_EOV_MAX_TILE_CNT_mask = 0xfff << 12, - FORCE_EOV_MAX_TILE_CNT_shift = 12, - SQ_CONFIG = 0x00008c00, - VC_ENABLE_bit = 1 << 0, - EXPORT_SRC_C_bit = 1 << 1, - DX9_CONSTS_bit = 1 << 2, - ALU_INST_PREFER_VECTOR_bit = 1 << 3, - SQ_CONFIG__DX10_CLAMP_bit = 1 << 4, - ALU_PREFER_ONE_WATERFALL_bit = 1 << 5, - ALU_MAX_ONE_WATERFALL_bit = 1 << 6, - CLAUSE_SEQ_PRIO_mask = 0x03 << 8, - CLAUSE_SEQ_PRIO_shift = 8, - SQ_CL_PRIO_RND_ROBIN = 0x00, - SQ_CL_PRIO_MACRO_SEQ = 0x01, - SQ_CL_PRIO_NONE = 0x02, - PS_PRIO_mask = 0x03 << 24, - PS_PRIO_shift = 24, - VS_PRIO_mask = 0x03 << 26, - VS_PRIO_shift = 26, - GS_PRIO_mask = 0x03 << 28, - GS_PRIO_shift = 28, - ES_PRIO_mask = 0x03 << 30, - ES_PRIO_shift = 30, - SQ_GPR_RESOURCE_MGMT_1 = 0x00008c04, - NUM_PS_GPRS_mask = 0xff << 0, - NUM_PS_GPRS_shift = 0, - NUM_VS_GPRS_mask = 0xff << 16, - NUM_VS_GPRS_shift = 16, - NUM_CLAUSE_TEMP_GPRS_mask = 0x0f << 28, - NUM_CLAUSE_TEMP_GPRS_shift = 28, - SQ_GPR_RESOURCE_MGMT_2 = 0x00008c08, - NUM_GS_GPRS_mask = 0xff << 0, - NUM_GS_GPRS_shift = 0, - NUM_ES_GPRS_mask = 0xff << 16, - NUM_ES_GPRS_shift = 16, - SQ_THREAD_RESOURCE_MGMT = 0x00008c0c, - NUM_PS_THREADS_mask = 0xff << 0, - NUM_PS_THREADS_shift = 0, - NUM_VS_THREADS_mask = 0xff << 8, - NUM_VS_THREADS_shift = 8, - NUM_GS_THREADS_mask = 0xff << 16, - NUM_GS_THREADS_shift = 16, - NUM_ES_THREADS_mask = 0xff << 24, - NUM_ES_THREADS_shift = 24, - SQ_STACK_RESOURCE_MGMT_1 = 0x00008c10, - NUM_PS_STACK_ENTRIES_mask = 0xfff << 0, - NUM_PS_STACK_ENTRIES_shift = 0, - NUM_VS_STACK_ENTRIES_mask = 0xfff << 16, - NUM_VS_STACK_ENTRIES_shift = 16, - SQ_STACK_RESOURCE_MGMT_2 = 0x00008c14, - NUM_GS_STACK_ENTRIES_mask = 0xfff << 0, - NUM_GS_STACK_ENTRIES_shift = 0, - NUM_ES_STACK_ENTRIES_mask = 0xfff << 16, - NUM_ES_STACK_ENTRIES_shift = 16, - SQ_ESGS_RING_BASE = 0x00008c40, - SQ_ESGS_RING_SIZE = 0x00008c44, - SQ_GSVS_RING_BASE = 0x00008c48, - SQ_GSVS_RING_SIZE = 0x00008c4c, - SQ_ESTMP_RING_BASE = 0x00008c50, - SQ_ESTMP_RING_SIZE = 0x00008c54, - SQ_GSTMP_RING_BASE = 0x00008c58, - SQ_GSTMP_RING_SIZE = 0x00008c5c, - SQ_VSTMP_RING_BASE = 0x00008c60, - SQ_VSTMP_RING_SIZE = 0x00008c64, - SQ_PSTMP_RING_BASE = 0x00008c68, - SQ_PSTMP_RING_SIZE = 0x00008c6c, - SQ_FBUF_RING_BASE = 0x00008c70, - SQ_FBUF_RING_SIZE = 0x00008c74, - SQ_REDUC_RING_BASE = 0x00008c78, - SQ_REDUC_RING_SIZE = 0x00008c7c, - SQ_ALU_WORD1_OP3 = 0x00008dfc, - SRC2_SEL_mask = 0x1ff << 0, - SRC2_SEL_shift = 0, - SQ_ALU_SRC_0 = 0xf8, - SQ_ALU_SRC_1 = 0xf9, - SQ_ALU_SRC_1_INT = 0xfa, - SQ_ALU_SRC_M_1_INT = 0xfb, - SQ_ALU_SRC_0_5 = 0xfc, - SQ_ALU_SRC_LITERAL = 0xfd, - SQ_ALU_SRC_PV = 0xfe, - SQ_ALU_SRC_PS = 0xff, - SRC2_REL_bit = 1 << 9, - SRC2_CHAN_mask = 0x03 << 10, - SRC2_CHAN_shift = 10, - SQ_CHAN_X = 0x00, - SQ_CHAN_Y = 0x01, - SQ_CHAN_Z = 0x02, - SQ_CHAN_W = 0x03, - SRC2_NEG_bit = 1 << 12, - SQ_ALU_WORD1_OP3__ALU_INST_mask = 0x1f << 13, - SQ_ALU_WORD1_OP3__ALU_INST_shift = 13, - SQ_OP3_INST_MUL_LIT = 0x0c, - SQ_OP3_INST_MUL_LIT_M2 = 0x0d, - SQ_OP3_INST_MUL_LIT_M4 = 0x0e, - SQ_OP3_INST_MUL_LIT_D2 = 0x0f, - SQ_OP3_INST_MULADD = 0x10, - SQ_OP3_INST_MULADD_M2 = 0x11, - SQ_OP3_INST_MULADD_M4 = 0x12, - SQ_OP3_INST_MULADD_D2 = 0x13, - SQ_OP3_INST_MULADD_IEEE = 0x14, - SQ_OP3_INST_MULADD_IEEE_M2 = 0x15, - SQ_OP3_INST_MULADD_IEEE_M4 = 0x16, - SQ_OP3_INST_MULADD_IEEE_D2 = 0x17, - SQ_OP3_INST_CNDE = 0x18, - SQ_OP3_INST_CNDGT = 0x19, - SQ_OP3_INST_CNDGE = 0x1a, - SQ_OP3_INST_CNDE_INT = 0x1c, - SQ_OP3_INST_CNDGT_INT = 0x1d, - SQ_OP3_INST_CNDGE_INT = 0x1e, - SQ_TEX_WORD2 = 0x00008dfc, - OFFSET_X_mask = 0x1f << 0, - OFFSET_X_shift = 0, - OFFSET_Y_mask = 0x1f << 5, - OFFSET_Y_shift = 5, - OFFSET_Z_mask = 0x1f << 10, - OFFSET_Z_shift = 10, - SAMPLER_ID_mask = 0x1f << 15, - SAMPLER_ID_shift = 15, - SQ_TEX_WORD2__SRC_SEL_X_mask = 0x07 << 20, - SQ_TEX_WORD2__SRC_SEL_X_shift = 20, - SQ_SEL_X = 0x00, - SQ_SEL_Y = 0x01, - SQ_SEL_Z = 0x02, - SQ_SEL_W = 0x03, - SQ_SEL_0 = 0x04, - SQ_SEL_1 = 0x05, - SRC_SEL_Y_mask = 0x07 << 23, - SRC_SEL_Y_shift = 23, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SRC_SEL_Z_mask = 0x07 << 26, - SRC_SEL_Z_shift = 26, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SRC_SEL_W_mask = 0x07 << 29, - SRC_SEL_W_shift = 29, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_CF_ALLOC_EXPORT_WORD1 = 0x00008dfc, - BURST_COUNT_mask = 0x0f << 17, - BURST_COUNT_shift = 17, - END_OF_PROGRAM_bit = 1 << 21, - VALID_PIXEL_MODE_bit = 1 << 22, - SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0x7f << 23, - SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_shift = 23, - SQ_CF_INST_MEM_STREAM0 = 0x20, - SQ_CF_INST_MEM_STREAM1 = 0x21, - SQ_CF_INST_MEM_STREAM2 = 0x22, - SQ_CF_INST_MEM_STREAM3 = 0x23, - SQ_CF_INST_MEM_SCRATCH = 0x24, - SQ_CF_INST_MEM_REDUCTION = 0x25, - SQ_CF_INST_MEM_RING = 0x26, - SQ_CF_INST_EXPORT = 0x27, - SQ_CF_INST_EXPORT_DONE = 0x28, - WHOLE_QUAD_MODE_bit = 1 << 30, - BARRIER_bit = 1 << 31, - SQ_CF_ALU_WORD1 = 0x00008dfc, - KCACHE_MODE1_mask = 0x03 << 0, - KCACHE_MODE1_shift = 0, - SQ_CF_KCACHE_NOP = 0x00, - SQ_CF_KCACHE_LOCK_1 = 0x01, - SQ_CF_KCACHE_LOCK_2 = 0x02, - SQ_CF_KCACHE_LOCK_LOOP_INDEX = 0x03, - KCACHE_ADDR0_mask = 0xff << 2, - KCACHE_ADDR0_shift = 2, - KCACHE_ADDR1_mask = 0xff << 10, - KCACHE_ADDR1_shift = 10, - SQ_CF_ALU_WORD1__COUNT_mask = 0x7f << 18, - SQ_CF_ALU_WORD1__COUNT_shift = 18, - SQ_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, - SQ_CF_ALU_WORD1__CF_INST_mask = 0x0f << 26, - SQ_CF_ALU_WORD1__CF_INST_shift = 26, - SQ_CF_INST_ALU = 0x08, - SQ_CF_INST_ALU_PUSH_BEFORE = 0x09, - SQ_CF_INST_ALU_POP_AFTER = 0x0a, - SQ_CF_INST_ALU_POP2_AFTER = 0x0b, - SQ_CF_INST_ALU_CONTINUE = 0x0d, - SQ_CF_INST_ALU_BREAK = 0x0e, - SQ_CF_INST_ALU_ELSE_AFTER = 0x0f, -/* WHOLE_QUAD_MODE_bit = 1 << 30, */ -/* BARRIER_bit = 1 << 31, */ - SQ_TEX_WORD1 = 0x00008dfc, - SQ_TEX_WORD1__DST_GPR_mask = 0x7f << 0, - SQ_TEX_WORD1__DST_GPR_shift = 0, - SQ_TEX_WORD1__DST_REL_bit = 1 << 7, - SQ_TEX_WORD1__DST_SEL_X_mask = 0x07 << 9, - SQ_TEX_WORD1__DST_SEL_X_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_SEL_MASK = 0x07, - SQ_TEX_WORD1__DST_SEL_Y_mask = 0x07 << 12, - SQ_TEX_WORD1__DST_SEL_Y_shift = 12, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__DST_SEL_Z_mask = 0x07 << 15, - SQ_TEX_WORD1__DST_SEL_Z_shift = 15, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__DST_SEL_W_mask = 0x07 << 18, - SQ_TEX_WORD1__DST_SEL_W_shift = 18, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_TEX_WORD1__LOD_BIAS_mask = 0x7f << 21, - SQ_TEX_WORD1__LOD_BIAS_shift = 21, - COORD_TYPE_X_bit = 1 << 28, - COORD_TYPE_Y_bit = 1 << 29, - COORD_TYPE_Z_bit = 1 << 30, - COORD_TYPE_W_bit = 1 << 31, - SQ_VTX_WORD0 = 0x00008dfc, - VTX_INST_mask = 0x1f << 0, - VTX_INST_shift = 0, - SQ_VTX_INST_FETCH = 0x00, - SQ_VTX_INST_SEMANTIC = 0x01, - FETCH_TYPE_mask = 0x03 << 5, - FETCH_TYPE_shift = 5, - SQ_VTX_FETCH_VERTEX_DATA = 0x00, - SQ_VTX_FETCH_INSTANCE_DATA = 0x01, - SQ_VTX_FETCH_NO_INDEX_OFFSET = 0x02, - FETCH_WHOLE_QUAD_bit = 1 << 7, - BUFFER_ID_mask = 0xff << 8, - BUFFER_ID_shift = 8, - SRC_GPR_mask = 0x7f << 16, - SRC_GPR_shift = 16, - SRC_REL_bit = 1 << 23, - SQ_VTX_WORD0__SRC_SEL_X_mask = 0x03 << 24, - SQ_VTX_WORD0__SRC_SEL_X_shift = 24, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ - MEGA_FETCH_COUNT_mask = 0x3f << 26, - MEGA_FETCH_COUNT_shift = 26, - SQ_CF_ALLOC_EXPORT_WORD1_SWIZ = 0x00008dfc, - SEL_X_mask = 0x07 << 0, - SEL_X_shift = 0, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_Y_mask = 0x07 << 3, - SEL_Y_shift = 3, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_Z_mask = 0x07 << 6, - SEL_Z_shift = 6, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SEL_W_mask = 0x07 << 9, - SEL_W_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_ALU_WORD1 = 0x00008dfc, - ENCODING_mask = 0x07 << 15, - ENCODING_shift = 15, - BANK_SWIZZLE_mask = 0x07 << 18, - BANK_SWIZZLE_shift = 18, - SQ_ALU_VEC_012 = 0x00, - SQ_ALU_VEC_021 = 0x01, - SQ_ALU_VEC_120 = 0x02, - SQ_ALU_VEC_102 = 0x03, - SQ_ALU_VEC_201 = 0x04, - SQ_ALU_VEC_210 = 0x05, - SQ_ALU_WORD1__DST_GPR_mask = 0x7f << 21, - SQ_ALU_WORD1__DST_GPR_shift = 21, - SQ_ALU_WORD1__DST_REL_bit = 1 << 28, - DST_CHAN_mask = 0x03 << 29, - DST_CHAN_shift = 29, - CHAN_X = 0x00, - CHAN_Y = 0x01, - CHAN_Z = 0x02, - CHAN_W = 0x03, - SQ_ALU_WORD1__CLAMP_bit = 1 << 31, - SQ_CF_ALU_WORD0 = 0x00008dfc, - SQ_CF_ALU_WORD0__ADDR_mask = 0x3fffff << 0, - SQ_CF_ALU_WORD0__ADDR_shift = 0, - KCACHE_BANK0_mask = 0x0f << 22, - KCACHE_BANK0_shift = 22, - KCACHE_BANK1_mask = 0x0f << 26, - KCACHE_BANK1_shift = 26, - KCACHE_MODE0_mask = 0x03 << 30, - KCACHE_MODE0_shift = 30, -/* SQ_CF_KCACHE_NOP = 0x00, */ -/* SQ_CF_KCACHE_LOCK_1 = 0x01, */ -/* SQ_CF_KCACHE_LOCK_2 = 0x02, */ -/* SQ_CF_KCACHE_LOCK_LOOP_INDEX = 0x03, */ - SQ_VTX_WORD2 = 0x00008dfc, - SQ_VTX_WORD2__OFFSET_mask = 0xffff << 0, - SQ_VTX_WORD2__OFFSET_shift = 0, - SQ_VTX_WORD2__ENDIAN_SWAP_mask = 0x03 << 16, - SQ_VTX_WORD2__ENDIAN_SWAP_shift = 16, - SQ_ENDIAN_NONE = 0x00, - SQ_ENDIAN_8IN16 = 0x01, - SQ_ENDIAN_8IN32 = 0x02, - CONST_BUF_NO_STRIDE_bit = 1 << 18, - MEGA_FETCH_bit = 1 << 19, - SQ_VTX_WORD2__ALT_CONST_bit = 1 << 20, - SQ_ALU_WORD1_OP2_V2 = 0x00008dfc, - SRC0_ABS_bit = 1 << 0, - SRC1_ABS_bit = 1 << 1, - UPDATE_EXECUTE_MASK_bit = 1 << 2, - UPDATE_PRED_bit = 1 << 3, - WRITE_MASK_bit = 1 << 4, - SQ_ALU_WORD1_OP2_V2__OMOD_mask = 0x03 << 5, - SQ_ALU_WORD1_OP2_V2__OMOD_shift = 5, - SQ_ALU_OMOD_OFF = 0x00, - SQ_ALU_OMOD_M2 = 0x01, - SQ_ALU_OMOD_M4 = 0x02, - SQ_ALU_OMOD_D2 = 0x03, - SQ_ALU_WORD1_OP2_V2__ALU_INST_mask = 0x7ff << 7, - SQ_ALU_WORD1_OP2_V2__ALU_INST_shift = 7, - SQ_OP2_INST_ADD = 0x00, - SQ_OP2_INST_MUL = 0x01, - SQ_OP2_INST_MUL_IEEE = 0x02, - SQ_OP2_INST_MAX = 0x03, - SQ_OP2_INST_MIN = 0x04, - SQ_OP2_INST_MAX_DX10 = 0x05, - SQ_OP2_INST_MIN_DX10 = 0x06, - SQ_OP2_INST_SETE = 0x08, - SQ_OP2_INST_SETGT = 0x09, - SQ_OP2_INST_SETGE = 0x0a, - SQ_OP2_INST_SETNE = 0x0b, - SQ_OP2_INST_SETE_DX10 = 0x0c, - SQ_OP2_INST_SETGT_DX10 = 0x0d, - SQ_OP2_INST_SETGE_DX10 = 0x0e, - SQ_OP2_INST_SETNE_DX10 = 0x0f, - SQ_OP2_INST_FRACT = 0x10, - SQ_OP2_INST_TRUNC = 0x11, - SQ_OP2_INST_CEIL = 0x12, - SQ_OP2_INST_RNDNE = 0x13, - SQ_OP2_INST_FLOOR = 0x14, - SQ_OP2_INST_MOVA = 0x15, - SQ_OP2_INST_MOVA_FLOOR = 0x16, - SQ_OP2_INST_MOVA_INT = 0x18, - SQ_OP2_INST_MOV = 0x19, - SQ_OP2_INST_NOP = 0x1a, - SQ_OP2_INST_PRED_SETGT_UINT = 0x1e, - SQ_OP2_INST_PRED_SETGE_UINT = 0x1f, - SQ_OP2_INST_PRED_SETE = 0x20, - SQ_OP2_INST_PRED_SETGT = 0x21, - SQ_OP2_INST_PRED_SETGE = 0x22, - SQ_OP2_INST_PRED_SETNE = 0x23, - SQ_OP2_INST_PRED_SET_INV = 0x24, - SQ_OP2_INST_PRED_SET_POP = 0x25, - SQ_OP2_INST_PRED_SET_CLR = 0x26, - SQ_OP2_INST_PRED_SET_RESTORE = 0x27, - SQ_OP2_INST_PRED_SETE_PUSH = 0x28, - SQ_OP2_INST_PRED_SETGT_PUSH = 0x29, - SQ_OP2_INST_PRED_SETGE_PUSH = 0x2a, - SQ_OP2_INST_PRED_SETNE_PUSH = 0x2b, - SQ_OP2_INST_KILLE = 0x2c, - SQ_OP2_INST_KILLGT = 0x2d, - SQ_OP2_INST_KILLGE = 0x2e, - SQ_OP2_INST_KILLNE = 0x2f, - SQ_OP2_INST_AND_INT = 0x30, - SQ_OP2_INST_OR_INT = 0x31, - SQ_OP2_INST_XOR_INT = 0x32, - SQ_OP2_INST_NOT_INT = 0x33, - SQ_OP2_INST_ADD_INT = 0x34, - SQ_OP2_INST_SUB_INT = 0x35, - SQ_OP2_INST_MAX_INT = 0x36, - SQ_OP2_INST_MIN_INT = 0x37, - SQ_OP2_INST_MAX_UINT = 0x38, - SQ_OP2_INST_MIN_UINT = 0x39, - SQ_OP2_INST_SETE_INT = 0x3a, - SQ_OP2_INST_SETGT_INT = 0x3b, - SQ_OP2_INST_SETGE_INT = 0x3c, - SQ_OP2_INST_SETNE_INT = 0x3d, - SQ_OP2_INST_SETGT_UINT = 0x3e, - SQ_OP2_INST_SETGE_UINT = 0x3f, - SQ_OP2_INST_KILLGT_UINT = 0x40, - SQ_OP2_INST_KILLGE_UINT = 0x41, - SQ_OP2_INST_PRED_SETE_INT = 0x42, - SQ_OP2_INST_PRED_SETGT_INT = 0x43, - SQ_OP2_INST_PRED_SETGE_INT = 0x44, - SQ_OP2_INST_PRED_SETNE_INT = 0x45, - SQ_OP2_INST_KILLE_INT = 0x46, - SQ_OP2_INST_KILLGT_INT = 0x47, - SQ_OP2_INST_KILLGE_INT = 0x48, - SQ_OP2_INST_KILLNE_INT = 0x49, - SQ_OP2_INST_PRED_SETE_PUSH_INT = 0x4a, - SQ_OP2_INST_PRED_SETGT_PUSH_INT = 0x4b, - SQ_OP2_INST_PRED_SETGE_PUSH_INT = 0x4c, - SQ_OP2_INST_PRED_SETNE_PUSH_INT = 0x4d, - SQ_OP2_INST_PRED_SETLT_PUSH_INT = 0x4e, - SQ_OP2_INST_PRED_SETLE_PUSH_INT = 0x4f, - SQ_OP2_INST_DOT4 = 0x50, - SQ_OP2_INST_DOT4_IEEE = 0x51, - SQ_OP2_INST_CUBE = 0x52, - SQ_OP2_INST_MAX4 = 0x53, - SQ_OP2_INST_MOVA_GPR_INT = 0x60, - SQ_OP2_INST_EXP_IEEE = 0x61, - SQ_OP2_INST_LOG_CLAMPED = 0x62, - SQ_OP2_INST_LOG_IEEE = 0x63, - SQ_OP2_INST_RECIP_CLAMPED = 0x64, - SQ_OP2_INST_RECIP_FF = 0x65, - SQ_OP2_INST_RECIP_IEEE = 0x66, - SQ_OP2_INST_RECIPSQRT_CLAMPED = 0x67, - SQ_OP2_INST_RECIPSQRT_FF = 0x68, - SQ_OP2_INST_RECIPSQRT_IEEE = 0x69, - SQ_OP2_INST_SQRT_IEEE = 0x6a, - SQ_OP2_INST_FLT_TO_INT = 0x6b, - SQ_OP2_INST_INT_TO_FLT = 0x6c, - SQ_OP2_INST_UINT_TO_FLT = 0x6d, - SQ_OP2_INST_SIN = 0x6e, - SQ_OP2_INST_COS = 0x6f, - SQ_OP2_INST_ASHR_INT = 0x70, - SQ_OP2_INST_LSHR_INT = 0x71, - SQ_OP2_INST_LSHL_INT = 0x72, - SQ_OP2_INST_MULLO_INT = 0x73, - SQ_OP2_INST_MULHI_INT = 0x74, - SQ_OP2_INST_MULLO_UINT = 0x75, - SQ_OP2_INST_MULHI_UINT = 0x76, - SQ_OP2_INST_RECIP_INT = 0x77, - SQ_OP2_INST_RECIP_UINT = 0x78, - SQ_OP2_INST_FLT_TO_UINT = 0x79, - SQ_CF_ALLOC_EXPORT_WORD1_BUF = 0x00008dfc, - ARRAY_SIZE_mask = 0xfff << 0, - ARRAY_SIZE_shift = 0, - COMP_MASK_mask = 0x0f << 12, - COMP_MASK_shift = 12, - SQ_CF_WORD0 = 0x00008dfc, - SQ_CF_ALLOC_EXPORT_WORD0 = 0x00008dfc, - ARRAY_BASE_mask = 0x1fff << 0, - ARRAY_BASE_shift = 0, - SQ_CF_ALLOC_EXPORT_WORD0__TYPE_mask = 0x03 << 13, - SQ_CF_ALLOC_EXPORT_WORD0__TYPE_shift = 13, - SQ_EXPORT_PIXEL = 0x00, - SQ_EXPORT_POS = 0x01, - SQ_EXPORT_PARAM = 0x02, - X_UNUSED_FOR_SX_EXPORTS = 0x03, - RW_GPR_mask = 0x7f << 15, - RW_GPR_shift = 15, - RW_REL_bit = 1 << 22, - INDEX_GPR_mask = 0x7f << 23, - INDEX_GPR_shift = 23, - ELEM_SIZE_mask = 0x03 << 30, - ELEM_SIZE_shift = 30, - SQ_VTX_WORD1 = 0x00008dfc, - SQ_VTX_WORD1__DST_SEL_X_mask = 0x07 << 9, - SQ_VTX_WORD1__DST_SEL_X_shift = 9, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_Y_mask = 0x07 << 12, - SQ_VTX_WORD1__DST_SEL_Y_shift = 12, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_Z_mask = 0x07 << 15, - SQ_VTX_WORD1__DST_SEL_Z_shift = 15, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - SQ_VTX_WORD1__DST_SEL_W_mask = 0x07 << 18, - SQ_VTX_WORD1__DST_SEL_W_shift = 18, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ -/* SQ_SEL_MASK = 0x07, */ - USE_CONST_FIELDS_bit = 1 << 21, - SQ_VTX_WORD1__DATA_FORMAT_mask = 0x3f << 22, - SQ_VTX_WORD1__DATA_FORMAT_shift = 22, - SQ_VTX_WORD1__NUM_FORMAT_ALL_mask = 0x03 << 28, - SQ_VTX_WORD1__NUM_FORMAT_ALL_shift = 28, - SQ_NUM_FORMAT_NORM = 0x00, - SQ_NUM_FORMAT_INT = 0x01, - SQ_NUM_FORMAT_SCALED = 0x02, - SQ_VTX_WORD1__FORMAT_COMP_ALL_bit = 1 << 30, - SQ_VTX_WORD1__SRF_MODE_ALL_bit = 1 << 31, - SQ_ALU_WORD1_OP2 = 0x00008dfc, -/* SRC0_ABS_bit = 1 << 0, */ -/* SRC1_ABS_bit = 1 << 1, */ -/* UPDATE_EXECUTE_MASK_bit = 1 << 2, */ -/* UPDATE_PRED_bit = 1 << 3, */ -/* WRITE_MASK_bit = 1 << 4, */ - FOG_MERGE_bit = 1 << 5, - SQ_ALU_WORD1_OP2__OMOD_mask = 0x03 << 6, - SQ_ALU_WORD1_OP2__OMOD_shift = 6, -/* SQ_ALU_OMOD_OFF = 0x00, */ -/* SQ_ALU_OMOD_M2 = 0x01, */ -/* SQ_ALU_OMOD_M4 = 0x02, */ -/* SQ_ALU_OMOD_D2 = 0x03, */ - SQ_ALU_WORD1_OP2__ALU_INST_mask = 0x3ff << 8, - SQ_ALU_WORD1_OP2__ALU_INST_shift = 8, -/* SQ_OP2_INST_ADD = 0x00, */ -/* SQ_OP2_INST_MUL = 0x01, */ -/* SQ_OP2_INST_MUL_IEEE = 0x02, */ -/* SQ_OP2_INST_MAX = 0x03, */ -/* SQ_OP2_INST_MIN = 0x04, */ -/* SQ_OP2_INST_MAX_DX10 = 0x05, */ -/* SQ_OP2_INST_MIN_DX10 = 0x06, */ -/* SQ_OP2_INST_SETE = 0x08, */ -/* SQ_OP2_INST_SETGT = 0x09, */ -/* SQ_OP2_INST_SETGE = 0x0a, */ -/* SQ_OP2_INST_SETNE = 0x0b, */ -/* SQ_OP2_INST_SETE_DX10 = 0x0c, */ -/* SQ_OP2_INST_SETGT_DX10 = 0x0d, */ -/* SQ_OP2_INST_SETGE_DX10 = 0x0e, */ -/* SQ_OP2_INST_SETNE_DX10 = 0x0f, */ -/* SQ_OP2_INST_FRACT = 0x10, */ -/* SQ_OP2_INST_TRUNC = 0x11, */ -/* SQ_OP2_INST_CEIL = 0x12, */ -/* SQ_OP2_INST_RNDNE = 0x13, */ -/* SQ_OP2_INST_FLOOR = 0x14, */ -/* SQ_OP2_INST_MOVA = 0x15, */ -/* SQ_OP2_INST_MOVA_FLOOR = 0x16, */ -/* SQ_OP2_INST_MOVA_INT = 0x18, */ -/* SQ_OP2_INST_MOV = 0x19, */ -/* SQ_OP2_INST_NOP = 0x1a, */ -/* SQ_OP2_INST_PRED_SETGT_UINT = 0x1e, */ -/* SQ_OP2_INST_PRED_SETGE_UINT = 0x1f, */ -/* SQ_OP2_INST_PRED_SETE = 0x20, */ -/* SQ_OP2_INST_PRED_SETGT = 0x21, */ -/* SQ_OP2_INST_PRED_SETGE = 0x22, */ -/* SQ_OP2_INST_PRED_SETNE = 0x23, */ -/* SQ_OP2_INST_PRED_SET_INV = 0x24, */ -/* SQ_OP2_INST_PRED_SET_POP = 0x25, */ -/* SQ_OP2_INST_PRED_SET_CLR = 0x26, */ -/* SQ_OP2_INST_PRED_SET_RESTORE = 0x27, */ -/* SQ_OP2_INST_PRED_SETE_PUSH = 0x28, */ -/* SQ_OP2_INST_PRED_SETGT_PUSH = 0x29, */ -/* SQ_OP2_INST_PRED_SETGE_PUSH = 0x2a, */ -/* SQ_OP2_INST_PRED_SETNE_PUSH = 0x2b, */ -/* SQ_OP2_INST_KILLE = 0x2c, */ -/* SQ_OP2_INST_KILLGT = 0x2d, */ -/* SQ_OP2_INST_KILLGE = 0x2e, */ -/* SQ_OP2_INST_KILLNE = 0x2f, */ -/* SQ_OP2_INST_AND_INT = 0x30, */ -/* SQ_OP2_INST_OR_INT = 0x31, */ -/* SQ_OP2_INST_XOR_INT = 0x32, */ -/* SQ_OP2_INST_NOT_INT = 0x33, */ -/* SQ_OP2_INST_ADD_INT = 0x34, */ -/* SQ_OP2_INST_SUB_INT = 0x35, */ -/* SQ_OP2_INST_MAX_INT = 0x36, */ -/* SQ_OP2_INST_MIN_INT = 0x37, */ -/* SQ_OP2_INST_MAX_UINT = 0x38, */ -/* SQ_OP2_INST_MIN_UINT = 0x39, */ -/* SQ_OP2_INST_SETE_INT = 0x3a, */ -/* SQ_OP2_INST_SETGT_INT = 0x3b, */ -/* SQ_OP2_INST_SETGE_INT = 0x3c, */ -/* SQ_OP2_INST_SETNE_INT = 0x3d, */ -/* SQ_OP2_INST_SETGT_UINT = 0x3e, */ -/* SQ_OP2_INST_SETGE_UINT = 0x3f, */ -/* SQ_OP2_INST_KILLGT_UINT = 0x40, */ -/* SQ_OP2_INST_KILLGE_UINT = 0x41, */ -/* SQ_OP2_INST_PRED_SETE_INT = 0x42, */ -/* SQ_OP2_INST_PRED_SETGT_INT = 0x43, */ -/* SQ_OP2_INST_PRED_SETGE_INT = 0x44, */ -/* SQ_OP2_INST_PRED_SETNE_INT = 0x45, */ -/* SQ_OP2_INST_KILLE_INT = 0x46, */ -/* SQ_OP2_INST_KILLGT_INT = 0x47, */ -/* SQ_OP2_INST_KILLGE_INT = 0x48, */ -/* SQ_OP2_INST_KILLNE_INT = 0x49, */ -/* SQ_OP2_INST_PRED_SETE_PUSH_INT = 0x4a, */ -/* SQ_OP2_INST_PRED_SETGT_PUSH_INT = 0x4b, */ -/* SQ_OP2_INST_PRED_SETGE_PUSH_INT = 0x4c, */ -/* SQ_OP2_INST_PRED_SETNE_PUSH_INT = 0x4d, */ -/* SQ_OP2_INST_PRED_SETLT_PUSH_INT = 0x4e, */ -/* SQ_OP2_INST_PRED_SETLE_PUSH_INT = 0x4f, */ -/* SQ_OP2_INST_DOT4 = 0x50, */ -/* SQ_OP2_INST_DOT4_IEEE = 0x51, */ -/* SQ_OP2_INST_CUBE = 0x52, */ -/* SQ_OP2_INST_MAX4 = 0x53, */ -/* SQ_OP2_INST_MOVA_GPR_INT = 0x60, */ -/* SQ_OP2_INST_EXP_IEEE = 0x61, */ -/* SQ_OP2_INST_LOG_CLAMPED = 0x62, */ -/* SQ_OP2_INST_LOG_IEEE = 0x63, */ -/* SQ_OP2_INST_RECIP_CLAMPED = 0x64, */ -/* SQ_OP2_INST_RECIP_FF = 0x65, */ -/* SQ_OP2_INST_RECIP_IEEE = 0x66, */ -/* SQ_OP2_INST_RECIPSQRT_CLAMPED = 0x67, */ -/* SQ_OP2_INST_RECIPSQRT_FF = 0x68, */ -/* SQ_OP2_INST_RECIPSQRT_IEEE = 0x69, */ -/* SQ_OP2_INST_SQRT_IEEE = 0x6a, */ -/* SQ_OP2_INST_FLT_TO_INT = 0x6b, */ -/* SQ_OP2_INST_INT_TO_FLT = 0x6c, */ -/* SQ_OP2_INST_UINT_TO_FLT = 0x6d, */ -/* SQ_OP2_INST_SIN = 0x6e, */ -/* SQ_OP2_INST_COS = 0x6f, */ -/* SQ_OP2_INST_ASHR_INT = 0x70, */ -/* SQ_OP2_INST_LSHR_INT = 0x71, */ -/* SQ_OP2_INST_LSHL_INT = 0x72, */ -/* SQ_OP2_INST_MULLO_INT = 0x73, */ -/* SQ_OP2_INST_MULHI_INT = 0x74, */ -/* SQ_OP2_INST_MULLO_UINT = 0x75, */ -/* SQ_OP2_INST_MULHI_UINT = 0x76, */ -/* SQ_OP2_INST_RECIP_INT = 0x77, */ -/* SQ_OP2_INST_RECIP_UINT = 0x78, */ -/* SQ_OP2_INST_FLT_TO_UINT = 0x79, */ - SQ_CF_WORD1 = 0x00008dfc, - POP_COUNT_mask = 0x07 << 0, - POP_COUNT_shift = 0, - CF_CONST_mask = 0x1f << 3, - CF_CONST_shift = 3, - COND_mask = 0x03 << 8, - COND_shift = 8, - SQ_CF_COND_ACTIVE = 0x00, - SQ_CF_COND_FALSE = 0x01, - SQ_CF_COND_BOOL = 0x02, - SQ_CF_COND_NOT_BOOL = 0x03, - SQ_CF_WORD1__COUNT_mask = 0x07 << 10, - SQ_CF_WORD1__COUNT_shift = 10, - CALL_COUNT_mask = 0x3f << 13, - CALL_COUNT_shift = 13, - COUNT_3_bit = 1 << 19, -/* END_OF_PROGRAM_bit = 1 << 21, */ -/* VALID_PIXEL_MODE_bit = 1 << 22, */ - SQ_CF_WORD1__CF_INST_mask = 0x7f << 23, - SQ_CF_WORD1__CF_INST_shift = 23, - SQ_CF_INST_NOP = 0x00, - SQ_CF_INST_TEX = 0x01, - SQ_CF_INST_VTX = 0x02, - SQ_CF_INST_VTX_TC = 0x03, - SQ_CF_INST_LOOP_START = 0x04, - SQ_CF_INST_LOOP_END = 0x05, - SQ_CF_INST_LOOP_START_DX10 = 0x06, - SQ_CF_INST_LOOP_START_NO_AL = 0x07, - SQ_CF_INST_LOOP_CONTINUE = 0x08, - SQ_CF_INST_LOOP_BREAK = 0x09, - SQ_CF_INST_JUMP = 0x0a, - SQ_CF_INST_PUSH = 0x0b, - SQ_CF_INST_PUSH_ELSE = 0x0c, - SQ_CF_INST_ELSE = 0x0d, - SQ_CF_INST_POP = 0x0e, - SQ_CF_INST_POP_JUMP = 0x0f, - SQ_CF_INST_POP_PUSH = 0x10, - SQ_CF_INST_POP_PUSH_ELSE = 0x11, - SQ_CF_INST_CALL = 0x12, - SQ_CF_INST_CALL_FS = 0x13, - SQ_CF_INST_RETURN = 0x14, - SQ_CF_INST_EMIT_VERTEX = 0x15, - SQ_CF_INST_EMIT_CUT_VERTEX = 0x16, - SQ_CF_INST_CUT_VERTEX = 0x17, - SQ_CF_INST_KILL = 0x18, -/* WHOLE_QUAD_MODE_bit = 1 << 30, */ -/* BARRIER_bit = 1 << 31, */ - SQ_VTX_WORD1_SEM = 0x00008dfc, - SEMANTIC_ID_mask = 0xff << 0, - SEMANTIC_ID_shift = 0, - SQ_TEX_WORD0 = 0x00008dfc, - TEX_INST_mask = 0x1f << 0, - TEX_INST_shift = 0, - SQ_TEX_INST_VTX_FETCH = 0x00, - SQ_TEX_INST_VTX_SEMANTIC = 0x01, - SQ_TEX_INST_LD = 0x03, - SQ_TEX_INST_GET_TEXTURE_RESINFO = 0x04, - SQ_TEX_INST_GET_NUMBER_OF_SAMPLES = 0x05, - SQ_TEX_INST_GET_LOD = 0x06, - SQ_TEX_INST_GET_GRADIENTS_H = 0x07, - SQ_TEX_INST_GET_GRADIENTS_V = 0x08, - SQ_TEX_INST_GET_LERP = 0x09, - SQ_TEX_INST_RESERVED_10 = 0x0a, - SQ_TEX_INST_SET_GRADIENTS_H = 0x0b, - SQ_TEX_INST_SET_GRADIENTS_V = 0x0c, - SQ_TEX_INST_PASS = 0x0d, - X_Z_SET_INDEX_FOR_ARRAY_OF_CUBEMAPS = 0x0e, - SQ_TEX_INST_SAMPLE = 0x10, - SQ_TEX_INST_SAMPLE_L = 0x11, - SQ_TEX_INST_SAMPLE_LB = 0x12, - SQ_TEX_INST_SAMPLE_LZ = 0x13, - SQ_TEX_INST_SAMPLE_G = 0x14, - SQ_TEX_INST_SAMPLE_G_L = 0x15, - SQ_TEX_INST_SAMPLE_G_LB = 0x16, - SQ_TEX_INST_SAMPLE_G_LZ = 0x17, - SQ_TEX_INST_SAMPLE_C = 0x18, - SQ_TEX_INST_SAMPLE_C_L = 0x19, - SQ_TEX_INST_SAMPLE_C_LB = 0x1a, - SQ_TEX_INST_SAMPLE_C_LZ = 0x1b, - SQ_TEX_INST_SAMPLE_C_G = 0x1c, - SQ_TEX_INST_SAMPLE_C_G_L = 0x1d, - SQ_TEX_INST_SAMPLE_C_G_LB = 0x1e, - SQ_TEX_INST_SAMPLE_C_G_LZ = 0x1f, - BC_FRAC_MODE_bit = 1 << 5, -/* FETCH_WHOLE_QUAD_bit = 1 << 7, */ - RESOURCE_ID_mask = 0xff << 8, - RESOURCE_ID_shift = 8, -/* SRC_GPR_mask = 0x7f << 16, */ -/* SRC_GPR_shift = 16, */ -/* SRC_REL_bit = 1 << 23, */ - SQ_TEX_WORD0__ALT_CONST_bit = 1 << 24, - SQ_VTX_WORD1_GPR = 0x00008dfc, - SQ_VTX_WORD1_GPR__DST_GPR_mask = 0x7f << 0, - SQ_VTX_WORD1_GPR__DST_GPR_shift = 0, - SQ_VTX_WORD1_GPR__DST_REL_bit = 1 << 7, - SQ_ALU_WORD0 = 0x00008dfc, - SRC0_SEL_mask = 0x1ff << 0, - SRC0_SEL_shift = 0, -/* SQ_ALU_SRC_0 = 0xf8, */ -/* SQ_ALU_SRC_1 = 0xf9, */ -/* SQ_ALU_SRC_1_INT = 0xfa, */ -/* SQ_ALU_SRC_M_1_INT = 0xfb, */ -/* SQ_ALU_SRC_0_5 = 0xfc, */ -/* SQ_ALU_SRC_LITERAL = 0xfd, */ -/* SQ_ALU_SRC_PV = 0xfe, */ -/* SQ_ALU_SRC_PS = 0xff, */ - SRC0_REL_bit = 1 << 9, - SRC0_CHAN_mask = 0x03 << 10, - SRC0_CHAN_shift = 10, -/* SQ_CHAN_X = 0x00, */ -/* SQ_CHAN_Y = 0x01, */ -/* SQ_CHAN_Z = 0x02, */ -/* SQ_CHAN_W = 0x03, */ - SRC0_NEG_bit = 1 << 12, - SRC1_SEL_mask = 0x1ff << 13, - SRC1_SEL_shift = 13, -/* SQ_ALU_SRC_0 = 0xf8, */ -/* SQ_ALU_SRC_1 = 0xf9, */ -/* SQ_ALU_SRC_1_INT = 0xfa, */ -/* SQ_ALU_SRC_M_1_INT = 0xfb, */ -/* SQ_ALU_SRC_0_5 = 0xfc, */ -/* SQ_ALU_SRC_LITERAL = 0xfd, */ -/* SQ_ALU_SRC_PV = 0xfe, */ -/* SQ_ALU_SRC_PS = 0xff, */ - SRC1_REL_bit = 1 << 22, - SRC1_CHAN_mask = 0x03 << 23, - SRC1_CHAN_shift = 23, -/* SQ_CHAN_X = 0x00, */ -/* SQ_CHAN_Y = 0x01, */ -/* SQ_CHAN_Z = 0x02, */ -/* SQ_CHAN_W = 0x03, */ - SRC1_NEG_bit = 1 << 25, - INDEX_MODE_mask = 0x07 << 26, - INDEX_MODE_shift = 26, - SQ_INDEX_AR_X = 0x00, - SQ_INDEX_AR_Y = 0x01, - SQ_INDEX_AR_Z = 0x02, - SQ_INDEX_AR_W = 0x03, - SQ_INDEX_LOOP = 0x04, - PRED_SEL_mask = 0x03 << 29, - PRED_SEL_shift = 29, - SQ_PRED_SEL_OFF = 0x00, - SQ_PRED_SEL_ZERO = 0x02, - SQ_PRED_SEL_ONE = 0x03, - LAST_bit = 1 << 31, - SX_EXPORT_BUFFER_SIZES = 0x0000900c, - COLOR_BUFFER_SIZE_mask = 0xff << 0, - COLOR_BUFFER_SIZE_shift = 0, - POSITION_BUFFER_SIZE_mask = 0xff << 8, - POSITION_BUFFER_SIZE_shift = 8, - SMX_BUFFER_SIZE_mask = 0xff << 16, - SMX_BUFFER_SIZE_shift = 16, - SX_MEMORY_EXPORT_BASE = 0x00009010, - SX_MEMORY_EXPORT_SIZE = 0x00009014, - SPI_CONFIG_CNTL = 0x00009100, - GPR_WRITE_PRIORITY_mask = 0x1f << 0, - GPR_WRITE_PRIORITY_shift = 0, - X_PRIORITY_ORDER = 0x00, - X_PRIORITY_ORDER_VS = 0x01, - DISABLE_INTERP_1_bit = 1 << 5, - DEBUG_THREAD_TYPE_SEL_mask = 0x03 << 6, - DEBUG_THREAD_TYPE_SEL_shift = 6, - DEBUG_GROUP_SEL_mask = 0x1f << 8, - DEBUG_GROUP_SEL_shift = 8, - DEBUG_GRBM_OVERRIDE_bit = 1 << 13, - SPI_CONFIG_CNTL_1 = 0x0000913c, - VTX_DONE_DELAY_mask = 0x0f << 0, - VTX_DONE_DELAY_shift = 0, - X_DELAY_10_CLKS = 0x00, - X_DELAY_11_CLKS = 0x01, - X_DELAY_12_CLKS = 0x02, - X_DELAY_13_CLKS = 0x03, - X_DELAY_14_CLKS = 0x04, - X_DELAY_15_CLKS = 0x05, - X_DELAY_16_CLKS = 0x06, - X_DELAY_17_CLKS = 0x07, - X_DELAY_2_CLKS = 0x08, - X_DELAY_3_CLKS = 0x09, - X_DELAY_4_CLKS = 0x0a, - X_DELAY_5_CLKS = 0x0b, - X_DELAY_6_CLKS = 0x0c, - X_DELAY_7_CLKS = 0x0d, - X_DELAY_8_CLKS = 0x0e, - X_DELAY_9_CLKS = 0x0f, - INTERP_ONE_PRIM_PER_ROW_bit = 1 << 4, - TD_FILTER4 = 0x00009400, - WEIGHT_1_mask = 0x7ff << 0, - WEIGHT_1_shift = 0, - WEIGHT_0_mask = 0x7ff << 11, - WEIGHT_0_shift = 11, - WEIGHT_PAIR_bit = 1 << 22, - PHASE_mask = 0x0f << 23, - PHASE_shift = 23, - DIRECTION_bit = 1 << 27, - TD_FILTER4_1 = 0x00009404, - TD_FILTER4_1_num = 35, -/* WEIGHT_1_mask = 0x7ff << 0, */ -/* WEIGHT_1_shift = 0, */ -/* WEIGHT_0_mask = 0x7ff << 11, */ -/* WEIGHT_0_shift = 11, */ - TD_CNTL = 0x00009490, - SYNC_PHASE_SH_mask = 0x03 << 0, - SYNC_PHASE_SH_shift = 0, - SYNC_PHASE_VC_SMX_mask = 0x03 << 4, - SYNC_PHASE_VC_SMX_shift = 4, - TD0_CNTL = 0x00009494, - TD0_CNTL_num = 4, - ID_OVERRIDE_mask = 0x03 << 28, - ID_OVERRIDE_shift = 28, - TD0_STATUS = 0x000094a4, - TD0_STATUS_num = 4, - BUSY_bit = 1 << 31, - TA_CNTL = 0x00009504, - GRADIENT_CREDIT_mask = 0x1f << 0, - GRADIENT_CREDIT_shift = 0, - WALKER_CREDIT_mask = 0x1f << 8, - WALKER_CREDIT_shift = 8, - ALIGNER_CREDIT_mask = 0x1f << 16, - ALIGNER_CREDIT_shift = 16, - TD_FIFO_CREDIT_mask = 0x3ff << 22, - TD_FIFO_CREDIT_shift = 22, - TA_CNTL_AUX = 0x00009508, - DISABLE_CUBE_WRAP_bit = 1 << 0, - SYNC_GRADIENT_bit = 1 << 24, - SYNC_WALKER_bit = 1 << 25, - SYNC_ALIGNER_bit = 1 << 26, - BILINEAR_PRECISION_bit = 1 << 31, - TA0_CNTL = 0x00009510, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA1_CNTL = 0x00009514, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA2_CNTL = 0x00009518, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA3_CNTL = 0x0000951c, -/* ID_OVERRIDE_mask = 0x03 << 28, */ -/* ID_OVERRIDE_shift = 28, */ - TA0_STATUS = 0x00009520, - FG_PFIFO_EMPTYB_bit = 1 << 12, - FG_LFIFO_EMPTYB_bit = 1 << 13, - FG_SFIFO_EMPTYB_bit = 1 << 14, - FL_PFIFO_EMPTYB_bit = 1 << 16, - FL_LFIFO_EMPTYB_bit = 1 << 17, - FL_SFIFO_EMPTYB_bit = 1 << 18, - FA_PFIFO_EMPTYB_bit = 1 << 20, - FA_LFIFO_EMPTYB_bit = 1 << 21, - FA_SFIFO_EMPTYB_bit = 1 << 22, - IN_BUSY_bit = 1 << 24, - FG_BUSY_bit = 1 << 25, - FL_BUSY_bit = 1 << 27, - TA_BUSY_bit = 1 << 28, - FA_BUSY_bit = 1 << 29, - AL_BUSY_bit = 1 << 30, -/* BUSY_bit = 1 << 31, */ - TA1_STATUS = 0x00009524, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TA2_STATUS = 0x00009528, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TA3_STATUS = 0x0000952c, -/* FG_PFIFO_EMPTYB_bit = 1 << 12, */ -/* FG_LFIFO_EMPTYB_bit = 1 << 13, */ -/* FG_SFIFO_EMPTYB_bit = 1 << 14, */ -/* FL_PFIFO_EMPTYB_bit = 1 << 16, */ -/* FL_LFIFO_EMPTYB_bit = 1 << 17, */ -/* FL_SFIFO_EMPTYB_bit = 1 << 18, */ -/* FA_PFIFO_EMPTYB_bit = 1 << 20, */ -/* FA_LFIFO_EMPTYB_bit = 1 << 21, */ -/* FA_SFIFO_EMPTYB_bit = 1 << 22, */ -/* IN_BUSY_bit = 1 << 24, */ -/* FG_BUSY_bit = 1 << 25, */ -/* FL_BUSY_bit = 1 << 27, */ -/* TA_BUSY_bit = 1 << 28, */ -/* FA_BUSY_bit = 1 << 29, */ -/* AL_BUSY_bit = 1 << 30, */ -/* BUSY_bit = 1 << 31, */ - TC_STATUS = 0x00009600, - TC_BUSY_bit = 1 << 0, - TC_INVALIDATE = 0x00009604, - START_bit = 1 << 0, - TC_CNTL = 0x00009608, - FORCE_HIT_bit = 1 << 0, - FORCE_MISS_bit = 1 << 1, - L2_SIZE_mask = 0x0f << 5, - L2_SIZE_shift = 5, - _256K = 0x00, - _224K = 0x01, - _192K = 0x02, - _160K = 0x03, - _128K = 0x04, - _96K = 0x05, - _64K = 0x06, - _32K = 0x07, - L2_DISABLE_LATE_HIT_bit = 1 << 9, - DISABLE_VERT_PERF_bit = 1 << 10, - DISABLE_INVAL_BUSY_bit = 1 << 11, - DISABLE_INVAL_SAME_SURFACE_bit = 1 << 12, - PARTITION_MODE_mask = 0x03 << 13, - PARTITION_MODE_shift = 13, - X_VERTEX = 0x00, - MISS_ARB_MODE_bit = 1 << 15, - HIT_ARB_MODE_bit = 1 << 16, - DISABLE_WRITE_DELAY_bit = 1 << 17, - HIT_FIFO_DEPTH_bit = 1 << 18, - VC_CNTL = 0x00009700, - L2_INVALIDATE_bit = 1 << 0, - RESERVED_bit = 1 << 1, - CC_FORCE_MISS_bit = 1 << 2, - MI_CHAN_SEL_mask = 0x03 << 3, - MI_CHAN_SEL_shift = 3, - X_MC0_USES_CH_0_1 = 0x00, - X_MC0_USES_CH_0_3 = 0x01, - X_VC_MC0_IS_ACTIVE = 0x02, - X_VC_MC1_IS_DISABLED = 0x03, - MI_STEER_DISABLE_bit = 1 << 5, - MI_CREDIT_CTR_mask = 0x0f << 6, - MI_CREDIT_CTR_shift = 6, - MI_CREDIT_WE_bit = 1 << 10, - MI_REQ_STALL_THLD_mask = 0x07 << 11, - MI_REQ_STALL_THLD_shift = 11, - X_LATENCY_EXCEEDS_399_CLOCKS = 0x00, - X_LATENCY_EXCEEDS_415_CLOCKS = 0x01, - X_LATENCY_EXCEEDS_431_CLOCKS = 0x02, - X_LATENCY_EXCEEDS_447_CLOCKS = 0x03, - X_LATENCY_EXCEEDS_463_CLOCKS = 0x04, - X_LATENCY_EXCEEDS_479_CLOCKS = 0x05, - X_LATENCY_EXCEEDS_495_CLOCKS = 0x06, - X_LATENCY_EXCEEDS_511_CLOCKS = 0x07, - VC_CNTL__MI_TIMESTAMP_RES_mask = 0x1f << 14, - VC_CNTL__MI_TIMESTAMP_RES_shift = 14, - X_1X_SYSTEM_CLOCK = 0x00, - X_2X_SYSTEM_CLOCK = 0x01, - X_4X_SYSTEM_CLOCK = 0x02, - X_8X_SYSTEM_CLOCK = 0x03, - X_16X_SYSTEM_CLOCK = 0x04, - X_32X_SYSTEM_CLOCK = 0x05, - X_64X_SYSTEM_CLOCK = 0x06, - X_128X_SYSTEM_CLOCK = 0x07, - X_256X_SYSTEM_CLOCK = 0x08, - X_512X_SYSTEM_CLOCK = 0x09, - X_1024X_SYSTEM_CLOCK = 0x0a, - X_2048X_SYSTEM_CLOCK = 0x0b, - X_4092X_SYSTEM_CLOCK = 0x0c, - X_8192X_SYSTEM_CLOCK = 0x0d, - X_16384X_SYSTEM_CLOCK = 0x0e, - X_32768X_SYSTEM_CLOCK = 0x0f, - VC_CNTL_STATUS = 0x00009704, - RP_BUSY_bit = 1 << 0, - RG_BUSY_bit = 1 << 1, - VC_BUSY_bit = 1 << 2, - CLAMP_DETECT_bit = 1 << 3, - VC_CONFIG = 0x00009718, - WRITE_DIS_bit = 1 << 0, - GPR_DATA_PHASE_ADJ_mask = 0x07 << 1, - GPR_DATA_PHASE_ADJ_shift = 1, - X_LATENCY_BASE_0_CYCLES = 0x00, - X_LATENCY_BASE_1_CYCLES = 0x01, - X_LATENCY_BASE_2_CYCLES = 0x02, - X_LATENCY_BASE_3_CYCLES = 0x03, - TD_SIMD_SYNC_ADJ_mask = 0x07 << 4, - TD_SIMD_SYNC_ADJ_shift = 4, - X_0_CYCLES_DELAY = 0x00, - X_1_CYCLES_DELAY = 0x01, - X_2_CYCLES_DELAY = 0x02, - X_3_CYCLES_DELAY = 0x03, - X_4_CYCLES_DELAY = 0x04, - X_5_CYCLES_DELAY = 0x05, - X_6_CYCLES_DELAY = 0x06, - X_7_CYCLES_DELAY = 0x07, - SMX_DC_CTL0 = 0x0000a020, - WR_GATHER_STREAM0_bit = 1 << 0, - WR_GATHER_STREAM1_bit = 1 << 1, - WR_GATHER_STREAM2_bit = 1 << 2, - WR_GATHER_STREAM3_bit = 1 << 3, - WR_GATHER_SCRATCH_bit = 1 << 4, - WR_GATHER_REDUC_BUF_bit = 1 << 5, - WR_GATHER_RING_BUF_bit = 1 << 6, - WR_GATHER_F_BUF_bit = 1 << 7, - DISABLE_CACHES_bit = 1 << 8, - AUTO_FLUSH_INVAL_EN_bit = 1 << 10, - AUTO_FLUSH_EN_bit = 1 << 11, - AUTO_FLUSH_CNT_mask = 0xffff << 12, - AUTO_FLUSH_CNT_shift = 12, - MC_RD_STALL_FACTOR_mask = 0x03 << 28, - MC_RD_STALL_FACTOR_shift = 28, - MC_WR_STALL_FACTOR_mask = 0x03 << 30, - MC_WR_STALL_FACTOR_shift = 30, - SMX_DC_CTL1 = 0x0000a024, - OP_FIFO_SKID_mask = 0x7f << 0, - OP_FIFO_SKID_shift = 0, - CACHE_LINE_SIZE_bit = 1 << 8, - MULTI_FLUSH_MODE_bit = 1 << 9, - MULTI_FLUSH_REQ_ABORT_IDX_FIFO_SKID_mask = 0x0f << 10, - MULTI_FLUSH_REQ_ABORT_IDX_FIFO_SKID_shift = 10, - DISABLE_WR_GATHER_RD_HIT_FORCE_EVICT_bit = 1 << 16, - DISABLE_WR_GATHER_RD_HIT_COMP_VLDS_CHECK_bit = 1 << 17, - DISABLE_FLUSH_ES_ALSO_INVALS_bit = 1 << 18, - DISABLE_FLUSH_GS_ALSO_INVALS_bit = 1 << 19, - SMX_DC_CTL2 = 0x0000a028, - INVALIDATE_CACHES_bit = 1 << 0, - CACHES_INVALID_bit = 1 << 1, - CACHES_DIRTY_bit = 1 << 2, - FLUSH_ALL_bit = 1 << 4, - FLUSH_GS_THREADS_bit = 1 << 8, - FLUSH_ES_THREADS_bit = 1 << 9, - SMX_DC_MC_INTF_CTL = 0x0000a02c, - MC_RD_REQ_CRED_mask = 0xff << 0, - MC_RD_REQ_CRED_shift = 0, - MC_WR_REQ_CRED_mask = 0xff << 16, - MC_WR_REQ_CRED_shift = 16, - TD_PS_SAMPLER0_BORDER_RED = 0x0000a400, - TD_PS_SAMPLER0_BORDER_RED_num = 18, - TD_PS_SAMPLER0_BORDER_RED_offset = 16, - TD_PS_SAMPLER0_BORDER_GREEN = 0x0000a404, - TD_PS_SAMPLER0_BORDER_GREEN_num = 18, - TD_PS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_PS_SAMPLER0_BORDER_BLUE = 0x0000a408, - TD_PS_SAMPLER0_BORDER_BLUE_num = 18, - TD_PS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_PS_SAMPLER0_BORDER_ALPHA = 0x0000a40c, - TD_PS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_PS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_VS_SAMPLER0_BORDER_RED = 0x0000a600, - TD_VS_SAMPLER0_BORDER_RED_num = 18, - TD_VS_SAMPLER0_BORDER_RED_offset = 16, - TD_VS_SAMPLER0_BORDER_GREEN = 0x0000a604, - TD_VS_SAMPLER0_BORDER_GREEN_num = 18, - TD_VS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_VS_SAMPLER0_BORDER_BLUE = 0x0000a608, - TD_VS_SAMPLER0_BORDER_BLUE_num = 18, - TD_VS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_VS_SAMPLER0_BORDER_ALPHA = 0x0000a60c, - TD_VS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_VS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_GS_SAMPLER0_BORDER_RED = 0x0000a800, - TD_GS_SAMPLER0_BORDER_RED_num = 18, - TD_GS_SAMPLER0_BORDER_RED_offset = 16, - TD_GS_SAMPLER0_BORDER_GREEN = 0x0000a804, - TD_GS_SAMPLER0_BORDER_GREEN_num = 18, - TD_GS_SAMPLER0_BORDER_GREEN_offset = 16, - TD_GS_SAMPLER0_BORDER_BLUE = 0x0000a808, - TD_GS_SAMPLER0_BORDER_BLUE_num = 18, - TD_GS_SAMPLER0_BORDER_BLUE_offset = 16, - TD_GS_SAMPLER0_BORDER_ALPHA = 0x0000a80c, - TD_GS_SAMPLER0_BORDER_ALPHA_num = 18, - TD_GS_SAMPLER0_BORDER_ALPHA_offset = 16, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL = 0x0000aa00, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL_num = 18, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__WIDTH_mask = 0x07 << 0, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__WIDTH_shift = 0, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__HEIGHT_mask = 0x07 << 3, - TD_PS_SAMPLER0_CLEARTYPE_KERNEL__HEIGHT_shift = 3, - DB_DEPTH_SIZE = 0x00028000, - PITCH_TILE_MAX_mask = 0x3ff << 0, - PITCH_TILE_MAX_shift = 0, - SLICE_TILE_MAX_mask = 0xfffff << 10, - SLICE_TILE_MAX_shift = 10, - DB_DEPTH_VIEW = 0x00028004, - SLICE_START_mask = 0x7ff << 0, - SLICE_START_shift = 0, - SLICE_MAX_mask = 0x7ff << 13, - SLICE_MAX_shift = 13, - DB_DEPTH_BASE = 0x0002800c, - DB_DEPTH_INFO = 0x00028010, - DB_DEPTH_INFO__FORMAT_mask = 0x07 << 0, - DB_DEPTH_INFO__FORMAT_shift = 0, - DEPTH_INVALID = 0x00, - DEPTH_16 = 0x01, - DEPTH_X8_24 = 0x02, - DEPTH_8_24 = 0x03, - DEPTH_X8_24_FLOAT = 0x04, - DEPTH_8_24_FLOAT = 0x05, - DEPTH_32_FLOAT = 0x06, - DEPTH_X24_8_32_FLOAT = 0x07, - DB_DEPTH_INFO__READ_SIZE_bit = 1 << 3, - DB_DEPTH_INFO__ARRAY_MODE_mask = 0x0f << 15, - DB_DEPTH_INFO__ARRAY_MODE_shift = 15, - ARRAY_1D_TILED_THIN1 = 0x02, - ARRAY_2D_TILED_THIN1 = 0x04, - TILE_SURFACE_ENABLE_bit = 1 << 25, - TILE_COMPACT_bit = 1 << 26, - ZRANGE_PRECISION_bit = 1 << 31, - DB_HTILE_DATA_BASE = 0x00028014, - DB_STENCIL_CLEAR = 0x00028028, - DB_STENCIL_CLEAR__CLEAR_mask = 0xff << 0, - DB_STENCIL_CLEAR__CLEAR_shift = 0, - MIN_mask = 0xff << 16, - MIN_shift = 16, - DB_DEPTH_CLEAR = 0x0002802c, - PA_SC_SCREEN_SCISSOR_TL = 0x00028030, - PA_SC_SCREEN_SCISSOR_TL__TL_X_mask = 0x7fff << 0, - PA_SC_SCREEN_SCISSOR_TL__TL_X_shift = 0, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask = 0x7fff << 16, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_shift = 16, - PA_SC_SCREEN_SCISSOR_BR = 0x00028034, - PA_SC_SCREEN_SCISSOR_BR__BR_X_mask = 0x7fff << 0, - PA_SC_SCREEN_SCISSOR_BR__BR_X_shift = 0, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask = 0x7fff << 16, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_shift = 16, - CB_COLOR0_BASE = 0x00028040, - CB_COLOR0_BASE_num = 8, - CB_COLOR0_SIZE = 0x00028060, - CB_COLOR0_SIZE_num = 8, -/* PITCH_TILE_MAX_mask = 0x3ff << 0, */ -/* PITCH_TILE_MAX_shift = 0, */ -/* SLICE_TILE_MAX_mask = 0xfffff << 10, */ -/* SLICE_TILE_MAX_shift = 10, */ - CB_COLOR0_VIEW = 0x00028080, - CB_COLOR0_VIEW_num = 8, -/* SLICE_START_mask = 0x7ff << 0, */ -/* SLICE_START_shift = 0, */ -/* SLICE_MAX_mask = 0x7ff << 13, */ -/* SLICE_MAX_shift = 13, */ - CB_COLOR0_INFO = 0x000280a0, - CB_COLOR0_INFO_num = 8, - ENDIAN_mask = 0x03 << 0, - ENDIAN_shift = 0, - ENDIAN_NONE = 0x00, - ENDIAN_8IN16 = 0x01, - ENDIAN_8IN32 = 0x02, - ENDIAN_8IN64 = 0x03, - CB_COLOR0_INFO__FORMAT_mask = 0x3f << 2, - CB_COLOR0_INFO__FORMAT_shift = 2, - COLOR_INVALID = 0x00, - COLOR_8 = 0x01, - COLOR_4_4 = 0x02, - COLOR_3_3_2 = 0x03, - COLOR_16 = 0x05, - COLOR_16_FLOAT = 0x06, - COLOR_8_8 = 0x07, - COLOR_5_6_5 = 0x08, - COLOR_6_5_5 = 0x09, - COLOR_1_5_5_5 = 0x0a, - COLOR_4_4_4_4 = 0x0b, - COLOR_5_5_5_1 = 0x0c, - COLOR_32 = 0x0d, - COLOR_32_FLOAT = 0x0e, - COLOR_16_16 = 0x0f, - COLOR_16_16_FLOAT = 0x10, - COLOR_8_24 = 0x11, - COLOR_8_24_FLOAT = 0x12, - COLOR_24_8 = 0x13, - COLOR_24_8_FLOAT = 0x14, - COLOR_10_11_11 = 0x15, - COLOR_10_11_11_FLOAT = 0x16, - COLOR_11_11_10 = 0x17, - COLOR_11_11_10_FLOAT = 0x18, - COLOR_2_10_10_10 = 0x19, - COLOR_8_8_8_8 = 0x1a, - COLOR_10_10_10_2 = 0x1b, - COLOR_X24_8_32_FLOAT = 0x1c, - COLOR_32_32 = 0x1d, - COLOR_32_32_FLOAT = 0x1e, - COLOR_16_16_16_16 = 0x1f, - COLOR_16_16_16_16_FLOAT = 0x20, - COLOR_32_32_32_32 = 0x22, - COLOR_32_32_32_32_FLOAT = 0x23, - CB_COLOR0_INFO__ARRAY_MODE_mask = 0x0f << 8, - CB_COLOR0_INFO__ARRAY_MODE_shift = 8, - ARRAY_LINEAR_GENERAL = 0x00, - ARRAY_LINEAR_ALIGNED = 0x01, -/* ARRAY_1D_TILED_THIN1 = 0x02, */ -/* ARRAY_2D_TILED_THIN1 = 0x04, */ - NUMBER_TYPE_mask = 0x07 << 12, - NUMBER_TYPE_shift = 12, - NUMBER_UNORM = 0x00, - NUMBER_SNORM = 0x01, - NUMBER_USCALED = 0x02, - NUMBER_SSCALED = 0x03, - NUMBER_UINT = 0x04, - NUMBER_SINT = 0x05, - NUMBER_SRGB = 0x06, - NUMBER_FLOAT = 0x07, - CB_COLOR0_INFO__READ_SIZE_bit = 1 << 15, - COMP_SWAP_mask = 0x03 << 16, - COMP_SWAP_shift = 16, - SWAP_STD = 0x00, - SWAP_ALT = 0x01, - SWAP_STD_REV = 0x02, - SWAP_ALT_REV = 0x03, - CB_COLOR0_INFO__TILE_MODE_mask = 0x03 << 18, - CB_COLOR0_INFO__TILE_MODE_shift = 18, - TILE_DISABLE = 0x00, - TILE_CLEAR_ENABLE = 0x01, - TILE_FRAG_ENABLE = 0x02, - BLEND_CLAMP_bit = 1 << 20, - CLEAR_COLOR_bit = 1 << 21, - BLEND_BYPASS_bit = 1 << 22, - BLEND_FLOAT32_bit = 1 << 23, - SIMPLE_FLOAT_bit = 1 << 24, - CB_COLOR0_INFO__ROUND_MODE_bit = 1 << 25, -/* TILE_COMPACT_bit = 1 << 26, */ - SOURCE_FORMAT_bit = 1 << 27, - CB_COLOR0_TILE = 0x000280c0, - CB_COLOR0_TILE_num = 8, - CB_COLOR0_FRAG = 0x000280e0, - CB_COLOR0_FRAG_num = 8, - CB_COLOR0_MASK = 0x00028100, - CB_COLOR0_MASK_num = 8, - CMASK_BLOCK_MAX_mask = 0xfff << 0, - CMASK_BLOCK_MAX_shift = 0, - FMASK_TILE_MAX_mask = 0xfffff << 12, - FMASK_TILE_MAX_shift = 12, - CB_CLEAR_RED = 0x00028120, - CB_CLEAR_GREEN = 0x00028124, - CB_CLEAR_BLUE = 0x00028128, - CB_CLEAR_ALPHA = 0x0002812c, - SQ_ALU_CONST_BUFFER_SIZE_PS_0 = 0x00028140, - SQ_ALU_CONST_BUFFER_SIZE_PS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_PS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_PS_0__DATA_shift = 0, - SQ_ALU_CONST_BUFFER_SIZE_VS_0 = 0x00028180, - SQ_ALU_CONST_BUFFER_SIZE_VS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_VS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_VS_0__DATA_shift = 0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0 = 0x000281c0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0_num = 16, - SQ_ALU_CONST_BUFFER_SIZE_GS_0__DATA_mask = 0x1ff << 0, - SQ_ALU_CONST_BUFFER_SIZE_GS_0__DATA_shift = 0, - PA_SC_WINDOW_OFFSET = 0x00028200, - WINDOW_X_OFFSET_mask = 0x7fff << 0, - WINDOW_X_OFFSET_shift = 0, - WINDOW_Y_OFFSET_mask = 0x7fff << 16, - WINDOW_Y_OFFSET_shift = 16, - PA_SC_WINDOW_SCISSOR_TL = 0x00028204, - PA_SC_WINDOW_SCISSOR_TL__TL_X_mask = 0x3fff << 0, - PA_SC_WINDOW_SCISSOR_TL__TL_X_shift = 0, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_shift = 16, - WINDOW_OFFSET_DISABLE_bit = 1 << 31, - PA_SC_WINDOW_SCISSOR_BR = 0x00028208, - PA_SC_WINDOW_SCISSOR_BR__BR_X_mask = 0x3fff << 0, - PA_SC_WINDOW_SCISSOR_BR__BR_X_shift = 0, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_shift = 16, - PA_SC_CLIPRECT_RULE = 0x0002820c, - CLIP_RULE_mask = 0xffff << 0, - CLIP_RULE_shift = 0, - PA_SC_CLIPRECT_0_TL = 0x00028210, - PA_SC_CLIPRECT_0_TL_num = 4, - PA_SC_CLIPRECT_0_TL_offset = 8, - PA_SC_CLIPRECT_0_TL__TL_X_mask = 0x3fff << 0, - PA_SC_CLIPRECT_0_TL__TL_X_shift = 0, - PA_SC_CLIPRECT_0_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_CLIPRECT_0_TL__TL_Y_shift = 16, - PA_SC_CLIPRECT_0_BR = 0x00028214, - PA_SC_CLIPRECT_0_BR_num = 4, - PA_SC_CLIPRECT_0_BR_offset = 8, - PA_SC_CLIPRECT_0_BR__BR_X_mask = 0x3fff << 0, - PA_SC_CLIPRECT_0_BR__BR_X_shift = 0, - PA_SC_CLIPRECT_0_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_CLIPRECT_0_BR__BR_Y_shift = 16, - CB_TARGET_MASK = 0x00028238, - TARGET0_ENABLE_mask = 0x0f << 0, - TARGET0_ENABLE_shift = 0, - TARGET1_ENABLE_mask = 0x0f << 4, - TARGET1_ENABLE_shift = 4, - TARGET2_ENABLE_mask = 0x0f << 8, - TARGET2_ENABLE_shift = 8, - TARGET3_ENABLE_mask = 0x0f << 12, - TARGET3_ENABLE_shift = 12, - TARGET4_ENABLE_mask = 0x0f << 16, - TARGET4_ENABLE_shift = 16, - TARGET5_ENABLE_mask = 0x0f << 20, - TARGET5_ENABLE_shift = 20, - TARGET6_ENABLE_mask = 0x0f << 24, - TARGET6_ENABLE_shift = 24, - TARGET7_ENABLE_mask = 0x0f << 28, - TARGET7_ENABLE_shift = 28, - CB_SHADER_MASK = 0x0002823c, - OUTPUT0_ENABLE_mask = 0x0f << 0, - OUTPUT0_ENABLE_shift = 0, - OUTPUT1_ENABLE_mask = 0x0f << 4, - OUTPUT1_ENABLE_shift = 4, - OUTPUT2_ENABLE_mask = 0x0f << 8, - OUTPUT2_ENABLE_shift = 8, - OUTPUT3_ENABLE_mask = 0x0f << 12, - OUTPUT3_ENABLE_shift = 12, - OUTPUT4_ENABLE_mask = 0x0f << 16, - OUTPUT4_ENABLE_shift = 16, - OUTPUT5_ENABLE_mask = 0x0f << 20, - OUTPUT5_ENABLE_shift = 20, - OUTPUT6_ENABLE_mask = 0x0f << 24, - OUTPUT6_ENABLE_shift = 24, - OUTPUT7_ENABLE_mask = 0x0f << 28, - OUTPUT7_ENABLE_shift = 28, - PA_SC_GENERIC_SCISSOR_TL = 0x00028240, - PA_SC_GENERIC_SCISSOR_TL__TL_X_mask = 0x3fff << 0, - PA_SC_GENERIC_SCISSOR_TL__TL_X_shift = 0, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_shift = 16, -/* WINDOW_OFFSET_DISABLE_bit = 1 << 31, */ - PA_SC_GENERIC_SCISSOR_BR = 0x00028244, - PA_SC_GENERIC_SCISSOR_BR__BR_X_mask = 0x3fff << 0, - PA_SC_GENERIC_SCISSOR_BR__BR_X_shift = 0, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_shift = 16, - PA_SC_VPORT_SCISSOR_0_TL = 0x00028250, - PA_SC_VPORT_SCISSOR_0_TL_num = 16, - PA_SC_VPORT_SCISSOR_0_TL_offset = 8, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask = 0x3fff << 0, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift = 0, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask = 0x3fff << 16, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift = 16, -/* WINDOW_OFFSET_DISABLE_bit = 1 << 31, */ - PA_SC_VPORT_SCISSOR_0_BR = 0x00028254, - PA_SC_VPORT_SCISSOR_0_BR_num = 16, - PA_SC_VPORT_SCISSOR_0_BR_offset = 8, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask = 0x3fff << 0, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift = 0, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask = 0x3fff << 16, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift = 16, - PA_SC_VPORT_ZMIN_0 = 0x000282d0, - PA_SC_VPORT_ZMIN_0_num = 16, - PA_SC_VPORT_ZMIN_0_offset = 8, - PA_SC_VPORT_ZMAX_0 = 0x000282d4, - PA_SC_VPORT_ZMAX_0_num = 16, - PA_SC_VPORT_ZMAX_0_offset = 8, - SX_MISC = 0x00028350, - MULTIPASS_bit = 1 << 0, - SQ_VTX_SEMANTIC_0 = 0x00028380, - SQ_VTX_SEMANTIC_0_num = 32, -/* SEMANTIC_ID_mask = 0xff << 0, */ -/* SEMANTIC_ID_shift = 0, */ - VGT_MAX_VTX_INDX = 0x00028400, - VGT_MIN_VTX_INDX = 0x00028404, - VGT_INDX_OFFSET = 0x00028408, - VGT_MULTI_PRIM_IB_RESET_INDX = 0x0002840c, - SX_ALPHA_TEST_CONTROL = 0x00028410, - ALPHA_FUNC_mask = 0x07 << 0, - ALPHA_FUNC_shift = 0, - REF_NEVER = 0x00, - REF_LESS = 0x01, - REF_EQUAL = 0x02, - REF_LEQUAL = 0x03, - REF_GREATER = 0x04, - REF_NOTEQUAL = 0x05, - REF_GEQUAL = 0x06, - REF_ALWAYS = 0x07, - ALPHA_TEST_ENABLE_bit = 1 << 3, - ALPHA_TEST_BYPASS_bit = 1 << 8, - CB_BLEND_RED = 0x00028414, - CB_BLEND_GREEN = 0x00028418, - CB_BLEND_BLUE = 0x0002841c, - CB_BLEND_ALPHA = 0x00028420, - CB_FOG_RED = 0x00028424, - CB_FOG_GREEN = 0x00028428, - CB_FOG_BLUE = 0x0002842c, - DB_STENCILREFMASK = 0x00028430, - STENCILREF_mask = 0xff << 0, - STENCILREF_shift = 0, - STENCILMASK_mask = 0xff << 8, - STENCILMASK_shift = 8, - STENCILWRITEMASK_mask = 0xff << 16, - STENCILWRITEMASK_shift = 16, - DB_STENCILREFMASK_BF = 0x00028434, - STENCILREF_BF_mask = 0xff << 0, - STENCILREF_BF_shift = 0, - STENCILMASK_BF_mask = 0xff << 8, - STENCILMASK_BF_shift = 8, - STENCILWRITEMASK_BF_mask = 0xff << 16, - STENCILWRITEMASK_BF_shift = 16, - SX_ALPHA_REF = 0x00028438, - PA_CL_VPORT_XSCALE_0 = 0x0002843c, - PA_CL_VPORT_XSCALE_0_num = 16, - PA_CL_VPORT_XSCALE_0_offset = 24, - PA_CL_VPORT_XOFFSET_0 = 0x00028440, - PA_CL_VPORT_XOFFSET_0_num = 16, - PA_CL_VPORT_XOFFSET_0_offset = 24, - PA_CL_VPORT_YSCALE_0 = 0x00028444, - PA_CL_VPORT_YSCALE_0_num = 16, - PA_CL_VPORT_YSCALE_0_offset = 24, - PA_CL_VPORT_YOFFSET_0 = 0x00028448, - PA_CL_VPORT_YOFFSET_0_num = 16, - PA_CL_VPORT_YOFFSET_0_offset = 24, - PA_CL_VPORT_ZSCALE_0 = 0x0002844c, - PA_CL_VPORT_ZSCALE_0_num = 16, - PA_CL_VPORT_ZSCALE_0_offset = 24, - PA_CL_VPORT_ZOFFSET_0 = 0x00028450, - PA_CL_VPORT_ZOFFSET_0_num = 16, - PA_CL_VPORT_ZOFFSET_0_offset = 24, - SPI_VS_OUT_ID_0 = 0x00028614, - SPI_VS_OUT_ID_0_num = 10, - SEMANTIC_0_mask = 0xff << 0, - SEMANTIC_0_shift = 0, - SEMANTIC_1_mask = 0xff << 8, - SEMANTIC_1_shift = 8, - SEMANTIC_2_mask = 0xff << 16, - SEMANTIC_2_shift = 16, - SEMANTIC_3_mask = 0xff << 24, - SEMANTIC_3_shift = 24, - SPI_PS_INPUT_CNTL_0 = 0x00028644, - SPI_PS_INPUT_CNTL_0_num = 32, - SEMANTIC_mask = 0xff << 0, - SEMANTIC_shift = 0, - DEFAULT_VAL_mask = 0x03 << 8, - DEFAULT_VAL_shift = 8, - X_0_0F = 0x00, - FLAT_SHADE_bit = 1 << 10, - SEL_CENTROID_bit = 1 << 11, - SEL_LINEAR_bit = 1 << 12, - CYL_WRAP_mask = 0x0f << 13, - CYL_WRAP_shift = 13, - PT_SPRITE_TEX_bit = 1 << 17, - SEL_SAMPLE_bit = 1 << 18, - SPI_VS_OUT_CONFIG = 0x000286c4, - VS_PER_COMPONENT_bit = 1 << 0, - VS_EXPORT_COUNT_mask = 0x1f << 1, - VS_EXPORT_COUNT_shift = 1, - VS_EXPORTS_FOG_bit = 1 << 8, - VS_OUT_FOG_VEC_ADDR_mask = 0x1f << 9, - VS_OUT_FOG_VEC_ADDR_shift = 9, - SPI_PS_IN_CONTROL_0 = 0x000286cc, - NUM_INTERP_mask = 0x3f << 0, - NUM_INTERP_shift = 0, - POSITION_ENA_bit = 1 << 8, - POSITION_CENTROID_bit = 1 << 9, - POSITION_ADDR_mask = 0x1f << 10, - POSITION_ADDR_shift = 10, - PARAM_GEN_mask = 0x0f << 15, - PARAM_GEN_shift = 15, - PARAM_GEN_ADDR_mask = 0x7f << 19, - PARAM_GEN_ADDR_shift = 19, - BARYC_SAMPLE_CNTL_mask = 0x03 << 26, - BARYC_SAMPLE_CNTL_shift = 26, - CENTROIDS_ONLY = 0x00, - CENTERS_ONLY = 0x01, - CENTROIDS_AND_CENTERS = 0x02, - UNDEF = 0x03, - PERSP_GRADIENT_ENA_bit = 1 << 28, - LINEAR_GRADIENT_ENA_bit = 1 << 29, - POSITION_SAMPLE_bit = 1 << 30, - BARYC_AT_SAMPLE_ENA_bit = 1 << 31, - SPI_PS_IN_CONTROL_1 = 0x000286d0, - GEN_INDEX_PIX_bit = 1 << 0, - GEN_INDEX_PIX_ADDR_mask = 0x7f << 1, - GEN_INDEX_PIX_ADDR_shift = 1, - FRONT_FACE_ENA_bit = 1 << 8, - FRONT_FACE_CHAN_mask = 0x03 << 9, - FRONT_FACE_CHAN_shift = 9, - FRONT_FACE_ALL_BITS_bit = 1 << 11, - FRONT_FACE_ADDR_mask = 0x1f << 12, - FRONT_FACE_ADDR_shift = 12, - FOG_ADDR_mask = 0x7f << 17, - FOG_ADDR_shift = 17, - FIXED_PT_POSITION_ENA_bit = 1 << 24, - FIXED_PT_POSITION_ADDR_mask = 0x1f << 25, - FIXED_PT_POSITION_ADDR_shift = 25, - SPI_INTERP_CONTROL_0 = 0x000286d4, - FLAT_SHADE_ENA_bit = 1 << 0, - PNT_SPRITE_ENA_bit = 1 << 1, - PNT_SPRITE_OVRD_X_mask = 0x07 << 2, - PNT_SPRITE_OVRD_X_shift = 2, - SPI_PNT_SPRITE_SEL_0 = 0x00, - SPI_PNT_SPRITE_SEL_1 = 0x01, - SPI_PNT_SPRITE_SEL_S = 0x02, - SPI_PNT_SPRITE_SEL_T = 0x03, - SPI_PNT_SPRITE_SEL_NONE = 0x04, - PNT_SPRITE_OVRD_Y_mask = 0x07 << 5, - PNT_SPRITE_OVRD_Y_shift = 5, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_OVRD_Z_mask = 0x07 << 8, - PNT_SPRITE_OVRD_Z_shift = 8, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_OVRD_W_mask = 0x07 << 11, - PNT_SPRITE_OVRD_W_shift = 11, -/* SPI_PNT_SPRITE_SEL_0 = 0x00, */ -/* SPI_PNT_SPRITE_SEL_1 = 0x01, */ -/* SPI_PNT_SPRITE_SEL_S = 0x02, */ -/* SPI_PNT_SPRITE_SEL_T = 0x03, */ -/* SPI_PNT_SPRITE_SEL_NONE = 0x04, */ - PNT_SPRITE_TOP_1_bit = 1 << 14, - SPI_INPUT_Z = 0x000286d8, - PROVIDE_Z_TO_SPI_bit = 1 << 0, - SPI_FOG_CNTL = 0x000286dc, - PASS_FOG_THROUGH_PS_bit = 1 << 0, - PIXEL_FOG_FUNC_mask = 0x03 << 1, - PIXEL_FOG_FUNC_shift = 1, - SPI_FOG_NONE = 0x00, - SPI_FOG_EXP = 0x01, - SPI_FOG_EXP2 = 0x02, - SPI_FOG_LINEAR = 0x03, - PIXEL_FOG_SRC_SEL_bit = 1 << 3, - VS_FOG_CLAMP_DISABLE_bit = 1 << 4, - SPI_FOG_FUNC_SCALE = 0x000286e0, - SPI_FOG_FUNC_BIAS = 0x000286e4, - CB_BLEND0_CONTROL = 0x00028780, - CB_BLEND0_CONTROL_num = 8, - COLOR_SRCBLEND_mask = 0x1f << 0, - COLOR_SRCBLEND_shift = 0, - COLOR_COMB_FCN_mask = 0x07 << 5, - COLOR_COMB_FCN_shift = 5, - COLOR_DESTBLEND_mask = 0x1f << 8, - COLOR_DESTBLEND_shift = 8, - OPACITY_WEIGHT_bit = 1 << 13, - ALPHA_SRCBLEND_mask = 0x1f << 16, - ALPHA_SRCBLEND_shift = 16, - ALPHA_COMB_FCN_mask = 0x07 << 21, - ALPHA_COMB_FCN_shift = 21, - ALPHA_DESTBLEND_mask = 0x1f << 24, - ALPHA_DESTBLEND_shift = 24, - SEPARATE_ALPHA_BLEND_bit = 1 << 29, - VGT_DMA_BASE_HI = 0x000287e4, - VGT_DMA_BASE_HI__BASE_ADDR_mask = 0xff << 0, - VGT_DMA_BASE_HI__BASE_ADDR_shift = 0, - VGT_DMA_BASE = 0x000287e8, - VGT_DRAW_INITIATOR = 0x000287f0, - SOURCE_SELECT_mask = 0x03 << 0, - SOURCE_SELECT_shift = 0, - DI_SRC_SEL_DMA = 0x00, - DI_SRC_SEL_IMMEDIATE = 0x01, - DI_SRC_SEL_AUTO_INDEX = 0x02, - DI_SRC_SEL_RESERVED = 0x03, - MAJOR_MODE_mask = 0x03 << 2, - MAJOR_MODE_shift = 2, - DI_MAJOR_MODE_0 = 0x00, - DI_MAJOR_MODE_1 = 0x01, - SPRITE_EN_bit = 1 << 4, - NOT_EOP_bit = 1 << 5, - USE_OPAQUE_bit = 1 << 6, - VGT_IMMED_DATA = 0x000287f4, - VGT_EVENT_ADDRESS_REG = 0x000287f8, - ADDRESS_LOW_mask = 0xfffffff << 0, - ADDRESS_LOW_shift = 0, - DB_DEPTH_CONTROL = 0x00028800, - STENCIL_ENABLE_bit = 1 << 0, - Z_ENABLE_bit = 1 << 1, - Z_WRITE_ENABLE_bit = 1 << 2, - ZFUNC_mask = 0x07 << 4, - ZFUNC_shift = 4, - FRAG_NEVER = 0x00, - FRAG_LESS = 0x01, - FRAG_EQUAL = 0x02, - FRAG_LEQUAL = 0x03, - FRAG_GREATER = 0x04, - FRAG_NOTEQUAL = 0x05, - FRAG_GEQUAL = 0x06, - FRAG_ALWAYS = 0x07, - BACKFACE_ENABLE_bit = 1 << 7, - STENCILFUNC_mask = 0x07 << 8, - STENCILFUNC_shift = 8, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - STENCILFAIL_mask = 0x07 << 11, - STENCILFAIL_shift = 11, - STENCIL_KEEP = 0x00, - STENCIL_ZERO = 0x01, - STENCIL_REPLACE = 0x02, - STENCIL_INCR_CLAMP = 0x03, - STENCIL_DECR_CLAMP = 0x04, - STENCIL_INVERT = 0x05, - STENCIL_INCR_WRAP = 0x06, - STENCIL_DECR_WRAP = 0x07, - STENCILZPASS_mask = 0x07 << 14, - STENCILZPASS_shift = 14, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZFAIL_mask = 0x07 << 17, - STENCILZFAIL_shift = 17, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILFUNC_BF_mask = 0x07 << 20, - STENCILFUNC_BF_shift = 20, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - STENCILFAIL_BF_mask = 0x07 << 23, - STENCILFAIL_BF_shift = 23, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZPASS_BF_mask = 0x07 << 26, - STENCILZPASS_BF_shift = 26, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - STENCILZFAIL_BF_mask = 0x07 << 29, - STENCILZFAIL_BF_shift = 29, -/* STENCIL_KEEP = 0x00, */ -/* STENCIL_ZERO = 0x01, */ -/* STENCIL_REPLACE = 0x02, */ -/* STENCIL_INCR_CLAMP = 0x03, */ -/* STENCIL_DECR_CLAMP = 0x04, */ -/* STENCIL_INVERT = 0x05, */ -/* STENCIL_INCR_WRAP = 0x06, */ -/* STENCIL_DECR_WRAP = 0x07, */ - CB_BLEND_CONTROL = 0x00028804, -/* COLOR_SRCBLEND_mask = 0x1f << 0, */ -/* COLOR_SRCBLEND_shift = 0, */ - BLEND_ZERO = 0x00, - BLEND_ONE = 0x01, - BLEND_SRC_COLOR = 0x02, - BLEND_ONE_MINUS_SRC_COLOR = 0x03, - BLEND_SRC_ALPHA = 0x04, - BLEND_ONE_MINUS_SRC_ALPHA = 0x05, - BLEND_DST_ALPHA = 0x06, - BLEND_ONE_MINUS_DST_ALPHA = 0x07, - BLEND_DST_COLOR = 0x08, - BLEND_ONE_MINUS_DST_COLOR = 0x09, - BLEND_SRC_ALPHA_SATURATE = 0x0a, - BLEND_BOTH_SRC_ALPHA = 0x0b, - BLEND_BOTH_INV_SRC_ALPHA = 0x0c, - BLEND_CONSTANT_COLOR = 0x0d, - BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, - BLEND_SRC1_COLOR = 0x0f, - BLEND_INV_SRC1_COLOR = 0x10, - BLEND_SRC1_ALPHA = 0x11, - BLEND_INV_SRC1_ALPHA = 0x12, - BLEND_CONSTANT_ALPHA = 0x13, - BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, -/* COLOR_COMB_FCN_mask = 0x07 << 5, */ -/* COLOR_COMB_FCN_shift = 5, */ - COMB_DST_PLUS_SRC = 0x00, - COMB_SRC_MINUS_DST = 0x01, - COMB_MIN_DST_SRC = 0x02, - COMB_MAX_DST_SRC = 0x03, - COMB_DST_MINUS_SRC = 0x04, -/* COLOR_DESTBLEND_mask = 0x1f << 8, */ -/* COLOR_DESTBLEND_shift = 8, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* OPACITY_WEIGHT_bit = 1 << 13, */ -/* ALPHA_SRCBLEND_mask = 0x1f << 16, */ -/* ALPHA_SRCBLEND_shift = 16, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* ALPHA_COMB_FCN_mask = 0x07 << 21, */ -/* ALPHA_COMB_FCN_shift = 21, */ -/* COMB_DST_PLUS_SRC = 0x00, */ -/* COMB_SRC_MINUS_DST = 0x01, */ -/* COMB_MIN_DST_SRC = 0x02, */ -/* COMB_MAX_DST_SRC = 0x03, */ -/* COMB_DST_MINUS_SRC = 0x04, */ -/* ALPHA_DESTBLEND_mask = 0x1f << 24, */ -/* ALPHA_DESTBLEND_shift = 24, */ -/* BLEND_ZERO = 0x00, */ -/* BLEND_ONE = 0x01, */ -/* BLEND_SRC_COLOR = 0x02, */ -/* BLEND_ONE_MINUS_SRC_COLOR = 0x03, */ -/* BLEND_SRC_ALPHA = 0x04, */ -/* BLEND_ONE_MINUS_SRC_ALPHA = 0x05, */ -/* BLEND_DST_ALPHA = 0x06, */ -/* BLEND_ONE_MINUS_DST_ALPHA = 0x07, */ -/* BLEND_DST_COLOR = 0x08, */ -/* BLEND_ONE_MINUS_DST_COLOR = 0x09, */ -/* BLEND_SRC_ALPHA_SATURATE = 0x0a, */ -/* BLEND_BOTH_SRC_ALPHA = 0x0b, */ -/* BLEND_BOTH_INV_SRC_ALPHA = 0x0c, */ -/* BLEND_CONSTANT_COLOR = 0x0d, */ -/* BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0e, */ -/* BLEND_SRC1_COLOR = 0x0f, */ -/* BLEND_INV_SRC1_COLOR = 0x10, */ -/* BLEND_SRC1_ALPHA = 0x11, */ -/* BLEND_INV_SRC1_ALPHA = 0x12, */ -/* BLEND_CONSTANT_ALPHA = 0x13, */ -/* BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x14, */ -/* SEPARATE_ALPHA_BLEND_bit = 1 << 29, */ - CB_COLOR_CONTROL = 0x00028808, - FOG_ENABLE_bit = 1 << 0, - MULTIWRITE_ENABLE_bit = 1 << 1, - DITHER_ENABLE_bit = 1 << 2, - DEGAMMA_ENABLE_bit = 1 << 3, - SPECIAL_OP_mask = 0x07 << 4, - SPECIAL_OP_shift = 4, - SPECIAL_NORMAL = 0x00, - SPECIAL_DISABLE = 0x01, - SPECIAL_FAST_CLEAR = 0x02, - SPECIAL_FORCE_CLEAR = 0x03, - SPECIAL_EXPAND_COLOR = 0x04, - SPECIAL_EXPAND_TEXTURE = 0x05, - SPECIAL_EXPAND_SAMPLES = 0x06, - SPECIAL_RESOLVE_BOX = 0x07, - PER_MRT_BLEND_bit = 1 << 7, - TARGET_BLEND_ENABLE_mask = 0xff << 8, - TARGET_BLEND_ENABLE_shift = 8, - ROP3_mask = 0xff << 16, - ROP3_shift = 16, - DB_SHADER_CONTROL = 0x0002880c, - Z_EXPORT_ENABLE_bit = 1 << 0, - STENCIL_REF_EXPORT_ENABLE_bit = 1 << 1, - Z_ORDER_mask = 0x03 << 4, - Z_ORDER_shift = 4, - LATE_Z = 0x00, - EARLY_Z_THEN_LATE_Z = 0x01, - RE_Z = 0x02, - EARLY_Z_THEN_RE_Z = 0x03, - KILL_ENABLE_bit = 1 << 6, - COVERAGE_TO_MASK_ENABLE_bit = 1 << 7, - MASK_EXPORT_ENABLE_bit = 1 << 8, - DUAL_EXPORT_ENABLE_bit = 1 << 9, - EXEC_ON_HIER_FAIL_bit = 1 << 10, - EXEC_ON_NOOP_bit = 1 << 11, - PA_CL_CLIP_CNTL = 0x00028810, - UCP_ENA_0_bit = 1 << 0, - UCP_ENA_1_bit = 1 << 1, - UCP_ENA_2_bit = 1 << 2, - UCP_ENA_3_bit = 1 << 3, - UCP_ENA_4_bit = 1 << 4, - UCP_ENA_5_bit = 1 << 5, - PS_UCP_Y_SCALE_NEG_bit = 1 << 13, - PS_UCP_MODE_mask = 0x03 << 14, - PS_UCP_MODE_shift = 14, - CLIP_DISABLE_bit = 1 << 16, - UCP_CULL_ONLY_ENA_bit = 1 << 17, - BOUNDARY_EDGE_FLAG_ENA_bit = 1 << 18, - DX_CLIP_SPACE_DEF_bit = 1 << 19, - DIS_CLIP_ERR_DETECT_bit = 1 << 20, - VTX_KILL_OR_bit = 1 << 21, - DX_LINEAR_ATTR_CLIP_ENA_bit = 1 << 24, - VTE_VPORT_PROVOKE_DISABLE_bit = 1 << 25, - ZCLIP_NEAR_DISABLE_bit = 1 << 26, - ZCLIP_FAR_DISABLE_bit = 1 << 27, - PA_SU_SC_MODE_CNTL = 0x00028814, - CULL_FRONT_bit = 1 << 0, - CULL_BACK_bit = 1 << 1, - FACE_bit = 1 << 2, - POLY_MODE_mask = 0x03 << 3, - POLY_MODE_shift = 3, - X_DISABLE_POLY_MODE = 0x00, - X_DUAL_MODE = 0x01, - POLYMODE_FRONT_PTYPE_mask = 0x07 << 5, - POLYMODE_FRONT_PTYPE_shift = 5, - X_DRAW_POINTS = 0x00, - X_DRAW_LINES = 0x01, - X_DRAW_TRIANGLES = 0x02, - POLYMODE_BACK_PTYPE_mask = 0x07 << 8, - POLYMODE_BACK_PTYPE_shift = 8, -/* X_DRAW_POINTS = 0x00, */ -/* X_DRAW_LINES = 0x01, */ -/* X_DRAW_TRIANGLES = 0x02, */ - POLY_OFFSET_FRONT_ENABLE_bit = 1 << 11, - POLY_OFFSET_BACK_ENABLE_bit = 1 << 12, - POLY_OFFSET_PARA_ENABLE_bit = 1 << 13, - VTX_WINDOW_OFFSET_ENABLE_bit = 1 << 16, - PROVOKING_VTX_LAST_bit = 1 << 19, - PERSP_CORR_DIS_bit = 1 << 20, - MULTI_PRIM_IB_ENA_bit = 1 << 21, - PA_CL_VTE_CNTL = 0x00028818, - VPORT_X_SCALE_ENA_bit = 1 << 0, - VPORT_X_OFFSET_ENA_bit = 1 << 1, - VPORT_Y_SCALE_ENA_bit = 1 << 2, - VPORT_Y_OFFSET_ENA_bit = 1 << 3, - VPORT_Z_SCALE_ENA_bit = 1 << 4, - VPORT_Z_OFFSET_ENA_bit = 1 << 5, - VTX_XY_FMT_bit = 1 << 8, - VTX_Z_FMT_bit = 1 << 9, - VTX_W0_FMT_bit = 1 << 10, - PERFCOUNTER_REF_bit = 1 << 11, - PA_CL_VS_OUT_CNTL = 0x0002881c, - CLIP_DIST_ENA_0_bit = 1 << 0, - CLIP_DIST_ENA_1_bit = 1 << 1, - CLIP_DIST_ENA_2_bit = 1 << 2, - CLIP_DIST_ENA_3_bit = 1 << 3, - CLIP_DIST_ENA_4_bit = 1 << 4, - CLIP_DIST_ENA_5_bit = 1 << 5, - CLIP_DIST_ENA_6_bit = 1 << 6, - CLIP_DIST_ENA_7_bit = 1 << 7, - CULL_DIST_ENA_0_bit = 1 << 8, - CULL_DIST_ENA_1_bit = 1 << 9, - CULL_DIST_ENA_2_bit = 1 << 10, - CULL_DIST_ENA_3_bit = 1 << 11, - CULL_DIST_ENA_4_bit = 1 << 12, - CULL_DIST_ENA_5_bit = 1 << 13, - CULL_DIST_ENA_6_bit = 1 << 14, - CULL_DIST_ENA_7_bit = 1 << 15, - USE_VTX_POINT_SIZE_bit = 1 << 16, - USE_VTX_EDGE_FLAG_bit = 1 << 17, - USE_VTX_RENDER_TARGET_INDX_bit = 1 << 18, - USE_VTX_VIEWPORT_INDX_bit = 1 << 19, - USE_VTX_KILL_FLAG_bit = 1 << 20, - VS_OUT_MISC_VEC_ENA_bit = 1 << 21, - VS_OUT_CCDIST0_VEC_ENA_bit = 1 << 22, - VS_OUT_CCDIST1_VEC_ENA_bit = 1 << 23, - PA_CL_NANINF_CNTL = 0x00028820, - VTE_XY_INF_DISCARD_bit = 1 << 0, - VTE_Z_INF_DISCARD_bit = 1 << 1, - VTE_W_INF_DISCARD_bit = 1 << 2, - VTE_0XNANINF_IS_0_bit = 1 << 3, - VTE_XY_NAN_RETAIN_bit = 1 << 4, - VTE_Z_NAN_RETAIN_bit = 1 << 5, - VTE_W_NAN_RETAIN_bit = 1 << 6, - VTE_W_RECIP_NAN_IS_0_bit = 1 << 7, - VS_XY_NAN_TO_INF_bit = 1 << 8, - VS_XY_INF_RETAIN_bit = 1 << 9, - VS_Z_NAN_TO_INF_bit = 1 << 10, - VS_Z_INF_RETAIN_bit = 1 << 11, - VS_W_NAN_TO_INF_bit = 1 << 12, - VS_W_INF_RETAIN_bit = 1 << 13, - VS_CLIP_DIST_INF_DISCARD_bit = 1 << 14, - VTE_NO_OUTPUT_NEG_0_bit = 1 << 20, - SQ_PGM_START_PS = 0x00028840, - SQ_PGM_RESOURCES_PS = 0x00028850, - NUM_GPRS_mask = 0xff << 0, - NUM_GPRS_shift = 0, - STACK_SIZE_mask = 0xff << 8, - STACK_SIZE_shift = 8, - SQ_PGM_RESOURCES_PS__DX10_CLAMP_bit = 1 << 21, - FETCH_CACHE_LINES_mask = 0x07 << 24, - FETCH_CACHE_LINES_shift = 24, - UNCACHED_FIRST_INST_bit = 1 << 28, - CLAMP_CONSTS_bit = 1 << 31, - SQ_PGM_EXPORTS_PS = 0x00028854, - EXPORT_MODE_mask = 0x1f << 0, - EXPORT_MODE_shift = 0, - SQ_PGM_START_VS = 0x00028858, - SQ_PGM_RESOURCES_VS = 0x00028868, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_VS__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_GS = 0x0002886c, - SQ_PGM_RESOURCES_GS = 0x0002887c, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_GS__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_ES = 0x00028880, - SQ_PGM_RESOURCES_ES = 0x00028890, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_ES__DX10_CLAMP_bit = 1 << 21, -/* FETCH_CACHE_LINES_mask = 0x07 << 24, */ -/* FETCH_CACHE_LINES_shift = 24, */ -/* UNCACHED_FIRST_INST_bit = 1 << 28, */ - SQ_PGM_START_FS = 0x00028894, - SQ_PGM_RESOURCES_FS = 0x000288a4, -/* NUM_GPRS_mask = 0xff << 0, */ -/* NUM_GPRS_shift = 0, */ -/* STACK_SIZE_mask = 0xff << 8, */ -/* STACK_SIZE_shift = 8, */ - SQ_PGM_RESOURCES_FS__DX10_CLAMP_bit = 1 << 21, - SQ_ESGS_RING_ITEMSIZE = 0x000288a8, - ITEMSIZE_mask = 0x7fff << 0, - ITEMSIZE_shift = 0, - SQ_GSVS_RING_ITEMSIZE = 0x000288ac, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_ESTMP_RING_ITEMSIZE = 0x000288b0, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_GSTMP_RING_ITEMSIZE = 0x000288b4, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_VSTMP_RING_ITEMSIZE = 0x000288b8, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_PSTMP_RING_ITEMSIZE = 0x000288bc, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_FBUF_RING_ITEMSIZE = 0x000288c0, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_REDUC_RING_ITEMSIZE = 0x000288c4, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_GS_VERT_ITEMSIZE = 0x000288c8, -/* ITEMSIZE_mask = 0x7fff << 0, */ -/* ITEMSIZE_shift = 0, */ - SQ_PGM_CF_OFFSET_PS = 0x000288cc, - PGM_CF_OFFSET_mask = 0xfffff << 0, - PGM_CF_OFFSET_shift = 0, - SQ_PGM_CF_OFFSET_VS = 0x000288d0, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_GS = 0x000288d4, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_ES = 0x000288d8, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_PGM_CF_OFFSET_FS = 0x000288dc, -/* PGM_CF_OFFSET_mask = 0xfffff << 0, */ -/* PGM_CF_OFFSET_shift = 0, */ - SQ_VTX_SEMANTIC_CLEAR = 0x000288e0, - SQ_ALU_CONST_CACHE_PS_0 = 0x00028940, - SQ_ALU_CONST_CACHE_PS_0_num = 16, - SQ_ALU_CONST_CACHE_VS_0 = 0x00028980, - SQ_ALU_CONST_CACHE_VS_0_num = 16, - SQ_ALU_CONST_CACHE_GS_0 = 0x000289c0, - SQ_ALU_CONST_CACHE_GS_0_num = 16, - PA_SU_POINT_SIZE = 0x00028a00, - PA_SU_POINT_SIZE__HEIGHT_mask = 0xffff << 0, - PA_SU_POINT_SIZE__HEIGHT_shift = 0, - PA_SU_POINT_SIZE__WIDTH_mask = 0xffff << 16, - PA_SU_POINT_SIZE__WIDTH_shift = 16, - PA_SU_POINT_MINMAX = 0x00028a04, - MIN_SIZE_mask = 0xffff << 0, - MIN_SIZE_shift = 0, - MAX_SIZE_mask = 0xffff << 16, - MAX_SIZE_shift = 16, - PA_SU_LINE_CNTL = 0x00028a08, - PA_SU_LINE_CNTL__WIDTH_mask = 0xffff << 0, - PA_SU_LINE_CNTL__WIDTH_shift = 0, - PA_SC_LINE_STIPPLE = 0x00028a0c, - LINE_PATTERN_mask = 0xffff << 0, - LINE_PATTERN_shift = 0, - REPEAT_COUNT_mask = 0xff << 16, - REPEAT_COUNT_shift = 16, - PATTERN_BIT_ORDER_bit = 1 << 28, - AUTO_RESET_CNTL_mask = 0x03 << 29, - AUTO_RESET_CNTL_shift = 29, - VGT_OUTPUT_PATH_CNTL = 0x00028a10, - PATH_SELECT_mask = 0x03 << 0, - PATH_SELECT_shift = 0, - VGT_OUTPATH_VTX_REUSE = 0x00, - VGT_OUTPATH_TESS_EN = 0x01, - VGT_OUTPATH_PASSTHRU = 0x02, - VGT_OUTPATH_GS_BLOCK = 0x03, - VGT_HOS_CNTL = 0x00028a14, - TESS_MODE_mask = 0x03 << 0, - TESS_MODE_shift = 0, - VGT_HOS_MAX_TESS_LEVEL = 0x00028a18, - VGT_HOS_MIN_TESS_LEVEL = 0x00028a1c, - VGT_HOS_REUSE_DEPTH = 0x00028a20, - REUSE_DEPTH_mask = 0xff << 0, - REUSE_DEPTH_shift = 0, - VGT_GROUP_PRIM_TYPE = 0x00028a24, - VGT_GROUP_PRIM_TYPE__PRIM_TYPE_mask = 0x1f << 0, - VGT_GROUP_PRIM_TYPE__PRIM_TYPE_shift = 0, - VGT_GRP_3D_POINT = 0x00, - VGT_GRP_3D_LINE = 0x01, - VGT_GRP_3D_TRI = 0x02, - VGT_GRP_3D_RECT = 0x03, - VGT_GRP_3D_QUAD = 0x04, - VGT_GRP_2D_COPY_RECT_V0 = 0x05, - VGT_GRP_2D_COPY_RECT_V1 = 0x06, - VGT_GRP_2D_COPY_RECT_V2 = 0x07, - VGT_GRP_2D_COPY_RECT_V3 = 0x08, - VGT_GRP_2D_FILL_RECT = 0x09, - VGT_GRP_2D_LINE = 0x0a, - VGT_GRP_2D_TRI = 0x0b, - VGT_GRP_PRIM_INDEX_LINE = 0x0c, - VGT_GRP_PRIM_INDEX_TRI = 0x0d, - VGT_GRP_PRIM_INDEX_QUAD = 0x0e, - VGT_GRP_3D_LINE_ADJ = 0x0f, - VGT_GRP_3D_TRI_ADJ = 0x10, - RETAIN_ORDER_bit = 1 << 14, - RETAIN_QUADS_bit = 1 << 15, - PRIM_ORDER_mask = 0x07 << 16, - PRIM_ORDER_shift = 16, - VGT_GRP_LIST = 0x00, - VGT_GRP_STRIP = 0x01, - VGT_GRP_FAN = 0x02, - VGT_GRP_LOOP = 0x03, - VGT_GRP_POLYGON = 0x04, - VGT_GROUP_FIRST_DECR = 0x00028a28, - FIRST_DECR_mask = 0x0f << 0, - FIRST_DECR_shift = 0, - VGT_GROUP_DECR = 0x00028a2c, - DECR_mask = 0x0f << 0, - DECR_shift = 0, - VGT_GROUP_VECT_0_CNTL = 0x00028a30, - COMP_X_EN_bit = 1 << 0, - COMP_Y_EN_bit = 1 << 1, - COMP_Z_EN_bit = 1 << 2, - COMP_W_EN_bit = 1 << 3, - VGT_GROUP_VECT_0_CNTL__STRIDE_mask = 0xff << 8, - VGT_GROUP_VECT_0_CNTL__STRIDE_shift = 8, - SHIFT_mask = 0xff << 16, - SHIFT_shift = 16, - VGT_GROUP_VECT_1_CNTL = 0x00028a34, -/* COMP_X_EN_bit = 1 << 0, */ -/* COMP_Y_EN_bit = 1 << 1, */ -/* COMP_Z_EN_bit = 1 << 2, */ -/* COMP_W_EN_bit = 1 << 3, */ - VGT_GROUP_VECT_1_CNTL__STRIDE_mask = 0xff << 8, - VGT_GROUP_VECT_1_CNTL__STRIDE_shift = 8, -/* SHIFT_mask = 0xff << 16, */ -/* SHIFT_shift = 16, */ - VGT_GROUP_VECT_0_FMT_CNTL = 0x00028a38, - X_CONV_mask = 0x0f << 0, - X_CONV_shift = 0, - VGT_GRP_INDEX_16 = 0x00, - VGT_GRP_INDEX_32 = 0x01, - VGT_GRP_UINT_16 = 0x02, - VGT_GRP_UINT_32 = 0x03, - VGT_GRP_SINT_16 = 0x04, - VGT_GRP_SINT_32 = 0x05, - VGT_GRP_FLOAT_32 = 0x06, - VGT_GRP_AUTO_PRIM = 0x07, - VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, - X_OFFSET_mask = 0x0f << 4, - X_OFFSET_shift = 4, - Y_CONV_mask = 0x0f << 8, - Y_CONV_shift = 8, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - Y_OFFSET_mask = 0x0f << 12, - Y_OFFSET_shift = 12, - Z_CONV_mask = 0x0f << 16, - Z_CONV_shift = 16, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - Z_OFFSET_mask = 0x0f << 20, - Z_OFFSET_shift = 20, - W_CONV_mask = 0x0f << 24, - W_CONV_shift = 24, -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ - W_OFFSET_mask = 0x0f << 28, - W_OFFSET_shift = 28, - VGT_GROUP_VECT_1_FMT_CNTL = 0x00028a3c, -/* X_CONV_mask = 0x0f << 0, */ -/* X_CONV_shift = 0, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* X_OFFSET_mask = 0x0f << 4, */ -/* X_OFFSET_shift = 4, */ -/* Y_CONV_mask = 0x0f << 8, */ -/* Y_CONV_shift = 8, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* Y_OFFSET_mask = 0x0f << 12, */ -/* Y_OFFSET_shift = 12, */ -/* Z_CONV_mask = 0x0f << 16, */ -/* Z_CONV_shift = 16, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* Z_OFFSET_mask = 0x0f << 20, */ -/* Z_OFFSET_shift = 20, */ -/* W_CONV_mask = 0x0f << 24, */ -/* W_CONV_shift = 24, */ -/* VGT_GRP_INDEX_16 = 0x00, */ -/* VGT_GRP_INDEX_32 = 0x01, */ -/* VGT_GRP_UINT_16 = 0x02, */ -/* VGT_GRP_UINT_32 = 0x03, */ -/* VGT_GRP_SINT_16 = 0x04, */ -/* VGT_GRP_SINT_32 = 0x05, */ -/* VGT_GRP_FLOAT_32 = 0x06, */ -/* VGT_GRP_AUTO_PRIM = 0x07, */ -/* VGT_GRP_FIX_1_23_TO_FLOAT = 0x08, */ -/* W_OFFSET_mask = 0x0f << 28, */ -/* W_OFFSET_shift = 28, */ - VGT_GS_MODE = 0x00028a40, - MODE_mask = 0x03 << 0, - MODE_shift = 0, - GS_OFF = 0x00, - GS_SCENARIO_A = 0x01, - GS_SCENARIO_B = 0x02, - GS_SCENARIO_G = 0x03, - ES_PASSTHRU_bit = 1 << 2, - CUT_MODE_mask = 0x03 << 3, - CUT_MODE_shift = 3, - GS_CUT_1024 = 0x00, - GS_CUT_512 = 0x01, - GS_CUT_256 = 0x02, - GS_CUT_128 = 0x03, - PA_SC_MPASS_PS_CNTL = 0x00028a48, - MPASS_PIX_VEC_PER_PASS_mask = 0xfffff << 0, - MPASS_PIX_VEC_PER_PASS_shift = 0, - MPASS_PS_ENA_bit = 1 << 31, - PA_SC_MODE_CNTL = 0x00028a4c, - MSAA_ENABLE_bit = 1 << 0, - CLIPRECT_ENABLE_bit = 1 << 1, - LINE_STIPPLE_ENABLE_bit = 1 << 2, - MULTI_CHIP_PRIM_DISCARD_ENAB_bit = 1 << 3, - WALK_ORDER_ENABLE_bit = 1 << 4, - HALVE_DETAIL_SAMPLE_PERF_bit = 1 << 5, - WALK_SIZE_bit = 1 << 6, - WALK_ALIGNMENT_bit = 1 << 7, - WALK_ALIGN8_PRIM_FITS_ST_bit = 1 << 8, - TILE_COVER_NO_SCISSOR_bit = 1 << 9, - KILL_PIX_POST_HI_Z_bit = 1 << 10, - KILL_PIX_POST_DETAIL_MASK_bit = 1 << 11, - MULTI_CHIP_SUPERTILE_ENABLE_bit = 1 << 12, - TILE_COVER_DISABLE_bit = 1 << 13, - FORCE_EOV_CNTDWN_ENABLE_bit = 1 << 14, - FORCE_EOV_TILE_ENABLE_bit = 1 << 15, - FORCE_EOV_REZ_ENABLE_bit = 1 << 16, - PS_ITER_SAMPLE_bit = 1 << 17, - VGT_ENHANCE = 0x00028a50, - VGT_ENHANCE__MI_TIMESTAMP_RES_mask = 0x03 << 0, - VGT_ENHANCE__MI_TIMESTAMP_RES_shift = 0, - X_0_992_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_32 = 0x00, - X_0_496_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_16 = 0x01, - X_0_248_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_8 = 0x02, - X_0_124_CLOCKS_LATENCY_RANGE_IN_STEPS_OF_4 = 0x03, - MISC_mask = 0x3fffffff << 2, - MISC_shift = 2, - VGT_GS_OUT_PRIM_TYPE = 0x00028a6c, - OUTPRIM_TYPE_mask = 0x3f << 0, - OUTPRIM_TYPE_shift = 0, - POINTLIST = 0x00, - LINESTRIP = 0x01, - TRISTRIP = 0x02, - VGT_DMA_SIZE = 0x00028a74, - VGT_DMA_INDEX_TYPE = 0x00028a7c, -/* INDEX_TYPE_mask = 0x03 << 0, */ -/* INDEX_TYPE_shift = 0, */ - VGT_INDEX_16 = 0x00, - VGT_INDEX_32 = 0x01, - SWAP_MODE_mask = 0x03 << 2, - SWAP_MODE_shift = 2, - VGT_DMA_SWAP_NONE = 0x00, - VGT_DMA_SWAP_16_BIT = 0x01, - VGT_DMA_SWAP_32_BIT = 0x02, - VGT_DMA_SWAP_WORD = 0x03, - VGT_PRIMITIVEID_EN = 0x00028a84, - PRIMITIVEID_EN_bit = 1 << 0, - VGT_DMA_NUM_INSTANCES = 0x00028a88, - VGT_EVENT_INITIATOR = 0x00028a90, - EVENT_TYPE_mask = 0x3f << 0, - EVENT_TYPE_shift = 0, - CACHE_FLUSH_TS = 0x04, - CONTEXT_DONE = 0x05, - CACHE_FLUSH = 0x06, - VIZQUERY_START = 0x07, - VIZQUERY_END = 0x08, - SC_WAIT_WC = 0x09, - MPASS_PS_CP_REFETCH = 0x0a, - MPASS_PS_RST_START = 0x0b, - MPASS_PS_INCR_START = 0x0c, - RST_PIX_CNT = 0x0d, - RST_VTX_CNT = 0x0e, - VS_PARTIAL_FLUSH = 0x0f, - PS_PARTIAL_FLUSH = 0x10, - CACHE_FLUSH_AND_INV_TS_EVENT = 0x14, - ZPASS_DONE = 0x15, - CACHE_FLUSH_AND_INV_EVENT = 0x16, - PERFCOUNTER_START = 0x17, - PERFCOUNTER_STOP = 0x18, - PIPELINESTAT_START = 0x19, - PIPELINESTAT_STOP = 0x1a, - PERFCOUNTER_SAMPLE = 0x1b, - FLUSH_ES_OUTPUT = 0x1c, - FLUSH_GS_OUTPUT = 0x1d, - SAMPLE_PIPELINESTAT = 0x1e, - SO_VGTSTREAMOUT_FLUSH = 0x1f, - SAMPLE_STREAMOUTSTATS = 0x20, - RESET_VTX_CNT = 0x21, - BLOCK_CONTEXT_DONE = 0x22, - CR_CONTEXT_DONE = 0x23, - VGT_FLUSH = 0x24, - CR_DONE_TS = 0x25, - SQ_NON_EVENT = 0x26, - SC_SEND_DB_VPZ = 0x27, - BOTTOM_OF_PIPE_TS = 0x28, - DB_CACHE_FLUSH_AND_INV = 0x2a, - ADDRESS_HI_mask = 0xff << 19, - ADDRESS_HI_shift = 19, - EXTENDED_EVENT_bit = 1 << 27, - VGT_MULTI_PRIM_IB_RESET_EN = 0x00028a94, - RESET_EN_bit = 1 << 0, - VGT_INSTANCE_STEP_RATE_0 = 0x00028aa0, - VGT_INSTANCE_STEP_RATE_1 = 0x00028aa4, - VGT_STRMOUT_EN = 0x00028ab0, - STREAMOUT_bit = 1 << 0, - VGT_REUSE_OFF = 0x00028ab4, - REUSE_OFF_bit = 1 << 0, - VGT_VTX_CNT_EN = 0x00028ab8, - VTX_CNT_EN_bit = 1 << 0, - VGT_STRMOUT_BUFFER_SIZE_0 = 0x00028ad0, - VGT_STRMOUT_VTX_STRIDE_0 = 0x00028ad4, - VGT_STRMOUT_VTX_STRIDE_0__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_0__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_0 = 0x00028ad8, - VGT_STRMOUT_BUFFER_OFFSET_0 = 0x00028adc, - VGT_STRMOUT_BUFFER_SIZE_1 = 0x00028ae0, - VGT_STRMOUT_VTX_STRIDE_1 = 0x00028ae4, - VGT_STRMOUT_VTX_STRIDE_1__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_1__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_1 = 0x00028ae8, - VGT_STRMOUT_BUFFER_OFFSET_1 = 0x00028aec, - VGT_STRMOUT_BUFFER_SIZE_2 = 0x00028af0, - VGT_STRMOUT_VTX_STRIDE_2 = 0x00028af4, - VGT_STRMOUT_VTX_STRIDE_2__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_2__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_2 = 0x00028af8, - VGT_STRMOUT_BUFFER_OFFSET_2 = 0x00028afc, - VGT_STRMOUT_BUFFER_SIZE_3 = 0x00028b00, - VGT_STRMOUT_VTX_STRIDE_3 = 0x00028b04, - VGT_STRMOUT_VTX_STRIDE_3__STRIDE_mask = 0x3ff << 0, - VGT_STRMOUT_VTX_STRIDE_3__STRIDE_shift = 0, - VGT_STRMOUT_BUFFER_BASE_3 = 0x00028b08, - VGT_STRMOUT_BUFFER_OFFSET_3 = 0x00028b0c, - VGT_STRMOUT_BASE_OFFSET_0 = 0x00028b10, - VGT_STRMOUT_BASE_OFFSET_1 = 0x00028b14, - VGT_STRMOUT_BASE_OFFSET_2 = 0x00028b18, - VGT_STRMOUT_BASE_OFFSET_3 = 0x00028b1c, - VGT_STRMOUT_BUFFER_EN = 0x00028b20, - BUFFER_0_EN_bit = 1 << 0, - BUFFER_1_EN_bit = 1 << 1, - BUFFER_2_EN_bit = 1 << 2, - BUFFER_3_EN_bit = 1 << 3, - VGT_STRMOUT_DRAW_OPAQUE_OFFSET = 0x00028b28, - VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE = 0x00028b2c, - VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE = 0x00028b30, - VGT_STRMOUT_BASE_OFFSET_HI_0 = 0x00028b44, - VGT_STRMOUT_BASE_OFFSET_HI_0__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_0__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_1 = 0x00028b48, - VGT_STRMOUT_BASE_OFFSET_HI_1__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_1__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_2 = 0x00028b4c, - VGT_STRMOUT_BASE_OFFSET_HI_2__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_2__BASE_OFFSET_shift = 0, - VGT_STRMOUT_BASE_OFFSET_HI_3 = 0x00028b50, - VGT_STRMOUT_BASE_OFFSET_HI_3__BASE_OFFSET_mask = 0x3f << 0, - VGT_STRMOUT_BASE_OFFSET_HI_3__BASE_OFFSET_shift = 0, - PA_SC_LINE_CNTL = 0x00028c00, - BRES_CNTL_mask = 0xff << 0, - BRES_CNTL_shift = 0, - USE_BRES_CNTL_bit = 1 << 8, - EXPAND_LINE_WIDTH_bit = 1 << 9, - LAST_PIXEL_bit = 1 << 10, - PA_SC_AA_CONFIG = 0x00028c04, - MSAA_NUM_SAMPLES_mask = 0x03 << 0, - MSAA_NUM_SAMPLES_shift = 0, - AA_MASK_CENTROID_DTMN_bit = 1 << 4, - MAX_SAMPLE_DIST_mask = 0x0f << 13, - MAX_SAMPLE_DIST_shift = 13, - PA_SU_VTX_CNTL = 0x00028c08, - PIX_CENTER_bit = 1 << 0, - PA_SU_VTX_CNTL__ROUND_MODE_mask = 0x03 << 1, - PA_SU_VTX_CNTL__ROUND_MODE_shift = 1, - X_TRUNCATE = 0x00, - X_ROUND = 0x01, - X_ROUND_TO_EVEN = 0x02, - X_ROUND_TO_ODD = 0x03, - QUANT_MODE_mask = 0x07 << 3, - QUANT_MODE_shift = 3, - X_1_16TH = 0x00, - X_1_8TH = 0x01, - X_1_4TH = 0x02, - X_1_2 = 0x03, - X_1 = 0x04, - X_1_256TH = 0x05, - PA_CL_GB_VERT_CLIP_ADJ = 0x00028c0c, - PA_CL_GB_VERT_DISC_ADJ = 0x00028c10, - PA_CL_GB_HORZ_CLIP_ADJ = 0x00028c14, - PA_CL_GB_HORZ_DISC_ADJ = 0x00028c18, - PA_SC_AA_SAMPLE_LOCS_MCTX = 0x00028c1c, -/* S0_X_mask = 0x0f << 0, */ -/* S0_X_shift = 0, */ -/* S0_Y_mask = 0x0f << 4, */ -/* S0_Y_shift = 4, */ -/* S1_X_mask = 0x0f << 8, */ -/* S1_X_shift = 8, */ -/* S1_Y_mask = 0x0f << 12, */ -/* S1_Y_shift = 12, */ -/* S2_X_mask = 0x0f << 16, */ -/* S2_X_shift = 16, */ -/* S2_Y_mask = 0x0f << 20, */ -/* S2_Y_shift = 20, */ -/* S3_X_mask = 0x0f << 24, */ -/* S3_X_shift = 24, */ -/* S3_Y_mask = 0x0f << 28, */ -/* S3_Y_shift = 28, */ - PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX = 0x00028c20, -/* S4_X_mask = 0x0f << 0, */ -/* S4_X_shift = 0, */ -/* S4_Y_mask = 0x0f << 4, */ -/* S4_Y_shift = 4, */ -/* S5_X_mask = 0x0f << 8, */ -/* S5_X_shift = 8, */ -/* S5_Y_mask = 0x0f << 12, */ -/* S5_Y_shift = 12, */ -/* S6_X_mask = 0x0f << 16, */ -/* S6_X_shift = 16, */ -/* S6_Y_mask = 0x0f << 20, */ -/* S6_Y_shift = 20, */ -/* S7_X_mask = 0x0f << 24, */ -/* S7_X_shift = 24, */ -/* S7_Y_mask = 0x0f << 28, */ -/* S7_Y_shift = 28, */ - CB_CLRCMP_CONTROL = 0x00028c30, - CLRCMP_FCN_SRC_mask = 0x07 << 0, - CLRCMP_FCN_SRC_shift = 0, - CLRCMP_DRAW_ALWAYS = 0x00, - CLRCMP_DRAW_NEVER = 0x01, - CLRCMP_DRAW_ON_NEQ = 0x04, - CLRCMP_DRAW_ON_EQ = 0x05, - CLRCMP_FCN_DST_mask = 0x07 << 8, - CLRCMP_FCN_DST_shift = 8, -/* CLRCMP_DRAW_ALWAYS = 0x00, */ -/* CLRCMP_DRAW_NEVER = 0x01, */ -/* CLRCMP_DRAW_ON_NEQ = 0x04, */ -/* CLRCMP_DRAW_ON_EQ = 0x05, */ - CLRCMP_FCN_SEL_mask = 0x03 << 24, - CLRCMP_FCN_SEL_shift = 24, - CLRCMP_SEL_DST = 0x00, - CLRCMP_SEL_SRC = 0x01, - CLRCMP_SEL_AND = 0x02, - CB_CLRCMP_SRC = 0x00028c34, - CB_CLRCMP_DST = 0x00028c38, - CB_CLRCMP_MSK = 0x00028c3c, - PA_SC_AA_MASK = 0x00028c48, - VGT_VERTEX_REUSE_BLOCK_CNTL = 0x00028c58, - VTX_REUSE_DEPTH_mask = 0xff << 0, - VTX_REUSE_DEPTH_shift = 0, - VGT_OUT_DEALLOC_CNTL = 0x00028c5c, - DEALLOC_DIST_mask = 0x7f << 0, - DEALLOC_DIST_shift = 0, - DB_RENDER_CONTROL = 0x00028d0c, - DEPTH_CLEAR_ENABLE_bit = 1 << 0, - STENCIL_CLEAR_ENABLE_bit = 1 << 1, - DEPTH_COPY_bit = 1 << 2, - STENCIL_COPY_bit = 1 << 3, - RESUMMARIZE_ENABLE_bit = 1 << 4, - STENCIL_COMPRESS_DISABLE_bit = 1 << 5, - DEPTH_COMPRESS_DISABLE_bit = 1 << 6, - COPY_CENTROID_bit = 1 << 7, - COPY_SAMPLE_mask = 0x07 << 8, - COPY_SAMPLE_shift = 8, - ZPASS_INCREMENT_DISABLE_bit = 1 << 11, - DB_RENDER_OVERRIDE = 0x00028d10, - FORCE_HIZ_ENABLE_mask = 0x03 << 0, - FORCE_HIZ_ENABLE_shift = 0, - FORCE_OFF = 0x00, - FORCE_ENABLE = 0x01, - FORCE_DISABLE = 0x02, - FORCE_RESERVED = 0x03, - FORCE_HIS_ENABLE0_mask = 0x03 << 2, - FORCE_HIS_ENABLE0_shift = 2, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_HIS_ENABLE1_mask = 0x03 << 4, - FORCE_HIS_ENABLE1_shift = 4, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_SHADER_Z_ORDER_bit = 1 << 6, - FAST_Z_DISABLE_bit = 1 << 7, - FAST_STENCIL_DISABLE_bit = 1 << 8, - NOOP_CULL_DISABLE_bit = 1 << 9, - FORCE_COLOR_KILL_bit = 1 << 10, - FORCE_Z_READ_bit = 1 << 11, - FORCE_STENCIL_READ_bit = 1 << 12, - FORCE_FULL_Z_RANGE_mask = 0x03 << 13, - FORCE_FULL_Z_RANGE_shift = 13, -/* FORCE_OFF = 0x00, */ -/* FORCE_ENABLE = 0x01, */ -/* FORCE_DISABLE = 0x02, */ -/* FORCE_RESERVED = 0x03, */ - FORCE_QC_SMASK_CONFLICT_bit = 1 << 15, - DISABLE_VIEWPORT_CLAMP_bit = 1 << 16, - IGNORE_SC_ZRANGE_bit = 1 << 17, - DB_HTILE_SURFACE = 0x00028d24, - HTILE_WIDTH_bit = 1 << 0, - HTILE_HEIGHT_bit = 1 << 1, - LINEAR_bit = 1 << 2, - FULL_CACHE_bit = 1 << 3, - HTILE_USES_PRELOAD_WIN_bit = 1 << 4, - PRELOAD_bit = 1 << 5, - PREFETCH_WIDTH_mask = 0x3f << 6, - PREFETCH_WIDTH_shift = 6, - PREFETCH_HEIGHT_mask = 0x3f << 12, - PREFETCH_HEIGHT_shift = 12, - DB_SRESULTS_COMPARE_STATE1 = 0x00028d2c, - COMPAREFUNC1_mask = 0x07 << 0, - COMPAREFUNC1_shift = 0, -/* REF_NEVER = 0x00, */ -/* REF_LESS = 0x01, */ -/* REF_EQUAL = 0x02, */ -/* REF_LEQUAL = 0x03, */ -/* REF_GREATER = 0x04, */ -/* REF_NOTEQUAL = 0x05, */ -/* REF_GEQUAL = 0x06, */ -/* REF_ALWAYS = 0x07, */ - COMPAREVALUE1_mask = 0xff << 4, - COMPAREVALUE1_shift = 4, - COMPAREMASK1_mask = 0xff << 12, - COMPAREMASK1_shift = 12, - ENABLE1_bit = 1 << 24, - DB_PRELOAD_CONTROL = 0x00028d30, - START_X_mask = 0xff << 0, - START_X_shift = 0, - START_Y_mask = 0xff << 8, - START_Y_shift = 8, - MAX_X_mask = 0xff << 16, - MAX_X_shift = 16, - MAX_Y_mask = 0xff << 24, - MAX_Y_shift = 24, - DB_PREFETCH_LIMIT = 0x00028d34, - DEPTH_HEIGHT_TILE_MAX_mask = 0x3ff << 0, - DEPTH_HEIGHT_TILE_MAX_shift = 0, - PA_SU_POLY_OFFSET_DB_FMT_CNTL = 0x00028df8, - POLY_OFFSET_NEG_NUM_DB_BITS_mask = 0xff << 0, - POLY_OFFSET_NEG_NUM_DB_BITS_shift = 0, - POLY_OFFSET_DB_IS_FLOAT_FMT_bit = 1 << 8, - PA_SU_POLY_OFFSET_CLAMP = 0x00028dfc, - PA_SU_POLY_OFFSET_FRONT_SCALE = 0x00028e00, - PA_SU_POLY_OFFSET_FRONT_OFFSET = 0x00028e04, - PA_SU_POLY_OFFSET_BACK_SCALE = 0x00028e08, - PA_SU_POLY_OFFSET_BACK_OFFSET = 0x00028e0c, - PA_CL_POINT_X_RAD = 0x00028e10, - PA_CL_POINT_Y_RAD = 0x00028e14, - PA_CL_POINT_SIZE = 0x00028e18, - PA_CL_POINT_CULL_RAD = 0x00028e1c, - PA_CL_UCP_0_X = 0x00028e20, - PA_CL_UCP_0_X_num = 6, - PA_CL_UCP_0_X_offset = 16, - PA_CL_UCP_0_Y = 0x00028e24, - PA_CL_UCP_0_Y_num = 6, - PA_CL_UCP_0_Y_offset = 16, - PA_CL_UCP_0_Z = 0x00028e28, - PA_CL_UCP_0_Z_num = 6, - PA_CL_UCP_0_Z_offset = 16, - SQ_ALU_CONSTANT0_0 = 0x00030000, - SQ_ALU_CONSTANT1_0 = 0x00030004, - SQ_ALU_CONSTANT2_0 = 0x00030008, - SQ_ALU_CONSTANT3_0 = 0x0003000c, - SQ_VTX_CONSTANT_WORD0_0 = 0x00038000, - SQ_TEX_RESOURCE_WORD0_0 = 0x00038000, - DIM_mask = 0x07 << 0, - DIM_shift = 0, - SQ_TEX_DIM_1D = 0x00, - SQ_TEX_DIM_2D = 0x01, - SQ_TEX_DIM_3D = 0x02, - SQ_TEX_DIM_CUBEMAP = 0x03, - SQ_TEX_DIM_1D_ARRAY = 0x04, - SQ_TEX_DIM_2D_ARRAY = 0x05, - SQ_TEX_DIM_2D_MSAA = 0x06, - SQ_TEX_DIM_2D_ARRAY_MSAA = 0x07, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask = 0x0f << 3, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift = 3, - TILE_TYPE_bit = 1 << 7, - PITCH_mask = 0x7ff << 8, - PITCH_shift = 8, - TEX_WIDTH_mask = 0x1fff << 19, - TEX_WIDTH_shift = 19, - SQ_VTX_CONSTANT_WORD1_0 = 0x00038004, - SQ_TEX_RESOURCE_WORD1_0 = 0x00038004, - TEX_HEIGHT_mask = 0x1fff << 0, - TEX_HEIGHT_shift = 0, - TEX_DEPTH_mask = 0x1fff << 13, - TEX_DEPTH_shift = 13, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask = 0x3f << 26, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift = 26, - SQ_VTX_CONSTANT_WORD2_0 = 0x00038008, - BASE_ADDRESS_HI_mask = 0xff << 0, - BASE_ADDRESS_HI_shift = 0, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask = 0x7ff << 8, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift = 8, - SQ_VTX_CONSTANT_WORD2_0__CLAMP_X_bit = 1 << 19, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask = 0x3f << 20, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift = 20, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask = 0x03 << 26, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift = 26, -/* SQ_NUM_FORMAT_NORM = 0x00, */ -/* SQ_NUM_FORMAT_INT = 0x01, */ -/* SQ_NUM_FORMAT_SCALED = 0x02, */ - SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit = 1 << 28, - SQ_VTX_CONSTANT_WORD2_0__SRF_MODE_ALL_bit = 1 << 29, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_mask = 0x03 << 30, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift = 30, -/* SQ_ENDIAN_NONE = 0x00, */ -/* SQ_ENDIAN_8IN16 = 0x01, */ -/* SQ_ENDIAN_8IN32 = 0x02, */ - SQ_TEX_RESOURCE_WORD2_0 = 0x00038008, - SQ_VTX_CONSTANT_WORD3_0 = 0x0003800c, - MEM_REQUEST_SIZE_mask = 0x03 << 0, - MEM_REQUEST_SIZE_shift = 0, - SQ_TEX_RESOURCE_WORD3_0 = 0x0003800c, - SQ_TEX_RESOURCE_WORD4_0 = 0x00038010, - FORMAT_COMP_X_mask = 0x03 << 0, - FORMAT_COMP_X_shift = 0, - SQ_FORMAT_COMP_UNSIGNED = 0x00, - SQ_FORMAT_COMP_SIGNED = 0x01, - SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, - FORMAT_COMP_Y_mask = 0x03 << 2, - FORMAT_COMP_Y_shift = 2, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - FORMAT_COMP_Z_mask = 0x03 << 4, - FORMAT_COMP_Z_shift = 4, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - FORMAT_COMP_W_mask = 0x03 << 6, - FORMAT_COMP_W_shift = 6, -/* SQ_FORMAT_COMP_UNSIGNED = 0x00, */ -/* SQ_FORMAT_COMP_SIGNED = 0x01, */ -/* SQ_FORMAT_COMP_UNSIGNED_BIASED = 0x02, */ - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_mask = 0x03 << 8, - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_shift = 8, -/* SQ_NUM_FORMAT_NORM = 0x00, */ -/* SQ_NUM_FORMAT_INT = 0x01, */ -/* SQ_NUM_FORMAT_SCALED = 0x02, */ - SQ_TEX_RESOURCE_WORD4_0__SRF_MODE_ALL_bit = 1 << 10, - SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit = 1 << 11, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_mask = 0x03 << 12, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_shift = 12, -/* SQ_ENDIAN_NONE = 0x00, */ -/* SQ_ENDIAN_8IN16 = 0x01, */ -/* SQ_ENDIAN_8IN32 = 0x02, */ - REQUEST_SIZE_mask = 0x03 << 14, - REQUEST_SIZE_shift = 14, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask = 0x07 << 16, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift = 16, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask = 0x07 << 19, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift = 19, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask = 0x07 << 22, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift = 22, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask = 0x07 << 25, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift = 25, -/* SQ_SEL_X = 0x00, */ -/* SQ_SEL_Y = 0x01, */ -/* SQ_SEL_Z = 0x02, */ -/* SQ_SEL_W = 0x03, */ -/* SQ_SEL_0 = 0x04, */ -/* SQ_SEL_1 = 0x05, */ - BASE_LEVEL_mask = 0x0f << 28, - BASE_LEVEL_shift = 28, - SQ_TEX_RESOURCE_WORD5_0 = 0x00038014, - LAST_LEVEL_mask = 0x0f << 0, - LAST_LEVEL_shift = 0, - BASE_ARRAY_mask = 0x1fff << 4, - BASE_ARRAY_shift = 4, - LAST_ARRAY_mask = 0x1fff << 17, - LAST_ARRAY_shift = 17, - SQ_TEX_RESOURCE_WORD6_0 = 0x00038018, - MPEG_CLAMP_mask = 0x03 << 0, - MPEG_CLAMP_shift = 0, - SQ_TEX_MPEG_CLAMP_OFF = 0x00, - SQ_TEX_MPEG_9 = 0x01, - SQ_TEX_MPEG_10 = 0x02, - PERF_MODULATION_mask = 0x07 << 5, - PERF_MODULATION_shift = 5, - INTERLACED_bit = 1 << 8, - SQ_TEX_RESOURCE_WORD6_0__TYPE_mask = 0x03 << 30, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift = 30, - SQ_TEX_VTX_INVALID_TEXTURE = 0x00, - SQ_TEX_VTX_INVALID_BUFFER = 0x01, - SQ_TEX_VTX_VALID_TEXTURE = 0x02, - SQ_TEX_VTX_VALID_BUFFER = 0x03, - SQ_VTX_CONSTANT_WORD6_0 = 0x00038018, - SQ_VTX_CONSTANT_WORD6_0__TYPE_mask = 0x03 << 30, - SQ_VTX_CONSTANT_WORD6_0__TYPE_shift = 30, -/* SQ_TEX_VTX_INVALID_TEXTURE = 0x00, */ -/* SQ_TEX_VTX_INVALID_BUFFER = 0x01, */ -/* SQ_TEX_VTX_VALID_TEXTURE = 0x02, */ -/* SQ_TEX_VTX_VALID_BUFFER = 0x03, */ - SQ_TEX_SAMPLER_WORD0_0 = 0x0003c000, - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask = 0x07 << 0, - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift = 0, - SQ_TEX_WRAP = 0x00, - SQ_TEX_MIRROR = 0x01, - SQ_TEX_CLAMP_LAST_TEXEL = 0x02, - SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, - SQ_TEX_CLAMP_HALF_BORDER = 0x04, - SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, - SQ_TEX_CLAMP_BORDER = 0x06, - SQ_TEX_MIRROR_ONCE_BORDER = 0x07, - CLAMP_Y_mask = 0x07 << 3, - CLAMP_Y_shift = 3, -/* SQ_TEX_WRAP = 0x00, */ -/* SQ_TEX_MIRROR = 0x01, */ -/* SQ_TEX_CLAMP_LAST_TEXEL = 0x02, */ -/* SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, */ -/* SQ_TEX_CLAMP_HALF_BORDER = 0x04, */ -/* SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, */ -/* SQ_TEX_CLAMP_BORDER = 0x06, */ -/* SQ_TEX_MIRROR_ONCE_BORDER = 0x07, */ - CLAMP_Z_mask = 0x07 << 6, - CLAMP_Z_shift = 6, -/* SQ_TEX_WRAP = 0x00, */ -/* SQ_TEX_MIRROR = 0x01, */ -/* SQ_TEX_CLAMP_LAST_TEXEL = 0x02, */ -/* SQ_TEX_MIRROR_ONCE_LAST_TEXEL = 0x03, */ -/* SQ_TEX_CLAMP_HALF_BORDER = 0x04, */ -/* SQ_TEX_MIRROR_ONCE_HALF_BORDER = 0x05, */ -/* SQ_TEX_CLAMP_BORDER = 0x06, */ -/* SQ_TEX_MIRROR_ONCE_BORDER = 0x07, */ - XY_MAG_FILTER_mask = 0x07 << 9, - XY_MAG_FILTER_shift = 9, - SQ_TEX_XY_FILTER_POINT = 0x00, - SQ_TEX_XY_FILTER_BILINEAR = 0x01, - SQ_TEX_XY_FILTER_BICUBIC = 0x02, - XY_MIN_FILTER_mask = 0x07 << 12, - XY_MIN_FILTER_shift = 12, -/* SQ_TEX_XY_FILTER_POINT = 0x00, */ -/* SQ_TEX_XY_FILTER_BILINEAR = 0x01, */ -/* SQ_TEX_XY_FILTER_BICUBIC = 0x02, */ - Z_FILTER_mask = 0x03 << 15, - Z_FILTER_shift = 15, - SQ_TEX_Z_FILTER_NONE = 0x00, - SQ_TEX_Z_FILTER_POINT = 0x01, - SQ_TEX_Z_FILTER_LINEAR = 0x02, - MIP_FILTER_mask = 0x03 << 17, - MIP_FILTER_shift = 17, -/* SQ_TEX_Z_FILTER_NONE = 0x00, */ -/* SQ_TEX_Z_FILTER_POINT = 0x01, */ -/* SQ_TEX_Z_FILTER_LINEAR = 0x02, */ - BORDER_COLOR_TYPE_mask = 0x03 << 22, - BORDER_COLOR_TYPE_shift = 22, - SQ_TEX_BORDER_COLOR_TRANS_BLACK = 0x00, - SQ_TEX_BORDER_COLOR_OPAQUE_BLACK = 0x01, - SQ_TEX_BORDER_COLOR_OPAQUE_WHITE = 0x02, - SQ_TEX_BORDER_COLOR_REGISTER = 0x03, - POINT_SAMPLING_CLAMP_bit = 1 << 24, - TEX_ARRAY_OVERRIDE_bit = 1 << 25, - DEPTH_COMPARE_FUNCTION_mask = 0x07 << 26, - DEPTH_COMPARE_FUNCTION_shift = 26, - SQ_TEX_DEPTH_COMPARE_NEVER = 0x00, - SQ_TEX_DEPTH_COMPARE_LESS = 0x01, - SQ_TEX_DEPTH_COMPARE_EQUAL = 0x02, - SQ_TEX_DEPTH_COMPARE_LESSEQUAL = 0x03, - SQ_TEX_DEPTH_COMPARE_GREATER = 0x04, - SQ_TEX_DEPTH_COMPARE_NOTEQUAL = 0x05, - SQ_TEX_DEPTH_COMPARE_GREATEREQUAL = 0x06, - SQ_TEX_DEPTH_COMPARE_ALWAYS = 0x07, - CHROMA_KEY_mask = 0x03 << 29, - CHROMA_KEY_shift = 29, - SQ_TEX_CHROMA_KEY_DISABLED = 0x00, - SQ_TEX_CHROMA_KEY_KILL = 0x01, - SQ_TEX_CHROMA_KEY_BLEND = 0x02, - LOD_USES_MINOR_AXIS_bit = 1 << 31, - SQ_TEX_SAMPLER_WORD1_0 = 0x0003c004, - MIN_LOD_mask = 0x3ff << 0, - MIN_LOD_shift = 0, - MAX_LOD_mask = 0x3ff << 10, - MAX_LOD_shift = 10, - SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_mask = 0xfff << 20, - SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_shift = 20, - SQ_TEX_SAMPLER_WORD2_0 = 0x0003c008, - LOD_BIAS_SEC_mask = 0xfff << 0, - LOD_BIAS_SEC_shift = 0, - MC_COORD_TRUNCATE_bit = 1 << 12, - SQ_TEX_SAMPLER_WORD2_0__FORCE_DEGAMMA_bit = 1 << 13, - HIGH_PRECISION_FILTER_bit = 1 << 14, - PERF_MIP_mask = 0x07 << 15, - PERF_MIP_shift = 15, - PERF_Z_mask = 0x03 << 18, - PERF_Z_shift = 18, - FETCH_4_bit = 1 << 26, - SAMPLE_IS_PCF_bit = 1 << 27, - SQ_TEX_SAMPLER_WORD2_0__TYPE_bit = 1 << 31, - SQ_VTX_BASE_VTX_LOC = 0x0003cff0, - SQ_VTX_START_INST_LOC = 0x0003cff4, - SQ_LOOP_CONST_DX10_0 = 0x0003e200, - SQ_LOOP_CONST_0 = 0x0003e200, - SQ_LOOP_CONST_0__COUNT_mask = 0xfff << 0, - SQ_LOOP_CONST_0__COUNT_shift = 0, - INIT_mask = 0xfff << 12, - INIT_shift = 12, - INC_mask = 0xff << 24, - INC_shift = 24, - SQ_BOOL_CONST_0 = 0x0003e380, - SQ_BOOL_CONST_0_num = 3, - -} ; - -#endif /* _AUTOREGS */ - diff --git a/src/mesa/drivers/dri/r600/r600_reg_r6xx.h b/src/mesa/drivers/dri/r600/r600_reg_r6xx.h deleted file mode 100644 index 74af7b4fed7..00000000000 --- a/src/mesa/drivers/dri/r600/r600_reg_r6xx.h +++ /dev/null @@ -1,492 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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 _R600_REG_R6xx_H_ -#define _R600_REG_R6xx_H_ - -/* - * Registers for R6xx chips that are not documented yet - */ - -enum { - - MM_INDEX = 0x0000, - MM_DATA = 0x0004, - - SRBM_STATUS = 0x0e50, - RLC_RQ_PENDING_bit = 1 << 3, - RCU_RQ_PENDING_bit = 1 << 4, - GRBM_RQ_PENDING_bit = 1 << 5, - HI_RQ_PENDING_bit = 1 << 6, - IO_EXTERN_SIGNAL_bit = 1 << 7, - VMC_BUSY_bit = 1 << 8, - MCB_BUSY_bit = 1 << 9, - MCDZ_BUSY_bit = 1 << 10, - MCDY_BUSY_bit = 1 << 11, - MCDX_BUSY_bit = 1 << 12, - MCDW_BUSY_bit = 1 << 13, - SEM_BUSY_bit = 1 << 14, - SRBM_STATUS__RLC_BUSY_bit = 1 << 15, - PDMA_BUSY_bit = 1 << 16, - IH_BUSY_bit = 1 << 17, - CSC_BUSY_bit = 1 << 20, - CMC7_BUSY_bit = 1 << 21, - CMC6_BUSY_bit = 1 << 22, - CMC5_BUSY_bit = 1 << 23, - CMC4_BUSY_bit = 1 << 24, - CMC3_BUSY_bit = 1 << 25, - CMC2_BUSY_bit = 1 << 26, - CMC1_BUSY_bit = 1 << 27, - CMC0_BUSY_bit = 1 << 28, - BIF_BUSY_bit = 1 << 29, - IDCT_BUSY_bit = 1 << 30, - - SRBM_READ_ERROR = 0x0e98, - READ_ADDRESS_mask = 0xffff << 2, - READ_ADDRESS_shift = 2, - READ_REQUESTER_HI_bit = 1 << 24, - READ_REQUESTER_GRBM_bit = 1 << 25, - READ_REQUESTER_RCU_bit = 1 << 26, - READ_REQUESTER_RLC_bit = 1 << 27, - READ_ERROR_bit = 1 << 31, - - SRBM_INT_STATUS = 0x0ea4, - RDERR_INT_STAT_bit = 1 << 0, - GFX_CNTX_SWITCH_INT_STAT_bit = 1 << 1, - SRBM_INT_ACK = 0x0ea8, - RDERR_INT_ACK_bit = 1 << 0, - GFX_CNTX_SWITCH_INT_ACK_bit = 1 << 1, - - R6XX_MC_VM_FB_LOCATION = 0x2180, - - VENDOR_DEVICE_ID = 0x4000, - - D1GRPH_PRIMARY_SURFACE_ADDRESS = 0x6110, - D1GRPH_PITCH = 0x6120, - D1GRPH_Y_END = 0x6138, - - GRBM_STATUS = 0x8010, - CMDFIFO_AVAIL_mask = 0x1f << 0, - CMDFIFO_AVAIL_shift = 0, - SRBM_RQ_PENDING_bit = 1 << 5, - CP_RQ_PENDING_bit = 1 << 6, - CF_RQ_PENDING_bit = 1 << 7, - PF_RQ_PENDING_bit = 1 << 8, - GRBM_EE_BUSY_bit = 1 << 10, - GRBM_STATUS__VC_BUSY_bit = 1 << 11, - DB03_CLEAN_bit = 1 << 12, - CB03_CLEAN_bit = 1 << 13, - VGT_BUSY_NO_DMA_bit = 1 << 16, - GRBM_STATUS__VGT_BUSY_bit = 1 << 17, - TA03_BUSY_bit = 1 << 18, - GRBM_STATUS__TC_BUSY_bit = 1 << 19, - SX_BUSY_bit = 1 << 20, - SH_BUSY_bit = 1 << 21, - SPI03_BUSY_bit = 1 << 22, - SMX_BUSY_bit = 1 << 23, - SC_BUSY_bit = 1 << 24, - PA_BUSY_bit = 1 << 25, - DB03_BUSY_bit = 1 << 26, - CR_BUSY_bit = 1 << 27, - CP_COHERENCY_BUSY_bit = 1 << 28, - GRBM_STATUS__CP_BUSY_bit = 1 << 29, - CB03_BUSY_bit = 1 << 30, - GUI_ACTIVE_bit = 1 << 31, - GRBM_STATUS2 = 0x8014, - CR_CLEAN_bit = 1 << 0, - SMX_CLEAN_bit = 1 << 1, - SPI0_BUSY_bit = 1 << 8, - SPI1_BUSY_bit = 1 << 9, - SPI2_BUSY_bit = 1 << 10, - SPI3_BUSY_bit = 1 << 11, - TA0_BUSY_bit = 1 << 12, - TA1_BUSY_bit = 1 << 13, - TA2_BUSY_bit = 1 << 14, - TA3_BUSY_bit = 1 << 15, - DB0_BUSY_bit = 1 << 16, - DB1_BUSY_bit = 1 << 17, - DB2_BUSY_bit = 1 << 18, - DB3_BUSY_bit = 1 << 19, - CB0_BUSY_bit = 1 << 20, - CB1_BUSY_bit = 1 << 21, - CB2_BUSY_bit = 1 << 22, - CB3_BUSY_bit = 1 << 23, - GRBM_SOFT_RESET = 0x8020, - SOFT_RESET_CP_bit = 1 << 0, - SOFT_RESET_CB_bit = 1 << 1, - SOFT_RESET_CR_bit = 1 << 2, - SOFT_RESET_DB_bit = 1 << 3, - SOFT_RESET_PA_bit = 1 << 5, - SOFT_RESET_SC_bit = 1 << 6, - SOFT_RESET_SMX_bit = 1 << 7, - SOFT_RESET_SPI_bit = 1 << 8, - SOFT_RESET_SH_bit = 1 << 9, - SOFT_RESET_SX_bit = 1 << 10, - SOFT_RESET_TC_bit = 1 << 11, - SOFT_RESET_TA_bit = 1 << 12, - SOFT_RESET_VC_bit = 1 << 13, - SOFT_RESET_VGT_bit = 1 << 14, - SOFT_RESET_GRBM_GCA_bit = 1 << 15, - - WAIT_UNTIL = 0x8040, - WAIT_CP_DMA_IDLE_bit = 1 << 8, - WAIT_CMDFIFO_bit = 1 << 10, - WAIT_2D_IDLE_bit = 1 << 14, - WAIT_3D_IDLE_bit = 1 << 15, - WAIT_2D_IDLECLEAN_bit = 1 << 16, - WAIT_3D_IDLECLEAN_bit = 1 << 17, - WAIT_EXTERN_SIG_bit = 1 << 19, - CMDFIFO_ENTRIES_mask = 0x1f << 20, - CMDFIFO_ENTRIES_shift = 20, - - GRBM_READ_ERROR = 0x8058, -/* READ_ADDRESS_mask = 0xffff << 2, */ -/* READ_ADDRESS_shift = 2, */ - READ_REQUESTER_SRBM_bit = 1 << 28, - READ_REQUESTER_CP_bit = 1 << 29, - READ_REQUESTER_WU_POLL_bit = 1 << 30, -/* READ_ERROR_bit = 1 << 31, */ - - SCRATCH_REG0 = 0x8500, - SCRATCH_REG1 = 0x8504, - SCRATCH_REG2 = 0x8508, - SCRATCH_REG3 = 0x850c, - SCRATCH_REG4 = 0x8510, - SCRATCH_REG5 = 0x8514, - SCRATCH_REG6 = 0x8518, - SCRATCH_REG7 = 0x851c, - SCRATCH_UMSK = 0x8540, - SCRATCH_ADDR = 0x8544, - - CP_COHER_CNTL = 0x85f0, - DEST_BASE_0_ENA_bit = 1 << 0, - DEST_BASE_1_ENA_bit = 1 << 1, - SO0_DEST_BASE_ENA_bit = 1 << 2, - SO1_DEST_BASE_ENA_bit = 1 << 3, - SO2_DEST_BASE_ENA_bit = 1 << 4, - SO3_DEST_BASE_ENA_bit = 1 << 5, - CB0_DEST_BASE_ENA_bit = 1 << 6, - CB1_DEST_BASE_ENA_bit = 1 << 7, - CB2_DEST_BASE_ENA_bit = 1 << 8, - CB3_DEST_BASE_ENA_bit = 1 << 9, - CB4_DEST_BASE_ENA_bit = 1 << 10, - CB5_DEST_BASE_ENA_bit = 1 << 11, - CB6_DEST_BASE_ENA_bit = 1 << 12, - CB7_DEST_BASE_ENA_bit = 1 << 13, - DB_DEST_BASE_ENA_bit = 1 << 14, - CR_DEST_BASE_ENA_bit = 1 << 15, - TC_ACTION_ENA_bit = 1 << 23, - VC_ACTION_ENA_bit = 1 << 24, - CB_ACTION_ENA_bit = 1 << 25, - DB_ACTION_ENA_bit = 1 << 26, - SH_ACTION_ENA_bit = 1 << 27, - SMX_ACTION_ENA_bit = 1 << 28, - CR0_ACTION_ENA_bit = 1 << 29, - CR1_ACTION_ENA_bit = 1 << 30, - CR2_ACTION_ENA_bit = 1 << 31, - CP_COHER_SIZE = 0x85f4, - CP_COHER_BASE = 0x85f8, - CP_COHER_STATUS = 0x85fc, - MATCHING_GFX_CNTX_mask = 0xff << 0, - MATCHING_GFX_CNTX_shift = 0, - MATCHING_CR_CNTX_mask = 0xffff << 8, - MATCHING_CR_CNTX_shift = 8, - STATUS_bit = 1 << 31, - - CP_STALLED_STAT1 = 0x8674, - RBIU_TO_DMA_NOT_RDY_TO_RCV_bit = 1 << 0, - RBIU_TO_IBS_NOT_RDY_TO_RCV_bit = 1 << 1, - RBIU_TO_SEM_NOT_RDY_TO_RCV_bit = 1 << 2, - RBIU_TO_2DREGS_NOT_RDY_TO_RCV_bit = 1 << 3, - RBIU_TO_MEMWR_NOT_RDY_TO_RCV_bit = 1 << 4, - RBIU_TO_MEMRD_NOT_RDY_TO_RCV_bit = 1 << 5, - RBIU_TO_EOPD_NOT_RDY_TO_RCV_bit = 1 << 6, - RBIU_TO_RECT_NOT_RDY_TO_RCV_bit = 1 << 7, - RBIU_TO_STRMO_NOT_RDY_TO_RCV_bit = 1 << 8, - RBIU_TO_PSTAT_NOT_RDY_TO_RCV_bit = 1 << 9, - MIU_WAITING_ON_RDREQ_FREE_bit = 1 << 16, - MIU_WAITING_ON_WRREQ_FREE_bit = 1 << 17, - MIU_NEEDS_AVAIL_WRREQ_PHASE_bit = 1 << 18, - RCIU_WAITING_ON_GRBM_FREE_bit = 1 << 24, - RCIU_WAITING_ON_VGT_FREE_bit = 1 << 25, - RCIU_STALLED_ON_ME_READ_bit = 1 << 26, - RCIU_STALLED_ON_DMA_READ_bit = 1 << 27, - RCIU_HALTED_BY_REG_VIOLATION_bit = 1 << 28, - CP_STALLED_STAT2 = 0x8678, - PFP_TO_CSF_NOT_RDY_TO_RCV_bit = 1 << 0, - PFP_TO_MEQ_NOT_RDY_TO_RCV_bit = 1 << 1, - PFP_TO_VGT_NOT_RDY_TO_RCV_bit = 1 << 2, - PFP_HALTED_BY_INSTR_VIOLATION_bit = 1 << 3, - MULTIPASS_IB_PENDING_IN_PFP_bit = 1 << 4, - ME_BRUSH_WC_NOT_RDY_TO_RCV_bit = 1 << 8, - ME_STALLED_ON_BRUSH_LOGIC_bit = 1 << 9, - CR_CNTX_NOT_AVAIL_TO_ME_bit = 1 << 10, - GFX_CNTX_NOT_AVAIL_TO_ME_bit = 1 << 11, - ME_RCIU_NOT_RDY_TO_RCV_bit = 1 << 12, - ME_TO_CONST_NOT_RDY_TO_RCV_bit = 1 << 13, - ME_WAITING_DATA_FROM_PFP_bit = 1 << 14, - ME_WAITING_ON_PARTIAL_FLUSH_bit = 1 << 15, - RECT_FIFO_NEEDS_CR_RECT_DONE_bit = 1 << 16, - RECT_FIFO_NEEDS_WR_CONFIRM_bit = 1 << 17, - EOPD_FIFO_NEEDS_SC_EOP_DONE_bit = 1 << 18, - EOPD_FIFO_NEEDS_SMX_EOP_DONE_bit = 1 << 19, - EOPD_FIFO_NEEDS_WR_CONFIRM_bit = 1 << 20, - EOPD_FIFO_NEEDS_SIGNAL_SEM_bit = 1 << 21, - SO_NUMPRIM_FIFO_NEEDS_SOADDR_bit = 1 << 22, - SO_NUMPRIM_FIFO_NEEDS_NUMPRIM_bit = 1 << 23, - PIPE_STATS_FIFO_NEEDS_SAMPLE_bit = 1 << 24, - SURF_SYNC_NEEDS_IDLE_CNTXS_bit = 1 << 30, - SURF_SYNC_NEEDS_ALL_CLEAN_bit = 1 << 31, - CP_BUSY_STAT = 0x867c, - REG_BUS_FIFO_BUSY_bit = 1 << 0, - RING_FETCHING_DATA_bit = 1 << 1, - INDR1_FETCHING_DATA_bit = 1 << 2, - INDR2_FETCHING_DATA_bit = 1 << 3, - STATE_FETCHING_DATA_bit = 1 << 4, - PRED_FETCHING_DATA_bit = 1 << 5, - COHER_CNTR_NEQ_ZERO_bit = 1 << 6, - PFP_PARSING_PACKETS_bit = 1 << 7, - ME_PARSING_PACKETS_bit = 1 << 8, - RCIU_PFP_BUSY_bit = 1 << 9, - RCIU_ME_BUSY_bit = 1 << 10, - OUTSTANDING_READ_TAGS_bit = 1 << 11, - SEM_CMDFIFO_NOT_EMPTY_bit = 1 << 12, - SEM_FAILED_AND_HOLDING_bit = 1 << 13, - SEM_POLLING_FOR_PASS_bit = 1 << 14, - _3D_BUSY_bit = 1 << 15, - _2D_BUSY_bit = 1 << 16, - CP_STAT = 0x8680, - CSF_RING_BUSY_bit = 1 << 0, - CSF_WPTR_POLL_BUSY_bit = 1 << 1, - CSF_INDIRECT1_BUSY_bit = 1 << 2, - CSF_INDIRECT2_BUSY_bit = 1 << 3, - CSF_STATE_BUSY_bit = 1 << 4, - CSF_PREDICATE_BUSY_bit = 1 << 5, - CSF_BUSY_bit = 1 << 6, - MIU_RDREQ_BUSY_bit = 1 << 7, - MIU_WRREQ_BUSY_bit = 1 << 8, - ROQ_RING_BUSY_bit = 1 << 9, - ROQ_INDIRECT1_BUSY_bit = 1 << 10, - ROQ_INDIRECT2_BUSY_bit = 1 << 11, - ROQ_STATE_BUSY_bit = 1 << 12, - ROQ_PREDICATE_BUSY_bit = 1 << 13, - ROQ_ALIGN_BUSY_bit = 1 << 14, - PFP_BUSY_bit = 1 << 15, - MEQ_BUSY_bit = 1 << 16, - ME_BUSY_bit = 1 << 17, - QUERY_BUSY_bit = 1 << 18, - SEMAPHORE_BUSY_bit = 1 << 19, - INTERRUPT_BUSY_bit = 1 << 20, - SURFACE_SYNC_BUSY_bit = 1 << 21, - DMA_BUSY_bit = 1 << 22, - RCIU_BUSY_bit = 1 << 23, - CP_STAT__CP_BUSY_bit = 1 << 31, - - CP_ME_CNTL = 0x86d8, - ME_STATMUX_mask = 0xff << 0, - ME_STATMUX_shift = 0, - ME_HALT_bit = 1 << 28, - CP_ME_STATUS = 0x86dc, - - CP_RB_RPTR = 0x8700, - RB_RPTR_mask = 0xfffff << 0, - RB_RPTR_shift = 0, - CP_RB_WPTR_DELAY = 0x8704, - PRE_WRITE_TIMER_mask = 0xfffffff << 0, - PRE_WRITE_TIMER_shift = 0, - PRE_WRITE_LIMIT_mask = 0x0f << 28, - PRE_WRITE_LIMIT_shift = 28, - - CP_ROQ_RB_STAT = 0x8780, - ROQ_RPTR_PRIMARY_mask = 0x3ff << 0, - ROQ_RPTR_PRIMARY_shift = 0, - ROQ_WPTR_PRIMARY_mask = 0x3ff << 16, - ROQ_WPTR_PRIMARY_shift = 16, - CP_ROQ_IB1_STAT = 0x8784, - ROQ_RPTR_INDIRECT1_mask = 0x3ff << 0, - ROQ_RPTR_INDIRECT1_shift = 0, - ROQ_WPTR_INDIRECT1_mask = 0x3ff << 16, - ROQ_WPTR_INDIRECT1_shift = 16, - CP_ROQ_IB2_STAT = 0x8788, - ROQ_RPTR_INDIRECT2_mask = 0x3ff << 0, - ROQ_RPTR_INDIRECT2_shift = 0, - ROQ_WPTR_INDIRECT2_mask = 0x3ff << 16, - ROQ_WPTR_INDIRECT2_shift = 16, - - CP_MEQ_STAT = 0x8794, - MEQ_RPTR_mask = 0x3ff << 0, - MEQ_RPTR_shift = 0, - MEQ_WPTR_mask = 0x3ff << 16, - MEQ_WPTR_shift = 16, - - CC_GC_SHADER_PIPE_CONFIG = 0x8950, - INACTIVE_QD_PIPES_mask = 0xff << 8, - INACTIVE_QD_PIPES_shift = 8, - R6XX_MAX_QD_PIPES = 8, - INACTIVE_SIMDS_mask = 0xff << 16, - INACTIVE_SIMDS_shift = 16, - R6XX_MAX_SIMDS = 8, - GC_USER_SHADER_PIPE_CONFIG = 0x8954, - - VC_ENHANCE = 0x9714, - DB_DEBUG = 0x9830, - PREZ_MUST_WAIT_FOR_POSTZ_DONE = 1 << 31, - - DB_WATERMARKS = 0x00009838, - DEPTH_FREE_mask = 0x1f << 0, - DEPTH_FREE_shift = 0, - DEPTH_FLUSH_mask = 0x3f << 5, - DEPTH_FLUSH_shift = 5, - FORCE_SUMMARIZE_mask = 0x0f << 11, - FORCE_SUMMARIZE_shift = 11, - DEPTH_PENDING_FREE_mask = 0x1f << 15, - DEPTH_PENDING_FREE_shift = 15, - DEPTH_CACHELINE_FREE_mask = 0x1f << 20, - DEPTH_CACHELINE_FREE_shift = 20, - EARLY_Z_PANIC_DISABLE_bit = 1 << 25, - LATE_Z_PANIC_DISABLE_bit = 1 << 26, - RE_Z_PANIC_DISABLE_bit = 1 << 27, - DB_EXTRA_DEBUG_mask = 0x0f << 28, - DB_EXTRA_DEBUG_shift = 28, - - CP_RB_BASE = 0xc100, - CP_RB_CNTL = 0xc104, - RB_BUFSZ_mask = 0x3f << 0, - CP_RB_WPTR = 0xc114, - RB_WPTR_mask = 0xfffff << 0, - RB_WPTR_shift = 0, - CP_RB_RPTR_WR = 0xc108, - RB_RPTR_WR_mask = 0xfffff << 0, - RB_RPTR_WR_shift = 0, - - CP_INT_STATUS = 0xc128, - DISABLE_CNTX_SWITCH_INT_STAT_bit = 1 << 0, - ENABLE_CNTX_SWITCH_INT_STAT_bit = 1 << 1, - SEM_SIGNAL_INT_STAT_bit = 1 << 18, - CNTX_BUSY_INT_STAT_bit = 1 << 19, - CNTX_EMPTY_INT_STAT_bit = 1 << 20, - WAITMEM_SEM_INT_STAT_bit = 1 << 21, - PRIV_INSTR_INT_STAT_bit = 1 << 22, - PRIV_REG_INT_STAT_bit = 1 << 23, - OPCODE_ERROR_INT_STAT_bit = 1 << 24, - SCRATCH_INT_STAT_bit = 1 << 25, - TIME_STAMP_INT_STAT_bit = 1 << 26, - RESERVED_BIT_ERROR_INT_STAT_bit = 1 << 27, - DMA_INT_STAT_bit = 1 << 28, - IB2_INT_STAT_bit = 1 << 29, - IB1_INT_STAT_bit = 1 << 30, - RB_INT_STAT_bit = 1 << 31, - -// SX_ALPHA_TEST_CONTROL = 0x00028410, - ALPHA_FUNC__REF_NEVER = 0, - ALPHA_FUNC__REF_ALWAYS = 7, -// DB_SHADER_CONTROL = 0x0002880c, - Z_ORDER__EARLY_Z_THEN_LATE_Z = 2, -// PA_SU_SC_MODE_CNTL = 0x00028814, -// POLY_MODE_mask = 0x03 << 3, - POLY_MODE__TRIANGLES = 0, POLY_MODE__DUAL_MODE, -// POLYMODE_FRONT_PTYPE_mask = 0x07 << 5, - POLYMODE_PTYPE__POINTS = 0, POLYMODE_PTYPE__LINES, POLYMODE_PTYPE__TRIANGLES, - PA_SC_AA_SAMPLE_LOCS_8S_WD1_M = 0x00028c20, - DB_SRESULTS_COMPARE_STATE0 = 0x00028d28, /* See autoregs: DB_SRESULTS_COMPARE_STATE1 */ -// DB_SRESULTS_COMPARE_STATE1 = 0x00028d2c, - DB_ALPHA_TO_MASK = 0x00028d44, - ALPHA_TO_MASK_ENABLE = 1 << 0, - ALPHA_TO_MASK_OFFSET0_mask = 0x03 << 8, - ALPHA_TO_MASK_OFFSET0_shift = 8, - ALPHA_TO_MASK_OFFSET1_mask = 0x03 << 10, - ALPHA_TO_MASK_OFFSET1_shift = 10, - ALPHA_TO_MASK_OFFSET2_mask = 0x03 << 12, - ALPHA_TO_MASK_OFFSET2_shift = 12, - ALPHA_TO_MASK_OFFSET3_mask = 0x03 << 14, - ALPHA_TO_MASK_OFFSET3_shift = 14, - -// SQ_VTX_CONSTANT_WORD2_0 = 0x00038008, -// SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask = 0x3f << 20, - FMT_INVALID=0, FMT_8, FMT_4_4, FMT_3_3_2, - FMT_16=5, FMT_16_FLOAT, FMT_8_8, - FMT_5_6_5, FMT_6_5_5, FMT_1_5_5_5, FMT_4_4_4_4, - FMT_5_5_5_1, FMT_32, FMT_32_FLOAT, FMT_16_16, - FMT_16_16_FLOAT=16, FMT_8_24, FMT_8_24_FLOAT, FMT_24_8, - FMT_24_8_FLOAT, FMT_10_11_11, FMT_10_11_11_FLOAT, FMT_11_11_10, - FMT_11_11_10_FLOAT, FMT_2_10_10_10, FMT_8_8_8_8, FMT_10_10_10_2, - FMT_X24_8_32_FLOAT, FMT_32_32, FMT_32_32_FLOAT, FMT_16_16_16_16, - FMT_16_16_16_16_FLOAT=32, FMT_32_32_32_32=34, FMT_32_32_32_32_FLOAT, - FMT_1 = 37, FMT_GB_GR=39, - FMT_BG_RG, FMT_32_AS_8, FMT_32_AS_8_8, FMT_5_9_9_9_SHAREDEXP, - FMT_8_8_8, FMT_16_16_16, FMT_16_16_16_FLOAT, FMT_32_32_32, - FMT_32_32_32_FLOAT=48, - -// High level register file lengths - SQ_ALU_CONSTANT = SQ_ALU_CONSTANT0_0, /* 256 PS, 256 VS */ - SQ_ALU_CONSTANT_ps_num = 256, - SQ_ALU_CONSTANT_vs_num = 256, - SQ_ALU_CONSTANT_all_num = 512, - SQ_ALU_CONSTANT_offset = 16, - SQ_ALU_CONSTANT_ps = 0, - SQ_ALU_CONSTANT_vs = SQ_ALU_CONSTANT_ps + SQ_ALU_CONSTANT_ps_num, - SQ_TEX_RESOURCE = SQ_TEX_RESOURCE_WORD0_0, /* 160 PS, 160 VS, 16 FS, 160 GS */ - SQ_TEX_RESOURCE_ps_num = 160, - SQ_TEX_RESOURCE_vs_num = 160, - SQ_TEX_RESOURCE_fs_num = 16, - SQ_TEX_RESOURCE_gs_num = 160, - SQ_TEX_RESOURCE_all_num = 496, - SQ_TEX_RESOURCE_offset = 28, - SQ_TEX_RESOURCE_ps = 0, - SQ_TEX_RESOURCE_vs = SQ_TEX_RESOURCE_ps + SQ_TEX_RESOURCE_ps_num, - SQ_TEX_RESOURCE_fs = SQ_TEX_RESOURCE_vs + SQ_TEX_RESOURCE_vs_num, - SQ_TEX_RESOURCE_gs = SQ_TEX_RESOURCE_fs + SQ_TEX_RESOURCE_fs_num, - SQ_VTX_RESOURCE = SQ_VTX_CONSTANT_WORD0_0, /* 160 PS, 160 VS, 16 FS, 160 GS */ - SQ_VTX_RESOURCE_ps_num = 160, - SQ_VTX_RESOURCE_vs_num = 160, - SQ_VTX_RESOURCE_fs_num = 16, - SQ_VTX_RESOURCE_gs_num = 160, - SQ_VTX_RESOURCE_all_num = 496, - SQ_VTX_RESOURCE_offset = 28, - SQ_VTX_RESOURCE_ps = 0, - SQ_VTX_RESOURCE_vs = SQ_VTX_RESOURCE_ps + SQ_VTX_RESOURCE_ps_num, - SQ_VTX_RESOURCE_fs = SQ_VTX_RESOURCE_vs + SQ_VTX_RESOURCE_vs_num, - SQ_VTX_RESOURCE_gs = SQ_VTX_RESOURCE_fs + SQ_VTX_RESOURCE_fs_num, - SQ_TEX_SAMPLER_WORD = SQ_TEX_SAMPLER_WORD0_0, /* 18 per PS, VS, GS */ - SQ_TEX_SAMPLER_WORD_ps_num = 18, - SQ_TEX_SAMPLER_WORD_vs_num = 18, - SQ_TEX_SAMPLER_WORD_gs_num = 18, - SQ_TEX_SAMPLER_WORD_all_num = 54, - SQ_TEX_SAMPLER_WORD_offset = 12, - SQ_TEX_SAMPLER_WORD_ps = 0, - SQ_TEX_SAMPLER_WORD_vs = SQ_TEX_SAMPLER_WORD_ps + SQ_TEX_SAMPLER_WORD_ps_num, - SQ_TEX_SAMPLER_WORD_gs = SQ_TEX_SAMPLER_WORD_vs + SQ_TEX_SAMPLER_WORD_vs_num, - SQ_LOOP_CONST = SQ_LOOP_CONST_0, /* 32 per PS, VS, GS */ - SQ_LOOP_CONST_ps_num = 32, - SQ_LOOP_CONST_vs_num = 32, - SQ_LOOP_CONST_gs_num = 32, - SQ_LOOP_CONST_all_num = 96, - SQ_LOOP_CONST_offset = 4, - SQ_LOOP_CONST_ps = 0, - SQ_LOOP_CONST_vs = SQ_LOOP_CONST_ps + SQ_LOOP_CONST_ps_num, - SQ_LOOP_CONST_gs = SQ_LOOP_CONST_vs + SQ_LOOP_CONST_vs_num, -} ; - - -#endif diff --git a/src/mesa/drivers/dri/r600/r600_reg_r7xx.h b/src/mesa/drivers/dri/r600/r600_reg_r7xx.h deleted file mode 100644 index eb169bd885d..00000000000 --- a/src/mesa/drivers/dri/r600/r600_reg_r7xx.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * RadeonHD R6xx, R7xx Register documentation - * - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * Copyright (C) 2008-2009 Matthias Hopf - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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 _R600_REG_R7xx_H_ -#define _R600_REG_R7xx_H_ - -/* - * Register update for R7xx chips - */ - -enum { - - R7XX_MC_VM_FB_LOCATION = 0x00002024, - -// GRBM_STATUS = 0x00008010, - R7XX_TA_BUSY_bit = 1 << 14, - - R7xx_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ = 0x00008d8c, - RING0_OFFSET_mask = 0xff << 0, - RING0_OFFSET_shift = 0, - ISOLATE_ES_ENABLE_bit = 1 << 12, - ISOLATE_GS_ENABLE_bit = 1 << 13, - VS_PC_LIMIT_ENABLE_bit = 1 << 14, - -// SQ_ALU_WORD0 = 0x00008dfc, -// SRC0_SEL_mask = 0x1ff << 0, -// SRC1_SEL_mask = 0x1ff << 13, - R7xx_SQ_ALU_SRC_1_DBL_L = 0xf4, - R7xx_SQ_ALU_SRC_1_DBL_M = 0xf5, - R7xx_SQ_ALU_SRC_0_5_DBL_L = 0xf6, - R7xx_SQ_ALU_SRC_0_5_DBL_M = 0xf7, -// INDEX_MODE_mask = 0x07 << 26, - R7xx_SQ_INDEX_GLOBAL = 0x05, - R7xx_SQ_INDEX_GLOBAL_AR_X = 0x06, - R6xx_SQ_ALU_WORD1_OP2 = 0x00008dfc, - R7xx_SQ_ALU_WORD1_OP2_V2 = 0x00008dfc, - R6xx_FOG_MERGE_bit = 1 << 5, - R6xx_OMOD_mask = 0x03 << 6, - R7xx_OMOD_mask = 0x03 << 5, - R6xx_OMOD_shift = 6, - R7xx_OMOD_shift = 5, - R6xx_SQ_ALU_WORD1_OP2__ALU_INST_mask = 0x3ff << 8, - R7xx_SQ_ALU_WORD1_OP2_V2__ALU_INST_mask = 0x7ff << 7, - R6xx_SQ_ALU_WORD1_OP2__ALU_INST_shift = 8, - R7xx_SQ_ALU_WORD1_OP2_V2__ALU_INST_shift = 7, - R7xx_SQ_OP2_INST_FREXP_64 = 0x07, - R7xx_SQ_OP2_INST_ADD_64 = 0x17, - R7xx_SQ_OP2_INST_MUL_64 = 0x1b, - R7xx_SQ_OP2_INST_FLT64_TO_FLT32 = 0x1c, - R7xx_SQ_OP2_INST_FLT32_TO_FLT64 = 0x1d, - R7xx_SQ_OP2_INST_LDEXP_64 = 0x7a, - R7xx_SQ_OP2_INST_FRACT_64 = 0x7b, - R7xx_SQ_OP2_INST_PRED_SETGT_64 = 0x7c, - R7xx_SQ_OP2_INST_PRED_SETE_64 = 0x7d, - R7xx_SQ_OP2_INST_PRED_SETGE_64 = 0x7e, -// SQ_ALU_WORD1_OP3 = 0x00008dfc, -// SRC2_SEL_mask = 0x1ff << 0, -// R7xx_SQ_ALU_SRC_1_DBL_L = 0xf4, -// R7xx_SQ_ALU_SRC_1_DBL_M = 0xf5, -// R7xx_SQ_ALU_SRC_0_5_DBL_L = 0xf6, -// R7xx_SQ_ALU_SRC_0_5_DBL_M = 0xf7, -// SQ_ALU_WORD1_OP3__ALU_INST_mask = 0x1f << 13, - R7xx_SQ_OP3_INST_MULADD_64 = 0x08, - R7xx_SQ_OP3_INST_MULADD_64_M2 = 0x09, - R7xx_SQ_OP3_INST_MULADD_64_M4 = 0x0a, - R7xx_SQ_OP3_INST_MULADD_64_D2 = 0x0b, -// SQ_CF_ALU_WORD1 = 0x00008dfc, - R6xx_USES_WATERFALL_bit = 1 << 25, - R7xx_SQ_CF_ALU_WORD1__ALT_CONST_bit = 1 << 25, -// SQ_CF_ALLOC_EXPORT_WORD0 = 0x00008dfc, -// ARRAY_BASE_mask = 0x1fff << 0, -// TYPE_mask = 0x03 << 13, -// SQ_EXPORT_PARAM = 0x02, -// X_UNUSED_FOR_SX_EXPORTS = 0x03, -// ELEM_SIZE_mask = 0x03 << 30, -// SQ_CF_ALLOC_EXPORT_WORD1 = 0x00008dfc, -// SQ_CF_ALLOC_EXPORT_WORD1__CF_INST_mask = 0x7f << 23, - R7xx_SQ_CF_INST_MEM_EXPORT = 0x3a, -// SQ_CF_WORD1 = 0x00008dfc, -// SQ_CF_WORD1__COUNT_mask = 0x07 << 10, - R7xx_COUNT_3_bit = 1 << 19, -// SQ_CF_WORD1__CF_INST_mask = 0x7f << 23, - R7xx_SQ_CF_INST_END_PROGRAM = 0x19, - R7xx_SQ_CF_INST_WAIT_ACK = 0x1a, - R7xx_SQ_CF_INST_TEX_ACK = 0x1b, - R7xx_SQ_CF_INST_VTX_ACK = 0x1c, - R7xx_SQ_CF_INST_VTX_TC_ACK = 0x1d, -// SQ_VTX_WORD0 = 0x00008dfc, -// VTX_INST_mask = 0x1f << 0, - R7xx_SQ_VTX_INST_MEM = 0x02, -// SQ_VTX_WORD2 = 0x00008dfc, - R7xx_SQ_VTX_WORD2__ALT_CONST_bit = 1 << 20, - -// SQ_TEX_WORD0 = 0x00008dfc, -// TEX_INST_mask = 0x1f << 0, - R7xx_X_MEMORY_READ = 0x02, - R7xx_SQ_TEX_INST_KEEP_GRADIENTS = 0x0a, - R7xx_X_FETCH4_LOAD4_INSTRUCTION_FOR_DX10_1 = 0x0f, - R7xx_SQ_TEX_WORD0__ALT_CONST_bit = 1 << 24, - - R7xx_PA_SC_EDGERULE = 0x00028230, - R7xx_SPI_THREAD_GROUPING = 0x000286c8, - PS_GROUPING_mask = 0x1f << 0, - PS_GROUPING_shift = 0, - VS_GROUPING_mask = 0x1f << 8, - VS_GROUPING_shift = 8, - GS_GROUPING_mask = 0x1f << 16, - GS_GROUPING_shift = 16, - ES_GROUPING_mask = 0x1f << 24, - ES_GROUPING_shift = 24, - R7xx_CB_SHADER_CONTROL = 0x000287a0, - RT0_ENABLE_bit = 1 << 0, - RT1_ENABLE_bit = 1 << 1, - RT2_ENABLE_bit = 1 << 2, - RT3_ENABLE_bit = 1 << 3, - RT4_ENABLE_bit = 1 << 4, - RT5_ENABLE_bit = 1 << 5, - RT6_ENABLE_bit = 1 << 6, - RT7_ENABLE_bit = 1 << 7, -// DB_ALPHA_TO_MASK = 0x00028d44, - R7xx_OFFSET_ROUND_bit = 1 << 16, -// SQ_TEX_SAMPLER_MISC_0 = 0x0003d03c, - R7xx_TRUNCATE_COORD_bit = 1 << 9, - R7xx_DISABLE_CUBE_WRAP_bit = 1 << 10, -// DB_RENDER_CONTROL = 0x00028d0c, - PERFECT_ZPASS_COUNTS_bit = 1 << 15, - -} ; - -#endif /* _R600_REG_R7xx_H_ */ diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c deleted file mode 100644 index 0bb4e133c68..00000000000 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ /dev/null @@ -1,455 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Keith Whitwell <[email protected]> - */ - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/colormac.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/image.h" -#include "main/mfeatures.h" -#include "main/mipmap.h" -#include "main/simple_list.h" -#include "main/texobj.h" - -#include "texmem.h" - -#include "r600_context.h" -#include "radeon_mipmap_tree.h" -#include "r600_tex.h" - - -static unsigned int translate_wrap_mode(GLenum wrapmode) -{ - switch(wrapmode) { - case GL_REPEAT: return SQ_TEX_WRAP; - case GL_CLAMP: return SQ_TEX_CLAMP_HALF_BORDER; - case GL_CLAMP_TO_EDGE: return SQ_TEX_CLAMP_LAST_TEXEL; - case GL_CLAMP_TO_BORDER: return SQ_TEX_CLAMP_BORDER; - case GL_MIRRORED_REPEAT: return SQ_TEX_MIRROR; - case GL_MIRROR_CLAMP_EXT: return SQ_TEX_MIRROR_ONCE_HALF_BORDER; - case GL_MIRROR_CLAMP_TO_EDGE_EXT: return SQ_TEX_MIRROR_ONCE_LAST_TEXEL; - case GL_MIRROR_CLAMP_TO_BORDER_EXT: return SQ_TEX_MIRROR_ONCE_BORDER; - default: - radeon_error("bad wrap mode in %s", __FUNCTION__); - return 0; - } -} - - -/** - * Update the cached hardware registers based on the current texture wrap modes. - * - * \param t Texture object whose wrap modes are to be set - */ -static void r600UpdateTexWrap(radeonTexObjPtr t) -{ - struct gl_texture_object *tObj = &t->base; - - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapS), - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - - if (tObj->Target != GL_TEXTURE_1D) { - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapT), - CLAMP_Y_shift, CLAMP_Y_mask); - - if (tObj->Target == GL_TEXTURE_3D) - SETfield(t->SQ_TEX_SAMPLER0, translate_wrap_mode(tObj->Sampler.WrapR), - CLAMP_Z_shift, CLAMP_Z_mask); - } -} - -static void r600SetTexDefaultState(radeonTexObjPtr t) -{ - /* Init text object to default states. */ - t->SQ_TEX_RESOURCE0 = 0; - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, DIM_shift, DIM_mask); - SETfield(t->SQ_TEX_RESOURCE0, ARRAY_LINEAR_GENERAL, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - CLEARbit(t->SQ_TEX_RESOURCE0, TILE_TYPE_bit); - - t->SQ_TEX_RESOURCE1 = 0; - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - t->SQ_TEX_RESOURCE2 = 0; - t->SQ_TEX_RESOURCE3 = 0; - - t->SQ_TEX_RESOURCE4 = 0; - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_NUM_FORMAT_NORM, - SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_shift, SQ_TEX_RESOURCE_WORD4_0__NUM_FORMAT_ALL_mask); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__SRF_MODE_ALL_bit); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - SETfield(t->SQ_TEX_RESOURCE4, SQ_ENDIAN_NONE, - SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_shift, SQ_TEX_RESOURCE_WORD4_0__ENDIAN_SWAP_mask); - SETfield(t->SQ_TEX_RESOURCE4, 1, REQUEST_SIZE_shift, REQUEST_SIZE_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); /* mip-maps */ - - t->SQ_TEX_RESOURCE5 = 0; - t->SQ_TEX_RESOURCE6 = 0; - - SETfield(t->SQ_TEX_RESOURCE6, SQ_TEX_VTX_VALID_TEXTURE, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - /* Initialize sampler registers */ - t->SQ_TEX_SAMPLER0 = 0; - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_shift, - SQ_TEX_SAMPLER_WORD0_0__CLAMP_X_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, CLAMP_Y_shift, CLAMP_Y_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_WRAP, CLAMP_Z_shift, CLAMP_Z_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, XY_MAG_FILTER_shift, XY_MAG_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_XY_FILTER_POINT, XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, Z_FILTER_shift, Z_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_Z_FILTER_NONE, MIP_FILTER_shift, MIP_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_TRANS_BLACK, BORDER_COLOR_TYPE_shift, BORDER_COLOR_TYPE_mask); - - t->SQ_TEX_SAMPLER1 = 0; - SETfield(t->SQ_TEX_SAMPLER1, 0x3ff, MAX_LOD_shift, MAX_LOD_mask); - - t->SQ_TEX_SAMPLER2 = 0; - SETbit(t->SQ_TEX_SAMPLER2, SQ_TEX_SAMPLER_WORD2_0__TYPE_bit); -} - - -#if 0 -static GLuint aniso_filter(GLfloat anisotropy) -{ - if (anisotropy >= 16.0) { - return R300_TX_MAX_ANISO_16_TO_1; - } else if (anisotropy >= 8.0) { - return R300_TX_MAX_ANISO_8_TO_1; - } else if (anisotropy >= 4.0) { - return R300_TX_MAX_ANISO_4_TO_1; - } else if (anisotropy >= 2.0) { - return R300_TX_MAX_ANISO_2_TO_1; - } else { - return R300_TX_MAX_ANISO_1_TO_1; - } - return 0; -} -#endif - -/** - * Set the texture magnification and minification modes. - * - * \param t Texture whose filter modes are to be set - * \param minf Texture minification mode - * \param magf Texture magnification mode - * \param anisotropy Maximum anisotropy level - */ -static void r600SetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloat anisotropy) -{ - /* Force revalidation to account for switches from/to mipmapping. */ - t->validated = GL_FALSE; - - /* Note that EXT_texture_filter_anisotropic is extremely vague about - * how anisotropic filtering interacts with the "normal" filter modes. - * When anisotropic filtering is enabled, we override min and mag - * filter settings completely. This includes driconf's settings. - */ - if (anisotropy >= 2.0 && (minf != GL_NEAREST) && (magf != GL_NEAREST)) { - /*t->pp_txfilter |= R300_TX_MAG_FILTER_ANISO - | R300_TX_MIN_FILTER_ANISO - | R300_TX_MIN_FILTER_MIP_LINEAR - | aniso_filter(anisotropy);*/ - radeon_print(RADEON_TEXTURE, RADEON_NORMAL, "Using maximum anisotropy of %f\n", anisotropy); - return; - } - - switch (minf) { - case GL_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - case GL_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_None, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - case GL_NEAREST_MIPMAP_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - case GL_NEAREST_MIPMAP_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - case GL_LINEAR_MIPMAP_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Point, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - case GL_LINEAR_MIPMAP_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - XY_MIN_FILTER_shift, XY_MIN_FILTER_mask); - SETfield(t->SQ_TEX_SAMPLER0, TEX_MipFilter_Linear, - MIP_FILTER_shift, MIP_FILTER_mask); - break; - } - - /* Note we don't have 3D mipmaps so only use the mag filter setting - * to set the 3D texture filter mode. - */ - switch (magf) { - case GL_NEAREST: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Point, - XY_MAG_FILTER_shift, XY_MAG_FILTER_mask); - break; - case GL_LINEAR: - SETfield(t->SQ_TEX_SAMPLER0, TEX_XYFilter_Linear, - XY_MAG_FILTER_shift, XY_MAG_FILTER_mask); - break; - } -} - -static void r600SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) -{ - t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3])); - t->TD_PS_SAMPLER0_BORDER_BLUE = *((uint32_t*)&(color[2])); - t->TD_PS_SAMPLER0_BORDER_GREEN = *((uint32_t*)&(color[1])); - t->TD_PS_SAMPLER0_BORDER_RED = *((uint32_t*)&(color[0])); - SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_REGISTER, - BORDER_COLOR_TYPE_shift, BORDER_COLOR_TYPE_mask); -} - -/** - * Changes variables and flags for a state update, which will happen at the - * next UpdateTextureState - */ - -static void r600TexParameter(struct gl_context * ctx, GLenum target, - struct gl_texture_object *texObj, - GLenum pname, const GLfloat * params) -{ - radeonTexObj* t = radeon_tex_obj(texObj); - GLenum baseFormat; - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_VERBOSE, - "%s( %s )\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(pname)); - - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - r600SetTexFilter(t, texObj->Sampler.MinFilter, texObj->Sampler.MagFilter, texObj->Sampler.MaxAnisotropy); - break; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_WRAP_R: - r600UpdateTexWrap(t); - break; - - case GL_TEXTURE_BORDER_COLOR: - r600SetTexBorderColor(t, texObj->Sampler.BorderColor.f); - break; - - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - t->validated = GL_FALSE; - break; - - case GL_DEPTH_TEXTURE_MODE: - if (!texObj->Image[0][texObj->BaseLevel]) - return; - baseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat; - if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH_STENCIL) { - r600SetDepthTexMode(texObj); - break; - } else { - /* If the texture isn't a depth texture, changing this - * state won't cause any changes to the hardware. - * Don't force a flush of texture state. - */ - return; - } - - default: - return; - } -} - -static void r600DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) -{ - context_t* rmesa = R700_CONTEXT(ctx); - radeonTexObj* t = radeon_tex_obj(texObj); - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, - "%s( %p (target = %s) )\n", __FUNCTION__, - (void *)texObj, - _mesa_lookup_enum_by_nr(texObj->Target)); - - if (rmesa) { - int i; - radeon_firevertices(&rmesa->radeon); - - for(i = 0; i < R700_MAX_TEXTURE_UNITS; ++i) - if (rmesa->hw.textures[i] == t) - rmesa->hw.textures[i] = 0; - } - - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - - radeon_miptree_unreference(&t->mt); - - _mesa_delete_texture_object(ctx, texObj); -} - -/** - * Allocate a new texture object. - * Called via ctx->Driver.NewTextureObject. - * Note: this function will be called during context creation to - * allocate the default texture objects. - * Fixup MaxAnisotropy according to user preference. - */ -static struct gl_texture_object *r600NewTextureObject(struct gl_context * ctx, - GLuint name, - GLenum target) -{ - context_t* rmesa = R700_CONTEXT(ctx); - radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj); - - - radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL, - "%s( %p (target = %s) )\n", __FUNCTION__, - t, _mesa_lookup_enum_by_nr(target)); - - _mesa_initialize_texture_object(&t->base, name, target); - t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy; - - /* Initialize hardware state */ - r600SetTexDefaultState(t); - r600UpdateTexWrap(t); - r600SetTexFilter(t, t->base.Sampler.MinFilter, t->base.Sampler.MagFilter, t->base.Sampler.MaxAnisotropy); - r600SetTexBorderColor(t, t->base.Sampler.BorderColor.f); - - return &t->base; -} - -unsigned r600IsFormatRenderable(gl_format mesa_format) -{ - switch (mesa_format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - case MESA_FORMAT_RGB332: - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: - case MESA_FORMAT_L8: - case MESA_FORMAT_RGBA_FLOAT32: - case MESA_FORMAT_RGBA_FLOAT16: - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z16: - case MESA_FORMAT_Z32: - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SLA8: - case MESA_FORMAT_SL8: - return 1; - default: - return 0; - } -} - -void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions) -{ - /* Note: we only plug in the functions we implement in the driver - * since _mesa_init_driver_functions() was already called. - */ - - radeon_init_common_texture_funcs(radeon, functions); - - functions->NewTextureObject = r600NewTextureObject; - functions->DeleteTexture = r600DeleteTexture; - functions->IsTextureResident = driIsTextureResident; - - functions->TexParameter = r600TexParameter; -} diff --git a/src/mesa/drivers/dri/r600/r600_tex.h b/src/mesa/drivers/dri/r600/r600_tex.h deleted file mode 100644 index 256588429e8..00000000000 --- a/src/mesa/drivers/dri/r600/r600_tex.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 __r600_TEX_H__ -#define __r600_TEX_H__ - -/* TODO : review this after texture load code. */ -#define R700_BLIT_WIDTH_BYTES 1024 -/* The BASE_ADDRESS and MIP_ADDRESS fields are 256-byte-aligned */ -#define R700_TEXTURE_ALIGNMENT_MASK 0x255 -/* Texel pitch is 8 alignment. */ -#define R700_TEXEL_PITCH_ALIGNMENT_MASK 0x7 - -#define R700_MAX_TEXTURE_UNITS 16 - -extern void r600SetDepthTexMode(struct gl_texture_object *tObj); - -extern void r600SetTexBuffer(__DRIcontext *pDRICtx, GLint target, - __DRIdrawable *dPriv); - -extern void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, - GLint format, __DRIdrawable *dPriv); - -extern void r600SetTexOffset(__DRIcontext *pDRICtx, GLint texname, - unsigned long long offset, GLint depth, - GLuint pitch); - -extern GLboolean r600ValidateBuffers(struct gl_context * ctx); - -extern void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); - -unsigned r600IsFormatRenderable(gl_format mesa_format); - -#endif /* __r600_TEX_H__ */ diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c deleted file mode 100644 index e0c5011c63c..00000000000 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ /dev/null @@ -1,1283 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -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, sublicense, 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 NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Keith Whitwell <[email protected]> - * - * \todo Enable R300 texture tiling code? - */ - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/teximage.h" -#include "main/texobj.h" -#include "main/enums.h" -#include "main/simple_list.h" - -#include "r600_context.h" -#include "radeon_mipmap_tree.h" -#include "r600_tex.h" -#include "r700_fragprog.h" -#include "r700_vertprog.h" - -#include "evergreen_tex.h" - -void r600UpdateTextureState(struct gl_context * ctx); - -void r600UpdateTextureState(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - struct gl_texture_unit *texUnit; - struct radeon_tex_obj *t; - GLuint unit; - - R600_STATECHANGE(context, tx); - R600_STATECHANGE(context, tx_smplr); - R600_STATECHANGE(context, tx_brdr_clr); - - for (unit = 0; unit < R700_MAX_TEXTURE_UNITS; unit++) { - texUnit = &ctx->Texture.Unit[unit]; - t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); - r700->textures[unit] = NULL; - if (texUnit->_ReallyEnabled) { - if (!t) - continue; - r700->textures[unit] = t; - } - } -} - -static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa_format) -{ - radeonTexObj *t = radeon_tex_obj(tObj); - - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - - CLEARbit(t->SQ_TEX_RESOURCE0, TILE_TYPE_bit); - SETfield(t->SQ_TEX_RESOURCE0, ARRAY_LINEAR_GENERAL, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - - switch (mesa_format) /* This is mesa format. */ - { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, - FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); - } - break; - case MESA_FORMAT_ARGB8888: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_XRGB8888: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_XRGB8888_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB8888_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_RGB888: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_RGB565: - SETfield(t->SQ_TEX_RESOURCE1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - - break; - case MESA_FORMAT_RGB565_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB4444: - SETfield(t->SQ_TEX_RESOURCE1, FMT_4_4_4_4, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB4444_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_4_4_4_4, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB1555: - SETfield(t->SQ_TEX_RESOURCE1, FMT_1_5_5_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_ARGB1555_REV: - SETfield(t->SQ_TEX_RESOURCE1, FMT_1_5_5_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); -#ifdef MESA_BIG_ENDIAN - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#else - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); -#endif - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: /* TODO : Check this. */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB332: - SETfield(t->SQ_TEX_RESOURCE1, FMT_3_3_2, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_L8: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_I8: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - /* YUV422 TODO conversion */ /* X, Y, Z, ONE, G8R8_G8B8 */ - /* - case MESA_FORMAT_YCBCR: - t->SQ_TEX_RESOURCE1.bitfields.DATA_FORMAT = ; - break; - */ - /* VUY422 TODO conversion */ /* X, Y, Z, ONE, G8R8_G8B8 */ - /* - case MESA_FORMAT_YCBCR_REV: - t->SQ_TEX_RESOURCE1.bitfields.DATA_FORMAT = ; - break; - */ - case MESA_FORMAT_RGB_DXT1: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT1: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT3: /* not supported yet */ - case MESA_FORMAT_RGBA_DXT5: /* not supported yet */ - return GL_FALSE; - - case MESA_FORMAT_RGBA_FLOAT32: - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGBA_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_16_16_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB_FLOAT32: /* X, Y, Z, ONE */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_RGB_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_16_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_32_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_16_FLOAT, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case MESA_FORMAT_Z16: - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: - case MESA_FORMAT_S8: - SETbit(t->SQ_TEX_RESOURCE0, TILE_TYPE_bit); - SETfield(t->SQ_TEX_RESOURCE0, ARRAY_1D_TILED_THIN1, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift, - SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask); - switch (mesa_format) { - case MESA_FORMAT_Z16: - SETfield(t->SQ_TEX_RESOURCE1, FMT_16, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_24, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_Z24_S8: - SETfield(t->SQ_TEX_RESOURCE1, FMT_24_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_Z32: - SETfield(t->SQ_TEX_RESOURCE1, FMT_32, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - break; - case MESA_FORMAT_S8: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - break; - default: - break; - }; - switch (tObj->Sampler.DepthMode) { - case GL_LUMINANCE: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case GL_INTENSITY: /* X, X, X, X */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - case GL_ALPHA: /* ZERO, ZERO, ZERO, X */ - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_0, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - break; - default: - return GL_FALSE; - } - break; - /* EXT_texture_sRGB */ - case MESA_FORMAT_SARGB8: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SLA8: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - case MESA_FORMAT_SL8: /* X, X, X, ONE */ - SETfield(t->SQ_TEX_RESOURCE1, FMT_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit); - break; - default: - /* Not supported format */ - return GL_FALSE; - }; - - return GL_TRUE; -} - -static GLuint r600_translate_shadow_func(GLenum func) -{ - switch (func) { - case GL_NEVER: - return SQ_TEX_DEPTH_COMPARE_NEVER; - case GL_LESS: - return SQ_TEX_DEPTH_COMPARE_LESS; - case GL_LEQUAL: - return SQ_TEX_DEPTH_COMPARE_LESSEQUAL; - case GL_GREATER: - return SQ_TEX_DEPTH_COMPARE_GREATER; - case GL_GEQUAL: - return SQ_TEX_DEPTH_COMPARE_GREATEREQUAL; - case GL_NOTEQUAL: - return SQ_TEX_DEPTH_COMPARE_NOTEQUAL; - case GL_EQUAL: - return SQ_TEX_DEPTH_COMPARE_EQUAL; - case GL_ALWAYS: - return SQ_TEX_DEPTH_COMPARE_ALWAYS; - default: - WARN_ONCE("Unknown shadow compare function! %d", func); - return 0; - } -} - -static INLINE uint32_t -S_FIXED(float value, uint32_t frac_bits) -{ - return value * (1 << frac_bits); -} - -void r600SetDepthTexMode(struct gl_texture_object *tObj) -{ - radeonTexObjPtr t; - - if (!tObj) - return; - - t = radeon_tex_obj(tObj); - - if(!r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat)) - t->validated = GL_FALSE; -} - -/** - * Compute the cached hardware register values for the given texture object. - * - * \param rmesa Context pointer - * \param t the r300 texture object - */ -static GLboolean setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) -{ - context_t *rmesa = R700_CONTEXT(ctx); - radeonTexObj *t = radeon_tex_obj(texObj); - const struct gl_texture_image *firstImage; - GLuint uTexelPitch, row_align; - - if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled && - t->image_override && - t->bo) - return GL_TRUE; - - firstImage = t->base.Image[0][t->minLod]; - - if (!t->image_override) { - if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { - radeon_warning("unsupported texture format in %s\n", - __FUNCTION__); - return GL_FALSE; - } - } - - switch (texObj->Target) { - case GL_TEXTURE_1D: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_1D, DIM_shift, DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, TEX_DEPTH_shift, TEX_DEPTH_mask); - break; - case GL_TEXTURE_2D: - case GL_TEXTURE_RECTANGLE_NV: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_2D, DIM_shift, DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, TEX_DEPTH_shift, TEX_DEPTH_mask); - break; - case GL_TEXTURE_3D: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_3D, DIM_shift, DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, firstImage->Depth - 1, // ??? - TEX_DEPTH_shift, TEX_DEPTH_mask); - break; - case GL_TEXTURE_CUBE_MAP: - SETfield(t->SQ_TEX_RESOURCE0, SQ_TEX_DIM_CUBEMAP, DIM_shift, DIM_mask); - SETfield(t->SQ_TEX_RESOURCE1, 0, TEX_DEPTH_shift, TEX_DEPTH_mask); - break; - default: - radeon_error("unexpected texture target type in %s\n", __FUNCTION__); - return GL_FALSE; - } - - row_align = rmesa->radeon.texture_row_align - 1; - uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align; - uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat); - uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (uTexelPitch < 8) - uTexelPitch = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (uTexelPitch/8)-1, PITCH_shift, PITCH_mask); - SETfield(t->SQ_TEX_RESOURCE0, firstImage->Width - 1, - TEX_WIDTH_shift, TEX_WIDTH_mask); - SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, - TEX_HEIGHT_shift, TEX_HEIGHT_mask); - - t->SQ_TEX_RESOURCE2 = get_base_teximage_offset(t) / 256; - - t->SQ_TEX_RESOURCE3 = radeon_miptree_image_offset(t->mt, 0, t->minLod + 1) / 256; - - SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); - SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask); - - SETfield(t->SQ_TEX_SAMPLER1, - S_FIXED(CLAMP(t->base.Sampler.MinLod - t->minLod, 0, 15), 6), - MIN_LOD_shift, MIN_LOD_mask); - SETfield(t->SQ_TEX_SAMPLER1, - S_FIXED(CLAMP(t->base.Sampler.MaxLod - t->minLod, 0, 15), 6), - MAX_LOD_shift, MAX_LOD_mask); - SETfield(t->SQ_TEX_SAMPLER1, - S_FIXED(CLAMP(ctx->Texture.Unit[unit].LodBias + t->base.Sampler.LodBias, -16, 16), 6), - SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_shift, SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_mask); - - if(texObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) - { - SETfield(t->SQ_TEX_SAMPLER0, r600_translate_shadow_func(texObj->Sampler.CompareFunc), DEPTH_COMPARE_FUNCTION_shift, DEPTH_COMPARE_FUNCTION_mask); - } - else - { - CLEARfield(t->SQ_TEX_SAMPLER0, DEPTH_COMPARE_FUNCTION_mask); - } - - return GL_TRUE; -} - -/** - * Ensure the given texture is ready for rendering. - * - * Mostly this means populating the texture object's mipmap tree. - */ -static GLboolean r600_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) -{ - radeonTexObj *t = radeon_tex_obj(texObj); - - if (!radeon_validate_texture_miptree(ctx, texObj)) - return GL_FALSE; - - /* Configure the hardware registers (more precisely, the cached version - * of the hardware registers). */ - if (!setup_hardware_state(ctx, texObj, unit)) - return GL_FALSE; - - t->validated = GL_TRUE; - return GL_TRUE; -} - -/** - * Ensure all enabled and complete textures are uploaded along with any buffers being used. - */ -GLboolean r600ValidateBuffers(struct gl_context * ctx) -{ - context_t *rmesa = R700_CONTEXT(ctx); - struct radeon_renderbuffer *rrb; - struct radeon_bo *pbo; - int i; - int ret; - - radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); - - rrb = radeon_get_colorbuffer(&rmesa->radeon); - /* color buffer */ - if (rrb && rrb->bo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - rrb->bo, 0, - RADEON_GEM_DOMAIN_VRAM); - } - - /* depth buffer */ - rrb = radeon_get_depthbuffer(&rmesa->radeon); - if (rrb && rrb->bo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - rrb->bo, 0, - RADEON_GEM_DOMAIN_VRAM); - } - - for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { - radeonTexObj *t; - - if (!ctx->Texture.Unit[i]._ReallyEnabled) - continue; - - if (!r600_validate_texture(ctx, ctx->Texture.Unit[i]._Current, i)) { - radeon_warning("failed to validate texture for unit %d.\n", i); - } - t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); - if (t->image_override && t->bo) - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - t->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - else if (t->mt->bo) - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, - t->mt->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - } - - pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)r700GetActiveFpShaderConstBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - pbo = (struct radeon_bo *)r700GetActiveVpShaderConstBo(ctx); - if (pbo) { - radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, pbo, - RADEON_GEM_DOMAIN_GTT, 0); - } - - ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, first_elem(&rmesa->radeon.dma.reserved)->bo, RADEON_GEM_DOMAIN_GTT, 0); - if (ret) - return GL_FALSE; - return GL_TRUE; -} - -void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, - unsigned long long offset, GLint depth, GLuint pitch) -{ - context_t *rmesa = pDRICtx->driverPrivate; - struct gl_texture_object *tObj = - _mesa_lookup_texture(rmesa->radeon.glCtx, texname); - radeonTexObjPtr t = radeon_tex_obj(tObj); - const struct gl_texture_image *firstImage; - uint32_t pitch_val, size, row_align; - - if (!tObj) - return; - - if(rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenSetTexOffset(pDRICtx, texname, offset, depth, pitch); - return; - } - - t->image_override = GL_TRUE; - - if (!offset) - return; - - firstImage = t->base.Image[0][t->minLod]; - row_align = rmesa->radeon.texture_row_align - 1; - size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height; - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - t->bo = radeon_legacy_bo_alloc_fake(rmesa->radeon.radeonScreen->bom, size, offset); - t->override_offset = offset; - pitch_val = pitch; - switch (depth) { - case 32: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 24: - default: - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 16: - SETfield(t->SQ_TEX_RESOURCE1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 2; - break; - } - - pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (pitch_val < 8) - pitch_val = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, PITCH_shift, PITCH_mask); -} - -void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - struct radeon_renderbuffer *rb; - radeon_texture_image *rImage; - radeonContextPtr radeon; - context_t *rmesa; - struct radeon_framebuffer *rfb; - radeonTexObjPtr t; - uint32_t pitch_val; - gl_format texFormat; - - radeon = pDRICtx->driverPrivate; - rmesa = pDRICtx->driverPrivate; - - if(rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) - { - evergreenSetTexBuffer(pDRICtx, target, glx_texture_format, dPriv); - return; - } - - rfb = dPriv->driverPrivate; - texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); - texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0); - - rImage = get_radeon_texture_image(texImage); - t = radeon_tex_obj(texObj); - if (t == NULL) { - return; - } - - radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); - rb = rfb->color_rb[0]; - if (rb->bo == NULL) { - /* Failed to BO for the buffer */ - return; - } - - _mesa_lock_texture(radeon->glCtx, texObj); - if (t->bo) { - radeon_bo_unref(t->bo); - t->bo = NULL; - } - if (rImage->bo) { - radeon_bo_unref(rImage->bo); - rImage->bo = NULL; - } - - radeon_miptree_unreference(&t->mt); - radeon_miptree_unreference(&rImage->mt); - - rImage->bo = rb->bo; - radeon_bo_ref(rImage->bo); - t->bo = rb->bo; - radeon_bo_ref(t->bo); - t->image_override = GL_TRUE; - t->override_offset = 0; - pitch_val = rb->pitch; - switch (rb->cpp) { - case 4: - if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texFormat = MESA_FORMAT_RGB888; - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - } else { - texFormat = MESA_FORMAT_ARGB8888; - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - } - pitch_val /= 4; - break; - case 3: - default: - // FMT_8_8_8 ??? - texFormat = MESA_FORMAT_RGB888; - SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 4; - break; - case 2: - texFormat = MESA_FORMAT_RGB565; - SETfield(t->SQ_TEX_RESOURCE1, FMT_5_6_5, - SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); - - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); - SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, - SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - pitch_val /= 2; - break; - } - - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, - rb->cpp, texFormat); - rImage->base.RowStride = rb->pitch / rb->cpp; - - pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) - & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; - - /* min pitch is 8 */ - if (pitch_val < 8) - pitch_val = 8; - - SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, PITCH_shift, PITCH_mask); - SETfield(t->SQ_TEX_RESOURCE0, rb->base.Width - 1, - TEX_WIDTH_shift, TEX_WIDTH_mask); - SETfield(t->SQ_TEX_RESOURCE1, rb->base.Height - 1, - TEX_HEIGHT_shift, TEX_HEIGHT_mask); - - t->validated = GL_TRUE; - _mesa_unlock_texture(radeon->glCtx, texObj); - return; -} - -void r600SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) -{ - r600SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); -} diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c deleted file mode 100644 index 216ff0b941c..00000000000 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ /dev/null @@ -1,8160 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/mtypes.h" -#include "main/imports.h" -#include "program/prog_parameter.h" - -#include "radeon_debug.h" -#include "r600_context.h" - -#include "r700_assembler.h" -#include "evergreen_sq.h" - -#define USE_CF_FOR_CONTINUE_BREAK 1 -#define USE_CF_FOR_POP_AFTER 1 - -struct prog_instruction noise1_insts[12] = { - {OPCODE_BGNSUB , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_MOV , {{0, 0, 0, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 2, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_MOV , {{8, 0, 0, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 4, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_MOV , {{8, 0, 585, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 8, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_SGT , {{0, 0, 585, 0, 0, 0}, {8, 0, 1170, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 1, 1, 0, 8, 1672, 0}, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_IF , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 7, 0, 0}, 0, 0, 0, 1, 0, 0, 0, 15, 0, 0, 0}, - {OPCODE_MOV , {{0, 0, 1755, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 1, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_RET , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_ENDIF , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_MOV , {{0, 0, 1170, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 1, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_RET , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, - {OPCODE_ENDSUB , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0} -}; -float noise1_const[2][4] = { - {0.300000f, 0.900000f, 0.500000f, 0.300000f} -}; - -COMPILED_SUB noise1_presub = { - &(noise1_insts[0]), - 12, - 2, - 1, - 0, - &(noise1_const[0]), - SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_X, - {0,0,0}, - 0 -}; - -BITS addrmode_PVSDST(PVSDST * pPVSDST) -{ - return pPVSDST->addrmode0 | ((BITS)pPVSDST->addrmode1 << 1); -} - -void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode) -{ - pPVSDST->addrmode0 = addrmode & 1; - pPVSDST->addrmode1 = (addrmode >> 1) & 1; -} - -void nomask_PVSDST(PVSDST * pPVSDST) -{ - pPVSDST->writex = pPVSDST->writey = pPVSDST->writez = pPVSDST->writew = 1; -} - -BITS addrmode_PVSSRC(PVSSRC* pPVSSRC) -{ - return pPVSSRC->addrmode0 | ((BITS)pPVSSRC->addrmode1 << 1); -} - -void setaddrmode_PVSSRC(PVSSRC* pPVSSRC, BITS addrmode) -{ - pPVSSRC->addrmode0 = addrmode & 1; - pPVSSRC->addrmode1 = (addrmode >> 1) & 1; -} - - -void setswizzle_PVSSRC(PVSSRC* pPVSSRC, BITS swz) -{ - pPVSSRC->swizzlex = - pPVSSRC->swizzley = - pPVSSRC->swizzlez = - pPVSSRC->swizzlew = swz; -} - -void noswizzle_PVSSRC(PVSSRC* pPVSSRC) -{ - pPVSSRC->swizzlex = SQ_SEL_X; - pPVSSRC->swizzley = SQ_SEL_Y; - pPVSSRC->swizzlez = SQ_SEL_Z; - pPVSSRC->swizzlew = SQ_SEL_W; -} - -void -swizzleagain_PVSSRC(PVSSRC * pPVSSRC, BITS x, BITS y, BITS z, BITS w) -{ - switch (x) - { - case SQ_SEL_X: x = pPVSSRC->swizzlex; - break; - case SQ_SEL_Y: x = pPVSSRC->swizzley; - break; - case SQ_SEL_Z: x = pPVSSRC->swizzlez; - break; - case SQ_SEL_W: x = pPVSSRC->swizzlew; - break; - default:; - } - - switch (y) - { - case SQ_SEL_X: y = pPVSSRC->swizzlex; - break; - case SQ_SEL_Y: y = pPVSSRC->swizzley; - break; - case SQ_SEL_Z: y = pPVSSRC->swizzlez; - break; - case SQ_SEL_W: y = pPVSSRC->swizzlew; - break; - default:; - } - - switch (z) - { - case SQ_SEL_X: z = pPVSSRC->swizzlex; - break; - case SQ_SEL_Y: z = pPVSSRC->swizzley; - break; - case SQ_SEL_Z: z = pPVSSRC->swizzlez; - break; - case SQ_SEL_W: z = pPVSSRC->swizzlew; - break; - default:; - } - - switch (w) - { - case SQ_SEL_X: w = pPVSSRC->swizzlex; - break; - case SQ_SEL_Y: w = pPVSSRC->swizzley; - break; - case SQ_SEL_Z: w = pPVSSRC->swizzlez; - break; - case SQ_SEL_W: w = pPVSSRC->swizzlew; - break; - default:; - } - - pPVSSRC->swizzlex = x; - pPVSSRC->swizzley = y; - pPVSSRC->swizzlez = z; - pPVSSRC->swizzlew = w; -} - -void neg_PVSSRC(PVSSRC* pPVSSRC) -{ - pPVSSRC->negx = 1; - pPVSSRC->negy = 1; - pPVSSRC->negz = 1; - pPVSSRC->negw = 1; -} - -void noneg_PVSSRC(PVSSRC* pPVSSRC) -{ - pPVSSRC->negx = 0; - pPVSSRC->negy = 0; - pPVSSRC->negz = 0; - pPVSSRC->negw = 0; -} - -// negate argument (for SUB instead of ADD and alike) -void flipneg_PVSSRC(PVSSRC* pPVSSRC) -{ - pPVSSRC->negx = !pPVSSRC->negx; - pPVSSRC->negy = !pPVSSRC->negy; - pPVSSRC->negz = !pPVSSRC->negz; - pPVSSRC->negw = !pPVSSRC->negw; -} - -void zerocomp_PVSSRC(PVSSRC* pPVSSRC, int c) -{ - switch (c) - { - case 0: pPVSSRC->swizzlex = SQ_SEL_0; pPVSSRC->negx = 0; break; - case 1: pPVSSRC->swizzley = SQ_SEL_0; pPVSSRC->negy = 0; break; - case 2: pPVSSRC->swizzlez = SQ_SEL_0; pPVSSRC->negz = 0; break; - case 3: pPVSSRC->swizzlew = SQ_SEL_0; pPVSSRC->negw = 0; break; - default:; - } -} - -void onecomp_PVSSRC(PVSSRC* pPVSSRC, int c) -{ - switch (c) - { - case 0: pPVSSRC->swizzlex = SQ_SEL_1; pPVSSRC->negx = 0; break; - case 1: pPVSSRC->swizzley = SQ_SEL_1; pPVSSRC->negy = 0; break; - case 2: pPVSSRC->swizzlez = SQ_SEL_1; pPVSSRC->negz = 0; break; - case 3: pPVSSRC->swizzlew = SQ_SEL_1; pPVSSRC->negw = 0; break; - default:; - } -} - -BITS is_misc_component_exported(VAP_OUT_VTX_FMT_0* pOutVTXFmt0) -{ - return (pOutVTXFmt0->point_size | - pOutVTXFmt0->edge_flag | - pOutVTXFmt0->rta_index | - pOutVTXFmt0->kill_flag | - pOutVTXFmt0->viewport_index); -} - -BITS is_depth_component_exported(OUT_FRAGMENT_FMT_0* pFPOutFmt) -{ - return (pFPOutFmt->depth | - pFPOutFmt->stencil_ref | - pFPOutFmt->mask | - pFPOutFmt->coverage_to_mask); -} - -GLboolean is_reduction_opcode(PVSDWORD* dest) -{ - if (dest->dst.op3 == 0) - { - if ( (dest->dst.opcode == SQ_OP2_INST_DOT4 || dest->dst.opcode == SQ_OP2_INST_DOT4_IEEE || dest->dst.opcode == SQ_OP2_INST_CUBE) ) - { - return GL_TRUE; - } - } - return GL_FALSE; -} - -#if 0 /* unused */ -GLboolean EG_is_reduction_opcode(PVSDWORD* dest) -{ - if (dest->dst.op3 == 0) - { - if ( (dest->dst.opcode == EG_OP2_INST_DOT4 || dest->dst.opcode == EG_OP2_INST_DOT4_IEEE || dest->dst.opcode == EG_OP2_INST_CUBE) ) - { - return GL_TRUE; - } - } - return GL_FALSE; -} -#endif - -GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size) -{ - GLuint format = FMT_INVALID; - GLuint uiElemSize = 0; - - switch (eType) - { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - uiElemSize = 1; - switch(nChannels) - { - case 1: - format = FMT_8; break; - case 2: - format = FMT_8_8; break; - case 3: - /* for some (small/unaligned) strides using 4 comps works - * better, probably same as GL_SHORT below - * test piglit/draw-vertices */ - format = FMT_8_8_8_8; break; - case 4: - format = FMT_8_8_8_8; break; - default: - break; - } - break; - - case GL_UNSIGNED_SHORT: - case GL_SHORT: - uiElemSize = 2; - switch(nChannels) - { - case 1: - format = FMT_16; break; - case 2: - format = FMT_16_16; break; - case 3: - /* 3 comp GL_SHORT vertex format doesnt work on r700 - 4 somehow works, test - sauerbraten */ - format = FMT_16_16_16_16; break; - case 4: - format = FMT_16_16_16_16; break; - default: - break; - } - break; - - case GL_UNSIGNED_INT: - case GL_INT: - uiElemSize = 4; - switch(nChannels) - { - case 1: - format = FMT_32; break; - case 2: - format = FMT_32_32; break; - case 3: - format = FMT_32_32_32; break; - case 4: - format = FMT_32_32_32_32; break; - default: - break; - } - break; - - case GL_FLOAT: - uiElemSize = 4; - switch(nChannels) - { - case 1: - format = FMT_32_FLOAT; break; - case 2: - format = FMT_32_32_FLOAT; break; - case 3: - format = FMT_32_32_32_FLOAT; break; - case 4: - format = FMT_32_32_32_32_FLOAT; break; - default: - break; - } - break; - case GL_DOUBLE: - uiElemSize = 8; - switch(nChannels) - { - case 1: - format = FMT_32_FLOAT; break; - case 2: - format = FMT_32_32_FLOAT; break; - case 3: - format = FMT_32_32_32_FLOAT; break; - case 4: - format = FMT_32_32_32_32_FLOAT; break; - default: - break; - } - break; - default: - ; - //GL_ASSERT_NO_CASE(); - } - - if(NULL != pClient_size) - { - *pClient_size = uiElemSize * nChannels; - } - - return(format); -} - -unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3) -{ - if(nIsOp3 > 0) - { - return 3; - } - - switch (opcode) - { - case SQ_OP2_INST_ADD: - case SQ_OP2_INST_KILLE: - case SQ_OP2_INST_KILLGT: - case SQ_OP2_INST_KILLGE: - case SQ_OP2_INST_KILLNE: - case SQ_OP2_INST_MUL: - case SQ_OP2_INST_MAX: - case SQ_OP2_INST_MIN: - //case SQ_OP2_INST_MAX_DX10: - //case SQ_OP2_INST_MIN_DX10: - case SQ_OP2_INST_SETE: - case SQ_OP2_INST_SETNE: - case SQ_OP2_INST_SETGT: - case SQ_OP2_INST_SETGE: - case SQ_OP2_INST_PRED_SETE: - case SQ_OP2_INST_PRED_SETGT: - case SQ_OP2_INST_PRED_SETGE: - case SQ_OP2_INST_PRED_SETNE: - case SQ_OP2_INST_DOT4: - case SQ_OP2_INST_DOT4_IEEE: - case SQ_OP2_INST_CUBE: - return 2; - - case SQ_OP2_INST_MOV: - case SQ_OP2_INST_MOVA_FLOOR: - case SQ_OP2_INST_FRACT: - case SQ_OP2_INST_FLOOR: - case SQ_OP2_INST_TRUNC: - case SQ_OP2_INST_EXP_IEEE: - case SQ_OP2_INST_LOG_CLAMPED: - case SQ_OP2_INST_LOG_IEEE: - case SQ_OP2_INST_RECIP_IEEE: - case SQ_OP2_INST_RECIPSQRT_IEEE: - case SQ_OP2_INST_FLT_TO_INT: - case SQ_OP2_INST_SIN: - case SQ_OP2_INST_COS: - return 1; - - default: radeon_error( - "Need instruction operand number for %x.\n", opcode); - }; - - return 3; -} - -unsigned int EG_GetNumOperands(GLuint opcode, GLuint nIsOp3) -{ - if(nIsOp3 > 0) - { - return 3; - } - - switch (opcode) - { - case EG_OP2_INST_ADD: - case EG_OP2_INST_KILLE: - case EG_OP2_INST_KILLGT: - case EG_OP2_INST_KILLGE: - case EG_OP2_INST_KILLNE: - case EG_OP2_INST_MUL: - case EG_OP2_INST_MAX: - case EG_OP2_INST_MIN: - //case EG_OP2_INST_MAX_DX10: - //case EG_OP2_INST_MIN_DX10: - case EG_OP2_INST_SETE: - case EG_OP2_INST_SETNE: - case EG_OP2_INST_SETGT: - case EG_OP2_INST_SETGE: - case EG_OP2_INST_PRED_SETE: - case EG_OP2_INST_PRED_SETGT: - case EG_OP2_INST_PRED_SETGE: - case EG_OP2_INST_PRED_SETNE: - case EG_OP2_INST_DOT4: - case EG_OP2_INST_DOT4_IEEE: - case EG_OP2_INST_CUBE: - return 2; - - case EG_OP2_INST_MOV: - //case SQ_OP2_INST_MOVA_FLOOR: - case EG_OP2_INST_FRACT: - case EG_OP2_INST_FLOOR: - case EG_OP2_INST_TRUNC: - case EG_OP2_INST_EXP_IEEE: - case EG_OP2_INST_LOG_CLAMPED: - case EG_OP2_INST_LOG_IEEE: - case EG_OP2_INST_RECIP_IEEE: - case EG_OP2_INST_RECIPSQRT_IEEE: - case EG_OP2_INST_FLT_TO_INT: - case EG_OP2_INST_SIN: - case EG_OP2_INST_COS: - case EG_OP2_INST_FLT_TO_INT_FLOOR: - case EG_OP2_INST_MOVA_INT: - return 1; - - default: radeon_error( - "Need instruction operand number for %x.\n", opcode); - }; - - return 3; -} - -int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader) -{ - GLuint i; - - Init_R700_Shader(pShader); - pAsm->pR700Shader = pShader; - pAsm->currentShaderType = spt; - - pAsm->cf_last_export_ptr = NULL; - - pAsm->cf_current_export_clause_ptr = NULL; - pAsm->cf_current_alu_clause_ptr = NULL; - pAsm->cf_current_tex_clause_ptr = NULL; - pAsm->cf_current_vtx_clause_ptr = NULL; - pAsm->cf_current_cf_clause_ptr = NULL; - - // No clause has been created yet - pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; - - pAsm->number_of_colorandz_exports = 0; - pAsm->number_of_exports = 0; - pAsm->number_of_export_opcodes = 0; - - pAsm->alu_x_opcode = 0; - - pAsm->D2.bits = 0; - - pAsm->D.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; - - pAsm->uLastPosUpdate = 0; - - *(BITS *) &pAsm->fp_stOutFmt0 = 0; - - pAsm->uIIns = 0; - pAsm->uOIns = 0; - pAsm->number_used_registers = 0; - pAsm->uUsedConsts = 256; - - - // Fragment programs - pAsm->uBoolConsts = 0; - pAsm->uIntConsts = 0; - pAsm->uInsts = 0; - pAsm->uConsts = 0; - - pAsm->FCSP = 0; - pAsm->fc_stack[0].type = FC_NONE; - - pAsm->aArgSubst[0] = - pAsm->aArgSubst[1] = - pAsm->aArgSubst[2] = - pAsm->aArgSubst[3] = (-1); - - pAsm->uOutputs = 0; - - for (i=0; i<NUMBER_OF_OUTPUT_COLORS; i++) - { - pAsm->color_export_register_number[i] = (-1); - } - - - pAsm->depth_export_register_number = (-1); - pAsm->stencil_export_register_number = (-1); - pAsm->coverage_to_mask_export_register_number = (-1); - pAsm->mask_export_register_number = (-1); - - pAsm->starting_export_register_number = 0; - pAsm->starting_vfetch_register_number = 0; - pAsm->starting_temp_register_number = 0; - pAsm->uFirstHelpReg = 0; - - pAsm->input_position_is_used = GL_FALSE; - pAsm->input_normal_is_used = GL_FALSE; - - for (i=0; i<NUMBER_OF_INPUT_COLORS; i++) - { - pAsm->input_color_is_used[ i ] = GL_FALSE; - } - - for (i=0; i<NUMBER_OF_TEXTURE_UNITS; i++) - { - pAsm->input_texture_unit_is_used[ i ] = GL_FALSE; - } - - for (i=0; i<VERT_ATTRIB_MAX; i++) - { - pAsm->vfetch_instruction_ptr_array[ i ] = NULL; - } - - pAsm->number_of_inputs = 0; - - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; - - pAsm->subs = NULL; - pAsm->unSubArraySize = 0; - pAsm->unSubArrayPointer = 0; - pAsm->callers = NULL; - pAsm->unCallerArraySize = 0; - pAsm->unCallerArrayPointer = 0; - - pAsm->CALLSP = 0; - pAsm->CALLSTACK[0].FCSP_BeforeEntry = 0; - pAsm->CALLSTACK[0].plstCFInstructions_local - = &(pAsm->pR700Shader->lstCFInstructions); - - pAsm->CALLSTACK[0].max = 0; - pAsm->CALLSTACK[0].current = 0; - - SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local); - - pAsm->unCFflags = 0; - - pAsm->presubs = NULL; - pAsm->unPresubArraySize = 0; - pAsm->unNumPresub = 0; - pAsm->unCurNumILInsts = 0; - - pAsm->unVetTexBits = 0; - - return 0; -} - -GLboolean IsTex(gl_inst_opcode Opcode) -{ - if( (OPCODE_TEX==Opcode) || (OPCODE_TXP==Opcode) || (OPCODE_TXB==Opcode) || - (OPCODE_DDX==Opcode) || (OPCODE_DDY==Opcode) || (OPCODE_TXL==Opcode) ) - { - return GL_TRUE; - } - return GL_FALSE; -} - -GLboolean IsAlu(gl_inst_opcode Opcode) -{ - //TODO : more for fc and ex for higher spec. - if( IsTex(Opcode) ) - { - return GL_FALSE; - } - return GL_TRUE; -} - -int check_current_clause(r700_AssemblerBase* pAsm, - CF_CLAUSE_TYPE new_clause_type) -{ - if (pAsm->cf_current_clause_type != new_clause_type) - { //Close last open clause - switch (pAsm->cf_current_clause_type) - { - case CF_ALU_CLAUSE: - if ( pAsm->cf_current_alu_clause_ptr != NULL) - { - pAsm->cf_current_alu_clause_ptr = NULL; - } - break; - case CF_VTX_CLAUSE: - if ( pAsm->cf_current_vtx_clause_ptr != NULL) - { - pAsm->cf_current_vtx_clause_ptr = NULL; - } - break; - case CF_TEX_CLAUSE: - if ( pAsm->cf_current_tex_clause_ptr != NULL) - { - pAsm->cf_current_tex_clause_ptr = NULL; - } - break; - case CF_EXPORT_CLAUSE: - if ( pAsm->cf_current_export_clause_ptr != NULL) - { - pAsm->cf_current_export_clause_ptr = NULL; - } - break; - case CF_OTHER_CLAUSE: - if ( pAsm->cf_current_cf_clause_ptr != NULL) - { - pAsm->cf_current_cf_clause_ptr = NULL; - } - break; - case CF_EMPTY_CLAUSE: - break; - default: - radeon_error( - "Unknown CF_CLAUSE_TYPE (%d) in check_current_clause. \n", (int) new_clause_type); - return GL_FALSE; - } - - pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; - - // Create new clause - switch (new_clause_type) - { - case CF_ALU_CLAUSE: - pAsm->cf_current_clause_type = CF_ALU_CLAUSE; - break; - case CF_VTX_CLAUSE: - pAsm->cf_current_clause_type = CF_VTX_CLAUSE; - break; - case CF_TEX_CLAUSE: - pAsm->cf_current_clause_type = CF_TEX_CLAUSE; - break; - case CF_EXPORT_CLAUSE: - { - R700ControlFlowSXClause* pR700ControlFlowSXClause - = (R700ControlFlowSXClause*) CALLOC_STRUCT(R700ControlFlowSXClause); - - // Add new export instruction to control flow program - if (pR700ControlFlowSXClause != 0) - { - pAsm->cf_current_export_clause_ptr = pR700ControlFlowSXClause; - Init_R700ControlFlowSXClause(pR700ControlFlowSXClause); - AddCFInstruction( pAsm->pR700Shader, - (R700ControlFlowInstruction *)pR700ControlFlowSXClause ); - } - else - { - radeon_error( - "Error allocating new EXPORT CF instruction in check_current_clause. \n"); - return GL_FALSE; - } - pAsm->cf_current_clause_type = CF_EXPORT_CLAUSE; - } - break; - case CF_EMPTY_CLAUSE: - break; - case CF_OTHER_CLAUSE: - pAsm->cf_current_clause_type = CF_OTHER_CLAUSE; - break; - default: - radeon_error( - "Unknown CF_CLAUSE_TYPE (%d) in check_current_clause. \n", (int) new_clause_type); - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean add_cf_instruction(r700_AssemblerBase* pAsm) -{ - if(GL_FALSE == check_current_clause(pAsm, CF_OTHER_CLAUSE)) - { - return GL_FALSE; - } - - pAsm->cf_current_cf_clause_ptr = - (R700ControlFlowGenericClause*) CALLOC_STRUCT(R700ControlFlowGenericClause); - - if (pAsm->cf_current_cf_clause_ptr != NULL) - { - Init_R700ControlFlowGenericClause(pAsm->cf_current_cf_clause_ptr); - AddCFInstruction( pAsm->pR700Shader, - (R700ControlFlowInstruction *)pAsm->cf_current_cf_clause_ptr ); - } - else - { - radeon_error("Could not allocate a new VFetch CF instruction.\n"); - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm, - R700VertexInstruction* vertex_instruction_ptr) -{ - if( GL_FALSE == check_current_clause(pAsm, CF_VTX_CLAUSE) ) - { - return GL_FALSE; - } - - if( pAsm->cf_current_vtx_clause_ptr == NULL || - ( (pAsm->cf_current_vtx_clause_ptr != NULL) && - (pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count >= GetCFMaxInstructions(pAsm->cf_current_vtx_clause_ptr->m_ShaderInstType)-1) - ) ) - { - // Create new Vfetch control flow instruction for this new clause - pAsm->cf_current_vtx_clause_ptr = (R700ControlFlowGenericClause*) CALLOC_STRUCT(R700ControlFlowGenericClause); - - if (pAsm->cf_current_vtx_clause_ptr != NULL) - { - Init_R700ControlFlowGenericClause(pAsm->cf_current_vtx_clause_ptr); - AddCFInstruction( pAsm->pR700Shader, - (R700ControlFlowInstruction *)pAsm->cf_current_vtx_clause_ptr ); - } - else - { - radeon_error("Could not allocate a new VFetch CF instruction.\n"); - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, EG_CF_INST_VC, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - } - else - { - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.pop_count = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_VTX; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.barrier = 0x1; - } - - LinkVertexInstruction(pAsm->cf_current_vtx_clause_ptr, vertex_instruction_ptr ); - } - else - { - if(8 == pAsm->unAsic) - { - unsigned int count = GETbits(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask) + 1; - SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, count, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_vtx_clause_ptr->m_Word1.f.count++; - } - } - - AddVTXInstruction(pAsm->pR700Shader, vertex_instruction_ptr); - - return GL_TRUE; -} - -GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, - R700TextureInstruction* tex_instruction_ptr) -{ - if ( GL_FALSE == check_current_clause(pAsm, CF_TEX_CLAUSE) ) - { - return GL_FALSE; - } - - if ( pAsm->cf_current_tex_clause_ptr == NULL || - ( (pAsm->cf_current_tex_clause_ptr != NULL) && - (pAsm->cf_current_tex_clause_ptr->m_Word1.f.count >= GetCFMaxInstructions(pAsm->cf_current_tex_clause_ptr->m_ShaderInstType)-1) - ) ) - { - // new tex cf instruction for this new clause - pAsm->cf_current_tex_clause_ptr = (R700ControlFlowGenericClause*) CALLOC_STRUCT(R700ControlFlowGenericClause); - - if (pAsm->cf_current_tex_clause_ptr != NULL) - { - Init_R700ControlFlowGenericClause(pAsm->cf_current_tex_clause_ptr); - AddCFInstruction( pAsm->pR700Shader, - (R700ControlFlowInstruction *)pAsm->cf_current_tex_clause_ptr ); - } - else - { - radeon_error("Could not allocate a new TEX CF instruction.\n"); - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, EG_CF_INST_TC, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); -#ifdef FORCE_CF_TEX_BARRIER - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); -#else - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, 0, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); -#endif - } - else - { - pAsm->cf_current_tex_clause_ptr->m_Word1.f.pop_count = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_tex_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_TEX; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x0; //0x1; - } - } - else - { - if(8 == pAsm->unAsic) - { - unsigned int count = GETbits(pAsm->cf_current_tex_clause_ptr->m_Word1.val, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask) + 1; - SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, count, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_tex_clause_ptr->m_Word1.f.count++; - } - } - - // If this clause constains any TEX instruction that is dependent on a - // previous instruction, set the barrier bit, also always set for vert - // programs as tex deps are not(yet) computed for them - if( pAsm->currentShaderType == SPT_VP || pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) || pAsm->need_tex_barrier == GL_TRUE ) - { - pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x1; - } - - if(NULL == pAsm->cf_current_tex_clause_ptr->m_pLinkedTEXInstruction) - { - pAsm->cf_current_tex_clause_ptr->m_pLinkedTEXInstruction = tex_instruction_ptr; - tex_instruction_ptr->m_pLinkedGenericClause = pAsm->cf_current_tex_clause_ptr; - } - - AddTEXInstruction(pAsm->pR700Shader, tex_instruction_ptr); - - return GL_TRUE; -} - -GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, - GLuint gl_client_id, - GLuint destination_register, - GLuint number_of_elements, - GLenum dataElementType, - VTX_FETCH_METHOD* pFetchMethod) -{ - GLuint client_size_inbyte; - GLuint data_format; - GLuint mega_fetch_count; - GLuint is_mega_fetch_flag; - - R700VertexGenericFetch* vfetch_instruction_ptr; - R700VertexGenericFetch* assembled_vfetch_instruction_ptr = pAsm->vfetch_instruction_ptr_array[ gl_client_id ]; - - if (assembled_vfetch_instruction_ptr == NULL) - { - vfetch_instruction_ptr = (R700VertexGenericFetch*) CALLOC_STRUCT(R700VertexGenericFetch); - if (vfetch_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700VertexGenericFetch(vfetch_instruction_ptr); - } - else - { - vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; - } - - data_format = GetSurfaceFormat(dataElementType, number_of_elements, &client_size_inbyte); - - if(GL_TRUE == pFetchMethod->bEnableMini) //More conditions here - { - //TODO : mini fetch - mega_fetch_count = 0; - is_mega_fetch_flag = 0; - } - else - { - mega_fetch_count = MEGA_FETCH_BYTES - 1; - is_mega_fetch_flag = 0x1; - pFetchMethod->mega_fetch_remainder = MEGA_FETCH_BYTES - client_size_inbyte; - } - - vfetch_instruction_ptr->m_Word0.f.vtx_inst = SQ_VTX_INST_FETCH; - vfetch_instruction_ptr->m_Word0.f.fetch_type = SQ_VTX_FETCH_VERTEX_DATA; - vfetch_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; - - vfetch_instruction_ptr->m_Word0.f.buffer_id = gl_client_id; - vfetch_instruction_ptr->m_Word0.f.src_gpr = 0x0; - vfetch_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; - vfetch_instruction_ptr->m_Word0.f.src_sel_x = SQ_SEL_X; - vfetch_instruction_ptr->m_Word0.f.mega_fetch_count = mega_fetch_count; - - vfetch_instruction_ptr->m_Word1.f.dst_sel_x = (number_of_elements < 1) ? SQ_SEL_0 : SQ_SEL_X; - vfetch_instruction_ptr->m_Word1.f.dst_sel_y = (number_of_elements < 2) ? SQ_SEL_0 : SQ_SEL_Y; - vfetch_instruction_ptr->m_Word1.f.dst_sel_z = (number_of_elements < 3) ? SQ_SEL_0 : SQ_SEL_Z; - vfetch_instruction_ptr->m_Word1.f.dst_sel_w = (number_of_elements < 4) ? SQ_SEL_1 : SQ_SEL_W; - - vfetch_instruction_ptr->m_Word1.f.use_const_fields = 1; - - // Destination register - vfetch_instruction_ptr->m_Word1_GPR.f.dst_gpr = destination_register; - vfetch_instruction_ptr->m_Word1_GPR.f.dst_rel = SQ_ABSOLUTE; - - vfetch_instruction_ptr->m_Word2.f.offset = 0; - vfetch_instruction_ptr->m_Word2.f.const_buf_no_stride = 0x0; - - vfetch_instruction_ptr->m_Word2.f.mega_fetch = is_mega_fetch_flag; - - if (assembled_vfetch_instruction_ptr == NULL) - { - if ( GL_FALSE == add_vfetch_instruction(pAsm, (R700VertexInstruction *)vfetch_instruction_ptr) ) - { - return GL_FALSE; - } - - if (pAsm->vfetch_instruction_ptr_array[ gl_client_id ] != NULL) - { - return GL_FALSE; - } - else - { - pAsm->vfetch_instruction_ptr_array[ gl_client_id ] = vfetch_instruction_ptr; - } - } - - return GL_TRUE; -} - -GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm, - GLuint destination_register, - GLenum type, - GLint size, - GLubyte element, - GLuint _signed, - GLboolean normalize, - GLenum format, - VTX_FETCH_METHOD * pFetchMethod) -{ - GLuint client_size_inbyte; - GLuint data_format; - GLuint mega_fetch_count; - GLuint is_mega_fetch_flag; - - GLuint dst_sel_x, dst_sel_y, dst_sel_z, dst_sel_w; - - R700VertexGenericFetch* vfetch_instruction_ptr; - R700VertexGenericFetch* assembled_vfetch_instruction_ptr - = pAsm->vfetch_instruction_ptr_array[element]; - - if (assembled_vfetch_instruction_ptr == NULL) - { - vfetch_instruction_ptr = (R700VertexGenericFetch*) CALLOC_STRUCT(R700VertexGenericFetch); - if (vfetch_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700VertexGenericFetch(vfetch_instruction_ptr); - } - else - { - vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; - } - - data_format = GetSurfaceFormat(type, size, &client_size_inbyte); - - if(GL_TRUE == pFetchMethod->bEnableMini) //More conditions here - { - //TODO : mini fetch - mega_fetch_count = 0; - is_mega_fetch_flag = 0; - } - else - { - mega_fetch_count = MEGA_FETCH_BYTES - 1; - is_mega_fetch_flag = 0x1; - pFetchMethod->mega_fetch_remainder = MEGA_FETCH_BYTES - client_size_inbyte; - } - - SETfield(vfetch_instruction_ptr->m_Word0.val, EG_VC_INST_FETCH, - EG_VTX_WORD0__VC_INST_shift, - EG_VTX_WORD0__VC_INST_mask); - SETfield(vfetch_instruction_ptr->m_Word0.val, EG_VTX_FETCH_VERTEX_DATA, - EG_VTX_WORD0__FETCH_TYPE_shift, - EG_VTX_WORD0__FETCH_TYPE_mask); - CLEARbit(vfetch_instruction_ptr->m_Word0.val, - EG_VTX_WORD0__FWQ_bit); - SETfield(vfetch_instruction_ptr->m_Word0.val, element, - EG_VTX_WORD0__BUFFER_ID_shift, - EG_VTX_WORD0__BUFFER_ID_mask); - SETfield(vfetch_instruction_ptr->m_Word0.val, 0x0, - EG_VTX_WORD0__SRC_GPR_shift, - EG_VTX_WORD0__SRC_GPR_mask); - SETfield(vfetch_instruction_ptr->m_Word0.val, SQ_ABSOLUTE, - EG_VTX_WORD0__SRC_REL_shift, - EG_VTX_WORD0__SRC_REL_bit); - SETfield(vfetch_instruction_ptr->m_Word0.val, SQ_SEL_X, - EG_VTX_WORD0__SRC_SEL_X_shift, - EG_VTX_WORD0__SRC_SEL_X_mask); - SETfield(vfetch_instruction_ptr->m_Word0.val, mega_fetch_count, - EG_VTX_WORD0__MFC_shift, - EG_VTX_WORD0__MFC_mask); - - if(format == GL_BGRA) - { - dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_Z; - dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; - dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_X; - dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; - } - else - { - dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_X; - dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; - dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_Z; - dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; - - } - SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_x, - EG_VTX_WORD1__DST_SEL_X_shift, - EG_VTX_WORD1__DST_SEL_X_mask); - SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_y, - EG_VTX_WORD1__DST_SEL_Y_shift, - EG_VTX_WORD1__DST_SEL_Y_mask); - SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_z, - EG_VTX_WORD1__DST_SEL_Z_shift, - EG_VTX_WORD1__DST_SEL_Z_mask); - SETfield(vfetch_instruction_ptr->m_Word1.val, dst_sel_w, - EG_VTX_WORD1__DST_SEL_W_shift, - EG_VTX_WORD1__DST_SEL_W_mask); - - SETfield(vfetch_instruction_ptr->m_Word1.val, 1, - EG_VTX_WORD1__UCF_shift, - EG_VTX_WORD1__UCF_bit); - SETfield(vfetch_instruction_ptr->m_Word1.val, data_format, - EG_VTX_WORD1__DATA_FORMAT_shift, - EG_VTX_WORD1__DATA_FORMAT_mask); -#ifdef TEST_VFETCH - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_SIGNED, - EG_VTX_WORD1__FCA_shift, - EG_VTX_WORD1__FCA_bit); -#else - if(1 == _signed) - { - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_SIGNED, - EG_VTX_WORD1__FCA_shift, - EG_VTX_WORD1__FCA_bit); - } - else - { - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_FORMAT_COMP_UNSIGNED, - EG_VTX_WORD1__FCA_shift, - EG_VTX_WORD1__FCA_bit); - } -#endif /* TEST_VFETCH */ - - if(GL_TRUE == normalize) - { - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_NUM_FORMAT_NORM, - EG_VTX_WORD1__NFA_shift, - EG_VTX_WORD1__NFA_mask); - } - else - { - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_NUM_FORMAT_SCALED, - EG_VTX_WORD1__NFA_shift, - EG_VTX_WORD1__NFA_mask); - } - - /* Destination register */ - SETfield(vfetch_instruction_ptr->m_Word1.val, destination_register, - EG_VTX_WORD1_GPR__DST_GPR_shift, - EG_VTX_WORD1_GPR__DST_GPR_mask); - SETfield(vfetch_instruction_ptr->m_Word1.val, SQ_ABSOLUTE, - EG_VTX_WORD1_GPR__DST_REL_shift, - EG_VTX_WORD1_GPR__DST_REL_bit); - - - SETfield(vfetch_instruction_ptr->m_Word2.val, 0, - EG_VTX_WORD2__OFFSET_shift, - EG_VTX_WORD2__OFFSET_mask); - SETfield(vfetch_instruction_ptr->m_Word2.val, -#ifdef MESA_BIG_ENDIAN - SQ_ENDIAN_8IN32, -#else - SQ_ENDIAN_NONE, -#endif - EG_VTX_WORD2__ENDIAN_SWAP_shift, - EG_VTX_WORD2__ENDIAN_SWAP_mask); - SETfield(vfetch_instruction_ptr->m_Word2.val, 0, - EG_VTX_WORD2__CBNS_shift, - EG_VTX_WORD2__CBNS_bit); - SETfield(vfetch_instruction_ptr->m_Word2.val, is_mega_fetch_flag, - EG_VTX_WORD2__MEGA_FETCH_shift, - EG_VTX_WORD2__MEGA_FETCH_mask); - - if (assembled_vfetch_instruction_ptr == NULL) - { - if ( GL_FALSE == add_vfetch_instruction(pAsm, (R700VertexInstruction *)vfetch_instruction_ptr) ) - { - return GL_FALSE; - } - - if (pAsm->vfetch_instruction_ptr_array[element] != NULL) - { - return GL_FALSE; - } - else - { - pAsm->vfetch_instruction_ptr_array[element] = vfetch_instruction_ptr; - } - } - - return GL_TRUE; -} - -GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, - GLuint destination_register, - GLenum type, - GLint size, - GLubyte element, - GLuint _signed, - GLboolean normalize, - GLenum format, - VTX_FETCH_METHOD * pFetchMethod) -{ - GLuint client_size_inbyte; - GLuint data_format; - GLuint mega_fetch_count; - GLuint is_mega_fetch_flag; - - R700VertexGenericFetch* vfetch_instruction_ptr; - R700VertexGenericFetch* assembled_vfetch_instruction_ptr - = pAsm->vfetch_instruction_ptr_array[element]; - - if (assembled_vfetch_instruction_ptr == NULL) - { - vfetch_instruction_ptr = (R700VertexGenericFetch*) CALLOC_STRUCT(R700VertexGenericFetch); - if (vfetch_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700VertexGenericFetch(vfetch_instruction_ptr); - } - else - { - vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; - } - - data_format = GetSurfaceFormat(type, size, &client_size_inbyte); - - if(GL_TRUE == pFetchMethod->bEnableMini) //More conditions here - { - //TODO : mini fetch - mega_fetch_count = 0; - is_mega_fetch_flag = 0; - } - else - { - mega_fetch_count = MEGA_FETCH_BYTES - 1; - is_mega_fetch_flag = 0x1; - pFetchMethod->mega_fetch_remainder = MEGA_FETCH_BYTES - client_size_inbyte; - } - - vfetch_instruction_ptr->m_Word0.f.vtx_inst = SQ_VTX_INST_FETCH; - vfetch_instruction_ptr->m_Word0.f.fetch_type = SQ_VTX_FETCH_VERTEX_DATA; - vfetch_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; - - vfetch_instruction_ptr->m_Word0.f.buffer_id = element; - vfetch_instruction_ptr->m_Word0.f.src_gpr = 0x0; - vfetch_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; - vfetch_instruction_ptr->m_Word0.f.src_sel_x = SQ_SEL_X; - vfetch_instruction_ptr->m_Word0.f.mega_fetch_count = mega_fetch_count; - - if(format == GL_BGRA) - { - vfetch_instruction_ptr->m_Word1.f.dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_Z; - vfetch_instruction_ptr->m_Word1.f.dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; - vfetch_instruction_ptr->m_Word1.f.dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_X; - vfetch_instruction_ptr->m_Word1.f.dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; - } - else - { - vfetch_instruction_ptr->m_Word1.f.dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_X; - vfetch_instruction_ptr->m_Word1.f.dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; - vfetch_instruction_ptr->m_Word1.f.dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_Z; - vfetch_instruction_ptr->m_Word1.f.dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; - - } - - vfetch_instruction_ptr->m_Word1.f.use_const_fields = 1; - vfetch_instruction_ptr->m_Word1.f.data_format = data_format; -#ifdef MESA_BIG_ENDIAN - vfetch_instruction_ptr->m_Word2.f.endian_swap = SQ_ENDIAN_8IN32; -#else - vfetch_instruction_ptr->m_Word2.f.endian_swap = SQ_ENDIAN_NONE; -#endif - - if(1 == _signed) - { - vfetch_instruction_ptr->m_Word1.f.format_comp_all = SQ_FORMAT_COMP_SIGNED; - } - else - { - vfetch_instruction_ptr->m_Word1.f.format_comp_all = SQ_FORMAT_COMP_UNSIGNED; - } - - if(GL_TRUE == normalize) - { - vfetch_instruction_ptr->m_Word1.f.num_format_all = SQ_NUM_FORMAT_NORM; - } - else - { - vfetch_instruction_ptr->m_Word1.f.num_format_all = SQ_NUM_FORMAT_INT; - } - - // Destination register - vfetch_instruction_ptr->m_Word1_GPR.f.dst_gpr = destination_register; - vfetch_instruction_ptr->m_Word1_GPR.f.dst_rel = SQ_ABSOLUTE; - - vfetch_instruction_ptr->m_Word2.f.offset = 0; - vfetch_instruction_ptr->m_Word2.f.const_buf_no_stride = 0x0; - - vfetch_instruction_ptr->m_Word2.f.mega_fetch = is_mega_fetch_flag; - - if (assembled_vfetch_instruction_ptr == NULL) - { - if ( GL_FALSE == add_vfetch_instruction(pAsm, (R700VertexInstruction *)vfetch_instruction_ptr) ) - { - return GL_FALSE; - } - - if (pAsm->vfetch_instruction_ptr_array[element] != NULL) - { - return GL_FALSE; - } - else - { - pAsm->vfetch_instruction_ptr_array[element] = vfetch_instruction_ptr; - } - } - - return GL_TRUE; -} - -GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm) -{ - GLint i; - pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; - pAsm->cf_current_vtx_clause_ptr = NULL; - - for (i=0; i<VERT_ATTRIB_MAX; i++) - { - pAsm->vfetch_instruction_ptr_array[ i ] = NULL; - } - - cleanup_vfetch_shaderinst(pAsm->pR700Shader); - - return GL_TRUE; -} - -GLuint gethelpr(r700_AssemblerBase* pAsm) -{ - GLuint r = pAsm->uHelpReg; - pAsm->uHelpReg++; - if (pAsm->uHelpReg > pAsm->number_used_registers) - { - pAsm->number_used_registers = pAsm->uHelpReg; - } - return r; -} -void resethelpr(r700_AssemblerBase* pAsm) -{ - pAsm->uHelpReg = pAsm->uFirstHelpReg; -} - -void checkop_init(r700_AssemblerBase* pAsm) -{ - resethelpr(pAsm); - pAsm->aArgSubst[0] = - pAsm->aArgSubst[1] = - pAsm->aArgSubst[2] = - pAsm->aArgSubst[3] = -1; -} - -static GLboolean next_ins(r700_AssemblerBase *pAsm) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - if (GL_TRUE == pAsm->is_tex) - { - if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) - { - if (GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE)) - { - radeon_error("Error assembling TEX instruction\n"); - return GL_FALSE; - } - } - else - { - if (GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE)) - { - radeon_error("Error assembling TEX instruction\n"); - return GL_FALSE; - } - } - } - else - { //ALU - if (GL_FALSE == assemble_alu_instruction(pAsm)) - { - radeon_error("Error assembling ALU instruction\n"); - return GL_FALSE; - } - } - - if (pAsm->D.dst.rtype == DST_REG_OUT) - { - assert(pAsm->D.dst.reg >= pAsm->starting_export_register_number); - } - - //reset for next inst. - pAsm->D.bits = 0; - pAsm->D2.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; - pAsm->D2.bits = 0; - pAsm->C[0].bits = pAsm->C[1].bits = pAsm->C[2].bits = pAsm->C[3].bits = 0; - return GL_TRUE; -} - -GLboolean mov_temp(r700_AssemblerBase* pAsm, int src) -{ - GLuint tmp = gethelpr(pAsm); - - //mov src to temp helper gpr. - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - nomask_PVSDST(&(pAsm->D.dst)); - - if( GL_FALSE == assemble_src(pAsm, src, 0) ) - { - return GL_FALSE; - } - - noswizzle_PVSSRC(&(pAsm->S[0].src)); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->aArgSubst[1 + src] = tmp; - - return GL_TRUE; -} - -GLboolean checkop1(r700_AssemblerBase* pAsm) -{ - checkop_init(pAsm); - return GL_TRUE; -} - -GLboolean checkop2(r700_AssemblerBase* pAsm) -{ - GLboolean bSrcConst[2]; - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - checkop_init(pAsm); - - if( (pILInst->SrcReg[0].File == PROGRAM_UNIFORM) || - (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || - (pILInst->SrcReg[0].File == PROGRAM_LOCAL_PARAM) || - (pILInst->SrcReg[0].File == PROGRAM_ENV_PARAM) || - (pILInst->SrcReg[0].File == PROGRAM_STATE_VAR) ) - { - bSrcConst[0] = GL_TRUE; - } - else - { - bSrcConst[0] = GL_FALSE; - } - if( (pILInst->SrcReg[1].File == PROGRAM_UNIFORM) || - (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || - (pILInst->SrcReg[1].File == PROGRAM_LOCAL_PARAM) || - (pILInst->SrcReg[1].File == PROGRAM_ENV_PARAM) || - (pILInst->SrcReg[1].File == PROGRAM_STATE_VAR) ) - { - bSrcConst[1] = GL_TRUE; - } - else - { - bSrcConst[1] = GL_FALSE; - } - - if( (bSrcConst[0] == GL_TRUE) && (bSrcConst[1] == GL_TRUE) ) - { - if(pILInst->SrcReg[0].Index != pILInst->SrcReg[1].Index) - { - if( GL_FALSE == mov_temp(pAsm, 1) ) - { - return GL_FALSE; - } - } - } - - return GL_TRUE; -} - -GLboolean checkop3(r700_AssemblerBase* pAsm) -{ - GLboolean bSrcConst[3]; - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - checkop_init(pAsm); - - if( (pILInst->SrcReg[0].File == PROGRAM_UNIFORM) || - (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || - (pILInst->SrcReg[0].File == PROGRAM_LOCAL_PARAM) || - (pILInst->SrcReg[0].File == PROGRAM_ENV_PARAM) || - (pILInst->SrcReg[0].File == PROGRAM_STATE_VAR) ) - { - bSrcConst[0] = GL_TRUE; - } - else - { - bSrcConst[0] = GL_FALSE; - } - if( (pILInst->SrcReg[1].File == PROGRAM_UNIFORM) || - (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || - (pILInst->SrcReg[1].File == PROGRAM_LOCAL_PARAM) || - (pILInst->SrcReg[1].File == PROGRAM_ENV_PARAM) || - (pILInst->SrcReg[1].File == PROGRAM_STATE_VAR) ) - { - bSrcConst[1] = GL_TRUE; - } - else - { - bSrcConst[1] = GL_FALSE; - } - if( (pILInst->SrcReg[2].File == PROGRAM_UNIFORM) || - (pILInst->SrcReg[2].File == PROGRAM_CONSTANT) || - (pILInst->SrcReg[2].File == PROGRAM_LOCAL_PARAM) || - (pILInst->SrcReg[2].File == PROGRAM_ENV_PARAM) || - (pILInst->SrcReg[2].File == PROGRAM_STATE_VAR) ) - { - bSrcConst[2] = GL_TRUE; - } - else - { - bSrcConst[2] = GL_FALSE; - } - - if( (GL_TRUE == bSrcConst[0]) && - (GL_TRUE == bSrcConst[1]) && - (GL_TRUE == bSrcConst[2]) ) - { - if( GL_FALSE == mov_temp(pAsm, 1) ) - { - return GL_FALSE; - } - if( GL_FALSE == mov_temp(pAsm, 2) ) - { - return GL_FALSE; - } - - return GL_TRUE; - } - else if( (GL_TRUE == bSrcConst[0]) && - (GL_TRUE == bSrcConst[1]) ) - { - if(pILInst->SrcReg[0].Index != pILInst->SrcReg[1].Index) - { - if( GL_FALSE == mov_temp(pAsm, 1) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; - } - else if ( (GL_TRUE == bSrcConst[0]) && - (GL_TRUE == bSrcConst[2]) ) - { - if(pILInst->SrcReg[0].Index != pILInst->SrcReg[2].Index) - { - if( GL_FALSE == mov_temp(pAsm, 2) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; - } - else if( (GL_TRUE == bSrcConst[1]) && - (GL_TRUE == bSrcConst[2]) ) - { - if(pILInst->SrcReg[1].Index != pILInst->SrcReg[2].Index) - { - if( GL_FALSE == mov_temp(pAsm, 2) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; - } - - return GL_TRUE; -} - -GLboolean assemble_src(r700_AssemblerBase *pAsm, - int src, - int fld) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - if (fld == -1) - { - fld = src; - } - - if(pAsm->aArgSubst[1+src] >= 0) - { - assert(fld >= 0); - setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); - pAsm->S[fld].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[fld].src.reg = pAsm->aArgSubst[1+src]; - } - else - { - if (1 == pILInst->SrcReg[src].RelAddr) - { - setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_RELATIVE_A0); - } - else - { - setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); - } - switch (pILInst->SrcReg[src].File) - { - case PROGRAM_TEMPORARY: - pAsm->S[fld].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[fld].src.reg = pILInst->SrcReg[src].Index + pAsm->starting_temp_register_number; - break; - case PROGRAM_CONSTANT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_STATE_VAR: - case PROGRAM_UNIFORM: - pAsm->S[fld].src.rtype = SRC_REG_CONSTANT; - if(pILInst->SrcReg[src].Index < 0) - { - WARN_ONCE("Negative register offsets not supported yet!\n"); - pAsm->S[fld].src.reg = 0; - } - else - { - pAsm->S[fld].src.reg = pILInst->SrcReg[src].Index; - } - break; - case PROGRAM_INPUT: - pAsm->S[fld].src.rtype = SRC_REG_GPR; - switch (pAsm->currentShaderType) - { - case SPT_FP: - pAsm->S[fld].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[src].Index]; - break; - case SPT_VP: - pAsm->S[fld].src.reg = pAsm->ucVP_AttributeMap[pILInst->SrcReg[src].Index]; - break; - } - break; - case PROGRAM_OUTPUT: - pAsm->S[fld].src.rtype = SRC_REG_GPR; - switch (pAsm->currentShaderType) - { - case SPT_FP: - pAsm->S[fld].src.reg = pAsm->uiFP_OutputMap[pILInst->SrcReg[src].Index]; - break; - case SPT_VP: - pAsm->S[fld].src.reg = pAsm->ucVP_OutputMap[pILInst->SrcReg[src].Index]; - break; - } - break; - default: - radeon_error("Invalid source argument type : %d \n", pILInst->SrcReg[src].File); - return GL_FALSE; - } - } - - pAsm->S[fld].src.swizzlex = pILInst->SrcReg[src].Swizzle & 0x7; - pAsm->S[fld].src.swizzley = (pILInst->SrcReg[src].Swizzle >> 3) & 0x7; - pAsm->S[fld].src.swizzlez = (pILInst->SrcReg[src].Swizzle >> 6) & 0x7; - pAsm->S[fld].src.swizzlew = (pILInst->SrcReg[src].Swizzle >> 9) & 0x7; - - pAsm->S[fld].src.negx = pILInst->SrcReg[src].Negate & 0x1; - pAsm->S[fld].src.negy = (pILInst->SrcReg[src].Negate >> 1) & 0x1; - pAsm->S[fld].src.negz = (pILInst->SrcReg[src].Negate >> 2) & 0x1; - pAsm->S[fld].src.negw = (pILInst->SrcReg[src].Negate >> 3) & 0x1; - - return GL_TRUE; -} - -GLboolean assemble_dst(r700_AssemblerBase *pAsm) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - switch (pILInst->DstReg.File) - { - case PROGRAM_TEMPORARY: - if (1 == pILInst->DstReg.RelAddr) - { - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_RELATIVE_A0); - } - else - { - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - } - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = pILInst->DstReg.Index + pAsm->starting_temp_register_number; - break; - case PROGRAM_ADDRESS: - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_A0; - pAsm->D.dst.reg = 0; - break; - case PROGRAM_OUTPUT: - if (1 == pILInst->DstReg.RelAddr) - { - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_RELATIVE_A0); - } - else - { - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - } - pAsm->D.dst.rtype = DST_REG_OUT; - switch (pAsm->currentShaderType) - { - case SPT_FP: - pAsm->D.dst.reg = pAsm->uiFP_OutputMap[pILInst->DstReg.Index]; - break; - case SPT_VP: - pAsm->D.dst.reg = pAsm->ucVP_OutputMap[pILInst->DstReg.Index]; - break; - } - break; - default: - radeon_error("Invalid destination output argument type\n"); - return GL_FALSE; - } - - pAsm->D.dst.writex = pILInst->DstReg.WriteMask & 0x1; - pAsm->D.dst.writey = (pILInst->DstReg.WriteMask >> 1) & 0x1; - pAsm->D.dst.writez = (pILInst->DstReg.WriteMask >> 2) & 0x1; - pAsm->D.dst.writew = (pILInst->DstReg.WriteMask >> 3) & 0x1; - - if(pILInst->SaturateMode == SATURATE_ZERO_ONE) - { - pAsm->D2.dst2.SaturateMode = 1; - } - else - { - pAsm->D2.dst2.SaturateMode = 0; - } - - return GL_TRUE; -} - -GLboolean tex_dst(r700_AssemblerBase *pAsm) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - if(PROGRAM_TEMPORARY == pILInst->DstReg.File) - { - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = pAsm->pILInst[pAsm->uiCurInst].DstReg.Index + pAsm->starting_temp_register_number; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - } - else if(PROGRAM_OUTPUT == pILInst->DstReg.File) - { - pAsm->D.dst.rtype = DST_REG_OUT; - switch (pAsm->currentShaderType) - { - case SPT_FP: - pAsm->D.dst.reg = pAsm->uiFP_OutputMap[pILInst->DstReg.Index]; - break; - case SPT_VP: - pAsm->D.dst.reg = pAsm->ucVP_OutputMap[pILInst->DstReg.Index]; - break; - } - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - } - else - { - radeon_error("Invalid destination output argument type\n"); - return GL_FALSE; - } - - pAsm->D.dst.writex = pILInst->DstReg.WriteMask & 0x1; - pAsm->D.dst.writey = (pILInst->DstReg.WriteMask >> 1) & 0x1; - pAsm->D.dst.writez = (pILInst->DstReg.WriteMask >> 2) & 0x1; - pAsm->D.dst.writew = (pILInst->DstReg.WriteMask >> 3) & 0x1; - - return GL_TRUE; -} - -GLboolean tex_src(r700_AssemblerBase *pAsm) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - GLboolean bValidTexCoord = GL_FALSE; - - if(pAsm->aArgSubst[1] >= 0) - { - bValidTexCoord = GL_TRUE; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->aArgSubst[1]; - } - else - { - switch (pILInst->SrcReg[0].File) { - case PROGRAM_UNIFORM: - case PROGRAM_CONSTANT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_STATE_VAR: - break; - case PROGRAM_TEMPORARY: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + - pAsm->starting_temp_register_number; - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - break; - case PROGRAM_INPUT: - if(SPT_VP == pAsm->currentShaderType) - { - switch (pILInst->SrcReg[0].Index) - { - case VERT_ATTRIB_TEX0: - case VERT_ATTRIB_TEX1: - case VERT_ATTRIB_TEX2: - case VERT_ATTRIB_TEX3: - case VERT_ATTRIB_TEX4: - case VERT_ATTRIB_TEX5: - case VERT_ATTRIB_TEX6: - case VERT_ATTRIB_TEX7: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = - pAsm->ucVP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_GPR; - break; - } - } - else - { - switch (pILInst->SrcReg[0].Index) - { - case FRAG_ATTRIB_WPOS: - case FRAG_ATTRIB_COL0: - case FRAG_ATTRIB_COL1: - case FRAG_ATTRIB_FOGC: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = - pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_GPR; - break; - case FRAG_ATTRIB_FACE: - fprintf(stderr, "FRAG_ATTRIB_FACE unsupported\n"); - break; - case FRAG_ATTRIB_PNTC: - fprintf(stderr, "FRAG_ATTRIB_PNTC unsupported\n"); - break; - } - - if( (pILInst->SrcReg[0].Index >= FRAG_ATTRIB_VAR0) || - (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) ) - { - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = - pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_GPR; - } - } - - break; - } - } - - if(GL_TRUE == bValidTexCoord) - { - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - } - else - { - radeon_error("Invalid source texcoord for TEX instruction\n"); - return GL_FALSE; - } - - pAsm->S[0].src.swizzlex = pILInst->SrcReg[0].Swizzle & 0x7; - pAsm->S[0].src.swizzley = (pILInst->SrcReg[0].Swizzle >> 3) & 0x7; - pAsm->S[0].src.swizzlez = (pILInst->SrcReg[0].Swizzle >> 6) & 0x7; - pAsm->S[0].src.swizzlew = (pILInst->SrcReg[0].Swizzle >> 9) & 0x7; - - pAsm->S[0].src.negx = pILInst->SrcReg[0].Negate & 0x1; - pAsm->S[0].src.negy = (pILInst->SrcReg[0].Negate >> 1) & 0x1; - pAsm->S[0].src.negz = (pILInst->SrcReg[0].Negate >> 2) & 0x1; - pAsm->S[0].src.negw = (pILInst->SrcReg[0].Negate >> 3) & 0x1; - - return GL_TRUE; -} - -GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalized) -{ - PVSSRC * texture_coordinate_source; - PVSSRC * texture_unit_source; - - R700TextureInstruction* tex_instruction_ptr = (R700TextureInstruction*) CALLOC_STRUCT(R700TextureInstruction); - if (tex_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700TextureInstruction(tex_instruction_ptr); - - texture_coordinate_source = &(pAsm->S[0].src); - texture_unit_source = &(pAsm->S[1].src); - - if(8 == pAsm->unAsic) /* evergreen */ - { - - SETfield(tex_instruction_ptr->m_Word0.val, pAsm->D.dst.opcode, - EG_TEX_WORD0__TEX_INST_shift, - EG_TEX_WORD0__TEX_INST_mask); - - if( (SQ_TEX_INST_GET_GRADIENTS_H == pAsm->D.dst.opcode) - ||(SQ_TEX_INST_GET_GRADIENTS_V == pAsm->D.dst.opcode) ) - { - /* Use fine texel derivative calculation rather than use quad derivative */ - SETfield(tex_instruction_ptr->m_Word0.val, 1, - EG_TEX_WORD0__INST_MOD_shift, - EG_TEX_WORD0__INST_MOD_mask); - } - else - { - SETfield(tex_instruction_ptr->m_Word0.val, 0, - EG_TEX_WORD0__INST_MOD_shift, - EG_TEX_WORD0__INST_MOD_mask); - } - - CLEARbit(tex_instruction_ptr->m_Word0.val, EG_TEX_WORD0__FWQ_bit); - - if(SPT_VP == pAsm->currentShaderType) - { - SETfield(tex_instruction_ptr->m_Word0.val, (texture_unit_source->reg + VERT_ATTRIB_MAX), - EG_TEX_WORD0__RESOURCE_ID_shift, - EG_TEX_WORD0__RESOURCE_ID_mask); - pAsm->unVetTexBits |= 1 << texture_unit_source->reg; - } - else - { - SETfield(tex_instruction_ptr->m_Word0.val, texture_unit_source->reg, - EG_TEX_WORD0__RESOURCE_ID_shift, - EG_TEX_WORD0__RESOURCE_ID_mask); - } - - CLEARbit(tex_instruction_ptr->m_Word0.val, EG_TEX_WORD0__ALT_CONST_bit); - SETfield(tex_instruction_ptr->m_Word0.val, 0, - EG_TEX_WORD0__RIM_shift, - EG_TEX_WORD0__RIM_mask); - SETfield(tex_instruction_ptr->m_Word0.val, 0, - EG_TEX_WORD0__SIM_shift, - EG_TEX_WORD0__SIM_mask); - } - else - { - tex_instruction_ptr->m_Word0.f.tex_inst = pAsm->D.dst.opcode; - tex_instruction_ptr->m_Word0.f.bc_frac_mode = 0x0; - tex_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; - tex_instruction_ptr->m_Word0.f.alt_const = 0; - - if(SPT_VP == pAsm->currentShaderType) - { - tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg + VERT_ATTRIB_MAX; - pAsm->unVetTexBits |= 1 << texture_unit_source->reg; - } - else - { - tex_instruction_ptr->m_Word0.f.resource_id = texture_unit_source->reg; - } - } - - tex_instruction_ptr->m_Word1.f.lod_bias = 0x0; - if (normalized) { - tex_instruction_ptr->m_Word1.f.coord_type_x = SQ_TEX_NORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_y = SQ_TEX_NORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_z = SQ_TEX_NORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_w = SQ_TEX_NORMALIZED; - } else { - /* XXX: UNNORMALIZED tex coords have limited wrap modes */ - tex_instruction_ptr->m_Word1.f.coord_type_x = SQ_TEX_UNNORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_y = SQ_TEX_UNNORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_z = SQ_TEX_UNNORMALIZED; - tex_instruction_ptr->m_Word1.f.coord_type_w = SQ_TEX_UNNORMALIZED; - } - - tex_instruction_ptr->m_Word2.f.offset_x = 0x0; - tex_instruction_ptr->m_Word2.f.offset_y = 0x0; - tex_instruction_ptr->m_Word2.f.offset_z = 0x0; - tex_instruction_ptr->m_Word2.f.sampler_id = texture_unit_source->reg; - - // dst - if ( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || - (pAsm->D.dst.rtype == DST_REG_OUT) ) - { - if(8 == pAsm->unAsic) /* evergreen */ - { - SETfield(tex_instruction_ptr->m_Word0.val, texture_coordinate_source->reg, - EG_TEX_WORD0__SRC_GPR_shift, - EG_TEX_WORD0__SRC_GPR_mask); - SETfield(tex_instruction_ptr->m_Word0.val, SQ_ABSOLUTE, - EG_TEX_WORD0__SRC_REL_shift, - EG_TEX_WORD0__SRC_REL_bit); - } - else - { - tex_instruction_ptr->m_Word0.f.src_gpr = texture_coordinate_source->reg; - tex_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; - } - - tex_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; - tex_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; - - tex_instruction_ptr->m_Word1.f.dst_sel_x = (pAsm->D.dst.writex ? texture_unit_source->swizzlex : SQ_SEL_MASK); - tex_instruction_ptr->m_Word1.f.dst_sel_y = (pAsm->D.dst.writey ? texture_unit_source->swizzley : SQ_SEL_MASK); - tex_instruction_ptr->m_Word1.f.dst_sel_z = (pAsm->D.dst.writez ? texture_unit_source->swizzlez : SQ_SEL_MASK); - tex_instruction_ptr->m_Word1.f.dst_sel_w = (pAsm->D.dst.writew ? texture_unit_source->swizzlew : SQ_SEL_MASK); - - - tex_instruction_ptr->m_Word2.f.src_sel_x = texture_coordinate_source->swizzlex; - tex_instruction_ptr->m_Word2.f.src_sel_y = texture_coordinate_source->swizzley; - tex_instruction_ptr->m_Word2.f.src_sel_z = texture_coordinate_source->swizzlez; - tex_instruction_ptr->m_Word2.f.src_sel_w = texture_coordinate_source->swizzlew; - } - else - { - radeon_error("Only temp destination registers supported for TEX dest regs.\n"); - return GL_FALSE; - } - - if( GL_FALSE == add_tex_instruction(pAsm, tex_instruction_ptr) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -void initialize(r700_AssemblerBase *pAsm) -{ - GLuint cycle, component; - - for (cycle=0; cycle<NUMBER_OF_CYCLES; cycle++) - { - for (component=0; component<NUMBER_OF_COMPONENTS; component++) - { - pAsm->hw_gpr[cycle][component] = (-1); - } - } - for (component=0; component<NUMBER_OF_COMPONENTS; component++) - { - pAsm->hw_cfile_addr[component] = (-1); - pAsm->hw_cfile_chan[component] = (-1); - } -} - -GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, - int source_index, - PVSSRC* pSource, - BITS scalar_channel_index, - r700_AssemblerBase *pAsm) -{ - BITS src_sel; - BITS src_rel; - BITS src_chan; - BITS src_neg; - - //-------------------------------------------------------------------------- - // Source for operands src0, src1. - // Values [0,127] correspond to GPR[0..127]. - // Values [256,511] correspond to cfile constants c[0..255]. - - //-------------------------------------------------------------------------- - // Other special values are shown in the list below. - - // 248 SQ_ALU_SRC_0: special constant 0.0. - // 249 SQ_ALU_SRC_1: special constant 1.0 float. - - // 250 SQ_ALU_SRC_1_INT: special constant 1 integer. - // 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer. - - // 252 SQ_ALU_SRC_0_5: special constant 0.5 float. - // 253 SQ_ALU_SRC_LITERAL: literal constant. - - // 254 SQ_ALU_SRC_PV: previous vector result. - // 255 SQ_ALU_SRC_PS: previous scalar result. - //-------------------------------------------------------------------------- - - BITS channel_swizzle; - switch (scalar_channel_index) - { - case 0: channel_swizzle = pSource->swizzlex; break; - case 1: channel_swizzle = pSource->swizzley; break; - case 2: channel_swizzle = pSource->swizzlez; break; - case 3: channel_swizzle = pSource->swizzlew; break; - default: channel_swizzle = SQ_SEL_MASK; break; - } - - if(channel_swizzle == SQ_SEL_0) - { - src_sel = SQ_ALU_SRC_0; - } - else if (channel_swizzle == SQ_SEL_1) - { - src_sel = SQ_ALU_SRC_1; - } - else - { - if ( (pSource->rtype == SRC_REG_TEMPORARY) || - (pSource->rtype == SRC_REG_GPR) - ) - { - src_sel = pSource->reg; - } - else if (pSource->rtype == SRC_REG_CONSTANT) - { - /* TODO : 4 const buffers */ - if(GL_TRUE == pAsm->bUseMemConstant) - { - src_sel = pSource->reg + SQ_ALU_SRC_KCACHE0_BASE; - pAsm->kcacheUsed = SQ_ALU_SRC_KCACHE0_BASE; - } - else - { - src_sel = pSource->reg + CFILE_REGISTER_OFFSET; - } - } - else if (pSource->rtype == SRC_REC_LITERAL) - { - src_sel = SQ_ALU_SRC_LITERAL; - } - else - { - radeon_error("Source (%d) register type (%d) not one of TEMP, INPUT, or CONSTANT.\n", - source_index, pSource->rtype); - return GL_FALSE; - } - } - - if( ADDR_ABSOLUTE == addrmode_PVSSRC(pSource) ) - { - src_rel = SQ_ABSOLUTE; - } - else - { - src_rel = SQ_RELATIVE; - } - - switch (channel_swizzle) - { - case SQ_SEL_X: - src_chan = SQ_CHAN_X; - break; - case SQ_SEL_Y: - src_chan = SQ_CHAN_Y; - break; - case SQ_SEL_Z: - src_chan = SQ_CHAN_Z; - break; - case SQ_SEL_W: - src_chan = SQ_CHAN_W; - break; - case SQ_SEL_0: - case SQ_SEL_1: - // Does not matter since src_sel controls - src_chan = SQ_CHAN_X; - break; - default: - radeon_error("Unknown source select value (%d) in assemble_alu_src().\n", channel_swizzle); - return GL_FALSE; - break; - } - - switch (scalar_channel_index) - { - case 0: src_neg = pSource->negx; break; - case 1: src_neg = pSource->negy; break; - case 2: src_neg = pSource->negz; break; - case 3: src_neg = pSource->negw; break; - default: src_neg = 0; break; - } - - switch (source_index) - { - case 0: - assert(alu_instruction_ptr); - alu_instruction_ptr->m_Word0.f.src0_sel = src_sel; - alu_instruction_ptr->m_Word0.f.src0_rel = src_rel; - alu_instruction_ptr->m_Word0.f.src0_chan = src_chan; - alu_instruction_ptr->m_Word0.f.src0_neg = src_neg; - break; - case 1: - assert(alu_instruction_ptr); - alu_instruction_ptr->m_Word0.f.src1_sel = src_sel; - alu_instruction_ptr->m_Word0.f.src1_rel = src_rel; - alu_instruction_ptr->m_Word0.f.src1_chan = src_chan; - alu_instruction_ptr->m_Word0.f.src1_neg = src_neg; - break; - case 2: - assert(alu_instruction_ptr); - alu_instruction_ptr->m_Word1_OP3.f.src2_sel = src_sel; - alu_instruction_ptr->m_Word1_OP3.f.src2_rel = src_rel; - alu_instruction_ptr->m_Word1_OP3.f.src2_chan = src_chan; - alu_instruction_ptr->m_Word1_OP3.f.src2_neg = src_neg; - break; - default: - radeon_error("Only three sources allowed in ALU opcodes.\n"); - return GL_FALSE; - break; - } - - return GL_TRUE; -} - -GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr, - GLuint contiguous_slots_needed) -{ - if( GL_FALSE == check_current_clause(pAsm, CF_ALU_CLAUSE) ) - { - return GL_FALSE; - } - - if ( pAsm->alu_x_opcode != 0 || - pAsm->cf_current_alu_clause_ptr == NULL || - ( (pAsm->cf_current_alu_clause_ptr != NULL) && - (pAsm->cf_current_alu_clause_ptr->m_Word1.f.count >= (GetCFMaxInstructions(pAsm->cf_current_alu_clause_ptr->m_ShaderInstType)-contiguous_slots_needed-1) ) - ) ) - { - - //new cf inst for this clause - pAsm->cf_current_alu_clause_ptr = (R700ControlFlowALUClause*) CALLOC_STRUCT(R700ControlFlowALUClause); - - // link the new cf to cf segment - if(NULL != pAsm->cf_current_alu_clause_ptr) - { - Init_R700ControlFlowALUClause(pAsm->cf_current_alu_clause_ptr); - AddCFInstruction( pAsm->pR700Shader, - (R700ControlFlowInstruction *)pAsm->cf_current_alu_clause_ptr ); - } - else - { - radeon_error("Could not allocate a new ALU CF instruction.\n"); - return GL_FALSE; - } - - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank0 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank1 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_mode0 = SQ_CF_KCACHE_NOP; - - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_mode1 = SQ_CF_KCACHE_NOP; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr0 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr1 = 0x0; - - pAsm->cf_current_alu_clause_ptr->m_Word1.f.count = 0x0; - - if(pAsm->alu_x_opcode != 0) - { - pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = pAsm->alu_x_opcode; - pAsm->alu_x_opcode = 0; - } - else - { - pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ALU; - } - - pAsm->cf_current_alu_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_alu_clause_ptr->m_Word1.f.barrier = 0x1; - } - else - { - pAsm->cf_current_alu_clause_ptr->m_Word1.f.count += (GetInstructionSize(alu_instruction_ptr->m_ShaderInstType) / 2); - } - - /* TODO : handle 4 bufs */ - if( (pAsm->kcacheUsed > 0) && (GL_TRUE == pAsm->bUseMemConstant) ) - { - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank0 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_bank1 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word0.f.kcache_mode0 = SQ_CF_KCACHE_LOCK_2; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_mode1 = SQ_CF_KCACHE_NOP; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr0 = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr1 = 0x0; - } - - // If this clause constains any instruction that is forward dependent on a TEX instruction, - // set the whole_quad_mode for this clause - if ( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) ) - { - pAsm->cf_current_alu_clause_ptr->m_Word1.f.whole_quad_mode = 0x1; - } - - if (pAsm->cf_current_alu_clause_ptr->m_Word1.f.count >= (GetCFMaxInstructions(pAsm->cf_current_alu_clause_ptr->m_ShaderInstType)-1) ) - { - alu_instruction_ptr->m_Word0.f.last = 1; - } - - if(NULL == pAsm->cf_current_alu_clause_ptr->m_pLinkedALUInstruction) - { - pAsm->cf_current_alu_clause_ptr->m_pLinkedALUInstruction = alu_instruction_ptr; - alu_instruction_ptr->m_pLinkedALUClause = pAsm->cf_current_alu_clause_ptr; - } - - AddALUInstruction(pAsm->pR700Shader, alu_instruction_ptr); - - return GL_TRUE; -} - -GLboolean EG_add_ps_interp(r700_AssemblerBase* pAsm) -{ - R700ALUInstruction * alu_instruction_ptr = NULL; - - int ui; - unsigned int uj; - unsigned int unWord0Temp = 0x380C00; - unsigned int unWord1Temp = 0x146B10; //SQ_SEL_X - - if(pAsm->uIIns > 0) - { - for(ui=(pAsm->uIIns-1); ui>=0; ui--) - { - for(uj=0; uj<8; uj++) - { - alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - Init_R700ALUInstruction(alu_instruction_ptr); - alu_instruction_ptr->m_Word0.val = unWord0Temp; - alu_instruction_ptr->m_Word1.val = unWord1Temp; - - if(uj < 4) - { - SETfield(alu_instruction_ptr->m_Word1.val, EG_OP2_INST_INTERP_ZW, - EG_ALU_WORD1_OP2__ALU_INST_shift, EG_ALU_WORD1_OP2__ALU_INST_mask); - } - else - { - SETfield(alu_instruction_ptr->m_Word1.val, EG_OP2_INST_INTERP_XY, - EG_ALU_WORD1_OP2__ALU_INST_shift, EG_ALU_WORD1_OP2__ALU_INST_mask); - } - if( (uj > 1) && (uj < 6) ) - { - SETfield(alu_instruction_ptr->m_Word1.val, 1, - EG_ALU_WORD1_OP2__WRITE_MASK_shift, EG_ALU_WORD1_OP2__WRITE_MASK_bit); - } - else - { - SETfield(alu_instruction_ptr->m_Word1.val, 0, - EG_ALU_WORD1_OP2__WRITE_MASK_shift, EG_ALU_WORD1_OP2__WRITE_MASK_bit); - } - if( (uj > 1) && (uj < 6) ) - { - SETfield(alu_instruction_ptr->m_Word1.val, ui, - EG_ALU_WORD1__DST_GPR_shift, EG_ALU_WORD1__DST_GPR_mask); - } - else - { - SETfield(alu_instruction_ptr->m_Word1.val, 111, - EG_ALU_WORD1__DST_GPR_shift, EG_ALU_WORD1__DST_GPR_mask); - } - - SETfield(alu_instruction_ptr->m_Word1.val, (uj % 4), - EG_ALU_WORD1__DST_CHAN_shift, EG_ALU_WORD1__DST_CHAN_mask); - SETfield(alu_instruction_ptr->m_Word0.val, (1 - (uj % 2)), - EG_ALU_WORD0__SRC0_CHAN_shift, EG_ALU_WORD0__SRC0_CHAN_mask); - SETfield(alu_instruction_ptr->m_Word0.val, (EG_ALU_SRC_PARAM_BASE + ui), - EG_ALU_WORD0__SRC1_SEL_shift, EG_ALU_WORD0__SRC1_SEL_mask); - if(3 == (uj % 4)) - { - SETfield(alu_instruction_ptr->m_Word0.val, 1, - EG_ALU_WORD0__LAST_shift, EG_ALU_WORD0__LAST_bit); - } - - if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, 4) ) - { - return GL_FALSE; - } - } - } - } - - return GL_TRUE; -} - -void get_src_properties(R700ALUInstruction* alu_instruction_ptr, - int source_index, - BITS* psrc_sel, - BITS* psrc_rel, - BITS* psrc_chan, - BITS* psrc_neg) -{ - switch (source_index) - { - case 0: - *psrc_sel = alu_instruction_ptr->m_Word0.f.src0_sel ; - *psrc_rel = alu_instruction_ptr->m_Word0.f.src0_rel ; - *psrc_chan = alu_instruction_ptr->m_Word0.f.src0_chan; - *psrc_neg = alu_instruction_ptr->m_Word0.f.src0_neg ; - break; - - case 1: - *psrc_sel = alu_instruction_ptr->m_Word0.f.src1_sel ; - *psrc_rel = alu_instruction_ptr->m_Word0.f.src1_rel ; - *psrc_chan = alu_instruction_ptr->m_Word0.f.src1_chan; - *psrc_neg = alu_instruction_ptr->m_Word0.f.src1_neg ; - break; - - case 2: - *psrc_sel = alu_instruction_ptr->m_Word1_OP3.f.src2_sel; - *psrc_rel = alu_instruction_ptr->m_Word1_OP3.f.src2_rel; - *psrc_chan = alu_instruction_ptr->m_Word1_OP3.f.src2_chan; - *psrc_neg = alu_instruction_ptr->m_Word1_OP3.f.src2_neg; - break; - } -} - -int is_cfile(BITS sel) -{ - if (sel > 255 && sel < 512) - { - return 1; - } - return 0; -} - -int is_const(BITS sel) -{ - if (is_cfile(sel)) - { - return 1; - } - else if(sel >= SQ_ALU_SRC_0 && sel <= SQ_ALU_SRC_LITERAL) - { - return 1; - } - return 0; -} - -int is_gpr(BITS sel) -{ - if (sel >= 0 && sel < 128) - { - return 1; - } - return 0; -} - -const GLuint BANK_SWIZZLE_VEC[8] = {SQ_ALU_VEC_210, //000 - SQ_ALU_VEC_120, //001 - SQ_ALU_VEC_102, //010 - - SQ_ALU_VEC_201, //011 - SQ_ALU_VEC_012, //100 - SQ_ALU_VEC_021, //101 - - SQ_ALU_VEC_012, //110 - SQ_ALU_VEC_012}; //111 - -const GLuint BANK_SWIZZLE_SCL[8] = {SQ_ALU_SCL_210, //000 - SQ_ALU_SCL_122, //001 - SQ_ALU_SCL_122, //010 - - SQ_ALU_SCL_221, //011 - SQ_ALU_SCL_212, //100 - SQ_ALU_SCL_122, //101 - - SQ_ALU_SCL_122, //110 - SQ_ALU_SCL_122}; //111 - -GLboolean reserve_cfile(r700_AssemblerBase* pAsm, - GLuint sel, - GLuint chan) -{ - int res_match = (-1); - int res_empty = (-1); - - GLint res; - - for (res=3; res>=0; res--) - { - if(pAsm->hw_cfile_addr[ res] < 0) - { - res_empty = res; - } - else if( (pAsm->hw_cfile_addr[res] == (int)sel) - && - (pAsm->hw_cfile_chan[ res ] == (int) chan) ) - { - res_match = res; - } - } - - if(res_match >= 0) - { - // Read for this scalar component already reserved, nothing to do here. - ; - } - else if(res_empty >= 0) - { - pAsm->hw_cfile_addr[ res_empty ] = sel; - pAsm->hw_cfile_chan[ res_empty ] = chan; - } - else - { - radeon_error("All cfile read ports are used, cannot reference C$sel, channel $chan.\n"); - return GL_FALSE; - } - return GL_TRUE; -} - -GLboolean reserve_gpr(r700_AssemblerBase* pAsm, GLuint sel, GLuint chan, GLuint cycle) -{ - if(pAsm->hw_gpr[cycle][chan] < 0) - { - pAsm->hw_gpr[cycle][chan] = sel; - } - else if(pAsm->hw_gpr[cycle][chan] != (int)sel) - { - radeon_error("Another scalar operation has already used GPR read port for given channel\n"); - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean cycle_for_scalar_bank_swizzle(const int swiz, const int sel, GLuint* pCycle) -{ - switch (swiz) - { - case SQ_ALU_SCL_210: - { - int table[3] = {2, 1, 0}; - *pCycle = table[sel]; - return GL_TRUE; - } - break; - case SQ_ALU_SCL_122: - { - int table[3] = {1, 2, 2}; - *pCycle = table[sel]; - return GL_TRUE; - } - break; - case SQ_ALU_SCL_212: - { - int table[3] = {2, 1, 2}; - *pCycle = table[sel]; - return GL_TRUE; - } - break; - case SQ_ALU_SCL_221: - { - int table[3] = {2, 2, 1}; - *pCycle = table[sel]; - return GL_TRUE; - } - break; - default: - radeon_error("Bad Scalar bank swizzle value\n"); - break; - } - - return GL_FALSE; -} - -GLboolean cycle_for_vector_bank_swizzle(const int swiz, const int sel, GLuint* pCycle) -{ - switch (swiz) - { - case SQ_ALU_VEC_012: - { - int table[3] = {0, 1, 2}; - *pCycle = table[sel]; - } - break; - case SQ_ALU_VEC_021: - { - int table[3] = {0, 2, 1}; - *pCycle = table[sel]; - } - break; - case SQ_ALU_VEC_120: - { - int table[3] = {1, 2, 0}; - *pCycle = table[sel]; - } - break; - case SQ_ALU_VEC_102: - { - int table[3] = {1, 0, 2}; - *pCycle = table[sel]; - } - break; - case SQ_ALU_VEC_201: - { - int table[3] = {2, 0, 1}; - *pCycle = table[sel]; - } - break; - case SQ_ALU_VEC_210: - { - int table[3] = {2, 1, 0}; - *pCycle = table[sel]; - } - break; - default: - radeon_error("Bad Vec bank swizzle value\n"); - return GL_FALSE; - break; - } - - return GL_TRUE; -} - -GLboolean check_scalar(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr) -{ - GLuint cycle; - GLuint bank_swizzle; - GLuint const_count = 0; - - BITS sel; - BITS chan; - BITS rel; - BITS neg; - - GLuint src; - - BITS src_sel [3] = {0,0,0}; - BITS src_chan[3] = {0,0,0}; - BITS src_rel [3] = {0,0,0}; - BITS src_neg [3] = {0,0,0}; - - GLuint swizzle_key; - GLuint number_of_operands; - - if(8 == pAsm->unAsic) - { - number_of_operands = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - else - { - number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - - for (src=0; src<number_of_operands; src++) - { - get_src_properties(alu_instruction_ptr, - src, - &(src_sel[src]), - &(src_rel[src]), - &(src_chan[src]), - &(src_neg[src]) ); - } - - - swizzle_key = ( (is_const( src_sel[0] ) ? 4 : 0) + - (is_const( src_sel[1] ) ? 2 : 0) + - (is_const( src_sel[2] ) ? 1 : 0) ); - - alu_instruction_ptr->m_Word1.f.bank_swizzle = BANK_SWIZZLE_SCL[ swizzle_key ]; - - for (src=0; src<number_of_operands; src++) - { - sel = src_sel [src]; - chan = src_chan[src]; - rel = src_rel [src]; - neg = src_neg [src]; - - if (is_const( sel )) - { - // Any constant, including literal and inline constants - const_count++; - - if (is_cfile( sel )) - { - reserve_cfile(pAsm, sel, chan); - } - - } - } - - for (src=0; src<number_of_operands; src++) - { - sel = src_sel [src]; - chan = src_chan[src]; - rel = src_rel [src]; - neg = src_neg [src]; - - if( is_gpr(sel) ) - { - bank_swizzle = alu_instruction_ptr->m_Word1.f.bank_swizzle; - - if( GL_FALSE == cycle_for_scalar_bank_swizzle(bank_swizzle, src, &cycle) ) - { - return GL_FALSE; - } - - if(cycle < const_count) - { - if( GL_FALSE == reserve_gpr(pAsm, sel, chan, cycle) ) - { - return GL_FALSE; - } - } - } - } - - return GL_TRUE; -} - -GLboolean check_vector(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr) -{ - GLuint cycle; - GLuint bank_swizzle; - GLuint const_count = 0; - - GLuint src; - - BITS sel; - BITS chan; - BITS rel; - BITS neg; - - BITS src_sel [3] = {0,0,0}; - BITS src_chan[3] = {0,0,0}; - BITS src_rel [3] = {0,0,0}; - BITS src_neg [3] = {0,0,0}; - - GLuint swizzle_key; - GLuint number_of_operands; - - if(8 == pAsm->unAsic) - { - number_of_operands = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - else - { - number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - - for (src=0; src<number_of_operands; src++) - { - get_src_properties(alu_instruction_ptr, - src, - &(src_sel[src]), - &(src_rel[src]), - &(src_chan[src]), - &(src_neg[src]) ); - } - - - swizzle_key = ( (is_const( src_sel[0] ) ? 4 : 0) + - (is_const( src_sel[1] ) ? 2 : 0) + - (is_const( src_sel[2] ) ? 1 : 0) - ); - - alu_instruction_ptr->m_Word1.f.bank_swizzle = BANK_SWIZZLE_VEC[swizzle_key]; - - for (src=0; src<number_of_operands; src++) - { - sel = src_sel [src]; - chan = src_chan[src]; - rel = src_rel [src]; - neg = src_neg [src]; - - - bank_swizzle = alu_instruction_ptr->m_Word1.f.bank_swizzle; - - if( is_gpr(sel) ) - { - if( GL_FALSE == cycle_for_vector_bank_swizzle(bank_swizzle, src, &cycle) ) - { - return GL_FALSE; - } - - if ( (src == 1) && - (sel == src_sel[0]) && - (chan == src_chan[0]) ) - { - } - else - { - if( GL_FALSE == reserve_gpr(pAsm, sel, chan, cycle) ) - { - return GL_FALSE; - } - } - } - else if( is_const(sel) ) - { - const_count++; - - if( is_cfile(sel) ) - { - if( GL_FALSE == reserve_cfile(pAsm, sel, chan) ) - { - return GL_FALSE; - } - } - } - } - - return GL_TRUE; -} - -GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) -{ - R700ALUInstruction * alu_instruction_ptr = NULL; - R700ALUInstructionHalfLiteral * alu_instruction_ptr_hl; - R700ALUInstructionFullLiteral * alu_instruction_ptr_fl; - - GLuint number_of_scalar_operations; - GLboolean is_single_scalar_operation; - GLuint scalar_channel_index; - - PVSSRC * pcurrent_source; - int current_source_index; - GLuint contiguous_slots_needed; - GLuint uNumSrc; - GLboolean bSplitInst; - - if(8 == pAsm->unAsic) - { - uNumSrc = EG_GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - else - { - uNumSrc = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); - } - - //GLuint channel_swizzle, j; - //GLuint chan_counter[4] = {0, 0, 0, 0}; - //PVSSRC * pSource[3]; - bSplitInst = GL_FALSE; - pAsm->kcacheUsed = 0; - - if (1 == pAsm->D.dst.math) - { - is_single_scalar_operation = GL_TRUE; - number_of_scalar_operations = 1; - } - else - { - is_single_scalar_operation = GL_FALSE; - number_of_scalar_operations = 4; - -/* current assembler doesn't do more than 1 register per source */ -#if 0 - /* check read port, only very preliminary algorithm, not count in - src0/1 same comp case and prev slot repeat case; also not count relative - addressing. TODO: improve performance. */ - for(j=0; j<uNumSrc; j++) - { - pSource[j] = &(pAsm->S[j].src); - } - for(scalar_channel_index=0; scalar_channel_index<4; scalar_channel_index++) - { - for(j=0; j<uNumSrc; j++) - { - switch (scalar_channel_index) - { - case 0: channel_swizzle = pSource[j]->swizzlex; break; - case 1: channel_swizzle = pSource[j]->swizzley; break; - case 2: channel_swizzle = pSource[j]->swizzlez; break; - case 3: channel_swizzle = pSource[j]->swizzlew; break; - default: channel_swizzle = SQ_SEL_MASK; break; - } - if ( ((pSource[j]->rtype == SRC_REG_TEMPORARY) || - (pSource[j]->rtype == SRC_REG_GPR)) - && (channel_swizzle <= SQ_SEL_W) ) - { - chan_counter[channel_swizzle]++; - } - } - } - if( (chan_counter[SQ_SEL_X] > 3) - || (chan_counter[SQ_SEL_Y] > 3) - || (chan_counter[SQ_SEL_Z] > 3) - || (chan_counter[SQ_SEL_W] > 3) ) /* each chan bank has only 3 ports. */ - { - bSplitInst = GL_TRUE; - } -#endif - } - - contiguous_slots_needed = 0; - - if(!is_single_scalar_operation) - { - contiguous_slots_needed = 4; - } - - contiguous_slots_needed += pAsm->D2.dst2.literal_slots; - - initialize(pAsm); - - for (scalar_channel_index=0; - scalar_channel_index < number_of_scalar_operations; - scalar_channel_index++) - { - if(scalar_channel_index == (number_of_scalar_operations-1)) - { - switch(pAsm->D2.dst2.literal_slots) - { - case 0: - alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - Init_R700ALUInstruction(alu_instruction_ptr); - break; - case 1: - alu_instruction_ptr_hl = (R700ALUInstructionHalfLiteral*) CALLOC_STRUCT(R700ALUInstructionHalfLiteral); - Init_R700ALUInstructionHalfLiteral(alu_instruction_ptr_hl, pAsm->C[0].f, pAsm->C[1].f); - alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_hl; - break; - case 2: - alu_instruction_ptr_fl = (R700ALUInstructionFullLiteral*) CALLOC_STRUCT(R700ALUInstructionFullLiteral); - Init_R700ALUInstructionFullLiteral(alu_instruction_ptr_fl,pAsm->C[0].f, pAsm->C[1].f, pAsm->C[2].f, pAsm->C[3].f); - alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_fl; - break; - }; - } - else - { - alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - Init_R700ALUInstruction(alu_instruction_ptr); - } - - //src 0 - current_source_index = 0; - pcurrent_source = &(pAsm->S[0].src); - - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index, - pAsm) ) - { - return GL_FALSE; - } - - if (uNumSrc > 1) - { - // Process source 1 - current_source_index = 1; - pcurrent_source = &(pAsm->S[current_source_index].src); - - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index, - pAsm) ) - { - return GL_FALSE; - } - } - - //other bits - alu_instruction_ptr->m_Word0.f.index_mode = pAsm->D2.dst2.index_mode; - - if( (is_single_scalar_operation == GL_TRUE) - || (GL_TRUE == bSplitInst) ) - { - alu_instruction_ptr->m_Word0.f.last = 1; - } - else - { - alu_instruction_ptr->m_Word0.f.last = (scalar_channel_index == 3) ? 1 : 0; - } - - alu_instruction_ptr->m_Word0.f.pred_sel = (pAsm->D.dst.pred_inv > 0) ? 1 : 0; - if(1 == pAsm->D.dst.predicated) - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; - } - - // dst - if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || - (pAsm->D.dst.rtype == DST_REG_OUT) ) - { - alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; - } - else - { - radeon_error("Only temp destination registers supported for ALU dest regs.\n"); - return GL_FALSE; - } - - if ( ADDR_RELATIVE_A0 == addrmode_PVSDST(&(pAsm->D.dst)) ) - { - alu_instruction_ptr->m_Word1.f.dst_rel = SQ_RELATIVE; - } - else - { - alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; - } - - if ( is_single_scalar_operation == GL_TRUE ) - { - // Override scalar_channel_index since only one scalar value will be written - if(pAsm->D.dst.writex) - { - scalar_channel_index = 0; - } - else if(pAsm->D.dst.writey) - { - scalar_channel_index = 1; - } - else if(pAsm->D.dst.writez) - { - scalar_channel_index = 2; - } - else if(pAsm->D.dst.writew) - { - scalar_channel_index = 3; - } - } - - alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; - - alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; - - if (pAsm->D.dst.op3) - { - //op3 - - alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode; - - //There's 3rd src for op3 - current_source_index = 2; - pcurrent_source = &(pAsm->S[current_source_index].src); - - if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index, - pAsm) ) - { - return GL_FALSE; - } - } - else - { - //op2 - if (pAsm->bR6xx) - { - alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; - - alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = pAsm->S[0].src.abs; - alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = pAsm->S[1].src.abs; - - //alu_instruction_ptr->m_Word1_OP2.f6.update_execute_mask = 0x0; - //alu_instruction_ptr->m_Word1_OP2.f6.update_pred = 0x0; - switch (scalar_channel_index) - { - case 0: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writex; - break; - case 1: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writey; - break; - case 2: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writez; - break; - case 3: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writew; - break; - default: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; //SQ_SEL_MASK; - break; - } - alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; - - alu_instruction_ptr->m_Word1_OP2.f.src0_abs = pAsm->S[0].src.abs; - alu_instruction_ptr->m_Word1_OP2.f.src1_abs = pAsm->S[1].src.abs; - - //alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; - //alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; - switch (scalar_channel_index) - { - case 0: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writex; - break; - case 1: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writey; - break; - case 2: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writez; - break; - case 3: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writew; - break; - default: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; //SQ_SEL_MASK; - break; - } - alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF; - } - } - - if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) - { - return GL_FALSE; - } - - /* - * Judge the type of current instruction, is it vector or scalar - * instruction. - */ - if (is_single_scalar_operation) - { - if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - else - { - if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - - contiguous_slots_needed -= 1; - } - - return GL_TRUE; -} - -GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) -{ - BITS tmp; - - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - // opcode tmp.x, a.x - // MOV dst, tmp.x - - pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_RSQ ) - pAsm->S[0].src.abs = 1; - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // Now replicate result to all necessary channels in destination - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_ABS(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->S[1].bits = pAsm->S[0].bits; - flipneg_PVSSRC(&(pAsm->S[1].src)); - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_ADD(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_SUB) - { - flipneg_PVSSRC(&(pAsm->S[1].src)); - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_ARL(r700_AssemblerBase *pAsm) -{ /* TODO: ar values dont' persist between clauses */ - if( GL_FALSE == checkop1(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - /* Evergreen */ - - /* Float to Signed Integer Using FLOOR */ - pAsm->D.dst.opcode = EG_OP2_INST_FLT_TO_INT_FLOOR; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = 0; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* Copy Signed Integer To Integer in AR and GPR */ - pAsm->D.dst.opcode = EG_OP2_INST_MOVA_INT; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = 0; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - else - { - /* r6xx/r7xx */ - - /* Truncate floating-point to the nearest integer - in the range [-256, +255], and copy to AR and - to a GPR. - */ - pAsm->D.dst.opcode = SQ_OP2_INST_MOVA_FLOOR; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = 0; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean assemble_BAD(char *opcode_str) -{ - radeon_error("Not yet implemented instruction (%s)\n", opcode_str); - return GL_FALSE; -} - -GLboolean assemble_CMP(r700_AssemblerBase *pAsm) -{ - int tmp; - - if( GL_FALSE == checkop3(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_CNDGE; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_CNDGE; - } - pAsm->D.dst.op3 = 1; - - tmp = (-1); - - if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - //OP3 has no support for write mask - tmp = gethelpr(pAsm); - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - nomask_PVSDST(&(pAsm->D.dst)); - } - else - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 2, 1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, 2) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if (0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - //tmp for source - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - noneg_PVSSRC(&(pAsm->S[0].src)); - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode) -{ - /* - * r600 - trunc to -PI..PI range - * r700 - normalize by dividing by 2PI - * see fdo bug 27901 - */ - - int tmp; - checkop1(pAsm); - - tmp = gethelpr(pAsm); - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - assemble_src(pAsm, 0, -1); - - pAsm->S[1].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); - - pAsm->S[2].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y); - - pAsm->D2.dst2.literal_slots = 1; - pAsm->C[0].f = 1/(3.1415926535 * 2); - pAsm->C[1].f = 0.5f; - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_FRACT; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - - if(( GL_FALSE == next_ins(pAsm) )) - { - return GL_FALSE; - } - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - - pAsm->S[1].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); - - pAsm->S[2].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y); - - pAsm->D2.dst2.literal_slots = 1; - - if (pAsm->bR6xx) - { - pAsm->C[0].f = 3.1415926535897f * 2.0f; - pAsm->C[1].f = -3.1415926535897f; - } - else - { - pAsm->C[0].f = 1.0f; - pAsm->C[1].f = -0.5f; - } - - if(( GL_FALSE == next_ins(pAsm) )) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; - - assemble_dst(pAsm); - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - next_ins(pAsm); - - //TODO - replicate if more channels set in WriteMask - return GL_TRUE; - -} - -GLboolean assemble_DOT(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_DOT4; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_DOT4; - } - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if(OPCODE_DP2 == pAsm->pILInst[pAsm->uiCurInst].Opcode) - { - zerocomp_PVSSRC(&(pAsm->S[0].src),2); - zerocomp_PVSSRC(&(pAsm->S[0].src),3); - zerocomp_PVSSRC(&(pAsm->S[1].src),2); - zerocomp_PVSSRC(&(pAsm->S[1].src),3); - } - else if(OPCODE_DP3 == pAsm->pILInst[pAsm->uiCurInst].Opcode) - { - zerocomp_PVSSRC(&(pAsm->S[0].src), 3); - zerocomp_PVSSRC(&(pAsm->S[1].src), 3); - } - else if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_DPH) - { - onecomp_PVSSRC(&(pAsm->S[0].src), 3); - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_DST(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - onecomp_PVSSRC(&(pAsm->S[0].src), 0); - onecomp_PVSSRC(&(pAsm->S[0].src), 3); - - onecomp_PVSSRC(&(pAsm->S[1].src), 0); - onecomp_PVSSRC(&(pAsm->S[1].src), 2); - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_EX2(r700_AssemblerBase *pAsm) -{ - if(8 == pAsm->unAsic) - { - return assemble_math_function(pAsm, EG_OP2_INST_EXP_IEEE); - } - - return assemble_math_function(pAsm, SQ_OP2_INST_EXP_IEEE); -} - -GLboolean assemble_EXP(r700_AssemblerBase *pAsm) -{ - BITS tmp; - - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - // FLOOR tmp.x, a.x - // EX2 dst.x tmp.x - - if (pAsm->pILInst->DstReg.WriteMask & 0x1) { - pAsm->D.dst.opcode = SQ_OP2_INST_FLOOR; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; - } - pAsm->D.dst.math = 1; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - // FRACT dst.y a.x - - if ((pAsm->pILInst->DstReg.WriteMask >> 1) & 0x1) { - pAsm->D.dst.opcode = SQ_OP2_INST_FRACT; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - // EX2 dst.z, a.x - - if ((pAsm->pILInst->DstReg.WriteMask >> 2) & 0x1) { - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; - } - pAsm->D.dst.math = 1; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writew = 0; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - // MOV dst.w 1.0 - - if ((pAsm->pILInst->DstReg.WriteMask >> 3) & 0x1) { - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writez = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_1); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean assemble_FLR(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_FLOOR; - - if ( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm) -{ - if(8 == pAsm->unAsic) - { - return assemble_math_function(pAsm, EG_OP2_INST_FLT_TO_INT); - } - - return assemble_math_function(pAsm, SQ_OP2_INST_FLT_TO_INT); -} - -GLboolean assemble_FRC(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_FRACT; - - if ( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - if(pILInst->Opcode == OPCODE_KIL) - checkop1(pAsm); - - pAsm->D.dst.opcode = opcode; - //pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = 0; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = 0; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if(pILInst->Opcode == OPCODE_KIL_NV) - { - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = 0; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); - neg_PVSSRC(&(pAsm->S[1].src)); - } - else - { - if( GL_FALSE == assemble_src(pAsm, 0, 1) ) - { - return GL_FALSE; - } - - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* Doc says KILL has to be last(end) ALU clause */ - pAsm->pR700Shader->killIsUsed = GL_TRUE; - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - - return GL_TRUE; -} - -GLboolean assemble_LG2(r700_AssemblerBase *pAsm) -{ - if(8 == pAsm->unAsic) - { - return assemble_math_function(pAsm, EG_OP2_INST_LOG_IEEE); - } - - return assemble_math_function(pAsm, SQ_OP2_INST_LOG_IEEE); -} - -GLboolean assemble_LRP(r700_AssemblerBase *pAsm) -{ - BITS tmp; - - if( GL_FALSE == checkop3(pAsm) ) - { - return GL_FALSE; - } - - tmp = gethelpr(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - nomask_PVSDST(&(pAsm->D.dst)); - - - if( GL_FALSE == assemble_src(pAsm, 1, 0) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == assemble_src(pAsm, 2, 1) ) - { - return GL_FALSE; - } - - neg_PVSSRC(&(pAsm->S[1].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - nomask_PVSDST(&(pAsm->D.dst)); - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - - if( GL_FALSE == assemble_src(pAsm, 0, 1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 2, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_LOG(r700_AssemblerBase *pAsm) -{ - BITS tmp1, tmp2, tmp3; - - checkop1(pAsm); - - tmp1 = gethelpr(pAsm); - tmp2 = gethelpr(pAsm); - tmp3 = gethelpr(pAsm); - - // FIXME: The hardware can do fabs() directly on input - // elements, but the compiler doesn't have the - // capability to use that. - - // MAX tmp1.x, a.x, -a.x (fabs(a.x)) - - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - pAsm->D.dst.writex = 1; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->S[1].bits = pAsm->S[0].bits; - flipneg_PVSSRC(&(pAsm->S[1].src)); - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // Entire algo: - // - // LG2 tmp2.x, tmp1.x - // FLOOR tmp3.x, tmp2.x - // MOV dst.x, tmp3.x - // ADD tmp3.x, tmp2.x, -tmp3.x - // EX2 dst.y, tmp3.x - // MOV dst.z, tmp2.x - // MOV dst.w, 1.0 - - // LG2 tmp2.x, tmp1.x - // FLOOR tmp3.x, tmp2.x - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_LOG_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; - } - pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp2; - pAsm->D.dst.writex = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp1; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_FLOOR; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp3; - pAsm->D.dst.writex = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // MOV dst.x, tmp3.x - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp3; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // ADD tmp3.x, tmp2.x, -tmp3.x - // EX2 dst.y, tmp3.x - - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp3; - pAsm->D.dst.writex = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = DST_REG_TEMPORARY; - pAsm->S[1].src.reg = tmp3; - - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); - neg_PVSSRC(&(pAsm->S[1].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; - } - pAsm->D.dst.math = 1; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp3; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // MOV dst.z, tmp2.x - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // MOV dst.w 1.0 - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writez = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp1; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_1); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_MAD(struct r700_AssemblerBase *pAsm) -{ - int tmp, ii; - GLboolean bReplaceDst = GL_FALSE; - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - if( GL_FALSE == checkop3(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - tmp = (-1); - - if(PROGRAM_TEMPORARY == pILInst->DstReg.File) - { /* TODO : more investigation on MAD src and dst using same register */ - for(ii=0; ii<3; ii++) - { - if( (PROGRAM_TEMPORARY == pILInst->SrcReg[ii].File) - && (pILInst->DstReg.Index == pILInst->SrcReg[ii].Index) ) - { - bReplaceDst = GL_TRUE; - break; - } - } - } - if(0xF != pILInst->DstReg.WriteMask) - { /* OP3 has no support for write mask */ - bReplaceDst = GL_TRUE; - } - - if(GL_TRUE == bReplaceDst) - { - tmp = gethelpr(pAsm); - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - nomask_PVSDST(&(pAsm->D.dst)); - } - else - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 2, -1) ) - { - return GL_FALSE; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if (GL_TRUE == bReplaceDst) - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - //tmp for source - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - noneg_PVSSRC(&(pAsm->S[0].src)); - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; -} - -/* LIT dst, src */ -GLboolean assemble_LIT(r700_AssemblerBase *pAsm) -{ - unsigned int dstReg; - unsigned int dstType; - checkop1(pAsm); - int tmp = gethelpr(pAsm); - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - dstReg = pAsm->D.dst.reg; - dstType = pAsm->D.dst.rtype; - - /* dst.xw, <- 1.0 */ - if( pAsm->D.dst.writex || pAsm->D.dst.writew ) - { - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_1; - pAsm->S[0].src.swizzley = SQ_SEL_1; - pAsm->S[0].src.swizzlez = SQ_SEL_1; - pAsm->S[0].src.swizzlew = SQ_SEL_1; - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( pAsm->D.dst.writey ) { - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - /* dst.y = max(src.x, 0.0) */ - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = tmp; - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_0; - pAsm->S[1].src.swizzley = SQ_SEL_0; - pAsm->S[1].src.swizzlez = SQ_SEL_0; - pAsm->S[1].src.swizzlew = SQ_SEL_0; - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - if ( pAsm->D.dst.writez) { - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - /* dst.z = log(src.y) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_LOG_CLAMPED; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; - } - pAsm->D.dst.math = 1; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 1; - pAsm->D.dst.writew = 0; - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y); - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, 2) ) - { - return GL_FALSE; - } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); - - swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); - - /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MUL_LIT; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; - } - pAsm->D.dst.math = 1; - pAsm->D.dst.op3 = 1; - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = dstReg; - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_Z; - pAsm->S[1].src.swizzley = SQ_SEL_Z; - pAsm->S[1].src.swizzlez = SQ_SEL_Z; - pAsm->S[1].src.swizzlew = SQ_SEL_Z; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* dst.z = exp(tmp.x) */ - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; - } - pAsm->D.dst.math = 1; - pAsm->D.dst.writex = 0; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 1; - pAsm->D.dst.writew = 0; - - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_X; - pAsm->S[0].src.swizzley = SQ_SEL_X; - pAsm->S[0].src.swizzlez = SQ_SEL_X; - pAsm->S[0].src.swizzlew = SQ_SEL_X; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - return GL_TRUE; -} - -GLboolean assemble_MAX(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_MIN(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MIN; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_MOV(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if (GL_FALSE == assemble_dst(pAsm)) - { - return GL_FALSE; - } - - if (GL_FALSE == assemble_src(pAsm, 0, -1)) - { - return GL_FALSE; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_MUL(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_POW(r700_AssemblerBase *pAsm) -{ - BITS tmp; - - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - // LG2 tmp.x, a.swizzle - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_LOG_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; - } - pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - nomask_PVSDST(&(pAsm->D.dst)); - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // MUL tmp.x, tmp.x, b.swizzle - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - nomask_PVSDST(&(pAsm->D.dst)); - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // EX2 dst.mask, tmp.x - // EX2 tmp.x, tmp.x - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; - } - pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - nomask_PVSDST(&(pAsm->D.dst)); - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // Now replicate result to all necessary channels in destination - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_RCP(r700_AssemblerBase *pAsm) -{ - if(8 == pAsm->unAsic) - { - return assemble_math_function(pAsm, EG_OP2_INST_RECIP_IEEE); - } - - return assemble_math_function(pAsm, SQ_OP2_INST_RECIP_IEEE); -} - -GLboolean assemble_RSQ(r700_AssemblerBase *pAsm) -{ - if(8 == pAsm->unAsic) - { - return assemble_math_function(pAsm, EG_OP2_INST_RECIPSQRT_IEEE); - } - - return assemble_math_function(pAsm, SQ_OP2_INST_RECIPSQRT_IEEE); -} - -GLboolean assemble_SCS(r700_AssemblerBase *pAsm) -{ - BITS tmp; - - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - assemble_src(pAsm, 0, -1); - - pAsm->S[1].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); - - pAsm->S[2].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y); - - pAsm->D2.dst2.literal_slots = 1; - pAsm->C[0].f = 1/(3.1415926535 * 2); - pAsm->C[1].f = 0.5F; - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_FRACT; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - - if(( GL_FALSE == next_ins(pAsm) )) - { - return GL_FALSE; - } - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - - pAsm->S[1].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); - - pAsm->S[2].src.rtype = SRC_REC_LITERAL; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y); - - pAsm->D2.dst2.literal_slots = 1; - - if(pAsm->bR6xx) { - pAsm->C[0].f = 3.1415926535897f * 2.0f; - pAsm->C[1].f = -3.1415926535897f; - } else { - pAsm->C[0].f = 1.0f; - pAsm->C[1].f = -0.5f; - } - - if(( GL_FALSE == next_ins(pAsm) )) - { - return GL_FALSE; - } - - // COS dst.x, a.x - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_COS; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_COS; - } - pAsm->D.dst.math = 1; - - assemble_dst(pAsm); - /* mask y */ - pAsm->D.dst.writey = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - // SIN dst.y, a.x - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_SIN; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_SIN; - } - pAsm->D.dst.math = 1; - - assemble_dst(pAsm); - /* mask x */ - pAsm->D.dst.writex = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = opcode; - //pAsm->D.dst.math = 1; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; - pAsm->D.dst.predicated = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = pAsm->uHelpReg; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->last_cond_register + pAsm->starting_temp_register_number; - pAsm->S[0].src.swizzlex = pILInst->DstReg.CondSwizzle & 0x7; - noneg_PVSSRC(&(pAsm->S[0].src)); - - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = pAsm->uHelpReg; - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_0; - pAsm->S[1].src.swizzley = SQ_SEL_0; - pAsm->S[1].src.swizzlez = SQ_SEL_0; - pAsm->S[1].src.swizzlew = SQ_SEL_0; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_SGE(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_SETGE; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_SLT(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_SETGT; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, 1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, 0) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_SSG(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); - - GLuint tmp = gethelpr(pAsm); - /* tmp = (src > 0 ? 1 : src) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_CNDGT; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT; - } - pAsm->D.dst.op3 = 1; - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); - - if( GL_FALSE == assemble_src(pAsm, 0, 2) ) - { - return GL_FALSE; - } - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* dst = (-tmp > 0 ? -1 : tmp) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_CNDGT; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT; - } - pAsm->D.dst.op3 = 1; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - neg_PVSSRC(&(pAsm->S[0].src)); - - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); - neg_PVSSRC(&(pAsm->S[1].src)); - - setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); - pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[2].src.reg = tmp; - noswizzle_PVSSRC(&(pAsm->S[2].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - return GL_TRUE; -} - -GLboolean assemble_STP(r700_AssemblerBase *pAsm) -{ - return GL_TRUE; -} - -GLboolean assemble_TEX(r700_AssemblerBase *pAsm) -{ - GLboolean src_const; - GLboolean need_barrier = GL_FALSE; - - checkop1(pAsm); - - switch (pAsm->pILInst[pAsm->uiCurInst].SrcReg[0].File) - { - case PROGRAM_UNIFORM: - case PROGRAM_CONSTANT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_STATE_VAR: - src_const = GL_TRUE; - break; - case PROGRAM_TEMPORARY: - case PROGRAM_INPUT: - default: - src_const = GL_FALSE; - break; - } - - if (GL_TRUE == src_const) - { - if ( GL_FALSE == mov_temp(pAsm, 0) ) - return GL_FALSE; - need_barrier = GL_TRUE; - } - - if (pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) - { - GLuint tmp = gethelpr(pAsm); - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_RECIP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; - } - pAsm->D.dst.math = 1; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writew = 1; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 1; - pAsm->D.dst.writew = 0; - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = tmp; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_W); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - pAsm->aArgSubst[1] = tmp; - need_barrier = GL_TRUE; - } - - if (pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX ) - { - GLuint tmp1 = gethelpr(pAsm); - GLuint tmp2 = gethelpr(pAsm); - - /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_CUBE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_CUBE; - } - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - nomask_PVSDST(&(pAsm->D.dst)); - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 0, 1) ) - { - return GL_FALSE; - } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y); - swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_X, SQ_SEL_Z, SQ_SEL_Z); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* tmp1.z = RCP_e(|tmp1.z|) */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP2_INST_RECIP_IEEE; - } - else - { - pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; - } - pAsm->D.dst.math = 1; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - pAsm->D.dst.writez = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp1; - pAsm->S[0].src.swizzlex = SQ_SEL_Z; - pAsm->S[0].src.abs = 1; - - next_ins(pAsm); - - /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x - * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x - * muladd has no writemask, have to use another temp - */ - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp2; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp1; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = tmp1; - setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z); - setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); - /* immediate c 1.5 */ - pAsm->D2.dst2.literal_slots = 1; - pAsm->C[0].f = 1.5F; - pAsm->S[2].src.rtype = SRC_REC_LITERAL; - pAsm->S[2].src.reg = tmp1; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X); - - next_ins(pAsm); - - /* tmp1.xy = temp2.xy */ - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - next_ins(pAsm); - pAsm->aArgSubst[1] = tmp1; - need_barrier = GL_TRUE; - - } - - switch(pAsm->pILInst[pAsm->uiCurInst].Opcode) - { - case OPCODE_DDX: - /* will these need WQM(1) on CF inst ? */ - pAsm->D.dst.opcode = SQ_TEX_INST_GET_GRADIENTS_H; - break; - case OPCODE_DDY: - pAsm->D.dst.opcode = SQ_TEX_INST_GET_GRADIENTS_V; - break; - case OPCODE_TXB: - /* this should actually be SAMPLE_LB but that needs bias to be - * embedded in the instruction - cant do here */ - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_L; - break; - case OPCODE_TXL: - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_L; - break; - default: - if(pAsm->pILInst[pAsm->uiCurInst].TexShadow == 1) - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_C; - else - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; - } - - pAsm->is_tex = GL_TRUE; - if ( GL_TRUE == need_barrier ) - - pAsm->is_tex = GL_TRUE; - if ( GL_TRUE == need_barrier ) - { - pAsm->need_tex_barrier = GL_TRUE; - } - // Set src1 to tex unit id - pAsm->S[1].src.reg = pAsm->SamplerUnits[pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit]; - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - - //No sw info from mesa compiler, so hard code here. - pAsm->S[1].src.swizzlex = SQ_SEL_X; - pAsm->S[1].src.swizzley = SQ_SEL_Y; - pAsm->S[1].src.swizzlez = SQ_SEL_Z; - pAsm->S[1].src.swizzlew = SQ_SEL_W; - - if( GL_FALSE == tex_dst(pAsm) ) - { - return GL_FALSE; - } - - if( GL_FALSE == tex_src(pAsm) ) - { - return GL_FALSE; - } - - if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) - { - /* hopefully did swizzles before */ - noswizzle_PVSSRC(&(pAsm->S[0].src)); - } - - if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX) - { - /* SAMPLE dst, tmp.yxwy, CUBE */ - pAsm->S[0].src.swizzlex = SQ_SEL_Y; - pAsm->S[0].src.swizzley = SQ_SEL_X; - pAsm->S[0].src.swizzlez = SQ_SEL_W; - pAsm->S[0].src.swizzlew = SQ_SEL_Y; - } - - if(pAsm->pILInst[pAsm->uiCurInst].TexShadow == 1) - { - /* compare value goes to w chan ? */ - pAsm->S[0].src.swizzlew = SQ_SEL_Z; - } - - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - /* add ARB shadow ambient but clamp to 0..1 */ - if(pAsm->pILInst[pAsm->uiCurInst].TexShadow == 1) - { - /* ADD_SAT dst, dst, ambient[texunit] */ - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - pAsm->D2.dst2.SaturateMode = 1; - - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->D.dst.reg; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - noneg_PVSSRC(&(pAsm->S[0].src)); - - pAsm->S[1].src.rtype = SRC_REG_CONSTANT; - pAsm->S[1].src.reg = pAsm->shadow_regs[pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit]; - noswizzle_PVSSRC(&(pAsm->S[1].src)); - noneg_PVSSRC(&(pAsm->S[1].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - } - - return GL_TRUE; -} - -GLboolean assemble_XPD(r700_AssemblerBase *pAsm) -{ - BITS tmp1; - BITS tmp2 = 0; - - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } - - tmp1 = gethelpr(pAsm); - - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - nomask_PVSDST(&(pAsm->D.dst)); - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); - swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - pAsm->D.dst.opcode = EG_OP3_INST_MULADD; - } - else - { - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - } - pAsm->D.dst.op3 = 1; - - if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - tmp2 = gethelpr(pAsm); - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp2; - - nomask_PVSDST(&(pAsm->D.dst)); - } - else - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - } - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); - swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); - - // result1 + (neg) result0 - setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE); - pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[2].src.reg = tmp1; - - neg_PVSSRC(&(pAsm->S[2].src)); - noswizzle_PVSSRC(&(pAsm->S[2].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - - - if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - // Use tmp as source - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - - noneg_PVSSRC(&(pAsm->S[0].src)); - noswizzle_PVSSRC(&(pAsm->S[0].src)); - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) -{ - return GL_TRUE; -} - -static inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason) -{ - switch (uReason) - { - case FC_PUSH_VPM: - pAsm->CALLSTACK[pAsm->CALLSP].current--; - break; - case FC_PUSH_WQM: - pAsm->CALLSTACK[pAsm->CALLSP].current -= 4; - break; - case FC_LOOP: - pAsm->CALLSTACK[pAsm->CALLSP].current -= 4; - break; - case FC_REP: - /* TODO : for 16 vp asic, should -= 2; */ - pAsm->CALLSTACK[pAsm->CALLSP].current -= 1; - break; - }; -} - -static inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly) -{ - if(GL_TRUE == bCheckMaxOnly) - { - switch (uReason) - { - case FC_PUSH_VPM: - if((pAsm->CALLSTACK[pAsm->CALLSP].current + 1) - > pAsm->CALLSTACK[pAsm->CALLSP].max) - { - pAsm->CALLSTACK[pAsm->CALLSP].max = - pAsm->CALLSTACK[pAsm->CALLSP].current + 1; - } - break; - case FC_PUSH_WQM: - if((pAsm->CALLSTACK[pAsm->CALLSP].current + 4) - > pAsm->CALLSTACK[pAsm->CALLSP].max) - { - pAsm->CALLSTACK[pAsm->CALLSP].max = - pAsm->CALLSTACK[pAsm->CALLSP].current + 4; - } - break; - } - return; - } - - switch (uReason) - { - case FC_PUSH_VPM: - pAsm->CALLSTACK[pAsm->CALLSP].current++; - break; - case FC_PUSH_WQM: - pAsm->CALLSTACK[pAsm->CALLSP].current += 4; - break; - case FC_LOOP: - pAsm->CALLSTACK[pAsm->CALLSP].current += 4; - break; - case FC_REP: - /* TODO : for 16 vp asic, should += 2; */ - pAsm->CALLSTACK[pAsm->CALLSP].current += 1; - break; - }; - - if(pAsm->CALLSTACK[pAsm->CALLSP].current - > pAsm->CALLSTACK[pAsm->CALLSP].max) - { - pAsm->CALLSTACK[pAsm->CALLSP].max = - pAsm->CALLSTACK[pAsm->CALLSP].current; - } -} - -GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset) -{ - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_JUMP, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - pops, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + offset; - - return GL_TRUE; -} - -GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops) -{ - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_POP, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - pops, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; - - return GL_TRUE; -} - -GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) -{ - pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - - assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); - - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - if(GL_TRUE != bHasElse) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - } - else - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - } - - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_JUMP, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - if(GL_TRUE != bHasElse) - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - } - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->FCSP++; - pAsm->fc_stack[pAsm->FCSP].type = FC_IF; - pAsm->fc_stack[pAsm->FCSP].mid = NULL; - pAsm->fc_stack[pAsm->FCSP].midLen= 0; - pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; - -#ifndef USE_CF_FOR_POP_AFTER - if(GL_TRUE != bHasElse) - { - pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; - } -#endif /* USE_CF_FOR_POP_AFTER */ - - checkStackDepth(pAsm, FC_PUSH_VPM, GL_FALSE); - - return GL_TRUE; -} - -GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) -{ - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_ELSE, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; /// - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ELSE; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->fc_stack[pAsm->FCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[pAsm->FCSP].mid, - 0, - sizeof(R700ControlFlowGenericClause *) ); - pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr; - //pAsm->fc_stack[pAsm->FCSP].unNumMid = 1; - -#ifndef USE_CF_FOR_POP_AFTER - pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; -#endif /* USE_CF_FOR_POP_AFTER */ - - pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1; - - return GL_TRUE; -} - -GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) -{ -#ifdef USE_CF_FOR_POP_AFTER - pops(pAsm, 1); -#endif /* USE_CF_FOR_POP_AFTER */ - - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - - if(NULL == pAsm->fc_stack[pAsm->FCSP].mid) - { - /* no else in between */ - pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode; - } - else - { - pAsm->fc_stack[pAsm->FCSP].mid[0]->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode; - } - - if(NULL != pAsm->fc_stack[pAsm->FCSP].mid) - { - FREE(pAsm->fc_stack[pAsm->FCSP].mid); - } - - if(pAsm->fc_stack[pAsm->FCSP].type != FC_IF) - { - radeon_error("if/endif in shader code are not paired. \n"); - return GL_FALSE; - } - - pAsm->FCSP--; - - decreaseCurrent(pAsm, FC_PUSH_VPM); - - return GL_TRUE; -} - -GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm) -{ - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_LOOP_START_NO_AL, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_START_NO_AL; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->FCSP++; - pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP; - pAsm->fc_stack[pAsm->FCSP].mid = NULL; - pAsm->fc_stack[pAsm->FCSP].unNumMid = 0; - pAsm->fc_stack[pAsm->FCSP].midLen = 0; - pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; - - checkStackDepth(pAsm, FC_LOOP, GL_FALSE); - - return GL_TRUE; -} - -GLboolean assemble_BRK(r700_AssemblerBase *pAsm) -{ -#ifdef USE_CF_FOR_CONTINUE_BREAK - - pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - - assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); - - unsigned int unFCSP; - for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) - { - if(FC_LOOP == pAsm->fc_stack[unFCSP].type) - { - break; - } - } - if(0 == FC_LOOP) - { - radeon_error("Break is not inside loop/endloop pair.\n"); - return GL_FALSE; - } - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_LOOP_BREAK, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( - (void *)pAsm->fc_stack[unFCSP].mid, - sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, - sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); - pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; - pAsm->fc_stack[unFCSP].unNumMid++; - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_POP, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; - - checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); - -#endif //USE_CF_FOR_CONTINUE_BREAK - return GL_TRUE; -} - -GLboolean assemble_CONT(r700_AssemblerBase *pAsm) -{ -#ifdef USE_CF_FOR_CONTINUE_BREAK - pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - - assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); - - unsigned int unFCSP; - for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) - { - if(FC_LOOP == pAsm->fc_stack[unFCSP].type) - { - break; - } - } - if(0 == FC_LOOP) - { - radeon_error("Continue is not inside loop/endloop pair.\n"); - return GL_FALSE; - } - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_LOOP_CONTINUE, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_CONTINUE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( - (void *)pAsm->fc_stack[unFCSP].mid, - sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, - sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); - pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; - pAsm->fc_stack[unFCSP].unNumMid++; - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_POP, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; - - checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); - -#endif /* USE_CF_FOR_CONTINUE_BREAK */ - - return GL_TRUE; -} - -GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm) -{ - GLuint i; - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_LOOP_END, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_END; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->fc_stack[pAsm->FCSP].first->m_uIndex + 1; - pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; - -#ifdef USE_CF_FOR_CONTINUE_BREAK - for(i=0; i<pAsm->fc_stack[pAsm->FCSP].unNumMid; i++) - { - pAsm->fc_stack[pAsm->FCSP].mid[i]->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex; - } - if(NULL != pAsm->fc_stack[pAsm->FCSP].mid) - { - FREE(pAsm->fc_stack[pAsm->FCSP].mid); - } -#endif - - if(pAsm->fc_stack[pAsm->FCSP].type != FC_LOOP) - { - radeon_error("loop/endloop in shader code are not paired. \n"); - return GL_FALSE; - } - - GLuint unFCSP; - GLuint unIF = 0; - if((pAsm->unCFflags & HAS_CURRENT_LOOPRET) > 0) - { - for(unFCSP=(pAsm->FCSP-1); unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) - { - if(FC_LOOP == pAsm->fc_stack[unFCSP].type) - { - breakLoopOnFlag(pAsm, unFCSP); - break; - } - else if(FC_IF == pAsm->fc_stack[unFCSP].type) - { - unIF++; - } - } - if(unFCSP <= pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry) - { -#ifdef USE_CF_FOR_POP_AFTER - returnOnFlag(pAsm, unIF); -#else - returnOnFlag(pAsm, 0); -#endif /* USE_CF_FOR_POP_AFTER */ - pAsm->unCFflags &= ~HAS_CURRENT_LOOPRET; - } - } - - pAsm->FCSP--; - - decreaseCurrent(pAsm, FC_LOOP); - - return GL_TRUE; -} - -void add_return_inst(r700_AssemblerBase *pAsm) -{ - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_RETURN, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - //pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_RETURN; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } -} - -GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift) -{ - /* Put in sub */ - if( (pAsm->unSubArrayPointer + 1) > pAsm->unSubArraySize ) - { - pAsm->subs = (SUB_OFFSET*)_mesa_realloc( (void *)pAsm->subs, - sizeof(SUB_OFFSET) * pAsm->unSubArraySize, - sizeof(SUB_OFFSET) * (pAsm->unSubArraySize + 10) ); - if(NULL == pAsm->subs) - { - return GL_FALSE; - } - pAsm->unSubArraySize += 10; - } - - pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex + uiIL_Shift; - pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL; - pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL; - pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0; - - pAsm->CALLSP++; - pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex = pAsm->unSubArrayPointer; - pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP; - pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local - = &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local); - pAsm->CALLSTACK[pAsm->CALLSP].max = 0; - pAsm->CALLSTACK[pAsm->CALLSP].current = 0; - SetActiveCFlist(pAsm->pR700Shader, - pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); - - pAsm->unSubArrayPointer++; - - /* start sub */ - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - - pAsm->FCSP++; - pAsm->fc_stack[pAsm->FCSP].type = FC_REP; - - checkStackDepth(pAsm, FC_REP, GL_FALSE); - - return GL_TRUE; -} - -GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm) -{ - if(pAsm->fc_stack[pAsm->FCSP].type != FC_REP) - { - radeon_error("BGNSUB/ENDSUB in shader code are not paired. \n"); - return GL_FALSE; - } - - /* copy max to sub structure */ - pAsm->subs[pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex].unStackDepthMax - = pAsm->CALLSTACK[pAsm->CALLSP].max; - - decreaseCurrent(pAsm, FC_REP); - - pAsm->CALLSP--; - SetActiveCFlist(pAsm->pR700Shader, - pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); - - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - - pAsm->FCSP--; - - return GL_TRUE; -} - -GLboolean assemble_RET(r700_AssemblerBase *pAsm) -{ - GLuint unIF = 0; - - if(pAsm->CALLSP > 0) - { /* in sub */ - GLuint unFCSP; - for(unFCSP=pAsm->FCSP; unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) - { - if(FC_LOOP == pAsm->fc_stack[unFCSP].type) - { - setRetInLoopFlag(pAsm, SQ_SEL_1); - breakLoopOnFlag(pAsm, unFCSP); - pAsm->unCFflags |= LOOPRET_FLAGS; - - return GL_TRUE; - } - else if(FC_IF == pAsm->fc_stack[unFCSP].type) - { - unIF++; - } - } - } - -#ifdef USE_CF_FOR_POP_AFTER - if(unIF > 0) - { - pops(pAsm, unIF); - } -#endif /* USE_CF_FOR_POP_AFTER */ - - add_return_inst(pAsm); - - return GL_TRUE; -} - -GLboolean assemble_CAL(r700_AssemblerBase *pAsm, - GLint nILindex, - GLuint uiIL_Shift, - GLuint uiNumberInsts, - struct prog_instruction *pILInst, - PRESUB_DESC * pPresubDesc) -{ - GLint uiIL_Offset; - - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_CALL, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.call_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_CALL; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - /* Put in caller */ - if( (pAsm->unCallerArrayPointer + 1) > pAsm->unCallerArraySize ) - { - pAsm->callers = (CALLER_POINTER*)_mesa_realloc( (void *)pAsm->callers, - sizeof(CALLER_POINTER) * pAsm->unCallerArraySize, - sizeof(CALLER_POINTER) * (pAsm->unCallerArraySize + 10) ); - if(NULL == pAsm->callers) - { - return GL_FALSE; - } - pAsm->unCallerArraySize += 10; - } - - uiIL_Offset = nILindex + uiIL_Shift; - pAsm->callers[pAsm->unCallerArrayPointer].subIL_Offset = uiIL_Offset; - pAsm->callers[pAsm->unCallerArrayPointer].cf_ptr = pAsm->cf_current_cf_clause_ptr; - - pAsm->callers[pAsm->unCallerArrayPointer].finale_cf_ptr = NULL; - pAsm->callers[pAsm->unCallerArrayPointer].prelude_cf_ptr = NULL; - - pAsm->unCallerArrayPointer++; - - int j; - GLuint max; - GLuint unSubID; - GLboolean bRet; - for(j=0; j<pAsm->unSubArrayPointer; j++) - { - if(uiIL_Offset == pAsm->subs[j].subIL_Offset) - { /* compiled before */ - - max = pAsm->subs[j].unStackDepthMax - + pAsm->CALLSTACK[pAsm->CALLSP].current; - if(max > pAsm->CALLSTACK[pAsm->CALLSP].max) - { - pAsm->CALLSTACK[pAsm->CALLSP].max = max; - } - - pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = j; - return GL_TRUE; - } - } - - pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer; - unSubID = pAsm->unSubArrayPointer; - - bRet = AssembleInstr(nILindex, uiIL_Shift, uiNumberInsts, pILInst, pAsm); - - if(GL_TRUE == bRet) - { - max = pAsm->subs[unSubID].unStackDepthMax - + pAsm->CALLSTACK[pAsm->CALLSP].current; - if(max > pAsm->CALLSTACK[pAsm->CALLSP].max) - { - pAsm->CALLSTACK[pAsm->CALLSP].max = max; - } - - pAsm->subs[unSubID].pPresubDesc = pPresubDesc; - } - - return bRet; -} - -GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) -{ - /*GLfloat fLiteral[2] = {0.1, 0.0};*/ - - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - pAsm->D.dst.op3 = 0; - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = pAsm->flag_reg_index; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - pAsm->D2.dst2.literal_slots = 1; - pAsm->D2.dst2.SaturateMode = SATURATE_OFF; - pAsm->D.dst.predicated = 0; - /* in reloc where dislink flag init inst, only one slot alu inst is handled. */ - pAsm->D.dst.math = 1; /* TODO : not math really, but one channel op, more generic alu assembler needed */ - pAsm->D2.dst2.index_mode = SQ_INDEX_LOOP; /* Check this ! */ -#if 0 - pAsm->S[0].src.rtype = SRC_REC_LITERAL; - //pAsm->S[0].src.reg = 0; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_X; - pAsm->S[0].src.swizzley = SQ_SEL_Y; - pAsm->S[0].src.swizzlez = SQ_SEL_Z; - pAsm->S[0].src.swizzlew = SQ_SEL_W; - - if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) ) - { - return GL_FALSE; - } -#else - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = 0; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = flagValue; - pAsm->S[0].src.swizzley = flagValue; - pAsm->S[0].src.swizzlez = flagValue; - pAsm->S[0].src.swizzlew = flagValue; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } -#endif - - return GL_TRUE; -} - -GLboolean testFlag(r700_AssemblerBase *pAsm) -{ - /*GLfloat fLiteral[2] = {0.1, 0.0};*/ - - //Test flag - GLuint tmp = gethelpr(pAsm); - pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - - pAsm->D.dst.opcode = SQ_OP2_INST_PRED_SETE; - pAsm->D.dst.math = 1; - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - pAsm->D2.dst2.literal_slots = 1; - pAsm->D2.dst2.SaturateMode = SATURATE_OFF; - pAsm->D.dst.predicated = 1; - pAsm->D2.dst2.index_mode = SQ_INDEX_LOOP; /* Check this ! */ - - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->flag_reg_index; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_X; - pAsm->S[0].src.swizzley = SQ_SEL_Y; - pAsm->S[0].src.swizzlez = SQ_SEL_Z; - pAsm->S[0].src.swizzlew = SQ_SEL_W; -#if 0 - pAsm->S[1].src.rtype = SRC_REC_LITERAL; - //pAsm->S[1].src.reg = 0; - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_X; - pAsm->S[1].src.swizzley = SQ_SEL_Y; - pAsm->S[1].src.swizzlez = SQ_SEL_Z; - pAsm->S[1].src.swizzlew = SQ_SEL_W; - - if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) ) - { - return GL_FALSE; - } -#else - pAsm->S[1].src.rtype = DST_REG_TEMPORARY; - pAsm->S[1].src.reg = 0; - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_1; - pAsm->S[1].src.swizzley = SQ_SEL_1; - pAsm->S[1].src.swizzlez = SQ_SEL_1; - pAsm->S[1].src.swizzlew = SQ_SEL_1; - - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } -#endif - - checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); - - return GL_TRUE; -} - -GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF) -{ - testFlag(pAsm); - jumpToOffest(pAsm, 1, 4); - setRetInLoopFlag(pAsm, SQ_SEL_0); - pops(pAsm, unIF + 1); - add_return_inst(pAsm); - - return GL_TRUE; -} - -GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP) -{ - testFlag(pAsm); - - //break - if(GL_FALSE == add_cf_instruction(pAsm) ) - { - return GL_FALSE; - } - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__POP_COUNT_shift, EG_CF_WORD1__POP_COUNT_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - EG_CF_INST_LOOP_BREAK, - EG_CF_WORD1__CF_INST_shift, EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__CF_CONST_shift, EG_CF_WORD1__CF_CONST_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - SQ_CF_COND_ACTIVE, - EG_CF_WORD1__COND_shift, EG_CF_WORD1__COND_mask); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__EOP_shift, EG_CF_WORD1__EOP_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__VPM_shift, EG_CF_WORD1__VPM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 0, - EG_CF_WORD1__WQM_shift, EG_CF_WORD1__WQM_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__BARRIER_shift, EG_CF_WORD1__BARRIER_bit); - SETfield(pAsm->cf_current_cf_clause_ptr->m_Word1.val, - 1, - EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask); - } - else - { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; - pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - - pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - } - - pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( - (void *)pAsm->fc_stack[unFCSP].mid, - sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, - sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); - pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; - pAsm->fc_stack[unFCSP].unNumMid++; - - pops(pAsm, 1); - - return GL_TRUE; -} - -GLboolean AssembleInstr(GLuint uiFirstInst, - GLuint uiIL_Shift, - GLuint uiNumberInsts, - struct prog_instruction *pILInst, - r700_AssemblerBase *pR700AsmCode) -{ - GLuint i; - - pR700AsmCode->pILInst = pILInst; - for(i=uiFirstInst; i<uiNumberInsts; i++) - { - pR700AsmCode->uiCurInst = i; - -#ifndef USE_CF_FOR_CONTINUE_BREAK - if(OPCODE_BRK == pILInst[i+1].Opcode) - { - switch(pILInst[i].Opcode) - { - case OPCODE_SLE: - pILInst[i].Opcode = OPCODE_SGT; - break; - case OPCODE_SLT: - pILInst[i].Opcode = OPCODE_SGE; - break; - case OPCODE_SGE: - pILInst[i].Opcode = OPCODE_SLT; - break; - case OPCODE_SGT: - pILInst[i].Opcode = OPCODE_SLE; - break; - case OPCODE_SEQ: - pILInst[i].Opcode = OPCODE_SNE; - break; - case OPCODE_SNE: - pILInst[i].Opcode = OPCODE_SEQ; - break; - default: - break; - } - } -#endif - if(pILInst[i].CondUpdate == 1) - { - /* remember dest register used for cond evaluation */ - /* XXX also handle PROGRAM_OUTPUT registers here? */ - pR700AsmCode->last_cond_register = pILInst[i].DstReg.Index; - } - - switch (pILInst[i].Opcode) - { - case OPCODE_ABS: - if ( GL_FALSE == assemble_ABS(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_ADD: - case OPCODE_SUB: - if ( GL_FALSE == assemble_ADD(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_ARL: - if ( GL_FALSE == assemble_ARL(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_ARR: - radeon_error("Not yet implemented instruction OPCODE_ARR \n"); - //if ( GL_FALSE == assemble_BAD("ARR") ) - return GL_FALSE; - break; - - case OPCODE_CMP: - if ( GL_FALSE == assemble_CMP(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_COS: - if(8 == pR700AsmCode->unAsic) - { - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, EG_OP2_INST_COS) ) - return GL_FALSE; - } - else - { - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_COS) ) - return GL_FALSE; - } - break; - - case OPCODE_DP2: - case OPCODE_DP3: - case OPCODE_DP4: - case OPCODE_DPH: - if ( GL_FALSE == assemble_DOT(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_DST: - if ( GL_FALSE == assemble_DST(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_EX2: - if ( GL_FALSE == assemble_EX2(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_EXP: - if ( GL_FALSE == assemble_EXP(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_FLR: - if ( GL_FALSE == assemble_FLR(pR700AsmCode) ) - return GL_FALSE; - break; - //case OP_FLR_INT: ; - - // if ( GL_FALSE == assemble_FLR_INT() ) - // return GL_FALSE; - // break; - - case OPCODE_FRC: - if ( GL_FALSE == assemble_FRC(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_KIL: - case OPCODE_KIL_NV: - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) - return GL_FALSE; - break; - case OPCODE_LG2: - if ( GL_FALSE == assemble_LG2(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LIT: - if ( GL_FALSE == assemble_LIT(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LRP: - if ( GL_FALSE == assemble_LRP(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LOG: - if ( GL_FALSE == assemble_LOG(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_MAD: - if ( GL_FALSE == assemble_MAD(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MAX: - if ( GL_FALSE == assemble_MAX(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MIN: - if ( GL_FALSE == assemble_MIN(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_MOV: - if ( GL_FALSE == assemble_MOV(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MUL: - if ( GL_FALSE == assemble_MUL(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_NOISE1: - { - callPreSub(pR700AsmCode, - GLSL_NOISE1, - &noise1_presub, - pILInst->DstReg.Index + pR700AsmCode->starting_temp_register_number, - 1); - radeon_error("noise1: not yet supported shader instruction\n"); - }; - break; - case OPCODE_NOISE2: - radeon_error("noise2: not yet supported shader instruction\n"); - break; - case OPCODE_NOISE3: - radeon_error("noise3: not yet supported shader instruction\n"); - break; - case OPCODE_NOISE4: - radeon_error("noise4: not yet supported shader instruction\n"); - break; - - case OPCODE_POW: - if ( GL_FALSE == assemble_POW(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_RCP: - if ( GL_FALSE == assemble_RCP(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_RSQ: - if ( GL_FALSE == assemble_RSQ(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_SIN: - if(8 == pR700AsmCode->unAsic) - { - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, EG_OP2_INST_SIN) ) - return GL_FALSE; - } - else - { - if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_SIN) ) - return GL_FALSE; - } - break; - case OPCODE_SCS: - if ( GL_FALSE == assemble_SCS(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_SEQ: - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) ) - { - return GL_FALSE; - } - break; - - case OPCODE_SGT: - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) - { - return GL_FALSE; - } - break; - - case OPCODE_SGE: - if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - /* NO LT, LE, TODO : use GE => LE, GT => LT : reverse 2 src order would be simpliest. Or use SQ_CF_COND_FALSE for SQ_CF_COND_ACTIVE.*/ - case OPCODE_SLT: - { - struct prog_src_register SrcRegSave[2]; - SrcRegSave[0] = pILInst[i].SrcReg[0]; - SrcRegSave[1] = pILInst[i].SrcReg[1]; - pILInst[i].SrcReg[0] = SrcRegSave[1]; - pILInst[i].SrcReg[1] = SrcRegSave[0]; - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - } - break; - - case OPCODE_SLE: - { - struct prog_src_register SrcRegSave[2]; - SrcRegSave[0] = pILInst[i].SrcReg[0]; - SrcRegSave[1] = pILInst[i].SrcReg[1]; - pILInst[i].SrcReg[0] = SrcRegSave[1]; - pILInst[i].SrcReg[1] = SrcRegSave[0]; - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - } - break; - - case OPCODE_SNE: - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) ) - { - return GL_FALSE; - } - break; - - //case OP_STP: - // if ( GL_FALSE == assemble_STP(pR700AsmCode) ) - // return GL_FALSE; - // break; - - case OPCODE_SSG: - if ( GL_FALSE == assemble_SSG(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_SWZ: - if ( GL_FALSE == assemble_MOV(pR700AsmCode) ) - { - return GL_FALSE; - } - else - { - if( (i+1)<uiNumberInsts ) - { - if(OPCODE_END != pILInst[i+1].Opcode) - { - if( GL_TRUE == IsTex(pILInst[i+1].Opcode) ) - { - pR700AsmCode->pInstDeps[i+1].nDstDep = i+1; //=1? - } - } - } - } - break; - case OPCODE_DDX: - case OPCODE_DDY: - case OPCODE_TEX: - case OPCODE_TXB: - case OPCODE_TXL: - case OPCODE_TXP: - if ( GL_FALSE == assemble_TEX(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_TRUNC: - if ( GL_FALSE == assemble_math_function(pR700AsmCode, SQ_OP2_INST_TRUNC) ) - return GL_FALSE; - break; - - case OPCODE_XPD: - if ( GL_FALSE == assemble_XPD(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_IF: - { - GLboolean bHasElse = GL_FALSE; - - if(pILInst[pILInst[i].BranchTarget].Opcode == OPCODE_ELSE) - { - bHasElse = GL_TRUE; - } - - if ( GL_FALSE == assemble_IF(pR700AsmCode, bHasElse) ) - { - return GL_FALSE; - } - } - break; - - case OPCODE_ELSE : - if ( GL_FALSE == assemble_ELSE(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_ENDIF: - if ( GL_FALSE == assemble_ENDIF(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_BGNLOOP: - if( GL_FALSE == assemble_BGNLOOP(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_BRK: - if( GL_FALSE == assemble_BRK(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_CONT: - if( GL_FALSE == assemble_CONT(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_ENDLOOP: - if( GL_FALSE == assemble_ENDLOOP(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_BGNSUB: - if( GL_FALSE == assemble_BGNSUB(pR700AsmCode, i, uiIL_Shift) ) - { - return GL_FALSE; - } - break; - - case OPCODE_RET: - if( GL_FALSE == assemble_RET(pR700AsmCode) ) - { - return GL_FALSE; - } - break; - - case OPCODE_CAL: - if( GL_FALSE == assemble_CAL(pR700AsmCode, - pILInst[i].BranchTarget, - uiIL_Shift, - uiNumberInsts, - pILInst, - NULL) ) - { - return GL_FALSE; - } - break; - - //case OPCODE_EXPORT: - // if ( GL_FALSE == assemble_EXPORT() ) - // return GL_FALSE; - // break; - - case OPCODE_ENDSUB: - return assemble_ENDSUB(pR700AsmCode); - - case OPCODE_END: - //pR700AsmCode->uiCurInst = i; - //This is to remaind that if in later exoort there is depth/stencil - //export, we need a mov to re-arrange DST channel, where using a - //psuedo inst, we will use this end inst to do it. - return GL_TRUE; - - default: - radeon_error("r600: unknown instruction %d\n", pILInst[i].Opcode); - return GL_FALSE; - } - } - - return GL_TRUE; -} - -GLboolean InitShaderProgram(r700_AssemblerBase * pAsm) -{ -#ifndef GENERATE_SHADER_FOR_2D - setRetInLoopFlag(pAsm, SQ_SEL_0); -#endif - - if((SPT_FP == pAsm->currentShaderType) && (8 == pAsm->unAsic)) - { - EG_add_ps_interp(pAsm); - } - - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - return GL_TRUE; -} - -GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg) -{ - GLuint i; - GLuint unCFoffset; - TypedShaderList * plstCFmain; - TypedShaderList * plstCFsub; - - R700ShaderInstruction * pInst; - R700ControlFlowGenericClause * pCFInst; - - R700ControlFlowALUClause * pCF_ALU; - R700ALUInstruction * pALU; - GLuint unConstOffset = 0; - GLuint unRegOffset; - GLuint unMinRegIndex; - - plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; - -#ifndef GENERATE_SHADER_FOR_2D - /* remove flags init if they are not used */ - if((pAsm->unCFflags & HAS_LOOPRET) == 0) - { - R700ControlFlowALUClause * pCF_ALU; - pInst = plstCFmain->pHead; - while(pInst) - { - if(SIT_CF_ALU == pInst->m_ShaderInstType) - { - pCF_ALU = (R700ControlFlowALUClause *)pInst; - if(0 == pCF_ALU->m_Word1.f.count) - { - pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP; - } - else - { - R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction; - - pALU->m_pLinkedALUClause = NULL; - pALU = (R700ALUInstruction *)(pALU->pNextInst); - pALU->m_pLinkedALUClause = pCF_ALU; - pCF_ALU->m_pLinkedALUInstruction = pALU; - - pCF_ALU->m_Word1.f.count--; - } - break; - } - pInst = pInst->pNextInst; - }; - } -#endif /* GENERATE_SHADER_FOR_2D */ - - if(pAsm->CALLSTACK[0].max > 0) - { - pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2; - } - - if(0 == pAsm->unSubArrayPointer) - { - return GL_TRUE; - } - - unCFoffset = plstCFmain->uNumOfNode; - - if(NULL != pILProg->Parameters) - { - unConstOffset = pILProg->Parameters->NumParameters; - } - - /* Reloc subs */ - for(i=0; i<pAsm->unSubArrayPointer; i++) - { - pAsm->subs[i].unCFoffset = unCFoffset; - plstCFsub = &(pAsm->subs[i].lstCFInstructions_local); - - pInst = plstCFsub->pHead; - - /* reloc instructions */ - while(pInst) - { - if(SIT_CF_GENERIC == pInst->m_ShaderInstType) - { - pCFInst = (R700ControlFlowGenericClause *)pInst; - - switch (pCFInst->m_Word1.f.cf_inst) - { - case SQ_CF_INST_POP: - case SQ_CF_INST_JUMP: - case SQ_CF_INST_ELSE: - case SQ_CF_INST_LOOP_END: - case SQ_CF_INST_LOOP_START: - case SQ_CF_INST_LOOP_START_NO_AL: - case SQ_CF_INST_LOOP_CONTINUE: - case SQ_CF_INST_LOOP_BREAK: - pCFInst->m_Word0.f.addr += unCFoffset; - break; - default: - break; - } - } - - pInst->m_uIndex += unCFoffset; - - pInst = pInst->pNextInst; - }; - - if(NULL != pAsm->subs[i].pPresubDesc) - { - GLuint uNumSrc; - - unMinRegIndex = pAsm->subs[i].pPresubDesc->pCompiledSub->MinRegIndex; - unRegOffset = pAsm->subs[i].pPresubDesc->maxStartReg; - unConstOffset += pAsm->subs[i].pPresubDesc->unConstantsStart; - - pInst = plstCFsub->pHead; - while(pInst) - { - if(SIT_CF_ALU == pInst->m_ShaderInstType) - { - pCF_ALU = (R700ControlFlowALUClause *)pInst; - - pALU = pCF_ALU->m_pLinkedALUInstruction; - for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) - { - pALU->m_Word1.f.dst_gpr = pALU->m_Word1.f.dst_gpr + unRegOffset - unMinRegIndex; - - if(pALU->m_Word0.f.src0_sel < SQ_ALU_SRC_GPR_SIZE) - { - pALU->m_Word0.f.src0_sel = pALU->m_Word0.f.src0_sel + unRegOffset - unMinRegIndex; - } - else if(pALU->m_Word0.f.src0_sel >= SQ_ALU_SRC_CFILE_BASE) - { - pALU->m_Word0.f.src0_sel += unConstOffset; - } - - if( ((pALU->m_Word1.val >> SQ_ALU_WORD1_OP3_ALU_INST_SHIFT) & 0x0000001F) - >= SQ_OP3_INST_MUL_LIT ) - { /* op3 : 3 srcs */ - if(pALU->m_Word1_OP3.f.src2_sel < SQ_ALU_SRC_GPR_SIZE) - { - pALU->m_Word1_OP3.f.src2_sel = pALU->m_Word1_OP3.f.src2_sel + unRegOffset - unMinRegIndex; - } - else if(pALU->m_Word1_OP3.f.src2_sel >= SQ_ALU_SRC_CFILE_BASE) - { - pALU->m_Word1_OP3.f.src2_sel += unConstOffset; - } - if(pALU->m_Word0.f.src1_sel < SQ_ALU_SRC_GPR_SIZE) - { - pALU->m_Word0.f.src1_sel = pALU->m_Word0.f.src1_sel + unRegOffset - unMinRegIndex; - } - else if(pALU->m_Word0.f.src1_sel >= SQ_ALU_SRC_CFILE_BASE) - { - pALU->m_Word0.f.src1_sel += unConstOffset; - } - } - else - { - if(8 == pAsm->unAsic) - { - uNumSrc = EG_GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); - } - else - { - if(pAsm->bR6xx) - { - uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f6.alu_inst, 0); - } - else - { - uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); - } - } - if(2 == uNumSrc) - { /* 2 srcs */ - if(pALU->m_Word0.f.src1_sel < SQ_ALU_SRC_GPR_SIZE) - { - pALU->m_Word0.f.src1_sel = pALU->m_Word0.f.src1_sel + unRegOffset - unMinRegIndex; - } - else if(pALU->m_Word0.f.src1_sel >= SQ_ALU_SRC_CFILE_BASE) - { - pALU->m_Word0.f.src1_sel += unConstOffset; - } - } - } - pALU = (R700ALUInstruction*)(pALU->pNextInst); - } - } - pInst = pInst->pNextInst; - }; - } - - /* Put sub into main */ - plstCFmain->pTail->pNextInst = plstCFsub->pHead; - plstCFmain->pTail = plstCFsub->pTail; - plstCFmain->uNumOfNode += plstCFsub->uNumOfNode; - - unCFoffset += plstCFsub->uNumOfNode; - } - - /* reloc callers */ - for(i=0; i<pAsm->unCallerArrayPointer; i++) - { - pAsm->callers[i].cf_ptr->m_Word0.f.addr - = pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset; - - if(NULL != pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc) - { - unMinRegIndex = pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc->pCompiledSub->MinRegIndex; - unRegOffset = pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc->maxStartReg; - - if(NULL != pAsm->callers[i].prelude_cf_ptr) - { - pCF_ALU = (R700ControlFlowALUClause * )(pAsm->callers[i].prelude_cf_ptr); - pALU = pCF_ALU->m_pLinkedALUInstruction; - for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) - { - pALU->m_Word1.f.dst_gpr = pALU->m_Word1.f.dst_gpr + unRegOffset - unMinRegIndex; - pALU = (R700ALUInstruction*)(pALU->pNextInst); - } - } - if(NULL != pAsm->callers[i].finale_cf_ptr) - { - pCF_ALU = (R700ControlFlowALUClause * )(pAsm->callers[i].finale_cf_ptr); - pALU = pCF_ALU->m_pLinkedALUInstruction; - for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) - { - pALU->m_Word0.f.src0_sel = pALU->m_Word0.f.src0_sel + unRegOffset - unMinRegIndex; - pALU = (R700ALUInstruction*)(pALU->pNextInst); - } - } - } - } - - return GL_TRUE; -} - -GLboolean callPreSub(r700_AssemblerBase* pAsm, - LOADABLE_SCRIPT_SIGNITURE scriptSigniture, - COMPILED_SUB * pCompiledSub, - GLshort uOutReg, - GLshort uNumValidSrc) -{ - /* save assemble context */ - GLuint starting_temp_register_number_save; - GLuint number_used_registers_save; - GLuint uFirstHelpReg_save; - GLuint uHelpReg_save; - GLuint uiCurInst_save; - struct prog_instruction *pILInst_save; - PRESUB_DESC * pPresubDesc; - GLboolean bRet; - int i; - - R700ControlFlowGenericClause* prelude_cf_ptr = NULL; - - /* copy srcs to presub inputs */ - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - for(i=0; i<uNumValidSrc; i++) - { - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = pCompiledSub->srcRegIndex[i]; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 1; - pAsm->D.dst.writew = 1; - - if( GL_FALSE == assemble_src(pAsm, i, 0) ) - { - return GL_FALSE; - } - - next_ins(pAsm); - } - if(uNumValidSrc > 0) - { - prelude_cf_ptr = (R700ControlFlowGenericClause*) pAsm->cf_current_alu_clause_ptr; - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - } - - /* browse thro existing presubs. */ - for(i=0; i<pAsm->unNumPresub; i++) - { - if(pAsm->presubs[i].sptSigniture == scriptSigniture) - { - break; - } - } - - if(i == pAsm->unNumPresub) - { /* not loaded yet */ - /* save assemble context */ - number_used_registers_save = pAsm->number_used_registers; - uFirstHelpReg_save = pAsm->uFirstHelpReg; - uHelpReg_save = pAsm->uHelpReg; - starting_temp_register_number_save = pAsm->starting_temp_register_number; - pILInst_save = pAsm->pILInst; - uiCurInst_save = pAsm->uiCurInst; - - /* alloc in presub */ - if( (pAsm->unNumPresub + 1) > pAsm->unPresubArraySize ) - { - pAsm->presubs = (PRESUB_DESC*)_mesa_realloc( (void *)pAsm->presubs, - sizeof(PRESUB_DESC) * pAsm->unPresubArraySize, - sizeof(PRESUB_DESC) * (pAsm->unPresubArraySize + 4) ); - if(NULL == pAsm->presubs) - { - radeon_error("No memeory to allocate built in shader function description structures. \n"); - return GL_FALSE; - } - pAsm->unPresubArraySize += 4; - } - - pPresubDesc = &(pAsm->presubs[i]); - pPresubDesc->sptSigniture = scriptSigniture; - - /* constants offsets need to be final resolved at reloc. */ - if(0 == pAsm->unNumPresub) - { - pPresubDesc->unConstantsStart = 0; - } - else - { - pPresubDesc->unConstantsStart = pAsm->presubs[i-1].unConstantsStart - + pAsm->presubs[i-1].pCompiledSub->NumParameters; - } - - pPresubDesc->pCompiledSub = pCompiledSub; - - pPresubDesc->subIL_Shift = pAsm->unCurNumILInsts; - pPresubDesc->maxStartReg = uFirstHelpReg_save; - pAsm->unCurNumILInsts += pCompiledSub->NumInstructions; - - pAsm->unNumPresub++; - - /* setup new assemble context */ - pAsm->starting_temp_register_number = 0; - pAsm->number_used_registers = pCompiledSub->NumTemporaries; - pAsm->uFirstHelpReg = pAsm->number_used_registers; - pAsm->uHelpReg = pAsm->uFirstHelpReg; - - bRet = assemble_CAL(pAsm, - 0, - pPresubDesc->subIL_Shift, - pCompiledSub->NumInstructions, - pCompiledSub->Instructions, - pPresubDesc); - - - pPresubDesc->number_used_registers = pAsm->number_used_registers; - - /* restore assemble context */ - pAsm->number_used_registers = number_used_registers_save; - pAsm->uFirstHelpReg = uFirstHelpReg_save; - pAsm->uHelpReg = uHelpReg_save; - pAsm->starting_temp_register_number = starting_temp_register_number_save; - pAsm->pILInst = pILInst_save; - pAsm->uiCurInst = uiCurInst_save; - } - else - { /* was loaded */ - pPresubDesc = &(pAsm->presubs[i]); - - bRet = assemble_CAL(pAsm, - 0, - pPresubDesc->subIL_Shift, - pCompiledSub->NumInstructions, - pCompiledSub->Instructions, - pPresubDesc); - } - - if(GL_FALSE == bRet) - { - radeon_error("Shader presub assemble failed. \n"); - } - else - { - /* copy presub output to real dst */ - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pCompiledSub->dstRegIndex; - pAsm->S[0].src.swizzlex = pCompiledSub->outputSwizzleX; - pAsm->S[0].src.swizzley = pCompiledSub->outputSwizzleY; - pAsm->S[0].src.swizzlez = pCompiledSub->outputSwizzleZ; - pAsm->S[0].src.swizzlew = pCompiledSub->outputSwizzleW; - - next_ins(pAsm); - - pAsm->callers[pAsm->unCallerArrayPointer - 1].finale_cf_ptr = (R700ControlFlowGenericClause*) pAsm->cf_current_alu_clause_ptr; - pAsm->callers[pAsm->unCallerArrayPointer - 1].prelude_cf_ptr = prelude_cf_ptr; - pAsm->alu_x_opcode = SQ_CF_INST_ALU; - } - - if( (pPresubDesc->number_used_registers + pAsm->uFirstHelpReg) > pAsm->number_used_registers ) - { - pAsm->number_used_registers = pPresubDesc->number_used_registers + pAsm->uFirstHelpReg; - } - if(pAsm->uFirstHelpReg > pPresubDesc->maxStartReg) - { - pPresubDesc->maxStartReg = pAsm->uFirstHelpReg; - } - - return bRet; -} - -GLboolean Process_Export(r700_AssemblerBase* pAsm, - GLuint type, - GLuint export_starting_index, - GLuint export_count, - GLuint starting_register_number, - GLboolean is_depth_export) -{ - check_current_clause(pAsm, CF_EMPTY_CLAUSE); - check_current_clause(pAsm, CF_EXPORT_CLAUSE); //alloc the cf_current_export_clause_ptr - - pAsm->cf_current_export_clause_ptr->m_Word0.f.type = type; - - switch (type) - { - case SQ_EXPORT_PIXEL: - if(GL_TRUE == is_depth_export) - { - pAsm->cf_current_export_clause_ptr->m_Word0.f.array_base = SQ_CF_PIXEL_Z; - } - else - { - pAsm->cf_current_export_clause_ptr->m_Word0.f.array_base = SQ_CF_PIXEL_MRT0 + export_starting_index; - } - break; - - case SQ_EXPORT_POS: - pAsm->cf_current_export_clause_ptr->m_Word0.f.array_base = SQ_CF_POS_0 + export_starting_index; - break; - - case SQ_EXPORT_PARAM: - pAsm->cf_current_export_clause_ptr->m_Word0.f.array_base = 0x0 + export_starting_index; - break; - - default: - radeon_error("Unknown export type: %d\n", type); - return GL_FALSE; - break; - } - - pAsm->cf_current_export_clause_ptr->m_Word0.f.rw_gpr = starting_register_number; - - pAsm->cf_current_export_clause_ptr->m_Word0.f.rw_rel = SQ_ABSOLUTE; - pAsm->cf_current_export_clause_ptr->m_Word0.f.index_gpr = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word0.f.elem_size = 0x3; - - if(8 == pAsm->unAsic) - { - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - (export_count - 1), - EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_shift, - EG_CF_ALLOC_EXPORT_WORD1__BURST_COUNT_mask); - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - 0, - EG_CF_ALLOC_EXPORT_WORD1__EOP_shift, - EG_CF_ALLOC_EXPORT_WORD1__EOP_bit); - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - 0, - EG_CF_ALLOC_EXPORT_WORD1__VPM_shift, - EG_CF_ALLOC_EXPORT_WORD1__VPM_bit); - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - EG_CF_INST_EXPORT, - EG_CF_WORD1__CF_INST_shift, - EG_CF_WORD1__CF_INST_mask); - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - 0, - EG_CF_ALLOC_EXPORT_WORD1__MARK_shift, - EG_CF_ALLOC_EXPORT_WORD1__MARK_bit); - SETfield(pAsm->cf_current_export_clause_ptr->m_Word1.val, - 1, - EG_CF_ALLOC_EXPORT_WORD1__BARRIER_shift, - EG_CF_ALLOC_EXPORT_WORD1__BARRIER_bit); - } - else - { - pAsm->cf_current_export_clause_ptr->m_Word1.f.burst_count = (export_count - 1); - pAsm->cf_current_export_clause_ptr->m_Word1.f.end_of_program = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT; // _DONE - pAsm->cf_current_export_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - pAsm->cf_current_export_clause_ptr->m_Word1.f.barrier = 0x1; - } - - if (export_count == 1) - { - assert(starting_register_number >= pAsm->starting_export_register_number); - - /* exports Z as a float into Red channel */ - if (GL_TRUE == is_depth_export) - { - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_Z; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_MASK; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_MASK; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_MASK; - } - else - { - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_X; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_Y; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_Z; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_W; - } - } - else - { - // This should only be used if all components for all registers have been written - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_X; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_Y; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_Z; - pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_W; - } - - pAsm->cf_last_export_ptr = pAsm->cf_current_export_clause_ptr; - - return GL_TRUE; -} - -GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, - GLbitfield OutputsWritten) -{ - unsigned int unBit; - GLuint export_count = 0; - unsigned int i; - - for (i = 0; i < FRAG_RESULT_MAX; ++i) - { - unBit = 1 << i; - - if (OutputsWritten & unBit) - { - GLboolean is_depth = i == FRAG_RESULT_DEPTH ? GL_TRUE : GL_FALSE; - if (!Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, pR700AsmCode->uiFP_OutputMap[i], is_depth)) - return GL_FALSE; - ++export_count; - } - } - - /* Need to export something, otherwise we'll hang - * results are undefined anyway */ - if(export_count == 0) - { - Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, pR700AsmCode->starting_export_register_number, GL_FALSE); - } - - if(pR700AsmCode->cf_last_export_ptr != NULL) - { - if(8 == pR700AsmCode->unAsic) - { - SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, - 1, - EG_CF_ALLOC_EXPORT_WORD1__EOP_shift, - EG_CF_ALLOC_EXPORT_WORD1__EOP_bit); - SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, - EG_CF_INST_EXPORT_DONE, - EG_CF_WORD1__CF_INST_shift, - EG_CF_WORD1__CF_INST_mask); - } - else - { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; - pR700AsmCode->cf_last_export_ptr->m_Word1.f.end_of_program = 0x1; - } - } - - return GL_TRUE; -} - -GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, - GLbitfield OutputsWritten) -{ - unsigned int unBit; - unsigned int i; - - GLuint export_starting_index = 0; - GLuint export_count = pR700AsmCode->number_of_exports; - - unBit = 1 << VERT_RESULT_HPOS; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_POS, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_HPOS], - GL_FALSE) ) - { - return GL_FALSE; - } - export_starting_index++; - export_count--; - } - - unBit = 1 << VERT_RESULT_PSIZ; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_POS, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_PSIZ], - GL_FALSE) ) - { - return GL_FALSE; - } - export_count--; - } - - if(8 == pR700AsmCode->unAsic) - { - SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, - EG_CF_INST_EXPORT_DONE, - EG_CF_WORD1__CF_INST_shift, - EG_CF_WORD1__CF_INST_mask); - } - else - { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; - } - - - pR700AsmCode->number_of_exports = export_count; - export_starting_index = 0; - - unBit = 1 << VERT_RESULT_COL0; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_COL0], - GL_FALSE) ) - { - return GL_FALSE; - } - - export_starting_index++; - } - - unBit = 1 << VERT_RESULT_COL1; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_COL1], - GL_FALSE) ) - { - return GL_FALSE; - } - - export_starting_index++; - } - - unBit = 1 << VERT_RESULT_FOGC; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_FOGC], - GL_FALSE) ) - { - return GL_FALSE; - } - - export_starting_index++; - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[VERT_RESULT_TEX0 + i], - GL_FALSE) ) - { - return GL_FALSE; - } - - export_starting_index++; - } - } - - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(OutputsWritten & unBit) - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - export_starting_index, - 1, - pR700AsmCode->ucVP_OutputMap[i], - GL_FALSE) ) - { - return GL_FALSE; - } - - export_starting_index++; - } - } - - // At least one param should be exported - if (export_count) - { - if(8 == pR700AsmCode->unAsic) - { - SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, - EG_CF_INST_EXPORT_DONE, - EG_CF_WORD1__CF_INST_shift, - EG_CF_WORD1__CF_INST_mask); - } - else - { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; - } - } - else - { - if( GL_FALSE == Process_Export(pR700AsmCode, - SQ_EXPORT_PARAM, - 0, - 1, - pR700AsmCode->starting_export_register_number, - GL_FALSE) ) - { - return GL_FALSE; - } - - pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_0; - pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_0; - pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_0; - pR700AsmCode->cf_last_export_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_1; - if(8 == pR700AsmCode->unAsic) - { - SETfield(pR700AsmCode->cf_last_export_ptr->m_Word1.val, - EG_CF_INST_EXPORT_DONE, - EG_CF_WORD1__CF_INST_shift, - EG_CF_WORD1__CF_INST_mask); - } - else - { - pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; - } - } - - pR700AsmCode->cf_last_export_ptr->m_Word1.f.end_of_program = 0x1; - - return GL_TRUE; -} - -GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode) -{ - if(NULL != pR700AsmCode->pInstDeps) - { - FREE(pR700AsmCode->pInstDeps); - pR700AsmCode->pInstDeps = NULL; - } - - if(NULL != pR700AsmCode->subs) - { - FREE(pR700AsmCode->subs); - pR700AsmCode->subs = NULL; - } - if(NULL != pR700AsmCode->callers) - { - FREE(pR700AsmCode->callers); - pR700AsmCode->callers = NULL; - } - - if(NULL != pR700AsmCode->presubs) - { - FREE(pR700AsmCode->presubs); - pR700AsmCode->presubs = NULL; - } - - return GL_TRUE; -} - diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h deleted file mode 100644 index 8a9ccd1c4ec..00000000000 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ /dev/null @@ -1,838 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _R700_ASSEMBLER_H_ -#define _R700_ASSEMBLER_H_ - -#include "main/mtypes.h" -#include "program/prog_instruction.h" - -#include "r700_chip.h" -#include "r700_shaderinst.h" -#include "r700_shader.h" - -typedef enum LOADABLE_SCRIPT_SIGNITURE -{ - GLSL_NOISE1 = 0x10000001, - GLSL_NOISE2 = 0x10000002, - GLSL_NOISE3 = 0x10000003, - GLSL_NOISE4 = 0x10000004 -}LOADABLE_SCRIPT_SIGNITURE; - -typedef struct COMPILED_SUB -{ - struct prog_instruction *Instructions; - GLuint NumInstructions; - GLuint NumTemporaries; - GLuint NumParameters; - GLuint MinRegIndex; - GLfloat (*ParameterValues)[4]; - GLbyte outputSwizzleX; - GLbyte outputSwizzleY; - GLbyte outputSwizzleZ; - GLbyte outputSwizzleW; - GLshort srcRegIndex[3]; - GLushort dstRegIndex; -}COMPILED_SUB; - -typedef struct PRESUB_DESCtag -{ - LOADABLE_SCRIPT_SIGNITURE sptSigniture; - GLint subIL_Shift; - struct prog_src_register InReg[3]; - struct prog_dst_register OutReg; - - GLushort maxStartReg; - GLushort number_used_registers; - - GLuint unConstantsStart; - - COMPILED_SUB * pCompiledSub; -} PRESUB_DESC; - -typedef enum SHADER_PIPE_TYPE -{ - SPT_VP = 0, - SPT_FP = 1 -} SHADER_PIPE_TYPE; - -typedef enum ConstantCycles -{ - NUMBER_OF_CYCLES = 3, - NUMBER_OF_COMPONENTS = 4 -} ConstantCycles; - -typedef enum HARDWARE_LIMIT_VALUES -{ - TEMPORARY_REGISTER_OFFSET = SQ_ALU_SRC_GPR_BASE, - MAX_TEMPORARY_REGISTERS = SQ_ALU_SRC_GPR_SIZE, - MAX_CONSTANT_REGISTERS = SQ_ALU_SRC_CFILE_SIZE, - CFILE_REGISTER_OFFSET = SQ_ALU_SRC_CFILE_BASE, - NUMBER_OF_INPUT_COLORS = 2, - NUMBER_OF_OUTPUT_COLORS = 8, - NUMBER_OF_TEXTURE_UNITS = 16, - MEGA_FETCH_BYTES = 32 -} HARDWARE_LIMIT_VALUES; - -typedef enum AddressMode -{ - ADDR_ABSOLUTE = 0, - ADDR_RELATIVE_A0 = 1, - ADDR_RELATIVE_FLI_0 = 2, - NUMBER_OF_ADDR_MOD = 3 -} AddressMode; - -typedef enum SrcRegisterType -{ - SRC_REG_TEMPORARY = 0, - SRC_REG_GPR = 1, - SRC_REG_CONSTANT = 2, - SRC_REG_ALT_TEMPORARY = 3, - SRC_REC_LITERAL = 4, - NUMBER_OF_SRC_REG_TYPE = 5 -} SrcRegisterType; - -typedef enum DstRegisterType -{ - DST_REG_TEMPORARY = 0, - DST_REG_A0 = 1, - DST_REG_OUT = 2, - DST_REG_OUT_X_REPL = 3, - DST_REG_ALT_TEMPORARY = 4, - DST_REG_INPUT = 5, - NUMBER_OF_DST_REG_TYPE = 6 -} DstRegisterType; - -typedef unsigned int BITS; - -typedef struct PVSDSTtag -{ -#ifdef MESA_BIG_ENDIAN - BITS addrmode1:1; //32 - BITS addrmode0:1; //31 //29 - - BITS dualop:1; // 30 //26 - - BITS op3:1; // 29 Represents *_OP3_* ALU opcode - - BITS writew:1; //28 - BITS writez:1; - BITS writey:1; - BITS writex:1; - - BITS reg:10; //24 //20 - BITS rtype:3; - - BITS pred_inv :1; //11 //8 - BITS predicated:1; //10 //8 - BITS math:1; - BITS opcode:8; //(:6) //@@@ really should be 10 bits for OP2 -#else - BITS opcode:8; //(:6) //@@@ really should be 10 bits for OP2 - BITS math:1; - BITS predicated:1; //10 //8 - BITS pred_inv :1; //11 //8 - - BITS rtype:3; - BITS reg:10; //24 //20 - - BITS writex:1; - BITS writey:1; - BITS writez:1; - BITS writew:1; //28 - - BITS op3:1; // 29 Represents *_OP3_* ALU opcode - - BITS dualop:1; // 30 //26 - - BITS addrmode0:1; //31 //29 - BITS addrmode1:1; //32 -#endif -} PVSDST; - -typedef struct PVSINSTtag -{ -#ifdef MESA_BIG_ENDIAN - BITS index_mode :3; - BITS SaturateMode :2; - BITS literal_slots :2; -#else - BITS literal_slots :2; - BITS SaturateMode :2; - BITS index_mode :3; -#endif -} PVSINST; - -typedef struct PVSSRCtag -{ -#ifdef MESA_BIG_ENDIAN - BITS addrmode1:1; //32 - //BITS addrsel:2; - BITS negw:1; //31 - BITS negz:1; - BITS negy:1; - BITS negx:1; - BITS abs:1; - - BITS swizzlew:3; //26 - BITS swizzlez:3; - BITS swizzley:3; - BITS swizzlex:3; - BITS reg:10; //14 (8) - BITS addrmode0:1; - BITS rtype:3; -#else - BITS rtype:3; - BITS addrmode0:1; - BITS reg:10; //14 (8) - BITS swizzlex:3; - BITS swizzley:3; - BITS swizzlez:3; - BITS swizzlew:3; //26 - - BITS abs:1; - BITS negx:1; - BITS negy:1; - BITS negz:1; - BITS negw:1; //31 - //BITS addrsel:2; - BITS addrmode1:1; //32 -#endif -} PVSSRC; - -typedef struct PVSMATHtag -{ -#ifdef MESA_BIG_ENDIAN - BITS spare2:3; - BITS dstcomp:2; // select dest component - BITS negy:1; - BITS negx:1; - BITS opcode:4; - BITS dstoff:2; // 2 bits of dest offset into alt ram - BITS swizzley:3; - BITS swizzlex:3; - BITS reg:8; - BITS spare:1; - BITS rtype:4; -#else - BITS rtype:4; - BITS spare:1; - BITS reg:8; - BITS swizzlex:3; - BITS swizzley:3; - BITS dstoff:2; // 2 bits of dest offset into alt ram - BITS opcode:4; - BITS negx:1; - BITS negy:1; - BITS dstcomp:2; // select dest component - BITS spare2:3; -#endif -} PVSMATH; - -typedef union PVSDWORDtag -{ - BITS bits; - PVSDST dst; - PVSINST dst2; - PVSSRC src; - PVSMATH math; - float f; -} PVSDWORD; - -typedef struct VAP_OUT_VTX_FMT_0tag -{ -#ifdef MESA_BIG_ENDIAN - BITS resvd1:12; // 20 - - BITS viewport_index:1; // 19 - BITS kill_flag:1; - BITS rta_index:1; // shares same channel as kill_flag - BITS edge_flag:1; - BITS point_size:1; // 15 - - BITS depth:1; // 14 - - BITS normal:1; - - BITS color7:1; - BITS color6:1; - BITS color5:1; - BITS color4:1; - BITS color3:1; - BITS color2:1; - BITS color1:1; - BITS color0:1; - - BITS pos_param:1; // 4 - BITS clip_dist1:1; - BITS clip_dist0:1; - BITS misc:1; - BITS pos:1; // 0 -#else - BITS pos:1; // 0 - BITS misc:1; - BITS clip_dist0:1; - BITS clip_dist1:1; - BITS pos_param:1; // 4 - - BITS color0:1; // 5 - BITS color1:1; - BITS color2:1; - BITS color3:1; - BITS color4:1; - BITS color5:1; - BITS color6:1; - BITS color7:1; - - BITS normal:1; - - BITS depth:1; // 14 - - BITS point_size:1; // 15 - BITS edge_flag:1; - BITS rta_index:1; // shares same channel as kill_flag - BITS kill_flag:1; - BITS viewport_index:1; // 19 - - BITS resvd1:12; // 20 -#endif -} VAP_OUT_VTX_FMT_0; - -typedef struct VAP_OUT_VTX_FMT_1tag -{ -#ifdef MESA_BIG_ENDIAN - BITS resvd:8; - - BITS tex7comp:3; - BITS tex6comp:3; - BITS tex5comp:3; - BITS tex4comp:3; - BITS tex3comp:3; - BITS tex2comp:3; - BITS tex1comp:3; - BITS tex0comp:3; -#else - BITS tex0comp:3; - BITS tex1comp:3; - BITS tex2comp:3; - BITS tex3comp:3; - BITS tex4comp:3; - BITS tex5comp:3; - BITS tex6comp:3; - BITS tex7comp:3; - - BITS resvd:8; -#endif -} VAP_OUT_VTX_FMT_1; - -typedef struct VAP_OUT_VTX_FMT_2tag -{ -#ifdef MESA_BIG_ENDIAN - BITS resvd:8; - - BITS tex15comp:3; - BITS tex14comp:3; - BITS tex13comp:3; - BITS tex12comp:3; - BITS tex11comp:3; - BITS tex10comp:3; - BITS tex9comp:3; - BITS tex8comp:3; -#else - BITS tex8comp :3; - BITS tex9comp :3; - BITS tex10comp:3; - BITS tex11comp:3; - BITS tex12comp:3; - BITS tex13comp:3; - BITS tex14comp:3; - BITS tex15comp:3; - - BITS resvd:8; -#endif -} VAP_OUT_VTX_FMT_2; - -typedef struct OUT_FRAGMENT_FMT_0tag -{ -#ifdef MESA_BIG_ENDIAN - BITS resvd1:20; - - BITS mask:1; - BITS coverage_to_mask:1; - BITS stencil_ref:1; - BITS depth:1; - - BITS color7:1; - BITS color6:1; - BITS color5:1; - BITS color4:1; - BITS color3:1; - BITS color2:1; - BITS color1:1; - BITS color0:1; -#else - BITS color0:1; - BITS color1:1; - BITS color2:1; - BITS color3:1; - BITS color4:1; - BITS color5:1; - BITS color6:1; - BITS color7:1; - - BITS depth:1; - BITS stencil_ref:1; - BITS coverage_to_mask:1; - BITS mask:1; - - BITS resvd1:20; -#endif -} OUT_FRAGMENT_FMT_0; - -typedef enum CF_CLAUSE_TYPE -{ - CF_EXPORT_CLAUSE, - CF_ALU_CLAUSE, - CF_TEX_CLAUSE, - CF_VTX_CLAUSE, - CF_OTHER_CLAUSE, - CF_EMPTY_CLAUSE, - NUMBER_CF_CLAUSE_TYPES -} CF_CLAUSE_TYPE; - -enum -{ - MAX_BOOL_CONSTANTS = 32, - MAX_INT_CONSTANTS = 32, - MAX_FLOAT_CONSTANTS = 256, - - FC_NONE = 0, - FC_IF = 1, - FC_LOOP = 2, - FC_REP = 3, - FC_PUSH_VPM = 4, - FC_PUSH_WQM = 5, - - COND_NONE = 0, - COND_BOOL = 1, - COND_PRED = 2, - COND_ALU = 3, - - SAFEDIST_TEX = 6, ///< safe distance for using result of texture lookup in alu or another tex lookup - SAFEDIST_ALU = 6 ///< the same for alu->fc -}; - -typedef struct FC_LEVEL -{ - R700ControlFlowGenericClause * first; - R700ControlFlowGenericClause ** mid; - unsigned int unNumMid; - unsigned int midLen; - unsigned int type; - unsigned int cond; - unsigned int inv; - int id; ///< id of bool or int variable -} FC_LEVEL; - -typedef struct VTX_FETCH_METHOD -{ - GLboolean bEnableMini; - GLuint mega_fetch_remainder; -} VTX_FETCH_METHOD; - -typedef struct SUB_OFFSET -{ - GLint subIL_Offset; - GLuint unCFoffset; - GLuint unStackDepthMax; - PRESUB_DESC * pPresubDesc; - TypedShaderList lstCFInstructions_local; -} SUB_OFFSET; - -typedef struct CALLER_POINTER -{ - GLint subIL_Offset; - GLint subDescIndex; - R700ControlFlowGenericClause* cf_ptr; - - R700ControlFlowGenericClause* prelude_cf_ptr; - R700ControlFlowGenericClause* finale_cf_ptr; -} CALLER_POINTER; - -#define SQ_MAX_CALL_DEPTH 0x00000020 - -typedef struct CALL_LEVEL -{ - unsigned int FCSP_BeforeEntry; - GLint subDescIndex; - GLushort current; - GLushort max; - TypedShaderList * plstCFInstructions_local; -} CALL_LEVEL; - -#define HAS_CURRENT_LOOPRET 0x1L -#define HAS_LOOPRET 0x2L -#define LOOPRET_FLAGS HAS_LOOPRET | HAS_CURRENT_LOOPRET - -typedef struct r700_AssemblerBase -{ - R700ControlFlowSXClause* cf_last_export_ptr; - R700ControlFlowSXClause* cf_current_export_clause_ptr; - R700ControlFlowALUClause* cf_current_alu_clause_ptr; - R700ControlFlowGenericClause* cf_current_tex_clause_ptr; - R700ControlFlowGenericClause* cf_current_vtx_clause_ptr; - R700ControlFlowGenericClause* cf_current_cf_clause_ptr; - - //Result shader - R700_Shader * pR700Shader; - - // No clause has been created yet - CF_CLAUSE_TYPE cf_current_clause_type; - - BITS alu_x_opcode; - - GLuint number_of_exports; - GLuint number_of_colorandz_exports; - GLuint number_of_export_opcodes; - - PVSDWORD D; - PVSDWORD D2; - PVSDWORD S[3]; - PVSDWORD C[4]; - - unsigned int uLastPosUpdate; - unsigned int last_cond_register; - - OUT_FRAGMENT_FMT_0 fp_stOutFmt0; - - unsigned int uIIns; - unsigned int uOIns; - unsigned int number_used_registers; - unsigned int uUsedConsts; - - unsigned int flag_reg_index; - - // Fragment programs - unsigned int uiFP_AttributeMap[FRAG_ATTRIB_MAX]; - unsigned int uiFP_OutputMap[FRAG_RESULT_MAX]; - unsigned int uBoolConsts; - unsigned int uIntConsts; - unsigned int uInsts; - unsigned int uConsts; - - // Vertex programs - unsigned char ucVP_AttributeMap[VERT_ATTRIB_MAX]; - unsigned char ucVP_OutputMap[VERT_RESULT_MAX]; - - //----------------------------------------------------------------------------------- - // flow control members - //----------------------------------------------------------------------------------- - unsigned int FCSP; - FC_LEVEL fc_stack[32]; - - //----------------------------------------------------------------------------------- - // ArgSubst used in Assemble_Source() function - //----------------------------------------------------------------------------------- - int aArgSubst[4]; - - GLint hw_gpr[ NUMBER_OF_CYCLES ][ NUMBER_OF_COMPONENTS ]; - GLint hw_cfile_addr[ NUMBER_OF_COMPONENTS ]; - GLint hw_cfile_chan[ NUMBER_OF_COMPONENTS ]; - - GLuint uOutputs; - - GLint color_export_register_number[NUMBER_OF_OUTPUT_COLORS]; - GLint depth_export_register_number; - - GLint stencil_export_register_number; - GLint coverage_to_mask_export_register_number; - GLint mask_export_register_number; - - GLuint starting_export_register_number; - GLuint starting_vfetch_register_number; - GLuint starting_temp_register_number; - GLuint uHelpReg; - GLuint uFirstHelpReg; - - GLboolean input_position_is_used; - GLboolean input_normal_is_used; - - GLboolean input_color_is_used[NUMBER_OF_INPUT_COLORS]; - - GLboolean input_texture_unit_is_used[NUMBER_OF_TEXTURE_UNITS]; - - R700VertexGenericFetch* vfetch_instruction_ptr_array[VERT_ATTRIB_MAX]; - - GLuint number_of_inputs; - - InstDeps *pInstDeps; - - SHADER_PIPE_TYPE currentShaderType; - struct prog_instruction * pILInst; - GLuint uiCurInst; - GLubyte SamplerUnits[MAX_SAMPLERS]; - GLboolean bR6xx; - - /* TODO : merge bR6xx */ - GLuint unAsic; - - /* helper to decide which type of instruction to assemble */ - GLboolean is_tex; - /* we inserted helper intructions and need barrier on next TEX ins */ - GLboolean need_tex_barrier; - - SUB_OFFSET * subs; - GLuint unSubArraySize; - GLuint unSubArrayPointer; - CALLER_POINTER * callers; - GLuint unCallerArraySize; - GLuint unCallerArrayPointer; - unsigned int CALLSP; - CALL_LEVEL CALLSTACK[SQ_MAX_CALL_DEPTH]; - - GLuint unCFflags; - - PRESUB_DESC * presubs; - GLuint unPresubArraySize; - GLuint unNumPresub; - GLuint unCurNumILInsts; - - GLuint unVetTexBits; - - GLuint shadow_regs[R700_MAX_TEXTURE_UNITS]; - - GLboolean bUseMemConstant; - GLuint kcacheUsed; - -} r700_AssemblerBase; - -//Internal use -BITS addrmode_PVSDST(PVSDST * pPVSDST); -void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode); -void nomask_PVSDST(PVSDST * pPVSDST); -BITS addrmode_PVSSRC(PVSSRC* pPVSSRC); -void setaddrmode_PVSSRC(PVSSRC* pPVSSRC, BITS addrmode); -void setswizzle_PVSSRC(PVSSRC* pPVSSRC, BITS swz); -void noswizzle_PVSSRC(PVSSRC* pPVSSRC); -void swizzleagain_PVSSRC(PVSSRC * pPVSSRC, BITS x, BITS y, BITS z, BITS w); -void neg_PVSSRC(PVSSRC* pPVSSRC); -void noneg_PVSSRC(PVSSRC* pPVSSRC); -void flipneg_PVSSRC(PVSSRC* pPVSSRC); -void zerocomp_PVSSRC(PVSSRC* pPVSSRC, int c); -void onecomp_PVSSRC(PVSSRC* pPVSSRC, int c); -BITS is_misc_component_exported(VAP_OUT_VTX_FMT_0* pOutVTXFmt0); -BITS is_depth_component_exported(OUT_FRAGMENT_FMT_0* pFPOutFmt) ; -GLboolean is_reduction_opcode(PVSDWORD * dest); -GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size); - -unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3); - -unsigned int EG_GetNumOperands(GLuint opcode, GLuint nIsOp3); - -GLboolean IsTex(gl_inst_opcode Opcode); -GLboolean IsAlu(gl_inst_opcode Opcode); -int check_current_clause(r700_AssemblerBase* pAsm, - CF_CLAUSE_TYPE new_clause_type); -GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm, - R700VertexInstruction* vertex_instruction_ptr); -GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, - R700TextureInstruction* tex_instruction_ptr); -GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, - GLuint gl_client_id, - GLuint destination_register, - GLuint number_of_elements, - GLenum dataElementType, - VTX_FETCH_METHOD* pFetchMethod); -GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, - GLuint destination_register, - GLenum type, - GLint size, - GLubyte element, - GLuint _signed, - GLboolean normalize, - GLenum format, - VTX_FETCH_METHOD * pFetchMethod); - -GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm, - GLuint destination_register, - GLenum type, - GLint size, - GLubyte element, - GLuint _signed, - GLboolean normalize, - GLenum format, - VTX_FETCH_METHOD * pFetchMethod); -//----------------------- - -GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm); -GLuint gethelpr(r700_AssemblerBase* pAsm); -void resethelpr(r700_AssemblerBase* pAsm); -void checkop_init(r700_AssemblerBase* pAsm); -GLboolean mov_temp(r700_AssemblerBase* pAsm, int src); -GLboolean checkop1(r700_AssemblerBase* pAsm); -GLboolean checkop2(r700_AssemblerBase* pAsm); -GLboolean checkop3(r700_AssemblerBase* pAsm); -GLboolean assemble_src(r700_AssemblerBase *pAsm, - int src, - int fld); -GLboolean assemble_dst(r700_AssemblerBase *pAsm); -GLboolean tex_dst(r700_AssemblerBase *pAsm); -GLboolean tex_src(r700_AssemblerBase *pAsm); -GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalized); -void initialize(r700_AssemblerBase *pAsm); -GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, - int source_index, - PVSSRC* pSource, - BITS scalar_channel_index, - r700_AssemblerBase *pAsm); - -GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr, - GLuint contiguous_slots_needed); - -GLboolean add_cf_instruction(r700_AssemblerBase* pAsm); -void add_return_inst(r700_AssemblerBase *pAsm); - -void get_src_properties(R700ALUInstruction* alu_instruction_ptr, - int source_index, - BITS* psrc_sel, - BITS* psrc_rel, - BITS* psrc_chan, - BITS* psrc_neg); -int is_cfile(BITS sel); -int is_const(BITS sel); -int is_gpr(BITS sel); -GLboolean reserve_cfile(r700_AssemblerBase* pAsm, - GLuint sel, - GLuint chan); -GLboolean reserve_gpr(r700_AssemblerBase* pAsm, GLuint sel, GLuint chan, GLuint cycle); -GLboolean cycle_for_scalar_bank_swizzle(const int swiz, const int sel, GLuint* pCycle); -GLboolean cycle_for_vector_bank_swizzle(const int swiz, const int sel, GLuint* pCycle); -GLboolean check_scalar(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr); -GLboolean check_vector(r700_AssemblerBase* pAsm, - R700ALUInstruction* alu_instruction_ptr); -GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm); - -GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops); -GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset); -GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue); -GLboolean testFlag(r700_AssemblerBase *pAsm); -GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP); -GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF); - -GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode); -GLboolean assemble_ABS(r700_AssemblerBase *pAsm); -GLboolean assemble_ADD(r700_AssemblerBase *pAsm); -GLboolean assemble_ARL(r700_AssemblerBase *pAsm); -GLboolean assemble_BAD(char *opcode_str); -GLboolean assemble_CMP(r700_AssemblerBase *pAsm); -GLboolean assemble_DOT(r700_AssemblerBase *pAsm); -GLboolean assemble_DST(r700_AssemblerBase *pAsm); -GLboolean assemble_EX2(r700_AssemblerBase *pAsm); -GLboolean assemble_EXP(r700_AssemblerBase *pAsm); -GLboolean assemble_FLR(r700_AssemblerBase *pAsm); -GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm); -GLboolean assemble_FRC(r700_AssemblerBase *pAsm); -GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode); -GLboolean assemble_LG2(r700_AssemblerBase *pAsm); -GLboolean assemble_LRP(r700_AssemblerBase *pAsm); -GLboolean assemble_LOG(r700_AssemblerBase *pAsm); -GLboolean assemble_MAD(r700_AssemblerBase *pAsm); -GLboolean assemble_LIT(r700_AssemblerBase *pAsm); -GLboolean assemble_MAX(r700_AssemblerBase *pAsm); -GLboolean assemble_MIN(r700_AssemblerBase *pAsm); -GLboolean assemble_MOV(r700_AssemblerBase *pAsm); -GLboolean assemble_MUL(r700_AssemblerBase *pAsm); -GLboolean assemble_POW(r700_AssemblerBase *pAsm); -GLboolean assemble_RCP(r700_AssemblerBase *pAsm); -GLboolean assemble_RSQ(r700_AssemblerBase *pAsm); -GLboolean assemble_SCS(r700_AssemblerBase *pAsm); -GLboolean assemble_SGE(r700_AssemblerBase *pAsm); -GLboolean assemble_CONT(r700_AssemblerBase *pAsm); - -GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode); -GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode); -GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode); - -GLboolean assemble_SLT(r700_AssemblerBase *pAsm); -GLboolean assemble_SSG(r700_AssemblerBase *pAsm); -GLboolean assemble_STP(r700_AssemblerBase *pAsm); -GLboolean assemble_TEX(r700_AssemblerBase *pAsm); -GLboolean assemble_XPD(r700_AssemblerBase *pAsm); -GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm); -GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse); -GLboolean assemble_ELSE(r700_AssemblerBase *pAsm); -GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm); - -GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm); -GLboolean assemble_BRK(r700_AssemblerBase *pAsm); -GLboolean assemble_COND(r700_AssemblerBase *pAsm); -GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm); - -GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift); -GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm); -GLboolean assemble_RET(r700_AssemblerBase *pAsm); -GLboolean assemble_CAL(r700_AssemblerBase *pAsm, - GLint nILindex, - GLuint uiIL_Offest, - GLuint uiNumberInsts, - struct prog_instruction *pILInst, - PRESUB_DESC * pPresubDesc); - -GLboolean Process_Export(r700_AssemblerBase* pAsm, - GLuint type, - GLuint export_starting_index, - GLuint export_count, - GLuint starting_register_number, - GLboolean is_depth_export); -GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm, - BITS depth_channel_select); - -GLboolean callPreSub(r700_AssemblerBase* pAsm, - LOADABLE_SCRIPT_SIGNITURE scriptSigniture, - /* struct prog_instruction ** pILInstParent, */ - COMPILED_SUB * pCompiledSub, - GLshort uOutReg, - GLshort uNumValidSrc); -GLboolean EG_add_ps_interp(r700_AssemblerBase* pAsm); - -//Interface -GLboolean AssembleInstr(GLuint uiFirstInst, - GLuint uiIL_Shift, - GLuint uiNumberInsts, - struct prog_instruction *pILInst, - r700_AssemblerBase *pR700AsmCode); -GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); -GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); - -GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg); -GLboolean InitShaderProgram(r700_AssemblerBase * pAsm); - -int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader); -GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode); - -#endif //_R700_ASSEMBLER_H_ diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c deleted file mode 100644 index c653c085220..00000000000 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ /dev/null @@ -1,1656 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include "main/imports.h" -#include "main/glheader.h" -#include "main/simple_list.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" - -#include "r600_tex.h" -#include "r700_oglprog.h" -#include "r700_fragprog.h" -#include "r700_vertprog.h" - -#include "radeon_mipmap_tree.h" - -static void r700SendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - struct r700_vertex_program *vp = context->selected_vp; - - struct radeon_bo *bo = NULL; - unsigned int i; - BATCH_LOCALS(&context->radeon); - - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = r700->textures[i]; - if (t) { - if (!t->image_override) { - bo = t->mt->bo; - } else { - bo = t->bo; - } - if (bo) { - - r700SyncSurf(context, bo, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, - 0, TC_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 4); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - - if( (1<<i) & vp->r700AsmCode.unVetTexBits ) - { /* vs texture */ - R600_OUT_BATCH((i + VERT_ATTRIB_MAX + SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE); - } - else - { - R600_OUT_BATCH(i * 7); - } - - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE0); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE1); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE2); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE3); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE4); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE5); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE6); - R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE2, - bo, - r700->textures[i]->SQ_TEX_RESOURCE2, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE3, - bo, - r700->textures[i]->SQ_TEX_RESOURCE3, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - } - } - } - } -} - -#define SAMPLER_STRIDE 3 - -static void r700SendTexSamplerState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - unsigned int i; - - struct r700_vertex_program *vp = context->selected_vp; - - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = r700->textures[i]; - if (t) { - BEGIN_BATCH_NO_AUTOSTATE(5); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); - - if( (1<<i) & vp->r700AsmCode.unVetTexBits ) - { /* vs texture */ - R600_OUT_BATCH((i+SQ_TEX_SAMPLER_VS_OFFSET) * SAMPLER_STRIDE); //work 1 - } - else - { - R600_OUT_BATCH(i * 3); - } - - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER0); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER1); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER2); - END_BATCH(); - COMMIT_BATCH(); - } - } - } -} - -static void r700SendTexBorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - unsigned int i; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = r700->textures[i]; - if (t) { - BEGIN_BATCH_NO_AUTOSTATE(2 + 4); - R600_OUT_BATCH_REGSEQ((TD_PS_SAMPLER0_BORDER_RED + (i * 16)), 4); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_RED); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA); - END_BATCH(); - COMMIT_BATCH(); - } - } - } -} - -extern int getTypeSize(GLenum type); -static void r700SetupVTXConstants(struct gl_context * ctx, - void * pAos, - StreamDesc * pStreamDesc) -{ - context_t *context = R700_CONTEXT(ctx); - struct radeon_aos * paos = (struct radeon_aos *)pAos; - BATCH_LOCALS(&context->radeon); - - unsigned int uSQ_VTX_CONSTANT_WORD0_0; - unsigned int uSQ_VTX_CONSTANT_WORD1_0; - unsigned int uSQ_VTX_CONSTANT_WORD2_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD3_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD6_0 = 0; - - if (!paos->bo) - return; - - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); - else - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - - uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; - uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1; - - SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); /* TODO */ - SETfield(uSQ_VTX_CONSTANT_WORD2_0, pStreamDesc->stride, SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask); - SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(pStreamDesc->type, pStreamDesc->size, NULL), - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); /* TODO : trace back api for initial data type, not only GL_FLOAT */ - SETfield(uSQ_VTX_CONSTANT_WORD2_0, -#ifdef MESA_BIG_ENDIAN - SQ_ENDIAN_8IN32, -#else - SQ_ENDIAN_NONE, -#endif - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_shift, - SQ_VTX_CONSTANT_WORD2_0__ENDIAN_SWAP_mask); - - if(GL_TRUE == pStreamDesc->normalize) - { - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - } - else - { - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - } - - if(1 == pStreamDesc->_signed) - { - SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); - } - - SETfield(uSQ_VTX_CONSTANT_WORD3_0, 1, MEM_REQUEST_SIZE_shift, MEM_REQUEST_SIZE_mask); - SETfield(uSQ_VTX_CONSTANT_WORD6_0, SQ_TEX_VTX_VALID_BUFFER, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 2); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - R600_OUT_BATCH((pStreamDesc->element + SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD0_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD1_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD2_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD3_0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD6_0); - R600_OUT_BATCH_RELOC(uSQ_VTX_CONSTANT_WORD0_0, - paos->bo, - uSQ_VTX_CONSTANT_WORD0_0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - -} - -static void r700SendVTXState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vp = context->selected_vp; - unsigned int i, j = 0; - BATCH_LOCALS(&context->radeon); - (void) b_l_rmesa; /* silence unused var warning */ - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (context->radeon.tcl.aos_count == 0) - return; - - for(i=0; i<VERT_ATTRIB_MAX; i++) { - if(vp->mesa_program->Base.InputsRead & (1 << i)) - { - r700SetupVTXConstants(ctx, - (void*)(&context->radeon.tcl.aos[j]), - &(context->stream_desc[j])); - j++; - } - } -} - -static void r700SetRenderTarget(context_t *context, int id) -{ - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - uint32_t format = COLOR_8_8_8_8, comp_swap = SWAP_ALT, number_type = NUMBER_UNORM; - struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height; - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - - R600_STATECHANGE(context, cb_target); - - /* color buffer */ - r700->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset / 256; - - nPitchInPixel = rrb->pitch/rrb->cpp; - - if (context->radeon.radeonScreen->driScreen->dri2.enabled) - { - height = rrb->base.Height; - } - else - { - height = context->radeon.radeonScreen->driScreen->fbHeight; - } - - SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, (nPitchInPixel/8)-1, - PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask); - SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, ( (nPitchInPixel * height)/64 )-1, - SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask); - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ENDIAN_NONE, ENDIAN_shift, ENDIAN_mask); - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_LINEAR_GENERAL, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - - switch (rrb->base.Format) { - case MESA_FORMAT_RGBA8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_SIGNED_RGBA8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_SNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGBA8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_SIGNED_RGBA8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_SNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_XRGB8888_REV: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGB565: - format = COLOR_5_6_5; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGB565_REV: - format = COLOR_5_6_5; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB4444: - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB4444_REV: - format = COLOR_4_4_4_4; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB1555: - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ARGB1555_REV: - format = COLOR_1_5_5_5; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_AL88: - format = COLOR_8_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_AL88_REV: - format = COLOR_8_8; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGB332: - format = COLOR_3_3_2; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_A8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_I8: - format = COLOR_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_L8: - format = COLOR_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_UNORM; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGBA_FLOAT32: - format = COLOR_32_32_32_32_FLOAT; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_FLOAT; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_RGBA_FLOAT16: - format = COLOR_16_16_16_16_FLOAT; - comp_swap = SWAP_STD_REV; - number_type = NUMBER_FLOAT; - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ALPHA_FLOAT32: - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_ALPHA_FLOAT16: - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_LUMINANCE_FLOAT32: - format = COLOR_32_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_LUMINANCE_FLOAT16: - format = COLOR_16_FLOAT; - comp_swap = SWAP_ALT; - number_type = NUMBER_FLOAT; - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - format = COLOR_32_32_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - format = COLOR_16_16_FLOAT; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_FLOAT; - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */ - format = COLOR_32_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_FLOAT; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */ - format = COLOR_16_FLOAT; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - format = COLOR_8_24; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_Z24_S8: - format = COLOR_24_8; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_Z16: - format = COLOR_16; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_Z32: - format = COLOR_32; - comp_swap = SWAP_STD; - number_type = NUMBER_UNORM; - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_1D_TILED_THIN1, - CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask); - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_SARGB8: - format = COLOR_8_8_8_8; - comp_swap = SWAP_ALT; - number_type = NUMBER_SRGB; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_SLA8: - format = COLOR_8_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - case MESA_FORMAT_SL8: - format = COLOR_8; - comp_swap = SWAP_ALT_REV; - number_type = NUMBER_SRGB; - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit); - break; - default: - _mesa_problem(context->radeon.glCtx, "unexpected format in r700SetRenderTarget()"); - break; - } - - /* must be 0 on r7xx */ - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_FLOAT32_bit); - - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, format, - CB_COLOR0_INFO__FORMAT_shift, CB_COLOR0_INFO__FORMAT_mask); - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, comp_swap, - COMP_SWAP_shift, COMP_SWAP_mask); - SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, number_type, - NUMBER_TYPE_shift, NUMBER_TYPE_mask); - SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, BLEND_CLAMP_bit); - - r700->render_target[id].enabled = GL_TRUE; -} - -static void r700SetDepthTarget(context_t *context) -{ - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height; - - rrb = radeon_get_depthbuffer(&context->radeon); - if (!rrb) - return; - - R600_STATECHANGE(context, db_target); - - /* depth buf */ - r700->DB_DEPTH_SIZE.u32All = 0; - r700->DB_DEPTH_BASE.u32All = 0; - r700->DB_DEPTH_INFO.u32All = 0; - r700->DB_DEPTH_VIEW.u32All = 0; - - nPitchInPixel = rrb->pitch/rrb->cpp; - - if (context->radeon.radeonScreen->driScreen->dri2.enabled) - { - height = rrb->base.Height; - } - else - { - height = context->radeon.radeonScreen->driScreen->fbHeight; - } - - SETfield(r700->DB_DEPTH_SIZE.u32All, (nPitchInPixel/8)-1, - PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask); - SETfield(r700->DB_DEPTH_SIZE.u32All, ( (nPitchInPixel * height)/64 )-1, - SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask); /* size in pixel / 64 - 1 */ - - if(4 == rrb->cpp) - { - SETfield(r700->DB_DEPTH_INFO.u32All, DEPTH_8_24, - DB_DEPTH_INFO__FORMAT_shift, DB_DEPTH_INFO__FORMAT_mask); - } - else - { - SETfield(r700->DB_DEPTH_INFO.u32All, DEPTH_16, - DB_DEPTH_INFO__FORMAT_shift, DB_DEPTH_INFO__FORMAT_mask); - } - SETfield(r700->DB_DEPTH_INFO.u32All, ARRAY_1D_TILED_THIN1, - DB_DEPTH_INFO__ARRAY_MODE_shift, DB_DEPTH_INFO__ARRAY_MODE_mask); - /* r700->DB_PREFETCH_LIMIT.bits.DEPTH_HEIGHT_TILE_MAX = (context->currentDraw->h >> 3) - 1; */ /* z buffer sie may much bigger than what need, so use actual used h. */ -} - -static void r700SendDepthTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_renderbuffer *rrb; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - rrb = radeon_get_depthbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - - r700SetDepthTarget(context); - - BEGIN_BATCH_NO_AUTOSTATE(7 + 2); - R600_OUT_BATCH_REGSEQ(DB_DEPTH_SIZE, 2); - R600_OUT_BATCH(r700->DB_DEPTH_SIZE.u32All); - R600_OUT_BATCH(r700->DB_DEPTH_VIEW.u32All); - R600_OUT_BATCH_REGSEQ(DB_DEPTH_BASE, 1); - R600_OUT_BATCH(r700->DB_DEPTH_BASE.u32All); - R600_OUT_BATCH_RELOC(r700->DB_DEPTH_BASE.u32All, - rrb->bo, - r700->DB_DEPTH_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(DB_DEPTH_INFO, 1); - R600_OUT_BATCH(r700->DB_DEPTH_INFO.u32All); - R600_OUT_BATCH_RELOC(r700->DB_DEPTH_INFO.u32All, - rrb->bo, - r700->DB_DEPTH_INFO.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - if ((context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) && - (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)) { - BEGIN_BATCH_NO_AUTOSTATE(2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SURFACE_BASE_UPDATE, 0)); - R600_OUT_BATCH(1 << 0); - END_BATCH(); - } - - COMMIT_BATCH(); - -} - -static void r700SendRenderTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_renderbuffer *rrb; - BATCH_LOCALS(&context->radeon); - int id = 0; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - - r700SetRenderTarget(context, 0); - - if (id > R700_MAX_RENDER_TARGETS) - return; - - if (!r700->render_target[id].enabled) - return; - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_BASE + (4 * id), 1); - R600_OUT_BATCH(r700->render_target[id].CB_COLOR0_BASE.u32All); - R600_OUT_BATCH_RELOC(r700->render_target[id].CB_COLOR0_BASE.u32All, - rrb->bo, - r700->render_target[id].CB_COLOR0_BASE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - if ((context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) && - (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)) { - BEGIN_BATCH_NO_AUTOSTATE(2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SURFACE_BASE_UPDATE, 0)); - R600_OUT_BATCH((2 << id)); - END_BATCH(); - } - /* Set CMASK & TILE buffer to the offset of color buffer as - * we don't use those this shouldn't cause any issue and we - * then have a valid cmd stream - */ - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_TILE + (4 * id), 1); - R600_OUT_BATCH(r700->render_target[id].CB_COLOR0_TILE.u32All); - R600_OUT_BATCH_RELOC(r700->render_target[id].CB_COLOR0_TILE.u32All, - rrb->bo, - r700->render_target[id].CB_COLOR0_TILE.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(CB_COLOR0_FRAG + (4 * id), 1); - R600_OUT_BATCH(r700->render_target[id].CB_COLOR0_FRAG.u32All); - R600_OUT_BATCH_RELOC(r700->render_target[id].CB_COLOR0_FRAG.u32All, - rrb->bo, - r700->render_target[id].CB_COLOR0_FRAG.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(CB_COLOR0_SIZE + (4 * id), r700->render_target[id].CB_COLOR0_SIZE.u32All); - R600_OUT_BATCH_REGVAL(CB_COLOR0_VIEW + (4 * id), r700->render_target[id].CB_COLOR0_VIEW.u32All); - R600_OUT_BATCH_REGVAL(CB_COLOR0_MASK + (4 * id), r700->render_target[id].CB_COLOR0_MASK.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGVAL(CB_COLOR0_INFO + (4 * id), r700->render_target[id].CB_COLOR0_INFO.u32All); - R600_OUT_BATCH_RELOC(r700->render_target[id].CB_COLOR0_INFO.u32All, - rrb->bo, - r700->render_target[id].CB_COLOR0_INFO.u32All, - 0, RADEON_GEM_DOMAIN_VRAM, 0); - - END_BATCH(); - - COMMIT_BATCH(); - -} - -static void r700SendPSState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_bo * pbo; - struct radeon_bo * pbo_const; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(GL_CONTEXT(context)); - - if (!pbo) - return; - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1); - R600_OUT_BATCH(r700->ps.SQ_PGM_START_PS.u32All); - R600_OUT_BATCH_RELOC(r700->ps.SQ_PGM_START_PS.u32All, - pbo, - r700->ps.SQ_PGM_START_PS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, r700->ps.SQ_PGM_RESOURCES_PS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, r700->ps.SQ_PGM_EXPORTS_PS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, r700->ps.SQ_PGM_CF_OFFSET_PS.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL(SQ_LOOP_CONST_0, 0x01000FFF); - END_BATCH(); - - pbo_const = (struct radeon_bo *)r700GetActiveFpShaderConstBo(GL_CONTEXT(context)); - //TODO : set up shader const - - COMMIT_BATCH(); - -} - -static void r700SendVSState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_bo * pbo; - struct radeon_bo * pbo_const; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context)); - - if (!pbo) - return; - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1); - R600_OUT_BATCH(r700->vs.SQ_PGM_START_VS.u32All); - R600_OUT_BATCH_RELOC(r700->vs.SQ_PGM_START_VS.u32All, - pbo, - r700->vs.SQ_PGM_START_VS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, r700->vs.SQ_PGM_RESOURCES_VS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, r700->vs.SQ_PGM_CF_OFFSET_VS.u32All); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + 32*4), 0x0100000F); - //R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F); - END_BATCH(); - - /* TODO : handle 4 bufs */ - if(GL_TRUE == r700->bShaderUseMemConstant) - { - pbo_const = (struct radeon_bo *)r700GetActiveVpShaderConstBo(GL_CONTEXT(context)); - if(NULL != pbo_const) - { - r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); /* TODO : Check kc bit. */ - - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL(SQ_ALU_CONST_BUFFER_SIZE_VS_0, (r700->vs.num_consts * 4)/16 ); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_ALU_CONST_CACHE_VS_0, 1); - R600_OUT_BATCH(r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All); - R600_OUT_BATCH_RELOC(r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All, - pbo_const, - r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - } - } - - COMMIT_BATCH(); -} - -static void r700SendFSState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_bo * pbo; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - /* XXX fixme - * R6xx chips require a FS be emitted, even if it's not used. - * since we aren't using FS yet, just send the VS address to make - * the kernel command checker happy - */ - pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context)); - r700->fs.SQ_PGM_START_FS.u32All = r700->vs.SQ_PGM_START_VS.u32All; - r700->fs.SQ_PGM_RESOURCES_FS.u32All = 0; - r700->fs.SQ_PGM_CF_OFFSET_FS.u32All = 0; - /* XXX */ - - if (!pbo) - return; - - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_FS, 1); - R600_OUT_BATCH(r700->fs.SQ_PGM_START_FS.u32All); - R600_OUT_BATCH_RELOC(r700->fs.SQ_PGM_START_FS.u32All, - pbo, - r700->fs.SQ_PGM_START_FS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_FS, r700->fs.SQ_PGM_RESOURCES_FS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_FS, r700->fs.SQ_PGM_CF_OFFSET_FS.u32All); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static void r700SendViewportState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - int id = 0; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (id > R700_MAX_VIEWPORTS) - return; - - if (!r700->viewport[id].enabled) - return; - - BEGIN_BATCH_NO_AUTOSTATE(16); - R600_OUT_BATCH_REGSEQ(PA_SC_VPORT_SCISSOR_0_TL + (8 * id), 2); - R600_OUT_BATCH(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All); - R600_OUT_BATCH_REGSEQ(PA_SC_VPORT_ZMIN_0 + (8 * id), 2); - R600_OUT_BATCH(r700->viewport[id].PA_SC_VPORT_ZMIN_0.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_SC_VPORT_ZMAX_0.u32All); - R600_OUT_BATCH_REGSEQ(PA_CL_VPORT_XSCALE_0 + (24 * id), 6); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_XSCALE.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_XOFFSET.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_YSCALE.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_YOFFSET.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_ZSCALE.u32All); - R600_OUT_BATCH(r700->viewport[id].PA_CL_VPORT_ZOFFSET.u32All); - END_BATCH(); - - COMMIT_BATCH(); - -} - -static void r700SendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(34); - R600_OUT_BATCH_REGSEQ(SQ_CONFIG, 6); - R600_OUT_BATCH(r700->sq_config.SQ_CONFIG.u32All); - R600_OUT_BATCH(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All); - R600_OUT_BATCH(r700->sq_config.SQ_GPR_RESOURCE_MGMT_2.u32All); - R600_OUT_BATCH(r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All); - R600_OUT_BATCH(r700->sq_config.SQ_STACK_RESOURCE_MGMT_1.u32All); - R600_OUT_BATCH(r700->sq_config.SQ_STACK_RESOURCE_MGMT_2.u32All); - - R600_OUT_BATCH_REGVAL(TA_CNTL_AUX, r700->TA_CNTL_AUX.u32All); - R600_OUT_BATCH_REGVAL(VC_ENHANCE, r700->VC_ENHANCE.u32All); - R600_OUT_BATCH_REGVAL(R7xx_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, r700->SQ_DYN_GPR_CNTL_PS_FLUSH_REQ.u32All); - R600_OUT_BATCH_REGVAL(DB_DEBUG, r700->DB_DEBUG.u32All); - R600_OUT_BATCH_REGVAL(DB_WATERMARKS, r700->DB_WATERMARKS.u32All); - - R600_OUT_BATCH_REGSEQ(SQ_ESGS_RING_ITEMSIZE, 9); - R600_OUT_BATCH(r700->SQ_ESGS_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_GSVS_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_ESTMP_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_GSTMP_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_VSTMP_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_PSTMP_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_FBUF_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_REDUC_RING_ITEMSIZE.u32All); - R600_OUT_BATCH(r700->SQ_GS_VERT_ITEMSIZE.u32All); - END_BATCH(); - - COMMIT_BATCH(); -} - -static void r700SendUCPState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - int i; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - for (i = 0; i < R700_MAX_UCP; i++) { - if (r700->ucp[i].enabled) { - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGSEQ(PA_CL_UCP_0_X + (16 * i), 4); - R600_OUT_BATCH(r700->ucp[i].PA_CL_UCP_0_X.u32All); - R600_OUT_BATCH(r700->ucp[i].PA_CL_UCP_0_Y.u32All); - R600_OUT_BATCH(r700->ucp[i].PA_CL_UCP_0_Z.u32All); - R600_OUT_BATCH(r700->ucp[i].PA_CL_UCP_0_W.u32All); - END_BATCH(); - COMMIT_BATCH(); - } - } -} - -static void r700SendSPIState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - unsigned int ui; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(59 + R700_MAX_SHADER_EXPORTS); - - R600_OUT_BATCH_REGSEQ(SQ_VTX_SEMANTIC_0, 32); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_0.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_1.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_2.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_3.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_4.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_5.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_6.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_7.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_8.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_9.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_10.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_11.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_12.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_13.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_14.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_15.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_16.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_17.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_18.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_19.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_20.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_21.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_22.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_23.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_24.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_25.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_26.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_27.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_28.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_29.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_30.u32All); - R600_OUT_BATCH(r700->SQ_VTX_SEMANTIC_31.u32All); - - R600_OUT_BATCH_REGSEQ(SPI_VS_OUT_ID_0, 10); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_0.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_1.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_2.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_3.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_4.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_5.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_6.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_7.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_8.u32All); - R600_OUT_BATCH(r700->SPI_VS_OUT_ID_9.u32All); - - R600_OUT_BATCH_REGSEQ(SPI_VS_OUT_CONFIG, 9); - R600_OUT_BATCH(r700->SPI_VS_OUT_CONFIG.u32All); - R600_OUT_BATCH(r700->SPI_THREAD_GROUPING.u32All); - R600_OUT_BATCH(r700->SPI_PS_IN_CONTROL_0.u32All); - R600_OUT_BATCH(r700->SPI_PS_IN_CONTROL_1.u32All); - R600_OUT_BATCH(r700->SPI_INTERP_CONTROL_0.u32All); - R600_OUT_BATCH(r700->SPI_INPUT_Z.u32All); - R600_OUT_BATCH(r700->SPI_FOG_CNTL.u32All); - R600_OUT_BATCH(r700->SPI_FOG_FUNC_SCALE.u32All); - R600_OUT_BATCH(r700->SPI_FOG_FUNC_BIAS.u32All); - - R600_OUT_BATCH_REGSEQ(SPI_PS_INPUT_CNTL_0, R700_MAX_SHADER_EXPORTS); - for(ui = 0; ui < R700_MAX_SHADER_EXPORTS; ui++) - R600_OUT_BATCH(r700->SPI_PS_INPUT_CNTL[ui].u32All); - - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendVGTState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(41); - - R600_OUT_BATCH_REGSEQ(VGT_MAX_VTX_INDX, 4); - R600_OUT_BATCH(r700->VGT_MAX_VTX_INDX.u32All); - R600_OUT_BATCH(r700->VGT_MIN_VTX_INDX.u32All); - R600_OUT_BATCH(r700->VGT_INDX_OFFSET.u32All); - R600_OUT_BATCH(r700->VGT_MULTI_PRIM_IB_RESET_INDX.u32All); - - R600_OUT_BATCH_REGSEQ(VGT_OUTPUT_PATH_CNTL, 13); - R600_OUT_BATCH(r700->VGT_OUTPUT_PATH_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_HOS_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_HOS_MAX_TESS_LEVEL.u32All); - R600_OUT_BATCH(r700->VGT_HOS_MIN_TESS_LEVEL.u32All); - R600_OUT_BATCH(r700->VGT_HOS_REUSE_DEPTH.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_PRIM_TYPE.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_FIRST_DECR.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_DECR.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_VECT_0_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_VECT_1_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_VECT_0_FMT_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_GROUP_VECT_1_FMT_CNTL.u32All); - R600_OUT_BATCH(r700->VGT_GS_MODE.u32All); - - R600_OUT_BATCH_REGVAL(VGT_PRIMITIVEID_EN, r700->VGT_PRIMITIVEID_EN.u32All); - R600_OUT_BATCH_REGVAL(VGT_MULTI_PRIM_IB_RESET_EN, r700->VGT_MULTI_PRIM_IB_RESET_EN.u32All); - R600_OUT_BATCH_REGVAL(VGT_INSTANCE_STEP_RATE_0, r700->VGT_INSTANCE_STEP_RATE_0.u32All); - R600_OUT_BATCH_REGVAL(VGT_INSTANCE_STEP_RATE_1, r700->VGT_INSTANCE_STEP_RATE_1.u32All); - - R600_OUT_BATCH_REGSEQ(VGT_STRMOUT_EN, 3); - R600_OUT_BATCH(r700->VGT_STRMOUT_EN.u32All); - R600_OUT_BATCH(r700->VGT_REUSE_OFF.u32All); - R600_OUT_BATCH(r700->VGT_VTX_CNT_EN.u32All); - - R600_OUT_BATCH_REGVAL(VGT_STRMOUT_BUFFER_EN, r700->VGT_STRMOUT_BUFFER_EN.u32All); - - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendSXState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(SX_MISC, r700->SX_MISC.u32All); - R600_OUT_BATCH_REGVAL(SX_ALPHA_TEST_CONTROL, r700->SX_ALPHA_TEST_CONTROL.u32All); - R600_OUT_BATCH_REGVAL(SX_ALPHA_REF, r700->SX_ALPHA_REF.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendDBState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(17); - - R600_OUT_BATCH_REGSEQ(DB_STENCIL_CLEAR, 2); - R600_OUT_BATCH(r700->DB_STENCIL_CLEAR.u32All); - R600_OUT_BATCH(r700->DB_DEPTH_CLEAR.u32All); - - R600_OUT_BATCH_REGVAL(DB_DEPTH_CONTROL, r700->DB_DEPTH_CONTROL.u32All); - R600_OUT_BATCH_REGVAL(DB_SHADER_CONTROL, r700->DB_SHADER_CONTROL.u32All); - - R600_OUT_BATCH_REGSEQ(DB_RENDER_CONTROL, 2); - R600_OUT_BATCH(r700->DB_RENDER_CONTROL.u32All); - R600_OUT_BATCH(r700->DB_RENDER_OVERRIDE.u32All); - - R600_OUT_BATCH_REGVAL(DB_ALPHA_TO_MASK, r700->DB_ALPHA_TO_MASK.u32All); - - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendStencilState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(4); - R600_OUT_BATCH_REGSEQ(DB_STENCILREFMASK, 2); - R600_OUT_BATCH(r700->DB_STENCILREFMASK.u32All); - R600_OUT_BATCH(r700->DB_STENCILREFMASK_BF.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendCBState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { - BEGIN_BATCH_NO_AUTOSTATE(11); - R600_OUT_BATCH_REGSEQ(CB_CLEAR_RED, 4); - R600_OUT_BATCH(r700->CB_CLEAR_RED_R6XX.u32All); - R600_OUT_BATCH(r700->CB_CLEAR_GREEN_R6XX.u32All); - R600_OUT_BATCH(r700->CB_CLEAR_BLUE_R6XX.u32All); - R600_OUT_BATCH(r700->CB_CLEAR_ALPHA_R6XX.u32All); - R600_OUT_BATCH_REGSEQ(CB_FOG_RED, 3); - R600_OUT_BATCH(r700->CB_FOG_RED_R6XX.u32All); - R600_OUT_BATCH(r700->CB_FOG_GREEN_R6XX.u32All); - R600_OUT_BATCH(r700->CB_FOG_BLUE_R6XX.u32All); - END_BATCH(); - } - - BEGIN_BATCH_NO_AUTOSTATE(7); - R600_OUT_BATCH_REGSEQ(CB_TARGET_MASK, 2); - R600_OUT_BATCH(r700->CB_TARGET_MASK.u32All); - R600_OUT_BATCH(r700->CB_SHADER_MASK.u32All); - R600_OUT_BATCH_REGVAL(R7xx_CB_SHADER_CONTROL, r700->CB_SHADER_CONTROL.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendCBCLRCMPState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGSEQ(CB_CLRCMP_CONTROL, 4); - R600_OUT_BATCH(r700->CB_CLRCMP_CONTROL.u32All); - R600_OUT_BATCH(r700->CB_CLRCMP_SRC.u32All); - R600_OUT_BATCH(r700->CB_CLRCMP_DST.u32All); - R600_OUT_BATCH(r700->CB_CLRCMP_MSK.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendCBBlendState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - unsigned int ui; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL(CB_BLEND_CONTROL, r700->CB_BLEND_CONTROL.u32All); - END_BATCH(); - } - - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL(CB_COLOR_CONTROL, r700->CB_COLOR_CONTROL.u32All); - END_BATCH(); - - if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) { - for (ui = 0; ui < R700_MAX_RENDER_TARGETS; ui++) { - if (r700->render_target[ui].enabled) { - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH_REGVAL(CB_BLEND0_CONTROL + (4 * ui), - r700->render_target[ui].CB_BLEND0_CONTROL.u32All); - END_BATCH(); - } - } - } - - COMMIT_BATCH(); -} - -static void r700SendCBBlendColorState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGSEQ(CB_BLEND_RED, 4); - R600_OUT_BATCH(r700->CB_BLEND_RED.u32All); - R600_OUT_BATCH(r700->CB_BLEND_GREEN.u32All); - R600_OUT_BATCH(r700->CB_BLEND_BLUE.u32All); - R600_OUT_BATCH(r700->CB_BLEND_ALPHA.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendSUState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(PA_SU_SC_MODE_CNTL, r700->PA_SU_SC_MODE_CNTL.u32All); - R600_OUT_BATCH_REGSEQ(PA_SU_POINT_SIZE, 4); - R600_OUT_BATCH(r700->PA_SU_POINT_SIZE.u32All); - R600_OUT_BATCH(r700->PA_SU_POINT_MINMAX.u32All); - R600_OUT_BATCH(r700->PA_SU_LINE_CNTL.u32All); - R600_OUT_BATCH(r700->PA_SU_VTX_CNTL.u32All); - END_BATCH(); - COMMIT_BATCH(); - -} - -static void r700SendPolyState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(10); - R600_OUT_BATCH_REGSEQ(PA_SU_POLY_OFFSET_DB_FMT_CNTL, 2); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_CLAMP.u32All); - R600_OUT_BATCH_REGSEQ(PA_SU_POLY_OFFSET_FRONT_SCALE, 4); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_FRONT_SCALE.u32All); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_FRONT_OFFSET.u32All); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_BACK_SCALE.u32All); - R600_OUT_BATCH(r700->PA_SU_POLY_OFFSET_BACK_OFFSET.u32All); - END_BATCH(); - COMMIT_BATCH(); - -} - -static void r700SendCLState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(12); - R600_OUT_BATCH_REGVAL(PA_CL_CLIP_CNTL, r700->PA_CL_CLIP_CNTL.u32All); - R600_OUT_BATCH_REGVAL(PA_CL_VTE_CNTL, r700->PA_CL_VTE_CNTL.u32All); - R600_OUT_BATCH_REGVAL(PA_CL_VS_OUT_CNTL, r700->PA_CL_VS_OUT_CNTL.u32All); - R600_OUT_BATCH_REGVAL(PA_CL_NANINF_CNTL, r700->PA_CL_NANINF_CNTL.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendGBState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGSEQ(PA_CL_GB_VERT_CLIP_ADJ, 4); - R600_OUT_BATCH(r700->PA_CL_GB_VERT_CLIP_ADJ.u32All); - R600_OUT_BATCH(r700->PA_CL_GB_VERT_DISC_ADJ.u32All); - R600_OUT_BATCH(r700->PA_CL_GB_HORZ_CLIP_ADJ.u32All); - R600_OUT_BATCH(r700->PA_CL_GB_HORZ_DISC_ADJ.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendScissorState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(22); - R600_OUT_BATCH_REGSEQ(PA_SC_SCREEN_SCISSOR_TL, 2); - R600_OUT_BATCH(r700->PA_SC_SCREEN_SCISSOR_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_SCREEN_SCISSOR_BR.u32All); - - R600_OUT_BATCH_REGSEQ(PA_SC_WINDOW_OFFSET, 12); - R600_OUT_BATCH(r700->PA_SC_WINDOW_OFFSET.u32All); - R600_OUT_BATCH(r700->PA_SC_WINDOW_SCISSOR_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_WINDOW_SCISSOR_BR.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_RULE.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_0_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_0_BR.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_1_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_1_BR.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_2_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_2_BR.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_3_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_CLIPRECT_3_BR.u32All); - - R600_OUT_BATCH_REGSEQ(PA_SC_GENERIC_SCISSOR_TL, 2); - R600_OUT_BATCH(r700->PA_SC_GENERIC_SCISSOR_TL.u32All); - R600_OUT_BATCH(r700->PA_SC_GENERIC_SCISSOR_BR.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendSCState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - BEGIN_BATCH_NO_AUTOSTATE(15); - R600_OUT_BATCH_REGVAL(R7xx_PA_SC_EDGERULE, r700->PA_SC_EDGERULE.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_LINE_STIPPLE, r700->PA_SC_LINE_STIPPLE.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_MPASS_PS_CNTL, r700->PA_SC_MPASS_PS_CNTL.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_MODE_CNTL, r700->PA_SC_MODE_CNTL.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_LINE_CNTL, r700->PA_SC_LINE_CNTL.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendAAState(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - BATCH_LOCALS(&context->radeon); - - BEGIN_BATCH_NO_AUTOSTATE(12); - R600_OUT_BATCH_REGVAL(PA_SC_AA_CONFIG, r700->PA_SC_AA_CONFIG.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_AA_SAMPLE_LOCS_MCTX, r700->PA_SC_AA_SAMPLE_LOCS_MCTX.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, r700->PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX.u32All); - R600_OUT_BATCH_REGVAL(PA_SC_AA_MASK, r700->PA_SC_AA_MASK.u32All); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendPSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - int i; - BATCH_LOCALS(&context->radeon); - - if (r700->ps.num_consts == 0) - return; - - BEGIN_BATCH_NO_AUTOSTATE(2 + (r700->ps.num_consts * 4)); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_ALU_CONST, (r700->ps.num_consts * 4))); - /* assembler map const from very beginning. */ - R600_OUT_BATCH(SQ_ALU_CONSTANT_PS_OFFSET * 4); - for (i = 0; i < r700->ps.num_consts; i++) { - R600_OUT_BATCH(r700->ps.consts[i][0].u32All); - R600_OUT_BATCH(r700->ps.consts[i][1].u32All); - R600_OUT_BATCH(r700->ps.consts[i][2].u32All); - R600_OUT_BATCH(r700->ps.consts[i][3].u32All); - } - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendVSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - int i; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - if (r700->vs.num_consts == 0) - return; - - BEGIN_BATCH_NO_AUTOSTATE(2 + (r700->vs.num_consts * 4)); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_ALU_CONST, (r700->vs.num_consts * 4))); - /* assembler map const from very beginning. */ - R600_OUT_BATCH(SQ_ALU_CONSTANT_VS_OFFSET * 4); - for (i = 0; i < r700->vs.num_consts; i++) { - R600_OUT_BATCH(r700->vs.consts[i][0].u32All); - R600_OUT_BATCH(r700->vs.consts[i][1].u32All); - R600_OUT_BATCH(r700->vs.consts[i][2].u32All); - R600_OUT_BATCH(r700->vs.consts[i][3].u32All); - } - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700SendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - struct radeon_query_object *query = radeon->query.current; - BATCH_LOCALS(radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - /* clear the buffer */ - radeon_bo_map(query->bo, GL_FALSE); - memset(query->bo->ptr, 0, 4 * 2 * sizeof(uint64_t)); /* 4 DBs, 2 qwords each */ - radeon_bo_unmap(query->bo); - - radeon_cs_space_check_with_bo(radeon->cmdbuf.cs, - query->bo, - 0, RADEON_GEM_DOMAIN_GTT); - - BEGIN_BATCH_NO_AUTOSTATE(4 + 2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); - R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1)); - R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */ - R600_OUT_BATCH(0x00000000); - R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); - END_BATCH(); - query->emitted_begin = GL_TRUE; -} - -static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - return atom->cmd_size; -} - -static int check_cb(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - int count = 7; - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - count += 11; - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - - return count; -} - -static int check_blnd(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - unsigned int ui; - int count = 3; - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - count += 3; - - if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) { - /* targets are enabled in r700SetRenderTarget but state - size is calculated before that. Until MRT's are done - hardcode target0 as enabled. */ - count += 3; - for (ui = 1; ui < R700_MAX_RENDER_TARGETS; ui++) { - if (r700->render_target[ui].enabled) - count += 3; - } - } - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - - return count; -} - -static int check_ucp(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int i; - int count = 0; - - for (i = 0; i < R700_MAX_UCP; i++) { - if (r700->ucp[i].enabled) - count += 6; - } - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count; -} - -static int check_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - int count = context->radeon.tcl.aos_count * 18; - - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count; -} - -static int check_tx(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - unsigned int i, count = 0; - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled) { - radeonTexObj *t = r700->textures[i]; - if (t) - count++; - } - } - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count * 31; -} - -static int check_ps_consts(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int count = r700->ps.num_consts * 4; - - if (count) - count += 2; - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - - return count; -} - -static int check_vs_consts(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int count = r700->vs.num_consts * 4; - - if (count) - count += 2; - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - - return count; -} - -static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - struct radeon_query_object *query = radeon->query.current; - int count; - - if (!query || query->emitted_begin) - count = 0; - else - count = atom->cmd_size; - radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); - return count; -} - -#define ALLOC_STATE( ATOM, CHK, SZ, EMIT ) \ -do { \ - context->atoms.ATOM.cmd_size = (SZ); \ - context->atoms.ATOM.cmd = NULL; \ - context->atoms.ATOM.name = #ATOM; \ - context->atoms.ATOM.idx = 0; \ - context->atoms.ATOM.check = check_##CHK; \ - context->atoms.ATOM.dirty = GL_FALSE; \ - context->atoms.ATOM.emit = (EMIT); \ - context->radeon.hw.max_state_size += (SZ); \ - insert_at_tail(&context->radeon.hw.atomlist, &context->atoms.ATOM); \ -} while (0) - -static void r600_init_query_stateobj(radeonContextPtr radeon, int SZ) -{ - radeon->query.queryobj.cmd_size = (SZ); - radeon->query.queryobj.cmd = NULL; - radeon->query.queryobj.name = "queryobj"; - radeon->query.queryobj.idx = 0; - radeon->query.queryobj.check = check_queryobj; - radeon->query.queryobj.dirty = GL_FALSE; - radeon->query.queryobj.emit = r700SendQueryBegin; - radeon->hw.max_state_size += (SZ); - insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj); -} - -void r600InitAtoms(context_t *context) -{ - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); - context->radeon.hw.max_state_size = 10 + 5 + 14; /* start 3d, idle, cb/db flush */ - - /* Setup the atom linked list */ - make_empty_list(&context->radeon.hw.atomlist); - context->radeon.hw.atomlist.name = "atom-list"; - - ALLOC_STATE(sq, always, 34, r700SendSQConfig); - ALLOC_STATE(db, always, 17, r700SendDBState); - ALLOC_STATE(stencil, always, 4, r700SendStencilState); - ALLOC_STATE(db_target, always, 16, r700SendDepthTargetState); - ALLOC_STATE(sc, always, 15, r700SendSCState); - ALLOC_STATE(scissor, always, 22, r700SendScissorState); - ALLOC_STATE(aa, always, 12, r700SendAAState); - ALLOC_STATE(cl, always, 12, r700SendCLState); - ALLOC_STATE(gb, always, 6, r700SendGBState); - ALLOC_STATE(ucp, ucp, (R700_MAX_UCP * 6), r700SendUCPState); - ALLOC_STATE(su, always, 9, r700SendSUState); - ALLOC_STATE(poly, always, 10, r700SendPolyState); - ALLOC_STATE(cb, cb, 18, r700SendCBState); - ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState); - ALLOC_STATE(cb_target, always, 31, r700SendRenderTargetState); - ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState); - ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState); - ALLOC_STATE(sx, always, 9, r700SendSXState); - ALLOC_STATE(vgt, always, 41, r700SendVGTState); - ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState); - ALLOC_STATE(vpt, always, 16, r700SendViewportState); - ALLOC_STATE(fs, always, 18, r700SendFSState); - if(GL_TRUE == r700->bShaderUseMemConstant) - { - ALLOC_STATE(vs, always, 36, r700SendVSState); - ALLOC_STATE(ps, always, 24, r700SendPSState); /* TODO : not imp yet, fix later. */ - } - else - { - ALLOC_STATE(vs, always, 21, r700SendVSState); - ALLOC_STATE(ps, always, 24, r700SendPSState); - ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts); - ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts); - } - - ALLOC_STATE(vtx, vtx, (VERT_ATTRIB_MAX * 18), r700SendVTXState); - ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState); - ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState); - ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState); - r600_init_query_stateobj(&context->radeon, 6 * 2); - - context->radeon.hw.is_dirty = GL_TRUE; - context->radeon.hw.all_dirty = GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/r700_chip.h b/src/mesa/drivers/dri/r600/r700_chip.h deleted file mode 100644 index 0ca237b1fe0..00000000000 --- a/src/mesa/drivers/dri/r600/r700_chip.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _R700_CHIP_H_ -#define _R700_CHIP_H_ - -#include <GL/gl.h> - -#include "radeon_common_context.h" - -#include "r600_reg.h" -#include "r600_reg_auto_r6xx.h" -#include "r600_reg_r6xx.h" -#include "r600_reg_r7xx.h" - -#include "r700_chipoffset.h" - -#define SETfield(x, val, shift, mask) ( (x) = ((x) & ~(mask)) | (((val) << (shift)) & (mask)) )/* u32All */ -#define CLEARfield(x, mask) ( (x) &= ~(mask) ) -#define SETbit(x, bit) ( (x) |= (bit) ) -#define CLEARbit(x, bit) ( (x) &= ~(bit) ) - -#define GETbits(x, shift, mask) ( ((x) & (mask)) >> (shift) ) - -#define R700_TEXTURE_NUMBERUNITS 16 -#define R700_MAX_RENDER_TARGETS 8 -#define R700_MAX_VIEWPORTS 16 -#define R700_MAX_SHADER_EXPORTS 32 -#define R700_MAX_UCP 6 -#define R700_MAX_DX9_CONSTS 256 - -/* Enum not show in r600_*.h */ - -#define FETCH_RESOURCE_STRIDE 7 - -#define ASIC_CONFIG_BASE_INDEX 0x2000 -#define ASIC_CONTEXT_BASE_INDEX 0xA000 -#define ASIC_CTL_CONST_BASE_INDEX 0xF3FC - - -enum -{ - SQ_ABSOLUTE = 0x00000000, - SQ_RELATIVE = 0x00000001, -}; - -enum -{ - SQ_ALU_SCL_210 = 0x00000000, - SQ_ALU_SCL_122 = 0x00000001, - SQ_ALU_SCL_212 = 0x00000002, - SQ_ALU_SCL_221 = 0x00000003, -}; - -enum -{ - SQ_TEX_UNNORMALIZED = 0x00000000, - SQ_TEX_NORMALIZED = 0x00000001, -}; - -enum -{ - SQ_CF_PIXEL_MRT0 = 0x00000000, - SQ_CF_PIXEL_MRT1 = 0x00000001, - SQ_CF_PIXEL_MRT2 = 0x00000002, - SQ_CF_PIXEL_MRT3 = 0x00000003, - SQ_CF_PIXEL_MRT4 = 0x00000004, - SQ_CF_PIXEL_MRT5 = 0x00000005, - SQ_CF_PIXEL_MRT6 = 0x00000006, - SQ_CF_PIXEL_MRT7 = 0x00000007, - SQ_CF_PIXEL_Z = 0x0000003d, -}; - -typedef enum ENUM_SQ_CF_ARRAY_BASE_POS { -SQ_CF_POS_0 = 0x0000003c, -SQ_CF_POS_1 = 0x0000003d, -SQ_CF_POS_2 = 0x0000003e, -SQ_CF_POS_3 = 0x0000003f, -} ENUM_SQ_CF_ARRAY_BASE_POS; - -enum -{ - PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit = 23, -}; - -enum -{ - TEX_XYFilter_Point = 0x00000000, - TEX_XYFilter_Linear = 0x00000001, - TEX_XYFilter_Cubic = 0x00000002, - TEX_XYFilter_Cleartype = 0x00000003, - - TEX_MipFilter_None = 0x00000000, - TEX_MipFilter_Point = 0x00000001, - TEX_MipFilter_Linear = 0x00000002, -}; - -enum -{ - SQ_EXPORT_WRITE = 0x00000000, - SQ_EXPORT_WRITE_IND = 0x00000001, - SQ_EXPORT_WRITE_ACK = 0x00000002, - SQ_EXPORT_WRITE_IND_ACK = 0x00000003, -}; - -/* --------------------------------- */ - -enum -{ - R700_PM4_PACKET0_NOP = 0x00000000, - R700_PM4_PACKET1_NOP = 0x40000000, - R700_PM4_PACKET2_NOP = 0x80000000, - R700_PM4_PACKET3_NOP = 0xC0000000, -}; - -#define PM4_OPCODE_SET_INDEX_TYPE (R700_PM4_PACKET3_NOP | (IT_INDEX_TYPE << 8)) - -#define PM4_OPCODE_DRAW_INDEX_AUTO (R700_PM4_PACKET3_NOP | (IT_DRAW_INDEX_AUTO << 8)) -#define PM4_OPCODE_DRAW_INDEX_IMMD (R700_PM4_PACKET3_NOP | (IT_DRAW_INDEX_IMMD << 8)) -#define PM4_OPCODE_WAIT_REG_MEM (R700_PM4_PACKET3_NOP | (IT_WAIT_REG_MEM << 8)) -#define PM4_OPCODE_SET_CONTEXT_REG (R700_PM4_PACKET3_NOP | (IT_SET_CONTEXT_REG << 8)) -#define PM4_OPCODE_SET_CONFIG_REG (R700_PM4_PACKET3_NOP | (IT_SET_CONFIG_REG << 8)) -#define PM4_OPCODE_SET_ALU_CONST (R700_PM4_PACKET3_NOP | (IT_SET_ALU_CONST << 8)) -#define PM4_OPCODE_SET_RESOURCE (R700_PM4_PACKET3_NOP | (IT_SET_RESOURCE << 8)) -#define PM4_OPCODE_SET_SAMPLER (R700_PM4_PACKET3_NOP | (IT_SET_SAMPLER << 8)) -#define PM4_OPCODE_CONTEXT_CONTROL (R700_PM4_PACKET3_NOP | (IT_CONTEXT_CONTROL << 8)) - -union UINT_FLOAT -{ - unsigned int u32All; - float f32All; -}; - -#if 0 -typedef struct _TEXTURE_STATE_STRUCT -{ - union UINT_FLOAT SQ_TEX_RESOURCE0; - union UINT_FLOAT SQ_TEX_RESOURCE1; - union UINT_FLOAT SQ_TEX_RESOURCE2; - union UINT_FLOAT SQ_TEX_RESOURCE3; - union UINT_FLOAT SQ_TEX_RESOURCE4; - union UINT_FLOAT SQ_TEX_RESOURCE5; - union UINT_FLOAT SQ_TEX_RESOURCE6; - GLboolean enabled; -} TEXTURE_STATE_STRUCT; - -typedef struct _SAMPLER_STATE_STRUCT -{ - union UINT_FLOAT SQ_TEX_SAMPLER0; - union UINT_FLOAT SQ_TEX_SAMPLER1; - union UINT_FLOAT SQ_TEX_SAMPLER2; - GLboolean enabled; -} SAMPLER_STATE_STRUCT; - -typedef struct _R700_TEXTURE_STATES -{ - TEXTURE_STATE_STRUCT *textures[R700_TEXTURE_NUMBERUNITS]; - SAMPLER_STATE_STRUCT *samplers[R700_TEXTURE_NUMBERUNITS]; -} R700_TEXTURE_STATES; -#endif - -typedef struct _RENDER_TARGET_STATE_STRUCT -{ - union UINT_FLOAT CB_COLOR0_BASE; /* 0xA010 */ - union UINT_FLOAT CB_COLOR0_SIZE; /* 0xA018 */ - union UINT_FLOAT CB_COLOR0_VIEW; /* 0xA020 */ - union UINT_FLOAT CB_COLOR0_INFO; /* 0xA028 */ - union UINT_FLOAT CB_COLOR0_TILE; /* 0xA030 */ - union UINT_FLOAT CB_COLOR0_FRAG; /* 0xA038 */ - union UINT_FLOAT CB_COLOR0_MASK; /* 0xA040 */ - union UINT_FLOAT CB_BLEND0_CONTROL; /* 0xA1E0 */ - GLboolean enabled; - GLboolean dirty; -} RENDER_TARGET_STATE_STRUCT; - -typedef struct _VIEWPORT_STATE_STRUCT -{ - union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_TL; /* 0xA094 */ - union UINT_FLOAT PA_SC_VPORT_SCISSOR_0_BR; /* 0xA095 */ - union UINT_FLOAT PA_SC_VPORT_ZMIN_0; /* 0xA0B4 */ - union UINT_FLOAT PA_SC_VPORT_ZMAX_0; /* 0xA0B5 */ - union UINT_FLOAT PA_CL_VPORT_XSCALE; /* 0xA10F */ - union UINT_FLOAT PA_CL_VPORT_XOFFSET; /* 0xA110 */ - union UINT_FLOAT PA_CL_VPORT_YSCALE; /* 0xA111 */ - union UINT_FLOAT PA_CL_VPORT_YOFFSET; /* 0xA112 */ - union UINT_FLOAT PA_CL_VPORT_ZSCALE; /* 0xA113 */ - union UINT_FLOAT PA_CL_VPORT_ZOFFSET; /* 0xA114 */ - GLboolean enabled; - GLboolean dirty; -} VIEWPORT_STATE_STRUCT; - -typedef struct _UCP_STATE_STRUCT -{ - union UINT_FLOAT PA_CL_UCP_0_X; - union UINT_FLOAT PA_CL_UCP_0_Y; - union UINT_FLOAT PA_CL_UCP_0_Z; - union UINT_FLOAT PA_CL_UCP_0_W; - GLboolean enabled; - GLboolean dirty; -} UCP_STATE_STRUCT; - -typedef struct _PS_STATE_STRUCT -{ - union UINT_FLOAT SQ_PGM_START_PS ; /* 0xA210 */ - union UINT_FLOAT SQ_PGM_RESOURCES_PS ; /* 0xA214 */ - union UINT_FLOAT SQ_PGM_EXPORTS_PS ; /* 0xA215 */ - union UINT_FLOAT SQ_PGM_CF_OFFSET_PS ; /* 0xA233 */ - GLboolean dirty; - int num_consts; - union UINT_FLOAT consts[R700_MAX_DX9_CONSTS][4]; -} PS_STATE_STRUCT; - -typedef struct _VS_STATE_STRUCT -{ - union UINT_FLOAT SQ_PGM_START_VS ; /* 0xA216 */ - union UINT_FLOAT SQ_PGM_RESOURCES_VS ; /* 0xA21A */ - union UINT_FLOAT SQ_PGM_CF_OFFSET_VS ; /* 0xA234 */ - GLboolean dirty; - int num_consts; - - union UINT_FLOAT SQ_ALU_CONST_CACHE_VS_0; - - union UINT_FLOAT consts[R700_MAX_DX9_CONSTS][4]; -} VS_STATE_STRUCT; - -typedef struct _GS_STATE_STRUCT -{ - union UINT_FLOAT SQ_PGM_START_GS ; /* 0xA21B */ - union UINT_FLOAT SQ_PGM_RESOURCES_GS ; /* 0xA21F */ - union UINT_FLOAT SQ_PGM_CF_OFFSET_GS ; /* 0xA235 */ - GLboolean dirty; -} GS_STATE_STRUCT; - -typedef struct _ES_STATE_STRUCT -{ - union UINT_FLOAT SQ_PGM_START_ES ; /* 0xA220 */ - union UINT_FLOAT SQ_PGM_RESOURCES_ES ; /* 0xA224 */ - union UINT_FLOAT SQ_PGM_CF_OFFSET_ES ; /* 0xA236 */ - GLboolean dirty; -} ES_STATE_STRUCT; - -typedef struct _FS_STATE_STRUCT -{ - union UINT_FLOAT SQ_PGM_START_FS ; /* 0xA225 */ - union UINT_FLOAT SQ_PGM_RESOURCES_FS ; /* 0xA229 */ - union UINT_FLOAT SQ_PGM_CF_OFFSET_FS ; /* 0xA237 */ - GLboolean dirty; -} FS_STATE_STRUCT; - -typedef struct _SQ_CONFIG_STRUCT -{ - union UINT_FLOAT SQ_CONFIG ; /* 0x2300 */ - union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_1 ; /* 0x2301 */ - union UINT_FLOAT SQ_GPR_RESOURCE_MGMT_2 ; /* 0x2302 */ - union UINT_FLOAT SQ_THREAD_RESOURCE_MGMT ; /* 0x2303 */ - union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_1 ; /* 0x2304 */ - union UINT_FLOAT SQ_STACK_RESOURCE_MGMT_2 ; /* 0x2305 */ -} SQ_CONFIG_STRUCT; - -typedef struct _R700_CHIP_CONTEXT -{ - // DB - union UINT_FLOAT DB_DEPTH_SIZE ; /* 0xA000 */ - union UINT_FLOAT DB_DEPTH_VIEW ; /* 0xA001 */ - union UINT_FLOAT DB_DEPTH_BASE ; /* 0xA003 */ - union UINT_FLOAT DB_DEPTH_INFO ; /* 0xA004 */ - GLboolean db_target_dirty; - union UINT_FLOAT DB_HTILE_DATA_BASE ; /* 0xA005 */ - union UINT_FLOAT DB_STENCIL_CLEAR ; /* 0xA00A */ - union UINT_FLOAT DB_DEPTH_CLEAR ; /* 0xA00B */ - union UINT_FLOAT DB_STENCILREFMASK ; /* 0xA10C */ - union UINT_FLOAT DB_STENCILREFMASK_BF ; /* 0xA10D */ - union UINT_FLOAT DB_RENDER_CONTROL ; /* 0xA343 */ - union UINT_FLOAT DB_RENDER_OVERRIDE ; /* 0xA344 */ - union UINT_FLOAT DB_HTILE_SURFACE ; /* 0xA349 */ - union UINT_FLOAT DB_ALPHA_TO_MASK ; /* 0xA351 */ - union UINT_FLOAT DB_DEPTH_CONTROL ; /* 0xA200 */ - union UINT_FLOAT DB_SHADER_CONTROL ; /* 0xA203 */ - GLboolean db_dirty; - - // SC - union UINT_FLOAT PA_SC_SCREEN_SCISSOR_TL ; /* 0xA00C */ - union UINT_FLOAT PA_SC_SCREEN_SCISSOR_BR ; /* 0xA00D */ - union UINT_FLOAT PA_SC_WINDOW_OFFSET ; /* 0xA080 */ - union UINT_FLOAT PA_SC_WINDOW_SCISSOR_TL ; /* 0xA081 */ - union UINT_FLOAT PA_SC_WINDOW_SCISSOR_BR ; /* 0xA082 */ - union UINT_FLOAT PA_SC_CLIPRECT_RULE ; /* 0xA083 */ - union UINT_FLOAT PA_SC_CLIPRECT_0_TL ; /* 0xA084 */ - union UINT_FLOAT PA_SC_CLIPRECT_0_BR ; /* 0xA085 */ - union UINT_FLOAT PA_SC_CLIPRECT_1_TL ; /* 0xA086 */ - union UINT_FLOAT PA_SC_CLIPRECT_1_BR ; /* 0xA087 */ - union UINT_FLOAT PA_SC_CLIPRECT_2_TL ; /* 0xA088 */ - union UINT_FLOAT PA_SC_CLIPRECT_2_BR ; /* 0xA089 */ - union UINT_FLOAT PA_SC_CLIPRECT_3_TL ; /* 0xA08A */ - union UINT_FLOAT PA_SC_CLIPRECT_3_BR ; /* 0xA08B */ - union UINT_FLOAT PA_SC_EDGERULE ; /* 0xA08C */ - union UINT_FLOAT PA_SC_GENERIC_SCISSOR_TL ; /* 0xA090 */ - union UINT_FLOAT PA_SC_GENERIC_SCISSOR_BR ; /* 0xA091 */ - GLboolean scissor_dirty; - - union UINT_FLOAT PA_SC_LINE_STIPPLE ; /* 0xA283 */ - union UINT_FLOAT PA_SC_LINE_CNTL ; /* 0xA300 */ - union UINT_FLOAT PA_SC_AA_CONFIG ; /* 0xA301 */ - union UINT_FLOAT PA_SC_MPASS_PS_CNTL ; /* 0xA292 */ - union UINT_FLOAT PA_SC_MODE_CNTL ; /* 0xA293 */ - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_MCTX ; /* 0xA307 */ - union UINT_FLOAT PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX; /* 0xA308 */ - union UINT_FLOAT PA_SC_AA_MASK ; /* 0xA312 */ - GLboolean sc_dirty; - - // CL - union UINT_FLOAT PA_CL_CLIP_CNTL ; /* 0xA204 */ - union UINT_FLOAT PA_CL_VTE_CNTL ; /* 0xA206 */ - union UINT_FLOAT PA_CL_VS_OUT_CNTL ; /* 0xA207 */ - union UINT_FLOAT PA_CL_NANINF_CNTL ; /* 0xA208 */ - union UINT_FLOAT PA_CL_GB_VERT_CLIP_ADJ ; /* 0xA303 */ - union UINT_FLOAT PA_CL_GB_VERT_DISC_ADJ ; /* 0xA304 */ - union UINT_FLOAT PA_CL_GB_HORZ_CLIP_ADJ ; /* 0xA305 */ - union UINT_FLOAT PA_CL_GB_HORZ_DISC_ADJ ; /* 0xA306 */ - GLboolean cl_dirty; - - // SU - union UINT_FLOAT PA_SU_SC_MODE_CNTL ; /* 0xA205 */ - union UINT_FLOAT PA_SU_POINT_SIZE ; /* 0xA280 */ - union UINT_FLOAT PA_SU_POINT_MINMAX ; /* 0xA281 */ - union UINT_FLOAT PA_SU_LINE_CNTL ; /* 0xA282 */ - union UINT_FLOAT PA_SU_VTX_CNTL ; /* 0xA302 */ - union UINT_FLOAT PA_SU_POLY_OFFSET_DB_FMT_CNTL; /* 0xA37E */ - union UINT_FLOAT PA_SU_POLY_OFFSET_CLAMP ; /* 0xA37F */ - union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_SCALE; /* 0xA380 */ - union UINT_FLOAT PA_SU_POLY_OFFSET_FRONT_OFFSET; /* 0xA381 */ - union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_SCALE; /* 0xA382 */ - union UINT_FLOAT PA_SU_POLY_OFFSET_BACK_OFFSET; /* 0xA383 */ - GLboolean su_dirty; - - VIEWPORT_STATE_STRUCT viewport[R700_MAX_VIEWPORTS]; - UCP_STATE_STRUCT ucp[R700_MAX_UCP]; - - // CB - union UINT_FLOAT CB_CLEAR_RED_R6XX ; /* 0xA048 */ - union UINT_FLOAT CB_CLEAR_GREEN_R6XX ; /* 0xA049 */ - union UINT_FLOAT CB_CLEAR_BLUE_R6XX ; /* 0xA04A */ - union UINT_FLOAT CB_CLEAR_ALPHA_R6XX ; /* 0xA04B */ - union UINT_FLOAT CB_TARGET_MASK ; /* 0xA08E */ - union UINT_FLOAT CB_SHADER_MASK ; /* 0xA08F */ - union UINT_FLOAT CB_BLEND_RED ; /* 0xA105 */ - union UINT_FLOAT CB_BLEND_GREEN ; /* 0xA106 */ - union UINT_FLOAT CB_BLEND_BLUE ; /* 0xA107 */ - union UINT_FLOAT CB_BLEND_ALPHA ; /* 0xA108 */ - union UINT_FLOAT CB_FOG_RED_R6XX ; /* 0xA109 */ - union UINT_FLOAT CB_FOG_GREEN_R6XX ; /* 0xA10A */ - union UINT_FLOAT CB_FOG_BLUE_R6XX ; /* 0xA10B */ - union UINT_FLOAT CB_SHADER_CONTROL ; /* 0xA1E8 */ - union UINT_FLOAT CB_COLOR_CONTROL ; /* 0xA202 */ - union UINT_FLOAT CB_CLRCMP_CONTROL ; /* 0xA30C */ - union UINT_FLOAT CB_CLRCMP_SRC ; /* 0xA30D */ - union UINT_FLOAT CB_CLRCMP_DST ; /* 0xA30E */ - union UINT_FLOAT CB_CLRCMP_MSK ; /* 0xA30F */ - union UINT_FLOAT CB_BLEND_CONTROL ; /* 0xABD0 */ - GLboolean cb_dirty; - RENDER_TARGET_STATE_STRUCT render_target[R700_MAX_RENDER_TARGETS]; - - // SX - union UINT_FLOAT SX_MISC ; /* 0xA0D4 */ - union UINT_FLOAT SX_ALPHA_TEST_CONTROL ; /* 0xA104 */ - union UINT_FLOAT SX_ALPHA_REF ; /* 0xA10E */ - GLboolean sx_dirty; - - // VGT - union UINT_FLOAT VGT_MAX_VTX_INDX ; /* 0xA100 */ - union UINT_FLOAT VGT_MIN_VTX_INDX ; /* 0xA101 */ - union UINT_FLOAT VGT_INDX_OFFSET ; /* 0xA102 */ - union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_INDX; /* 0xA103 */ - union UINT_FLOAT VGT_OUTPUT_PATH_CNTL ; /* 0xA284 */ - union UINT_FLOAT VGT_HOS_CNTL ; /* 0xA285 */ - union UINT_FLOAT VGT_HOS_MAX_TESS_LEVEL ; /* 0xA286 */ - union UINT_FLOAT VGT_HOS_MIN_TESS_LEVEL ; /* 0xA287 */ - union UINT_FLOAT VGT_HOS_REUSE_DEPTH ; /* 0xA288 */ - union UINT_FLOAT VGT_GROUP_PRIM_TYPE ; /* 0xA289 */ - union UINT_FLOAT VGT_GROUP_FIRST_DECR ; /* 0xA28A */ - union UINT_FLOAT VGT_GROUP_DECR ; /* 0xA28B */ - union UINT_FLOAT VGT_GROUP_VECT_0_CNTL ; /* 0xA28C */ - union UINT_FLOAT VGT_GROUP_VECT_1_CNTL ; /* 0xA28D */ - union UINT_FLOAT VGT_GROUP_VECT_0_FMT_CNTL ; /* 0xA28E */ - union UINT_FLOAT VGT_GROUP_VECT_1_FMT_CNTL ; /* 0xA28F */ - union UINT_FLOAT VGT_GS_MODE ; /* 0xA290 */ - union UINT_FLOAT VGT_PRIMITIVEID_EN ; /* 0xA2A1 */ - union UINT_FLOAT VGT_MULTI_PRIM_IB_RESET_EN; /* 0xA2A5 */ - union UINT_FLOAT VGT_INSTANCE_STEP_RATE_0 ; /* 0xA2A8 */ - union UINT_FLOAT VGT_INSTANCE_STEP_RATE_1 ; /* 0xA2A9 */ - union UINT_FLOAT VGT_STRMOUT_EN ; /* 0xA2AC */ - union UINT_FLOAT VGT_REUSE_OFF ; /* 0xA2AD */ - union UINT_FLOAT VGT_VTX_CNT_EN ; /* 0xA2AE */ - union UINT_FLOAT VGT_STRMOUT_BUFFER_EN ; /* 0xA2C8 */ - GLboolean vgt_dirty; - - // SPI - union UINT_FLOAT SPI_VS_OUT_ID_0 ; /* 0xA185 */ - union UINT_FLOAT SPI_VS_OUT_ID_1 ; /* 0xA186 */ - union UINT_FLOAT SPI_VS_OUT_ID_2 ; /* 0xA187 */ - union UINT_FLOAT SPI_VS_OUT_ID_3 ; /* 0xA188 */ - union UINT_FLOAT SPI_VS_OUT_ID_4 ; /* 0xA189 */ - union UINT_FLOAT SPI_VS_OUT_ID_5 ; /* 0xA18A */ - union UINT_FLOAT SPI_VS_OUT_ID_6 ; /* 0xA18B */ - union UINT_FLOAT SPI_VS_OUT_ID_7 ; /* 0xA18C */ - union UINT_FLOAT SPI_VS_OUT_ID_8 ; /* 0xA18D */ - union UINT_FLOAT SPI_VS_OUT_ID_9 ; /* 0xA18E */ - union UINT_FLOAT SPI_VS_OUT_CONFIG ; /* 0xA1B1 */ - union UINT_FLOAT SPI_THREAD_GROUPING ; /* 0xA1B2 */ - union UINT_FLOAT SPI_PS_IN_CONTROL_0 ; /* 0xA1B3 */ - union UINT_FLOAT SPI_PS_IN_CONTROL_1 ; /* 0xA1B4 */ - union UINT_FLOAT SPI_INTERP_CONTROL_0 ; /* 0xA1B5 */ - union UINT_FLOAT SPI_INPUT_Z ; /* 0xA1B6 */ - union UINT_FLOAT SPI_FOG_CNTL ; /* 0xA1B7 */ - union UINT_FLOAT SPI_FOG_FUNC_SCALE ; /* 0xA1B8 */ - union UINT_FLOAT SPI_FOG_FUNC_BIAS ; /* 0xA1B9 */ - - union UINT_FLOAT SQ_VTX_SEMANTIC_0 ; /* 0xA0E0 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_1 ; /* 0xA0E1 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_2 ; /* 0xA0E2 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_3 ; /* 0xA0E3 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_4 ; /* 0xA0E4 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_5 ; /* 0xA0E5 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_6 ; /* 0xA0E6 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_7 ; /* 0xA0E7 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_8 ; /* 0xA0E8 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_9 ; /* 0xA0E9 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_10 ; /* 0xA0EA */ - union UINT_FLOAT SQ_VTX_SEMANTIC_11 ; /* 0xA0EB */ - union UINT_FLOAT SQ_VTX_SEMANTIC_12 ; /* 0xA0EC */ - union UINT_FLOAT SQ_VTX_SEMANTIC_13 ; /* 0xA0ED */ - union UINT_FLOAT SQ_VTX_SEMANTIC_14 ; /* 0xA0EE */ - union UINT_FLOAT SQ_VTX_SEMANTIC_15 ; /* 0xA0EF */ - union UINT_FLOAT SQ_VTX_SEMANTIC_16 ; /* 0xA0F0 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_17 ; /* 0xA0F1 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_18 ; /* 0xA0F2 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_19 ; /* 0xA0F3 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_20 ; /* 0xA0F4 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_21 ; /* 0xA0F5 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_22 ; /* 0xA0F6 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_23 ; /* 0xA0F7 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_24 ; /* 0xA0F8 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_25 ; /* 0xA0F9 */ - union UINT_FLOAT SQ_VTX_SEMANTIC_26 ; /* 0xA0FA */ - union UINT_FLOAT SQ_VTX_SEMANTIC_27 ; /* 0xA0FB */ - union UINT_FLOAT SQ_VTX_SEMANTIC_28 ; /* 0xA0FC */ - union UINT_FLOAT SQ_VTX_SEMANTIC_29 ; /* 0xA0FD */ - union UINT_FLOAT SQ_VTX_SEMANTIC_30 ; /* 0xA0FE */ - union UINT_FLOAT SQ_VTX_SEMANTIC_31 ; /* 0xA0FF */ - union UINT_FLOAT SPI_PS_INPUT_CNTL[R700_MAX_SHADER_EXPORTS]; - GLboolean spi_dirty; - - // shaders - PS_STATE_STRUCT ps; - VS_STATE_STRUCT vs; - GS_STATE_STRUCT gs; - ES_STATE_STRUCT es; - FS_STATE_STRUCT fs; - - // SQ CONFIG - SQ_CONFIG_STRUCT sq_config; - // misc - union UINT_FLOAT TA_CNTL_AUX ; /* 0x2542 */ - union UINT_FLOAT VC_ENHANCE ; /* 0x25C5 */ - union UINT_FLOAT SQ_DYN_GPR_CNTL_PS_FLUSH_REQ; /* 0x2363 */ - union UINT_FLOAT DB_DEBUG ; /* 0x260C */ - union UINT_FLOAT DB_WATERMARKS ; /* 0x260E */ - // SQ - union UINT_FLOAT SQ_ESGS_RING_ITEMSIZE ; /* 0xA22A */ - union UINT_FLOAT SQ_GSVS_RING_ITEMSIZE ; /* 0xA22B */ - union UINT_FLOAT SQ_ESTMP_RING_ITEMSIZE ; /* 0xA22C */ - union UINT_FLOAT SQ_GSTMP_RING_ITEMSIZE ; /* 0xA22D */ - union UINT_FLOAT SQ_VSTMP_RING_ITEMSIZE ; /* 0xA22E */ - union UINT_FLOAT SQ_PSTMP_RING_ITEMSIZE ; /* 0xA22F */ - union UINT_FLOAT SQ_FBUF_RING_ITEMSIZE ; /* 0xA230 */ - union UINT_FLOAT SQ_REDUC_RING_ITEMSIZE ; /* 0xA231 */ - union UINT_FLOAT SQ_GS_VERT_ITEMSIZE ; /* 0xA232 */ - GLboolean sq_dirty; - - radeonTexObj* textures[R700_TEXTURE_NUMBERUNITS]; - - GLboolean bEnablePerspective; - - GLboolean bShaderUseMemConstant; - -} R700_CHIP_CONTEXT; - -#endif /* _R700_CHIP_H_ */ - diff --git a/src/mesa/drivers/dri/r600/r700_chipoffset.h b/src/mesa/drivers/dri/r600/r700_chipoffset.h deleted file mode 100644 index 4d73fb99a7d..00000000000 --- a/src/mesa/drivers/dri/r600/r700_chipoffset.h +++ /dev/null @@ -1,693 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#ifndef _R700_CHIPOFFSET_H_ -#define _R700_CHIPOFFSET_H_ - -#define mmWAIT_UNTIL 0x2010 -#define mmSCRATCH_REG0 0x2140 -#define mmGUI_SCRATCH_REG0 0x2140 -#define mmSCRATCH_REG1 0x2141 -#define mmGUI_SCRATCH_REG1 0x2141 -#define mmSCRATCH_REG2 0x2142 -#define mmGUI_SCRATCH_REG2 0x2142 -#define mmSCRATCH_REG3 0x2143 -#define mmGUI_SCRATCH_REG3 0x2143 -#define mmSCRATCH_REG4 0x2144 -#define mmGUI_SCRATCH_REG4 0x2144 -#define mmSCRATCH_REG5 0x2145 -#define mmGUI_SCRATCH_REG5 0x2145 -#define mmSCRATCH_REG6 0x2146 -#define mmGUI_SCRATCH_REG6 0x2146 -#define mmSCRATCH_REG7 0x2147 -#define mmGUI_SCRATCH_REG7 0x2147 - -#define mmCP_COHER_CNTL 0x217C -#define mmCP_COHER_SIZE 0x217D -#define mmCP_COHER_BASE 0x217E -#define mmCP_COHER_STATUS 0x217F - -#define mmTA_CNTL_AUX 0x2542 -#define mmVC_ENHANCE 0x25C5 -#define mmSQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x2363 -#define mmDB_DEBUG 0x260C -#define mmDB_WATERMARKS 0x260E - -#define mmPA_CL_VPORT_XSCALE 0xA10F -#define mmPA_CL_VPORT_XOFFSET 0xA110 -#define mmPA_CL_VPORT_YSCALE 0xA111 -#define mmPA_CL_VPORT_YOFFSET 0xA112 -#define mmPA_CL_VPORT_ZSCALE 0xA113 -#define mmPA_CL_VPORT_ZOFFSET 0xA114 -#define mmPA_CL_VPORT_XSCALE_1 0xA115 -#define mmPA_CL_VPORT_XSCALE_2 0xA11B -#define mmPA_CL_VPORT_XSCALE_3 0xA121 -#define mmPA_CL_VPORT_XSCALE_4 0xA127 -#define mmPA_CL_VPORT_XSCALE_5 0xA12D -#define mmPA_CL_VPORT_XSCALE_6 0xA133 -#define mmPA_CL_VPORT_XSCALE_7 0xA139 -#define mmPA_CL_VPORT_XSCALE_8 0xA13F -#define mmPA_CL_VPORT_XSCALE_9 0xA145 -#define mmPA_CL_VPORT_XSCALE_10 0xA14B -#define mmPA_CL_VPORT_XSCALE_11 0xA151 -#define mmPA_CL_VPORT_XSCALE_12 0xA157 -#define mmPA_CL_VPORT_XSCALE_13 0xA15D -#define mmPA_CL_VPORT_XSCALE_14 0xA163 -#define mmPA_CL_VPORT_XSCALE_15 0xA169 -#define mmPA_CL_VPORT_XOFFSET_1 0xA116 -#define mmPA_CL_VPORT_XOFFSET_2 0xA11C -#define mmPA_CL_VPORT_XOFFSET_3 0xA122 -#define mmPA_CL_VPORT_XOFFSET_4 0xA128 -#define mmPA_CL_VPORT_XOFFSET_5 0xA12E -#define mmPA_CL_VPORT_XOFFSET_6 0xA134 -#define mmPA_CL_VPORT_XOFFSET_7 0xA13A -#define mmPA_CL_VPORT_XOFFSET_8 0xA140 -#define mmPA_CL_VPORT_XOFFSET_9 0xA146 -#define mmPA_CL_VPORT_XOFFSET_10 0xA14C -#define mmPA_CL_VPORT_XOFFSET_11 0xA152 -#define mmPA_CL_VPORT_XOFFSET_12 0xA158 -#define mmPA_CL_VPORT_XOFFSET_13 0xA15E -#define mmPA_CL_VPORT_XOFFSET_14 0xA164 -#define mmPA_CL_VPORT_XOFFSET_15 0xA16A -#define mmPA_CL_VPORT_YSCALE_1 0xA117 -#define mmPA_CL_VPORT_YSCALE_2 0xA11D -#define mmPA_CL_VPORT_YSCALE_3 0xA123 -#define mmPA_CL_VPORT_YSCALE_4 0xA129 -#define mmPA_CL_VPORT_YSCALE_5 0xA12F -#define mmPA_CL_VPORT_YSCALE_6 0xA135 -#define mmPA_CL_VPORT_YSCALE_7 0xA13B -#define mmPA_CL_VPORT_YSCALE_8 0xA141 -#define mmPA_CL_VPORT_YSCALE_9 0xA147 -#define mmPA_CL_VPORT_YSCALE_10 0xA14D -#define mmPA_CL_VPORT_YSCALE_11 0xA153 -#define mmPA_CL_VPORT_YSCALE_12 0xA159 -#define mmPA_CL_VPORT_YSCALE_13 0xA15F -#define mmPA_CL_VPORT_YSCALE_14 0xA165 -#define mmPA_CL_VPORT_YSCALE_15 0xA16B -#define mmPA_CL_VPORT_YOFFSET_1 0xA118 -#define mmPA_CL_VPORT_YOFFSET_2 0xA11E -#define mmPA_CL_VPORT_YOFFSET_3 0xA124 -#define mmPA_CL_VPORT_YOFFSET_4 0xA12A -#define mmPA_CL_VPORT_YOFFSET_5 0xA130 -#define mmPA_CL_VPORT_YOFFSET_6 0xA136 -#define mmPA_CL_VPORT_YOFFSET_7 0xA13C -#define mmPA_CL_VPORT_YOFFSET_8 0xA142 -#define mmPA_CL_VPORT_YOFFSET_9 0xA148 -#define mmPA_CL_VPORT_YOFFSET_10 0xA14E -#define mmPA_CL_VPORT_YOFFSET_11 0xA154 -#define mmPA_CL_VPORT_YOFFSET_12 0xA15A -#define mmPA_CL_VPORT_YOFFSET_13 0xA160 -#define mmPA_CL_VPORT_YOFFSET_14 0xA166 -#define mmPA_CL_VPORT_YOFFSET_15 0xA16C -#define mmPA_CL_VPORT_ZSCALE_1 0xA119 -#define mmPA_CL_VPORT_ZSCALE_2 0xA11F -#define mmPA_CL_VPORT_ZSCALE_3 0xA125 -#define mmPA_CL_VPORT_ZSCALE_4 0xA12B -#define mmPA_CL_VPORT_ZSCALE_5 0xA131 -#define mmPA_CL_VPORT_ZSCALE_6 0xA137 -#define mmPA_CL_VPORT_ZSCALE_7 0xA13D -#define mmPA_CL_VPORT_ZSCALE_8 0xA143 -#define mmPA_CL_VPORT_ZSCALE_9 0xA149 -#define mmPA_CL_VPORT_ZSCALE_10 0xA14F -#define mmPA_CL_VPORT_ZSCALE_11 0xA155 -#define mmPA_CL_VPORT_ZSCALE_12 0xA15B -#define mmPA_CL_VPORT_ZSCALE_13 0xA161 -#define mmPA_CL_VPORT_ZSCALE_14 0xA167 -#define mmPA_CL_VPORT_ZSCALE_15 0xA16D -#define mmPA_CL_VPORT_ZOFFSET_1 0xA11A -#define mmPA_CL_VPORT_ZOFFSET_2 0xA120 -#define mmPA_CL_VPORT_ZOFFSET_3 0xA126 -#define mmPA_CL_VPORT_ZOFFSET_4 0xA12C -#define mmPA_CL_VPORT_ZOFFSET_5 0xA132 -#define mmPA_CL_VPORT_ZOFFSET_6 0xA138 -#define mmPA_CL_VPORT_ZOFFSET_7 0xA13E -#define mmPA_CL_VPORT_ZOFFSET_8 0xA144 -#define mmPA_CL_VPORT_ZOFFSET_9 0xA14A -#define mmPA_CL_VPORT_ZOFFSET_10 0xA150 -#define mmPA_CL_VPORT_ZOFFSET_11 0xA156 -#define mmPA_CL_VPORT_ZOFFSET_12 0xA15C -#define mmPA_CL_VPORT_ZOFFSET_13 0xA162 -#define mmPA_CL_VPORT_ZOFFSET_14 0xA168 -#define mmPA_CL_VPORT_ZOFFSET_15 0xA16E -#define mmPA_CL_VTE_CNTL 0xA206 -#define mmPA_CL_VS_OUT_CNTL 0xA207 -#define mmPA_CL_NANINF_CNTL 0xA208 -#define mmPA_CL_CLIP_CNTL 0xA204 -#define mmPA_CL_GB_VERT_CLIP_ADJ 0xA303 -#define mmPA_CL_GB_VERT_DISC_ADJ 0xA304 -#define mmPA_CL_GB_HORZ_CLIP_ADJ 0xA305 -#define mmPA_CL_GB_HORZ_DISC_ADJ 0xA306 -#define mmPA_CL_UCP_0_X 0xA388 -#define mmPA_CL_UCP_0_Y 0xA389 -#define mmPA_CL_UCP_0_Z 0xA38A -#define mmPA_CL_UCP_0_W 0xA38B -#define mmPA_CL_UCP_1_X 0xA38C -#define mmPA_CL_UCP_1_Y 0xA38D -#define mmPA_CL_UCP_1_Z 0xA38E -#define mmPA_CL_UCP_1_W 0xA38F -#define mmPA_CL_UCP_2_X 0xA390 -#define mmPA_CL_UCP_2_Y 0xA391 -#define mmPA_CL_UCP_2_Z 0xA392 -#define mmPA_CL_UCP_2_W 0xA393 -#define mmPA_CL_UCP_3_X 0xA394 -#define mmPA_CL_UCP_3_Y 0xA395 -#define mmPA_CL_UCP_3_Z 0xA396 -#define mmPA_CL_UCP_3_W 0xA397 -#define mmPA_CL_UCP_4_X 0xA398 -#define mmPA_CL_UCP_4_Y 0xA399 -#define mmPA_CL_UCP_4_Z 0xA39A -#define mmPA_CL_UCP_4_W 0xA39B -#define mmPA_CL_UCP_5_X 0xA39C -#define mmPA_CL_UCP_5_Y 0xA39D -#define mmPA_CL_UCP_5_Z 0xA39E -#define mmPA_CL_UCP_5_W 0xA39F -#define mmPA_CL_POINT_X_RAD 0xA384 -#define mmPA_CL_POINT_Y_RAD 0xA385 -#define mmPA_CL_POINT_SIZE 0xA386 -#define mmPA_CL_POINT_CULL_RAD 0xA387 - -#define mmPA_SU_VTX_CNTL 0xA302 -#define mmPA_SU_POINT_SIZE 0xA280 -#define mmPA_SU_POINT_MINMAX 0xA281 -#define mmPA_SU_LINE_CNTL 0xA282 -#define mmPA_SU_SC_MODE_CNTL 0xA205 -#define mmPA_SU_POLY_OFFSET_DB_FMT_CNTL 0xA37E -#define mmPA_SU_POLY_OFFSET_CLAMP 0xA37F -#define mmPA_SU_POLY_OFFSET_FRONT_SCALE 0xA380 -#define mmPA_SU_POLY_OFFSET_FRONT_OFFSET 0xA381 -#define mmPA_SU_POLY_OFFSET_BACK_SCALE 0xA382 -#define mmPA_SU_POLY_OFFSET_BACK_OFFSET 0xA383 - -#define mmPA_SC_WINDOW_OFFSET 0xA080 -#define mmPA_SC_AA_CONFIG 0xA301 -#define mmPA_SC_AA_MASK 0xA312 -#define mmPA_SC_AA_SAMPLE_LOCS_MCTX 0xA307 -#define mmPA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 0xA308 -#define mmPA_SC_LINE_STIPPLE 0xA283 -#define mmPA_SC_LINE_CNTL 0xA300 -#define mmPA_SC_SCREEN_SCISSOR_TL 0xA00C -#define mmPA_SC_SCREEN_SCISSOR_BR 0xA00D -#define mmPA_SC_WINDOW_SCISSOR_TL 0xA081 -#define mmPA_SC_WINDOW_SCISSOR_BR 0xA082 -#define mmPA_SC_CLIPRECT_RULE 0xA083 -#define mmPA_SC_CLIPRECT_0_TL 0xA084 -#define mmPA_SC_CLIPRECT_0_BR 0xA085 -#define mmPA_SC_CLIPRECT_1_TL 0xA086 -#define mmPA_SC_CLIPRECT_1_BR 0xA087 -#define mmPA_SC_CLIPRECT_2_TL 0xA088 -#define mmPA_SC_CLIPRECT_2_BR 0xA089 -#define mmPA_SC_CLIPRECT_3_TL 0xA08A -#define mmPA_SC_CLIPRECT_3_BR 0xA08B -#define mmPA_SC_EDGERULE 0xA08C -#define mmPA_SC_GENERIC_SCISSOR_TL 0xA090 -#define mmPA_SC_GENERIC_SCISSOR_BR 0xA091 -#define mmPA_SC_VPORT_SCISSOR_0_TL 0xA094 -#define mmPA_SC_VPORT_SCISSOR_1_TL 0xA096 -#define mmPA_SC_VPORT_SCISSOR_2_TL 0xA098 -#define mmPA_SC_VPORT_SCISSOR_3_TL 0xA09A -#define mmPA_SC_VPORT_SCISSOR_4_TL 0xA09C -#define mmPA_SC_VPORT_SCISSOR_5_TL 0xA09E -#define mmPA_SC_VPORT_SCISSOR_6_TL 0xA0A0 -#define mmPA_SC_VPORT_SCISSOR_7_TL 0xA0A2 -#define mmPA_SC_VPORT_SCISSOR_8_TL 0xA0A4 -#define mmPA_SC_VPORT_SCISSOR_9_TL 0xA0A6 -#define mmPA_SC_VPORT_SCISSOR_10_TL 0xA0A8 -#define mmPA_SC_VPORT_SCISSOR_11_TL 0xA0AA -#define mmPA_SC_VPORT_SCISSOR_12_TL 0xA0AC -#define mmPA_SC_VPORT_SCISSOR_13_TL 0xA0AE -#define mmPA_SC_VPORT_SCISSOR_14_TL 0xA0B0 -#define mmPA_SC_VPORT_SCISSOR_15_TL 0xA0B2 -#define mmPA_SC_VPORT_SCISSOR_0_BR 0xA095 -#define mmPA_SC_VPORT_SCISSOR_1_BR 0xA097 -#define mmPA_SC_VPORT_SCISSOR_2_BR 0xA099 -#define mmPA_SC_VPORT_SCISSOR_3_BR 0xA09B -#define mmPA_SC_VPORT_SCISSOR_4_BR 0xA09D -#define mmPA_SC_VPORT_SCISSOR_5_BR 0xA09F -#define mmPA_SC_VPORT_SCISSOR_6_BR 0xA0A1 -#define mmPA_SC_VPORT_SCISSOR_7_BR 0xA0A3 -#define mmPA_SC_VPORT_SCISSOR_8_BR 0xA0A5 -#define mmPA_SC_VPORT_SCISSOR_9_BR 0xA0A7 -#define mmPA_SC_VPORT_SCISSOR_10_BR 0xA0A9 -#define mmPA_SC_VPORT_SCISSOR_11_BR 0xA0AB -#define mmPA_SC_VPORT_SCISSOR_12_BR 0xA0AD -#define mmPA_SC_VPORT_SCISSOR_13_BR 0xA0AF -#define mmPA_SC_VPORT_SCISSOR_14_BR 0xA0B1 -#define mmPA_SC_VPORT_SCISSOR_15_BR 0xA0B3 -#define mmPA_SC_VPORT_ZMIN_0 0xA0B4 -#define mmPA_SC_VPORT_ZMIN_1 0xA0B6 -#define mmPA_SC_VPORT_ZMIN_2 0xA0B8 -#define mmPA_SC_VPORT_ZMIN_3 0xA0BA -#define mmPA_SC_VPORT_ZMIN_4 0xA0BC -#define mmPA_SC_VPORT_ZMIN_5 0xA0BE -#define mmPA_SC_VPORT_ZMIN_6 0xA0C0 -#define mmPA_SC_VPORT_ZMIN_7 0xA0C2 -#define mmPA_SC_VPORT_ZMIN_8 0xA0C4 -#define mmPA_SC_VPORT_ZMIN_9 0xA0C6 -#define mmPA_SC_VPORT_ZMIN_10 0xA0C8 -#define mmPA_SC_VPORT_ZMIN_11 0xA0CA -#define mmPA_SC_VPORT_ZMIN_12 0xA0CC -#define mmPA_SC_VPORT_ZMIN_13 0xA0CE -#define mmPA_SC_VPORT_ZMIN_14 0xA0D0 -#define mmPA_SC_VPORT_ZMIN_15 0xA0D2 -#define mmPA_SC_VPORT_ZMAX_0 0xA0B5 -#define mmPA_SC_VPORT_ZMAX_1 0xA0B7 -#define mmPA_SC_VPORT_ZMAX_2 0xA0B9 -#define mmPA_SC_VPORT_ZMAX_3 0xA0BB -#define mmPA_SC_VPORT_ZMAX_4 0xA0BD -#define mmPA_SC_VPORT_ZMAX_5 0xA0BF -#define mmPA_SC_VPORT_ZMAX_6 0xA0C1 -#define mmPA_SC_VPORT_ZMAX_7 0xA0C3 -#define mmPA_SC_VPORT_ZMAX_8 0xA0C5 -#define mmPA_SC_VPORT_ZMAX_9 0xA0C7 -#define mmPA_SC_VPORT_ZMAX_10 0xA0C9 -#define mmPA_SC_VPORT_ZMAX_11 0xA0CB -#define mmPA_SC_VPORT_ZMAX_12 0xA0CD -#define mmPA_SC_VPORT_ZMAX_13 0xA0CF -#define mmPA_SC_VPORT_ZMAX_14 0xA0D1 -#define mmPA_SC_VPORT_ZMAX_15 0xA0D3 -#define mmPA_SC_MODE_CNTL 0xA293 -#define mmPA_SC_MPASS_PS_CNTL 0xA292 - -#define mmVGT_DRAW_INITIATOR 0xA1FC -#define mmVGT_EVENT_INITIATOR 0xA2A4 -#define mmVGT_EVENT_ADDRESS_REG 0xA1FE -#define mmVGT_DMA_BASE_HI 0xA1F9 -#define mmVGT_DMA_BASE 0xA1FA -#define mmVGT_DMA_INDEX_TYPE 0xA29F -#define mmVGT_DMA_NUM_INSTANCES 0xA2A2 -#define mmVGT_DMA_SIZE 0xA29D - -#define mmVGT_IMMED_DATA 0xA1FD -#define mmVGT_INDEX_TYPE 0x2257 -#define mmVGT_NUM_INDICES 0x225C -#define mmVGT_NUM_INSTANCES 0x225D -#define mmVGT_PRIMITIVE_TYPE 0x2256 -#define mmVGT_PRIMITIVEID_EN 0xA2A1 -#define mmVGT_VTX_CNT_EN 0xA2AE -#define mmVGT_REUSE_OFF 0xA2AD -#define mmVGT_INSTANCE_STEP_RATE_0 0xA2A8 -#define mmVGT_INSTANCE_STEP_RATE_1 0xA2A9 -#define mmVGT_MAX_VTX_INDX 0xA100 -#define mmVGT_MIN_VTX_INDX 0xA101 -#define mmVGT_INDX_OFFSET 0xA102 -#define mmVGT_VERTEX_REUSE_BLOCK_CNTL 0xA316 -#define mmVGT_OUT_DEALLOC_CNTL 0xA317 -#define mmVGT_MULTI_PRIM_IB_RESET_INDX 0xA103 -#define mmVGT_MULTI_PRIM_IB_RESET_EN 0xA2A5 -#define mmVGT_ENHANCE 0xA294 -#define mmVGT_OUTPUT_PATH_CNTL 0xA284 -#define mmVGT_HOS_CNTL 0xA285 -#define mmVGT_HOS_MAX_TESS_LEVEL 0xA286 -#define mmVGT_HOS_MIN_TESS_LEVEL 0xA287 -#define mmVGT_HOS_REUSE_DEPTH 0xA288 -#define mmVGT_GROUP_PRIM_TYPE 0xA289 -#define mmVGT_GROUP_FIRST_DECR 0xA28A -#define mmVGT_GROUP_DECR 0xA28B -#define mmVGT_GROUP_VECT_0_CNTL 0xA28C -#define mmVGT_GROUP_VECT_1_CNTL 0xA28D -#define mmVGT_GROUP_VECT_0_FMT_CNTL 0xA28E -#define mmVGT_GROUP_VECT_1_FMT_CNTL 0xA28F -#define mmVGT_GS_MODE 0xA290 -#define mmVGT_GS_OUT_PRIM_TYPE 0xA29B - -#define mmVGT_STRMOUT_EN 0xA2AC -#define mmVGT_STRMOUT_BUFFER_SIZE_0 0xA2B4 -#define mmVGT_STRMOUT_BUFFER_SIZE_1 0xA2B8 -#define mmVGT_STRMOUT_BUFFER_SIZE_2 0xA2BC -#define mmVGT_STRMOUT_BUFFER_SIZE_3 0xA2C0 -#define mmVGT_STRMOUT_BUFFER_OFFSET_0 0xA2B7 -#define mmVGT_STRMOUT_BUFFER_OFFSET_1 0xA2BB -#define mmVGT_STRMOUT_BUFFER_OFFSET_2 0xA2BF -#define mmVGT_STRMOUT_BUFFER_OFFSET_3 0xA2C3 -#define mmVGT_STRMOUT_VTX_STRIDE_0 0xA2B5 -#define mmVGT_STRMOUT_VTX_STRIDE_1 0xA2B9 -#define mmVGT_STRMOUT_VTX_STRIDE_2 0xA2BD -#define mmVGT_STRMOUT_VTX_STRIDE_3 0xA2C1 -#define mmVGT_STRMOUT_BUFFER_BASE_0 0xA2B6 -#define mmVGT_STRMOUT_BUFFER_BASE_1 0xA2BA -#define mmVGT_STRMOUT_BUFFER_BASE_2 0xA2BE -#define mmVGT_STRMOUT_BUFFER_BASE_3 0xA2C2 -#define mmVGT_STRMOUT_BUFFER_EN 0xA2C8 -#define mmVGT_STRMOUT_BASE_OFFSET_0 0xA2C4 -#define mmVGT_STRMOUT_BASE_OFFSET_1 0xA2C5 -#define mmVGT_STRMOUT_BASE_OFFSET_2 0xA2C6 -#define mmVGT_STRMOUT_BASE_OFFSET_3 0xA2C7 -#define mmVGT_STRMOUT_BASE_OFFSET_HI_0 0xA2D1 -#define mmVGT_STRMOUT_BASE_OFFSET_HI_1 0xA2D2 -#define mmVGT_STRMOUT_BASE_OFFSET_HI_2 0xA2D3 -#define mmVGT_STRMOUT_BASE_OFFSET_HI_3 0xA2D4 -#define mmVGT_STRMOUT_DRAW_OPAQUE_OFFSET 0xA2CA -#define mmVGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE 0xA2CB -#define mmVGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE 0xA2CC - -#define mmSQ_PGM_START_PS 0xA210 -#define mmSQ_PGM_CF_OFFSET_PS 0xA233 -#define mmSQ_PGM_RESOURCES_PS 0xA214 -#define mmSQ_PGM_EXPORTS_PS 0xA215 -#define mmSQ_PGM_START_VS 0xA216 -#define mmSQ_PGM_CF_OFFSET_VS 0xA234 -#define mmSQ_PGM_RESOURCES_VS 0xA21A -#define mmSQ_PGM_START_GS 0xA21B -#define mmSQ_PGM_CF_OFFSET_GS 0xA235 -#define mmSQ_PGM_RESOURCES_GS 0xA21F -#define mmSQ_PGM_START_ES 0xA220 -#define mmSQ_PGM_CF_OFFSET_ES 0xA236 -#define mmSQ_PGM_RESOURCES_ES 0xA224 -#define mmSQ_PGM_START_FS 0xA225 -#define mmSQ_PGM_CF_OFFSET_FS 0xA237 -#define mmSQ_PGM_RESOURCES_FS 0xA229 -#define mmSQ_ESGS_RING_ITEMSIZE 0xA22A -#define mmSQ_GSVS_RING_ITEMSIZE 0xA22B -#define mmSQ_ESTMP_RING_ITEMSIZE 0xA22C -#define mmSQ_GSTMP_RING_ITEMSIZE 0xA22D -#define mmSQ_VSTMP_RING_ITEMSIZE 0xA22E -#define mmSQ_PSTMP_RING_ITEMSIZE 0xA22F -#define mmSQ_FBUF_RING_ITEMSIZE 0xA230 -#define mmSQ_REDUC_RING_ITEMSIZE 0xA231 -#define mmSQ_GS_VERT_ITEMSIZE 0xA232 -#define mmSQ_VTX_SEMANTIC_CLEAR 0xA238 - -#define mmSQ_VTX_SEMANTIC_0 0xA0E0 -#define mmSQ_VTX_SEMANTIC_1 0xA0E1 -#define mmSQ_VTX_SEMANTIC_2 0xA0E2 -#define mmSQ_VTX_SEMANTIC_3 0xA0E3 -#define mmSQ_VTX_SEMANTIC_4 0xA0E4 -#define mmSQ_VTX_SEMANTIC_5 0xA0E5 -#define mmSQ_VTX_SEMANTIC_6 0xA0E6 -#define mmSQ_VTX_SEMANTIC_7 0xA0E7 -#define mmSQ_VTX_SEMANTIC_8 0xA0E8 -#define mmSQ_VTX_SEMANTIC_9 0xA0E9 -#define mmSQ_VTX_SEMANTIC_10 0xA0EA -#define mmSQ_VTX_SEMANTIC_11 0xA0EB -#define mmSQ_VTX_SEMANTIC_12 0xA0EC -#define mmSQ_VTX_SEMANTIC_13 0xA0ED -#define mmSQ_VTX_SEMANTIC_14 0xA0EE -#define mmSQ_VTX_SEMANTIC_15 0xA0EF -#define mmSQ_VTX_SEMANTIC_16 0xA0F0 -#define mmSQ_VTX_SEMANTIC_17 0xA0F1 -#define mmSQ_VTX_SEMANTIC_18 0xA0F2 -#define mmSQ_VTX_SEMANTIC_19 0xA0F3 -#define mmSQ_VTX_SEMANTIC_20 0xA0F4 -#define mmSQ_VTX_SEMANTIC_21 0xA0F5 -#define mmSQ_VTX_SEMANTIC_22 0xA0F6 -#define mmSQ_VTX_SEMANTIC_23 0xA0F7 -#define mmSQ_VTX_SEMANTIC_24 0xA0F8 -#define mmSQ_VTX_SEMANTIC_25 0xA0F9 -#define mmSQ_VTX_SEMANTIC_26 0xA0FA -#define mmSQ_VTX_SEMANTIC_27 0xA0FB -#define mmSQ_VTX_SEMANTIC_28 0xA0FC -#define mmSQ_VTX_SEMANTIC_29 0xA0FD -#define mmSQ_VTX_SEMANTIC_30 0xA0FE -#define mmSQ_VTX_SEMANTIC_31 0xA0FF - -#define mmSQ_ALU_CONST_CACHE_PS_0 0xA250 -#define mmSQ_ALU_CONST_CACHE_PS_1 0xA251 -#define mmSQ_ALU_CONST_CACHE_PS_2 0xA252 -#define mmSQ_ALU_CONST_CACHE_PS_3 0xA253 -#define mmSQ_ALU_CONST_CACHE_PS_4 0xA254 -#define mmSQ_ALU_CONST_CACHE_PS_5 0xA255 -#define mmSQ_ALU_CONST_CACHE_PS_6 0xA256 -#define mmSQ_ALU_CONST_CACHE_PS_7 0xA257 -#define mmSQ_ALU_CONST_CACHE_PS_8 0xA258 -#define mmSQ_ALU_CONST_CACHE_PS_9 0xA259 -#define mmSQ_ALU_CONST_CACHE_PS_10 0xA25A -#define mmSQ_ALU_CONST_CACHE_PS_11 0xA25B -#define mmSQ_ALU_CONST_CACHE_PS_12 0xA25C -#define mmSQ_ALU_CONST_CACHE_PS_13 0xA25D -#define mmSQ_ALU_CONST_CACHE_PS_14 0xA25E -#define mmSQ_ALU_CONST_CACHE_PS_15 0xA25F -#define mmSQ_ALU_CONST_CACHE_VS_0 0xA260 -#define mmSQ_ALU_CONST_CACHE_VS_1 0xA261 -#define mmSQ_ALU_CONST_CACHE_VS_2 0xA262 -#define mmSQ_ALU_CONST_CACHE_VS_3 0xA263 -#define mmSQ_ALU_CONST_CACHE_VS_4 0xA264 -#define mmSQ_ALU_CONST_CACHE_VS_5 0xA265 -#define mmSQ_ALU_CONST_CACHE_VS_6 0xA266 -#define mmSQ_ALU_CONST_CACHE_VS_7 0xA267 -#define mmSQ_ALU_CONST_CACHE_VS_8 0xA268 -#define mmSQ_ALU_CONST_CACHE_VS_9 0xA269 -#define mmSQ_ALU_CONST_CACHE_VS_10 0xA26A -#define mmSQ_ALU_CONST_CACHE_VS_11 0xA26B -#define mmSQ_ALU_CONST_CACHE_VS_12 0xA26C -#define mmSQ_ALU_CONST_CACHE_VS_13 0xA26D -#define mmSQ_ALU_CONST_CACHE_VS_14 0xA26E -#define mmSQ_ALU_CONST_CACHE_VS_15 0xA26F -#define mmSQ_ALU_CONST_CACHE_GS_0 0xA270 -#define mmSQ_ALU_CONST_CACHE_GS_1 0xA271 -#define mmSQ_ALU_CONST_CACHE_GS_2 0xA272 -#define mmSQ_ALU_CONST_CACHE_GS_3 0xA273 -#define mmSQ_ALU_CONST_CACHE_GS_4 0xA274 -#define mmSQ_ALU_CONST_CACHE_GS_5 0xA275 -#define mmSQ_ALU_CONST_CACHE_GS_6 0xA276 -#define mmSQ_ALU_CONST_CACHE_GS_7 0xA277 -#define mmSQ_ALU_CONST_CACHE_GS_8 0xA278 -#define mmSQ_ALU_CONST_CACHE_GS_9 0xA279 -#define mmSQ_ALU_CONST_CACHE_GS_10 0xA27A -#define mmSQ_ALU_CONST_CACHE_GS_11 0xA27B -#define mmSQ_ALU_CONST_CACHE_GS_12 0xA27C -#define mmSQ_ALU_CONST_CACHE_GS_13 0xA27D -#define mmSQ_ALU_CONST_CACHE_GS_14 0xA27E -#define mmSQ_ALU_CONST_CACHE_GS_15 0xA27F -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_0 0xA050 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_1 0xA051 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_2 0xA052 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_3 0xA053 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_4 0xA054 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_5 0xA055 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_6 0xA056 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_7 0xA057 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_8 0xA058 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_9 0xA059 -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_10 0xA05A -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_11 0xA05B -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_12 0xA05C -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_13 0xA05D -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_14 0xA05E -#define mmSQ_ALU_CONST_BUFFER_SIZE_PS_15 0xA05F -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_0 0xA060 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_1 0xA061 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_2 0xA062 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_3 0xA063 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_4 0xA064 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_5 0xA065 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_6 0xA066 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_7 0xA067 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_8 0xA068 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_9 0xA069 -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_10 0xA06A -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_11 0xA06B -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_12 0xA06C -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_13 0xA06D -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_14 0xA06E -#define mmSQ_ALU_CONST_BUFFER_SIZE_VS_15 0xA06F -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_0 0xA070 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_1 0xA071 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_2 0xA072 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_3 0xA073 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_4 0xA074 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_5 0xA075 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_6 0xA076 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_7 0xA077 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_8 0xA078 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_9 0xA079 -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_10 0xA07A -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_11 0xA07B -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_12 0xA07C -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_13 0xA07D -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_14 0xA07E -#define mmSQ_ALU_CONST_BUFFER_SIZE_GS_15 0xA07F - -#define mmSPI_VS_OUT_ID_0 0xA185 -#define mmSPI_VS_OUT_ID_1 0xA186 -#define mmSPI_VS_OUT_ID_2 0xA187 -#define mmSPI_VS_OUT_ID_3 0xA188 -#define mmSPI_VS_OUT_ID_4 0xA189 -#define mmSPI_VS_OUT_ID_5 0xA18A -#define mmSPI_VS_OUT_ID_6 0xA18B -#define mmSPI_VS_OUT_ID_7 0xA18C -#define mmSPI_VS_OUT_ID_8 0xA18D -#define mmSPI_VS_OUT_ID_9 0xA18E -#define mmSPI_PS_INPUT_CNTL_0 0xA191 -#define mmSPI_PS_INPUT_CNTL_1 0xA192 -#define mmSPI_PS_INPUT_CNTL_2 0xA193 -#define mmSPI_PS_INPUT_CNTL_3 0xA194 -#define mmSPI_PS_INPUT_CNTL_4 0xA195 -#define mmSPI_PS_INPUT_CNTL_5 0xA196 -#define mmSPI_PS_INPUT_CNTL_6 0xA197 -#define mmSPI_PS_INPUT_CNTL_7 0xA198 -#define mmSPI_PS_INPUT_CNTL_8 0xA199 -#define mmSPI_PS_INPUT_CNTL_9 0xA19A -#define mmSPI_PS_INPUT_CNTL_10 0xA19B -#define mmSPI_PS_INPUT_CNTL_11 0xA19C -#define mmSPI_PS_INPUT_CNTL_12 0xA19D -#define mmSPI_PS_INPUT_CNTL_13 0xA19E -#define mmSPI_PS_INPUT_CNTL_14 0xA19F -#define mmSPI_PS_INPUT_CNTL_15 0xA1A0 -#define mmSPI_PS_INPUT_CNTL_16 0xA1A1 -#define mmSPI_PS_INPUT_CNTL_17 0xA1A2 -#define mmSPI_PS_INPUT_CNTL_18 0xA1A3 -#define mmSPI_PS_INPUT_CNTL_19 0xA1A4 -#define mmSPI_PS_INPUT_CNTL_20 0xA1A5 -#define mmSPI_PS_INPUT_CNTL_21 0xA1A6 -#define mmSPI_PS_INPUT_CNTL_22 0xA1A7 -#define mmSPI_PS_INPUT_CNTL_23 0xA1A8 -#define mmSPI_PS_INPUT_CNTL_24 0xA1A9 -#define mmSPI_PS_INPUT_CNTL_25 0xA1AA -#define mmSPI_PS_INPUT_CNTL_26 0xA1AB -#define mmSPI_PS_INPUT_CNTL_27 0xA1AC -#define mmSPI_PS_INPUT_CNTL_28 0xA1AD -#define mmSPI_PS_INPUT_CNTL_29 0xA1AE -#define mmSPI_PS_INPUT_CNTL_30 0xA1AF -#define mmSPI_PS_INPUT_CNTL_31 0xA1B0 -#define mmSPI_VS_OUT_CONFIG 0xA1B1 -#define mmSPI_THREAD_GROUPING 0xA1B2 -#define mmSPI_PS_IN_CONTROL_0 0xA1B3 -#define mmSPI_PS_IN_CONTROL_1 0xA1B4 -#define mmSPI_INTERP_CONTROL_0 0xA1B5 -#define mmSPI_INPUT_Z 0xA1B6 -#define mmSPI_FOG_CNTL 0xA1B7 -#define mmSPI_FOG_FUNC_SCALE 0xA1B8 -#define mmSPI_FOG_FUNC_BIAS 0xA1B9 - -#define mmSX_MISC 0xA0D4 -#define mmSX_ALPHA_TEST_CONTROL 0xA104 -#define mmSX_ALPHA_REF 0xA10E - -#define mmDB_DEPTH_BASE 0xA003 -#define mmDB_DEPTH_INFO 0xA004 -#define mmDB_HTILE_DATA_BASE 0xA005 -#define mmDB_DEPTH_SIZE 0xA000 -#define mmDB_DEPTH_VIEW 0xA001 -#define mmDB_RENDER_CONTROL 0xA343 -#define mmDB_RENDER_OVERRIDE 0xA344 -#define mmDB_SHADER_CONTROL 0xA203 -#define mmDB_STENCIL_CLEAR 0xA00A -#define mmDB_DEPTH_CLEAR 0xA00B -#define mmDB_HTILE_SURFACE 0xA349 -#define mmDB_PRELOAD_CONTROL 0xA34C -#define mmDB_PREFETCH_LIMIT 0xA34D -#define mmDB_STENCILREFMASK 0xA10C -#define mmDB_STENCILREFMASK_BF 0xA10D -#define mmDB_SRESULTS_COMPARE_STATE0 0xA34A -#define mmDB_SRESULTS_COMPARE_STATE1 0xA34B -#define mmDB_DEPTH_CONTROL 0xA200 -#define mmDB_ALPHA_TO_MASK 0xA351 - -#define mmCB_CLEAR_RED_R6XX 0xA048 -#define mmCB_CLEAR_GREEN_R6XX 0xA049 -#define mmCB_CLEAR_BLUE_R6XX 0xA04A -#define mmCB_CLEAR_ALPHA_R6XX 0xA04B -#define mmCB_BLEND_RED 0xA105 -#define mmCB_BLEND_GREEN 0xA106 -#define mmCB_BLEND_BLUE 0xA107 -#define mmCB_BLEND_ALPHA 0xA108 -#define mmCB_FOG_RED_R6XX 0xA109 -#define mmCB_FOG_GREEN_R6XX 0xA10A -#define mmCB_FOG_BLUE_R6XX 0xA10B -#define mmCB_BLEND_CONTROL 0xA201 -#define mmCB_COLOR_CONTROL 0xA202 -#define mmCB_BLEND0_CONTROL 0xA1E0 -#define mmCB_BLEND1_CONTROL 0xA1E1 -#define mmCB_BLEND2_CONTROL 0xA1E2 -#define mmCB_BLEND3_CONTROL 0xA1E3 -#define mmCB_BLEND4_CONTROL 0xA1E4 -#define mmCB_BLEND5_CONTROL 0xA1E5 -#define mmCB_BLEND6_CONTROL 0xA1E6 -#define mmCB_BLEND7_CONTROL 0xA1E7 -#define mmCB_CLRCMP_CONTROL 0xA30C -#define mmCB_CLRCMP_SRC 0xA30D -#define mmCB_CLRCMP_DST 0xA30E -#define mmCB_CLRCMP_MSK 0xA30F -#define mmCB_COLOR0_BASE 0xA010 -#define mmCB_COLOR1_BASE 0xA011 -#define mmCB_COLOR2_BASE 0xA012 -#define mmCB_COLOR3_BASE 0xA013 -#define mmCB_COLOR4_BASE 0xA014 -#define mmCB_COLOR5_BASE 0xA015 -#define mmCB_COLOR6_BASE 0xA016 -#define mmCB_COLOR7_BASE 0xA017 -#define mmCB_COLOR0_SIZE 0xA018 -#define mmCB_COLOR1_SIZE 0xA019 -#define mmCB_COLOR2_SIZE 0xA01A -#define mmCB_COLOR3_SIZE 0xA01B -#define mmCB_COLOR4_SIZE 0xA01C -#define mmCB_COLOR5_SIZE 0xA01D -#define mmCB_COLOR6_SIZE 0xA01E -#define mmCB_COLOR7_SIZE 0xA01F -#define mmCB_COLOR0_VIEW 0xA020 -#define mmCB_COLOR1_VIEW 0xA021 -#define mmCB_COLOR2_VIEW 0xA022 -#define mmCB_COLOR3_VIEW 0xA023 -#define mmCB_COLOR4_VIEW 0xA024 -#define mmCB_COLOR5_VIEW 0xA025 -#define mmCB_COLOR6_VIEW 0xA026 -#define mmCB_COLOR7_VIEW 0xA027 -#define mmCB_COLOR0_INFO 0xA028 -#define mmCB_COLOR1_INFO 0xA029 -#define mmCB_COLOR2_INFO 0xA02A -#define mmCB_COLOR3_INFO 0xA02B -#define mmCB_COLOR4_INFO 0xA02C -#define mmCB_COLOR5_INFO 0xA02D -#define mmCB_COLOR6_INFO 0xA02E -#define mmCB_COLOR7_INFO 0xA02F -#define mmCB_COLOR0_TILE 0xA030 -#define mmCB_COLOR1_TILE 0xA031 -#define mmCB_COLOR2_TILE 0xA032 -#define mmCB_COLOR3_TILE 0xA033 -#define mmCB_COLOR4_TILE 0xA034 -#define mmCB_COLOR5_TILE 0xA035 -#define mmCB_COLOR6_TILE 0xA036 -#define mmCB_COLOR7_TILE 0xA037 -#define mmCB_COLOR0_FRAG 0xA038 -#define mmCB_COLOR1_FRAG 0xA039 -#define mmCB_COLOR2_FRAG 0xA03A -#define mmCB_COLOR3_FRAG 0xA03B -#define mmCB_COLOR4_FRAG 0xA03C -#define mmCB_COLOR5_FRAG 0xA03D -#define mmCB_COLOR6_FRAG 0xA03E -#define mmCB_COLOR7_FRAG 0xA03F -#define mmCB_COLOR0_MASK 0xA040 -#define mmCB_COLOR1_MASK 0xA041 -#define mmCB_COLOR2_MASK 0xA042 -#define mmCB_COLOR3_MASK 0xA043 -#define mmCB_COLOR4_MASK 0xA044 -#define mmCB_COLOR5_MASK 0xA045 -#define mmCB_COLOR6_MASK 0xA046 -#define mmCB_COLOR7_MASK 0xA047 -#define mmCB_CLEAR_RED_R6XX 0xA048 -#define mmCB_CLEAR_GREEN_R6XX 0xA049 -#define mmCB_CLEAR_BLUE_R6XX 0xA04A -#define mmCB_CLEAR_ALPHA_R6XX 0xA04B -#define mmCB_TARGET_MASK 0xA08E -#define mmCB_SHADER_MASK 0xA08F -#define mmCB_SHADER_CONTROL 0xA1E8 - -#define mmSQ_VTX_BASE_VTX_LOC 0xF3FC -#define mmSQ_VTX_START_INST_LOC 0xF3FD - -#endif /* _R700_CHIPOFFSET_H_ */ - diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c deleted file mode 100644 index 853dec9233c..00000000000 --- a/src/mesa/drivers/dri/r600/r700_clear.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" -#include "main/enums.h" -#include "swrast/swrast.h" - -#include "radeon_lock.h" -#include "r600_context.h" - -#include "r700_shaderinst.h" -#include "r700_clear.h" - -static GLboolean r700ClearFast(context_t *context, GLbitfield mask) -{ - /* TODO, fast clear need implementation */ - return GL_FALSE; -} - -void r700Clear(struct gl_context * ctx, GLbitfield mask) -{ - context_t *context = R700_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]); - GLbitfield swrast_mask = 0, tri_mask = 0; - int i; - struct gl_framebuffer *fb = ctx->DrawBuffer; - - radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s %x\n", __func__, mask); - - if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) { - context->radeon.front_buffer_dirty = GL_TRUE; - } - - radeon_prepare_render(radeon); - - if( GL_TRUE == r700ClearFast(context, mask) ) - { - return; - } - if (!context->radeon.radeonScreen->driScreen->dri2.enabled) { - LOCK_HARDWARE(&context->radeon); - UNLOCK_HARDWARE(&context->radeon); - if (dPriv->numClipRects == 0) - return; - } - - R600_NEWPRIM(context); - - if (colorMask == ~0) - tri_mask |= (mask & BUFFER_BITS_COLOR); - else - tri_mask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)); - - - /* HW stencil */ - if (mask & BUFFER_BIT_STENCIL) { - tri_mask |= BUFFER_BIT_STENCIL; - } - - /* HW depth */ - if (mask & BUFFER_BIT_DEPTH) { - tri_mask |= BUFFER_BIT_DEPTH; - } - - /* If we're doing a tri pass for depth/stencil, include a likely color - * buffer with it. - */ - - for (i = 0; i < BUFFER_COUNT; i++) { - GLuint bufBit = 1 << i; - if ((tri_mask) & bufBit) { - if (!fb->Attachment[i].Renderbuffer->ClassID) { - tri_mask &= ~bufBit; - swrast_mask |= bufBit; - } - } - } - - /* SW fallback clearing */ - swrast_mask = mask & ~tri_mask; - - if (tri_mask) { - radeonUserClear(ctx, tri_mask); - } - - if (swrast_mask) { - radeon_print(RADEON_FALLBACKS, RADEON_IMPORTANT, "%s: swrast clear, mask: %x\n", - __FUNCTION__, swrast_mask); - _swrast_Clear(ctx, swrast_mask); - } - -} - - diff --git a/src/mesa/drivers/dri/r600/r700_clear.h b/src/mesa/drivers/dri/r600/r700_clear.h deleted file mode 100644 index de372ee3039..00000000000 --- a/src/mesa/drivers/dri/r600/r700_clear.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#ifndef __r700_CLEAR_H__ -#define __r700_CLEAR_H__ - -extern void r700Clear(struct gl_context * ctx, GLbitfield mask); - -#endif /* __r700_CLEAR_H__ */ diff --git a/src/mesa/drivers/dri/r600/r700_debug.c b/src/mesa/drivers/dri/r600/r700_debug.c deleted file mode 100644 index cd1ba9eca3f..00000000000 --- a/src/mesa/drivers/dri/r600/r700_debug.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include "r700_debug.h" -#include "radeon_debug.h" - -void DumpHwBinary(int type, void *addr, int size) -{ - int i; - unsigned int *pHw = (unsigned int *)addr; - - return; - - switch (type) - { - case DUMP_PIXEL_SHADER: - radeon_print(RADEON_SHADER, RADEON_TRACE, "Pixel Shader\n"); - break; - case DUMP_VERTEX_SHADER: - radeon_print(RADEON_SHADER, RADEON_TRACE, "Vertex Shader\n"); - break; - case DUMP_FETCH_SHADER: - radeon_print(RADEON_SHADER, RADEON_TRACE, "Fetch Shader\n"); - break; - } - - for (i = 0; i < size; i++) - { - radeon_print(RADEON_SHADER, RADEON_TRACE, "0x%08x,\t", *pHw); - if (i%4 == 3) - radeon_print(RADEON_SHADER, RADEON_TRACE, "0x%08x\n", *pHw); - pHw++; - - } -} - diff --git a/src/mesa/drivers/dri/r600/r700_debug.h b/src/mesa/drivers/dri/r600/r700_debug.h deleted file mode 100644 index c0921bf6100..00000000000 --- a/src/mesa/drivers/dri/r600/r700_debug.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#ifndef _R700_DEBUG_H_ -#define _R700_DEBUG_H_ -enum R700_DUMP_TYPE -{ - DUMP_VERTEX_SHADER = 0x1, - DUMP_PIXEL_SHADER = 0x2, - DUMP_FETCH_SHADER = 0x4, -}; - -extern void DumpHwBinary(int, void *, int); - -#endif /*_R700_DEBUG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_driconf.h b/src/mesa/drivers/dri/r600/r700_driconf.h deleted file mode 100644 index a9e21523449..00000000000 --- a/src/mesa/drivers/dri/r600/r700_driconf.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _R700_DRICONF_H_ -#define _R700_DRICONF_H_ - -#define DRI_CONF_FP_OPTIMIZATION_SPEED 0 -#define DRI_CONF_FP_OPTIMIZATION_QUALITY 1 - -#endif /* _R700_DRICONF_H_ */ diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c deleted file mode 100644 index 6f9834e68fe..00000000000 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ /dev/null @@ -1,821 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/imports.h" -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" -#include "program/program.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" -#include "r600_emit.h" - -#include "r700_fragprog.h" - -#include "r700_debug.h" - -void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) -{ - static const gl_state_index winstate[STATE_LENGTH] - = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0, 0}; - struct prog_instruction *newInst, *inst; - GLint win_size; /* state reference */ - GLuint wpos_temp; /* temp register */ - int i, j; - - /* PARAM win_size = STATE_FB_WPOS_Y_TRANSFORM */ - win_size = _mesa_add_state_reference(fprog->Base.Parameters, winstate); - - wpos_temp = fprog->Base.NumTemporaries++; - - /* scan program where WPOS is used and replace with wpos_temp */ - inst = fprog->Base.Instructions; - for (i = 0; i < fprog->Base.NumInstructions; i++) { - for (j=0; j < 3; j++) { - if(inst->SrcReg[j].File == PROGRAM_INPUT && - inst->SrcReg[j].Index == FRAG_ATTRIB_WPOS) { - inst->SrcReg[j].File = PROGRAM_TEMPORARY; - inst->SrcReg[j].Index = wpos_temp; - } - } - inst++; - } - - _mesa_insert_instructions(&(fprog->Base), 0, 1); - - newInst = fprog->Base.Instructions; - /* possibly invert wpos.y depending on STATE_FB_WPOS_Y_TRANSFORM var */ - newInst[0].Opcode = OPCODE_MAD; - newInst[0].DstReg.File = PROGRAM_TEMPORARY; - newInst[0].DstReg.Index = wpos_temp; - newInst[0].DstReg.WriteMask = WRITEMASK_XYZW; - - newInst[0].SrcReg[0].File = PROGRAM_INPUT; - newInst[0].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - newInst[0].SrcReg[0].Swizzle = SWIZZLE_XYZW; - - newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR; - newInst[0].SrcReg[1].Index = win_size; - newInst[0].SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_X, SWIZZLE_ONE, SWIZZLE_ONE); - - newInst[0].SrcReg[2].File = PROGRAM_STATE_VAR; - newInst[0].SrcReg[2].Index = win_size; - newInst[0].SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ZERO); - -} - -//TODO : Validate FP input with VP output. -void Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx) -{ - unsigned int unBit; - unsigned int i; - - /* match fp inputs with vp exports. */ - struct r700_vertex_program_cont *vpc = - (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; - GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; - - pAsm->number_used_registers = 0; - -//Input mapping : mesa_fp->Base.InputsRead set the flag, set in - //The flags parsed in parse_attrib_binding. FRAG_ATTRIB_COLx, FRAG_ATTRIB_TEXx, ... - //MUST match order in Map_Vertex_Output - unBit = 1 << FRAG_ATTRIB_WPOS; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_COL0; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_COL1; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++; - } - - unBit = 1 << VERT_RESULT_FOGC; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i] = pAsm->number_used_registers++; - } - } - -/* order has been taken care of */ -#if 1 - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(OutputsWritten & unBit) - { - pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0] = pAsm->number_used_registers++; - } - } -#else - if( (mesa_fp->Base.InputsRead >> FRAG_ATTRIB_VAR0) > 0 ) - { - struct r700_vertex_program_cont *vpc = - (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; - struct gl_program_parameter_list * VsVarying = vpc->mesa_program.Base.Varying; - struct gl_program_parameter_list * PsVarying = mesa_fp->Base.Varying; - struct gl_program_parameter * pVsParam; - struct gl_program_parameter * pPsParam; - GLuint j, k; - GLuint unMaxVarying = 0; - - for(i=0; i<VsVarying->NumParameters; i++) - { - pAsm->uiFP_AttributeMap[i + FRAG_ATTRIB_VAR0] = 0; - } - - for(i=FRAG_ATTRIB_VAR0; i<FRAG_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_fp->Base.InputsRead & unBit) - { - j = i - FRAG_ATTRIB_VAR0; - pPsParam = PsVarying->Parameters + j; - - for(k=0; k<VsVarying->NumParameters; k++) - { - pVsParam = VsVarying->Parameters + k; - - if( strcmp(pPsParam->Name, pVsParam->Name) == 0) - { - pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers + k; - if(k > unMaxVarying) - { - unMaxVarying = k; - } - break; - } - } - } - } - - pAsm->number_used_registers += unMaxVarying + 1; - } -#endif - unBit = 1 << FRAG_ATTRIB_FACE; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE] = pAsm->number_used_registers++; - } - - unBit = 1 << FRAG_ATTRIB_PNTC; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC] = pAsm->number_used_registers++; - } - -/* Map temporary registers (GPRs) */ - pAsm->starting_temp_register_number = pAsm->number_used_registers; - - if(mesa_fp->Base.NumNativeTemporaries >= mesa_fp->Base.NumTemporaries) - { - pAsm->number_used_registers += mesa_fp->Base.NumNativeTemporaries; - } - else - { - pAsm->number_used_registers += mesa_fp->Base.NumTemporaries; - } - -/* Output mapping */ - pAsm->number_of_exports = 0; - pAsm->number_of_colorandz_exports = 0; /* don't include stencil and mask out. */ - pAsm->starting_export_register_number = pAsm->number_used_registers; - - for (i = 0; i < FRAG_RESULT_MAX; ++i) - { - unBit = 1 << i; - if (mesa_fp->Base.OutputsWritten & unBit) - { - if (i == FRAG_RESULT_DEPTH) - { - pAsm->depth_export_register_number = pAsm->number_used_registers; - pAsm->pR700Shader->depthIsExported = 1; - } - - pAsm->uiFP_OutputMap[i] = pAsm->number_used_registers++; - ++pAsm->number_of_exports; - ++pAsm->number_of_colorandz_exports; - } - } - - pAsm->flag_reg_index = pAsm->number_used_registers++; - - pAsm->uFirstHelpReg = pAsm->number_used_registers; -} - -GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_fp) -{ - GLuint i, j; - GLint * puiTEMPwrites; - GLint * puiTEMPreads; - struct prog_instruction * pILInst; - InstDeps *pInstDeps; - struct prog_instruction * texcoord_DepInst; - GLint nDepInstID; - - puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); - puiTEMPreads = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); - - for(i=0; i<mesa_fp->Base.NumTemporaries; i++) - { - puiTEMPwrites[i] = -1; - puiTEMPreads[i] = -1; - } - - pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_fp->Base.NumInstructions); - - for(i=0; i<mesa_fp->Base.NumInstructions; i++) - { - pInstDeps[i].nDstDep = -1; - pILInst = &(mesa_fp->Base.Instructions[i]); - - //Dst - if(pILInst->DstReg.File == PROGRAM_TEMPORARY) - { - //Set lastwrite for the temp - puiTEMPwrites[pILInst->DstReg.Index] = i; - } - - //Src - for(j=0; j<3; j++) - { - if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) - { - //Set dep. - pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; - //Set first read - if(puiTEMPreads[pILInst->SrcReg[j].Index] < 0 ) - { - puiTEMPreads[pILInst->SrcReg[j].Index] = i; - } - } - else - { - pInstDeps[i].nSrcDeps[j] = -1; - } - } - } - - fp->r700AsmCode.pInstDeps = pInstDeps; - - //Find dep for tex inst - for(i=0; i<mesa_fp->Base.NumInstructions; i++) - { - pILInst = &(mesa_fp->Base.Instructions[i]); - - if(GL_TRUE == IsTex(pILInst->Opcode)) - { //src0 is the tex coord register, src1 is texunit, src2 is textype - nDepInstID = pInstDeps[i].nSrcDeps[0]; - if(nDepInstID >= 0) - { - texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); - if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) - { - pInstDeps[nDepInstID].nDstDep = i; - pInstDeps[i].nDstDep = i; - } - else if(GL_TRUE == IsTex(texcoord_DepInst->Opcode) ) - { - pInstDeps[i].nDstDep = i; - } - else - { //... other deps? - } - } - // make sure that we dont overwrite src used earlier - nDepInstID = puiTEMPreads[pILInst->DstReg.Index]; - if(nDepInstID < i) - { - pInstDeps[i].nDstDep = puiTEMPreads[pILInst->DstReg.Index]; - texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); - if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) - { - pInstDeps[nDepInstID].nDstDep = i; - } - - } - - } - } - - FREE(puiTEMPwrites); - FREE(puiTEMPreads); - - return GL_TRUE; -} - -GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - GLuint number_of_colors_exported; - GLboolean z_enabled = GL_FALSE; - GLuint unBit, shadow_unit; - int i; - struct prog_instruction *inst; - gl_state_index shadow_ambient[STATE_LENGTH] - = { STATE_INTERNAL, STATE_SHADOW_AMBIENT, 0, 0, 0}; - - //Init_Program - Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); - - if(GL_TRUE == r700->bShaderUseMemConstant) - { - fp->r700AsmCode.bUseMemConstant = GL_TRUE; - } - else - { - fp->r700AsmCode.bUseMemConstant = GL_FALSE; - } - - fp->r700AsmCode.unAsic = 7; - - if(mesa_fp->Base.InputsRead & FRAG_BIT_WPOS) - { - insert_wpos_code(ctx, mesa_fp); - } - - /* add/map consts for ARB_shadow_ambient */ - if(mesa_fp->Base.ShadowSamplers) - { - inst = mesa_fp->Base.Instructions; - for (i = 0; i < mesa_fp->Base.NumInstructions; i++) - { - if(inst->TexShadow == 1) - { - shadow_unit = inst->TexSrcUnit; - shadow_ambient[2] = shadow_unit; - fp->r700AsmCode.shadow_regs[shadow_unit] = - _mesa_add_state_reference(mesa_fp->Base.Parameters, shadow_ambient); - } - inst++; - } - } - - Map_Fragment_Program(&(fp->r700AsmCode), mesa_fp, ctx); - - if( GL_FALSE == Find_Instruction_Dependencies_fp(fp, mesa_fp) ) - { - return GL_FALSE; - } - - InitShaderProgram(&(fp->r700AsmCode)); - - for(i=0; i < MAX_SAMPLERS; i++) - { - fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i]; - } - - fp->r700AsmCode.unCurNumILInsts = mesa_fp->Base.NumInstructions; - - if( GL_FALSE == AssembleInstr(0, - 0, - mesa_fp->Base.NumInstructions, - &(mesa_fp->Base.Instructions[0]), - &(fp->r700AsmCode)) ) - { - return GL_FALSE; - } - - if(GL_FALSE == Process_Fragment_Exports(&(fp->r700AsmCode), mesa_fp->Base.OutputsWritten) ) - { - return GL_FALSE; - } - - if( GL_FALSE == RelocProgram(&(fp->r700AsmCode), &(mesa_fp->Base)) ) - { - return GL_FALSE; - } - - fp->r700Shader.nRegs = (fp->r700AsmCode.number_used_registers == 0) ? 0 - : (fp->r700AsmCode.number_used_registers - 1); - - fp->r700Shader.nParamExports = fp->r700AsmCode.number_of_exports; - - number_of_colors_exported = fp->r700AsmCode.number_of_colorandz_exports; - - unBit = 1 << FRAG_RESULT_DEPTH; - if(mesa_fp->Base.OutputsWritten & unBit) - { - z_enabled = GL_TRUE; - number_of_colors_exported--; - } - - /* illegal to set this to 0 */ - if(number_of_colors_exported || z_enabled) - { - fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled; - } - else - { - fp->r700Shader.exportMode = (1 << 1); - } - - fp->translated = GL_TRUE; - - return GL_TRUE; -} - -void r700SelectFragmentShader(struct gl_context *ctx) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_fragment_program *fp = (struct r700_fragment_program *) - (ctx->FragmentProgram._Current); - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - { - fp->r700AsmCode.bR6xx = 1; - } - - if (GL_FALSE == fp->translated) - r700TranslateFragmentShader(fp, &(fp->mesa_program), ctx); -} - -void * r700GetActiveFpShaderBo(struct gl_context * ctx) -{ - struct r700_fragment_program *fp = (struct r700_fragment_program *) - (ctx->FragmentProgram._Current); - - return fp->shaderbo; -} - -void * r700GetActiveFpShaderConstBo(struct gl_context * ctx) -{ - struct r700_fragment_program *fp = (struct r700_fragment_program *) - (ctx->FragmentProgram._Current); - - return fp->constbo0; -} - -GLboolean r700SetupFragmentProgram(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - struct r700_fragment_program *fp = (struct r700_fragment_program *) - (ctx->FragmentProgram._Current); - r700_AssemblerBase *pAsm = &(fp->r700AsmCode); - struct gl_fragment_program *mesa_fp = &(fp->mesa_program); - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui, i; - unsigned int unNumOfReg; - unsigned int unBit; - unsigned int num_sq_ps_gprs; - GLuint exportCount; - GLboolean point_sprite = GL_FALSE; - - if(GL_FALSE == fp->loaded) - { - if(fp->r700Shader.bNeedsAssembly == GL_TRUE) - { - Assemble( &(fp->r700Shader) ); - } - - /* Load fp to gpu */ - r600EmitShader(ctx, - &(fp->shaderbo), - (GLvoid *)(fp->r700Shader.pProgram), - fp->r700Shader.uShaderBinaryDWORDSize, - "FS"); - - fp->loaded = GL_TRUE; - } - - DumpHwBinary(DUMP_PIXEL_SHADER, (GLvoid *)(fp->r700Shader.pProgram), - fp->r700Shader.uShaderBinaryDWORDSize); - - /* TODO : enable this after MemUse fixed *= - (context->chipobj.MemUse)(context, fp->shadercode.buf->id); - */ - - R600_STATECHANGE(context, ps); - - r700->ps.SQ_PGM_RESOURCES_PS.u32All = 0; - SETbit(r700->ps.SQ_PGM_RESOURCES_PS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); - - r700->ps.SQ_PGM_START_PS.u32All = 0; /* set from buffer obj */ - - R600_STATECHANGE(context, spi); - - unNumOfReg = fp->r700Shader.nRegs + 1; - - ui = (r700->SPI_PS_IN_CONTROL_0.u32All & NUM_INTERP_mask) / (1 << NUM_INTERP_shift); - - /* PS uses fragment.position */ - if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) - { - ui += 1; - SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, CENTERS_ONLY, BARYC_SAMPLE_CNTL_shift, BARYC_SAMPLE_CNTL_mask); - SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); - SETbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); - } - else - { - CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); - CLEARbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); - } - - if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_FACE)) - { - ui += 1; - SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - SETbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); - SETbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ALL_BITS_bit); - SETfield(r700->SPI_PS_IN_CONTROL_1.u32All, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE], FRONT_FACE_ADDR_shift, FRONT_FACE_ADDR_mask); - } - else - { - CLEARbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); - } - - /* see if we need any point_sprite replacements, also increase num_interp - * as there's no vp output for them */ - if (ctx->Point.PointSprite) - { - for (i = FRAG_ATTRIB_TEX0; i<= FRAG_ATTRIB_TEX7; i++) - { - if (ctx->Point.CoordReplace[i - FRAG_ATTRIB_TEX0] == GL_TRUE) - { - ui++; - point_sprite = GL_TRUE; - } - } - } - - if( mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) - ui++; - - if ((mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) || point_sprite) - { - SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); - SETbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); - SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_S, PNT_SPRITE_OVRD_X_shift, PNT_SPRITE_OVRD_X_mask); - SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_T, PNT_SPRITE_OVRD_Y_shift, PNT_SPRITE_OVRD_Y_mask); - SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_0, PNT_SPRITE_OVRD_Z_shift, PNT_SPRITE_OVRD_Z_mask); - SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_1, PNT_SPRITE_OVRD_W_shift, PNT_SPRITE_OVRD_W_mask); - /* Like e.g. viewport and winding, point sprite coordinates are - * inverted when rendering to FBO. */ - if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == !ctx->DrawBuffer->Name) - SETbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); - else - CLEARbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit); - } - else - { - CLEARbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit); - } - - - ui = (unNumOfReg < ui) ? ui : unNumOfReg; - - SETfield(r700->ps.SQ_PGM_RESOURCES_PS.u32All, ui, NUM_GPRS_shift, NUM_GPRS_mask); - - num_sq_ps_gprs = ((r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All & NUM_PS_GPRS_mask) >> NUM_PS_GPRS_shift); - - if(ui > num_sq_ps_gprs) - { - /* care! thich changes sq - needs idle state */ - R600_STATECHANGE(context, sq); - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, ui, NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - } - - CLEARbit(r700->ps.SQ_PGM_RESOURCES_PS.u32All, UNCACHED_FIRST_INST_bit); - - if(fp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ - { - SETfield(r700->ps.SQ_PGM_RESOURCES_PS.u32All, fp->r700Shader.uStackSize, - STACK_SIZE_shift, STACK_SIZE_mask); - } - - SETfield(r700->ps.SQ_PGM_EXPORTS_PS.u32All, fp->r700Shader.exportMode, - EXPORT_MODE_shift, EXPORT_MODE_mask); - - // emit ps input map - struct r700_vertex_program_cont *vpc = - (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; - GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; - - for(ui = 0; ui < R700_MAX_SHADER_EXPORTS; ui++) - r700->SPI_PS_INPUT_CNTL[ui].u32All = 0; - - unBit = 1 << FRAG_ATTRIB_WPOS; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_COL0; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - else - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_COL1; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - else - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - unBit = 1 << VERT_RESULT_FOGC; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - - for(i=0; i<8; i++) - { - GLboolean coord_replace = ctx->Point.PointSprite && ctx->Point.CoordReplace[i]; - unBit = 1 << (VERT_RESULT_TEX0 + i); - if ((OutputsWritten & unBit) || coord_replace) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - /* ARB_point_sprite */ - if (coord_replace) - { - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); - } - } - } - - unBit = 1 << FRAG_ATTRIB_FACE; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - unBit = 1 << FRAG_ATTRIB_PNTC; - if(mesa_fp->Base.InputsRead & unBit) - { - ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_PNTC]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - else - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit); - } - - - - - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(OutputsWritten & unBit) - { - ui = pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0]; - SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); - SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, - SEMANTIC_shift, SEMANTIC_mask); - CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - } - - exportCount = (r700->ps.SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); - if (r700->CB_SHADER_CONTROL.u32All != ((1 << exportCount) - 1)) - { - R600_STATECHANGE(context, cb); - r700->CB_SHADER_CONTROL.u32All = (1 << exportCount) - 1; - } - - /* sent out shader constants. */ - paramList = fp->mesa_program.Base.Parameters; - - if(NULL != paramList) - { - _mesa_load_state_parameters(ctx, paramList); - - if (paramList->NumParameters > R700_MAX_DX9_CONSTS) - return GL_FALSE; - - R600_STATECHANGE(context, ps_consts); - - r700->ps.num_consts = paramList->NumParameters; - - unNumParamData = paramList->NumParameters; - - for(ui=0; ui<unNumParamData; ui++) { - r700->ps.consts[ui][0].f32All = paramList->ParameterValues[ui][0].f; - r700->ps.consts[ui][1].f32All = paramList->ParameterValues[ui][1].f; - r700->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2].f; - r700->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3].f; - } - - /* Load fp constants to gpu */ - if( (GL_TRUE == r700->bShaderUseMemConstant) && (unNumParamData > 0) ) - { - r600EmitShader(ctx, - &(fp->constbo0), - (GLvoid *)&(paramList->ParameterValues[0][0]), - unNumParamData * 4, - "FS Const"); - } - - } else - r700->ps.num_consts = 0; - - COMPILED_SUB * pCompiledSub; - GLuint uj; - GLuint unConstOffset = r700->ps.num_consts; - for(ui=0; ui<pAsm->unNumPresub; ui++) - { - pCompiledSub = pAsm->presubs[ui].pCompiledSub; - - r700->ps.num_consts += pCompiledSub->NumParameters; - - for(uj=0; uj<pCompiledSub->NumParameters; uj++) - { - r700->ps.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; - r700->ps.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; - r700->ps.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; - r700->ps.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; - } - unConstOffset += pCompiledSub->NumParameters; - } - - return GL_TRUE; -} - diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h deleted file mode 100644 index bdb95ff0e71..00000000000 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _R700_FRAGPROG_H_ -#define _R700_FRAGPROG_H_ - -#include "r600_context.h" -#include "r700_assembler.h" - -struct r700_fragment_program -{ - struct gl_fragment_program mesa_program; - - r700_AssemblerBase r700AsmCode; - R700_Shader r700Shader; - - GLboolean translated; - GLboolean loaded; - GLboolean error; - - void * shaderbo; - - GLuint k0used; - void * constbo0; - - GLboolean WritesDepth; - GLuint optimization; -}; - -/* Internal */ -void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); - -void Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp, - struct gl_context *ctx); -GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_fp); - -GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_vp, - struct gl_context *ctx); - -/* Interface */ -extern void r700SelectFragmentShader(struct gl_context *ctx); - -extern GLboolean r700SetupFragmentProgram(struct gl_context * ctx); - -extern void * r700GetActiveFpShaderBo(struct gl_context * ctx); - -extern void * r700GetActiveFpShaderConstBo(struct gl_context * ctx); - -#endif /*_R700_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_ioctl.c b/src/mesa/drivers/dri/r600/r700_ioctl.c deleted file mode 100644 index 3bc422f394e..00000000000 --- a/src/mesa/drivers/dri/r600/r700_ioctl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <sched.h> -#include <errno.h> - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/simple_list.h" - -#include "radeon_common.h" -#include "r600_context.h" - -#include "r700_ioctl.h" -#include "r700_clear.h" - - -void r700InitIoctlFuncs(struct dd_function_table *functions) -{ - functions->Clear = r700Clear; - functions->Finish = radeonFinish; - functions->Flush = radeonFlush; -} diff --git a/src/mesa/drivers/dri/r600/r700_ioctl.h b/src/mesa/drivers/dri/r600/r700_ioctl.h deleted file mode 100644 index 414dc3e23e3..00000000000 --- a/src/mesa/drivers/dri/r600/r700_ioctl.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef __R700_IOCTL_H__ -#define __R700_IOCTL_H__ - -#include "r600_context.h" -#include "radeon_drm.h" - -extern void r700InitIoctlFuncs(struct dd_function_table *functions); - -#endif /* __R700_IOCTL_H__ */ diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c deleted file mode 100644 index 6ca74580035..00000000000 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <string.h> - -#include "main/glheader.h" -#include "main/imports.h" - -#include "program/program.h" -#include "tnl/tnl.h" - -#include "r600_context.h" -#include "r600_emit.h" - -#include "r700_oglprog.h" -#include "r700_fragprog.h" -#include "r700_vertprog.h" - - -static void freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) -{ - struct r700_vertex_program *tmp, *vp = cache->progs; - - while (vp) { - tmp = vp->next; - /* Release DMA region */ - r600DeleteShader(ctx, vp->shaderbo); - - if(NULL != vp->constbo0) - { - r600DeleteShader(ctx, vp->constbo0); - } - - /* Clean up */ - Clean_Up_Assembler(&(vp->r700AsmCode)); - Clean_Up_Shader(&(vp->r700Shader)); - - _mesa_reference_vertprog(ctx, &vp->mesa_program, NULL); - free(vp); - vp = tmp; - } -} - -static struct gl_program *r700NewProgram(struct gl_context * ctx, - GLenum target, - GLuint id) -{ - struct gl_program *pProgram = NULL; - - struct r700_vertex_program_cont *vpc; - struct r700_fragment_program *fp; - - radeon_print(RADEON_SHADER, RADEON_VERBOSE, - "%s %u, %u\n", __func__, target, id); - - switch (target) - { - case GL_VERTEX_STATE_PROGRAM_NV: - case GL_VERTEX_PROGRAM_ARB: - vpc = CALLOC_STRUCT(r700_vertex_program_cont); - pProgram = _mesa_init_vertex_program(ctx, - &vpc->mesa_program, - target, - id); - - break; - case GL_FRAGMENT_PROGRAM_NV: - case GL_FRAGMENT_PROGRAM_ARB: - fp = CALLOC_STRUCT(r700_fragment_program); - pProgram = _mesa_init_fragment_program(ctx, - &fp->mesa_program, - target, - id); - fp->translated = GL_FALSE; - fp->loaded = GL_FALSE; - - fp->shaderbo = NULL; - - fp->constbo0 = NULL; - - break; - default: - _mesa_problem(ctx, "Bad target in r700NewProgram"); - } - - return pProgram; -} - -static void r700DeleteProgram(struct gl_context * ctx, struct gl_program *prog) -{ - struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; - struct r700_fragment_program * fp; - - radeon_print(RADEON_SHADER, RADEON_VERBOSE, - "%s %p\n", __func__, prog); - - switch (prog->Target) - { - case GL_VERTEX_STATE_PROGRAM_NV: - case GL_VERTEX_PROGRAM_ARB: - freeVertProgCache(ctx, vpc); - break; - case GL_FRAGMENT_PROGRAM_NV: - case GL_FRAGMENT_PROGRAM_ARB: - fp = (struct r700_fragment_program*)prog; - /* Release DMA region */ - - r600DeleteShader(ctx, fp->shaderbo); - - if(NULL != fp->constbo0) - { - r600DeleteShader(ctx, fp->constbo0); - } - - /* Clean up */ - Clean_Up_Assembler(&(fp->r700AsmCode)); - Clean_Up_Shader(&(fp->r700Shader)); - break; - default: - _mesa_problem(ctx, "Bad target in r700NewProgram"); - } - - _mesa_delete_program(ctx, prog); -} - -static GLboolean -r700ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) -{ - struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; - struct r700_fragment_program * fp = (struct r700_fragment_program*)prog; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - freeVertProgCache(ctx, vpc); - vpc->progs = NULL; - break; - case GL_FRAGMENT_PROGRAM_ARB: - r600DeleteShader(ctx, fp->shaderbo); - - if(NULL != fp->constbo0) - { - r600DeleteShader(ctx, fp->constbo0); - fp->constbo0 = NULL; - } - - Clean_Up_Assembler(&(fp->r700AsmCode)); - Clean_Up_Shader(&(fp->r700Shader)); - fp->translated = GL_FALSE; - fp->loaded = GL_FALSE; - fp->shaderbo = NULL; - break; - } - - /* XXX check if program is legal, within limits */ - return GL_TRUE; -} - -static GLboolean r700IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) -{ - - return GL_TRUE; -} - -void r700InitShaderFuncs(struct dd_function_table *functions) -{ - functions->NewProgram = r700NewProgram; - functions->DeleteProgram = r700DeleteProgram; - functions->ProgramStringNotify = r700ProgramStringNotify; - functions->IsProgramNative = r700IsProgramNative; -} diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.h b/src/mesa/drivers/dri/r600/r700_oglprog.h deleted file mode 100644 index 4d421338678..00000000000 --- a/src/mesa/drivers/dri/r600/r700_oglprog.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#ifndef _R700_OGLPROG_H_ -#define _R700_OGLPROG_H_ -#include "main/dd.h" - -extern void r700InitShaderFuncs(struct dd_function_table *functions); - -#endif /*_R700_OGLPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c deleted file mode 100644 index a565c9f2087..00000000000 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ /dev/null @@ -1,995 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - * CooperYuan <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/state.h" -#include "main/imports.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/dd.h" -#include "main/simple_list.h" -#include "main/api_arrayelt.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_vp_build.h" -#include "tnl/t_context.h" -#include "tnl/t_vertex.h" -#include "vbo/vbo_context.h" - -#include "r600_context.h" -#include "r600_cmdbuf.h" - -#include "r600_tex.h" - -#include "r700_vertprog.h" -#include "r700_fragprog.h" -#include "r700_state.h" - -#include "radeon_buffer_objects.h" -#include "radeon_common_context.h" - -void r700WaitForIdle(context_t *context); -void r700WaitForIdleClean(context_t *context); -static unsigned int r700PrimitiveType(int prim); -GLboolean r700SyncSurf(context_t *context, - struct radeon_bo *pbo, - uint32_t read_domain, - uint32_t write_domain, - uint32_t sync_type); - -void r700WaitForIdle(context_t *context) -{ - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_RENDER | RADEON_STATE, RADEON_TRACE, "%s\n", __func__); - BEGIN_BATCH_NO_AUTOSTATE(3); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); - R600_OUT_BATCH(mmWAIT_UNTIL - ASIC_CONFIG_BASE_INDEX); - R600_OUT_BATCH(WAIT_3D_IDLE_bit); - - END_BATCH(); - COMMIT_BATCH(); -} - -void r700WaitForIdleClean(context_t *context) -{ - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_RENDER | RADEON_STATE, RADEON_TRACE, "%s\n", __func__); - BEGIN_BATCH_NO_AUTOSTATE(5); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 0)); - R600_OUT_BATCH(CACHE_FLUSH_AND_INV_EVENT); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); - R600_OUT_BATCH(mmWAIT_UNTIL - ASIC_CONFIG_BASE_INDEX); - R600_OUT_BATCH(WAIT_3D_IDLE_bit | WAIT_3D_IDLECLEAN_bit); - - END_BATCH(); - COMMIT_BATCH(); -} - -void r700Start3D(context_t *context) -{ - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_RENDER | RADEON_STATE, RADEON_TRACE, "%s\n", __func__); - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - { - BEGIN_BATCH_NO_AUTOSTATE(2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_START_3D_CMDBUF, 0)); - R600_OUT_BATCH(0); - END_BATCH(); - } - - BEGIN_BATCH_NO_AUTOSTATE(3); - R600_OUT_BATCH(CP_PACKET3(R600_IT_CONTEXT_CONTROL, 1)); - R600_OUT_BATCH(0x80000000); - R600_OUT_BATCH(0x80000000); - END_BATCH(); - - COMMIT_BATCH(); -} - -GLboolean r700SyncSurf(context_t *context, - struct radeon_bo *pbo, - uint32_t read_domain, - uint32_t write_domain, - uint32_t sync_type) -{ - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_RENDER | RADEON_STATE, RADEON_TRACE, "%s\n", __func__); - uint32_t cp_coher_size; - - if (!pbo) - return GL_FALSE; - - if (pbo->size == 0xffffffff) - cp_coher_size = 0xffffffff; - else - cp_coher_size = ((pbo->size + 255) >> 8); - - BEGIN_BATCH_NO_AUTOSTATE(5 + 2); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SURFACE_SYNC, 3)); - R600_OUT_BATCH(sync_type); - R600_OUT_BATCH(cp_coher_size); - R600_OUT_BATCH(0); - R600_OUT_BATCH(10); - R600_OUT_BATCH_RELOC(0, - pbo, - 0, - read_domain, write_domain, 0); - END_BATCH(); - COMMIT_BATCH(); - - return GL_TRUE; -} - -static unsigned int r700PrimitiveType(int prim) -{ - switch (prim & PRIM_MODE_MASK) - { - case GL_POINTS: - return DI_PT_POINTLIST; - break; - case GL_LINES: - return DI_PT_LINELIST; - break; - case GL_LINE_STRIP: - return DI_PT_LINESTRIP; - break; - case GL_LINE_LOOP: - return DI_PT_LINELOOP; - break; - case GL_TRIANGLES: - return DI_PT_TRILIST; - break; - case GL_TRIANGLE_STRIP: - return DI_PT_TRISTRIP; - break; - case GL_TRIANGLE_FAN: - return DI_PT_TRIFAN; - break; - case GL_QUADS: - return DI_PT_QUADLIST; - break; - case GL_QUAD_STRIP: - return DI_PT_QUADSTRIP; - break; - case GL_POLYGON: - return DI_PT_POLYGON; - break; - default: - assert(0); - return -1; - break; - } -} - -static int r700NumVerts(int num_verts, int prim) -{ - int verts_off = 0; - - switch (prim & PRIM_MODE_MASK) { - case GL_POINTS: - verts_off = 0; - break; - case GL_LINES: - verts_off = num_verts % 2; - break; - case GL_LINE_STRIP: - if (num_verts < 2) - verts_off = num_verts; - break; - case GL_LINE_LOOP: - if (num_verts < 2) - verts_off = num_verts; - break; - case GL_TRIANGLES: - verts_off = num_verts % 3; - break; - case GL_TRIANGLE_STRIP: - if (num_verts < 3) - verts_off = num_verts; - break; - case GL_TRIANGLE_FAN: - if (num_verts < 3) - verts_off = num_verts; - break; - case GL_QUADS: - verts_off = num_verts % 4; - break; - case GL_QUAD_STRIP: - if (num_verts < 4) - verts_off = num_verts; - else - verts_off = num_verts % 2; - break; - case GL_POLYGON: - if (num_verts < 3) - verts_off = num_verts; - break; - default: - assert(0); - return -1; - break; - } - - return num_verts - verts_off; -} - -static void r700RunRenderPrimitive(struct gl_context * ctx, int start, int end, - int prim, GLint basevertex) -{ - context_t *context = R700_CONTEXT(ctx); - BATCH_LOCALS(&context->radeon); - int type, total_emit; - int num_indices; - uint32_t vgt_draw_initiator = 0; - uint32_t vgt_index_type = 0; - uint32_t vgt_primitive_type = 0; - uint32_t vgt_num_indices = 0; - - type = r700PrimitiveType(prim); - num_indices = r700NumVerts(end - start, prim); - - radeon_print(RADEON_RENDER, RADEON_TRACE, - "%s type %x num_indices %d\n", - __func__, type, num_indices); - - if (type < 0 || num_indices <= 0) - return; - - SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - - SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - - if(GL_TRUE != context->ind_buf.is_32bit) - { - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - - /* 16-bit indexes are packed in a 32-bit value */ - SETfield(vgt_index_type, -#if MESA_BIG_ENDIAN - VGT_DMA_SWAP_32_BIT, -#else - VGT_DMA_SWAP_NONE, -#endif - SWAP_MODE_shift, SWAP_MODE_mask); - - - vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ - + 5 + 2; /* DRAW_INDEX */ - - BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim - R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - /* offset */ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(basevertex); //VTX_BASE_VTX_LOC - R600_OUT_BATCH(0); //VTX_START_INST_LOC - // draw packet - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); - R600_OUT_BATCH(context->ind_buf.bo_offset); - R600_OUT_BATCH(0); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, - context->ind_buf.bo, - context->ind_buf.bo_offset, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); -} - -static void r700RunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) -{ - context_t *context = R700_CONTEXT(ctx); - BATCH_LOCALS(&context->radeon); - int type; - uint32_t num_indices, total_emit = 0; - uint32_t vgt_draw_initiator = 0; - uint32_t vgt_index_type = 0; - uint32_t vgt_primitive_type = 0; - uint32_t vgt_num_indices = 0; - - type = r700PrimitiveType(prim); - num_indices = r700NumVerts(end - start, prim); - - radeon_print(RADEON_RENDER, RADEON_TRACE, - "%s type %x num_indices %d\n", - __func__, type, num_indices); - - if (type < 0 || num_indices <= 0) - return; - - SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - - if (num_indices > 0xffff) - { - SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - else - { - SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } - - /* 16-bit indexes are packed in a 32-bit value */ - SETfield(vgt_index_type, -#if MESA_BIG_ENDIAN - VGT_DMA_SWAP_32_BIT, -#else - VGT_DMA_SWAP_NONE, -#endif - SWAP_MODE_shift, SWAP_MODE_mask); - - vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - - SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); - - total_emit += 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ - + 3; /* DRAW */ - - BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim - R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); - R600_OUT_BATCH(vgt_primitive_type); - // index type - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); - /* offset */ - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(start); //VTX_BASE_VTX_LOC - R600_OUT_BATCH(0); //VTX_START_INST_LOC - // draw packet - - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - - END_BATCH(); - COMMIT_BATCH(); -} - -/* start 3d, idle, cb/db flush */ -#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 - -static GLuint r700PredictRenderSize(struct gl_context* ctx, - const struct _mesa_prim *prim, - const struct _mesa_index_buffer *ib, - GLuint nr_prims) -{ - context_t *context = R700_CONTEXT(ctx); - GLboolean flushed; - GLuint dwords, i; - GLuint state_size; - - dwords = PRE_EMIT_STATE_BUFSZ; - if (ib) - dwords += nr_prims * 18; - else { - for (i = 0; i < nr_prims; ++i) - { - dwords += 14; - } - } - - state_size = radeonCountStateEmitSize(&context->radeon); - flushed = rcommonEnsureCmdBufSpace(&context->radeon, - dwords + state_size, - __FUNCTION__); - if (flushed) - dwords += radeonCountStateEmitSize(&context->radeon); - else - dwords += state_size; - - radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s: total prediction size is %d.\n", __FUNCTION__, dwords); - return dwords; - -} - -#define CONVERT( TYPE, MACRO ) do { \ - GLuint i, j, sz; \ - sz = input->Size; \ - if (input->Normalized) { \ - for (i = 0; i < count; i++) { \ - const TYPE *in = (TYPE *)src_ptr; \ - for (j = 0; j < sz; j++) { \ - *dst_ptr++ = MACRO(*in); \ - in++; \ - } \ - src_ptr += stride; \ - } \ - } else { \ - for (i = 0; i < count; i++) { \ - const TYPE *in = (TYPE *)src_ptr; \ - for (j = 0; j < sz; j++) { \ - *dst_ptr++ = (GLfloat)(*in); \ - in++; \ - } \ - src_ptr += stride; \ - } \ - } \ -} while (0) - -/** - * Convert attribute data type to float - * If the attribute uses named buffer object replace the bo with newly allocated bo - */ -static void r700ConvertAttrib(struct gl_context *ctx, int count, - const struct gl_client_array *input, - struct StreamDesc *attr) -{ - context_t *context = R700_CONTEXT(ctx); - const GLvoid *src_ptr; - GLboolean mapped_named_bo = GL_FALSE; - GLfloat *dst_ptr; - GLuint stride; - - stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size : input->StrideB; - - /* Convert value for first element only */ - if (input->StrideB == 0) - { - count = 1; - } - - if (input->BufferObj->Name) - { - if (!input->BufferObj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size, - GL_MAP_READ_BIT, input->BufferObj); - mapped_named_bo = GL_TRUE; - } - - src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); - } - else - { - src_ptr = input->Ptr; - } - - radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, - sizeof(GLfloat) * input->Size * count, 32); - - radeon_bo_map(attr->bo, 1); - - dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); - - assert(src_ptr != NULL); - - switch (input->Type) - { - case GL_DOUBLE: - CONVERT(GLdouble, (GLfloat)); - break; - case GL_UNSIGNED_INT: - CONVERT(GLuint, UINT_TO_FLOAT); - break; - case GL_INT: - CONVERT(GLint, INT_TO_FLOAT); - break; - case GL_UNSIGNED_SHORT: - CONVERT(GLushort, USHORT_TO_FLOAT); - break; - case GL_SHORT: - CONVERT(GLshort, SHORT_TO_FLOAT); - break; - case GL_UNSIGNED_BYTE: - assert(input->Format != GL_BGRA); - CONVERT(GLubyte, UBYTE_TO_FLOAT); - break; - case GL_BYTE: - CONVERT(GLbyte, BYTE_TO_FLOAT); - break; - default: - assert(0); - break; - } - - radeon_bo_unmap(attr->bo); - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, input->BufferObj); - } -} - -#if 0 /* unused */ -static void r700AlignDataToDword(struct gl_context *ctx, - const struct gl_client_array *input, - int count, - struct StreamDesc *attr) -{ - context_t *context = R700_CONTEXT(ctx); - const int dst_stride = (input->StrideB + 3) & ~3; - const int size = getTypeSize(input->Type) * input->Size * count; - GLboolean mapped_named_bo = GL_FALSE; - - radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32); - - radeon_bo_map(attr->bo, 1); - - if (!input->BufferObj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size, - GL_MAP_READ_BIT, input->BufferObj); - mapped_named_bo = GL_TRUE; - } - - { - GLvoid *src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); - GLvoid *dst_ptr = ADD_POINTERS(attr->bo->ptr, attr->bo_offset); - int i; - - for (i = 0; i < count; ++i) - { - memcpy(dst_ptr, src_ptr, input->StrideB); - src_ptr += input->StrideB; - dst_ptr += dst_stride; - } - } - - radeon_bo_unmap(attr->bo); - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, input->BufferObj); - } - - attr->stride = dst_stride; -} -#endif - -static void r700SetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) -{ - context_t *context = R700_CONTEXT(ctx); - GLuint stride; - int ret; - int i, index; - - R600_STATECHANGE(context, vtx); - - for(index = 0; index < context->nNumActiveAos; index++) - { - struct radeon_aos *aos = &context->radeon.tcl.aos[index]; - i = context->stream_desc[index].element; - - stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; - - if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT -#if MESA_BIG_ENDIAN - || getTypeSize(input[i]->Type) != 4 -#endif - ) - { - assert(count); - r700ConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); - } - else - { - if (input[i]->BufferObj->Name) - { - context->stream_desc[index].stride = input[i]->StrideB; - context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; - context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; - context->stream_desc[index].is_named_bo = GL_TRUE; - } - else - { - int size; - int local_count = count; - uint32_t *dst; - - if (input[i]->StrideB == 0) - { - size = getTypeSize(input[i]->Type) * input[i]->Size; - local_count = 1; - } - else - { - size = getTypeSize(input[i]->Type) * input[i]->Size * local_count; - } - - radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo, - &context->stream_desc[index].bo_offset, size, 32); - - radeon_bo_map(context->stream_desc[index].bo, 1); - assert(context->stream_desc[index].bo->ptr != NULL); - - - dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr, - context->stream_desc[index].bo_offset); - - switch (context->stream_desc[index].dwords) - { - case 1: - radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 2: - radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 3: - radeonEmitVec12(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - case 4: - radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); - break; - default: - assert(0); - break; - } - radeon_bo_unmap(context->stream_desc[index].bo); - } - } - - aos->count = context->stream_desc[index].stride == 0 ? 1 : count; - aos->stride = context->stream_desc[index].stride / sizeof(float); - aos->components = context->stream_desc[index].dwords; - aos->bo = context->stream_desc[index].bo; - aos->offset = context->stream_desc[index].bo_offset; - - if(context->stream_desc[index].is_named_bo) - { - radeon_cs_space_add_persistent_bo(context->radeon.cmdbuf.cs, - context->stream_desc[index].bo, - RADEON_GEM_DOMAIN_GTT, 0); - } - } - - ret = radeon_cs_space_check_with_bo(context->radeon.cmdbuf.cs, - first_elem(&context->radeon.dma.reserved)->bo, - RADEON_GEM_DOMAIN_GTT, 0); -} - -static void r700FreeData(struct gl_context *ctx) -{ - /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo - * to prevent double unref in radeonReleaseArrays - * called during context destroy - */ - context_t *context = R700_CONTEXT(ctx); - - int i; - - for (i = 0; i < context->nNumActiveAos; i++) - { - if (!context->stream_desc[i].is_named_bo) - { - radeon_bo_unref(context->stream_desc[i].bo); - } - context->radeon.tcl.aos[i].bo = NULL; - } - - if (context->ind_buf.bo != NULL) - { - radeon_bo_unref(context->ind_buf.bo); - } -} - -static void r700FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) -{ - context_t *context = R700_CONTEXT(ctx); - GLvoid *src_ptr; - GLuint *out; - int i; - GLboolean mapped_named_bo = GL_FALSE; - - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size, - GL_MAP_READ_BIT, mesa_ind_buf->obj); - mapped_named_bo = GL_TRUE; - assert(mesa_ind_buf->obj->Pointer != NULL); - } - src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); - - if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) - { - GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); - GLubyte *in = (GLubyte *)src_ptr; - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) - { - *out++ = in[i] | in[i + 1] << 16; - } - - if (i < mesa_ind_buf->count) - { - *out++ = in[i]; - } - - radeon_bo_unmap(context->ind_buf.bo); -#if MESA_BIG_ENDIAN - } - else - { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ - GLushort *in = (GLushort *)src_ptr; - GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) - { - *out++ = in[i] | in[i + 1] << 16; - } - - if (i < mesa_ind_buf->count) - { - *out++ = in[i]; - } - radeon_bo_unmap(context->ind_buf.bo); -#endif - } - - context->ind_buf.is_32bit = GL_FALSE; - context->ind_buf.count = mesa_ind_buf->count; - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, mesa_ind_buf->obj); - } -} - -static void r700SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) -{ - context_t *context = R700_CONTEXT(ctx); - - if (!mesa_ind_buf) { - context->ind_buf.bo = NULL; - return; - } - -#if MESA_BIG_ENDIAN - if (mesa_ind_buf->type == GL_UNSIGNED_INT) -#else - if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) -#endif - { - const GLvoid *src_ptr; - GLvoid *dst_ptr; - GLboolean mapped_named_bo = GL_FALSE; - - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) - { - ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size, - GL_MAP_READ_BIT, mesa_ind_buf->obj); - assert(mesa_ind_buf->obj->Pointer != NULL); - mapped_named_bo = GL_TRUE; - } - - src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); - - const GLuint size = mesa_ind_buf->count * getTypeSize(mesa_ind_buf->type); - - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - radeon_bo_map(context->ind_buf.bo, 1); - assert(context->ind_buf.bo->ptr != NULL); - dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - - memcpy(dst_ptr, src_ptr, size); - - radeon_bo_unmap(context->ind_buf.bo); - context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); - context->ind_buf.count = mesa_ind_buf->count; - - if (mapped_named_bo) - { - ctx->Driver.UnmapBuffer(ctx, mesa_ind_buf->obj); - } - } - else - { - r700FixupIndexBuffer(ctx, mesa_ind_buf); - } -} - -static GLboolean check_fallbacks(struct gl_context *ctx) -{ - if (ctx->RenderMode != GL_RENDER) - return GL_TRUE; - - return GL_FALSE; -} - -static GLboolean r700TryDrawPrims(struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index ) -{ - context_t *context = R700_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - GLuint i, id = 0; - struct radeon_renderbuffer *rrb; - - if (ctx->NewState) - _mesa_update_state( ctx ); - - if (check_fallbacks(ctx)) - return GL_FALSE; - - _tnl_UpdateFixedFunctionProgram(ctx); - r700SetVertexFormat(ctx, arrays, max_index + 1); - /* shaders need to be updated before buffers are validated */ - r700UpdateShaders(ctx); - if (!r600ValidateBuffers(ctx)) - return GL_FALSE; - - /* always emit CB base to prevent - * lock ups on some chips. - */ - R600_STATECHANGE(context, cb_target); - /* mark vtx as dirty since it changes per-draw */ - R600_STATECHANGE(context, vtx); - - r700SetScissor(context); - r700SetupVertexProgram(ctx); - r700SetupFragmentProgram(ctx); - r700UpdateShaderStates(ctx); - - GLuint emit_end = r700PredictRenderSize(ctx, prim, ib, nr_prims) - + context->radeon.cmdbuf.cs->cdw; - - r700SetupIndexBuffer(ctx, ib); - r700SetupStreams(ctx, arrays, max_index + 1); - - radeonEmitState(radeon); - - radeon_debug_add_indent(); - for (i = 0; i < nr_prims; ++i) - { - if (context->ind_buf.bo) - r700RunRenderPrimitive(ctx, - prim[i].start, - prim[i].start + prim[i].count, - prim[i].mode, - prim[i].basevertex); - else - r700RunRenderPrimitiveImmediate(ctx, - prim[i].start, - prim[i].start + prim[i].count, - prim[i].mode); - } - radeon_debug_remove_indent(); - - /* Flush render op cached for last several quads. */ - /* XXX drm should handle this in fence submit */ - r700WaitForIdleClean(context); - - rrb = radeon_get_colorbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - CB_ACTION_ENA_bit | (1 << (id + 6))); - - rrb = radeon_get_depthbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - DB_ACTION_ENA_bit | DB_DEST_BASE_ENA_bit); - - r700FreeData(ctx); - - if (emit_end < context->radeon.cmdbuf.cs->cdw) - { - WARN_ONCE("Rendering was %d commands larger than predicted size." - " We might overflow command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end); - } - - return GL_TRUE; -} - -static void r700DrawPrims(struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index) -{ - GLboolean retval = GL_FALSE; - - context_t *context = R700_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - radeon_prepare_render(radeon); - - /* This check should get folded into just the places that - * min/max index are really needed. - */ - - if (!vbo_all_varyings_in_vbos(arrays)) { - if (!index_bounds_valid) - vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); - /* do we want to rebase, minimizes the - * amount of data to upload? */ - if (min_index) { - vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r700DrawPrims ); - return; - } - } - /* Make an attempt at drawing */ - retval = r700TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); - - /* If failed run tnl pipeline - it should take care of fallbacks */ - if (!retval) { - _swsetup_Wakeup(ctx); - _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); - } -} - -void r700InitDraw(struct gl_context *ctx) -{ - struct vbo_context *vbo = vbo_context(ctx); - - /* to be enabled */ - vbo->draw_prims = r700DrawPrims; -} - - diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c deleted file mode 100644 index cbbfaed31c9..00000000000 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/imports.h" - -#include "main/glheader.h" - -#include "r600_context.h" - -#include "r700_shader.h" - -void r700ShaderInit(struct gl_context * ctx) -{ -} - -void AddInstToList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst) -{ - if(NULL == plstCFInstructions->pTail) - { //first - plstCFInstructions->pHead = pInst; - plstCFInstructions->pTail = pInst; - } - else - { - plstCFInstructions->pTail->pNextInst = pInst; - plstCFInstructions->pTail = pInst; - } - pInst->pNextInst = NULL; - - plstCFInstructions->uNumOfNode++; -} - -void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst) -{ - GLuint ulIndex = 0; - GLboolean bFound = GL_FALSE; - R700ShaderInstruction * pPrevInst = NULL; - R700ShaderInstruction * pCurInst = plstCFInstructions->pHead; - - /* Need go thro list to make sure pInst is there. */ - while(NULL != pCurInst) - { - if(pCurInst == pInst) - { - bFound = GL_TRUE; - break; - } - - pPrevInst = pCurInst; - pCurInst = pCurInst->pNextInst; - } - if(GL_TRUE == bFound) - { - plstCFInstructions->uNumOfNode--; - - pCurInst = pInst->pNextInst; - ulIndex = pInst->m_uIndex; - while(NULL != pCurInst) - { - pCurInst->m_uIndex = ulIndex; - ulIndex++; - pCurInst = pCurInst->pNextInst; - } - - if(plstCFInstructions->pHead == pInst) - { - plstCFInstructions->pHead = pInst->pNextInst; - } - if(plstCFInstructions->pTail == pInst) - { - plstCFInstructions->pTail = pPrevInst; - } - if(NULL != pPrevInst) - { - pPrevInst->pNextInst = pInst->pNextInst; - } - - FREE(pInst); - } -} - -void Init_R700_Shader(R700_Shader * pShader) -{ - pShader->Type = R700_SHADER_INVALID; - pShader->pProgram = NULL; - pShader->bBinaryShader = GL_FALSE; - pShader->bFetchShaderRequired = GL_FALSE; - pShader->bNeedsAssembly = GL_FALSE; - pShader->bLinksDirty = GL_TRUE; - pShader->uShaderBinaryDWORDSize = 0; - pShader->nRegs = 0; - pShader->nParamExports = 0; - pShader->nMemExports = 0; - pShader->resource = 0; - - pShader->exportMode = 0; - pShader->depthIsImported = GL_FALSE; - - pShader->positionVectorIsExported = GL_FALSE; - pShader->miscVectorIsExported = GL_FALSE; - pShader->renderTargetArrayIndexIsExported = GL_FALSE; - pShader->ccDist0VectorIsExported = GL_FALSE; - pShader->ccDist1VectorIsExported = GL_FALSE; - - - pShader->depthIsExported = GL_FALSE; - pShader->stencilRefIsExported = GL_FALSE; - pShader->coverageToMaskIsExported = GL_FALSE; - pShader->maskIsExported = GL_FALSE; - pShader->killIsUsed = GL_FALSE; - - pShader->uCFOffset = 0; - pShader->uStackSize = 0; - pShader->uMaxCallDepth = 0; - - pShader->bSurfAllocated = GL_FALSE; - - pShader->lstCFInstructions.pHead=NULL; - pShader->lstCFInstructions.pTail=NULL; - pShader->lstCFInstructions.uNumOfNode=0; - pShader->lstALUInstructions.pHead=NULL; - pShader->lstALUInstructions.pTail=NULL; - pShader->lstALUInstructions.uNumOfNode=0; - pShader->lstTEXInstructions.pHead=NULL; - pShader->lstTEXInstructions.pTail=NULL; - pShader->lstTEXInstructions.uNumOfNode=0; - pShader->lstVTXInstructions.pHead=NULL; - pShader->lstVTXInstructions.pTail=NULL; - pShader->lstVTXInstructions.uNumOfNode=0; -} - -void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF) -{ - pShader->plstCFInstructions_active = plstCF; -} - -void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst) -{ - R700ControlFlowSXClause* pSXClause; - R700ControlFlowSMXClause* pSMXClause; - - pCFInst->m_uIndex = pShader->plstCFInstructions_active->uNumOfNode; - AddInstToList(pShader->plstCFInstructions_active, - (R700ShaderInstruction*)pCFInst); - pShader->uShaderBinaryDWORDSize += GetInstructionSize(pCFInst->m_ShaderInstType); - - pSXClause = NULL; - pSMXClause = NULL; - switch (pCFInst->m_ShaderInstType) - { - case SIT_CF_ALL_EXP_SX: - pSXClause = (R700ControlFlowSXClause*)pCFInst; - break; - case SIT_CF_ALL_EXP_SMX: - pSMXClause = (R700ControlFlowSMXClause*)pCFInst; - break; - default: - break; - }; - - if((pSXClause != NULL) && (pSXClause->m_Word0.f.type == SQ_EXPORT_PARAM)) - { - pShader->nParamExports += pSXClause->m_Word1.f.burst_count + 1; - } - else if ((pSMXClause != NULL) && (pSMXClause->m_Word1.f.cf_inst == SQ_CF_INST_MEM_RING) && - (pSMXClause->m_Word0.f.type == SQ_EXPORT_WRITE || pSMXClause->m_Word0.f.type == SQ_EXPORT_WRITE_IND)) - { - pShader->nMemExports += pSMXClause->m_Word1.f.burst_count + 1; - } - - pShader->bLinksDirty = GL_TRUE; - pShader->bNeedsAssembly = GL_TRUE; - - pCFInst->useCount++; -} - -void AddVTXInstruction(R700_Shader *pShader, R700VertexInstruction *pVTXInst) -{ - pVTXInst->m_uIndex = pShader->lstVTXInstructions.uNumOfNode; - AddInstToList(&(pShader->lstVTXInstructions), - (R700ShaderInstruction*)pVTXInst); - pShader->uShaderBinaryDWORDSize += GetInstructionSize(pVTXInst->m_ShaderInstType); - - if(pVTXInst->m_ShaderInstType == SIT_VTX_GENERIC) - { - R700VertexGenericFetch* pVTXGenericClause = (R700VertexGenericFetch*)pVTXInst; - pShader->nRegs = (pShader->nRegs < pVTXGenericClause->m_Word1_GPR.f.dst_gpr) ? pVTXGenericClause->m_Word1_GPR.f.dst_gpr : pShader->nRegs; - } - - pShader->bLinksDirty = GL_TRUE; - pShader->bNeedsAssembly = GL_TRUE; - - pVTXInst->useCount++; -} - -void AddTEXInstruction(R700_Shader *pShader, R700TextureInstruction *pTEXInst) -{ - pTEXInst->m_uIndex = pShader->lstTEXInstructions.uNumOfNode; - AddInstToList(&(pShader->lstTEXInstructions), - (R700ShaderInstruction*)pTEXInst); - pShader->uShaderBinaryDWORDSize += GetInstructionSize(pTEXInst->m_ShaderInstType); - - pShader->nRegs = (pShader->nRegs < pTEXInst->m_Word1.f.dst_gpr) ? pTEXInst->m_Word1.f.dst_gpr : pShader->nRegs; - - pShader->bLinksDirty = GL_TRUE; - pShader->bNeedsAssembly = GL_TRUE; - - pTEXInst->useCount++; -} - -void AddALUInstruction(R700_Shader *pShader, R700ALUInstruction *pALUInst) -{ - pALUInst->m_uIndex = pShader->lstALUInstructions.uNumOfNode; - AddInstToList(&(pShader->lstALUInstructions), - (R700ShaderInstruction*)pALUInst); - pShader->uShaderBinaryDWORDSize += GetInstructionSize(pALUInst->m_ShaderInstType); - - pShader->nRegs = (pShader->nRegs < pALUInst->m_Word1.f.dst_gpr) ? pALUInst->m_Word1.f.dst_gpr : pShader->nRegs; - - pShader->bLinksDirty = GL_TRUE; - pShader->bNeedsAssembly = GL_TRUE; - - pALUInst->useCount++; -} - -void ResolveLinks(R700_Shader *pShader) -{ - GLuint uiSize; - R700ShaderInstruction *pInst; - R700ALUInstruction *pALUinst; - R700TextureInstruction *pTEXinst; - R700VertexInstruction *pVTXinst; - - GLuint vtxOffset; - - GLuint cfOffset = 0x0; - - GLuint aluOffset = cfOffset + pShader->lstCFInstructions.uNumOfNode * GetInstructionSize(SIT_CF); - - GLuint texOffset = aluOffset; // + m_lstALUInstructions.size() * R700ALUInstruction::SIZE, - - pInst = pShader->lstALUInstructions.pHead; - while(NULL != pInst) - { - texOffset += GetInstructionSize(pInst->m_ShaderInstType); - - pInst = pInst->pNextInst; - }; - - vtxOffset = texOffset + pShader->lstTEXInstructions.uNumOfNode * GetInstructionSize(SIT_TEX); - - if ( ((pShader->lstTEXInstructions.uNumOfNode > 0) && (texOffset % 4 != 0)) || - ((pShader->lstVTXInstructions.uNumOfNode > 0) && (vtxOffset % 4 != 0)) ) - { - pALUinst = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - Init_R700ALUInstruction(pALUinst); - AddALUInstruction(pShader, pALUinst); - texOffset += GetInstructionSize(SIT_ALU); - vtxOffset += GetInstructionSize(SIT_ALU); - } - - pInst = pShader->lstALUInstructions.pHead; - uiSize = 0; - while(NULL != pInst) - { - pALUinst = (R700ALUInstruction*)pInst; - - if(pALUinst->m_pLinkedALUClause != NULL) - { - // This address is quad-word aligned - pALUinst->m_pLinkedALUClause->m_Word0.f.addr = (aluOffset + uiSize) >> 1; - } - - uiSize += GetInstructionSize(pALUinst->m_ShaderInstType); - - pInst = pInst->pNextInst; - }; - - pInst = pShader->lstTEXInstructions.pHead; - uiSize = 0; - while(NULL != pInst) - { - pTEXinst = (R700TextureInstruction*)pInst; - - if (pTEXinst->m_pLinkedGenericClause != NULL) - { - pTEXinst->m_pLinkedGenericClause->m_Word0.f.addr = (texOffset + uiSize) >> 1; - } - - uiSize += GetInstructionSize(pTEXinst->m_ShaderInstType); - - pInst = pInst->pNextInst; - }; - - pInst = pShader->lstVTXInstructions.pHead; - uiSize = 0; - while(NULL != pInst) - { - pVTXinst = (R700VertexInstruction*)pInst; - - if (pVTXinst->m_pLinkedGenericClause != NULL) - { - pVTXinst->m_pLinkedGenericClause->m_Word0.f.addr = (vtxOffset + uiSize) >> 1; - } - - uiSize += GetInstructionSize(pVTXinst->m_ShaderInstType); - - pInst = pInst->pNextInst; - }; - - pShader->bLinksDirty = GL_FALSE; -} - -void Assemble(R700_Shader *pShader) -{ - GLuint i; - GLuint *pShaderBinary; - GLuint size_of_program; - GLuint *pCurrPos; - - GLuint end_of_cf_instructions; - GLuint number_of_alu_dwords; - - R700ShaderInstruction *pInst; - - if(GL_TRUE == pShader->bBinaryShader) - { - return; - } - - if(pShader->bLinksDirty == GL_TRUE) - { - ResolveLinks(pShader); - } - - size_of_program = pShader->uShaderBinaryDWORDSize; - - pShaderBinary = (GLuint*) MALLOC(sizeof(GLuint)*size_of_program); - - pCurrPos = pShaderBinary; - - for (i = 0; i < size_of_program; i++) - { - pShaderBinary[i] = 0; - } - - pInst = pShader->lstCFInstructions.pHead; - while(NULL != pInst) - { - switch (pInst->m_ShaderInstType) - { - case SIT_CF_GENERIC: - { - R700ControlFlowGenericClause* pCFgeneric = (R700ControlFlowGenericClause*)pInst; - *pCurrPos++ = pCFgeneric->m_Word0.val; - *pCurrPos++ = pCFgeneric->m_Word1.val; - } - break; - case SIT_CF_ALU: - { - R700ControlFlowALUClause* pCFalu = (R700ControlFlowALUClause*)pInst; - *pCurrPos++ = pCFalu->m_Word0.val; - *pCurrPos++ = pCFalu->m_Word1.val; - } - break; - case SIT_CF_ALL_EXP_SX: - { - R700ControlFlowSXClause* pCFsx = (R700ControlFlowSXClause*)pInst; - *pCurrPos++ = pCFsx->m_Word0.val; - *pCurrPos++ = (pCFsx->m_Word1.val | pCFsx->m_Word1_SWIZ.val); - } - break; - case SIT_CF_ALL_EXP_SMX: - { - R700ControlFlowSMXClause* pCFsmx = (R700ControlFlowSMXClause*)pInst; - *pCurrPos++ = pCFsmx->m_Word0.val; - *pCurrPos++ = (pCFsmx->m_Word1.val | pCFsmx->m_Word1_BUF.val); - } - break; - default: - break; - } - - pInst = pInst->pNextInst; - }; - - number_of_alu_dwords = 0; - pInst = pShader->lstALUInstructions.pHead; - while(NULL != pInst) - { - switch (pInst->m_ShaderInstType) - { - case SIT_ALU: - { - R700ALUInstruction* pALU = (R700ALUInstruction*)pInst; - - *pCurrPos++ = pALU->m_Word0.val; - *pCurrPos++ = (pALU->m_Word1.val | pALU->m_Word1_OP2.val | pALU->m_Word1_OP3.val); - - number_of_alu_dwords += 2; - } - break; - case SIT_ALU_HALF_LIT: - { - R700ALUInstructionHalfLiteral* pALUhalf = (R700ALUInstructionHalfLiteral*)pInst; - - *pCurrPos++ = pALUhalf->m_Word0.val; - *pCurrPos++ = (pALUhalf->m_Word1.val | pALUhalf->m_Word1_OP2.val | pALUhalf->m_Word1_OP3.val); - *pCurrPos++ = *((GLuint*)&(pALUhalf->m_fLiteralX)); - *pCurrPos++ = *((GLuint*)&(pALUhalf->m_fLiteralY)); - - number_of_alu_dwords += 4; - } - break; - case SIT_ALU_FALL_LIT: - { - R700ALUInstructionFullLiteral* pALUfull = (R700ALUInstructionFullLiteral*)pInst; - - *pCurrPos++ = pALUfull->m_Word0.val; - *pCurrPos++ = (pALUfull->m_Word1.val | pALUfull->m_Word1_OP2.val | pALUfull->m_Word1_OP3.val); - - *pCurrPos++ = *((GLuint*)&(pALUfull->m_fLiteralX)); - *pCurrPos++ = *((GLuint*)&(pALUfull->m_fLiteralY)); - *pCurrPos++ = *((GLuint*)&(pALUfull->m_fLiteralZ)); - *pCurrPos++ = *((GLuint*)&(pALUfull->m_fLiteralW)); - - number_of_alu_dwords += 6; - } - break; - default: - break; - } - - pInst = pInst->pNextInst; - }; - - pInst = pShader->lstTEXInstructions.pHead; - while(NULL != pInst) - { - R700TextureInstruction* pTEX = (R700TextureInstruction*)pInst; - - *pCurrPos++ = pTEX->m_Word0.val; - *pCurrPos++ = pTEX->m_Word1.val; - *pCurrPos++ = pTEX->m_Word2.val; - *pCurrPos++ = 0x0beadeaf; - - pInst = pInst->pNextInst; - }; - - pInst = pShader->lstVTXInstructions.pHead; - while(NULL != pInst) - { - switch (pInst->m_ShaderInstType) - { - case SIT_VTX_SEM: // - { - R700VertexSemanticFetch* pVTXsem = (R700VertexSemanticFetch*)pInst; - - *pCurrPos++ = pVTXsem->m_Word0.val; - *pCurrPos++ = (pVTXsem->m_Word1.val | pVTXsem->m_Word1_SEM.val); - *pCurrPos++ = pVTXsem->m_Word2.val; - *pCurrPos++ = 0x0beadeaf; - } - break; - case SIT_VTX_GENERIC: // - { - R700VertexGenericFetch* pVTXgeneric = (R700VertexGenericFetch*)pInst; - - *pCurrPos++ = pVTXgeneric->m_Word0.val; - *pCurrPos++ = (pVTXgeneric->m_Word1.val | pVTXgeneric->m_Word1_GPR.val); - *pCurrPos++ = pVTXgeneric->m_Word2.val; - *pCurrPos++ = 0x0beadeaf; - } - break; - default: - break; - } - - pInst = pInst->pNextInst; - }; - - if(NULL != pShader->pProgram) - { - FREE(pShader->pProgram); - } - pShader->pProgram = (GLubyte*)pShaderBinary; - - end_of_cf_instructions = pShader->uCFOffset + pShader->lstCFInstructions.uNumOfNode * GetInstructionSize(SIT_CF); - - pShader->uEndOfCF = end_of_cf_instructions >> 1; - - pShader->uEndOfALU = (end_of_cf_instructions + number_of_alu_dwords) >> 1; - - pShader->uEndOfFetch = (pShader->uCFOffset + pShader->uShaderBinaryDWORDSize) >> 1; - - pShader->bNeedsAssembly = GL_FALSE; -} - -void LoadProgram(R700_Shader *pShader) //context -{ -} - -void UpdateShaderRegisters(R700_Shader *pShader) //context -{ -} - -void DeleteInstructions(R700_Shader *pShader) -{ -} - -void DebugPrint(void) -{ -} - -void cleanup_vfetch_shaderinst(R700_Shader *pShader) -{ - R700ShaderInstruction *pInst; - R700ShaderInstruction *pInstToFree; - R700VertexInstruction *pVTXInst; - R700ControlFlowInstruction *pCFInst; - - pInst = pShader->lstVTXInstructions.pHead; - while(NULL != pInst) - { - pVTXInst = (R700VertexInstruction *)pInst; - pShader->uShaderBinaryDWORDSize -= GetInstructionSize(pVTXInst->m_ShaderInstType); - - if(NULL != pVTXInst->m_pLinkedGenericClause) - { - pCFInst = (R700ControlFlowInstruction*)(pVTXInst->m_pLinkedGenericClause); - - TakeInstOutFromList(&(pShader->lstCFInstructions), - (R700ShaderInstruction*)pCFInst); - - pShader->uShaderBinaryDWORDSize -= GetInstructionSize(pCFInst->m_ShaderInstType); - } - - pInst = pInst->pNextInst; - }; - - //destroy each item in pShader->lstVTXInstructions; - pInst = pShader->lstVTXInstructions.pHead; - while(NULL != pInst) - { - pInstToFree = pInst; - pInst = pInst->pNextInst; - FREE(pInstToFree); - }; - - //set NULL pShader->lstVTXInstructions - pShader->lstVTXInstructions.pHead=NULL; - pShader->lstVTXInstructions.pTail=NULL; - pShader->lstVTXInstructions.uNumOfNode=0; -} - -void Clean_Up_Shader(R700_Shader *pShader) -{ - if(NULL != pShader->pProgram) - { - FREE(pShader->pProgram); - pShader->pProgram = NULL; - } - - R700ShaderInstruction *pInst; - R700ShaderInstruction *pInstToFree; - - pInst = pShader->lstCFInstructions.pHead; - while(NULL != pInst) - { - pInstToFree = pInst; - pInst = pInst->pNextInst; - FREE(pInstToFree); - }; - pShader->lstCFInstructions.pHead = NULL; - - pInst = pShader->lstALUInstructions.pHead; - while(NULL != pInst) - { - pInstToFree = pInst; - pInst = pInst->pNextInst; - FREE(pInstToFree); - }; - pShader->lstALUInstructions.pHead = NULL; - - pInst = pShader->lstTEXInstructions.pHead; - while(NULL != pInst) - { - pInstToFree = pInst; - pInst = pInst->pNextInst; - FREE(pInstToFree); - }; - pShader->lstTEXInstructions.pHead = NULL; - - pInst = pShader->lstVTXInstructions.pHead; - while(NULL != pInst) - { - pInstToFree = pInst; - pInst = pInst->pNextInst; - FREE(pInstToFree); - }; - pShader->lstVTXInstructions.pHead = NULL; -} - diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h deleted file mode 100644 index 183dd33525f..00000000000 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#ifndef __R700_SHADER_H__ -#define __R700_SHADER_H__ - -#include "main/mtypes.h" - -#include "r700_shaderinst.h" - - -void r700ShaderInit(struct gl_context * ctx); - -typedef enum R700ShaderType -{ - R700_SHADER_FS = 0x0, - R700_SHADER_ES = 0x1, - R700_SHADER_GS = 0x2, - R700_SHADER_VS = 0x3, - R700_SHADER_PS = 0x4, - R700_SHADER_INVALID = 0x5, -} R700ShaderType; - -typedef struct TypedShaderList -{ - R700ShaderInstruction * pHead; - R700ShaderInstruction * pTail; - GLuint uNumOfNode; -} TypedShaderList; - -typedef struct RealRegister -{ - GLuint uAddr; - GLuint uValue; -} RealRegister; - -typedef struct InstDeps -{ - GLint nDstDep; - GLint nSrcDeps[3]; -} InstDeps; - -typedef struct R700_Shader -{ - R700ShaderType Type; - - GLubyte* pProgram; - - GLboolean bBinaryShader; - GLboolean bFetchShaderRequired; - GLboolean bNeedsAssembly; - GLboolean bLinksDirty; - - GLuint uShaderBinaryDWORDSize; // in DWORDS - GLuint nRegs; - GLuint nParamExports; // VS_ EXPORT_COUNT (1 based, the actual register is 0 based!) - GLuint nMemExports; - GLuint resource; // VS and PS _RESOURCE - GLuint exportMode; // VS and PS _EXPORT_MODE - - GLboolean depthIsImported; - - // Vertex program exports - GLboolean positionVectorIsExported; - - GLboolean miscVectorIsExported; - GLboolean renderTargetArrayIndexIsExported; - - GLboolean ccDist0VectorIsExported; - GLboolean ccDist1VectorIsExported; - - // Pixel program exports - GLboolean depthIsExported; - GLboolean stencilRefIsExported; - GLboolean coverageToMaskIsExported; - GLboolean maskIsExported; - - GLboolean killIsUsed; - - GLuint uStartAddr; - GLuint uCFOffset; - GLuint uEndOfCF; - GLuint uEndOfALU; - GLuint uEndOfFetch; - GLuint uStackSize; - GLuint uMaxCallDepth; - - TypedShaderList * plstCFInstructions_active; - TypedShaderList lstCFInstructions; - TypedShaderList lstALUInstructions; - TypedShaderList lstTEXInstructions; - TypedShaderList lstVTXInstructions; - - RealRegister RegStartAddr; - RealRegister RegCFOffset; - RealRegister RegEndCF; - RealRegister RegEndALU; - RealRegister egEndFetcg; - - // -------- constants - GLfloat ConstantArray[SQ_ALU_CONSTANT_PS_COUNT * 4]; - - GLboolean bSurfAllocated; -} R700_Shader; - -//Internal -void AddInstToList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst); -void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst); -void ResolveLinks(R700_Shader *pShader); -void Assemble(R700_Shader *pShader); - -//Interface -void Init_R700_Shader(R700_Shader * pShader); -void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst); -void AddVTXInstruction(R700_Shader *pShader, R700VertexInstruction *pVTXInst); -void AddTEXInstruction(R700_Shader *pShader, R700TextureInstruction *pTEXInst); -void AddALUInstruction(R700_Shader *pShader, R700ALUInstruction *pALUInst); -void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF); - -void LoadProgram(R700_Shader *pShader); -void UpdateShaderRegisters(R700_Shader *pShader); -void DeleteInstructions(R700_Shader *pShader); -void DebugPrint(void); -void cleanup_vfetch_shaderinst(R700_Shader *pShader); - -void Clean_Up_Shader(R700_Shader *pShader); - -#endif /*__R700_SHADER_H__*/ - diff --git a/src/mesa/drivers/dri/r600/r700_shaderinst.c b/src/mesa/drivers/dri/r600/r700_shaderinst.c deleted file mode 100644 index f120d9f941f..00000000000 --- a/src/mesa/drivers/dri/r600/r700_shaderinst.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#include "main/mtypes.h" - -#include "radeon_debug.h" -#include "r700_shaderinst.h" - -void Init_R700ControlFlowGenericClause(R700ControlFlowGenericClause* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - - pInst->m_pLinkedVTXInstruction = 0; - pInst->m_pLinkedTEXInstruction = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_CF_GENERIC; -} - -void Init_R700ControlFlowALUClause(R700ControlFlowALUClause* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - - pInst->m_pLinkedALUInstruction = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_CF_ALU; -} - -void Init_R700ControlFlowSXClause(R700ControlFlowSXClause* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_SWIZ.val = 0x00000000; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_CF_ALL_EXP_SX; -} - -void Init_R700ControlFlowSMXClause(R700ControlFlowSMXClause* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_BUF.val = 0x00000000; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_CF_ALL_EXP_SMX; -} - -void Init_R700ALUInstruction(R700ALUInstruction* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_OP2.val = 0x00000000; - pInst->m_Word1_OP3.val = 0x00000000; - - pInst->m_pLinkedALUClause = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_ALU; -} - -void Init_R700ALUInstructionHalfLiteral(R700ALUInstructionHalfLiteral* pInst, GLfloat x, GLfloat y) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_OP2.val = 0x00000000; - pInst->m_Word1_OP3.val = 0x00000000; - - pInst->m_pLinkedALUClause = 0; - - pInst->m_fLiteralX = x; - pInst->m_fLiteralY = y; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_ALU_HALF_LIT; -} - -void Init_R700ALUInstructionFullLiteral(R700ALUInstructionFullLiteral* pInst, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_OP2.val = 0x00000000; - pInst->m_Word1_OP3.val = 0x00000000; - - pInst->m_pLinkedALUClause = 0; - - pInst->m_fLiteralX = x; - pInst->m_fLiteralY = y; - pInst->m_fLiteralZ = z; - pInst->m_fLiteralW = w; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_ALU_FALL_LIT; -} - -void Init_R700TextureInstruction(R700TextureInstruction* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word2.val = 0x00000000; - - pInst->m_pLinkedGenericClause = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_TEX; -} - -void Init_R700VertexSemanticFetch(R700VertexSemanticFetch* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_SEM.val = 0x00000000; - pInst->m_Word2.val = 0x00000000; - - pInst->m_pLinkedGenericClause = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_VTX_SEM; -} - -void Init_R700VertexGenericFetch(R700VertexGenericFetch* pInst) -{ - pInst->m_Word0.val = 0x00000000; - pInst->m_Word1.val = 0x00000000; - pInst->m_Word1_GPR.val = 0x00000000; - pInst->m_Word2.val = 0x00000000; - - pInst->m_pLinkedGenericClause = 0; - - pInst->useCount = 0; - - pInst->m_ShaderInstType = SIT_VTX_GENERIC; -} - -unsigned int GetInstructionSize(ShaderInstType instType) -{ - switch(instType) - { - case SIT_ALU_HALF_LIT: - case SIT_TEX: - case SIT_VTX: - case SIT_VTX_GENERIC: - case SIT_VTX_SEM: - return 4; - case SIT_ALU_FALL_LIT: - return 6; - default: - break; - } - - return 2; -} - -unsigned int GetCFMaxInstructions(ShaderInstType instType) -{ - switch (instType) - { - case SIT_CF_ALL_EXP: - case SIT_CF_ALL_EXP_SX: - case SIT_CF_ALL_EXP_SMX: - return 0x10; - case SIT_CF_GENERIC: - return 0x8; //For tex and vtx - case SIT_CF_ALU: - return 0x80; - default: - break; - } - return 0x10; -} - -GLboolean LinkVertexInstruction(R700ControlFlowGenericClause *pCFGeneric, - R700VertexInstruction *pVTXInstruction) -{ - if (pCFGeneric->m_pLinkedTEXInstruction != 0) - { - radeon_error("This instruction is already linked to a texture instruction.\n"); - return GL_FALSE; - } - - pCFGeneric->m_pLinkedVTXInstruction = pVTXInstruction; - pVTXInstruction->m_pLinkedGenericClause = pCFGeneric; - - return GL_TRUE; -} - - - diff --git a/src/mesa/drivers/dri/r600/r700_shaderinst.h b/src/mesa/drivers/dri/r600/r700_shaderinst.h deleted file mode 100644 index cdb9a570f7c..00000000000 --- a/src/mesa/drivers/dri/r600/r700_shaderinst.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#ifndef _R700_SHADERINST_H_ -#define _R700_SHADERINST_H_ - -#include "main/glheader.h" - -#include "defaultendian.h" -#include "sq_micro_reg.h" - -#define SQ_ALU_CONSTANT_PS_OFFSET 0x00000000 -#define SQ_ALU_CONSTANT_PS_COUNT 0x00000100 -#define SQ_ALU_CONSTANT_VS_OFFSET 0x00000100 -#define SQ_ALU_CONSTANT_VS_COUNT 0x00000100 -#define SQ_FETCH_RESOURCE_PS_OFFSET 0x00000000 -#define SQ_FETCH_RESOURCE_PS_COUNT 0x000000a0 -#define SQ_FETCH_RESOURCE_VS_OFFSET 0x000000a0 -#define SQ_FETCH_RESOURCE_VS_COUNT 0x000000b0 - -//richard dec.10 glsl -#define SQ_TEX_SAMPLER_PS_OFFSET 0x00000000 -#define SQ_TEX_SAMPLER_PS_COUNT 0x00000012 -#define SQ_TEX_SAMPLER_VS_OFFSET 0x00000012 -#define SQ_TEX_SAMPLER_VS_COUNT 0x00000012 -//------------------- - -#define SHADERINST_TYPEMASK_CF 0x10 -#define SHADERINST_TYPEMASK_ALU 0x20 -#define SHADERINST_TYPEMASK_TEX 0x40 -#define SHADERINST_TYPEMASK_VTX 0x80 - -typedef enum ShaderInstType -{ - SIT_CF = 0x10, /*SIZE = 0x2*/ - SIT_CF_ALL_EXP = 0x14, /*SIZE = 0x2, MAX_INSTRUCTIONS = 0x10;*/ - SIT_CF_ALL_EXP_SX = 0x15, /*SIZE = 0x2, MAX_INSTRUCTIONS = 0x10;*/ - SIT_CF_ALL_EXP_SMX= 0x16, /*SIZE = 0x2, MAX_INSTRUCTIONS = 0x10;*/ - SIT_CF_GENERIC = 0x18, /*SIZE = 0x2, MAX_INSTRUCTIONS = 0x8; //For tex and vtx*/ - SIT_CF_ALU = 0x19, /*SIZE = 0x2, MAX_INSTRUCTIONS = 0x80;*/ - SIT_ALU = 0x20, /*SIZE = 0x2,*/ - SIT_ALU_HALF_LIT = 0x21, /*SIZE = 0x4,*/ - SIT_ALU_FALL_LIT = 0x22, /*SIZE = 0x6,*/ - SIT_TEX = 0x40, /*SIZE = 0x4,*/ - SIT_VTX = 0x80, /*SIZE = 0x4, MEGA_FETCH_BYTES = 0x20*/ - SIT_VTX_GENERIC = 0x81, /*SIZE = 0x4, MEGA_FETCH_BYTES = 0x20*/ - SIT_VTX_SEM = 0x82 /*SIZE = 0x4, MEGA_FETCH_BYTES = 0x20*/ -} ShaderInstType; - -typedef struct R700ShaderInstruction -{ - ShaderInstType m_ShaderInstType; - struct R700ShaderInstruction *pNextInst; - GLuint m_uIndex; - GLuint useCount; -} R700ShaderInstruction; - -// ------------------ CF insts --------------------------- - -typedef R700ShaderInstruction R700ControlFlowInstruction; - -typedef struct R700ControlFlowAllocExportClause -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - GLuint m_uIndex; - GLuint useCount; - - sq_cf_alloc_export_word0_u m_Word0; - sq_cf_alloc_export_word1_u m_Word1; -} R700ControlFlowAllocExportClause; - -typedef struct R700ControlFlowSXClause -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ControlFlowAllocExportClause - //R700ControlFlowInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - //--------------------------- - sq_cf_alloc_export_word0_u m_Word0; - sq_cf_alloc_export_word1_u m_Word1; - //------------------------------------- - - sq_cf_alloc_export_word1_swiz_u m_Word1_SWIZ; -} R700ControlFlowSXClause; - -typedef struct R700ControlFlowSMXClause -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ControlFlowAllocExportClause - //R700ControlFlowInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - //--------------------------- - sq_cf_alloc_export_word0_u m_Word0; - sq_cf_alloc_export_word1_u m_Word1; - //------------------------------- - - sq_cf_alloc_export_word1_buf_u m_Word1_BUF; -} R700ControlFlowSMXClause; - -typedef struct R700ControlFlowGenericClause -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ControlFlowInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - //--------------------- - - sq_cf_word0_u m_Word0; - sq_cf_word1_u m_Word1; - - struct R700VertexInstruction *m_pLinkedVTXInstruction; - struct R700TextureInstruction *m_pLinkedTEXInstruction; -} R700ControlFlowGenericClause; - -typedef struct R700ControlFlowALUClause -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ControlFlowInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - //--------------------- - - sq_cf_alu_word0_u m_Word0; - sq_cf_alu_word1_u m_Word1; - - struct R700ALUInstruction *m_pLinkedALUInstruction; -} R700ControlFlowALUClause; - -// ------------------- End of CF Inst ------------------------ - -// ------------------- ALU Inst ------------------------------ -typedef struct R700ALUInstruction -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_alu_word0_u m_Word0; - sq_alu_word1_u m_Word1; - sq_alu_word1_op2_v2_u m_Word1_OP2; - sq_alu_word1_op3_u m_Word1_OP3; - - struct R700ControlFlowALUClause *m_pLinkedALUClause; -} R700ALUInstruction; - -typedef struct R700ALUInstructionHalfLiteral -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ALUInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_alu_word0_u m_Word0; - sq_alu_word1_u m_Word1; - sq_alu_word1_op2_v2_u m_Word1_OP2; - sq_alu_word1_op3_u m_Word1_OP3; - - struct R700ControlFlowALUClause *m_pLinkedALUClause; - //------------------- - - GLfloat m_fLiteralX, - m_fLiteralY; -} R700ALUInstructionHalfLiteral; - -typedef struct R700ALUInstructionFullLiteral -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ALUInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_alu_word0_u m_Word0; - sq_alu_word1_u m_Word1; - sq_alu_word1_op2_v2_u m_Word1_OP2; - sq_alu_word1_op3_u m_Word1_OP3; - - struct R700ControlFlowALUClause *m_pLinkedALUClause; - //------------------- - - GLfloat m_fLiteralX, - m_fLiteralY, - m_fLiteralZ, - m_fLiteralW; -} R700ALUInstructionFullLiteral; -// ------------------- End of ALU Inst ----------------------- - -// ------------------- Textuer/Vertex Instruction -------------------- - -typedef struct R700TextureInstruction -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_tex_word0_u m_Word0; - sq_tex_word1_u m_Word1; - sq_tex_word2_u m_Word2; - - struct R700ControlFlowGenericClause *m_pLinkedGenericClause; -} R700TextureInstruction; - -typedef struct R700VertexInstruction -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_vtx_word0_u m_Word0; - sq_vtx_word1_u m_Word1; - sq_vtx_word2_u m_Word2; - - struct R700ControlFlowGenericClause *m_pLinkedGenericClause; -} R700VertexInstruction; -// -typedef struct R700VertexSemanticFetch -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700VertexInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_vtx_word0_u m_Word0; - sq_vtx_word1_u m_Word1; - sq_vtx_word2_u m_Word2; - - struct R700ControlFlowGenericClause *m_pLinkedGenericClause; - //--------------------------- - - sq_vtx_word1_sem_u m_Word1_SEM; -} R700VertexSemanticFetch; -// -typedef struct R700VertexGenericFetch -{ - ShaderInstType m_ShaderInstType; - R700ShaderInstruction * pNextInst; - //R700VertexInstruction - //R700ShaderInstruction - GLuint m_uIndex; - GLuint useCount; - //--------------------- - - sq_vtx_word0_u m_Word0; - sq_vtx_word1_u m_Word1; - sq_vtx_word2_u m_Word2; - - struct R700ControlFlowGenericClause *m_pLinkedGenericClause; - //--------------------------- - - sq_vtx_word1_gpr_u m_Word1_GPR; -} R700VertexGenericFetch; - -// ------------------- End of Texture Vertex Instruction -------------------- - -void Init_R700ControlFlowGenericClause(R700ControlFlowGenericClause* pInst); -void Init_R700ControlFlowALUClause(R700ControlFlowALUClause* pInst); -void Init_R700ControlFlowSXClause(R700ControlFlowSXClause* pInst); -void Init_R700ControlFlowSMXClause(R700ControlFlowSMXClause* pInst); -void Init_R700ALUInstruction(R700ALUInstruction* pInst); -void Init_R700ALUInstructionHalfLiteral(R700ALUInstructionHalfLiteral* pInst, GLfloat x, GLfloat y); -void Init_R700ALUInstructionFullLiteral(R700ALUInstructionFullLiteral* pInst, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -void Init_R700TextureInstruction(R700TextureInstruction* pInst); -void Init_R700VertexSemanticFetch(R700VertexSemanticFetch* pInst); -void Init_R700VertexGenericFetch(R700VertexGenericFetch* pInst); - -unsigned int GetInstructionSize(ShaderInstType instType); -unsigned int GetCFMaxInstructions(ShaderInstType instType); - -GLboolean LinkVertexInstruction(R700ControlFlowGenericClause *pCFGeneric, - R700VertexInstruction *pVTXInstruction); - -#endif //_R700_SHADERINST_H_ diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c deleted file mode 100644 index 99c03dff83e..00000000000 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ /dev/null @@ -1,1883 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/imports.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/dd.h" -#include "main/simple_list.h" -#include "main/state.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "main/api_arrayelt.h" -#include "main/framebuffer.h" -#include "drivers/common/meta.h" - -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" -#include "vbo/vbo.h" - -#include "r600_context.h" - -#include "r700_state.h" - -#include "r700_fragprog.h" -#include "r700_vertprog.h" - -void r600UpdateTextureState(struct gl_context * ctx); -static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state); -static void r700UpdatePolygonMode(struct gl_context * ctx); -static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state); -static void r700SetStencilState(struct gl_context * ctx, GLboolean state); -static void r700UpdateWindow(struct gl_context * ctx, int id); - -void r700UpdateShaders(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - - /* should only happenen once, just after context is created */ - /* TODO: shouldn't we fallback to sw here? */ - if (!ctx->FragmentProgram._Current) { - fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; - } - - r700SelectFragmentShader(ctx); - - r700SelectVertexShader(ctx); - r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - context->radeon.NewGLState = 0; -} - -/* - * To correctly position primitives: - */ -void r700UpdateViewportOffset(struct gl_context * ctx) //------------------ -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); - GLfloat xoffset = (GLfloat) dPriv->x; - GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - int id = 0; - - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat ty = (-v[MAT_TY]) + yoffset; - - if (r700->viewport[id].PA_CL_VPORT_XOFFSET.f32All != tx || - r700->viewport[id].PA_CL_VPORT_YOFFSET.f32All != ty) { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - R600_STATECHANGE(context, vpt); - r700->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; - r700->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; - } - - radeonUpdateScissor(ctx); -} - -void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state) //-------------------- -{ - struct r700_fragment_program *fp = - (struct r700_fragment_program *)ctx->FragmentProgram._Current; - struct gl_program_parameter_list *paramList; - - if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) - return; - - if (!ctx->FragmentProgram._Current || !fp) - return; - - paramList = ctx->FragmentProgram._Current->Base.Parameters; - - if (!paramList) - return; - - _mesa_load_state_parameters(ctx, paramList); - -} - -/** - * Called by Mesa after an internal state update. - */ -static void r700InvalidateState(struct gl_context * ctx, GLuint new_state) //------------------- -{ - context_t *context = R700_CONTEXT(ctx); - - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - _swrast_InvalidateState(ctx, new_state); - _swsetup_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); - _tnl_InvalidateState(ctx, new_state); - _ae_invalidate_state(ctx, new_state); - - if (new_state & _NEW_BUFFERS) { - _mesa_update_framebuffer(ctx); - /* this updates the DrawBuffer's Width/Height if it's a FBO */ - _mesa_update_draw_buffer_bounds(ctx); - - R600_STATECHANGE(context, cb_target); - R600_STATECHANGE(context, db_target); - } - - if (new_state & (_NEW_LIGHT)) { - R600_STATECHANGE(context, su); - if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); - else - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); - } - - r700UpdateStateParameters(ctx, new_state); - - R600_STATECHANGE(context, cl); - R600_STATECHANGE(context, spi); - - if(GL_TRUE == r700->bEnablePerspective) - { - /* Do scale XY and Z by 1/W0 for perspective correction on pos. For orthogonal case, set both to one. */ - CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - - SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - } - else - { - /* For orthogonal case. */ - SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - - SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - } - - context->radeon.NewGLState |= new_state; -} - -static void r700SetDBRenderState(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - struct r700_fragment_program *fp = (struct r700_fragment_program *) - (ctx->FragmentProgram._Current); - - R600_STATECHANGE(context, db); - - SETbit(r700->DB_SHADER_CONTROL.u32All, DUAL_EXPORT_ENABLE_bit); - SETfield(r700->DB_SHADER_CONTROL.u32All, EARLY_Z_THEN_LATE_Z, Z_ORDER_shift, Z_ORDER_mask); - /* XXX need to enable htile for hiz/s */ - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); - - if (context->radeon.query.current) - { - SETbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - { - SETbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); - } - } - else - { - CLEARbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - { - CLEARbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); - } - } - - if (fp) - { - if (fp->r700Shader.killIsUsed) - { - SETbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - else - { - CLEARbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - - if (fp->r700Shader.depthIsExported) - { - SETbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - else - { - CLEARbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - } -} - -void r700UpdateShaderStates(struct gl_context * ctx) -{ - r700SetDBRenderState(ctx); - r600UpdateTextureState(ctx); -} - -static void r700SetDepthState(struct gl_context * ctx) -{ - struct radeon_renderbuffer *rrb; - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, db); - - rrb = radeon_get_depthbuffer(&context->radeon); - - if (ctx->Depth.Test && rrb && rrb->bo) - { - SETbit(r700->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); - if (ctx->Depth.Mask) - { - SETbit(r700->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } - else - { - CLEARbit(r700->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } - - switch (ctx->Depth.Func) - { - case GL_NEVER: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_NEVER, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_LESS: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_LESS, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_EQUAL: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_EQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_LEQUAL: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_LEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_GREATER: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_GREATER, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_NOTEQUAL: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_NOTEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_GEQUAL: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_GEQUAL, - ZFUNC_shift, ZFUNC_mask); - break; - case GL_ALWAYS: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, - ZFUNC_shift, ZFUNC_mask); - break; - default: - SETfield(r700->DB_DEPTH_CONTROL.u32All, FRAG_ALWAYS, - ZFUNC_shift, ZFUNC_mask); - break; - } - } - else - { - CLEARbit(r700->DB_DEPTH_CONTROL.u32All, Z_ENABLE_bit); - CLEARbit(r700->DB_DEPTH_CONTROL.u32All, Z_WRITE_ENABLE_bit); - } -} - -static void r700SetAlphaState(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - uint32_t alpha_func = REF_ALWAYS; - GLboolean really_enabled = ctx->Color.AlphaEnabled; - - R600_STATECHANGE(context, sx); - - switch (ctx->Color.AlphaFunc) { - case GL_NEVER: - alpha_func = REF_NEVER; - break; - case GL_LESS: - alpha_func = REF_LESS; - break; - case GL_EQUAL: - alpha_func = REF_EQUAL; - break; - case GL_LEQUAL: - alpha_func = REF_LEQUAL; - break; - case GL_GREATER: - alpha_func = REF_GREATER; - break; - case GL_NOTEQUAL: - alpha_func = REF_NOTEQUAL; - break; - case GL_GEQUAL: - alpha_func = REF_GEQUAL; - break; - case GL_ALWAYS: - /*alpha_func = REF_ALWAYS; */ - really_enabled = GL_FALSE; - break; - } - - if (really_enabled) { - SETfield(r700->SX_ALPHA_TEST_CONTROL.u32All, alpha_func, - ALPHA_FUNC_shift, ALPHA_FUNC_mask); - SETbit(r700->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); - r700->SX_ALPHA_REF.f32All = ctx->Color.AlphaRef; - } else { - CLEARbit(r700->SX_ALPHA_TEST_CONTROL.u32All, ALPHA_TEST_ENABLE_bit); - } - -} - -static void r700AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //--------------- -{ - (void)func; - (void)ref; - r700SetAlphaState(ctx); -} - - -static void r700BlendColor(struct gl_context * ctx, const GLfloat cf[4]) //---------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, blnd_clr); - - r700->CB_BLEND_RED.f32All = cf[0]; - r700->CB_BLEND_GREEN.f32All = cf[1]; - r700->CB_BLEND_BLUE.f32All = cf[2]; - r700->CB_BLEND_ALPHA.f32All = cf[3]; -} - -static int blend_factor(GLenum factor, GLboolean is_src) -{ - switch (factor) { - case GL_ZERO: - return BLEND_ZERO; - break; - case GL_ONE: - return BLEND_ONE; - break; - case GL_DST_COLOR: - return BLEND_DST_COLOR; - break; - case GL_ONE_MINUS_DST_COLOR: - return BLEND_ONE_MINUS_DST_COLOR; - break; - case GL_SRC_COLOR: - return BLEND_SRC_COLOR; - break; - case GL_ONE_MINUS_SRC_COLOR: - return BLEND_ONE_MINUS_SRC_COLOR; - break; - case GL_SRC_ALPHA: - return BLEND_SRC_ALPHA; - break; - case GL_ONE_MINUS_SRC_ALPHA: - return BLEND_ONE_MINUS_SRC_ALPHA; - break; - case GL_DST_ALPHA: - return BLEND_DST_ALPHA; - break; - case GL_ONE_MINUS_DST_ALPHA: - return BLEND_ONE_MINUS_DST_ALPHA; - break; - case GL_SRC_ALPHA_SATURATE: - return (is_src) ? BLEND_SRC_ALPHA_SATURATE : BLEND_ZERO; - break; - case GL_CONSTANT_COLOR: - return BLEND_CONSTANT_COLOR; - break; - case GL_ONE_MINUS_CONSTANT_COLOR: - return BLEND_ONE_MINUS_CONSTANT_COLOR; - break; - case GL_CONSTANT_ALPHA: - return BLEND_CONSTANT_ALPHA; - break; - case GL_ONE_MINUS_CONSTANT_ALPHA: - return BLEND_ONE_MINUS_CONSTANT_ALPHA; - break; - default: - fprintf(stderr, "unknown blend factor %x\n", factor); - return (is_src) ? BLEND_ONE : BLEND_ZERO; - break; - } -} - -static void r700SetBlendState(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int id = 0; - uint32_t blend_reg = 0, eqn, eqnA; - - R600_STATECHANGE(context, blnd); - - if (ctx->Color.ColorLogicOpEnabled || !ctx->Color.BlendEnabled) { - SETfield(blend_reg, - BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ZERO, COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - SETfield(blend_reg, - COMB_DST_PLUS_SRC, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); - SETfield(blend_reg, - BLEND_ONE, ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ZERO, ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - SETfield(blend_reg, - COMB_DST_PLUS_SRC, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); - if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_R600) - r700->CB_BLEND_CONTROL.u32All = blend_reg; - else - r700->render_target[id].CB_BLEND0_CONTROL.u32All = blend_reg; - return; - } - - SETfield(blend_reg, - blend_factor(ctx->Color.Blend[0].SrcRGB, GL_TRUE), - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - blend_factor(ctx->Color.Blend[0].DstRGB, GL_FALSE), - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - - switch (ctx->Color.Blend[0].EquationRGB) { - case GL_FUNC_ADD: - eqn = COMB_DST_PLUS_SRC; - break; - case GL_FUNC_SUBTRACT: - eqn = COMB_SRC_MINUS_DST; - break; - case GL_FUNC_REVERSE_SUBTRACT: - eqn = COMB_DST_MINUS_SRC; - break; - case GL_MIN: - eqn = COMB_MIN_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - break; - case GL_MAX: - eqn = COMB_MAX_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - break; - - default: - fprintf(stderr, - "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); - return; - } - SETfield(blend_reg, - eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); - - SETfield(blend_reg, - blend_factor(ctx->Color.Blend[0].SrcA, GL_TRUE), - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - blend_factor(ctx->Color.Blend[0].DstA, GL_FALSE), - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - - switch (ctx->Color.Blend[0].EquationA) { - case GL_FUNC_ADD: - eqnA = COMB_DST_PLUS_SRC; - break; - case GL_FUNC_SUBTRACT: - eqnA = COMB_SRC_MINUS_DST; - break; - case GL_FUNC_REVERSE_SUBTRACT: - eqnA = COMB_DST_MINUS_SRC; - break; - case GL_MIN: - eqnA = COMB_MIN_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - break; - case GL_MAX: - eqnA = COMB_MAX_DST_SRC; - SETfield(blend_reg, - BLEND_ONE, - ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); - SETfield(blend_reg, - BLEND_ONE, - ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - break; - default: - fprintf(stderr, - "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); - return; - } - - SETfield(blend_reg, - eqnA, ALPHA_COMB_FCN_shift, ALPHA_COMB_FCN_mask); - - SETbit(blend_reg, SEPARATE_ALPHA_BLEND_bit); - - if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_R600) - r700->CB_BLEND_CONTROL.u32All = blend_reg; - else { - r700->render_target[id].CB_BLEND0_CONTROL.u32All = blend_reg; - SETbit(r700->CB_COLOR_CONTROL.u32All, PER_MRT_BLEND_bit); - } - SETfield(r700->CB_COLOR_CONTROL.u32All, (1 << id), - TARGET_BLEND_ENABLE_shift, TARGET_BLEND_ENABLE_mask); - -} - -static void r700BlendEquationSeparate(struct gl_context * ctx, - GLenum modeRGB, GLenum modeA) //----------------- -{ - r700SetBlendState(ctx); -} - -static void r700BlendFuncSeparate(struct gl_context * ctx, - GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA) //------------------------ -{ - r700SetBlendState(ctx); -} - -/** - * Translate LogicOp enums into hardware representation. - */ -static GLuint translate_logicop(GLenum logicop) -{ - switch (logicop) { - case GL_CLEAR: - return 0x00; - case GL_SET: - return 0xff; - case GL_COPY: - return 0xcc; - case GL_COPY_INVERTED: - return 0x33; - case GL_NOOP: - return 0xaa; - case GL_INVERT: - return 0x55; - case GL_AND: - return 0x88; - case GL_NAND: - return 0x77; - case GL_OR: - return 0xee; - case GL_NOR: - return 0x11; - case GL_XOR: - return 0x66; - case GL_EQUIV: - return 0x99; - case GL_AND_REVERSE: - return 0x44; - case GL_AND_INVERTED: - return 0x22; - case GL_OR_REVERSE: - return 0xdd; - case GL_OR_INVERTED: - return 0xbb; - default: - fprintf(stderr, "unknown blend logic operation %x\n", logicop); - return 0xcc; - } -} - -/** - * Used internally to update the r300->hw hardware state to match the - * current OpenGL state. - */ -static void r700SetLogicOpState(struct gl_context *ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); - - R600_STATECHANGE(context, blnd); - - if (ctx->Color.ColorLogicOpEnabled) - SETfield(r700->CB_COLOR_CONTROL.u32All, - translate_logicop(ctx->Color.LogicOp), ROP3_shift, ROP3_mask); - else - SETfield(r700->CB_COLOR_CONTROL.u32All, 0xCC, ROP3_shift, ROP3_mask); -} - -/** - * Called by Mesa when an application program changes the LogicOp state - * via glLogicOp. - */ -static void r700LogicOpcode(struct gl_context *ctx, GLenum logicop) -{ - if (ctx->Color.ColorLogicOpEnabled) - r700SetLogicOpState(ctx); -} - -static void r700UpdateCulling(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); - - R600_STATECHANGE(context, su); - - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - - if (ctx->Polygon.CullFlag) - { - switch (ctx->Polygon.CullFaceMode) - { - case GL_FRONT: - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - case GL_BACK: - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - case GL_FRONT_AND_BACK: - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - default: - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_BACK_bit); - break; - } - } - - switch (ctx->Polygon.FrontFace) - { - case GL_CW: - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - break; - case GL_CCW: - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); - break; - default: - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */ - break; - } - - /* Winding is inverted when rendering to FBO */ - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) - r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; -} - -static void r700UpdateLineStipple(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); - - R600_STATECHANGE(context, sc); - - if (ctx->Line.StippleFlag) - { - SETbit(r700->PA_SC_MODE_CNTL.u32All, LINE_STIPPLE_ENABLE_bit); - } - else - { - CLEARbit(r700->PA_SC_MODE_CNTL.u32All, LINE_STIPPLE_ENABLE_bit); - } -} - -static void r700Enable(struct gl_context * ctx, GLenum cap, GLboolean state) //------------------ -{ - context_t *context = R700_CONTEXT(ctx); - - switch (cap) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - /* empty */ - break; - case GL_FOG: - /* empty */ - break; - case GL_ALPHA_TEST: - r700SetAlphaState(ctx); - break; - case GL_COLOR_LOGIC_OP: - r700SetLogicOpState(ctx); - /* fall-through, because logic op overrides blending */ - case GL_BLEND: - r700SetBlendState(ctx); - break; - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - r700SetClipPlaneState(ctx, cap, state); - break; - case GL_DEPTH_TEST: - r700SetDepthState(ctx); - break; - case GL_STENCIL_TEST: - r700SetStencilState(ctx, state); - break; - case GL_CULL_FACE: - r700UpdateCulling(ctx); - break; - case GL_POLYGON_OFFSET_POINT: - case GL_POLYGON_OFFSET_LINE: - case GL_POLYGON_OFFSET_FILL: - r700SetPolygonOffsetState(ctx, state); - break; - case GL_SCISSOR_TEST: - radeon_firevertices(&context->radeon); - context->radeon.state.scissor.enabled = state; - radeonUpdateScissor(ctx); - break; - case GL_LINE_STIPPLE: - r700UpdateLineStipple(ctx); - break; - case GL_DEPTH_CLAMP: - r700UpdateWindow(ctx, 0); - break; - default: - break; - } - -} - -/** - * Handle glColorMask() - */ -static void r700ColorMask(struct gl_context * ctx, - GLboolean r, GLboolean g, GLboolean b, GLboolean a) //------------------ -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); - unsigned int mask = ((r ? 1 : 0) | - (g ? 2 : 0) | - (b ? 4 : 0) | - (a ? 8 : 0)); - - if (mask != r700->CB_TARGET_MASK.u32All) { - R600_STATECHANGE(context, cb); - SETfield(r700->CB_TARGET_MASK.u32All, mask, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); - } -} - -/** - * Change the depth testing function. - * - * \note Mesa already filters redundant calls to this function. - */ -static void r700DepthFunc(struct gl_context * ctx, GLenum func) //-------------------- -{ - r700SetDepthState(ctx); -} - -/** - * Enable/Disable depth writing. - * - * \note Mesa already filters redundant calls to this function. - */ -static void r700DepthMask(struct gl_context * ctx, GLboolean mask) //------------------ -{ - r700SetDepthState(ctx); -} - -/** - * Change the culling mode. - * - * \note Mesa already filters redundant calls to this function. - */ -static void r700CullFace(struct gl_context * ctx, GLenum mode) //----------------- -{ - r700UpdateCulling(ctx); -} - -/* ============================================================= - * Fog - */ -static void r700Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //-------------- -{ -} - -/** - * Change the polygon orientation. - * - * \note Mesa already filters redundant calls to this function. - */ -static void r700FrontFace(struct gl_context * ctx, GLenum mode) //------------------ -{ - r700UpdateCulling(ctx); - r700UpdatePolygonMode(ctx); -} - -static void r700ShadeModel(struct gl_context * ctx, GLenum mode) //-------------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, spi); - - /* also need to set/clear FLAT_SHADE bit per param in SPI_PS_INPUT_CNTL_[0-31] */ - switch (mode) { - case GL_FLAT: - SETbit(r700->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); - break; - case GL_SMOOTH: - CLEARbit(r700->SPI_INTERP_CONTROL_0.u32All, FLAT_SHADE_ENA_bit); - break; - default: - return; - } -} - -/* ============================================================= - * Point state - */ -static void r700PointSize(struct gl_context * ctx, GLfloat size) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, su); - - /* We need to clamp to user defined range here, because - * the HW clamping happens only for per vertex point size. */ - size = CLAMP(size, ctx->Point.MinSize, ctx->Point.MaxSize); - - /* same size limits for AA, non-AA points */ - size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); - - /* format is 12.4 fixed point */ - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), - PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), - PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); - -} - -static void r700PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //--------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, su); - - /* format is 12.4 fixed point */ - switch (pname) { - case GL_POINT_SIZE_MIN: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0), - MIN_SIZE_shift, MIN_SIZE_mask); - r700PointSize(ctx, ctx->Point.Size); - break; - case GL_POINT_SIZE_MAX: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0), - MAX_SIZE_shift, MAX_SIZE_mask); - r700PointSize(ctx, ctx->Point.Size); - break; - case GL_POINT_DISTANCE_ATTENUATION: - break; - case GL_POINT_FADE_THRESHOLD_SIZE: - break; - default: - break; - } -} - -static int translate_stencil_func(int func) -{ - switch (func) { - case GL_NEVER: - return REF_NEVER; - case GL_LESS: - return REF_LESS; - case GL_EQUAL: - return REF_EQUAL; - case GL_LEQUAL: - return REF_LEQUAL; - case GL_GREATER: - return REF_GREATER; - case GL_NOTEQUAL: - return REF_NOTEQUAL; - case GL_GEQUAL: - return REF_GEQUAL; - case GL_ALWAYS: - return REF_ALWAYS; - } - return 0; -} - -static int translate_stencil_op(int op) -{ - switch (op) { - case GL_KEEP: - return STENCIL_KEEP; - case GL_ZERO: - return STENCIL_ZERO; - case GL_REPLACE: - return STENCIL_REPLACE; - case GL_INCR: - return STENCIL_INCR_CLAMP; - case GL_DECR: - return STENCIL_DECR_CLAMP; - case GL_INCR_WRAP_EXT: - return STENCIL_INCR_WRAP; - case GL_DECR_WRAP_EXT: - return STENCIL_DECR_WRAP; - case GL_INVERT: - return STENCIL_INVERT; - default: - WARN_ONCE("Do not know how to translate stencil op"); - return STENCIL_KEEP; - } - return 0; -} - -static void r700SetStencilState(struct gl_context * ctx, GLboolean state) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - GLboolean hw_stencil = GL_FALSE; - - if (ctx->DrawBuffer) { - struct radeon_renderbuffer *rrbStencil - = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (rrbStencil && rrbStencil->bo); - } - - if (hw_stencil) { - R600_STATECHANGE(context, db); - if (state) { - SETbit(r700->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - SETbit(r700->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); - } else - CLEARbit(r700->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - } -} - -static void r700StencilFuncSeparate(struct gl_context * ctx, GLenum face, - GLenum func, GLint ref, GLuint mask) //--------------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - const unsigned back = ctx->Stencil._BackFace; - - R600_STATECHANGE(context, stencil); - R600_STATECHANGE(context, db); - - //front - SETfield(r700->DB_STENCILREFMASK.u32All, ctx->Stencil.Ref[0], - STENCILREF_shift, STENCILREF_mask); - SETfield(r700->DB_STENCILREFMASK.u32All, ctx->Stencil.ValueMask[0], - STENCILMASK_shift, STENCILMASK_mask); - - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_func(ctx->Stencil.Function[0]), - STENCILFUNC_shift, STENCILFUNC_mask); - - //back - SETfield(r700->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.Ref[back], - STENCILREF_BF_shift, STENCILREF_BF_mask); - SETfield(r700->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.ValueMask[back], - STENCILMASK_BF_shift, STENCILMASK_BF_mask); - - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_func(ctx->Stencil.Function[back]), - STENCILFUNC_BF_shift, STENCILFUNC_BF_mask); - -} - -static void r700StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //-------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - const unsigned back = ctx->Stencil._BackFace; - - R600_STATECHANGE(context, stencil); - - // front - SETfield(r700->DB_STENCILREFMASK.u32All, ctx->Stencil.WriteMask[0], - STENCILWRITEMASK_shift, STENCILWRITEMASK_mask); - - // back - SETfield(r700->DB_STENCILREFMASK_BF.u32All, ctx->Stencil.WriteMask[back], - STENCILWRITEMASK_BF_shift, STENCILWRITEMASK_BF_mask); - -} - -static void r700StencilOpSeparate(struct gl_context * ctx, GLenum face, - GLenum fail, GLenum zfail, GLenum zpass) //-------------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - const unsigned back = ctx->Stencil._BackFace; - - R600_STATECHANGE(context, db); - - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.FailFunc[0]), - STENCILFAIL_shift, STENCILFAIL_mask); - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.ZFailFunc[0]), - STENCILZFAIL_shift, STENCILZFAIL_mask); - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.ZPassFunc[0]), - STENCILZPASS_shift, STENCILZPASS_mask); - - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.FailFunc[back]), - STENCILFAIL_BF_shift, STENCILFAIL_BF_mask); - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.ZFailFunc[back]), - STENCILZFAIL_BF_shift, STENCILZFAIL_BF_mask); - SETfield(r700->DB_DEPTH_CONTROL.u32All, translate_stencil_op(ctx->Stencil.ZPassFunc[back]), - STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); -} - -static void r700UpdateWindow(struct gl_context * ctx, int id) //-------------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - __DRIdrawable *dPriv = radeon_get_drawable(&context->radeon); - GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; - GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; - const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; - const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); - GLfloat y_scale, y_bias; - - if (render_to_fbo) { - y_scale = 1.0; - y_bias = 0; - } else { - y_scale = -1.0; - y_bias = yoffset; - } - - GLfloat sx = v[MAT_SX]; - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat sy = v[MAT_SY] * y_scale; - GLfloat ty = (v[MAT_TY] * y_scale) + y_bias; - GLfloat sz = v[MAT_SZ] * depthScale; - GLfloat tz = v[MAT_TZ] * depthScale; - - R600_STATECHANGE(context, vpt); - R600_STATECHANGE(context, cl); - - r700->viewport[id].PA_CL_VPORT_XSCALE.f32All = sx; - r700->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; - - r700->viewport[id].PA_CL_VPORT_YSCALE.f32All = sy; - r700->viewport[id].PA_CL_VPORT_YOFFSET.f32All = ty; - - r700->viewport[id].PA_CL_VPORT_ZSCALE.f32All = sz; - r700->viewport[id].PA_CL_VPORT_ZOFFSET.f32All = tz; - - if (ctx->Transform.DepthClamp) { - r700->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); - r700->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); - SETbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); - SETbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); - } else { - r700->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; - r700->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; - CLEARbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); - CLEARbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); - } - - r700->viewport[id].enabled = GL_TRUE; - - r700SetScissor(context); -} - - -static void r700Viewport(struct gl_context * ctx, - GLint x, - GLint y, - GLsizei width, - GLsizei height) //-------------------- -{ - r700UpdateWindow(ctx, 0); - - radeon_viewport(ctx, x, y, width, height); -} - -static void r700DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //------------- -{ - r700UpdateWindow(ctx, 0); -} - -static void r700LineWidth(struct gl_context * ctx, GLfloat widthf) //--------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - uint32_t lineWidth = (uint32_t)((widthf * 0.5) * (1 << 4)); - - R600_STATECHANGE(context, su); - - if (lineWidth > 0xFFFF) - lineWidth = 0xFFFF; - SETfield(r700->PA_SU_LINE_CNTL.u32All,(uint16_t)lineWidth, - PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); -} - -static void r700LineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, sc); - - SETfield(r700->PA_SC_LINE_STIPPLE.u32All, pattern, LINE_PATTERN_shift, LINE_PATTERN_mask); - SETfield(r700->PA_SC_LINE_STIPPLE.u32All, (factor-1), REPEAT_COUNT_shift, REPEAT_COUNT_mask); - SETfield(r700->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); -} - -static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, su); - - if (state) { - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); - } else { - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_FRONT_ENABLE_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_BACK_ENABLE_bit); - CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, POLY_OFFSET_PARA_ENABLE_bit); - } -} - -static void r700PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //-------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - GLfloat constant = units; - GLchar depth = 0; - - R600_STATECHANGE(context, poly); - - switch (ctx->Visual.depthBits) { - case 16: - constant *= 4.0; - depth = -16; - break; - case 24: - constant *= 2.0; - depth = -24; - break; - } - - factor *= 12.0; - SETfield(r700->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth, - POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask); - //r700->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //??? - r700->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor; - r700->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant; - r700->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor; - r700->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; -} - -static void r700UpdatePolygonMode(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - R600_STATECHANGE(context, su); - - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DISABLE_POLY_MODE, POLY_MODE_shift, POLY_MODE_mask); - - /* Only do something if a polygon mode is wanted, default is GL_FILL */ - if (ctx->Polygon.FrontMode != GL_FILL || - ctx->Polygon.BackMode != GL_FILL) { - GLenum f, b; - - /* Handle GL_CW (clock wise and GL_CCW (counter clock wise) - * correctly by selecting the correct front and back face - */ - f = ctx->Polygon.FrontMode; - b = ctx->Polygon.BackMode; - - /* Enable polygon mode */ - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DUAL_MODE, POLY_MODE_shift, POLY_MODE_mask); - - switch (f) { - case GL_LINE: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - case GL_POINT: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - case GL_FILL: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, - POLYMODE_FRONT_PTYPE_shift, POLYMODE_FRONT_PTYPE_mask); - break; - } - - switch (b) { - case GL_LINE: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_LINES, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - case GL_POINT: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_POINTS, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - case GL_FILL: - SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DRAW_TRIANGLES, - POLYMODE_BACK_PTYPE_shift, POLYMODE_BACK_PTYPE_mask); - break; - } - } -} - -static void r700PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //------------------ -{ - (void)face; - (void)mode; - - r700UpdatePolygonMode(ctx); -} - -static void r700RenderMode(struct gl_context * ctx, GLenum mode) //--------------------- -{ -} - -static void r700ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - GLint p; - GLint *ip; - - p = (GLint) plane - (GLint) GL_CLIP_PLANE0; - ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - - R600_STATECHANGE(context, ucp); - - r700->ucp[p].PA_CL_UCP_0_X.u32All = ip[0]; - r700->ucp[p].PA_CL_UCP_0_Y.u32All = ip[1]; - r700->ucp[p].PA_CL_UCP_0_Z.u32All = ip[2]; - r700->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; -} - -static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - GLuint p; - - p = cap - GL_CLIP_PLANE0; - - R600_STATECHANGE(context, cl); - - if (state) { - r700->PA_CL_CLIP_CNTL.u32All |= (UCP_ENA_0_bit << p); - r700->ucp[p].enabled = GL_TRUE; - r700ClipPlane(ctx, cap, NULL); - } else { - r700->PA_CL_CLIP_CNTL.u32All &= ~(UCP_ENA_0_bit << p); - r700->ucp[p].enabled = GL_FALSE; - } -} - -void r700SetScissor(context_t *context) //--------------- -{ - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - unsigned x1, y1, x2, y2; - int id = 0; - struct radeon_renderbuffer *rrb; - - rrb = radeon_get_colorbuffer(&context->radeon); - if (!rrb || !rrb->bo) { - return; - } - if (context->radeon.state.scissor.enabled) { - x1 = context->radeon.state.scissor.rect.x1; - y1 = context->radeon.state.scissor.rect.y1; - x2 = context->radeon.state.scissor.rect.x2; - y2 = context->radeon.state.scissor.rect.y2; - /* r600 has exclusive BR scissors */ - if (context->radeon.radeonScreen->kernel_mm) { - x2++; - y2++; - } - } else { - if (context->radeon.radeonScreen->driScreen->dri2.enabled) { - x1 = 0; - y1 = 0; - x2 = rrb->base.Width; - y2 = rrb->base.Height; - } else { - x1 = rrb->dPriv->x; - y1 = rrb->dPriv->y; - x2 = rrb->dPriv->x + rrb->dPriv->w; - y2 = rrb->dPriv->y + rrb->dPriv->h; - } - } - - R600_STATECHANGE(context, scissor); - - /* screen */ - SETbit(r700->PA_SC_SCREEN_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(r700->PA_SC_SCREEN_SCISSOR_TL.u32All, x1, - PA_SC_SCREEN_SCISSOR_TL__TL_X_shift, PA_SC_SCREEN_SCISSOR_TL__TL_X_mask); - SETfield(r700->PA_SC_SCREEN_SCISSOR_TL.u32All, y1, - PA_SC_SCREEN_SCISSOR_TL__TL_Y_shift, PA_SC_SCREEN_SCISSOR_TL__TL_Y_mask); - - SETfield(r700->PA_SC_SCREEN_SCISSOR_BR.u32All, x2, - PA_SC_SCREEN_SCISSOR_BR__BR_X_shift, PA_SC_SCREEN_SCISSOR_BR__BR_X_mask); - SETfield(r700->PA_SC_SCREEN_SCISSOR_BR.u32All, y2, - PA_SC_SCREEN_SCISSOR_BR__BR_Y_shift, PA_SC_SCREEN_SCISSOR_BR__BR_Y_mask); - - /* window */ - SETbit(r700->PA_SC_WINDOW_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(r700->PA_SC_WINDOW_SCISSOR_TL.u32All, x1, - PA_SC_WINDOW_SCISSOR_TL__TL_X_shift, PA_SC_WINDOW_SCISSOR_TL__TL_X_mask); - SETfield(r700->PA_SC_WINDOW_SCISSOR_TL.u32All, y1, - PA_SC_WINDOW_SCISSOR_TL__TL_Y_shift, PA_SC_WINDOW_SCISSOR_TL__TL_Y_mask); - - SETfield(r700->PA_SC_WINDOW_SCISSOR_BR.u32All, x2, - PA_SC_WINDOW_SCISSOR_BR__BR_X_shift, PA_SC_WINDOW_SCISSOR_BR__BR_X_mask); - SETfield(r700->PA_SC_WINDOW_SCISSOR_BR.u32All, y2, - PA_SC_WINDOW_SCISSOR_BR__BR_Y_shift, PA_SC_WINDOW_SCISSOR_BR__BR_Y_mask); - - - SETfield(r700->PA_SC_CLIPRECT_0_TL.u32All, x1, - PA_SC_CLIPRECT_0_TL__TL_X_shift, PA_SC_CLIPRECT_0_TL__TL_X_mask); - SETfield(r700->PA_SC_CLIPRECT_0_TL.u32All, y1, - PA_SC_CLIPRECT_0_TL__TL_Y_shift, PA_SC_CLIPRECT_0_TL__TL_Y_mask); - SETfield(r700->PA_SC_CLIPRECT_0_BR.u32All, x2, - PA_SC_CLIPRECT_0_BR__BR_X_shift, PA_SC_CLIPRECT_0_BR__BR_X_mask); - SETfield(r700->PA_SC_CLIPRECT_0_BR.u32All, y2, - PA_SC_CLIPRECT_0_BR__BR_Y_shift, PA_SC_CLIPRECT_0_BR__BR_Y_mask); - - r700->PA_SC_CLIPRECT_1_TL.u32All = r700->PA_SC_CLIPRECT_0_TL.u32All; - r700->PA_SC_CLIPRECT_1_BR.u32All = r700->PA_SC_CLIPRECT_0_BR.u32All; - r700->PA_SC_CLIPRECT_2_TL.u32All = r700->PA_SC_CLIPRECT_0_TL.u32All; - r700->PA_SC_CLIPRECT_2_BR.u32All = r700->PA_SC_CLIPRECT_0_BR.u32All; - r700->PA_SC_CLIPRECT_3_TL.u32All = r700->PA_SC_CLIPRECT_0_TL.u32All; - r700->PA_SC_CLIPRECT_3_BR.u32All = r700->PA_SC_CLIPRECT_0_BR.u32All; - - /* more....2d clip */ - SETbit(r700->PA_SC_GENERIC_SCISSOR_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(r700->PA_SC_GENERIC_SCISSOR_TL.u32All, x1, - PA_SC_GENERIC_SCISSOR_TL__TL_X_shift, PA_SC_GENERIC_SCISSOR_TL__TL_X_mask); - SETfield(r700->PA_SC_GENERIC_SCISSOR_TL.u32All, y1, - PA_SC_GENERIC_SCISSOR_TL__TL_Y_shift, PA_SC_GENERIC_SCISSOR_TL__TL_Y_mask); - SETfield(r700->PA_SC_GENERIC_SCISSOR_BR.u32All, x2, - PA_SC_GENERIC_SCISSOR_BR__BR_X_shift, PA_SC_GENERIC_SCISSOR_BR__BR_X_mask); - SETfield(r700->PA_SC_GENERIC_SCISSOR_BR.u32All, y2, - PA_SC_GENERIC_SCISSOR_BR__BR_Y_shift, PA_SC_GENERIC_SCISSOR_BR__BR_Y_mask); - - SETbit(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, WINDOW_OFFSET_DISABLE_bit); - SETfield(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, x1, - PA_SC_VPORT_SCISSOR_0_TL__TL_X_shift, PA_SC_VPORT_SCISSOR_0_TL__TL_X_mask); - SETfield(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_TL.u32All, y1, - PA_SC_VPORT_SCISSOR_0_TL__TL_Y_shift, PA_SC_VPORT_SCISSOR_0_TL__TL_Y_mask); - SETfield(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, x2, - PA_SC_VPORT_SCISSOR_0_BR__BR_X_shift, PA_SC_VPORT_SCISSOR_0_BR__BR_X_mask); - SETfield(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, - PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); - - r700->viewport[id].enabled = GL_TRUE; -} - -static void r700InitSQConfig(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int ps_prio; - int vs_prio; - int gs_prio; - int es_prio; - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - - R600_STATECHANGE(context, sq); - - // SQ - ps_prio = 0; - vs_prio = 1; - gs_prio = 2; - es_prio = 3; - switch (context->radeon.radeonScreen->chip_family) { - case CHIP_FAMILY_R600: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV630: - case CHIP_FAMILY_RV635: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 40; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV610: - case CHIP_FAMILY_RV620: - case CHIP_FAMILY_RS780: - case CHIP_FAMILY_RS880: - default: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV670: - num_ps_gprs = 144; - num_vs_gprs = 40; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_FAMILY_RV770: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 256; - num_vs_stack_entries = 256; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV730: - case CHIP_FAMILY_RV740: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_FAMILY_RV710: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 48; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - } - - r700->sq_config.SQ_CONFIG.u32All = 0; - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) - CLEARbit(r700->sq_config.SQ_CONFIG.u32All, VC_ENABLE_bit); - else - SETbit(r700->sq_config.SQ_CONFIG.u32All, VC_ENABLE_bit); - - if(GL_TRUE == r700->bShaderUseMemConstant) - { - CLEARbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit); - } - else - { - SETbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit); - } - - SETbit(r700->sq_config.SQ_CONFIG.u32All, ALU_INST_PREFER_VECTOR_bit); - SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, PS_PRIO_shift, PS_PRIO_mask); - SETfield(r700->sq_config.SQ_CONFIG.u32All, vs_prio, VS_PRIO_shift, VS_PRIO_mask); - SETfield(r700->sq_config.SQ_CONFIG.u32All, gs_prio, GS_PRIO_shift, GS_PRIO_mask); - SETfield(r700->sq_config.SQ_CONFIG.u32All, es_prio, ES_PRIO_shift, ES_PRIO_mask); - - r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All = 0; - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, num_ps_gprs, NUM_PS_GPRS_shift, NUM_PS_GPRS_mask); - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, num_vs_gprs, NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, num_temp_gprs, - NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask); - - r700->sq_config.SQ_GPR_RESOURCE_MGMT_2.u32All = 0; - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_2.u32All, num_gs_gprs, NUM_GS_GPRS_shift, NUM_GS_GPRS_mask); - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_2.u32All, num_es_gprs, NUM_ES_GPRS_shift, NUM_ES_GPRS_mask); - - r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All = 0; - SETfield(r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All, num_ps_threads, - NUM_PS_THREADS_shift, NUM_PS_THREADS_mask); - SETfield(r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All, num_vs_threads, - NUM_VS_THREADS_shift, NUM_VS_THREADS_mask); - SETfield(r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All, num_gs_threads, - NUM_GS_THREADS_shift, NUM_GS_THREADS_mask); - SETfield(r700->sq_config.SQ_THREAD_RESOURCE_MGMT.u32All, num_es_threads, - NUM_ES_THREADS_shift, NUM_ES_THREADS_mask); - - r700->sq_config.SQ_STACK_RESOURCE_MGMT_1.u32All = 0; - SETfield(r700->sq_config.SQ_STACK_RESOURCE_MGMT_1.u32All, num_ps_stack_entries, - NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask); - SETfield(r700->sq_config.SQ_STACK_RESOURCE_MGMT_1.u32All, num_vs_stack_entries, - NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask); - - r700->sq_config.SQ_STACK_RESOURCE_MGMT_2.u32All = 0; - SETfield(r700->sq_config.SQ_STACK_RESOURCE_MGMT_2.u32All, num_gs_stack_entries, - NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask); - SETfield(r700->sq_config.SQ_STACK_RESOURCE_MGMT_2.u32All, num_es_stack_entries, - NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask); - -} - -/** - * Calculate initial hardware state and register state functions. - * Assumes that the command buffer and state atoms have been - * initialized already. - */ -void r700InitState(struct gl_context * ctx) //------------------- -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - int id = 0; - - r700->TA_CNTL_AUX.u32All = 0; - SETfield(r700->TA_CNTL_AUX.u32All, 28, TD_FIFO_CREDIT_shift, TD_FIFO_CREDIT_mask); - r700->VC_ENHANCE.u32All = 0; - r700->DB_WATERMARKS.u32All = 0; - SETfield(r700->DB_WATERMARKS.u32All, 4, DEPTH_FREE_shift, DEPTH_FREE_mask); - SETfield(r700->DB_WATERMARKS.u32All, 16, DEPTH_FLUSH_shift, DEPTH_FLUSH_mask); - SETfield(r700->DB_WATERMARKS.u32All, 0, FORCE_SUMMARIZE_shift, FORCE_SUMMARIZE_mask); - SETfield(r700->DB_WATERMARKS.u32All, 4, DEPTH_PENDING_FREE_shift, DEPTH_PENDING_FREE_mask); - r700->SQ_DYN_GPR_CNTL_PS_FLUSH_REQ.u32All = 0; - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { - SETfield(r700->TA_CNTL_AUX.u32All, 3, GRADIENT_CREDIT_shift, GRADIENT_CREDIT_mask); - r700->DB_DEBUG.u32All = 0x82000000; - SETfield(r700->DB_WATERMARKS.u32All, 16, DEPTH_CACHELINE_FREE_shift, DEPTH_CACHELINE_FREE_mask); - } else { - SETfield(r700->TA_CNTL_AUX.u32All, 2, GRADIENT_CREDIT_shift, GRADIENT_CREDIT_mask); - SETfield(r700->DB_WATERMARKS.u32All, 4, DEPTH_CACHELINE_FREE_shift, DEPTH_CACHELINE_FREE_mask); - SETbit(r700->SQ_DYN_GPR_CNTL_PS_FLUSH_REQ.u32All, VS_PC_LIMIT_ENABLE_bit); - } - - /* Turn off vgt reuse */ - r700->VGT_REUSE_OFF.u32All = 0; - SETbit(r700->VGT_REUSE_OFF.u32All, REUSE_OFF_bit); - - /* Specify offsetting and clamp values for vertices */ - r700->VGT_MAX_VTX_INDX.u32All = 0xFFFFFF; - r700->VGT_MIN_VTX_INDX.u32All = 0; - r700->VGT_INDX_OFFSET.u32All = 0; - - /* default shader connections. */ - r700->SPI_VS_OUT_ID_0.u32All = 0x03020100; - r700->SPI_VS_OUT_ID_1.u32All = 0x07060504; - r700->SPI_VS_OUT_ID_2.u32All = 0x0b0a0908; - r700->SPI_VS_OUT_ID_3.u32All = 0x0f0e0d0c; - - r700->SPI_THREAD_GROUPING.u32All = 0; - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - SETfield(r700->SPI_THREAD_GROUPING.u32All, 1, PS_GROUPING_shift, PS_GROUPING_mask); - - /* 4 clip rectangles */ /* TODO : set these clip rects according to context->currentDraw->numClipRects */ - r700->PA_SC_CLIPRECT_RULE.u32All = 0; - SETfield(r700->PA_SC_CLIPRECT_RULE.u32All, CLIP_RULE_mask, CLIP_RULE_shift, CLIP_RULE_mask); - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - r700->PA_SC_EDGERULE.u32All = 0; - else - r700->PA_SC_EDGERULE.u32All = 0xAAAAAAAA; - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { - r700->PA_SC_MODE_CNTL.u32All = 0; - SETbit(r700->PA_SC_MODE_CNTL.u32All, WALK_ORDER_ENABLE_bit); - SETbit(r700->PA_SC_MODE_CNTL.u32All, FORCE_EOV_CNTDWN_ENABLE_bit); - } else { - r700->PA_SC_MODE_CNTL.u32All = 0x00500000; - SETbit(r700->PA_SC_MODE_CNTL.u32All, FORCE_EOV_REZ_ENABLE_bit); - SETbit(r700->PA_SC_MODE_CNTL.u32All, FORCE_EOV_CNTDWN_ENABLE_bit); - } - - /* Do scale XY and Z by 1/W0. */ - r700->bEnablePerspective = GL_TRUE; - - CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_XY_FMT_bit); - CLEARbit(r700->PA_CL_VTE_CNTL.u32All, VTX_Z_FMT_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VTX_W0_FMT_bit); - - /* Enable viewport scaling for all three axis */ - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_X_SCALE_ENA_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_X_OFFSET_ENA_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_Y_SCALE_ENA_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_Y_OFFSET_ENA_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_Z_SCALE_ENA_bit); - SETbit(r700->PA_CL_VTE_CNTL.u32All, VPORT_Z_OFFSET_ENA_bit); - - /* GL uses last vtx for flat shading components */ - SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit); - - /* Set up vertex control */ - r700->PA_SU_VTX_CNTL.u32All = 0; - CLEARfield(r700->PA_SU_VTX_CNTL.u32All, QUANT_MODE_mask); - SETbit(r700->PA_SU_VTX_CNTL.u32All, PIX_CENTER_bit); - SETfield(r700->PA_SU_VTX_CNTL.u32All, X_ROUND_TO_EVEN, - PA_SU_VTX_CNTL__ROUND_MODE_shift, PA_SU_VTX_CNTL__ROUND_MODE_mask); - - /* to 1.0 = no guard band */ - r700->PA_CL_GB_VERT_CLIP_ADJ.u32All = 0x3F800000; /* 1.0 */ - r700->PA_CL_GB_VERT_DISC_ADJ.u32All = 0x3F800000; - r700->PA_CL_GB_HORZ_CLIP_ADJ.u32All = 0x3F800000; - r700->PA_CL_GB_HORZ_DISC_ADJ.u32All = 0x3F800000; - - /* Enable all samples for multi-sample anti-aliasing */ - r700->PA_SC_AA_MASK.u32All = 0xFFFFFFFF; - /* Turn off AA */ - r700->PA_SC_AA_CONFIG.u32All = 0; - - r700->SX_MISC.u32All = 0; - - r700InitSQConfig(ctx); - - r700ColorMask(ctx, - ctx->Color.ColorMask[0][RCOMP], - ctx->Color.ColorMask[0][GCOMP], - ctx->Color.ColorMask[0][BCOMP], - ctx->Color.ColorMask[0][ACOMP]); - - r700Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); - r700DepthMask(ctx, ctx->Depth.Mask); - r700DepthFunc(ctx, ctx->Depth.Func); - r700->DB_DEPTH_CLEAR.u32All = 0x3F800000; - SETbit(r700->DB_RENDER_CONTROL.u32All, STENCIL_COMPRESS_DISABLE_bit); - SETbit(r700->DB_RENDER_CONTROL.u32All, DEPTH_COMPRESS_DISABLE_bit); - r700SetDBRenderState(ctx); - - r700->DB_ALPHA_TO_MASK.u32All = 0; - SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET0_shift, ALPHA_TO_MASK_OFFSET0_mask); - SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET1_shift, ALPHA_TO_MASK_OFFSET1_mask); - SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET2_shift, ALPHA_TO_MASK_OFFSET2_mask); - SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET3_shift, ALPHA_TO_MASK_OFFSET3_mask); - - /* stencil */ - r700Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); - r700StencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]); - r700StencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], - ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); - r700StencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], - ctx->Stencil.ZFailFunc[0], - ctx->Stencil.ZPassFunc[0]); - - r700UpdateCulling(ctx); - - r700SetBlendState(ctx); - r700SetLogicOpState(ctx); - - r700AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); - r700Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); - - r700PointSize(ctx, 1.0); - - CLEARfield(r700->PA_SU_POINT_MINMAX.u32All, MIN_SIZE_mask); - SETfield(r700->PA_SU_POINT_MINMAX.u32All, 0x8000, MAX_SIZE_shift, MAX_SIZE_mask); - - r700LineWidth(ctx, 1.0); - - r700->PA_SC_LINE_CNTL.u32All = 0; - CLEARbit(r700->PA_SC_LINE_CNTL.u32All, EXPAND_LINE_WIDTH_bit); - SETbit(r700->PA_SC_LINE_CNTL.u32All, LAST_PIXEL_bit); - - r700ShadeModel(ctx, ctx->Light.ShadeModel); - r700PolygonMode(ctx, GL_FRONT, ctx->Polygon.FrontMode); - r700PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode); - r700PolygonOffset(ctx, ctx->Polygon.OffsetFactor, - ctx->Polygon.OffsetUnits); - r700Enable(ctx, GL_POLYGON_OFFSET_POINT, ctx->Polygon.OffsetPoint); - r700Enable(ctx, GL_POLYGON_OFFSET_LINE, ctx->Polygon.OffsetLine); - r700Enable(ctx, GL_POLYGON_OFFSET_FILL, ctx->Polygon.OffsetFill); - - /* CB */ - r700BlendColor(ctx, ctx->Color.BlendColor); - - r700->CB_CLEAR_RED_R6XX.f32All = 1.0; //r6xx only - r700->CB_CLEAR_GREEN_R6XX.f32All = 0.0; //r6xx only - r700->CB_CLEAR_BLUE_R6XX.f32All = 1.0; //r6xx only - r700->CB_CLEAR_ALPHA_R6XX.f32All = 1.0; //r6xx only - r700->CB_FOG_RED_R6XX.u32All = 0; //r6xx only - r700->CB_FOG_GREEN_R6XX.u32All = 0; //r6xx only - r700->CB_FOG_BLUE_R6XX.u32All = 0; //r6xx only - - /* Disable color compares */ - SETfield(r700->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, - CLRCMP_FCN_SRC_shift, CLRCMP_FCN_SRC_mask); - SETfield(r700->CB_CLRCMP_CONTROL.u32All, CLRCMP_DRAW_ALWAYS, - CLRCMP_FCN_DST_shift, CLRCMP_FCN_DST_mask); - SETfield(r700->CB_CLRCMP_CONTROL.u32All, CLRCMP_SEL_SRC, - CLRCMP_FCN_SEL_shift, CLRCMP_FCN_SEL_mask); - - /* Zero out source */ - r700->CB_CLRCMP_SRC.u32All = 0x00000000; - - /* Put a compare color in for error checking */ - r700->CB_CLRCMP_DST.u32All = 0x000000FF; - - /* Set up color compare mask */ - r700->CB_CLRCMP_MSK.u32All = 0xFFFFFFFF; - - /* screen/window/view */ - SETfield(r700->CB_SHADER_MASK.u32All, 0xF, (4 * id), OUTPUT0_ENABLE_mask); - - context->radeon.hw.all_dirty = GL_TRUE; - -} - -void r700InitStateFuncs(radeonContextPtr radeon, struct dd_function_table *functions) -{ - functions->UpdateState = r700InvalidateState; - functions->AlphaFunc = r700AlphaFunc; - functions->BlendColor = r700BlendColor; - functions->BlendEquationSeparate = r700BlendEquationSeparate; - functions->BlendFuncSeparate = r700BlendFuncSeparate; - functions->Enable = r700Enable; - functions->ColorMask = r700ColorMask; - functions->DepthFunc = r700DepthFunc; - functions->DepthMask = r700DepthMask; - functions->CullFace = r700CullFace; - functions->Fogfv = r700Fogfv; - functions->FrontFace = r700FrontFace; - functions->ShadeModel = r700ShadeModel; - functions->LogicOpcode = r700LogicOpcode; - - /* ARB_point_parameters */ - functions->PointParameterfv = r700PointParameter; - - /* Stencil related */ - functions->StencilFuncSeparate = r700StencilFuncSeparate; - functions->StencilMaskSeparate = r700StencilMaskSeparate; - functions->StencilOpSeparate = r700StencilOpSeparate; - - /* Viewport related */ - functions->Viewport = r700Viewport; - functions->DepthRange = r700DepthRange; - functions->PointSize = r700PointSize; - functions->LineWidth = r700LineWidth; - functions->LineStipple = r700LineStipple; - - functions->PolygonOffset = r700PolygonOffset; - functions->PolygonMode = r700PolygonMode; - - functions->RenderMode = r700RenderMode; - - functions->ClipPlane = r700ClipPlane; - - functions->Scissor = radeonScissor; - - functions->DrawBuffer = radeonDrawBuffer; - functions->ReadBuffer = radeonReadBuffer; - - functions->CopyPixels = _mesa_meta_CopyPixels; - functions->DrawPixels = _mesa_meta_DrawPixels; - if (radeon->radeonScreen->kernel_mm) - functions->ReadPixels = radeonReadPixels; -} - diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h deleted file mode 100644 index 2d51198c8a8..00000000000 --- a/src/mesa/drivers/dri/r600/r700_state.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - -#ifndef _R700_STATE_H -#define _R700_STATE_H - -#include "main/mtypes.h" - -#include "r600_context.h" - -#include "r700_chip.h" - -extern void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state); -extern void r700UpdateShaders (struct gl_context * ctx); -extern void r700UpdateShaderStates(struct gl_context * ctx); - -extern void r700UpdateViewportOffset(struct gl_context * ctx); - -extern void r700InitState (struct gl_context * ctx); -extern void r700InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); - -extern void r700SetScissor(context_t *context); - -#endif /* _R600_SCREEN_H */ diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c deleted file mode 100644 index b1e2742b27d..00000000000 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ /dev/null @@ -1,769 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#include "main/imports.h" -#include "main/mtypes.h" - -#include "tnl/t_context.h" -#include "program/program.h" -#include "program/prog_parameter.h" -#include "program/prog_statevars.h" - -#include "radeon_debug.h" -#include "r600_context.h" -#include "r600_cmdbuf.h" -#include "r600_emit.h" -#include "program/programopt.h" - -#include "r700_debug.h" -#include "r700_vertprog.h" - -unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart) -{ - unsigned int i; - unsigned int unBit; - unsigned int unTotal = unStart; - - //!!!!!!! THE ORDER MATCH FS INPUT - - unBit = 1 << VERT_RESULT_HPOS; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_HPOS] = unTotal++; - } - - unBit = 1 << VERT_RESULT_COL0; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_COL0] = unTotal++; - } - - unBit = 1 << VERT_RESULT_COL1; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_COL1] = unTotal++; - } - - //TODO : dealing back face. - unBit = 1 << VERT_RESULT_BFC0; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_BFC0] = unTotal++; - } - - unBit = 1 << VERT_RESULT_BFC1; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_BFC1] = unTotal++; - } - - //TODO : dealing fog. - unBit = 1 << VERT_RESULT_FOGC; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_FOGC] = unTotal++; - } - - //TODO : dealing point size. - unBit = 1 << VERT_RESULT_PSIZ; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_PSIZ] = unTotal++; - } - - for(i=0; i<8; i++) - { - unBit = 1 << (VERT_RESULT_TEX0 + i); - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[VERT_RESULT_TEX0 + i] = unTotal++; - } - } - - for(i=VERT_RESULT_VAR0; i<VERT_RESULT_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.OutputsWritten & unBit) - { - pAsm->ucVP_OutputMap[i] = unTotal++; - } - } - - return (unTotal - unStart); -} - -unsigned int Map_Vertex_Input(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart) -{ - int i; - unsigned int unBit; - unsigned int unTotal = unStart; - for(i=0; i<VERT_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.InputsRead & unBit) - { - pAsm->ucVP_AttributeMap[i] = unTotal++; - } - } - return (unTotal - unStart); -} - -GLboolean Process_Vertex_Program_Vfetch_Instructions( - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - int i; - unsigned int unBit; - VTX_FETCH_METHOD vtxFetchMethod; - vtxFetchMethod.bEnableMini = GL_FALSE; - vtxFetchMethod.mega_fetch_remainder = 0; - - for(i=0; i<VERT_ATTRIB_MAX; i++) - { - unBit = 1 << i; - if(mesa_vp->Base.InputsRead & unBit) - { - assemble_vfetch_instruction(&vp->r700AsmCode, - i, - vp->r700AsmCode.ucVP_AttributeMap[i], - vp->aos_desc[i].size, - vp->aos_desc[i].type, - &vtxFetchMethod); - } - } - - return GL_TRUE; -} - -GLboolean Process_Vertex_Program_Vfetch_Instructions2( - struct gl_context *ctx, - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - int i; - context_t *context = R700_CONTEXT(ctx); - - VTX_FETCH_METHOD vtxFetchMethod; - vtxFetchMethod.bEnableMini = GL_FALSE; - vtxFetchMethod.mega_fetch_remainder = 0; - - for(i=0; i<context->nNumActiveAos; i++) - { - assemble_vfetch_instruction2(&vp->r700AsmCode, - vp->r700AsmCode.ucVP_AttributeMap[context->stream_desc[i].element], - context->stream_desc[i].type, - context->stream_desc[i].size, - context->stream_desc[i].element, - context->stream_desc[i]._signed, - context->stream_desc[i].normalize, - context->stream_desc[i].format, - &vtxFetchMethod); - } - - return GL_TRUE; -} - -void Map_Vertex_Program(struct gl_context *ctx, - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - r700_AssemblerBase *pAsm = &(vp->r700AsmCode); - unsigned int num_inputs; - - // R0 will always be used for index into vertex buffer - pAsm->number_used_registers = 1; - pAsm->starting_vfetch_register_number = pAsm->number_used_registers; - - // Map Inputs: Add 1 to mapping since R0 is used for index - num_inputs = Map_Vertex_Input(pAsm, mesa_vp, pAsm->number_used_registers); - pAsm->number_used_registers += num_inputs; - - // Create VFETCH instructions for inputs - if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) - { - radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); - return; - } - - // Map Outputs - pAsm->number_of_exports = Map_Vertex_Output(pAsm, mesa_vp, pAsm->number_used_registers); - - pAsm->starting_export_register_number = pAsm->number_used_registers; - - pAsm->number_used_registers += pAsm->number_of_exports; - - /* Map temporary registers (GPRs) */ - pAsm->starting_temp_register_number = pAsm->number_used_registers; - - if(mesa_vp->Base.NumNativeTemporaries >= mesa_vp->Base.NumTemporaries) - { /* arb uses NumNativeTemporaries */ - pAsm->number_used_registers += mesa_vp->Base.NumNativeTemporaries; - } - else - { /* fix func t_vp uses NumTemporaries */ - pAsm->number_used_registers += mesa_vp->Base.NumTemporaries; - } - - pAsm->flag_reg_index = pAsm->number_used_registers++; - - pAsm->uFirstHelpReg = pAsm->number_used_registers; -} - -GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp) -{ - GLuint i, j; - GLint * puiTEMPwrites; - struct prog_instruction *pILInst; - InstDeps *pInstDeps; - - puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_vp->Base.NumTemporaries); - for(i=0; i<mesa_vp->Base.NumTemporaries; i++) - { - puiTEMPwrites[i] = -1; - } - - pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_vp->Base.NumInstructions); - - for(i=0; i<mesa_vp->Base.NumInstructions; i++) - { - pInstDeps[i].nDstDep = -1; - pILInst = &(mesa_vp->Base.Instructions[i]); - - //Dst - if(pILInst->DstReg.File == PROGRAM_TEMPORARY) - { - //Set lastwrite for the temp - puiTEMPwrites[pILInst->DstReg.Index] = i; - } - - //Src - for(j=0; j<3; j++) - { - if(pILInst->SrcReg[j].File == PROGRAM_TEMPORARY) - { - //Set dep. - pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; - } - else - { - pInstDeps[i].nSrcDeps[j] = -1; - } - } - } - - vp->r700AsmCode.pInstDeps = pInstDeps; - - FREE(puiTEMPwrites); - - return GL_TRUE; -} - -struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, - struct gl_vertex_program *mesa_vp) -{ - context_t *context = R700_CONTEXT(ctx); - - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - - struct r700_vertex_program *vp; - unsigned int i; - - vp = calloc(1, sizeof(*vp)); - vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp); - - vp->constbo0 = NULL; - - if (mesa_vp->IsPositionInvariant) - { - _mesa_insert_mvp_code(ctx, vp->mesa_program); - } - - for(i=0; i<context->nNumActiveAos; i++) - { - vp->aos_desc[i].size = context->stream_desc[i].size; - vp->aos_desc[i].stride = context->stream_desc[i].stride; - vp->aos_desc[i].type = context->stream_desc[i].type; - vp->aos_desc[i].format = context->stream_desc[i].format; - } - - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - { - vp->r700AsmCode.bR6xx = 1; - } - - //Init_Program - Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); - - if(GL_TRUE == r700->bShaderUseMemConstant) - { - vp->r700AsmCode.bUseMemConstant = GL_TRUE; - } - else - { - vp->r700AsmCode.bUseMemConstant = GL_FALSE; - } - - vp->r700AsmCode.unAsic = 7; - - Map_Vertex_Program(ctx, vp, vp->mesa_program ); - - if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) - { - return NULL; - } - - InitShaderProgram(&(vp->r700AsmCode)); - - for(i=0; i < MAX_SAMPLERS; i++) - { - vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i]; - } - - vp->r700AsmCode.unCurNumILInsts = vp->mesa_program->Base.NumInstructions; - - if(GL_FALSE == AssembleInstr(0, - 0, - vp->mesa_program->Base.NumInstructions, - &(vp->mesa_program->Base.Instructions[0]), - &(vp->r700AsmCode)) ) - { - return NULL; - } - - if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), vp->mesa_program->Base.OutputsWritten) ) - { - return NULL; - } - - if( GL_FALSE == RelocProgram(&(vp->r700AsmCode), &(vp->mesa_program->Base)) ) - { - return GL_FALSE; - } - - vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0 - : (vp->r700AsmCode.number_used_registers - 1); - - vp->r700Shader.nParamExports = vp->r700AsmCode.number_of_exports; - - vp->translated = GL_TRUE; - - return vp; -} - -void r700SelectVertexShader(struct gl_context *ctx) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program_cont *vpc; - struct r700_vertex_program *vp; - unsigned int i; - GLboolean match; - GLbitfield InputsRead; - - vpc = (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; - - InputsRead = vpc->mesa_program.Base.InputsRead; - if (vpc->mesa_program.IsPositionInvariant) - { - InputsRead |= VERT_BIT_POS; - } - - for (vp = vpc->progs; vp; vp = vp->next) - { - match = GL_TRUE; - for(i=0; i<context->nNumActiveAos; i++) - { - if (vp->aos_desc[i].size != context->stream_desc[i].size || - vp->aos_desc[i].format != context->stream_desc[i].format) - { - match = GL_FALSE; - break; - } - } - if (match) - { - context->selected_vp = vp; - return; - } - } - - vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program)); - if(!vp) - { - radeon_error("Failed to translate vertex shader. \n"); - return; - } - vp->next = vpc->progs; - vpc->progs = vp; - context->selected_vp = vp; - return; -} - -int getTypeSize(GLenum type) -{ - switch (type) - { - case GL_DOUBLE: - return sizeof(GLdouble); - case GL_FLOAT: - return sizeof(GLfloat); - case GL_INT: - return sizeof(GLint); - case GL_UNSIGNED_INT: - return sizeof(GLuint); - case GL_SHORT: - return sizeof(GLshort); - case GL_UNSIGNED_SHORT: - return sizeof(GLushort); - case GL_BYTE: - return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: - return sizeof(GLubyte); - default: - assert(0); - return 0; - } -} - -static void r700TranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) -{ - context_t *context = R700_CONTEXT(ctx); - - StreamDesc * pStreamDesc = &(context->stream_desc[context->nNumActiveAos]); - - GLuint stride; - - stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size - : input->StrideB; - - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT -#if MESA_BIG_ENDIAN - || getTypeSize(input->Type) != 4 -#endif - ) - { - pStreamDesc->type = GL_FLOAT; - - if (input->StrideB == 0) - { - pStreamDesc->stride = 0; - } - else - { - pStreamDesc->stride = sizeof(GLfloat) * input->Size; - } - pStreamDesc->dwords = input->Size; - pStreamDesc->is_named_bo = GL_FALSE; - } - else - { - pStreamDesc->type = input->Type; - pStreamDesc->dwords = (getTypeSize(input->Type) * input->Size + 3)/ 4; - if (!input->BufferObj->Name) - { - if (input->StrideB == 0) - { - pStreamDesc->stride = 0; - } - else - { - pStreamDesc->stride = (getTypeSize(pStreamDesc->type) * input->Size + 3) & ~3; - } - - pStreamDesc->is_named_bo = GL_FALSE; - } - } - - pStreamDesc->size = input->Size; - pStreamDesc->dst_loc = context->nNumActiveAos; - pStreamDesc->element = unLoc; - pStreamDesc->format = input->Format; - - switch (pStreamDesc->type) - { //GetSurfaceFormat - case GL_FLOAT: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = GL_FALSE; - break; - case GL_SHORT: - pStreamDesc->_signed = 1; - pStreamDesc->normalize = input->Normalized; - break; - case GL_BYTE: - pStreamDesc->_signed = 1; - pStreamDesc->normalize = input->Normalized; - break; - case GL_UNSIGNED_SHORT: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = input->Normalized; - break; - case GL_UNSIGNED_BYTE: - pStreamDesc->_signed = 0; - pStreamDesc->normalize = input->Normalized; - break; - default: - case GL_INT: - case GL_UNSIGNED_INT: - case GL_DOUBLE: - assert(0); - break; - } - context->nNumActiveAos++; -} - -void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vpc - = (struct r700_vertex_program *)ctx->VertexProgram._Current; - - struct gl_vertex_program * mesa_vp = (struct gl_vertex_program *)&(vpc->mesa_program); - unsigned int unLoc = 0; - unsigned int unBit = mesa_vp->Base.InputsRead; - context->nNumActiveAos = 0; - - if (mesa_vp->IsPositionInvariant) - { - unBit |= VERT_BIT_POS; - } - - while(unBit) - { - if(unBit & 1) - { - r700TranslateAttrib(ctx, unLoc, count, arrays[unLoc]); - } - - unBit >>= 1; - ++unLoc; - } - context->radeon.tcl.aos_count = context->nNumActiveAos; -} - -void * r700GetActiveVpShaderBo(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vp = context->selected_vp;; - - if (vp) - return vp->shaderbo; - else - return NULL; -} - -void * r700GetActiveVpShaderConstBo(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vp = context->selected_vp;; - - if (vp) - return vp->constbo0; - else - return NULL; -} - -GLboolean r700SetupVertexProgram(struct gl_context * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - struct r700_vertex_program *vp = context->selected_vp; - - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui; - unsigned int num_sq_vs_gprs; - - if(GL_FALSE == vp->loaded) - { - if(vp->r700Shader.bNeedsAssembly == GL_TRUE) - { - Assemble( &(vp->r700Shader) ); - } - - /* Load vp to gpu */ - r600EmitShader(ctx, - &(vp->shaderbo), - (GLvoid *)(vp->r700Shader.pProgram), - vp->r700Shader.uShaderBinaryDWORDSize, - "VS"); - - if(GL_TRUE == r700->bShaderUseMemConstant) - { - paramList = vp->mesa_program->Base.Parameters; - if(NULL != paramList) - { - unNumParamData = paramList->NumParameters; - r600AllocShaderConsts(ctx, - &(vp->constbo0), - unNumParamData *4*4, - "VSCON"); - } - } - - vp->loaded = GL_TRUE; - } - - DumpHwBinary(DUMP_VERTEX_SHADER, (GLvoid *)(vp->r700Shader.pProgram), - vp->r700Shader.uShaderBinaryDWORDSize); - - /* TODO : enable this after MemUse fixed *= - (context->chipobj.MemUse)(context, vp->shadercode.buf->id); - */ - - R600_STATECHANGE(context, vs); - R600_STATECHANGE(context, fs); /* hack */ - - r700->vs.SQ_PGM_RESOURCES_VS.u32All = 0; - SETbit(r700->vs.SQ_PGM_RESOURCES_VS.u32All, PGM_RESOURCES__PRIME_CACHE_ON_DRAW_bit); - - r700->vs.SQ_ALU_CONST_CACHE_VS_0.u32All = 0; /* set from buffer object. */ - - r700->vs.SQ_PGM_START_VS.u32All = 0; - - SETfield(r700->vs.SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.nRegs + 1, - NUM_GPRS_shift, NUM_GPRS_mask); - - num_sq_vs_gprs = ((r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All & NUM_VS_GPRS_mask) >> NUM_VS_GPRS_shift); - - if((vp->r700Shader.nRegs + 1) > num_sq_vs_gprs) - { - /* care! thich changes sq - needs idle state */ - R600_STATECHANGE(context, sq); - SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, vp->r700Shader.nRegs + 1, - NUM_VS_GPRS_shift, NUM_VS_GPRS_mask); - } - - if(vp->r700Shader.uStackSize) /* we don't use branch for now, it should be zero. */ - { - SETfield(r700->vs.SQ_PGM_RESOURCES_VS.u32All, vp->r700Shader.uStackSize, - STACK_SIZE_shift, STACK_SIZE_mask); - } - - R600_STATECHANGE(context, spi); - - if(vp->mesa_program->Base.OutputsWritten & (1 << VERT_RESULT_PSIZ)) { - R600_STATECHANGE(context, cl); - SETbit(r700->PA_CL_VS_OUT_CNTL.u32All, USE_VTX_POINT_SIZE_bit); - SETbit(r700->PA_CL_VS_OUT_CNTL.u32All, VS_OUT_MISC_VEC_ENA_bit); - } else if (r700->PA_CL_VS_OUT_CNTL.u32All != 0) { - R600_STATECHANGE(context, cl); - CLEARbit(r700->PA_CL_VS_OUT_CNTL.u32All, USE_VTX_POINT_SIZE_bit); - CLEARbit(r700->PA_CL_VS_OUT_CNTL.u32All, VS_OUT_MISC_VEC_ENA_bit); - } - - SETfield(r700->SPI_VS_OUT_CONFIG.u32All, - vp->r700Shader.nParamExports ? (vp->r700Shader.nParamExports - 1) : 0, - VS_EXPORT_COUNT_shift, VS_EXPORT_COUNT_mask); - SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, vp->r700Shader.nParamExports, - NUM_INTERP_shift, NUM_INTERP_mask); - - /* - SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, PERSP_GRADIENT_ENA_bit); - CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); - */ - - /* sent out shader constants. */ - paramList = vp->mesa_program->Base.Parameters; - - if(NULL != paramList) { - /* vp->mesa_program was cloned, not updated by glsl shader api. */ - /* _mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current */ - /* so, use ctx->VertexProgem._Current */ - struct gl_program_parameter_list *paramListOrginal = - ctx->VertexProgram._Current->Base.Parameters; - - _mesa_load_state_parameters(ctx, paramList); - - if (paramList->NumParameters > R700_MAX_DX9_CONSTS) - return GL_FALSE; - - R600_STATECHANGE(context, vs_consts); - - r700->vs.num_consts = paramList->NumParameters; - - unNumParamData = paramList->NumParameters; - - for(ui=0; ui<unNumParamData; ui++) { - if(paramList->Parameters[ui].Type == PROGRAM_UNIFORM) - { - r700->vs.consts[ui][0].f32All = paramListOrginal->ParameterValues[ui][0].f; - r700->vs.consts[ui][1].f32All = paramListOrginal->ParameterValues[ui][1].f; - r700->vs.consts[ui][2].f32All = paramListOrginal->ParameterValues[ui][2].f; - r700->vs.consts[ui][3].f32All = paramListOrginal->ParameterValues[ui][3].f; - } - else - { - r700->vs.consts[ui][0].f32All = paramList->ParameterValues[ui][0].f; - r700->vs.consts[ui][1].f32All = paramList->ParameterValues[ui][1].f; - r700->vs.consts[ui][2].f32All = paramList->ParameterValues[ui][2].f; - r700->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3].f; - } - } - - /* Load vp constants to gpu */ - if(GL_TRUE == r700->bShaderUseMemConstant) - { - r600EmitShaderConsts(ctx, - vp->constbo0, - 0, - (GLvoid *)&(r700->vs.consts[0][0]), - unNumParamData * 4 * 4); - } - } else - r700->vs.num_consts = 0; - - COMPILED_SUB * pCompiledSub; - GLuint uj; - GLuint unConstOffset = r700->vs.num_consts; - for(ui=0; ui<vp->r700AsmCode.unNumPresub; ui++) - { - pCompiledSub = vp->r700AsmCode.presubs[ui].pCompiledSub; - - r700->vs.num_consts += pCompiledSub->NumParameters; - - for(uj=0; uj<pCompiledSub->NumParameters; uj++) - { - r700->vs.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; - r700->vs.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; - r700->vs.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; - r700->vs.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; - } - unConstOffset += pCompiledSub->NumParameters; - } - - return GL_TRUE; -} diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h deleted file mode 100644 index 859afb6e97c..00000000000 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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: - * Richard Li <[email protected]>, <[email protected]> - */ - - -#ifndef _R700_VERTPROG_H_ -#define _R700_VERTPROG_H_ - -#include "main/glheader.h" -#include "main/mtypes.h" - -#include "r700_shader.h" -#include "r700_assembler.h" - -typedef struct ArrayDesc //TEMP -{ - GLint size; //number of data element - GLenum type; //data element type - GLsizei stride; - GLenum format; //GL_RGBA or GL_BGRA -} ArrayDesc; - -struct r700_vertex_program -{ - struct gl_vertex_program *mesa_program; /* Must be first */ - - struct r700_vertex_program *next; - - r700_AssemblerBase r700AsmCode; - R700_Shader r700Shader; - - GLboolean translated; - GLboolean loaded; - - void * shaderbo; - - GLuint K0used; - void * constbo0; - - ArrayDesc aos_desc[VERT_ATTRIB_MAX]; -}; - -struct r700_vertex_program_cont -{ - struct gl_vertex_program mesa_program; - - struct r700_vertex_program *progs; -}; - -//Internal -unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart); -unsigned int Map_Vertex_Input(r700_AssemblerBase *pAsm, - struct gl_vertex_program *mesa_vp, - unsigned int unStart); -GLboolean Process_Vertex_Program_Vfetch_Instructions( - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -GLboolean Process_Vertex_Program_Vfetch_Instructions2( - struct gl_context *ctx, - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -void Map_Vertex_Program(struct gl_context *ctx, - struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp); -GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp); - -struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, - struct gl_vertex_program *mesa_vp); - -/* Interface */ -extern void r700SelectVertexShader(struct gl_context *ctx); -extern void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); - -extern GLboolean r700SetupVertexProgram(struct gl_context * ctx); - -extern void * r700GetActiveVpShaderBo(struct gl_context * ctx); - -extern void * r700GetActiveVpShaderConstBo(struct gl_context * ctx); - -extern int getTypeSize(GLenum type); - -#endif /* _R700_VERTPROG_H_ */ diff --git a/src/mesa/drivers/dri/r600/radeon_bo.c b/src/mesa/drivers/dri/r600/radeon_bo.c deleted file mode 120000 index 9448ffee54b..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_bo.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bo.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h b/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h deleted file mode 120000 index 029450928be..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_bo_int_drm.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bo_int_drm.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_bo_legacy.c b/src/mesa/drivers/dri/r600/radeon_bo_legacy.c deleted file mode 120000 index 79ad050e6b6..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_bo_legacy.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bo_legacy.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_bo_legacy.h b/src/mesa/drivers/dri/r600/radeon_bo_legacy.h deleted file mode 120000 index 83b0f7ffabe..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_bo_legacy.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bo_legacy.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_bocs_wrapper.h b/src/mesa/drivers/dri/r600/radeon_bocs_wrapper.h deleted file mode 120000 index ca894b2443c..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_bocs_wrapper.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bocs_wrapper.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_buffer_objects.c b/src/mesa/drivers/dri/r600/radeon_buffer_objects.c deleted file mode 120000 index f6a5f664701..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_buffer_objects.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_buffer_objects.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_buffer_objects.h b/src/mesa/drivers/dri/r600/radeon_buffer_objects.h deleted file mode 120000 index 2f134fd17b8..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_buffer_objects.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_buffer_objects.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_chipset.h b/src/mesa/drivers/dri/r600/radeon_chipset.h deleted file mode 120000 index eba99001ff8..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_chipset.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_chipset.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cmdbuf.h b/src/mesa/drivers/dri/r600/radeon_cmdbuf.h deleted file mode 120000 index a799e1dc6df..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cmdbuf.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cmdbuf.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_common.c b/src/mesa/drivers/dri/r600/radeon_common.c deleted file mode 120000 index 67b19ba940d..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_common.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_common.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_common.h b/src/mesa/drivers/dri/r600/radeon_common.h deleted file mode 120000 index 5bcb696a9f7..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_common.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_common.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_common_context.c b/src/mesa/drivers/dri/r600/radeon_common_context.c deleted file mode 120000 index 86800f3819c..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_common_context.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_common_context.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_common_context.h b/src/mesa/drivers/dri/r600/radeon_common_context.h deleted file mode 120000 index 4d663125500..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_common_context.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_common_context.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cs.c b/src/mesa/drivers/dri/r600/radeon_cs.c deleted file mode 120000 index 66b7ad1eb03..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cs.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h b/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h deleted file mode 120000 index 462f5245d0e..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cs_int_drm.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs_int_drm.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cs_legacy.c b/src/mesa/drivers/dri/r600/radeon_cs_legacy.c deleted file mode 120000 index 006720f8a46..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cs_legacy.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs_legacy.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cs_legacy.h b/src/mesa/drivers/dri/r600/radeon_cs_legacy.h deleted file mode 120000 index a5f95e0a3dc..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cs_legacy.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs_legacy.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_cs_space_drm.c b/src/mesa/drivers/dri/r600/radeon_cs_space_drm.c deleted file mode 120000 index c248ea7d1a5..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_cs_space_drm.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs_space_drm.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_debug.c b/src/mesa/drivers/dri/r600/radeon_debug.c deleted file mode 120000 index c98c2e074c5..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_debug.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_debug.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_debug.h b/src/mesa/drivers/dri/r600/radeon_debug.h deleted file mode 120000 index bd8aa28e89e..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_debug.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_debug.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_dma.c b/src/mesa/drivers/dri/r600/radeon_dma.c deleted file mode 120000 index 43be0006255..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_dma.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_dma.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_dma.h b/src/mesa/drivers/dri/r600/radeon_dma.h deleted file mode 120000 index 82e50634e3c..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_dma.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_dma.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_fbo.c b/src/mesa/drivers/dri/r600/radeon_fbo.c deleted file mode 120000 index 0d738d8d780..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_fbo.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_fbo.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_lock.c b/src/mesa/drivers/dri/r600/radeon_lock.c deleted file mode 120000 index af4108a8e30..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_lock.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_lock.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_lock.h b/src/mesa/drivers/dri/r600/radeon_lock.h deleted file mode 120000 index 64bdf94ee7e..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_lock.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_lock.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_mipmap_tree.c b/src/mesa/drivers/dri/r600/radeon_mipmap_tree.c deleted file mode 120000 index 31c0cfbe942..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_mipmap_tree.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_mipmap_tree.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_mipmap_tree.h b/src/mesa/drivers/dri/r600/radeon_mipmap_tree.h deleted file mode 120000 index 254d50cf8c5..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_mipmap_tree.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_mipmap_tree.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_pixel_read.c b/src/mesa/drivers/dri/r600/radeon_pixel_read.c deleted file mode 120000 index 3b03803126f..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_pixel_read.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_pixel_read.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_queryobj.c b/src/mesa/drivers/dri/r600/radeon_queryobj.c deleted file mode 120000 index 1d6ebc1c48b..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_queryobj.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_queryobj.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_queryobj.h b/src/mesa/drivers/dri/r600/radeon_queryobj.h deleted file mode 120000 index 8f6f842b0a6..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_queryobj.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_queryobj.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_screen.c b/src/mesa/drivers/dri/r600/radeon_screen.c deleted file mode 120000 index 86161118dd3..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_screen.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_screen.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_screen.h b/src/mesa/drivers/dri/r600/radeon_screen.h deleted file mode 120000 index 23bb6bd4598..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_screen.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_screen.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_span.c b/src/mesa/drivers/dri/r600/radeon_span.c deleted file mode 120000 index 232868c4c9e..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_span.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_span.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_span.h b/src/mesa/drivers/dri/r600/radeon_span.h deleted file mode 120000 index f9d634508c2..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_span.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_span.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_tex_copy.c b/src/mesa/drivers/dri/r600/radeon_tex_copy.c deleted file mode 120000 index dfa5ba34e65..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_tex_copy.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_tex_copy.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_texture.c b/src/mesa/drivers/dri/r600/radeon_texture.c deleted file mode 120000 index a822710915f..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_texture.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_texture.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_texture.h b/src/mesa/drivers/dri/r600/radeon_texture.h deleted file mode 120000 index 17fac3d5ea5..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_texture.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_texture.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_tile.c b/src/mesa/drivers/dri/r600/radeon_tile.c deleted file mode 120000 index d4bfe27da64..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_tile.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_tile.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_tile.h b/src/mesa/drivers/dri/r600/radeon_tile.h deleted file mode 120000 index 31074c581ea..00000000000 --- a/src/mesa/drivers/dri/r600/radeon_tile.h +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_tile.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/server/radeon.h b/src/mesa/drivers/dri/r600/server/radeon.h deleted file mode 120000 index 81274a54f11..00000000000 --- a/src/mesa/drivers/dri/r600/server/radeon.h +++ /dev/null @@ -1 +0,0 @@ -../../radeon/server/radeon.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/server/radeon_dri.h b/src/mesa/drivers/dri/r600/server/radeon_dri.h deleted file mode 120000 index 27c591d3c9d..00000000000 --- a/src/mesa/drivers/dri/r600/server/radeon_dri.h +++ /dev/null @@ -1 +0,0 @@ -../../radeon/server/radeon_dri.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/server/radeon_macros.h b/src/mesa/drivers/dri/r600/server/radeon_macros.h deleted file mode 120000 index c56cd735b83..00000000000 --- a/src/mesa/drivers/dri/r600/server/radeon_macros.h +++ /dev/null @@ -1 +0,0 @@ -../../radeon/server/radeon_macros.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/server/radeon_reg.h b/src/mesa/drivers/dri/r600/server/radeon_reg.h deleted file mode 120000 index e2349dcb685..00000000000 --- a/src/mesa/drivers/dri/r600/server/radeon_reg.h +++ /dev/null @@ -1 +0,0 @@ -../../radeon/server/radeon_reg.h
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/sq_micro_reg.h b/src/mesa/drivers/dri/r600/sq_micro_reg.h deleted file mode 100644 index bfd21cef623..00000000000 --- a/src/mesa/drivers/dri/r600/sq_micro_reg.h +++ /dev/null @@ -1,2008 +0,0 @@ -/* - * Copyright (C) 2008-2009 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) 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. - */ - -/* - * Contacts: - * Richard Li <[email protected]>, <[email protected]> - */ - -#if !defined (_SQ_MICRO_REG_H) -#define _SQ_MICRO_REG_H - -#if defined(LITTLEENDIAN_CPU) -#elif defined(BIGENDIAN_CPU) -#else -#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined" -#endif - -/* - * SQ_ALU_SRC_GPR_BASE value - */ - -#define SQ_ALU_SRC_GPR_BASE 0x00000000 - -/* - * SQ_ALU_SRC_GPR_SIZE value - */ - -#define SQ_ALU_SRC_GPR_SIZE 0x00000080 - -/* - * SQ_ALU_SRC_KCACHE0_BASE value - */ - -#define SQ_ALU_SRC_KCACHE0_BASE 0x00000080 - -/* - * SQ_ALU_SRC_KCACHE0_SIZE value - */ - -#define SQ_ALU_SRC_KCACHE0_SIZE 0x00000020 - -/* - * SQ_ALU_SRC_KCACHE1_BASE value - */ - -#define SQ_ALU_SRC_KCACHE1_BASE 0x000000a0 - -/* - * SQ_ALU_SRC_KCACHE1_SIZE value - */ - -#define SQ_ALU_SRC_KCACHE1_SIZE 0x00000020 - -/* - * SQ_ALU_SRC_CFILE_BASE value - */ - -#define SQ_ALU_SRC_CFILE_BASE 0x00000100 - -/* - * SQ_ALU_SRC_CFILE_SIZE value - */ - -#define SQ_ALU_SRC_CFILE_SIZE 0x00000100 - -/* - * SQ_SP_OP_REDUC_BEGIN value - */ - -#define SQ_SP_OP_REDUC_BEGIN 0x00000050 - -/* - * SQ_SP_OP_REDUC_END value - */ - -#define SQ_SP_OP_REDUC_END 0x00000053 - -/* - * SQ_SP_OP_TRANS_BEGIN value - */ - -#define SQ_SP_OP_TRANS_BEGIN 0x00000060 - -/* - * SQ_SP_OP_TRANS_END value - */ - -#define SQ_SP_OP_TRANS_END 0x0000007f - -/* - * SQ_CF_WORD0 struct - */ - -#define SQ_CF_WORD0_ADDR_SIZE 32 - -#define SQ_CF_WORD0_ADDR_SHIFT 0 - -#define SQ_CF_WORD0_ADDR_MASK 0xffffffff - -#define SQ_CF_WORD0_MASK \ - (SQ_CF_WORD0_ADDR_MASK) - -#define SQ_CF_WORD0_DEFAULT 0xcdcdcdcd - -#define SQ_CF_WORD0_GET_ADDR(sq_cf_word0) \ - ((sq_cf_word0 & SQ_CF_WORD0_ADDR_MASK) >> SQ_CF_WORD0_ADDR_SHIFT) - -#define SQ_CF_WORD0_SET_ADDR(sq_cf_word0_reg, addr) \ - sq_cf_word0_reg = (sq_cf_word0_reg & ~SQ_CF_WORD0_ADDR_MASK) | (addr << SQ_CF_WORD0_ADDR_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_word0_t { - unsigned int addr : SQ_CF_WORD0_ADDR_SIZE; - } sq_cf_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_word0_t { - unsigned int addr : SQ_CF_WORD0_ADDR_SIZE; - } sq_cf_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_word0_t f; -} sq_cf_word0_u; - - -/* - * SQ_CF_WORD1 struct - */ - -#define SQ_CF_WORD1_POP_COUNT_SIZE 3 -#define SQ_CF_WORD1_CF_CONST_SIZE 5 -#define SQ_CF_WORD1_COND_SIZE 2 -#define SQ_CF_WORD1_COUNT_SIZE 3 -#define SQ_CF_WORD1_CALL_COUNT_SIZE 6 -#define SQ_CF_WORD1_COUNT_3_SIZE 1 -#define SQ_CF_WORD1_END_OF_PROGRAM_SIZE 1 -#define SQ_CF_WORD1_VALID_PIXEL_MODE_SIZE 1 -#define SQ_CF_WORD1_CF_INST_SIZE 7 -#define SQ_CF_WORD1_WHOLE_QUAD_MODE_SIZE 1 -#define SQ_CF_WORD1_BARRIER_SIZE 1 - -#define SQ_CF_WORD1_POP_COUNT_SHIFT 0 -#define SQ_CF_WORD1_CF_CONST_SHIFT 3 -#define SQ_CF_WORD1_COND_SHIFT 8 -#define SQ_CF_WORD1_COUNT_SHIFT 10 -#define SQ_CF_WORD1_CALL_COUNT_SHIFT 13 -#define SQ_CF_WORD1_COUNT_3_SHIFT 19 -#define SQ_CF_WORD1_END_OF_PROGRAM_SHIFT 21 -#define SQ_CF_WORD1_VALID_PIXEL_MODE_SHIFT 22 -#define SQ_CF_WORD1_CF_INST_SHIFT 23 -#define SQ_CF_WORD1_WHOLE_QUAD_MODE_SHIFT 30 -#define SQ_CF_WORD1_BARRIER_SHIFT 31 - -#define SQ_CF_WORD1_POP_COUNT_MASK 0x00000007 -#define SQ_CF_WORD1_CF_CONST_MASK 0x000000f8 -#define SQ_CF_WORD1_COND_MASK 0x00000300 -#define SQ_CF_WORD1_COUNT_MASK 0x00001c00 -#define SQ_CF_WORD1_CALL_COUNT_MASK 0x0007e000 -#define SQ_CF_WORD1_COUNT_3_MASK 0x00080000 -#define SQ_CF_WORD1_END_OF_PROGRAM_MASK 0x00200000 -#define SQ_CF_WORD1_VALID_PIXEL_MODE_MASK 0x00400000 -#define SQ_CF_WORD1_CF_INST_MASK 0x3f800000 -#define SQ_CF_WORD1_WHOLE_QUAD_MODE_MASK 0x40000000 -#define SQ_CF_WORD1_BARRIER_MASK 0x80000000 - -#define SQ_CF_WORD1_MASK \ - (SQ_CF_WORD1_POP_COUNT_MASK | \ - SQ_CF_WORD1_CF_CONST_MASK | \ - SQ_CF_WORD1_COND_MASK | \ - SQ_CF_WORD1_COUNT_MASK | \ - SQ_CF_WORD1_CALL_COUNT_MASK | \ - SQ_CF_WORD1_COUNT_3_MASK | \ - SQ_CF_WORD1_END_OF_PROGRAM_MASK | \ - SQ_CF_WORD1_VALID_PIXEL_MODE_MASK | \ - SQ_CF_WORD1_CF_INST_MASK | \ - SQ_CF_WORD1_WHOLE_QUAD_MODE_MASK | \ - SQ_CF_WORD1_BARRIER_MASK) - -#define SQ_CF_WORD1_DEFAULT 0xcdcdcdcd - -#define SQ_CF_WORD1_GET_POP_COUNT(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_POP_COUNT_MASK) >> SQ_CF_WORD1_POP_COUNT_SHIFT) -#define SQ_CF_WORD1_GET_CF_CONST(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_CF_CONST_MASK) >> SQ_CF_WORD1_CF_CONST_SHIFT) -#define SQ_CF_WORD1_GET_COND(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_COND_MASK) >> SQ_CF_WORD1_COND_SHIFT) -#define SQ_CF_WORD1_GET_COUNT(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_COUNT_MASK) >> SQ_CF_WORD1_COUNT_SHIFT) -#define SQ_CF_WORD1_GET_CALL_COUNT(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_CALL_COUNT_MASK) >> SQ_CF_WORD1_CALL_COUNT_SHIFT) -#define SQ_CF_WORD1_GET_COUNT_3(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_COUNT_3_MASK) >> SQ_CF_WORD1_COUNT_3_SHIFT) -#define SQ_CF_WORD1_GET_END_OF_PROGRAM(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_END_OF_PROGRAM_MASK) >> SQ_CF_WORD1_END_OF_PROGRAM_SHIFT) -#define SQ_CF_WORD1_GET_VALID_PIXEL_MODE(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_VALID_PIXEL_MODE_MASK) >> SQ_CF_WORD1_VALID_PIXEL_MODE_SHIFT) -#define SQ_CF_WORD1_GET_CF_INST(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_CF_INST_MASK) >> SQ_CF_WORD1_CF_INST_SHIFT) -#define SQ_CF_WORD1_GET_WHOLE_QUAD_MODE(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_WHOLE_QUAD_MODE_MASK) >> SQ_CF_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_WORD1_GET_BARRIER(sq_cf_word1) \ - ((sq_cf_word1 & SQ_CF_WORD1_BARRIER_MASK) >> SQ_CF_WORD1_BARRIER_SHIFT) - -#define SQ_CF_WORD1_SET_POP_COUNT(sq_cf_word1_reg, pop_count) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_POP_COUNT_MASK) | (pop_count << SQ_CF_WORD1_POP_COUNT_SHIFT) -#define SQ_CF_WORD1_SET_CF_CONST(sq_cf_word1_reg, cf_const) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_CF_CONST_MASK) | (cf_const << SQ_CF_WORD1_CF_CONST_SHIFT) -#define SQ_CF_WORD1_SET_COND(sq_cf_word1_reg, cond) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_COND_MASK) | (cond << SQ_CF_WORD1_COND_SHIFT) -#define SQ_CF_WORD1_SET_COUNT(sq_cf_word1_reg, count) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_COUNT_MASK) | (count << SQ_CF_WORD1_COUNT_SHIFT) -#define SQ_CF_WORD1_SET_CALL_COUNT(sq_cf_word1_reg, call_count) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_CALL_COUNT_MASK) | (call_count << SQ_CF_WORD1_CALL_COUNT_SHIFT) -#define SQ_CF_WORD1_SET_COUNT_3(sq_cf_word1_reg, count_3) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_COUNT_3_MASK) | (count_3 << SQ_CF_WORD1_COUNT_3_SHIFT) -#define SQ_CF_WORD1_SET_END_OF_PROGRAM(sq_cf_word1_reg, end_of_program) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_END_OF_PROGRAM_MASK) | (end_of_program << SQ_CF_WORD1_END_OF_PROGRAM_SHIFT) -#define SQ_CF_WORD1_SET_VALID_PIXEL_MODE(sq_cf_word1_reg, valid_pixel_mode) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_VALID_PIXEL_MODE_MASK) | (valid_pixel_mode << SQ_CF_WORD1_VALID_PIXEL_MODE_SHIFT) -#define SQ_CF_WORD1_SET_CF_INST(sq_cf_word1_reg, cf_inst) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_CF_INST_MASK) | (cf_inst << SQ_CF_WORD1_CF_INST_SHIFT) -#define SQ_CF_WORD1_SET_WHOLE_QUAD_MODE(sq_cf_word1_reg, whole_quad_mode) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_WHOLE_QUAD_MODE_MASK) | (whole_quad_mode << SQ_CF_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_WORD1_SET_BARRIER(sq_cf_word1_reg, barrier) \ - sq_cf_word1_reg = (sq_cf_word1_reg & ~SQ_CF_WORD1_BARRIER_MASK) | (barrier << SQ_CF_WORD1_BARRIER_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_word1_t { - unsigned int pop_count : SQ_CF_WORD1_POP_COUNT_SIZE; - unsigned int cf_const : SQ_CF_WORD1_CF_CONST_SIZE; - unsigned int cond : SQ_CF_WORD1_COND_SIZE; - unsigned int count : SQ_CF_WORD1_COUNT_SIZE; - unsigned int call_count : SQ_CF_WORD1_CALL_COUNT_SIZE; - unsigned int count_3 : SQ_CF_WORD1_COUNT_3_SIZE; - unsigned int : 1; - unsigned int end_of_program : SQ_CF_WORD1_END_OF_PROGRAM_SIZE; - unsigned int valid_pixel_mode : SQ_CF_WORD1_VALID_PIXEL_MODE_SIZE; - unsigned int cf_inst : SQ_CF_WORD1_CF_INST_SIZE; - unsigned int whole_quad_mode : SQ_CF_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int barrier : SQ_CF_WORD1_BARRIER_SIZE; - } sq_cf_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_word1_t { - unsigned int barrier : SQ_CF_WORD1_BARRIER_SIZE; - unsigned int whole_quad_mode : SQ_CF_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int cf_inst : SQ_CF_WORD1_CF_INST_SIZE; - unsigned int valid_pixel_mode : SQ_CF_WORD1_VALID_PIXEL_MODE_SIZE; - unsigned int end_of_program : SQ_CF_WORD1_END_OF_PROGRAM_SIZE; - unsigned int : 1; - unsigned int count_3 : SQ_CF_WORD1_COUNT_3_SIZE; - unsigned int call_count : SQ_CF_WORD1_CALL_COUNT_SIZE; - unsigned int count : SQ_CF_WORD1_COUNT_SIZE; - unsigned int cond : SQ_CF_WORD1_COND_SIZE; - unsigned int cf_const : SQ_CF_WORD1_CF_CONST_SIZE; - unsigned int pop_count : SQ_CF_WORD1_POP_COUNT_SIZE; - } sq_cf_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_word1_t f; -} sq_cf_word1_u; - - -/* - * SQ_CF_ALU_WORD0 struct - */ - -#define SQ_CF_ALU_WORD0_ADDR_SIZE 22 -#define SQ_CF_ALU_WORD0_KCACHE_BANK0_SIZE 4 -#define SQ_CF_ALU_WORD0_KCACHE_BANK1_SIZE 4 -#define SQ_CF_ALU_WORD0_KCACHE_MODE0_SIZE 2 - -#define SQ_CF_ALU_WORD0_ADDR_SHIFT 0 -#define SQ_CF_ALU_WORD0_KCACHE_BANK0_SHIFT 22 -#define SQ_CF_ALU_WORD0_KCACHE_BANK1_SHIFT 26 -#define SQ_CF_ALU_WORD0_KCACHE_MODE0_SHIFT 30 - -#define SQ_CF_ALU_WORD0_ADDR_MASK 0x003fffff -#define SQ_CF_ALU_WORD0_KCACHE_BANK0_MASK 0x03c00000 -#define SQ_CF_ALU_WORD0_KCACHE_BANK1_MASK 0x3c000000 -#define SQ_CF_ALU_WORD0_KCACHE_MODE0_MASK 0xc0000000 - -#define SQ_CF_ALU_WORD0_MASK \ - (SQ_CF_ALU_WORD0_ADDR_MASK | \ - SQ_CF_ALU_WORD0_KCACHE_BANK0_MASK | \ - SQ_CF_ALU_WORD0_KCACHE_BANK1_MASK | \ - SQ_CF_ALU_WORD0_KCACHE_MODE0_MASK) - -#define SQ_CF_ALU_WORD0_DEFAULT 0xcdcdcdcd - -#define SQ_CF_ALU_WORD0_GET_ADDR(sq_cf_alu_word0) \ - ((sq_cf_alu_word0 & SQ_CF_ALU_WORD0_ADDR_MASK) >> SQ_CF_ALU_WORD0_ADDR_SHIFT) -#define SQ_CF_ALU_WORD0_GET_KCACHE_BANK0(sq_cf_alu_word0) \ - ((sq_cf_alu_word0 & SQ_CF_ALU_WORD0_KCACHE_BANK0_MASK) >> SQ_CF_ALU_WORD0_KCACHE_BANK0_SHIFT) -#define SQ_CF_ALU_WORD0_GET_KCACHE_BANK1(sq_cf_alu_word0) \ - ((sq_cf_alu_word0 & SQ_CF_ALU_WORD0_KCACHE_BANK1_MASK) >> SQ_CF_ALU_WORD0_KCACHE_BANK1_SHIFT) -#define SQ_CF_ALU_WORD0_GET_KCACHE_MODE0(sq_cf_alu_word0) \ - ((sq_cf_alu_word0 & SQ_CF_ALU_WORD0_KCACHE_MODE0_MASK) >> SQ_CF_ALU_WORD0_KCACHE_MODE0_SHIFT) - -#define SQ_CF_ALU_WORD0_SET_ADDR(sq_cf_alu_word0_reg, addr) \ - sq_cf_alu_word0_reg = (sq_cf_alu_word0_reg & ~SQ_CF_ALU_WORD0_ADDR_MASK) | (addr << SQ_CF_ALU_WORD0_ADDR_SHIFT) -#define SQ_CF_ALU_WORD0_SET_KCACHE_BANK0(sq_cf_alu_word0_reg, kcache_bank0) \ - sq_cf_alu_word0_reg = (sq_cf_alu_word0_reg & ~SQ_CF_ALU_WORD0_KCACHE_BANK0_MASK) | (kcache_bank0 << SQ_CF_ALU_WORD0_KCACHE_BANK0_SHIFT) -#define SQ_CF_ALU_WORD0_SET_KCACHE_BANK1(sq_cf_alu_word0_reg, kcache_bank1) \ - sq_cf_alu_word0_reg = (sq_cf_alu_word0_reg & ~SQ_CF_ALU_WORD0_KCACHE_BANK1_MASK) | (kcache_bank1 << SQ_CF_ALU_WORD0_KCACHE_BANK1_SHIFT) -#define SQ_CF_ALU_WORD0_SET_KCACHE_MODE0(sq_cf_alu_word0_reg, kcache_mode0) \ - sq_cf_alu_word0_reg = (sq_cf_alu_word0_reg & ~SQ_CF_ALU_WORD0_KCACHE_MODE0_MASK) | (kcache_mode0 << SQ_CF_ALU_WORD0_KCACHE_MODE0_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alu_word0_t { - unsigned int addr : SQ_CF_ALU_WORD0_ADDR_SIZE; - unsigned int kcache_bank0 : SQ_CF_ALU_WORD0_KCACHE_BANK0_SIZE; - unsigned int kcache_bank1 : SQ_CF_ALU_WORD0_KCACHE_BANK1_SIZE; - unsigned int kcache_mode0 : SQ_CF_ALU_WORD0_KCACHE_MODE0_SIZE; - } sq_cf_alu_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alu_word0_t { - unsigned int kcache_mode0 : SQ_CF_ALU_WORD0_KCACHE_MODE0_SIZE; - unsigned int kcache_bank1 : SQ_CF_ALU_WORD0_KCACHE_BANK1_SIZE; - unsigned int kcache_bank0 : SQ_CF_ALU_WORD0_KCACHE_BANK0_SIZE; - unsigned int addr : SQ_CF_ALU_WORD0_ADDR_SIZE; - } sq_cf_alu_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alu_word0_t f; -} sq_cf_alu_word0_u; - - -/* - * SQ_CF_ALU_WORD1 struct - */ - -#define SQ_CF_ALU_WORD1_KCACHE_MODE1_SIZE 2 -#define SQ_CF_ALU_WORD1_KCACHE_ADDR0_SIZE 8 -#define SQ_CF_ALU_WORD1_KCACHE_ADDR1_SIZE 8 -#define SQ_CF_ALU_WORD1_COUNT_SIZE 7 -#define SQ_CF_ALU_WORD1_ALT_CONST_SIZE 1 -#define SQ_CF_ALU_WORD1_CF_INST_SIZE 4 -#define SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SIZE 1 -#define SQ_CF_ALU_WORD1_BARRIER_SIZE 1 - -#define SQ_CF_ALU_WORD1_KCACHE_MODE1_SHIFT 0 -#define SQ_CF_ALU_WORD1_KCACHE_ADDR0_SHIFT 2 -#define SQ_CF_ALU_WORD1_KCACHE_ADDR1_SHIFT 10 -#define SQ_CF_ALU_WORD1_COUNT_SHIFT 18 -#define SQ_CF_ALU_WORD1_ALT_CONST_SHIFT 25 -#define SQ_CF_ALU_WORD1_CF_INST_SHIFT 26 -#define SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SHIFT 30 -#define SQ_CF_ALU_WORD1_BARRIER_SHIFT 31 - -#define SQ_CF_ALU_WORD1_KCACHE_MODE1_MASK 0x00000003 -#define SQ_CF_ALU_WORD1_KCACHE_ADDR0_MASK 0x000003fc -#define SQ_CF_ALU_WORD1_KCACHE_ADDR1_MASK 0x0003fc00 -#define SQ_CF_ALU_WORD1_COUNT_MASK 0x01fc0000 -#define SQ_CF_ALU_WORD1_ALT_CONST_MASK 0x02000000 -#define SQ_CF_ALU_WORD1_CF_INST_MASK 0x3c000000 -#define SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_MASK 0x40000000 -#define SQ_CF_ALU_WORD1_BARRIER_MASK 0x80000000 - -#define SQ_CF_ALU_WORD1_MASK \ - (SQ_CF_ALU_WORD1_KCACHE_MODE1_MASK | \ - SQ_CF_ALU_WORD1_KCACHE_ADDR0_MASK | \ - SQ_CF_ALU_WORD1_KCACHE_ADDR1_MASK | \ - SQ_CF_ALU_WORD1_COUNT_MASK | \ - SQ_CF_ALU_WORD1_ALT_CONST_MASK | \ - SQ_CF_ALU_WORD1_CF_INST_MASK | \ - SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_MASK | \ - SQ_CF_ALU_WORD1_BARRIER_MASK) - -#define SQ_CF_ALU_WORD1_DEFAULT 0xcdcdcdcd - -#define SQ_CF_ALU_WORD1_GET_KCACHE_MODE1(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_KCACHE_MODE1_MASK) >> SQ_CF_ALU_WORD1_KCACHE_MODE1_SHIFT) -#define SQ_CF_ALU_WORD1_GET_KCACHE_ADDR0(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_KCACHE_ADDR0_MASK) >> SQ_CF_ALU_WORD1_KCACHE_ADDR0_SHIFT) -#define SQ_CF_ALU_WORD1_GET_KCACHE_ADDR1(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_KCACHE_ADDR1_MASK) >> SQ_CF_ALU_WORD1_KCACHE_ADDR1_SHIFT) -#define SQ_CF_ALU_WORD1_GET_COUNT(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_COUNT_MASK) >> SQ_CF_ALU_WORD1_COUNT_SHIFT) -#define SQ_CF_ALU_WORD1_GET_ALT_CONST(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_ALT_CONST_MASK) >> SQ_CF_ALU_WORD1_ALT_CONST_SHIFT) -#define SQ_CF_ALU_WORD1_GET_CF_INST(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_CF_INST_MASK) >> SQ_CF_ALU_WORD1_CF_INST_SHIFT) -#define SQ_CF_ALU_WORD1_GET_WHOLE_QUAD_MODE(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_MASK) >> SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_ALU_WORD1_GET_BARRIER(sq_cf_alu_word1) \ - ((sq_cf_alu_word1 & SQ_CF_ALU_WORD1_BARRIER_MASK) >> SQ_CF_ALU_WORD1_BARRIER_SHIFT) - -#define SQ_CF_ALU_WORD1_SET_KCACHE_MODE1(sq_cf_alu_word1_reg, kcache_mode1) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_KCACHE_MODE1_MASK) | (kcache_mode1 << SQ_CF_ALU_WORD1_KCACHE_MODE1_SHIFT) -#define SQ_CF_ALU_WORD1_SET_KCACHE_ADDR0(sq_cf_alu_word1_reg, kcache_addr0) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_KCACHE_ADDR0_MASK) | (kcache_addr0 << SQ_CF_ALU_WORD1_KCACHE_ADDR0_SHIFT) -#define SQ_CF_ALU_WORD1_SET_KCACHE_ADDR1(sq_cf_alu_word1_reg, kcache_addr1) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_KCACHE_ADDR1_MASK) | (kcache_addr1 << SQ_CF_ALU_WORD1_KCACHE_ADDR1_SHIFT) -#define SQ_CF_ALU_WORD1_SET_COUNT(sq_cf_alu_word1_reg, count) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_COUNT_MASK) | (count << SQ_CF_ALU_WORD1_COUNT_SHIFT) -#define SQ_CF_ALU_WORD1_SET_ALT_CONST(sq_cf_alu_word1_reg, alt_const) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_ALT_CONST_MASK) | (alt_const << SQ_CF_ALU_WORD1_ALT_CONST_SHIFT) -#define SQ_CF_ALU_WORD1_SET_CF_INST(sq_cf_alu_word1_reg, cf_inst) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_CF_INST_MASK) | (cf_inst << SQ_CF_ALU_WORD1_CF_INST_SHIFT) -#define SQ_CF_ALU_WORD1_SET_WHOLE_QUAD_MODE(sq_cf_alu_word1_reg, whole_quad_mode) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_MASK) | (whole_quad_mode << SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_ALU_WORD1_SET_BARRIER(sq_cf_alu_word1_reg, barrier) \ - sq_cf_alu_word1_reg = (sq_cf_alu_word1_reg & ~SQ_CF_ALU_WORD1_BARRIER_MASK) | (barrier << SQ_CF_ALU_WORD1_BARRIER_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alu_word1_t { - unsigned int kcache_mode1 : SQ_CF_ALU_WORD1_KCACHE_MODE1_SIZE; - unsigned int kcache_addr0 : SQ_CF_ALU_WORD1_KCACHE_ADDR0_SIZE; - unsigned int kcache_addr1 : SQ_CF_ALU_WORD1_KCACHE_ADDR1_SIZE; - unsigned int count : SQ_CF_ALU_WORD1_COUNT_SIZE; - unsigned int alt_const : SQ_CF_ALU_WORD1_ALT_CONST_SIZE; - unsigned int cf_inst : SQ_CF_ALU_WORD1_CF_INST_SIZE; - unsigned int whole_quad_mode : SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int barrier : SQ_CF_ALU_WORD1_BARRIER_SIZE; - } sq_cf_alu_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alu_word1_t { - unsigned int barrier : SQ_CF_ALU_WORD1_BARRIER_SIZE; - unsigned int whole_quad_mode : SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int cf_inst : SQ_CF_ALU_WORD1_CF_INST_SIZE; - unsigned int alt_const : SQ_CF_ALU_WORD1_ALT_CONST_SIZE; - unsigned int count : SQ_CF_ALU_WORD1_COUNT_SIZE; - unsigned int kcache_addr1 : SQ_CF_ALU_WORD1_KCACHE_ADDR1_SIZE; - unsigned int kcache_addr0 : SQ_CF_ALU_WORD1_KCACHE_ADDR0_SIZE; - unsigned int kcache_mode1 : SQ_CF_ALU_WORD1_KCACHE_MODE1_SIZE; - } sq_cf_alu_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alu_word1_t f; -} sq_cf_alu_word1_u; - - -/* - * SQ_CF_ALLOC_EXPORT_WORD0 struct - */ - -#define SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SIZE 13 -#define SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SIZE 2 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SIZE 7 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SIZE 1 -#define SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SIZE 7 -#define SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SIZE 2 - -#define SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SHIFT 0 -#define SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SHIFT 13 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SHIFT 15 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SHIFT 22 -#define SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SHIFT 23 -#define SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SHIFT 30 - -#define SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_MASK 0x00001fff -#define SQ_CF_ALLOC_EXPORT_WORD0_TYPE_MASK 0x00006000 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_MASK 0x003f8000 -#define SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_MASK 0x00400000 -#define SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_MASK 0x3f800000 -#define SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_MASK 0xc0000000 - -#define SQ_CF_ALLOC_EXPORT_WORD0_MASK \ - (SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD0_TYPE_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_MASK) - -#define SQ_CF_ALLOC_EXPORT_WORD0_DEFAULT 0xcdcdcdcd - -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_ARRAY_BASE(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_TYPE(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_TYPE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_RW_GPR(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_RW_REL(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_INDEX_GPR(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_GET_ELEM_SIZE(sq_cf_alloc_export_word0) \ - ((sq_cf_alloc_export_word0 & SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SHIFT) - -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_ARRAY_BASE(sq_cf_alloc_export_word0_reg, array_base) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_MASK) | (array_base << SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_TYPE(sq_cf_alloc_export_word0_reg, type) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_TYPE_MASK) | (type << SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_RW_GPR(sq_cf_alloc_export_word0_reg, rw_gpr) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_MASK) | (rw_gpr << SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_RW_REL(sq_cf_alloc_export_word0_reg, rw_rel) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_MASK) | (rw_rel << SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_INDEX_GPR(sq_cf_alloc_export_word0_reg, index_gpr) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_MASK) | (index_gpr << SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD0_SET_ELEM_SIZE(sq_cf_alloc_export_word0_reg, elem_size) \ - sq_cf_alloc_export_word0_reg = (sq_cf_alloc_export_word0_reg & ~SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_MASK) | (elem_size << SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word0_t { - unsigned int array_base : SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SIZE; - unsigned int type : SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SIZE; - unsigned int rw_gpr : SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SIZE; - unsigned int rw_rel : SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SIZE; - unsigned int index_gpr : SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SIZE; - unsigned int elem_size : SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SIZE; - } sq_cf_alloc_export_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word0_t { - unsigned int elem_size : SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE_SIZE; - unsigned int index_gpr : SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR_SIZE; - unsigned int rw_rel : SQ_CF_ALLOC_EXPORT_WORD0_RW_REL_SIZE; - unsigned int rw_gpr : SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR_SIZE; - unsigned int type : SQ_CF_ALLOC_EXPORT_WORD0_TYPE_SIZE; - unsigned int array_base : SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE_SIZE; - } sq_cf_alloc_export_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alloc_export_word0_t f; -} sq_cf_alloc_export_word0_u; - - -/* - * SQ_CF_ALLOC_EXPORT_WORD1 struct - */ - -#define SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SIZE 4 -#define SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SIZE 1 -#define SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SIZE 1 -#define SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SIZE 7 -#define SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SIZE 1 -#define SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SIZE 1 - -#define SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SHIFT 17 -#define SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SHIFT 21 -#define SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SHIFT 22 -#define SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SHIFT 23 -#define SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SHIFT 30 -#define SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SHIFT 31 - -#define SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_MASK 0x001e0000 -#define SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_MASK 0x00200000 -#define SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_MASK 0x00400000 -#define SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_MASK 0x3f800000 -#define SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_MASK 0x40000000 -#define SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_MASK 0x80000000 - -#define SQ_CF_ALLOC_EXPORT_WORD1_MASK \ - (SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_MASK) - -#define SQ_CF_ALLOC_EXPORT_WORD1_DEFAULT 0xcdcc0000 - -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_BURST_COUNT(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_END_OF_PROGRAM(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_VALID_PIXEL_MODE(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_CF_INST(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_WHOLE_QUAD_MODE(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_GET_BARRIER(sq_cf_alloc_export_word1) \ - ((sq_cf_alloc_export_word1 & SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SHIFT) - -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_BURST_COUNT(sq_cf_alloc_export_word1_reg, burst_count) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_MASK) | (burst_count << SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_END_OF_PROGRAM(sq_cf_alloc_export_word1_reg, end_of_program) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_MASK) | (end_of_program << SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_VALID_PIXEL_MODE(sq_cf_alloc_export_word1_reg, valid_pixel_mode) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_MASK) | (valid_pixel_mode << SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_CF_INST(sq_cf_alloc_export_word1_reg, cf_inst) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_MASK) | (cf_inst << SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_WHOLE_QUAD_MODE(sq_cf_alloc_export_word1_reg, whole_quad_mode) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_MASK) | (whole_quad_mode << SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SET_BARRIER(sq_cf_alloc_export_word1_reg, barrier) \ - sq_cf_alloc_export_word1_reg = (sq_cf_alloc_export_word1_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_MASK) | (barrier << SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_t { - unsigned int : 17; - unsigned int burst_count : SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SIZE; - unsigned int end_of_program : SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SIZE; - unsigned int valid_pixel_mode : SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SIZE; - unsigned int cf_inst : SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SIZE; - unsigned int whole_quad_mode : SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int barrier : SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SIZE; - } sq_cf_alloc_export_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_t { - unsigned int barrier : SQ_CF_ALLOC_EXPORT_WORD1_BARRIER_SIZE; - unsigned int whole_quad_mode : SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE_SIZE; - unsigned int cf_inst : SQ_CF_ALLOC_EXPORT_WORD1_CF_INST_SIZE; - unsigned int valid_pixel_mode : SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE_SIZE; - unsigned int end_of_program : SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM_SIZE; - unsigned int burst_count : SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT_SIZE; - unsigned int : 17; - } sq_cf_alloc_export_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alloc_export_word1_t f; -} sq_cf_alloc_export_word1_u; - - -/* - * SQ_CF_ALLOC_EXPORT_WORD1_BUF struct - */ - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SIZE 12 -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SIZE 4 - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SHIFT 0 -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SHIFT 12 - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_MASK 0x00000fff -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_MASK 0x0000f000 - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_MASK \ - (SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_MASK) - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_DEFAULT 0x0000cdcd - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_GET_ARRAY_SIZE(sq_cf_alloc_export_word1_buf) \ - ((sq_cf_alloc_export_word1_buf & SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_GET_COMP_MASK(sq_cf_alloc_export_word1_buf) \ - ((sq_cf_alloc_export_word1_buf & SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SHIFT) - -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_SET_ARRAY_SIZE(sq_cf_alloc_export_word1_buf_reg, array_size) \ - sq_cf_alloc_export_word1_buf_reg = (sq_cf_alloc_export_word1_buf_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_MASK) | (array_size << SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_BUF_SET_COMP_MASK(sq_cf_alloc_export_word1_buf_reg, comp_mask) \ - sq_cf_alloc_export_word1_buf_reg = (sq_cf_alloc_export_word1_buf_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_MASK) | (comp_mask << SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_buf_t { - unsigned int array_size : SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SIZE; - unsigned int comp_mask : SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SIZE; - unsigned int : 16; - } sq_cf_alloc_export_word1_buf_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_buf_t { - unsigned int : 16; - unsigned int comp_mask : SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK_SIZE; - unsigned int array_size : SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE_SIZE; - } sq_cf_alloc_export_word1_buf_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alloc_export_word1_buf_t f; -} sq_cf_alloc_export_word1_buf_u; - - -/* - * SQ_CF_ALLOC_EXPORT_WORD1_SWIZ struct - */ - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SIZE 3 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SIZE 3 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SIZE 3 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SIZE 3 - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SHIFT 0 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SHIFT 3 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SHIFT 6 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SHIFT 9 - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_MASK 0x00000007 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_MASK 0x00000038 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_MASK 0x000001c0 -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_MASK 0x00000e00 - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_MASK \ - (SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_MASK | \ - SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_MASK) - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_DEFAULT 0x00000dcd - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_GET_SEL_X(sq_cf_alloc_export_word1_swiz) \ - ((sq_cf_alloc_export_word1_swiz & SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_GET_SEL_Y(sq_cf_alloc_export_word1_swiz) \ - ((sq_cf_alloc_export_word1_swiz & SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_GET_SEL_Z(sq_cf_alloc_export_word1_swiz) \ - ((sq_cf_alloc_export_word1_swiz & SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_GET_SEL_W(sq_cf_alloc_export_word1_swiz) \ - ((sq_cf_alloc_export_word1_swiz & SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_MASK) >> SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SHIFT) - -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SET_SEL_X(sq_cf_alloc_export_word1_swiz_reg, sel_x) \ - sq_cf_alloc_export_word1_swiz_reg = (sq_cf_alloc_export_word1_swiz_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_MASK) | (sel_x << SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SET_SEL_Y(sq_cf_alloc_export_word1_swiz_reg, sel_y) \ - sq_cf_alloc_export_word1_swiz_reg = (sq_cf_alloc_export_word1_swiz_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_MASK) | (sel_y << SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SET_SEL_Z(sq_cf_alloc_export_word1_swiz_reg, sel_z) \ - sq_cf_alloc_export_word1_swiz_reg = (sq_cf_alloc_export_word1_swiz_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_MASK) | (sel_z << SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SHIFT) -#define SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SET_SEL_W(sq_cf_alloc_export_word1_swiz_reg, sel_w) \ - sq_cf_alloc_export_word1_swiz_reg = (sq_cf_alloc_export_word1_swiz_reg & ~SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_MASK) | (sel_w << SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_swiz_t { - unsigned int sel_x : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SIZE; - unsigned int sel_y : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SIZE; - unsigned int sel_z : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SIZE; - unsigned int sel_w : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SIZE; - unsigned int : 20; - } sq_cf_alloc_export_word1_swiz_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_cf_alloc_export_word1_swiz_t { - unsigned int : 20; - unsigned int sel_w : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W_SIZE; - unsigned int sel_z : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z_SIZE; - unsigned int sel_y : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y_SIZE; - unsigned int sel_x : SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X_SIZE; - } sq_cf_alloc_export_word1_swiz_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_cf_alloc_export_word1_swiz_t f; -} sq_cf_alloc_export_word1_swiz_u; - - -/* - * SQ_ALU_WORD0 struct - */ - -#define SQ_ALU_WORD0_SRC0_SEL_SIZE 9 -#define SQ_ALU_WORD0_SRC0_REL_SIZE 1 -#define SQ_ALU_WORD0_SRC0_CHAN_SIZE 2 -#define SQ_ALU_WORD0_SRC0_NEG_SIZE 1 -#define SQ_ALU_WORD0_SRC1_SEL_SIZE 9 -#define SQ_ALU_WORD0_SRC1_REL_SIZE 1 -#define SQ_ALU_WORD0_SRC1_CHAN_SIZE 2 -#define SQ_ALU_WORD0_SRC1_NEG_SIZE 1 -#define SQ_ALU_WORD0_INDEX_MODE_SIZE 3 -#define SQ_ALU_WORD0_PRED_SEL_SIZE 2 -#define SQ_ALU_WORD0_LAST_SIZE 1 - -#define SQ_ALU_WORD0_SRC0_SEL_SHIFT 0 -#define SQ_ALU_WORD0_SRC0_REL_SHIFT 9 -#define SQ_ALU_WORD0_SRC0_CHAN_SHIFT 10 -#define SQ_ALU_WORD0_SRC0_NEG_SHIFT 12 -#define SQ_ALU_WORD0_SRC1_SEL_SHIFT 13 -#define SQ_ALU_WORD0_SRC1_REL_SHIFT 22 -#define SQ_ALU_WORD0_SRC1_CHAN_SHIFT 23 -#define SQ_ALU_WORD0_SRC1_NEG_SHIFT 25 -#define SQ_ALU_WORD0_INDEX_MODE_SHIFT 26 -#define SQ_ALU_WORD0_PRED_SEL_SHIFT 29 -#define SQ_ALU_WORD0_LAST_SHIFT 31 - -#define SQ_ALU_WORD0_SRC0_SEL_MASK 0x000001ff -#define SQ_ALU_WORD0_SRC0_REL_MASK 0x00000200 -#define SQ_ALU_WORD0_SRC0_CHAN_MASK 0x00000c00 -#define SQ_ALU_WORD0_SRC0_NEG_MASK 0x00001000 -#define SQ_ALU_WORD0_SRC1_SEL_MASK 0x003fe000 -#define SQ_ALU_WORD0_SRC1_REL_MASK 0x00400000 -#define SQ_ALU_WORD0_SRC1_CHAN_MASK 0x01800000 -#define SQ_ALU_WORD0_SRC1_NEG_MASK 0x02000000 -#define SQ_ALU_WORD0_INDEX_MODE_MASK 0x1c000000 -#define SQ_ALU_WORD0_PRED_SEL_MASK 0x60000000 -#define SQ_ALU_WORD0_LAST_MASK 0x80000000 - -#define SQ_ALU_WORD0_MASK \ - (SQ_ALU_WORD0_SRC0_SEL_MASK | \ - SQ_ALU_WORD0_SRC0_REL_MASK | \ - SQ_ALU_WORD0_SRC0_CHAN_MASK | \ - SQ_ALU_WORD0_SRC0_NEG_MASK | \ - SQ_ALU_WORD0_SRC1_SEL_MASK | \ - SQ_ALU_WORD0_SRC1_REL_MASK | \ - SQ_ALU_WORD0_SRC1_CHAN_MASK | \ - SQ_ALU_WORD0_SRC1_NEG_MASK | \ - SQ_ALU_WORD0_INDEX_MODE_MASK | \ - SQ_ALU_WORD0_PRED_SEL_MASK | \ - SQ_ALU_WORD0_LAST_MASK) - -#define SQ_ALU_WORD0_DEFAULT 0xcdcdcdcd - -#define SQ_ALU_WORD0_GET_SRC0_SEL(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC0_SEL_MASK) >> SQ_ALU_WORD0_SRC0_SEL_SHIFT) -#define SQ_ALU_WORD0_GET_SRC0_REL(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC0_REL_MASK) >> SQ_ALU_WORD0_SRC0_REL_SHIFT) -#define SQ_ALU_WORD0_GET_SRC0_CHAN(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC0_CHAN_MASK) >> SQ_ALU_WORD0_SRC0_CHAN_SHIFT) -#define SQ_ALU_WORD0_GET_SRC0_NEG(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC0_NEG_MASK) >> SQ_ALU_WORD0_SRC0_NEG_SHIFT) -#define SQ_ALU_WORD0_GET_SRC1_SEL(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC1_SEL_MASK) >> SQ_ALU_WORD0_SRC1_SEL_SHIFT) -#define SQ_ALU_WORD0_GET_SRC1_REL(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC1_REL_MASK) >> SQ_ALU_WORD0_SRC1_REL_SHIFT) -#define SQ_ALU_WORD0_GET_SRC1_CHAN(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC1_CHAN_MASK) >> SQ_ALU_WORD0_SRC1_CHAN_SHIFT) -#define SQ_ALU_WORD0_GET_SRC1_NEG(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_SRC1_NEG_MASK) >> SQ_ALU_WORD0_SRC1_NEG_SHIFT) -#define SQ_ALU_WORD0_GET_INDEX_MODE(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_INDEX_MODE_MASK) >> SQ_ALU_WORD0_INDEX_MODE_SHIFT) -#define SQ_ALU_WORD0_GET_PRED_SEL(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_PRED_SEL_MASK) >> SQ_ALU_WORD0_PRED_SEL_SHIFT) -#define SQ_ALU_WORD0_GET_LAST(sq_alu_word0) \ - ((sq_alu_word0 & SQ_ALU_WORD0_LAST_MASK) >> SQ_ALU_WORD0_LAST_SHIFT) - -#define SQ_ALU_WORD0_SET_SRC0_SEL(sq_alu_word0_reg, src0_sel) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC0_SEL_MASK) | (src0_sel << SQ_ALU_WORD0_SRC0_SEL_SHIFT) -#define SQ_ALU_WORD0_SET_SRC0_REL(sq_alu_word0_reg, src0_rel) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC0_REL_MASK) | (src0_rel << SQ_ALU_WORD0_SRC0_REL_SHIFT) -#define SQ_ALU_WORD0_SET_SRC0_CHAN(sq_alu_word0_reg, src0_chan) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC0_CHAN_MASK) | (src0_chan << SQ_ALU_WORD0_SRC0_CHAN_SHIFT) -#define SQ_ALU_WORD0_SET_SRC0_NEG(sq_alu_word0_reg, src0_neg) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC0_NEG_MASK) | (src0_neg << SQ_ALU_WORD0_SRC0_NEG_SHIFT) -#define SQ_ALU_WORD0_SET_SRC1_SEL(sq_alu_word0_reg, src1_sel) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC1_SEL_MASK) | (src1_sel << SQ_ALU_WORD0_SRC1_SEL_SHIFT) -#define SQ_ALU_WORD0_SET_SRC1_REL(sq_alu_word0_reg, src1_rel) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC1_REL_MASK) | (src1_rel << SQ_ALU_WORD0_SRC1_REL_SHIFT) -#define SQ_ALU_WORD0_SET_SRC1_CHAN(sq_alu_word0_reg, src1_chan) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC1_CHAN_MASK) | (src1_chan << SQ_ALU_WORD0_SRC1_CHAN_SHIFT) -#define SQ_ALU_WORD0_SET_SRC1_NEG(sq_alu_word0_reg, src1_neg) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_SRC1_NEG_MASK) | (src1_neg << SQ_ALU_WORD0_SRC1_NEG_SHIFT) -#define SQ_ALU_WORD0_SET_INDEX_MODE(sq_alu_word0_reg, index_mode) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_INDEX_MODE_MASK) | (index_mode << SQ_ALU_WORD0_INDEX_MODE_SHIFT) -#define SQ_ALU_WORD0_SET_PRED_SEL(sq_alu_word0_reg, pred_sel) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_PRED_SEL_MASK) | (pred_sel << SQ_ALU_WORD0_PRED_SEL_SHIFT) -#define SQ_ALU_WORD0_SET_LAST(sq_alu_word0_reg, last) \ - sq_alu_word0_reg = (sq_alu_word0_reg & ~SQ_ALU_WORD0_LAST_MASK) | (last << SQ_ALU_WORD0_LAST_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_alu_word0_t { - unsigned int src0_sel : SQ_ALU_WORD0_SRC0_SEL_SIZE; - unsigned int src0_rel : SQ_ALU_WORD0_SRC0_REL_SIZE; - unsigned int src0_chan : SQ_ALU_WORD0_SRC0_CHAN_SIZE; - unsigned int src0_neg : SQ_ALU_WORD0_SRC0_NEG_SIZE; - unsigned int src1_sel : SQ_ALU_WORD0_SRC1_SEL_SIZE; - unsigned int src1_rel : SQ_ALU_WORD0_SRC1_REL_SIZE; - unsigned int src1_chan : SQ_ALU_WORD0_SRC1_CHAN_SIZE; - unsigned int src1_neg : SQ_ALU_WORD0_SRC1_NEG_SIZE; - unsigned int index_mode : SQ_ALU_WORD0_INDEX_MODE_SIZE; - unsigned int pred_sel : SQ_ALU_WORD0_PRED_SEL_SIZE; - unsigned int last : SQ_ALU_WORD0_LAST_SIZE; - } sq_alu_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_alu_word0_t { - unsigned int last : SQ_ALU_WORD0_LAST_SIZE; - unsigned int pred_sel : SQ_ALU_WORD0_PRED_SEL_SIZE; - unsigned int index_mode : SQ_ALU_WORD0_INDEX_MODE_SIZE; - unsigned int src1_neg : SQ_ALU_WORD0_SRC1_NEG_SIZE; - unsigned int src1_chan : SQ_ALU_WORD0_SRC1_CHAN_SIZE; - unsigned int src1_rel : SQ_ALU_WORD0_SRC1_REL_SIZE; - unsigned int src1_sel : SQ_ALU_WORD0_SRC1_SEL_SIZE; - unsigned int src0_neg : SQ_ALU_WORD0_SRC0_NEG_SIZE; - unsigned int src0_chan : SQ_ALU_WORD0_SRC0_CHAN_SIZE; - unsigned int src0_rel : SQ_ALU_WORD0_SRC0_REL_SIZE; - unsigned int src0_sel : SQ_ALU_WORD0_SRC0_SEL_SIZE; - } sq_alu_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_alu_word0_t f; -} sq_alu_word0_u; - - -/* - * SQ_ALU_WORD1 struct - */ - -#define SQ_ALU_WORD1_ENCODING_SIZE 3 -#define SQ_ALU_WORD1_BANK_SWIZZLE_SIZE 3 -#define SQ_ALU_WORD1_DST_GPR_SIZE 7 -#define SQ_ALU_WORD1_DST_REL_SIZE 1 -#define SQ_ALU_WORD1_DST_CHAN_SIZE 2 -#define SQ_ALU_WORD1_CLAMP_SIZE 1 - -#define SQ_ALU_WORD1_ENCODING_SHIFT 15 -#define SQ_ALU_WORD1_BANK_SWIZZLE_SHIFT 18 -#define SQ_ALU_WORD1_DST_GPR_SHIFT 21 -#define SQ_ALU_WORD1_DST_REL_SHIFT 28 -#define SQ_ALU_WORD1_DST_CHAN_SHIFT 29 -#define SQ_ALU_WORD1_CLAMP_SHIFT 31 - -#define SQ_ALU_WORD1_ENCODING_MASK 0x00038000 -#define SQ_ALU_WORD1_BANK_SWIZZLE_MASK 0x001c0000 -#define SQ_ALU_WORD1_DST_GPR_MASK 0x0fe00000 -#define SQ_ALU_WORD1_DST_REL_MASK 0x10000000 -#define SQ_ALU_WORD1_DST_CHAN_MASK 0x60000000 -#define SQ_ALU_WORD1_CLAMP_MASK 0x80000000 - -#define SQ_ALU_WORD1_MASK \ - (SQ_ALU_WORD1_ENCODING_MASK | \ - SQ_ALU_WORD1_BANK_SWIZZLE_MASK | \ - SQ_ALU_WORD1_DST_GPR_MASK | \ - SQ_ALU_WORD1_DST_REL_MASK | \ - SQ_ALU_WORD1_DST_CHAN_MASK | \ - SQ_ALU_WORD1_CLAMP_MASK) - -#define SQ_ALU_WORD1_DEFAULT 0xcdcd8000 - -#define SQ_ALU_WORD1_GET_ENCODING(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_ENCODING_MASK) >> SQ_ALU_WORD1_ENCODING_SHIFT) -#define SQ_ALU_WORD1_GET_BANK_SWIZZLE(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_BANK_SWIZZLE_MASK) >> SQ_ALU_WORD1_BANK_SWIZZLE_SHIFT) -#define SQ_ALU_WORD1_GET_DST_GPR(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_DST_GPR_MASK) >> SQ_ALU_WORD1_DST_GPR_SHIFT) -#define SQ_ALU_WORD1_GET_DST_REL(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_DST_REL_MASK) >> SQ_ALU_WORD1_DST_REL_SHIFT) -#define SQ_ALU_WORD1_GET_DST_CHAN(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_DST_CHAN_MASK) >> SQ_ALU_WORD1_DST_CHAN_SHIFT) -#define SQ_ALU_WORD1_GET_CLAMP(sq_alu_word1) \ - ((sq_alu_word1 & SQ_ALU_WORD1_CLAMP_MASK) >> SQ_ALU_WORD1_CLAMP_SHIFT) - -#define SQ_ALU_WORD1_SET_ENCODING(sq_alu_word1_reg, encoding) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_ENCODING_MASK) | (encoding << SQ_ALU_WORD1_ENCODING_SHIFT) -#define SQ_ALU_WORD1_SET_BANK_SWIZZLE(sq_alu_word1_reg, bank_swizzle) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_BANK_SWIZZLE_MASK) | (bank_swizzle << SQ_ALU_WORD1_BANK_SWIZZLE_SHIFT) -#define SQ_ALU_WORD1_SET_DST_GPR(sq_alu_word1_reg, dst_gpr) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_DST_GPR_MASK) | (dst_gpr << SQ_ALU_WORD1_DST_GPR_SHIFT) -#define SQ_ALU_WORD1_SET_DST_REL(sq_alu_word1_reg, dst_rel) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_DST_REL_MASK) | (dst_rel << SQ_ALU_WORD1_DST_REL_SHIFT) -#define SQ_ALU_WORD1_SET_DST_CHAN(sq_alu_word1_reg, dst_chan) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_DST_CHAN_MASK) | (dst_chan << SQ_ALU_WORD1_DST_CHAN_SHIFT) -#define SQ_ALU_WORD1_SET_CLAMP(sq_alu_word1_reg, clamp) \ - sq_alu_word1_reg = (sq_alu_word1_reg & ~SQ_ALU_WORD1_CLAMP_MASK) | (clamp << SQ_ALU_WORD1_CLAMP_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_alu_word1_t { - unsigned int : 15; - unsigned int encoding : SQ_ALU_WORD1_ENCODING_SIZE; - unsigned int bank_swizzle : SQ_ALU_WORD1_BANK_SWIZZLE_SIZE; - unsigned int dst_gpr : SQ_ALU_WORD1_DST_GPR_SIZE; - unsigned int dst_rel : SQ_ALU_WORD1_DST_REL_SIZE; - unsigned int dst_chan : SQ_ALU_WORD1_DST_CHAN_SIZE; - unsigned int clamp : SQ_ALU_WORD1_CLAMP_SIZE; - } sq_alu_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_alu_word1_t { - unsigned int clamp : SQ_ALU_WORD1_CLAMP_SIZE; - unsigned int dst_chan : SQ_ALU_WORD1_DST_CHAN_SIZE; - unsigned int dst_rel : SQ_ALU_WORD1_DST_REL_SIZE; - unsigned int dst_gpr : SQ_ALU_WORD1_DST_GPR_SIZE; - unsigned int bank_swizzle : SQ_ALU_WORD1_BANK_SWIZZLE_SIZE; - unsigned int encoding : SQ_ALU_WORD1_ENCODING_SIZE; - unsigned int : 15; - } sq_alu_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_alu_word1_t f; -} sq_alu_word1_u; - - -/* - * SQ_ALU_WORD1_OP2_V2 struct - */ - -#define SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SIZE 1 -#define SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SIZE 1 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SIZE 1 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SIZE 1 -#define SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SIZE 1 -#define SQ_ALU_WORD1_OP2_V2_OMOD_SIZE 2 -#define SQ_ALU_WORD1_OP2_V2_ALU_INST_SIZE 11 - -#define SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SHIFT 0 -#define SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SHIFT 1 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SHIFT 2 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SHIFT 3 -#define SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SHIFT 4 -#define SQ_ALU_WORD1_OP2_V2_OMOD_SHIFT 5 -#define SQ_ALU_WORD1_OP2_V2_ALU_INST_SHIFT 7 - -#define SQ_ALU_WORD1_OP2_V2_SRC0_ABS_MASK 0x00000001 -#define SQ_ALU_WORD1_OP2_V2_SRC1_ABS_MASK 0x00000002 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_MASK 0x00000004 -#define SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_MASK 0x00000008 -#define SQ_ALU_WORD1_OP2_V2_WRITE_MASK_MASK 0x00000010 -#define SQ_ALU_WORD1_OP2_V2_OMOD_MASK 0x00000060 -#define SQ_ALU_WORD1_OP2_V2_ALU_INST_MASK 0x0003ff80 - -#define SQ_ALU_WORD1_OP2_V2_MASK \ - (SQ_ALU_WORD1_OP2_V2_SRC0_ABS_MASK | \ - SQ_ALU_WORD1_OP2_V2_SRC1_ABS_MASK | \ - SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_MASK | \ - SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_MASK | \ - SQ_ALU_WORD1_OP2_V2_WRITE_MASK_MASK | \ - SQ_ALU_WORD1_OP2_V2_OMOD_MASK | \ - SQ_ALU_WORD1_OP2_V2_ALU_INST_MASK) - -#define SQ_ALU_WORD1_OP2_V2_DEFAULT 0x0001cdcd - -#define SQ_ALU_WORD1_OP2_V2_GET_SRC0_ABS(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_SRC0_ABS_MASK) >> SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_SRC1_ABS(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_SRC1_ABS_MASK) >> SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_UPDATE_EXECUTE_MASK(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_MASK) >> SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_UPDATE_PRED(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_MASK) >> SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_WRITE_MASK(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_WRITE_MASK_MASK) >> SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_OMOD(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_OMOD_MASK) >> SQ_ALU_WORD1_OP2_V2_OMOD_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_GET_ALU_INST(sq_alu_word1_op2_v2) \ - ((sq_alu_word1_op2_v2 & SQ_ALU_WORD1_OP2_V2_ALU_INST_MASK) >> SQ_ALU_WORD1_OP2_V2_ALU_INST_SHIFT) - -#define SQ_ALU_WORD1_OP2_V2_SET_SRC0_ABS(sq_alu_word1_op2_v2_reg, src0_abs) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_SRC0_ABS_MASK) | (src0_abs << SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_SRC1_ABS(sq_alu_word1_op2_v2_reg, src1_abs) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_SRC1_ABS_MASK) | (src1_abs << SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_UPDATE_EXECUTE_MASK(sq_alu_word1_op2_v2_reg, update_execute_mask) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_MASK) | (update_execute_mask << SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_UPDATE_PRED(sq_alu_word1_op2_v2_reg, update_pred) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_MASK) | (update_pred << SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_WRITE_MASK(sq_alu_word1_op2_v2_reg, write_mask) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_WRITE_MASK_MASK) | (write_mask << SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_OMOD(sq_alu_word1_op2_v2_reg, omod) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_OMOD_MASK) | (omod << SQ_ALU_WORD1_OP2_V2_OMOD_SHIFT) -#define SQ_ALU_WORD1_OP2_V2_SET_ALU_INST(sq_alu_word1_op2_v2_reg, alu_inst) \ - sq_alu_word1_op2_v2_reg = (sq_alu_word1_op2_v2_reg & ~SQ_ALU_WORD1_OP2_V2_ALU_INST_MASK) | (alu_inst << SQ_ALU_WORD1_OP2_V2_ALU_INST_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_alu_word1_op2_v2_t { - unsigned int src0_abs : SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SIZE; - unsigned int src1_abs : SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SIZE; - unsigned int update_execute_mask : SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SIZE; - unsigned int update_pred : SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SIZE; - unsigned int write_mask : SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SIZE; - unsigned int omod : SQ_ALU_WORD1_OP2_V2_OMOD_SIZE; - unsigned int alu_inst : SQ_ALU_WORD1_OP2_V2_ALU_INST_SIZE; - unsigned int : 14; - } sq_alu_word1_op2_v2_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_alu_word1_op2_v2_t { - unsigned int : 14; - unsigned int alu_inst : SQ_ALU_WORD1_OP2_V2_ALU_INST_SIZE; - unsigned int omod : SQ_ALU_WORD1_OP2_V2_OMOD_SIZE; - unsigned int write_mask : SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SIZE; - unsigned int update_pred : SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SIZE; - unsigned int update_execute_mask : SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SIZE; - unsigned int src1_abs : SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SIZE; - unsigned int src0_abs : SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SIZE; - } sq_alu_word1_op2_v2_t; - -#endif - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_alu_word1_op2_r6xx_t { - unsigned int src0_abs : SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SIZE; - unsigned int src1_abs : SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SIZE; - unsigned int update_execute_mask : SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SIZE; - unsigned int update_pred : SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SIZE; - unsigned int write_mask : SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SIZE; - unsigned int fog_export : 1; - unsigned int omod : SQ_ALU_WORD1_OP2_V2_OMOD_SIZE; - unsigned int alu_inst : 10; - unsigned int : 14; - } sq_alu_word1_op2_v1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_alu_word1_op2_r6xx_t { - unsigned int : 14; - unsigned int alu_inst : 10; - unsigned int omod : SQ_ALU_WORD1_OP2_V2_OMOD_SIZE; - unsigned int fog_export : 1; - unsigned int write_mask : SQ_ALU_WORD1_OP2_V2_WRITE_MASK_SIZE; - unsigned int update_pred : SQ_ALU_WORD1_OP2_V2_UPDATE_PRED_SIZE; - unsigned int update_execute_mask : SQ_ALU_WORD1_OP2_V2_UPDATE_EXECUTE_MASK_SIZE; - unsigned int src1_abs : SQ_ALU_WORD1_OP2_V2_SRC1_ABS_SIZE; - unsigned int src0_abs : SQ_ALU_WORD1_OP2_V2_SRC0_ABS_SIZE; - } sq_alu_word1_op2_v1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_alu_word1_op2_v2_t f; - sq_alu_word1_op2_v1_t f6; -} sq_alu_word1_op2_v2_u; - - -/* - * SQ_ALU_WORD1_OP3 struct - */ - -#define SQ_ALU_WORD1_OP3_SRC2_SEL_SIZE 9 -#define SQ_ALU_WORD1_OP3_SRC2_REL_SIZE 1 -#define SQ_ALU_WORD1_OP3_SRC2_CHAN_SIZE 2 -#define SQ_ALU_WORD1_OP3_SRC2_NEG_SIZE 1 -#define SQ_ALU_WORD1_OP3_ALU_INST_SIZE 5 - -#define SQ_ALU_WORD1_OP3_SRC2_SEL_SHIFT 0 -#define SQ_ALU_WORD1_OP3_SRC2_REL_SHIFT 9 -#define SQ_ALU_WORD1_OP3_SRC2_CHAN_SHIFT 10 -#define SQ_ALU_WORD1_OP3_SRC2_NEG_SHIFT 12 -#define SQ_ALU_WORD1_OP3_ALU_INST_SHIFT 13 - -#define SQ_ALU_WORD1_OP3_SRC2_SEL_MASK 0x000001ff -#define SQ_ALU_WORD1_OP3_SRC2_REL_MASK 0x00000200 -#define SQ_ALU_WORD1_OP3_SRC2_CHAN_MASK 0x00000c00 -#define SQ_ALU_WORD1_OP3_SRC2_NEG_MASK 0x00001000 -#define SQ_ALU_WORD1_OP3_ALU_INST_MASK 0x0003e000 - -#define SQ_ALU_WORD1_OP3_MASK \ - (SQ_ALU_WORD1_OP3_SRC2_SEL_MASK | \ - SQ_ALU_WORD1_OP3_SRC2_REL_MASK | \ - SQ_ALU_WORD1_OP3_SRC2_CHAN_MASK | \ - SQ_ALU_WORD1_OP3_SRC2_NEG_MASK | \ - SQ_ALU_WORD1_OP3_ALU_INST_MASK) - -#define SQ_ALU_WORD1_OP3_DEFAULT 0x0001cdcd - -#define SQ_ALU_WORD1_OP3_GET_SRC2_SEL(sq_alu_word1_op3) \ - ((sq_alu_word1_op3 & SQ_ALU_WORD1_OP3_SRC2_SEL_MASK) >> SQ_ALU_WORD1_OP3_SRC2_SEL_SHIFT) -#define SQ_ALU_WORD1_OP3_GET_SRC2_REL(sq_alu_word1_op3) \ - ((sq_alu_word1_op3 & SQ_ALU_WORD1_OP3_SRC2_REL_MASK) >> SQ_ALU_WORD1_OP3_SRC2_REL_SHIFT) -#define SQ_ALU_WORD1_OP3_GET_SRC2_CHAN(sq_alu_word1_op3) \ - ((sq_alu_word1_op3 & SQ_ALU_WORD1_OP3_SRC2_CHAN_MASK) >> SQ_ALU_WORD1_OP3_SRC2_CHAN_SHIFT) -#define SQ_ALU_WORD1_OP3_GET_SRC2_NEG(sq_alu_word1_op3) \ - ((sq_alu_word1_op3 & SQ_ALU_WORD1_OP3_SRC2_NEG_MASK) >> SQ_ALU_WORD1_OP3_SRC2_NEG_SHIFT) -#define SQ_ALU_WORD1_OP3_GET_ALU_INST(sq_alu_word1_op3) \ - ((sq_alu_word1_op3 & SQ_ALU_WORD1_OP3_ALU_INST_MASK) >> SQ_ALU_WORD1_OP3_ALU_INST_SHIFT) - -#define SQ_ALU_WORD1_OP3_SET_SRC2_SEL(sq_alu_word1_op3_reg, src2_sel) \ - sq_alu_word1_op3_reg = (sq_alu_word1_op3_reg & ~SQ_ALU_WORD1_OP3_SRC2_SEL_MASK) | (src2_sel << SQ_ALU_WORD1_OP3_SRC2_SEL_SHIFT) -#define SQ_ALU_WORD1_OP3_SET_SRC2_REL(sq_alu_word1_op3_reg, src2_rel) \ - sq_alu_word1_op3_reg = (sq_alu_word1_op3_reg & ~SQ_ALU_WORD1_OP3_SRC2_REL_MASK) | (src2_rel << SQ_ALU_WORD1_OP3_SRC2_REL_SHIFT) -#define SQ_ALU_WORD1_OP3_SET_SRC2_CHAN(sq_alu_word1_op3_reg, src2_chan) \ - sq_alu_word1_op3_reg = (sq_alu_word1_op3_reg & ~SQ_ALU_WORD1_OP3_SRC2_CHAN_MASK) | (src2_chan << SQ_ALU_WORD1_OP3_SRC2_CHAN_SHIFT) -#define SQ_ALU_WORD1_OP3_SET_SRC2_NEG(sq_alu_word1_op3_reg, src2_neg) \ - sq_alu_word1_op3_reg = (sq_alu_word1_op3_reg & ~SQ_ALU_WORD1_OP3_SRC2_NEG_MASK) | (src2_neg << SQ_ALU_WORD1_OP3_SRC2_NEG_SHIFT) -#define SQ_ALU_WORD1_OP3_SET_ALU_INST(sq_alu_word1_op3_reg, alu_inst) \ - sq_alu_word1_op3_reg = (sq_alu_word1_op3_reg & ~SQ_ALU_WORD1_OP3_ALU_INST_MASK) | (alu_inst << SQ_ALU_WORD1_OP3_ALU_INST_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_alu_word1_op3_t { - unsigned int src2_sel : SQ_ALU_WORD1_OP3_SRC2_SEL_SIZE; - unsigned int src2_rel : SQ_ALU_WORD1_OP3_SRC2_REL_SIZE; - unsigned int src2_chan : SQ_ALU_WORD1_OP3_SRC2_CHAN_SIZE; - unsigned int src2_neg : SQ_ALU_WORD1_OP3_SRC2_NEG_SIZE; - unsigned int alu_inst : SQ_ALU_WORD1_OP3_ALU_INST_SIZE; - unsigned int : 14; - } sq_alu_word1_op3_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_alu_word1_op3_t { - unsigned int : 14; - unsigned int alu_inst : SQ_ALU_WORD1_OP3_ALU_INST_SIZE; - unsigned int src2_neg : SQ_ALU_WORD1_OP3_SRC2_NEG_SIZE; - unsigned int src2_chan : SQ_ALU_WORD1_OP3_SRC2_CHAN_SIZE; - unsigned int src2_rel : SQ_ALU_WORD1_OP3_SRC2_REL_SIZE; - unsigned int src2_sel : SQ_ALU_WORD1_OP3_SRC2_SEL_SIZE; - } sq_alu_word1_op3_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_alu_word1_op3_t f; -} sq_alu_word1_op3_u; - - -/* - * SQ_TEX_WORD0 struct - */ - -#define SQ_TEX_WORD0_TEX_INST_SIZE 5 -#define SQ_TEX_WORD0_BC_FRAC_MODE_SIZE 1 -#define SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SIZE 1 -#define SQ_TEX_WORD0_RESOURCE_ID_SIZE 8 -#define SQ_TEX_WORD0_SRC_GPR_SIZE 7 -#define SQ_TEX_WORD0_SRC_REL_SIZE 1 -#define SQ_TEX_WORD0_ALT_CONST_SIZE 1 - -#define SQ_TEX_WORD0_TEX_INST_SHIFT 0 -#define SQ_TEX_WORD0_BC_FRAC_MODE_SHIFT 5 -#define SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SHIFT 7 -#define SQ_TEX_WORD0_RESOURCE_ID_SHIFT 8 -#define SQ_TEX_WORD0_SRC_GPR_SHIFT 16 -#define SQ_TEX_WORD0_SRC_REL_SHIFT 23 -#define SQ_TEX_WORD0_ALT_CONST_SHIFT 24 - -#define SQ_TEX_WORD0_TEX_INST_MASK 0x0000001f -#define SQ_TEX_WORD0_BC_FRAC_MODE_MASK 0x00000020 -#define SQ_TEX_WORD0_FETCH_WHOLE_QUAD_MASK 0x00000080 -#define SQ_TEX_WORD0_RESOURCE_ID_MASK 0x0000ff00 -#define SQ_TEX_WORD0_SRC_GPR_MASK 0x007f0000 -#define SQ_TEX_WORD0_SRC_REL_MASK 0x00800000 -#define SQ_TEX_WORD0_ALT_CONST_MASK 0x01000000 - -#define SQ_TEX_WORD0_MASK \ - (SQ_TEX_WORD0_TEX_INST_MASK | \ - SQ_TEX_WORD0_BC_FRAC_MODE_MASK | \ - SQ_TEX_WORD0_FETCH_WHOLE_QUAD_MASK | \ - SQ_TEX_WORD0_RESOURCE_ID_MASK | \ - SQ_TEX_WORD0_SRC_GPR_MASK | \ - SQ_TEX_WORD0_SRC_REL_MASK | \ - SQ_TEX_WORD0_ALT_CONST_MASK) - -#define SQ_TEX_WORD0_DEFAULT 0x01cdcd8d - -#define SQ_TEX_WORD0_GET_TEX_INST(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_TEX_INST_MASK) >> SQ_TEX_WORD0_TEX_INST_SHIFT) -#define SQ_TEX_WORD0_GET_BC_FRAC_MODE(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_BC_FRAC_MODE_MASK) >> SQ_TEX_WORD0_BC_FRAC_MODE_SHIFT) -#define SQ_TEX_WORD0_GET_FETCH_WHOLE_QUAD(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_FETCH_WHOLE_QUAD_MASK) >> SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SHIFT) -#define SQ_TEX_WORD0_GET_RESOURCE_ID(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_RESOURCE_ID_MASK) >> SQ_TEX_WORD0_RESOURCE_ID_SHIFT) -#define SQ_TEX_WORD0_GET_SRC_GPR(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_SRC_GPR_MASK) >> SQ_TEX_WORD0_SRC_GPR_SHIFT) -#define SQ_TEX_WORD0_GET_SRC_REL(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_SRC_REL_MASK) >> SQ_TEX_WORD0_SRC_REL_SHIFT) -#define SQ_TEX_WORD0_GET_ALT_CONST(sq_tex_word0) \ - ((sq_tex_word0 & SQ_TEX_WORD0_ALT_CONST_MASK) >> SQ_TEX_WORD0_ALT_CONST_SHIFT) - -#define SQ_TEX_WORD0_SET_TEX_INST(sq_tex_word0_reg, tex_inst) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_TEX_INST_MASK) | (tex_inst << SQ_TEX_WORD0_TEX_INST_SHIFT) -#define SQ_TEX_WORD0_SET_BC_FRAC_MODE(sq_tex_word0_reg, bc_frac_mode) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_BC_FRAC_MODE_MASK) | (bc_frac_mode << SQ_TEX_WORD0_BC_FRAC_MODE_SHIFT) -#define SQ_TEX_WORD0_SET_FETCH_WHOLE_QUAD(sq_tex_word0_reg, fetch_whole_quad) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_FETCH_WHOLE_QUAD_MASK) | (fetch_whole_quad << SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SHIFT) -#define SQ_TEX_WORD0_SET_RESOURCE_ID(sq_tex_word0_reg, resource_id) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_RESOURCE_ID_MASK) | (resource_id << SQ_TEX_WORD0_RESOURCE_ID_SHIFT) -#define SQ_TEX_WORD0_SET_SRC_GPR(sq_tex_word0_reg, src_gpr) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_SRC_GPR_MASK) | (src_gpr << SQ_TEX_WORD0_SRC_GPR_SHIFT) -#define SQ_TEX_WORD0_SET_SRC_REL(sq_tex_word0_reg, src_rel) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_SRC_REL_MASK) | (src_rel << SQ_TEX_WORD0_SRC_REL_SHIFT) -#define SQ_TEX_WORD0_SET_ALT_CONST(sq_tex_word0_reg, alt_const) \ - sq_tex_word0_reg = (sq_tex_word0_reg & ~SQ_TEX_WORD0_ALT_CONST_MASK) | (alt_const << SQ_TEX_WORD0_ALT_CONST_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_tex_word0_t { - unsigned int tex_inst : SQ_TEX_WORD0_TEX_INST_SIZE; - unsigned int bc_frac_mode : SQ_TEX_WORD0_BC_FRAC_MODE_SIZE; - unsigned int : 1; - unsigned int fetch_whole_quad : SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SIZE; - unsigned int resource_id : SQ_TEX_WORD0_RESOURCE_ID_SIZE; - unsigned int src_gpr : SQ_TEX_WORD0_SRC_GPR_SIZE; - unsigned int src_rel : SQ_TEX_WORD0_SRC_REL_SIZE; - unsigned int alt_const : SQ_TEX_WORD0_ALT_CONST_SIZE; - unsigned int : 7; - } sq_tex_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_tex_word0_t { - unsigned int : 7; - unsigned int alt_const : SQ_TEX_WORD0_ALT_CONST_SIZE; - unsigned int src_rel : SQ_TEX_WORD0_SRC_REL_SIZE; - unsigned int src_gpr : SQ_TEX_WORD0_SRC_GPR_SIZE; - unsigned int resource_id : SQ_TEX_WORD0_RESOURCE_ID_SIZE; - unsigned int fetch_whole_quad : SQ_TEX_WORD0_FETCH_WHOLE_QUAD_SIZE; - unsigned int : 1; - unsigned int bc_frac_mode : SQ_TEX_WORD0_BC_FRAC_MODE_SIZE; - unsigned int tex_inst : SQ_TEX_WORD0_TEX_INST_SIZE; - } sq_tex_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_tex_word0_t f; -} sq_tex_word0_u; - - -/* - * SQ_TEX_WORD1 struct - */ - -#define SQ_TEX_WORD1_DST_GPR_SIZE 7 -#define SQ_TEX_WORD1_DST_REL_SIZE 1 -#define SQ_TEX_WORD1_DST_SEL_X_SIZE 3 -#define SQ_TEX_WORD1_DST_SEL_Y_SIZE 3 -#define SQ_TEX_WORD1_DST_SEL_Z_SIZE 3 -#define SQ_TEX_WORD1_DST_SEL_W_SIZE 3 -#define SQ_TEX_WORD1_LOD_BIAS_SIZE 7 -#define SQ_TEX_WORD1_COORD_TYPE_X_SIZE 1 -#define SQ_TEX_WORD1_COORD_TYPE_Y_SIZE 1 -#define SQ_TEX_WORD1_COORD_TYPE_Z_SIZE 1 -#define SQ_TEX_WORD1_COORD_TYPE_W_SIZE 1 - -#define SQ_TEX_WORD1_DST_GPR_SHIFT 0 -#define SQ_TEX_WORD1_DST_REL_SHIFT 7 -#define SQ_TEX_WORD1_DST_SEL_X_SHIFT 9 -#define SQ_TEX_WORD1_DST_SEL_Y_SHIFT 12 -#define SQ_TEX_WORD1_DST_SEL_Z_SHIFT 15 -#define SQ_TEX_WORD1_DST_SEL_W_SHIFT 18 -#define SQ_TEX_WORD1_LOD_BIAS_SHIFT 21 -#define SQ_TEX_WORD1_COORD_TYPE_X_SHIFT 28 -#define SQ_TEX_WORD1_COORD_TYPE_Y_SHIFT 29 -#define SQ_TEX_WORD1_COORD_TYPE_Z_SHIFT 30 -#define SQ_TEX_WORD1_COORD_TYPE_W_SHIFT 31 - -#define SQ_TEX_WORD1_DST_GPR_MASK 0x0000007f -#define SQ_TEX_WORD1_DST_REL_MASK 0x00000080 -#define SQ_TEX_WORD1_DST_SEL_X_MASK 0x00000e00 -#define SQ_TEX_WORD1_DST_SEL_Y_MASK 0x00007000 -#define SQ_TEX_WORD1_DST_SEL_Z_MASK 0x00038000 -#define SQ_TEX_WORD1_DST_SEL_W_MASK 0x001c0000 -#define SQ_TEX_WORD1_LOD_BIAS_MASK 0x0fe00000 -#define SQ_TEX_WORD1_COORD_TYPE_X_MASK 0x10000000 -#define SQ_TEX_WORD1_COORD_TYPE_Y_MASK 0x20000000 -#define SQ_TEX_WORD1_COORD_TYPE_Z_MASK 0x40000000 -#define SQ_TEX_WORD1_COORD_TYPE_W_MASK 0x80000000 - -#define SQ_TEX_WORD1_MASK \ - (SQ_TEX_WORD1_DST_GPR_MASK | \ - SQ_TEX_WORD1_DST_REL_MASK | \ - SQ_TEX_WORD1_DST_SEL_X_MASK | \ - SQ_TEX_WORD1_DST_SEL_Y_MASK | \ - SQ_TEX_WORD1_DST_SEL_Z_MASK | \ - SQ_TEX_WORD1_DST_SEL_W_MASK | \ - SQ_TEX_WORD1_LOD_BIAS_MASK | \ - SQ_TEX_WORD1_COORD_TYPE_X_MASK | \ - SQ_TEX_WORD1_COORD_TYPE_Y_MASK | \ - SQ_TEX_WORD1_COORD_TYPE_Z_MASK | \ - SQ_TEX_WORD1_COORD_TYPE_W_MASK) - -#define SQ_TEX_WORD1_DEFAULT 0xcdcdcccd - -#define SQ_TEX_WORD1_GET_DST_GPR(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_GPR_MASK) >> SQ_TEX_WORD1_DST_GPR_SHIFT) -#define SQ_TEX_WORD1_GET_DST_REL(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_REL_MASK) >> SQ_TEX_WORD1_DST_REL_SHIFT) -#define SQ_TEX_WORD1_GET_DST_SEL_X(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_SEL_X_MASK) >> SQ_TEX_WORD1_DST_SEL_X_SHIFT) -#define SQ_TEX_WORD1_GET_DST_SEL_Y(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_SEL_Y_MASK) >> SQ_TEX_WORD1_DST_SEL_Y_SHIFT) -#define SQ_TEX_WORD1_GET_DST_SEL_Z(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_SEL_Z_MASK) >> SQ_TEX_WORD1_DST_SEL_Z_SHIFT) -#define SQ_TEX_WORD1_GET_DST_SEL_W(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_DST_SEL_W_MASK) >> SQ_TEX_WORD1_DST_SEL_W_SHIFT) -#define SQ_TEX_WORD1_GET_LOD_BIAS(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_LOD_BIAS_MASK) >> SQ_TEX_WORD1_LOD_BIAS_SHIFT) -#define SQ_TEX_WORD1_GET_COORD_TYPE_X(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_COORD_TYPE_X_MASK) >> SQ_TEX_WORD1_COORD_TYPE_X_SHIFT) -#define SQ_TEX_WORD1_GET_COORD_TYPE_Y(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_COORD_TYPE_Y_MASK) >> SQ_TEX_WORD1_COORD_TYPE_Y_SHIFT) -#define SQ_TEX_WORD1_GET_COORD_TYPE_Z(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_COORD_TYPE_Z_MASK) >> SQ_TEX_WORD1_COORD_TYPE_Z_SHIFT) -#define SQ_TEX_WORD1_GET_COORD_TYPE_W(sq_tex_word1) \ - ((sq_tex_word1 & SQ_TEX_WORD1_COORD_TYPE_W_MASK) >> SQ_TEX_WORD1_COORD_TYPE_W_SHIFT) - -#define SQ_TEX_WORD1_SET_DST_GPR(sq_tex_word1_reg, dst_gpr) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_GPR_MASK) | (dst_gpr << SQ_TEX_WORD1_DST_GPR_SHIFT) -#define SQ_TEX_WORD1_SET_DST_REL(sq_tex_word1_reg, dst_rel) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_REL_MASK) | (dst_rel << SQ_TEX_WORD1_DST_REL_SHIFT) -#define SQ_TEX_WORD1_SET_DST_SEL_X(sq_tex_word1_reg, dst_sel_x) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_SEL_X_MASK) | (dst_sel_x << SQ_TEX_WORD1_DST_SEL_X_SHIFT) -#define SQ_TEX_WORD1_SET_DST_SEL_Y(sq_tex_word1_reg, dst_sel_y) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_SEL_Y_MASK) | (dst_sel_y << SQ_TEX_WORD1_DST_SEL_Y_SHIFT) -#define SQ_TEX_WORD1_SET_DST_SEL_Z(sq_tex_word1_reg, dst_sel_z) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_SEL_Z_MASK) | (dst_sel_z << SQ_TEX_WORD1_DST_SEL_Z_SHIFT) -#define SQ_TEX_WORD1_SET_DST_SEL_W(sq_tex_word1_reg, dst_sel_w) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_DST_SEL_W_MASK) | (dst_sel_w << SQ_TEX_WORD1_DST_SEL_W_SHIFT) -#define SQ_TEX_WORD1_SET_LOD_BIAS(sq_tex_word1_reg, lod_bias) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_LOD_BIAS_MASK) | (lod_bias << SQ_TEX_WORD1_LOD_BIAS_SHIFT) -#define SQ_TEX_WORD1_SET_COORD_TYPE_X(sq_tex_word1_reg, coord_type_x) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_COORD_TYPE_X_MASK) | (coord_type_x << SQ_TEX_WORD1_COORD_TYPE_X_SHIFT) -#define SQ_TEX_WORD1_SET_COORD_TYPE_Y(sq_tex_word1_reg, coord_type_y) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_COORD_TYPE_Y_MASK) | (coord_type_y << SQ_TEX_WORD1_COORD_TYPE_Y_SHIFT) -#define SQ_TEX_WORD1_SET_COORD_TYPE_Z(sq_tex_word1_reg, coord_type_z) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_COORD_TYPE_Z_MASK) | (coord_type_z << SQ_TEX_WORD1_COORD_TYPE_Z_SHIFT) -#define SQ_TEX_WORD1_SET_COORD_TYPE_W(sq_tex_word1_reg, coord_type_w) \ - sq_tex_word1_reg = (sq_tex_word1_reg & ~SQ_TEX_WORD1_COORD_TYPE_W_MASK) | (coord_type_w << SQ_TEX_WORD1_COORD_TYPE_W_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_tex_word1_t { - unsigned int dst_gpr : SQ_TEX_WORD1_DST_GPR_SIZE; - unsigned int dst_rel : SQ_TEX_WORD1_DST_REL_SIZE; - unsigned int : 1; - unsigned int dst_sel_x : SQ_TEX_WORD1_DST_SEL_X_SIZE; - unsigned int dst_sel_y : SQ_TEX_WORD1_DST_SEL_Y_SIZE; - unsigned int dst_sel_z : SQ_TEX_WORD1_DST_SEL_Z_SIZE; - unsigned int dst_sel_w : SQ_TEX_WORD1_DST_SEL_W_SIZE; - unsigned int lod_bias : SQ_TEX_WORD1_LOD_BIAS_SIZE; - unsigned int coord_type_x : SQ_TEX_WORD1_COORD_TYPE_X_SIZE; - unsigned int coord_type_y : SQ_TEX_WORD1_COORD_TYPE_Y_SIZE; - unsigned int coord_type_z : SQ_TEX_WORD1_COORD_TYPE_Z_SIZE; - unsigned int coord_type_w : SQ_TEX_WORD1_COORD_TYPE_W_SIZE; - } sq_tex_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_tex_word1_t { - unsigned int coord_type_w : SQ_TEX_WORD1_COORD_TYPE_W_SIZE; - unsigned int coord_type_z : SQ_TEX_WORD1_COORD_TYPE_Z_SIZE; - unsigned int coord_type_y : SQ_TEX_WORD1_COORD_TYPE_Y_SIZE; - unsigned int coord_type_x : SQ_TEX_WORD1_COORD_TYPE_X_SIZE; - unsigned int lod_bias : SQ_TEX_WORD1_LOD_BIAS_SIZE; - unsigned int dst_sel_w : SQ_TEX_WORD1_DST_SEL_W_SIZE; - unsigned int dst_sel_z : SQ_TEX_WORD1_DST_SEL_Z_SIZE; - unsigned int dst_sel_y : SQ_TEX_WORD1_DST_SEL_Y_SIZE; - unsigned int dst_sel_x : SQ_TEX_WORD1_DST_SEL_X_SIZE; - unsigned int : 1; - unsigned int dst_rel : SQ_TEX_WORD1_DST_REL_SIZE; - unsigned int dst_gpr : SQ_TEX_WORD1_DST_GPR_SIZE; - } sq_tex_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_tex_word1_t f; -} sq_tex_word1_u; - - -/* - * SQ_TEX_WORD2 struct - */ - -#define SQ_TEX_WORD2_OFFSET_X_SIZE 5 -#define SQ_TEX_WORD2_OFFSET_Y_SIZE 5 -#define SQ_TEX_WORD2_OFFSET_Z_SIZE 5 -#define SQ_TEX_WORD2_SAMPLER_ID_SIZE 5 -#define SQ_TEX_WORD2_SRC_SEL_X_SIZE 3 -#define SQ_TEX_WORD2_SRC_SEL_Y_SIZE 3 -#define SQ_TEX_WORD2_SRC_SEL_Z_SIZE 3 -#define SQ_TEX_WORD2_SRC_SEL_W_SIZE 3 - -#define SQ_TEX_WORD2_OFFSET_X_SHIFT 0 -#define SQ_TEX_WORD2_OFFSET_Y_SHIFT 5 -#define SQ_TEX_WORD2_OFFSET_Z_SHIFT 10 -#define SQ_TEX_WORD2_SAMPLER_ID_SHIFT 15 -#define SQ_TEX_WORD2_SRC_SEL_X_SHIFT 20 -#define SQ_TEX_WORD2_SRC_SEL_Y_SHIFT 23 -#define SQ_TEX_WORD2_SRC_SEL_Z_SHIFT 26 -#define SQ_TEX_WORD2_SRC_SEL_W_SHIFT 29 - -#define SQ_TEX_WORD2_OFFSET_X_MASK 0x0000001f -#define SQ_TEX_WORD2_OFFSET_Y_MASK 0x000003e0 -#define SQ_TEX_WORD2_OFFSET_Z_MASK 0x00007c00 -#define SQ_TEX_WORD2_SAMPLER_ID_MASK 0x000f8000 -#define SQ_TEX_WORD2_SRC_SEL_X_MASK 0x00700000 -#define SQ_TEX_WORD2_SRC_SEL_Y_MASK 0x03800000 -#define SQ_TEX_WORD2_SRC_SEL_Z_MASK 0x1c000000 -#define SQ_TEX_WORD2_SRC_SEL_W_MASK 0xe0000000 - -#define SQ_TEX_WORD2_MASK \ - (SQ_TEX_WORD2_OFFSET_X_MASK | \ - SQ_TEX_WORD2_OFFSET_Y_MASK | \ - SQ_TEX_WORD2_OFFSET_Z_MASK | \ - SQ_TEX_WORD2_SAMPLER_ID_MASK | \ - SQ_TEX_WORD2_SRC_SEL_X_MASK | \ - SQ_TEX_WORD2_SRC_SEL_Y_MASK | \ - SQ_TEX_WORD2_SRC_SEL_Z_MASK | \ - SQ_TEX_WORD2_SRC_SEL_W_MASK) - -#define SQ_TEX_WORD2_DEFAULT 0xcdcdcdcd - -#define SQ_TEX_WORD2_GET_OFFSET_X(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_OFFSET_X_MASK) >> SQ_TEX_WORD2_OFFSET_X_SHIFT) -#define SQ_TEX_WORD2_GET_OFFSET_Y(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_OFFSET_Y_MASK) >> SQ_TEX_WORD2_OFFSET_Y_SHIFT) -#define SQ_TEX_WORD2_GET_OFFSET_Z(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_OFFSET_Z_MASK) >> SQ_TEX_WORD2_OFFSET_Z_SHIFT) -#define SQ_TEX_WORD2_GET_SAMPLER_ID(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_SAMPLER_ID_MASK) >> SQ_TEX_WORD2_SAMPLER_ID_SHIFT) -#define SQ_TEX_WORD2_GET_SRC_SEL_X(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_SRC_SEL_X_MASK) >> SQ_TEX_WORD2_SRC_SEL_X_SHIFT) -#define SQ_TEX_WORD2_GET_SRC_SEL_Y(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_SRC_SEL_Y_MASK) >> SQ_TEX_WORD2_SRC_SEL_Y_SHIFT) -#define SQ_TEX_WORD2_GET_SRC_SEL_Z(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_SRC_SEL_Z_MASK) >> SQ_TEX_WORD2_SRC_SEL_Z_SHIFT) -#define SQ_TEX_WORD2_GET_SRC_SEL_W(sq_tex_word2) \ - ((sq_tex_word2 & SQ_TEX_WORD2_SRC_SEL_W_MASK) >> SQ_TEX_WORD2_SRC_SEL_W_SHIFT) - -#define SQ_TEX_WORD2_SET_OFFSET_X(sq_tex_word2_reg, offset_x) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_OFFSET_X_MASK) | (offset_x << SQ_TEX_WORD2_OFFSET_X_SHIFT) -#define SQ_TEX_WORD2_SET_OFFSET_Y(sq_tex_word2_reg, offset_y) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_OFFSET_Y_MASK) | (offset_y << SQ_TEX_WORD2_OFFSET_Y_SHIFT) -#define SQ_TEX_WORD2_SET_OFFSET_Z(sq_tex_word2_reg, offset_z) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_OFFSET_Z_MASK) | (offset_z << SQ_TEX_WORD2_OFFSET_Z_SHIFT) -#define SQ_TEX_WORD2_SET_SAMPLER_ID(sq_tex_word2_reg, sampler_id) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_SAMPLER_ID_MASK) | (sampler_id << SQ_TEX_WORD2_SAMPLER_ID_SHIFT) -#define SQ_TEX_WORD2_SET_SRC_SEL_X(sq_tex_word2_reg, src_sel_x) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_SRC_SEL_X_MASK) | (src_sel_x << SQ_TEX_WORD2_SRC_SEL_X_SHIFT) -#define SQ_TEX_WORD2_SET_SRC_SEL_Y(sq_tex_word2_reg, src_sel_y) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_SRC_SEL_Y_MASK) | (src_sel_y << SQ_TEX_WORD2_SRC_SEL_Y_SHIFT) -#define SQ_TEX_WORD2_SET_SRC_SEL_Z(sq_tex_word2_reg, src_sel_z) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_SRC_SEL_Z_MASK) | (src_sel_z << SQ_TEX_WORD2_SRC_SEL_Z_SHIFT) -#define SQ_TEX_WORD2_SET_SRC_SEL_W(sq_tex_word2_reg, src_sel_w) \ - sq_tex_word2_reg = (sq_tex_word2_reg & ~SQ_TEX_WORD2_SRC_SEL_W_MASK) | (src_sel_w << SQ_TEX_WORD2_SRC_SEL_W_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_tex_word2_t { - unsigned int offset_x : SQ_TEX_WORD2_OFFSET_X_SIZE; - unsigned int offset_y : SQ_TEX_WORD2_OFFSET_Y_SIZE; - unsigned int offset_z : SQ_TEX_WORD2_OFFSET_Z_SIZE; - unsigned int sampler_id : SQ_TEX_WORD2_SAMPLER_ID_SIZE; - unsigned int src_sel_x : SQ_TEX_WORD2_SRC_SEL_X_SIZE; - unsigned int src_sel_y : SQ_TEX_WORD2_SRC_SEL_Y_SIZE; - unsigned int src_sel_z : SQ_TEX_WORD2_SRC_SEL_Z_SIZE; - unsigned int src_sel_w : SQ_TEX_WORD2_SRC_SEL_W_SIZE; - } sq_tex_word2_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_tex_word2_t { - unsigned int src_sel_w : SQ_TEX_WORD2_SRC_SEL_W_SIZE; - unsigned int src_sel_z : SQ_TEX_WORD2_SRC_SEL_Z_SIZE; - unsigned int src_sel_y : SQ_TEX_WORD2_SRC_SEL_Y_SIZE; - unsigned int src_sel_x : SQ_TEX_WORD2_SRC_SEL_X_SIZE; - unsigned int sampler_id : SQ_TEX_WORD2_SAMPLER_ID_SIZE; - unsigned int offset_z : SQ_TEX_WORD2_OFFSET_Z_SIZE; - unsigned int offset_y : SQ_TEX_WORD2_OFFSET_Y_SIZE; - unsigned int offset_x : SQ_TEX_WORD2_OFFSET_X_SIZE; - } sq_tex_word2_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_tex_word2_t f; -} sq_tex_word2_u; - - -/* - * SQ_VTX_WORD0 struct - */ - -#define SQ_VTX_WORD0_VTX_INST_SIZE 5 -#define SQ_VTX_WORD0_FETCH_TYPE_SIZE 2 -#define SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SIZE 1 -#define SQ_VTX_WORD0_BUFFER_ID_SIZE 8 -#define SQ_VTX_WORD0_SRC_GPR_SIZE 7 -#define SQ_VTX_WORD0_SRC_REL_SIZE 1 -#define SQ_VTX_WORD0_SRC_SEL_X_SIZE 2 -#define SQ_VTX_WORD0_MEGA_FETCH_COUNT_SIZE 6 - -#define SQ_VTX_WORD0_VTX_INST_SHIFT 0 -#define SQ_VTX_WORD0_FETCH_TYPE_SHIFT 5 -#define SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SHIFT 7 -#define SQ_VTX_WORD0_BUFFER_ID_SHIFT 8 -#define SQ_VTX_WORD0_SRC_GPR_SHIFT 16 -#define SQ_VTX_WORD0_SRC_REL_SHIFT 23 -#define SQ_VTX_WORD0_SRC_SEL_X_SHIFT 24 -#define SQ_VTX_WORD0_MEGA_FETCH_COUNT_SHIFT 26 - -#define SQ_VTX_WORD0_VTX_INST_MASK 0x0000001f -#define SQ_VTX_WORD0_FETCH_TYPE_MASK 0x00000060 -#define SQ_VTX_WORD0_FETCH_WHOLE_QUAD_MASK 0x00000080 -#define SQ_VTX_WORD0_BUFFER_ID_MASK 0x0000ff00 -#define SQ_VTX_WORD0_SRC_GPR_MASK 0x007f0000 -#define SQ_VTX_WORD0_SRC_REL_MASK 0x00800000 -#define SQ_VTX_WORD0_SRC_SEL_X_MASK 0x03000000 -#define SQ_VTX_WORD0_MEGA_FETCH_COUNT_MASK 0xfc000000 - -#define SQ_VTX_WORD0_MASK \ - (SQ_VTX_WORD0_VTX_INST_MASK | \ - SQ_VTX_WORD0_FETCH_TYPE_MASK | \ - SQ_VTX_WORD0_FETCH_WHOLE_QUAD_MASK | \ - SQ_VTX_WORD0_BUFFER_ID_MASK | \ - SQ_VTX_WORD0_SRC_GPR_MASK | \ - SQ_VTX_WORD0_SRC_REL_MASK | \ - SQ_VTX_WORD0_SRC_SEL_X_MASK | \ - SQ_VTX_WORD0_MEGA_FETCH_COUNT_MASK) - -#define SQ_VTX_WORD0_DEFAULT 0xcdcdcdcd - -#define SQ_VTX_WORD0_GET_VTX_INST(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_VTX_INST_MASK) >> SQ_VTX_WORD0_VTX_INST_SHIFT) -#define SQ_VTX_WORD0_GET_FETCH_TYPE(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_FETCH_TYPE_MASK) >> SQ_VTX_WORD0_FETCH_TYPE_SHIFT) -#define SQ_VTX_WORD0_GET_FETCH_WHOLE_QUAD(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_FETCH_WHOLE_QUAD_MASK) >> SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SHIFT) -#define SQ_VTX_WORD0_GET_BUFFER_ID(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_BUFFER_ID_MASK) >> SQ_VTX_WORD0_BUFFER_ID_SHIFT) -#define SQ_VTX_WORD0_GET_SRC_GPR(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_SRC_GPR_MASK) >> SQ_VTX_WORD0_SRC_GPR_SHIFT) -#define SQ_VTX_WORD0_GET_SRC_REL(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_SRC_REL_MASK) >> SQ_VTX_WORD0_SRC_REL_SHIFT) -#define SQ_VTX_WORD0_GET_SRC_SEL_X(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_SRC_SEL_X_MASK) >> SQ_VTX_WORD0_SRC_SEL_X_SHIFT) -#define SQ_VTX_WORD0_GET_MEGA_FETCH_COUNT(sq_vtx_word0) \ - ((sq_vtx_word0 & SQ_VTX_WORD0_MEGA_FETCH_COUNT_MASK) >> SQ_VTX_WORD0_MEGA_FETCH_COUNT_SHIFT) - -#define SQ_VTX_WORD0_SET_VTX_INST(sq_vtx_word0_reg, vtx_inst) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_VTX_INST_MASK) | (vtx_inst << SQ_VTX_WORD0_VTX_INST_SHIFT) -#define SQ_VTX_WORD0_SET_FETCH_TYPE(sq_vtx_word0_reg, fetch_type) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_FETCH_TYPE_MASK) | (fetch_type << SQ_VTX_WORD0_FETCH_TYPE_SHIFT) -#define SQ_VTX_WORD0_SET_FETCH_WHOLE_QUAD(sq_vtx_word0_reg, fetch_whole_quad) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_FETCH_WHOLE_QUAD_MASK) | (fetch_whole_quad << SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SHIFT) -#define SQ_VTX_WORD0_SET_BUFFER_ID(sq_vtx_word0_reg, buffer_id) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_BUFFER_ID_MASK) | (buffer_id << SQ_VTX_WORD0_BUFFER_ID_SHIFT) -#define SQ_VTX_WORD0_SET_SRC_GPR(sq_vtx_word0_reg, src_gpr) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_SRC_GPR_MASK) | (src_gpr << SQ_VTX_WORD0_SRC_GPR_SHIFT) -#define SQ_VTX_WORD0_SET_SRC_REL(sq_vtx_word0_reg, src_rel) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_SRC_REL_MASK) | (src_rel << SQ_VTX_WORD0_SRC_REL_SHIFT) -#define SQ_VTX_WORD0_SET_SRC_SEL_X(sq_vtx_word0_reg, src_sel_x) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_SRC_SEL_X_MASK) | (src_sel_x << SQ_VTX_WORD0_SRC_SEL_X_SHIFT) -#define SQ_VTX_WORD0_SET_MEGA_FETCH_COUNT(sq_vtx_word0_reg, mega_fetch_count) \ - sq_vtx_word0_reg = (sq_vtx_word0_reg & ~SQ_VTX_WORD0_MEGA_FETCH_COUNT_MASK) | (mega_fetch_count << SQ_VTX_WORD0_MEGA_FETCH_COUNT_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_vtx_word0_t { - unsigned int vtx_inst : SQ_VTX_WORD0_VTX_INST_SIZE; - unsigned int fetch_type : SQ_VTX_WORD0_FETCH_TYPE_SIZE; - unsigned int fetch_whole_quad : SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SIZE; - unsigned int buffer_id : SQ_VTX_WORD0_BUFFER_ID_SIZE; - unsigned int src_gpr : SQ_VTX_WORD0_SRC_GPR_SIZE; - unsigned int src_rel : SQ_VTX_WORD0_SRC_REL_SIZE; - unsigned int src_sel_x : SQ_VTX_WORD0_SRC_SEL_X_SIZE; - unsigned int mega_fetch_count : SQ_VTX_WORD0_MEGA_FETCH_COUNT_SIZE; - } sq_vtx_word0_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_vtx_word0_t { - unsigned int mega_fetch_count : SQ_VTX_WORD0_MEGA_FETCH_COUNT_SIZE; - unsigned int src_sel_x : SQ_VTX_WORD0_SRC_SEL_X_SIZE; - unsigned int src_rel : SQ_VTX_WORD0_SRC_REL_SIZE; - unsigned int src_gpr : SQ_VTX_WORD0_SRC_GPR_SIZE; - unsigned int buffer_id : SQ_VTX_WORD0_BUFFER_ID_SIZE; - unsigned int fetch_whole_quad : SQ_VTX_WORD0_FETCH_WHOLE_QUAD_SIZE; - unsigned int fetch_type : SQ_VTX_WORD0_FETCH_TYPE_SIZE; - unsigned int vtx_inst : SQ_VTX_WORD0_VTX_INST_SIZE; - } sq_vtx_word0_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_vtx_word0_t f; -} sq_vtx_word0_u; - - -/* - * SQ_VTX_WORD1 struct - */ - -#define SQ_VTX_WORD1_DST_SEL_X_SIZE 3 -#define SQ_VTX_WORD1_DST_SEL_Y_SIZE 3 -#define SQ_VTX_WORD1_DST_SEL_Z_SIZE 3 -#define SQ_VTX_WORD1_DST_SEL_W_SIZE 3 -#define SQ_VTX_WORD1_USE_CONST_FIELDS_SIZE 1 -#define SQ_VTX_WORD1_DATA_FORMAT_SIZE 6 -#define SQ_VTX_WORD1_NUM_FORMAT_ALL_SIZE 2 -#define SQ_VTX_WORD1_FORMAT_COMP_ALL_SIZE 1 -#define SQ_VTX_WORD1_SRF_MODE_ALL_SIZE 1 - -#define SQ_VTX_WORD1_DST_SEL_X_SHIFT 9 -#define SQ_VTX_WORD1_DST_SEL_Y_SHIFT 12 -#define SQ_VTX_WORD1_DST_SEL_Z_SHIFT 15 -#define SQ_VTX_WORD1_DST_SEL_W_SHIFT 18 -#define SQ_VTX_WORD1_USE_CONST_FIELDS_SHIFT 21 -#define SQ_VTX_WORD1_DATA_FORMAT_SHIFT 22 -#define SQ_VTX_WORD1_NUM_FORMAT_ALL_SHIFT 28 -#define SQ_VTX_WORD1_FORMAT_COMP_ALL_SHIFT 30 -#define SQ_VTX_WORD1_SRF_MODE_ALL_SHIFT 31 - -#define SQ_VTX_WORD1_DST_SEL_X_MASK 0x00000e00 -#define SQ_VTX_WORD1_DST_SEL_Y_MASK 0x00007000 -#define SQ_VTX_WORD1_DST_SEL_Z_MASK 0x00038000 -#define SQ_VTX_WORD1_DST_SEL_W_MASK 0x001c0000 -#define SQ_VTX_WORD1_USE_CONST_FIELDS_MASK 0x00200000 -#define SQ_VTX_WORD1_DATA_FORMAT_MASK 0x0fc00000 -#define SQ_VTX_WORD1_NUM_FORMAT_ALL_MASK 0x30000000 -#define SQ_VTX_WORD1_FORMAT_COMP_ALL_MASK 0x40000000 -#define SQ_VTX_WORD1_SRF_MODE_ALL_MASK 0x80000000 - -#define SQ_VTX_WORD1_MASK \ - (SQ_VTX_WORD1_DST_SEL_X_MASK | \ - SQ_VTX_WORD1_DST_SEL_Y_MASK | \ - SQ_VTX_WORD1_DST_SEL_Z_MASK | \ - SQ_VTX_WORD1_DST_SEL_W_MASK | \ - SQ_VTX_WORD1_USE_CONST_FIELDS_MASK | \ - SQ_VTX_WORD1_DATA_FORMAT_MASK | \ - SQ_VTX_WORD1_NUM_FORMAT_ALL_MASK | \ - SQ_VTX_WORD1_FORMAT_COMP_ALL_MASK | \ - SQ_VTX_WORD1_SRF_MODE_ALL_MASK) - -#define SQ_VTX_WORD1_DEFAULT 0xcdcdcc00 - -#define SQ_VTX_WORD1_GET_DST_SEL_X(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_DST_SEL_X_MASK) >> SQ_VTX_WORD1_DST_SEL_X_SHIFT) -#define SQ_VTX_WORD1_GET_DST_SEL_Y(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_DST_SEL_Y_MASK) >> SQ_VTX_WORD1_DST_SEL_Y_SHIFT) -#define SQ_VTX_WORD1_GET_DST_SEL_Z(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_DST_SEL_Z_MASK) >> SQ_VTX_WORD1_DST_SEL_Z_SHIFT) -#define SQ_VTX_WORD1_GET_DST_SEL_W(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_DST_SEL_W_MASK) >> SQ_VTX_WORD1_DST_SEL_W_SHIFT) -#define SQ_VTX_WORD1_GET_USE_CONST_FIELDS(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_USE_CONST_FIELDS_MASK) >> SQ_VTX_WORD1_USE_CONST_FIELDS_SHIFT) -#define SQ_VTX_WORD1_GET_DATA_FORMAT(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_DATA_FORMAT_MASK) >> SQ_VTX_WORD1_DATA_FORMAT_SHIFT) -#define SQ_VTX_WORD1_GET_NUM_FORMAT_ALL(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_NUM_FORMAT_ALL_MASK) >> SQ_VTX_WORD1_NUM_FORMAT_ALL_SHIFT) -#define SQ_VTX_WORD1_GET_FORMAT_COMP_ALL(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_FORMAT_COMP_ALL_MASK) >> SQ_VTX_WORD1_FORMAT_COMP_ALL_SHIFT) -#define SQ_VTX_WORD1_GET_SRF_MODE_ALL(sq_vtx_word1) \ - ((sq_vtx_word1 & SQ_VTX_WORD1_SRF_MODE_ALL_MASK) >> SQ_VTX_WORD1_SRF_MODE_ALL_SHIFT) - -#define SQ_VTX_WORD1_SET_DST_SEL_X(sq_vtx_word1_reg, dst_sel_x) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_DST_SEL_X_MASK) | (dst_sel_x << SQ_VTX_WORD1_DST_SEL_X_SHIFT) -#define SQ_VTX_WORD1_SET_DST_SEL_Y(sq_vtx_word1_reg, dst_sel_y) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_DST_SEL_Y_MASK) | (dst_sel_y << SQ_VTX_WORD1_DST_SEL_Y_SHIFT) -#define SQ_VTX_WORD1_SET_DST_SEL_Z(sq_vtx_word1_reg, dst_sel_z) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_DST_SEL_Z_MASK) | (dst_sel_z << SQ_VTX_WORD1_DST_SEL_Z_SHIFT) -#define SQ_VTX_WORD1_SET_DST_SEL_W(sq_vtx_word1_reg, dst_sel_w) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_DST_SEL_W_MASK) | (dst_sel_w << SQ_VTX_WORD1_DST_SEL_W_SHIFT) -#define SQ_VTX_WORD1_SET_USE_CONST_FIELDS(sq_vtx_word1_reg, use_const_fields) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_USE_CONST_FIELDS_MASK) | (use_const_fields << SQ_VTX_WORD1_USE_CONST_FIELDS_SHIFT) -#define SQ_VTX_WORD1_SET_DATA_FORMAT(sq_vtx_word1_reg, data_format) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_DATA_FORMAT_MASK) | (data_format << SQ_VTX_WORD1_DATA_FORMAT_SHIFT) -#define SQ_VTX_WORD1_SET_NUM_FORMAT_ALL(sq_vtx_word1_reg, num_format_all) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_NUM_FORMAT_ALL_MASK) | (num_format_all << SQ_VTX_WORD1_NUM_FORMAT_ALL_SHIFT) -#define SQ_VTX_WORD1_SET_FORMAT_COMP_ALL(sq_vtx_word1_reg, format_comp_all) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_FORMAT_COMP_ALL_MASK) | (format_comp_all << SQ_VTX_WORD1_FORMAT_COMP_ALL_SHIFT) -#define SQ_VTX_WORD1_SET_SRF_MODE_ALL(sq_vtx_word1_reg, srf_mode_all) \ - sq_vtx_word1_reg = (sq_vtx_word1_reg & ~SQ_VTX_WORD1_SRF_MODE_ALL_MASK) | (srf_mode_all << SQ_VTX_WORD1_SRF_MODE_ALL_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_vtx_word1_t { - unsigned int : 9; - unsigned int dst_sel_x : SQ_VTX_WORD1_DST_SEL_X_SIZE; - unsigned int dst_sel_y : SQ_VTX_WORD1_DST_SEL_Y_SIZE; - unsigned int dst_sel_z : SQ_VTX_WORD1_DST_SEL_Z_SIZE; - unsigned int dst_sel_w : SQ_VTX_WORD1_DST_SEL_W_SIZE; - unsigned int use_const_fields : SQ_VTX_WORD1_USE_CONST_FIELDS_SIZE; - unsigned int data_format : SQ_VTX_WORD1_DATA_FORMAT_SIZE; - unsigned int num_format_all : SQ_VTX_WORD1_NUM_FORMAT_ALL_SIZE; - unsigned int format_comp_all : SQ_VTX_WORD1_FORMAT_COMP_ALL_SIZE; - unsigned int srf_mode_all : SQ_VTX_WORD1_SRF_MODE_ALL_SIZE; - } sq_vtx_word1_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_vtx_word1_t { - unsigned int srf_mode_all : SQ_VTX_WORD1_SRF_MODE_ALL_SIZE; - unsigned int format_comp_all : SQ_VTX_WORD1_FORMAT_COMP_ALL_SIZE; - unsigned int num_format_all : SQ_VTX_WORD1_NUM_FORMAT_ALL_SIZE; - unsigned int data_format : SQ_VTX_WORD1_DATA_FORMAT_SIZE; - unsigned int use_const_fields : SQ_VTX_WORD1_USE_CONST_FIELDS_SIZE; - unsigned int dst_sel_w : SQ_VTX_WORD1_DST_SEL_W_SIZE; - unsigned int dst_sel_z : SQ_VTX_WORD1_DST_SEL_Z_SIZE; - unsigned int dst_sel_y : SQ_VTX_WORD1_DST_SEL_Y_SIZE; - unsigned int dst_sel_x : SQ_VTX_WORD1_DST_SEL_X_SIZE; - unsigned int : 9; - } sq_vtx_word1_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_vtx_word1_t f; -} sq_vtx_word1_u; - - -/* - * SQ_VTX_WORD1_GPR struct - */ - -#define SQ_VTX_WORD1_GPR_DST_GPR_SIZE 7 -#define SQ_VTX_WORD1_GPR_DST_REL_SIZE 1 - -#define SQ_VTX_WORD1_GPR_DST_GPR_SHIFT 0 -#define SQ_VTX_WORD1_GPR_DST_REL_SHIFT 7 - -#define SQ_VTX_WORD1_GPR_DST_GPR_MASK 0x0000007f -#define SQ_VTX_WORD1_GPR_DST_REL_MASK 0x00000080 - -#define SQ_VTX_WORD1_GPR_MASK \ - (SQ_VTX_WORD1_GPR_DST_GPR_MASK | \ - SQ_VTX_WORD1_GPR_DST_REL_MASK) - -#define SQ_VTX_WORD1_GPR_DEFAULT 0x000000cd - -#define SQ_VTX_WORD1_GPR_GET_DST_GPR(sq_vtx_word1_gpr) \ - ((sq_vtx_word1_gpr & SQ_VTX_WORD1_GPR_DST_GPR_MASK) >> SQ_VTX_WORD1_GPR_DST_GPR_SHIFT) -#define SQ_VTX_WORD1_GPR_GET_DST_REL(sq_vtx_word1_gpr) \ - ((sq_vtx_word1_gpr & SQ_VTX_WORD1_GPR_DST_REL_MASK) >> SQ_VTX_WORD1_GPR_DST_REL_SHIFT) - -#define SQ_VTX_WORD1_GPR_SET_DST_GPR(sq_vtx_word1_gpr_reg, dst_gpr) \ - sq_vtx_word1_gpr_reg = (sq_vtx_word1_gpr_reg & ~SQ_VTX_WORD1_GPR_DST_GPR_MASK) | (dst_gpr << SQ_VTX_WORD1_GPR_DST_GPR_SHIFT) -#define SQ_VTX_WORD1_GPR_SET_DST_REL(sq_vtx_word1_gpr_reg, dst_rel) \ - sq_vtx_word1_gpr_reg = (sq_vtx_word1_gpr_reg & ~SQ_VTX_WORD1_GPR_DST_REL_MASK) | (dst_rel << SQ_VTX_WORD1_GPR_DST_REL_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_vtx_word1_gpr_t { - unsigned int dst_gpr : SQ_VTX_WORD1_GPR_DST_GPR_SIZE; - unsigned int dst_rel : SQ_VTX_WORD1_GPR_DST_REL_SIZE; - unsigned int : 24; - } sq_vtx_word1_gpr_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_vtx_word1_gpr_t { - unsigned int : 24; - unsigned int dst_rel : SQ_VTX_WORD1_GPR_DST_REL_SIZE; - unsigned int dst_gpr : SQ_VTX_WORD1_GPR_DST_GPR_SIZE; - } sq_vtx_word1_gpr_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_vtx_word1_gpr_t f; -} sq_vtx_word1_gpr_u; - - -/* - * SQ_VTX_WORD1_SEM struct - */ - -#define SQ_VTX_WORD1_SEM_SEMANTIC_ID_SIZE 8 - -#define SQ_VTX_WORD1_SEM_SEMANTIC_ID_SHIFT 0 - -#define SQ_VTX_WORD1_SEM_SEMANTIC_ID_MASK 0x000000ff - -#define SQ_VTX_WORD1_SEM_MASK \ - (SQ_VTX_WORD1_SEM_SEMANTIC_ID_MASK) - -#define SQ_VTX_WORD1_SEM_DEFAULT 0x000000cd - -#define SQ_VTX_WORD1_SEM_GET_SEMANTIC_ID(sq_vtx_word1_sem) \ - ((sq_vtx_word1_sem & SQ_VTX_WORD1_SEM_SEMANTIC_ID_MASK) >> SQ_VTX_WORD1_SEM_SEMANTIC_ID_SHIFT) - -#define SQ_VTX_WORD1_SEM_SET_SEMANTIC_ID(sq_vtx_word1_sem_reg, semantic_id) \ - sq_vtx_word1_sem_reg = (sq_vtx_word1_sem_reg & ~SQ_VTX_WORD1_SEM_SEMANTIC_ID_MASK) | (semantic_id << SQ_VTX_WORD1_SEM_SEMANTIC_ID_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_vtx_word1_sem_t { - unsigned int semantic_id : SQ_VTX_WORD1_SEM_SEMANTIC_ID_SIZE; - unsigned int : 24; - } sq_vtx_word1_sem_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_vtx_word1_sem_t { - unsigned int : 24; - unsigned int semantic_id : SQ_VTX_WORD1_SEM_SEMANTIC_ID_SIZE; - } sq_vtx_word1_sem_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_vtx_word1_sem_t f; -} sq_vtx_word1_sem_u; - - -/* - * SQ_VTX_WORD2 struct - */ - -#define SQ_VTX_WORD2_OFFSET_SIZE 16 -#define SQ_VTX_WORD2_ENDIAN_SWAP_SIZE 2 -#define SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SIZE 1 -#define SQ_VTX_WORD2_MEGA_FETCH_SIZE 1 -#define SQ_VTX_WORD2_ALT_CONST_SIZE 1 - -#define SQ_VTX_WORD2_OFFSET_SHIFT 0 -#define SQ_VTX_WORD2_ENDIAN_SWAP_SHIFT 16 -#define SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SHIFT 18 -#define SQ_VTX_WORD2_MEGA_FETCH_SHIFT 19 -#define SQ_VTX_WORD2_ALT_CONST_SHIFT 20 - -#define SQ_VTX_WORD2_OFFSET_MASK 0x0000ffff -#define SQ_VTX_WORD2_ENDIAN_SWAP_MASK 0x00030000 -#define SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_MASK 0x00040000 -#define SQ_VTX_WORD2_MEGA_FETCH_MASK 0x00080000 -#define SQ_VTX_WORD2_ALT_CONST_MASK 0x00100000 - -#define SQ_VTX_WORD2_MASK \ - (SQ_VTX_WORD2_OFFSET_MASK | \ - SQ_VTX_WORD2_ENDIAN_SWAP_MASK | \ - SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_MASK | \ - SQ_VTX_WORD2_MEGA_FETCH_MASK | \ - SQ_VTX_WORD2_ALT_CONST_MASK) - -#define SQ_VTX_WORD2_DEFAULT 0x000dcdcd - -#define SQ_VTX_WORD2_GET_OFFSET(sq_vtx_word2) \ - ((sq_vtx_word2 & SQ_VTX_WORD2_OFFSET_MASK) >> SQ_VTX_WORD2_OFFSET_SHIFT) -#define SQ_VTX_WORD2_GET_ENDIAN_SWAP(sq_vtx_word2) \ - ((sq_vtx_word2 & SQ_VTX_WORD2_ENDIAN_SWAP_MASK) >> SQ_VTX_WORD2_ENDIAN_SWAP_SHIFT) -#define SQ_VTX_WORD2_GET_CONST_BUF_NO_STRIDE(sq_vtx_word2) \ - ((sq_vtx_word2 & SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_MASK) >> SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SHIFT) -#define SQ_VTX_WORD2_GET_MEGA_FETCH(sq_vtx_word2) \ - ((sq_vtx_word2 & SQ_VTX_WORD2_MEGA_FETCH_MASK) >> SQ_VTX_WORD2_MEGA_FETCH_SHIFT) -#define SQ_VTX_WORD2_GET_ALT_CONST(sq_vtx_word2) \ - ((sq_vtx_word2 & SQ_VTX_WORD2_ALT_CONST_MASK) >> SQ_VTX_WORD2_ALT_CONST_SHIFT) - -#define SQ_VTX_WORD2_SET_OFFSET(sq_vtx_word2_reg, offset) \ - sq_vtx_word2_reg = (sq_vtx_word2_reg & ~SQ_VTX_WORD2_OFFSET_MASK) | (offset << SQ_VTX_WORD2_OFFSET_SHIFT) -#define SQ_VTX_WORD2_SET_ENDIAN_SWAP(sq_vtx_word2_reg, endian_swap) \ - sq_vtx_word2_reg = (sq_vtx_word2_reg & ~SQ_VTX_WORD2_ENDIAN_SWAP_MASK) | (endian_swap << SQ_VTX_WORD2_ENDIAN_SWAP_SHIFT) -#define SQ_VTX_WORD2_SET_CONST_BUF_NO_STRIDE(sq_vtx_word2_reg, const_buf_no_stride) \ - sq_vtx_word2_reg = (sq_vtx_word2_reg & ~SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_MASK) | (const_buf_no_stride << SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SHIFT) -#define SQ_VTX_WORD2_SET_MEGA_FETCH(sq_vtx_word2_reg, mega_fetch) \ - sq_vtx_word2_reg = (sq_vtx_word2_reg & ~SQ_VTX_WORD2_MEGA_FETCH_MASK) | (mega_fetch << SQ_VTX_WORD2_MEGA_FETCH_SHIFT) -#define SQ_VTX_WORD2_SET_ALT_CONST(sq_vtx_word2_reg, alt_const) \ - sq_vtx_word2_reg = (sq_vtx_word2_reg & ~SQ_VTX_WORD2_ALT_CONST_MASK) | (alt_const << SQ_VTX_WORD2_ALT_CONST_SHIFT) - -#if defined(LITTLEENDIAN_CPU) - - typedef struct _sq_vtx_word2_t { - unsigned int offset : SQ_VTX_WORD2_OFFSET_SIZE; - unsigned int endian_swap : SQ_VTX_WORD2_ENDIAN_SWAP_SIZE; - unsigned int const_buf_no_stride : SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SIZE; - unsigned int mega_fetch : SQ_VTX_WORD2_MEGA_FETCH_SIZE; - unsigned int alt_const : SQ_VTX_WORD2_ALT_CONST_SIZE; - unsigned int : 11; - } sq_vtx_word2_t; - -#elif defined(BIGENDIAN_CPU) - - typedef struct _sq_vtx_word2_t { - unsigned int : 11; - unsigned int alt_const : SQ_VTX_WORD2_ALT_CONST_SIZE; - unsigned int mega_fetch : SQ_VTX_WORD2_MEGA_FETCH_SIZE; - unsigned int const_buf_no_stride : SQ_VTX_WORD2_CONST_BUF_NO_STRIDE_SIZE; - unsigned int endian_swap : SQ_VTX_WORD2_ENDIAN_SWAP_SIZE; - unsigned int offset : SQ_VTX_WORD2_OFFSET_SIZE; - } sq_vtx_word2_t; - -#endif - -typedef union { - unsigned int val : 32; - sq_vtx_word2_t f; -} sq_vtx_word2_u; - -#endif /* _SQ_MICRO_REG_H */ - - |