Sync the assembler with Mesa's opcode emission code
Hey,
Some time ago, Daniel mentioned merging the assembler into intel-gpu-tools to lower maintenance cost and have more eyes on the code.
This series is the aftermath of that with an effort to sync the opcode emission from Mesa with the assembler. It's also available in my fdo i-g-t tree:
http://cgit.freedesktop.org/~damien/intel-gpu-tools/log/?h=wip/mesa-sync
The list of changes is pretty large, but straighforward. The big picture is:
- Sync the brw_eu* files from Mesa and split them into a library,
- Gradually transform the assembler code to be able to use Mesa's structures and functions. The big change here is to collect the operands in struct brw_reg to be able to use the other brw_*() functions from Mesa,
- Add some nice little details to the assembler (like cleaning-up the non-useful warning messages when compiling libva shaders, adding the line number to warning and error messages, adding region warnings, ...)
- Port the few features that we need for the libva shaders to brw_eu_*
- Fix a few things I came across
- Lots of small refactoring
The regression tests used to make sure that that series is not too wrong was to ensure libva's shaders generate the same opcodes. This also means "bug compatible" as there are cases where the assembler output opcodes that don't respect region constraints (for instance).
This means that there's still a (documented) diff between Mesa's copy of brw_eu* and our. But hopefully, with time, it'll shrink down.
There is a sister series for Mesa I'll post later on the Mesa mailing list, the sync goes both ways.
PATCH 1/90 build: Add CAIRO_FLAGS to the debugger compilation
The library in lib/ exposes <cairo.h> in its main header and thus users must be able to include it.
--- debugger/Makefile.am | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
debugger/Makefile.am +1 -0
@@ -11,6 +11,7 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ $(DRM_CFLAGS) \ $(PCIACCESS_CFLAGS) \ + $(CAIRO_CFLAGS) \ $(CWARNFLAGS) LDADD = $(top_builddir)/lib/libintel_tools.la $(DRM_LIBS) $(PCIACCESS_LIBS) $(CAIRO_LIBS)
Signature · 1 line
1.7.7.5
PATCH 2/90 gitignore: Ignore TAGS files
In reply to Damien LespiauTAGS files are generated with "make tags" to quickly jump through the code. Ignore those by-products of automake/ctags.
--- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
@@ -79,6 +79,7 @@ core *.swo *.swp cscope.* +TAGS /assembler/gram.c /assembler/gram.h
Signature · 1 line
1.7.7.5
PATCH 3/90 build: Don't use AM_MAINTAINER_MODE
In reply to Damien LespiauThis does not bring us anything these days, not using the macro at all is the same thing as having it always on.
See this discussion:
https://www.redhat.com/archives/virt-tools-list/2010-October/msg00049.html
--- autogen.sh | 2 +- configure.ac | 1 - 2 files changed, 1 insertions(+), 2 deletions(-)
autogen.sh +1 -1
@@ -9,4 +9,4 @@ cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? -$srcdir/configure --enable-maintainer-mode "$@" +$srcdir/configure "$@"
configure.ac +0 -1
@@ -36,7 +36,6 @@ AC_GNU_SOURCE AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_PATH_PYTHON([3],, [:]) -AM_MAINTAINER_MODE AC_PROG_CC AM_PROG_LEX
Signature · 1 line
1.7.7.5
PATCH 4/90 build: Only build the assembler if flex and bison are found
In reply to Damien LespiauAnd start displaying a nice summary of what we are going to compile.
--- Makefile.am | 6 +++++- configure.ac | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletions(-)
Makefile.am +5 -1
@@ -21,7 +21,11 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -SUBDIRS = lib man tools scripts tests benchmarks demos assembler +SUBDIRS = lib man tools scripts tests benchmarks demos + +if BUILD_ASSEMBLER +SUBDIRS += assembler +endif if BUILD_SHADER_DEBUGGER SUBDIRS += debugger
configure.ac +15 -0
@@ -93,6 +93,12 @@ if test x"$udev" = xyes; then fi PKG_CHECK_MODULES(GLIB, glib-2.0) +# can we build the assembler? +AS_IF([test x"$LEX" != "x:" -a x"$YACC" != xyacc], + [enable_assembler=yes], + [enable_assembler=no]) +AM_CONDITIONAL(BUILD_ASSEMBLER, [test "x$enable_assembler" = xyes]) + # ----------------------------------------------------------------------------- # Configuration options # -----------------------------------------------------------------------------
@@ -155,3 +161,12 @@ AC_CONFIG_FILES([ assembler/intel-gen4asm.pc ]) AC_OUTPUT + +# Print a summary of the compilation +echo "" +echo "Intel GPU tools" + +echo "" +echo " • Tools:" +echo " Assembler: ${enable_assembler}" +echo ""
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/90 build: Add the debugger compilation status to the summary
In reply to Damien Lespiau--- configure.ac | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
configure.ac +5 -0
@@ -109,6 +109,7 @@ AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger], # Shadder debugger depends on python3, intel-genasm and objcopy if test "x$BUILD_SHADER_DEBUGGER" != xno; then + # Check Python 3 is installed if test "$PYTHON" = ":" ; then if test "x$BUILD_SHADER_DEBUGGER" = xyes; then
@@ -138,6 +139,9 @@ if test "x$BUILD_SHADER_DEBUGGER" != xno; then fi AM_CONDITIONAL(BUILD_SHADER_DEBUGGER, [test "x$BUILD_SHADER_DEBUGGER" != xno]) +AS_IF([test "x$BUILD_SHADER_DEBUGGER" != no], + [enable_debugger=yes], [enable_debugger=no]) + # ----------------------------------------------------------------------------- # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
@@ -169,4 +173,5 @@ echo "Intel GPU tools" echo "" echo " • Tools:" echo " Assembler: ${enable_assembler}" +echo " Debugger: ${enable_debugger}" echo ""
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/90 assembler: Sync brw_instruction's header with mesa's
In reply to Damien LespiauTwo changes there, a field has been renamed and one bit of padding is now used for compressed instructions.
--- assembler/brw_structs.h | 34 +++++++++++++++++++--------------- assembler/disasm.c | 8 ++++---- assembler/gram.y | 30 +++++++++++++++--------------- 3 files changed, 38 insertions(+), 34 deletions(-)
assembler/brw_structs.h +19 -15
@@ -1043,21 +1043,25 @@ struct brw_instruction {struct { -GLuint opcode:7 ;/* 0x0000007f */ -GLuint pad:1 ;/* 0x00000080 */ /* reserved for Opcode */ -GLuint access_mode:1 ;/* 0x00000100 */ -GLuint mask_control:1 ;/* 0x00000200 */ -GLuint dependency_control:2 ;/* 0x00000c00 */ -GLuint compression_control:2 ;/* 0x00003000 */ -GLuint thread_control:2 ;/* 0x0000c000 */ -GLuint predicate_control:4 ;/* 0x000f0000 */ -GLuint predicate_inverse:1 ;/* 0x00100000 */ -GLuint execution_size:3 ;/* 0x00e00000 */ -GLuint sfid_destreg__conditionalmod:4 ;/* sfid - send on GEN6+, destreg - send on Prev GEN6, conditionalmod - others */ -GLuint acc_wr_control:1 ;/* 0x10000000 */ -GLuint pad0:1 ;/* 0x20000000 */ -GLuint debug_control:1 ;/* 0x40000000 */ -GLuint saturate:1 ;/* 0x80000000 */ +GLuint opcode:7 ; +GLuint pad:1 ; +GLuint access_mode:1 ; +GLuint mask_control:1 ; +GLuint dependency_control:2 ; +GLuint compression_control:2 ;/* gen6: quater control */ +GLuint thread_control:2 ; +GLuint predicate_control:4 ; +GLuint predicate_inverse:1 ; +GLuint execution_size:3 ; +/** +* Conditional Modifier for most instructions. On Gen6+, this is also +* used for the SEND instruction's Message Target/SFID. +*/ +GLuint destreg__conditionalmod:4 ; +GLuint acc_wr_control:1 ; +GLuint cmpt_control:1 ; +GLuint debug_control:1 ; +GLuint saturate:1 ; } header;union {
assembler/disasm.c +4 -4
@@ -798,7 +798,7 @@ int disasm (FILE *file, struct brw_instruction *inst)if (inst->header.opcode !=BRW_OPCODE_SEND && inst->header.opcode !=BRW_OPCODE_SENDC ) err |=control (file,"conditional modifier" , conditional_modifier, - inst->header.sfid_destreg__conditionalmod,NULL ); + inst->header.destreg__conditionalmod,NULL );if (inst->header.opcode !=BRW_OPCODE_NOP ) {string (file,"(" );
@@ -808,7 +808,7 @@ int disasm (FILE *file, struct brw_instruction *inst)if (inst->header.opcode ==BRW_OPCODE_SEND || inst->header.opcode ==BRW_OPCODE_SENDC ) -format (file," %d" , inst->header.sfid_destreg__conditionalmod); +format (file," %d" , inst->header.destreg__conditionalmod);if (opcode[inst->header.opcode].ndst >0 ) {pad (file,16 );
@@ -829,8 +829,8 @@ int disasm (FILE *file, struct brw_instruction *inst)pad (file,16 ); space =0 ; err |=control (file,"target function" , target_function, - inst->header.sfid_destreg__conditionalmod, &space); -switch (inst->header.sfid_destreg__conditionalmod) { + inst->header.destreg__conditionalmod, &space); +switch (inst->header.destreg__conditionalmod) {case BRW_MESSAGE_TARGET_MATH : err |=control (file,"math function" , math_function, inst->bits3.math.function, &space);
assembler/gram.y +15 -15
@@ -678,7 +678,7 @@ unaryinstruction: { memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; - $$.header.sfid_destreg__conditionalmod = $3.cond; + $$.header.destreg__conditionalmod = $3.cond; $$.header.saturate = $4; $$.header.execution_size = $5; set_instruction_options(&$$, &$8);
@@ -715,7 +715,7 @@ binaryinstruction: { memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; - $$.header.sfid_destreg__conditionalmod = $3.cond; + $$.header.destreg__conditionalmod = $3.cond; $$.header.saturate = $4; $$.header.execution_size = $5; set_instruction_options(&$$, &$9);
@@ -754,7 +754,7 @@ binaryaccinstruction: { memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; - $$.header.sfid_destreg__conditionalmod = $3.cond; + $$.header.destreg__conditionalmod = $3.cond; $$.header.saturate = $4; $$.header.execution_size = $5; set_instruction_options(&$$, &$9);
@@ -801,7 +801,7 @@ trinaryinstruction: $$.bits1.three_src_gen6.flag_subreg_nr = $1.bits2.da1.flag_subreg_nr; $$.header.opcode = $2; - $$.header.sfid_destreg__conditionalmod = $3.cond; + $$.header.destreg__conditionalmod = $3.cond; $$.header.saturate = $4; $$.header.execution_size = $5;
@@ -839,7 +839,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = $4; /* msg reg index */ + $$.header.destreg__conditionalmod = $4; /* msg reg index */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$5) != 0) YYERROR;
@@ -869,9 +869,9 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if (IS_GENp(5)) { if (IS_GENp(6)) { - $$.header.sfid_destreg__conditionalmod = $7.bits2.send_gen5.sfid; + $$.header.destreg__conditionalmod = $7.bits2.send_gen5.sfid; } else { - $$.header.sfid_destreg__conditionalmod = $4; /* msg reg index */ + $$.header.destreg__conditionalmod = $4; /* msg reg index */ $$.bits2.send_gen5.sfid = $7.bits2.send_gen5.sfid; $$.bits2.send_gen5.end_of_thread = $12.bits3.generic_gen5.end_of_thread; }
@@ -882,7 +882,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget $$.bits3.generic_gen5.end_of_thread = $12.bits3.generic_gen5.end_of_thread; } else { - $$.header.sfid_destreg__conditionalmod = $4; /* msg reg index */ + $$.header.destreg__conditionalmod = $4; /* msg reg index */ $$.bits3.generic = $7.bits3.generic; $$.bits3.generic.msg_length = $9; $$.bits3.generic.response_length = $11;
@@ -895,7 +895,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = $5.reg_nr; /* msg reg index */ + $$.header.destreg__conditionalmod = $5.reg_nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -918,7 +918,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = $5.reg_nr; /* msg reg index */ + $$.header.destreg__conditionalmod = $5.reg_nr; /* msg reg index */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$4) != 0)
@@ -948,7 +948,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ + $$.header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$4) != 0)
@@ -994,7 +994,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ + $$.header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$4) != 0)
@@ -1029,7 +1029,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = $5.reg_nr; /* msg reg index */ + $$.header.destreg__conditionalmod = $5.reg_nr; /* msg reg index */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$4) != 0)
@@ -1051,7 +1051,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; $$.header.execution_size = $3; - $$.header.sfid_destreg__conditionalmod = $5.reg_nr; /* msg reg index */ + $$.header.destreg__conditionalmod = $5.reg_nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1100,7 +1100,7 @@ mathinstruction: predicate MATH_INST execsize dst src srcimm math_function insto { memset(&$$, 0, sizeof($$)); $$.header.opcode = $2; - $$.header.sfid_destreg__conditionalmod = $7; + $$.header.destreg__conditionalmod = $7; $$.header.execution_size = $3; set_instruction_options(&$$, &$8); set_instruction_predicate(&$$, &$1);
Signature · 1 line
1.7.7.5
PATCH 7/90 assembler: Rename three_src_gen6 to da3src
In reply to Damien LespiauMesa's brw_structs.h has named/renamed this field to da3src. Sync with them.
--- assembler/brw_structs.h | 6 +++--- assembler/gram.y | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-)
assembler/brw_structs.h +3 -3
@@ -1142,7 +1142,7 @@ struct brw_instruction GLuint dest_writemask:4; GLuint dest_subreg_nr:3; GLuint dest_reg_nr:8; - } three_src_gen6;/* Three-source-operator instructions for Gen6+ */ + } da3src;struct {
@@ -1229,7 +1229,7 @@ struct brw_instruction GLuint src1_rep_ctrl:1; GLuint src1_swizzle:8; GLuint src1_subreg_nr_low:2; /* src1_subreg_nr spans on two DWORDs */ - } three_src_gen6;/* Three-source-operator instructions for Gen6+ */ + } da3src;struct {
@@ -1315,7 +1315,7 @@ struct brw_instruction GLuint src2_subreg_nr:3; GLuint src2_reg_nr:8; GLuint pad1:2; /* reserved */ - } three_src_gen6;/* Three-source-operator instructions for Gen6+ */ + } da3src;struct {
assembler/gram.y +15 -15
@@ -797,8 +797,8 @@ trinaryinstruction: $$.header.predicate_control = $1.header.predicate_control; $$.header.predicate_inverse = $1.header.predicate_inverse; - $$.bits1.three_src_gen6.flag_reg_nr = $1.bits2.da1.flag_reg_nr; - $$.bits1.three_src_gen6.flag_subreg_nr = $1.bits2.da1.flag_subreg_nr; + $$.bits1.da3src.flag_reg_nr = $1.bits2.da1.flag_reg_nr; + $$.bits1.da3src.flag_subreg_nr = $1.bits2.da1.flag_subreg_nr; $$.header.opcode = $2; $$.header.destreg__conditionalmod = $3.cond;
@@ -3064,11 +3064,11 @@ static int reg_type_2_to_3(int reg_type) int set_instruction_dest_three_src(struct brw_instruction *instr, struct dst_operand *dest) { - instr->bits1.three_src_gen6.dest_reg_file = dest->reg_file; - instr->bits1.three_src_gen6.dest_reg_nr = dest->reg_nr; - instr->bits1.three_src_gen6.dest_subreg_nr = get_subreg_address(dest->reg_file, dest->reg_type, dest->subreg_nr, dest->address_mode) / 4; // in DWORD - instr->bits1.three_src_gen6.dest_writemask = dest->writemask; - instr->bits1.three_src_gen6.dest_reg_type = reg_type_2_to_3(dest->reg_type); + instr->bits1.da3src.dest_reg_file = dest->reg_file; + instr->bits1.da3src.dest_reg_nr = dest->reg_nr; + instr->bits1.da3src.dest_subreg_nr = get_subreg_address(dest->reg_file, dest->reg_type, dest->subreg_nr, dest->address_mode) / 4; // in DWORD + instr->bits1.da3src.dest_writemask = dest->writemask; + instr->bits1.da3src.dest_reg_type = reg_type_2_to_3(dest->reg_type); return 0; }
@@ -3079,9 +3079,9 @@ int set_instruction_src0_three_src(struct brw_instruction *instr, reset_instruction_src_region(instr, src); } // TODO: supporting src0 swizzle, src0 modifier, src0 rep_ctrl - instr->bits1.three_src_gen6.src_reg_type = reg_type_2_to_3(src->reg_type); - instr->bits2.three_src_gen6.src0_subreg_nr = get_subreg_address(src->reg_file, src->reg_type, src->subreg_nr, src->address_mode) / 4; // in DWORD - instr->bits2.three_src_gen6.src0_reg_nr = src->reg_nr; + instr->bits1.da3src.src_reg_type = reg_type_2_to_3(src->reg_type); + instr->bits2.da3src.src0_subreg_nr = get_subreg_address(src->reg_file, src->reg_type, src->subreg_nr, src->address_mode) / 4; // in DWORD + instr->bits2.da3src.src0_reg_nr = src->reg_nr; return 0; }
@@ -3093,9 +3093,9 @@ int set_instruction_src1_three_src(struct brw_instruction *instr, } // TODO: supporting src1 swizzle, src1 modifier, src1 rep_ctrl int v = get_subreg_address(src->reg_file, src->reg_type, src->subreg_nr, src->address_mode) / 4; // in DWORD - instr->bits2.three_src_gen6.src1_subreg_nr_low = v % 4; // lower 2 bits - instr->bits3.three_src_gen6.src1_subreg_nr_high = v / 4; // highest bit - instr->bits3.three_src_gen6.src1_reg_nr = src->reg_nr; + instr->bits2.da3src.src1_subreg_nr_low = v % 4; // lower 2 bits + instr->bits3.da3src.src1_subreg_nr_high = v / 4; // highest bit + instr->bits3.da3src.src1_reg_nr = src->reg_nr; return 0; }
@@ -3106,8 +3106,8 @@ int set_instruction_src2_three_src(struct brw_instruction *instr, reset_instruction_src_region(instr, src); } // TODO: supporting src2 swizzle, src2 modifier, src2 rep_ctrl - instr->bits3.three_src_gen6.src2_subreg_nr = get_subreg_address(src->reg_file, src->reg_type, src->subreg_nr, src->address_mode) / 4; // in DWORD - instr->bits3.three_src_gen6.src2_reg_nr = src->reg_nr; + instr->bits3.da3src.src2_subreg_nr = get_subreg_address(src->reg_file, src->reg_type, src->subreg_nr, src->address_mode) / 4; // in DWORD + instr->bits3.da3src.src2_reg_nr = src->reg_nr; return 0; }
Signature · 1 line
1.7.7.5
PATCH 8/90 assembler: Rename dp_read_gen6 to gen6_dp_sampler_const_cache
In reply to Damien LespiauThe purpose of this commit is to synchronize opcode definitions across the gen4asm assembler and mesa.
--- assembler/brw_structs.h | 27 ++++++++++++++++----------- assembler/gram.y | 6 +++--- 2 files changed, 19 insertions(+), 14 deletions(-)
assembler/brw_structs.h +16 -11
@@ -1469,17 +1469,22 @@ struct brw_instruction GLuint end_of_thread:1; } dp_read_gen5; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:5 ; -GLuint msg_type:3 ; -GLuint pad0:3 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_read_gen6; +/** +* Message for the Sandybridge Sampler Cache or Constant Cache Data Port. +* +* See the Sandybridge PRM, Volume 4 Part 1, Section 3.9.2.1.1. +**/ +struct { +GLuint binding_table_index:8 ; +GLuint msg_control:5 ; +GLuint msg_type:3 ; +GLuint pad0:3 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } gen6_dp_sampler_const_cache;struct {GLuint binding_table_index:8 ;
assembler/gram.y +3 -3
@@ -1260,9 +1260,9 @@ msgtarget: NULL_TOKEN $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_SC; $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_read_gen6.binding_table_index = $3; - $$.bits3.dp_read_gen6.msg_control = $7; - $$.bits3.dp_read_gen6.msg_type = $9; + $$.bits3.gen6_dp_sampler_const_cache.binding_table_index = $3; + $$.bits3.gen6_dp_sampler_const_cache.msg_control = $7; + $$.bits3.gen6_dp_sampler_const_cache.msg_type = $9; } else if (IS_GENx(5)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
Signature · 1 line
1.7.7.5
PATCH 9/90 assembler: Rename dp_gen6 to gen6_dp and sync with Mesa's
In reply to Damien LespiauThe purpose of this commit is to synchronize opcode definitions across the gen4asm assembler and mesa.
I had to drop how mesa splits msg_control as the current assembly language gives access the the whole msg_control field.
Recompiling the xorg and the intel driver of libva shaders doesn't show any difference in the assembly created.
--- assembler/brw_structs.h | 34 ++++++++++++++++++++++------------ assembler/gram.y | 8 ++++---- 2 files changed, 26 insertions(+), 16 deletions(-)
assembler/brw_structs.h +22 -12
@@ -1513,18 +1513,28 @@ struct brw_instruction GLuint end_of_thread:1; } dp_write_gen6; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:5 ; -GLuint msg_type:4 ; -GLuint send_commit_msg:1 ;/* ignore on read message */ -GLuint pad0:1 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_gen6; +/** +* Message for the Sandybridge Render Cache Data Port. +* +* Most fields are defined in the Sandybridge PRM, Volume 4 Part 1, +* Section 3.9.2.1.1: Message Descriptor. +* +* "Slot Group Select" and "Last Render Target" are part of the +* 5-bit message control for Render Target Write messages. See +* Section 3.9.9.2.1 of the same volume. +*/ +struct { +GLuint binding_table_index:8 ; +GLuint msg_control:5 ; +GLuint msg_type:4 ; +GLuint send_commit_msg:1 ; +GLuint pad0:1 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } gen6_dp;struct {GLuint binding_table_index:8 ;
assembler/gram.y +4 -4
@@ -1471,10 +1471,10 @@ msgtarget: NULL_TOKEN YYERROR; } - $$.bits3.dp_gen6.send_commit_msg = $11; - $$.bits3.dp_gen6.binding_table_index = $9; - $$.bits3.dp_gen6.msg_control = $7; - $$.bits3.dp_gen6.msg_type = $5; + $$.bits3.gen6_dp.send_commit_msg = $11; + $$.bits3.gen6_dp.binding_table_index = $9; + $$.bits3.gen6_dp.msg_control = $7; + $$.bits3.gen6_dp.msg_type = $5; } else if (!IS_GENp(5)) { fprintf (stderr, "Gen6- doesn't support data port for sampler/render/constant/data cache\n"); YYERROR;
Signature · 1 line
1.7.7.5
PATCH 10/90 assembler: Rename dp_gen7 to gen7_dp and sync it with Mesa's
In reply to Damien LespiauThe purpose of this commit is to synchronize opcode definitions across the gen4asm assembler and mesa.
I had to drop how mesa splits msg_control as the current assembly language gives access the the whole msg_control field.
Recompiling the xorg and the intel driver of libva shaders doesn't show any difference in the assembly created.
--- assembler/brw_structs.h | 31 ++++++++++++++++++++----------- assembler/gram.y | 26 +++++++++++++------------- 2 files changed, 33 insertions(+), 24 deletions(-)
assembler/brw_structs.h +20 -11
@@ -1536,17 +1536,26 @@ struct brw_instruction GLuint end_of_thread:1; } gen6_dp; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:6 ; -GLuint msg_type:4 ; -GLuint category:1 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_gen7; +/** +* Message for any of the Gen7 Data Port caches. +* +* Most fields are defined in BSpec volume 5c.2 Data Port / Messages / +* Data Port Messages / Message Descriptor. Once again, "Slot Group +* Select" and "Last Render Target" are part of the 6-bit message +* control for Render Target Writes. +*/ +struct { +GLuint binding_table_index:8 ; +GLuint msg_control:6 ; +GLuint msg_type:4 ; +GLuint category:1 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad2:2 ; +GLuint end_of_thread:1 ; + } gen7_dp; +/** @} */ struct {GLuint opcode:1 ;
assembler/gram.y +13 -13
@@ -1253,9 +1253,9 @@ msgtarget: NULL_TOKEN $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_SC; $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_gen7.binding_table_index = $3; - $$.bits3.dp_gen7.msg_control = $7; - $$.bits3.dp_gen7.msg_type = $9; + $$.bits3.gen7_dp.binding_table_index = $3; + $$.bits3.gen7_dp.msg_control = $7; + $$.bits3.gen7_dp.msg_type = $9; } else if (IS_GENx(6)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_SC;
@@ -1287,9 +1287,9 @@ msgtarget: NULL_TOKEN $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_RC; $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_gen7.binding_table_index = $3; - $$.bits3.dp_gen7.msg_control = $5; - $$.bits3.dp_gen7.msg_type = $7; + $$.bits3.gen7_dp.binding_table_index = $3; + $$.bits3.gen7_dp.msg_control = $5; + $$.bits3.gen7_dp.msg_type = $7; } else if (IS_GENx(6)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_RC;
@@ -1332,9 +1332,9 @@ msgtarget: NULL_TOKEN $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_RC; $$.bits3.generic_gen5.header_present = ($11 != 0); - $$.bits3.dp_gen7.binding_table_index = $3; - $$.bits3.dp_gen7.msg_control = $5; - $$.bits3.dp_gen7.msg_type = $7; + $$.bits3.gen7_dp.binding_table_index = $3; + $$.bits3.gen7_dp.msg_control = $5; + $$.bits3.gen7_dp.msg_type = $7; } else if (IS_GENx(6)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_RC;
@@ -1459,10 +1459,10 @@ msgtarget: NULL_TOKEN YYERROR; } - $$.bits3.dp_gen7.category = $11; - $$.bits3.dp_gen7.binding_table_index = $9; - $$.bits3.dp_gen7.msg_control = $7; - $$.bits3.dp_gen7.msg_type = $5; + $$.bits3.gen7_dp.category = $11; + $$.bits3.gen7_dp.binding_table_index = $9; + $$.bits3.gen7_dp.msg_control = $7; + $$.bits3.gen7_dp.msg_type = $5; } else if (IS_GENx(6)) { if ($3 != BRW_MESSAGE_TARGET_DP_SC && $3 != BRW_MESSAGE_TARGET_DP_RC &&
Signature · 1 line
1.7.7.5
PATCH 11/90 assembler: Remove struct dp_write_gen6 and struct use gen6_dp
In reply to Damien LespiauWe ended up with 2 structures that where exactly the same, so just use one, which happens to be the one Mesa has.
--- assembler/brw_structs.h | 13 ------------- assembler/gram.y | 16 ++++++++-------- 2 files changed, 8 insertions(+), 21 deletions(-)
assembler/brw_structs.h +0 -13
@@ -1500,19 +1500,6 @@ struct brw_instruction GLuint end_of_thread:1; } dp_write_gen5; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:5 ; -GLuint msg_type:4 ; -GLuint send_commit_msg:1 ; -GLuint pad0:1 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_write_gen6; -/** * Message for the Sandybridge Render Cache Data Port. *
assembler/gram.y +8 -8
@@ -1298,10 +1298,10 @@ msgtarget: NULL_TOKEN * message header */ $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_write_gen6.binding_table_index = $3; - $$.bits3.dp_write_gen6.msg_control = $5; - $$.bits3.dp_write_gen6.msg_type = $7; - $$.bits3.dp_write_gen6.send_commit_msg = $9; + $$.bits3.gen6_dp.binding_table_index = $3; + $$.bits3.gen6_dp.msg_control = $5; + $$.bits3.gen6_dp.msg_type = $7; + $$.bits3.gen6_dp.send_commit_msg = $9; } else if (IS_GENx(5)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
@@ -1339,10 +1339,10 @@ msgtarget: NULL_TOKEN $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DP_RC; $$.bits3.generic_gen5.header_present = ($11 != 0); - $$.bits3.dp_write_gen6.binding_table_index = $3; - $$.bits3.dp_write_gen6.msg_control = $5; - $$.bits3.dp_write_gen6.msg_type = $7; - $$.bits3.dp_write_gen6.send_commit_msg = $9; + $$.bits3.gen6_dp.binding_table_index = $3; + $$.bits3.gen6_dp.msg_control = $5; + $$.bits3.gen6_dp.msg_type = $7; + $$.bits3.gen6_dp.send_commit_msg = $9; } else if (IS_GENx(5)) { $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
Signature · 1 line
1.7.7.5
PATCH 12/90 assembler: Rename gen5 DP pixel_scoreboard_clear to last_render_target
In reply to Damien LespiauThe purpose of this commit is to synchronize opcode definitions across the gen4asm assembler and mesa.
--- assembler/brw_structs.h | 4 ++-- assembler/disasm.c | 2 +- assembler/gram.y | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-)
assembler/brw_structs.h +2 -2
@@ -1368,7 +1368,7 @@ struct brw_instructionstruct {GLuint binding_table_index:8 ;GLuint msg_control:3 ; -GLuint pixel_scoreboard_clear:1 ; +GLuint last_render_target:1 ;GLuint msg_type:3 ;GLuint send_commit_msg:1 ;GLuint response_length:4 ;
@@ -1489,7 +1489,7 @@ struct brw_instructionstruct {GLuint binding_table_index:8 ;GLuint msg_control:3 ; -GLuint pixel_scoreboard_clear:1 ; +GLuint last_render_target:1 ;GLuint msg_type:3 ;GLuint send_commit_msg:1 ;GLuint pad0:3 ;
assembler/disasm.c +1 -1
@@ -854,7 +854,7 @@ int disasm (FILE *file, struct brw_instruction *inst)case BRW_MESSAGE_TARGET_DATAPORT_WRITE :format (file," (%d, %d, %d, %d)" , inst->bits3.dp_write.binding_table_index, - (inst->bits3.dp_write.pixel_scoreboard_clear <<3 ) | + (inst->bits3.dp_write.last_render_target <<3 ) | inst->bits3.dp_write.msg_control, inst->bits3.dp_write.msg_type, inst->bits3.dp_write.send_commit_msg);
assembler/gram.y +8 -8
@@ -1307,7 +1307,7 @@ msgtarget: NULL_TOKEN BRW_MESSAGE_TARGET_DATAPORT_WRITE; $$.bits3.generic_gen5.header_present = 1; $$.bits3.dp_write_gen5.binding_table_index = $3; - $$.bits3.dp_write_gen5.pixel_scoreboard_clear = ($5 & 0x8) >> 3; + $$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; $$.bits3.dp_write_gen5.msg_control = $5 & 0x7; $$.bits3.dp_write_gen5.msg_type = $7; $$.bits3.dp_write_gen5.send_commit_msg = $9;
@@ -1316,10 +1316,10 @@ msgtarget: NULL_TOKEN BRW_MESSAGE_TARGET_DATAPORT_WRITE; $$.bits3.dp_write.binding_table_index = $3; /* The msg control field of brw_struct.h is split into - * msg control and pixel_scoreboard_clear, even though - * pixel_scoreboard_clear isn't common to all write messages. + * msg control and last_render_target, even though + * last_render_target isn't common to all write messages. */ - $$.bits3.dp_write.pixel_scoreboard_clear = ($5 & 0x8) >> 3; + $$.bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; $$.bits3.dp_write.msg_control = $5 & 0x7; $$.bits3.dp_write.msg_type = $7; $$.bits3.dp_write.send_commit_msg = $9;
@@ -1348,7 +1348,7 @@ msgtarget: NULL_TOKEN BRW_MESSAGE_TARGET_DATAPORT_WRITE; $$.bits3.generic_gen5.header_present = ($11 != 0); $$.bits3.dp_write_gen5.binding_table_index = $3; - $$.bits3.dp_write_gen5.pixel_scoreboard_clear = ($5 & 0x8) >> 3; + $$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; $$.bits3.dp_write_gen5.msg_control = $5 & 0x7; $$.bits3.dp_write_gen5.msg_type = $7; $$.bits3.dp_write_gen5.send_commit_msg = $9;
@@ -1357,10 +1357,10 @@ msgtarget: NULL_TOKEN BRW_MESSAGE_TARGET_DATAPORT_WRITE; $$.bits3.dp_write.binding_table_index = $3; /* The msg control field of brw_struct.h is split into - * msg control and pixel_scoreboard_clear, even though - * pixel_scoreboard_clear isn't common to all write messages. + * msg control and last_render_target, even though + * last_render_target isn't common to all write messages. */ - $$.bits3.dp_write.pixel_scoreboard_clear = ($5 & 0x8) >> 3; + $$.bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; $$.bits3.dp_write.msg_control = $5 & 0x7; $$.bits3.dp_write.msg_type = $7; $$.bits3.dp_write.send_commit_msg = $9;
Signature · 1 line
1.7.7.5
PATCH 13/90 assembler: Rename branch to branch_gen6
In reply to Damien LespiauThe purpose of this commit is to synchronize opcode definitions across the gen4asm assembler and mesa.
--- assembler/brw_structs.h | 17 ++++++++++++----- assembler/main.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-)
assembler/brw_structs.h +12 -5
@@ -1125,6 +1125,18 @@ struct brw_instruction GLuint dest_address_mode:1; } ia16;/* indirect align16 */ +struct { +GLuint dest_reg_file:2 ; +GLuint dest_reg_type:3 ; +GLuint src0_reg_file:2 ; +GLuint src0_reg_type:3 ; +GLuint src1_reg_file:2 ; +GLuint src1_reg_type:3 ; +GLuint pad:1 ; + +GLint jump_count:16 ; + } branch_gen6; +struct {GLuint dest_reg_file:1 ;/* used in Gen6, deleted in Gen7 */
@@ -1144,11 +1156,6 @@ struct brw_instruction GLuint dest_reg_nr:8; } da3src; -struct - { -GLuint pad:16 ; -GLint JIP:16 ; - } branch;/* conditional branch JIP for Gen6 only */ } bits1;
assembler/main.c +1 -1
@@ -448,7 +448,7 @@ int main(int argc, char **argv)if (opcode ==BRW_OPCODE_CALL || opcode ==BRW_OPCODE_JMPI ) entry->instruction.bits3.JIP = offset;// for CALL, JMPI else - entry->instruction.bits1.branch.JIP = offset;// for CASE,ELSE,FORK,IF,WHILE + entry->instruction.bits1.branch_gen6.jump_count = offset;// for CASE,ELSE,FORK,IF,WHILE }else if (IS_GENp (7 )) {int opcode = entry->instruction.header.opcode;/* Gen7 JMPI Restrictions in bspec:
Signature · 1 line
1.7.7.5
PATCH 14/90 assembler: Rename branch_2_offset to break_cont
In reply to Damien LespiauOnce again, import the equivalent struct from mesa.
--- assembler/brw_structs.h | 16 +++++++++++++--- assembler/main.c | 8 ++++---- 2 files changed, 17 insertions(+), 7 deletions(-)
assembler/brw_structs.h +13 -3
@@ -1324,11 +1324,21 @@ struct brw_instruction GLuint pad1:2; /* reserved */ } da3src; +/* This is also used for gen7 IF/ELSE instructions */ struct { -GLint JIP:16 ;/* Gen7 bspec: both the JIP and UIP are signed 16-bit numbers */ -GLint UIP:16 ; - } branch_2_offset;/* for Gen6, Gen7 2-offsets branch; for Gen7 1-offset branch */ +/* Signed jump distance to the ip to jump to if all channels +* are disabled after the break or continue. It should point +* to the end of the innermost control flow block, as that's +* where some channel could get re-enabled. +*/ +int jip:16 ; + +/* Signed jump distance to the location to resume execution +* of this channel if it's enabled for the break or continue. +*/ +int uip:16 ; + } break_cont;GLint JIP ;/* used by Gen6 CALL instructions; Gen7 JMPI */
assembler/main.c +4 -4
@@ -424,8 +424,8 @@ int main(int argc, char **argv)if (inst->second_reloc_offset) {// this is a branch instruction with two offset arguments - entry->instruction.bits3.branch_2_offset.JIP =jump_distance (inst->first_reloc_offset); - entry->instruction.bits3.branch_2_offset.UIP =jump_distance (inst->second_reloc_offset); + entry->instruction.bits3.break_cont.jip =jump_distance (inst->first_reloc_offset); + entry->instruction.bits3.break_cont.uip =jump_distance (inst->second_reloc_offset); }else if (inst->first_reloc_offset) {// this is a branch instruction with one offset argument int offset = inst->first_reloc_offset;
@@ -441,7 +441,7 @@ int main(int argc, char **argv)if (!IS_GENp (6 )) { entry->instruction.bits3.JIP = offset;if (entry->instruction.header.opcode ==BRW_OPCODE_ELSE ) - entry->instruction.bits3.branch_2_offset.UIP =1 ;/* Set the istack pop count, which must always be 1. */ + entry->instruction.bits3.break_cont.uip =1 ;/* Set the istack pop count, which must always be 1. */ }else if (IS_GENx (6 )) {/* TODO: endif JIP pos is not in Gen6 spec. may be bits1 */ int opcode = entry->instruction.header.opcode;
@@ -457,7 +457,7 @@ int main(int argc, char **argv)if (opcode ==BRW_OPCODE_JMPI ) entry->instruction.bits3.JIP = offset;else - entry->instruction.bits3.branch_2_offset.JIP = offset; + entry->instruction.bits3.break_cont.jip = offset; } } }
Signature · 1 line
1.7.7.5
PATCH 15/90 assembler: Rename bits3.id and bits3.fd
In reply to Damien LespiauAs always, to sync with mesa.
--- assembler/brw_structs.h | 4 ++-- assembler/disasm.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
assembler/brw_structs.h +2 -2
@@ -1599,8 +1599,8 @@ struct brw_instruction } generic_gen5;GLuint ud; -GLint id; -GLfloat fd; +GLint d; +GLfloat f; } bits3;char *first_reloc_target, *second_reloc_target;// first for JIP, second for UIP
assembler/disasm.c +3 -3
@@ -628,13 +628,13 @@ static int imm (FILE *file, GLuint type, struct brw_instruction *inst) {format (file,"0x%08xUD" , inst->bits3.ud);break ;case BRW_REGISTER_TYPE_D : -format (file,"%dD" , inst->bits3.id); +format (file,"%dD" , inst->bits3.d);break ;case BRW_REGISTER_TYPE_UW :format (file,"0x%04xUW" , (uint16_t ) inst->bits3.ud);break ;case BRW_REGISTER_TYPE_W : -format (file,"%dW" , (int16_t ) inst->bits3.id); +format (file,"%dW" , (int16_t ) inst->bits3.d);break ;case BRW_REGISTER_TYPE_UB :format (file,"0x%02xUB" , (int8_t ) inst->bits3.ud);
@@ -646,7 +646,7 @@ static int imm (FILE *file, GLuint type, struct brw_instruction *inst) {format (file,"0x%08xV" , inst->bits3.ud);break ;case BRW_REGISTER_TYPE_F : -format (file,"%-gF" , inst->bits3.fd); +format (file,"%-gF" , inst->bits3.f); }return 0 ; }
Signature · 1 line
1.7.7.5
PATCH 16/90 assembler: Adopt brw_structs.h from mesa
In reply to Damien LespiauFinally merge both brw_structs.h from mesa. One detail has risen in that last commit, the msg_control field of data port message descriptors.
Mesa's msg_control field is sometimes split with messages-specific fields where the assembler (at least for recent generations) exposes the full msg_control value in the send instruction.
As libva's shaders encodes the full msg_control value in its send instructions, I've chosen to not take the split msg_control from mesa. It's absolutely possible to have a patch fixing that divergence at some later point.
I've also kept a hack introduced with ironlake to not have to rewrite shaders (that encode msg_control in the text, remember), and thus creates a another difference with Mesa.
- GLuint msg_control:3;
- GLuint msg_type:3;
+ GLuint msg_control:4;
+ GLuint msg_type:2;
Once again, I've made sure that re-generating libva's shaders don't show any difference.
--- assembler/brw_structs.h | 1365 ++++++++++++++++++++++------------------------- 1 files changed, 624 insertions(+), 741 deletions(-)
assembler/brw_structs.h +624 -741
@@ -1,91 +1,38 @@ -/************************************************************************** -* -* Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. -* All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sub license, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice (including the -* next paragraph) shall be included in all copies or substantial portions -* of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -**************************************************************************/ +/* +Copyright (C) Intel Corp. 2006. All Rights Reserved. +Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to +develop this 3D driver. ++ 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 BRW_STRUCTS_H #define BRW_STRUCTS_H -/* Command packets: -*/ -struct header -{ -GLuint length:16 ; -GLuint opcode:16 ; -} bits; - - -union header_union -{ -struct header bits; -GLuint dword; -}; - -struct brw_3d_control -{ -struct - { -GLuint length:8 ; -GLuint notify_enable:1 ; -GLuint pad:3 ; -GLuint wc_flush_enable:1 ; -GLuint depth_stall_enable:1 ; -GLuint operation:2 ; -GLuint opcode:16 ; - } header; - -struct - { -GLuint pad:2 ; -GLuint dest_addr_type:1 ; -GLuint dest_addr:29 ; - } dest; - -GLuint dword2; -GLuint dword3; -}; - - -struct brw_3d_primitive -{ -struct - { -GLuint length:8 ; -GLuint pad:2 ; -GLuint topology:5 ; -GLuint indexed:1 ; -GLuint opcode:16 ; - } header; - -GLuint verts_per_instance; -GLuint start_vert_location; -GLuint instance_count; -GLuint start_instance_location; -GLuint base_vert_location; -}; -/* These seem to be passed around as function args, so it works out * better to keep them as #defines: */
@@ -94,243 +41,6 @@ struct brw_3d_primitive#define BRW_INHIBIT_FLUSH_RENDER_CACHE 0x4#define BRW_FLUSH_SNAPSHOT_COUNTERS 0x8 -struct brw_mi_flush -{ -GLuint flags:4 ; -GLuint pad:12 ; -GLuint opcode:16 ; -}; - -struct brw_vf_statistics -{ -GLuint statistics_enable:1 ; -GLuint pad:15 ; -GLuint opcode:16 ; -}; - - - -struct brw_binding_table_pointers -{ -struct header header; -GLuint vs; -GLuint gs; -GLuint clp; -GLuint sf; -GLuint wm; -}; - - -struct brw_blend_constant_color -{ -struct header header; -GLfloat blend_constant_color[4 ]; -}; - - -struct brw_depthbuffer -{ -union header_union header; - -union { -struct { -GLuint pitch:18 ; -GLuint format:3 ; -GLuint pad:4 ; -GLuint depth_offset_disable:1 ; -GLuint tile_walk:1 ; -GLuint tiled_surface:1 ; -GLuint pad2:1 ; -GLuint surface_type:3 ; - } bits; -GLuint dword; - } dword1; - -GLuint dword2_base_addr; - -union { -struct { -GLuint pad:1 ; -GLuint mipmap_layout:1 ; -GLuint lod:4 ; -GLuint width:13 ; -GLuint height:13 ; - } bits; -GLuint dword; - } dword3; - -union { -struct { -GLuint pad:12 ; -GLuint min_array_element:9 ; -GLuint depth:11 ; - } bits; -GLuint dword; - } dword4; -}; - -struct brw_drawrect -{ -struct header header; -GLuint xmin:16 ; -GLuint ymin:16 ; -GLuint xmax:16 ; -GLuint ymax:16 ; -GLuint xorg:16 ; -GLuint yorg:16 ; -}; - - - - -struct brw_global_depth_offset_clamp -{ -struct header header; -GLfloat depth_offset_clamp; -}; - -struct brw_indexbuffer -{ -union { -struct - { -GLuint length:8 ; -GLuint index_format:2 ; -GLuint cut_index_enable:1 ; -GLuint pad:5 ; -GLuint opcode:16 ; - } bits; -GLuint dword; - - } header; - -GLuint buffer_start; -GLuint buffer_end; -}; - - -struct brw_line_stipple -{ -struct header header; - -struct - { -GLuint pattern:16 ; -GLuint pad:16 ; - } bits0; - -struct - { -GLuint repeat_count:9 ; -GLuint pad:7 ; -GLuint inverse_repeat_count:16 ; - } bits1; -}; - - -struct brw_pipelined_state_pointers -{ -struct header header; - -struct { -GLuint pad:5 ; -GLuint offset:27 ; - } vs; - -struct - { -GLuint enable:1 ; -GLuint pad:4 ; -GLuint offset:27 ; - } gs; - -struct - { -GLuint enable:1 ; -GLuint pad:4 ; -GLuint offset:27 ; - } clp; - -struct - { -GLuint pad:5 ; -GLuint offset:27 ; - } sf; - -struct - { -GLuint pad:5 ; -GLuint offset:27 ; - } wm; - -struct - { -GLuint pad:5 ; -GLuint offset:27 ;/* KW: check me! */ - } cc; -}; - - -struct brw_polygon_stipple_offset -{ -struct header header; - -struct { -GLuint y_offset:5 ; -GLuint pad:3 ; -GLuint x_offset:5 ; -GLuint pad0:19 ; - } bits0; -}; - - - -struct brw_polygon_stipple -{ -struct header header; -GLuint stipple[32 ]; -}; - - - -struct brw_pipeline_select -{ -struct - { -GLuint pipeline_select:1 ; -GLuint pad:15 ; -GLuint opcode:16 ; - } header; -}; - - -struct brw_pipe_control -{ -struct - { -GLuint length:8 ; -GLuint notify_enable:1 ; -GLuint pad:2 ; -GLuint instruction_state_cache_flush_enable:1 ; -GLuint write_cache_flush_enable:1 ; -GLuint depth_stall_enable:1 ; -GLuint post_sync_operation:2 ; - -GLuint opcode:16 ; - } header; - -struct - { -GLuint pad:2 ; -GLuint dest_addr_type:1 ; -GLuint dest_addr:29 ; - } bits1; - -GLuint data0; -GLuint data1; -}; - -struct brw_urb_fence { struct
@@ -358,107 +68,11 @@ struct brw_urb_fence { GLuint sf_fence:10; GLuint vf_fence:10; - GLuint cs_fence:10; - GLuint pad:2; - } bits1; -}; - -struct brw_constant_buffer_state /* previously brw_command_streamer */ -{ -struct header header; - -struct - { -GLuint nr_urb_entries:3 ; + GLuint cs_fence:11; GLuint pad:1; -GLuint urb_entry_size:5 ; -GLuint pad0:23 ; - } bits0; -}; - -struct brw_constant_buffer -{ -struct - { -GLuint length:8 ; -GLuint valid:1 ; -GLuint pad:7 ; -GLuint opcode:16 ; - } header; - -struct - { -GLuint buffer_length:6 ; -GLuint buffer_address:26 ; - } bits0; -}; - -struct brw_state_base_address -{ -struct header header; - -struct - { -GLuint modify_enable:1 ; -GLuint pad:4 ; -GLuint general_state_address:27 ; - } bits0; - -struct - { -GLuint modify_enable:1 ; -GLuint pad:4 ; -GLuint surface_state_address:27 ; } bits1; - -struct - { -GLuint modify_enable:1 ; -GLuint pad:4 ; -GLuint indirect_object_state_address:27 ; - } bits2; - -struct - { -GLuint modify_enable:1 ; -GLuint pad:11 ; -GLuint general_state_upper_bound:20 ; - } bits3; - -struct - { -GLuint modify_enable:1 ; -GLuint pad:11 ; -GLuint indirect_object_state_upper_bound:20 ; - } bits4; }; -struct brw_state_prefetch -{ -struct header header; - -struct - { -GLuint prefetch_count:3 ; -GLuint pad:3 ; -GLuint prefetch_pointer:26 ; - } bits0; -}; - -struct brw_system_instruction_pointer -{ -struct header header; - -struct - { -GLuint pad:4 ; -GLuint system_instruction_pointer:28 ; - } bits0; -}; - - - -/* State structs for the various fixed function units: */
@@ -468,7 +82,7 @@ struct thread0 GLuint pad0:1; GLuint grf_reg_count:3; GLuint pad1:2; - GLuint kernel_start_pointer:26; + GLuint kernel_start_pointer:26; /* Offset from GENERAL_STATE_BASE */ };struct thread1
@@ -514,7 +128,22 @@ struct thread3struct brw_clip_unit_state {struct thread0 thread0; -struct thread1 thread1; +struct + { +GLuint pad0:7 ; +GLuint sw_exception_enable:1 ; +GLuint pad1:3 ; +GLuint mask_stack_exception_enable:1 ; +GLuint pad2:1 ; +GLuint illegal_op_exception_enable:1 ; +GLuint pad3:2 ; +GLuint floating_point_mode:1 ; +GLuint thread_priority:1 ; +GLuint binding_table_entry_count:8 ; +GLuint pad4:5 ; +GLuint single_program_flow:1 ; + } thread1; +struct thread2 thread2;struct thread3 thread3;
@@ -527,8 +156,8 @@ struct brw_clip_unit_state GLuint pad1:1; GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:6; /* may be less */ - GLuint pad3:1; + GLuint max_threads:5; /* may be less */ + GLuint pad3:2; } thread4; struct
@@ -537,7 +166,7 @@ struct brw_clip_unit_state GLuint clip_mode:3; GLuint userclip_enable_flags:8; GLuint userclip_must_clip:1; - GLuint pad1:1; + GLuint negative_w_clip_test:1; GLuint guard_band_enable:1; GLuint viewport_z_clip_enable:1; GLuint viewport_xy_clip_enable:1;
@@ -559,7 +188,105 @@ struct brw_clip_unit_stateGLfloat viewport_ymax; }; +struct gen6_blend_state +{ +struct { +GLuint dest_blend_factor:5 ; +GLuint source_blend_factor:5 ; +GLuint pad3:1 ; +GLuint blend_func:3 ; +GLuint pad2:1 ; +GLuint ia_dest_blend_factor:5 ; +GLuint ia_source_blend_factor:5 ; +GLuint pad1:1 ; +GLuint ia_blend_func:3 ; +GLuint pad0:1 ; +GLuint ia_blend_enable:1 ; +GLuint blend_enable:1 ; + } blend0; + +struct { +GLuint post_blend_clamp_enable:1 ; +GLuint pre_blend_clamp_enable:1 ; +GLuint clamp_range:2 ; +GLuint pad0:4 ; +GLuint x_dither_offset:2 ; +GLuint y_dither_offset:2 ; +GLuint dither_enable:1 ; +GLuint alpha_test_func:3 ; +GLuint alpha_test_enable:1 ; +GLuint pad1:1 ; +GLuint logic_op_func:4 ; +GLuint logic_op_enable:1 ; +GLuint pad2:1 ; +GLuint write_disable_b:1 ; +GLuint write_disable_g:1 ; +GLuint write_disable_r:1 ; +GLuint write_disable_a:1 ; +GLuint pad3:1 ; +GLuint alpha_to_coverage_dither:1 ; +GLuint alpha_to_one:1 ; +GLuint alpha_to_coverage:1 ; + } blend1; +}; + +struct gen6_color_calc_state +{ +struct { +GLuint alpha_test_format:1 ; +GLuint pad0:14 ; +GLuint round_disable:1 ; +GLuint bf_stencil_ref:8 ; +GLuint stencil_ref:8 ; + } cc0; +union { +GLfloat alpha_ref_f; +struct { +GLuint ui:8 ; +GLuint pad0:24 ; + } alpha_ref_fi; + } cc1; + +GLfloat constant_r; +GLfloat constant_g; +GLfloat constant_b; +GLfloat constant_a; +}; + +struct gen6_depth_stencil_state +{ +struct { +GLuint pad0:3 ; +GLuint bf_stencil_pass_depth_pass_op:3 ; +GLuint bf_stencil_pass_depth_fail_op:3 ; +GLuint bf_stencil_fail_op:3 ; +GLuint bf_stencil_func:3 ; +GLuint bf_stencil_enable:1 ; +GLuint pad1:2 ; +GLuint stencil_write_enable:1 ; +GLuint stencil_pass_depth_pass_op:3 ; +GLuint stencil_pass_depth_fail_op:3 ; +GLuint stencil_fail_op:3 ; +GLuint stencil_func:3 ; +GLuint stencil_enable:1 ; + } ds0; + +struct { +GLuint bf_stencil_write_mask:8 ; +GLuint bf_stencil_test_mask:8 ; +GLuint stencil_write_mask:8 ; +GLuint stencil_test_mask:8 ; + } ds1; + +struct { +GLuint pad0:26 ; +GLuint depth_write_enable:1 ; +GLuint depth_test_func:3 ; +GLuint pad1:1 ; +GLuint depth_test_enable:1 ; + } ds2; +};struct brw_cc_unit_state {
@@ -617,7 +344,7 @@ struct brw_cc_unit_statestruct {GLuint pad0:5 ; -GLuint cc_viewport_state_offset:27 ; +GLuint cc_viewport_state_offset:27 ;/* Offset from GENERAL_STATE_BASE */ } cc4; struct
@@ -653,8 +380,6 @@ struct brw_cc_unit_state } cc7; }; - -struct brw_sf_unit_state {struct thread0 thread0;
@@ -679,7 +404,7 @@ struct brw_sf_unit_state GLuint front_winding:1; GLuint viewport_transform:1; GLuint pad0:3; - GLuint sf_viewport_state_offset:27; + GLuint sf_viewport_state_offset:27; /* Offset from GENERAL_STATE_BASE */ } sf5; struct
@@ -704,7 +429,8 @@ struct brw_sf_unit_state GLuint use_point_size_state:1; GLuint subpixel_precision:1; GLuint sprite_point:1; - GLuint pad0:11; + GLuint pad0:10; + GLuint aa_line_distance_mode:1; GLuint trifan_pv:2; GLuint linestrip_pv:2; GLuint tristrip_pv:2;
@@ -713,6 +439,13 @@ struct brw_sf_unit_state }; +struct gen6_scissor_rect +{ +GLuint xmin:16 ; +GLuint ymin:16 ; +GLuint xmax:16 ; +GLuint ymax:16 ; +};struct brw_gs_unit_state {
@@ -723,14 +456,16 @@ struct brw_gs_unit_statestruct { -GLuint pad0:10 ; +GLuint pad0:8 ; +GLuint rendering_enable:1 ;/* for Ironlake */ +GLuint pad4:1 ;GLuint stats_enable:1 ;GLuint nr_urb_entries:7 ;GLuint pad1:1 ;GLuint urb_entry_allocation_size:5 ;GLuint pad2:1 ; -GLuint max_threads:1 ; -GLuint pad3:6 ; +GLuint max_threads:5 ; +GLuint pad3:2 ; } thread4; struct
@@ -744,9 +479,14 @@ struct brw_gs_unit_statestruct {GLuint max_vp_index:4 ; -GLuint pad0:26 ; -GLuint reorder_enable:1 ; +GLuint pad0:12 ; +GLuint svbi_post_inc_value:10 ;GLuint pad1:1 ; +GLuint svbi_post_inc_enable:1 ; +GLuint svbi_payload:1 ; +GLuint discard_adjaceny:1 ; +GLuint reorder_enable:1 ; +GLuint pad2:1 ; } gs6; };
@@ -766,8 +506,8 @@ struct brw_vs_unit_state GLuint pad1:1; GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:4; - GLuint pad3:3; + GLuint max_threads:6; + GLuint pad3:1; } thread4; struct
@@ -795,7 +535,7 @@ struct brw_wm_unit_statestruct {GLuint stats_enable:1 ; -GLuint pad0:1 ; +GLuint depth_buffer_clear:1 ;GLuint sampler_count:3 ;GLuint sampler_state_pointer:27 ; } wm4;
@@ -805,7 +545,16 @@ struct brw_wm_unit_state GLuint enable_8_pix:1; GLuint enable_16_pix:1; GLuint enable_32_pix:1; - GLuint pad0:7; + GLuint enable_con_32_pix:1; + GLuint enable_con_64_pix:1; + GLuint pad0:1; + +/* These next four bits are for Ironlake+ */ + GLuint fast_span_coverage_enable:1; + GLuint depth_buffer_clear:1; + GLuint depth_buffer_resolve_enable:1; + GLuint hierarchical_depth_buffer_resolve_enable:1; + GLuint legacy_global_depth_bias:1; GLuint line_stipple:1; GLuint depth_offset:1;
@@ -818,19 +567,49 @@ struct brw_wm_unit_state GLuint program_computes_depth:1; GLuint program_uses_killpixel:1; GLuint legacy_line_rast: 1; - GLuint pad1:1; - GLuint max_threads:6; - GLuint pad2:1; + GLuint transposed_urb_read_enable:1; + GLuint max_threads:7; } wm5;GLfloat global_depth_offset_constant;GLfloat global_depth_offset_scale; + +/* for Ironlake only */ +struct { +GLuint pad0:1 ; +GLuint grf_reg_count_1:3 ; +GLuint pad1:2 ; +GLuint kernel_start_pointer_1:26 ; + } wm8; + +struct { +GLuint pad0:1 ; +GLuint grf_reg_count_2:3 ; +GLuint pad1:2 ; +GLuint kernel_start_pointer_2:26 ; + } wm9; + +struct { +GLuint pad0:1 ; +GLuint grf_reg_count_3:3 ; +GLuint pad1:2 ; +GLuint kernel_start_pointer_3:26 ; + } wm10; };struct brw_sampler_default_color {GLfloat color[4 ]; }; +struct gen5_sampler_default_color { +uint8_t ub[4 ]; +float f[4 ]; +uint16_t hf[4 ]; +uint16_t us[4 ]; +int16_t s[4 ]; +uint8_t b[4 ]; +}; +struct brw_sampler_state {
@@ -842,7 +621,7 @@ struct brw_sampler_state GLuint mag_filter:3; GLuint mip_filter:2; GLuint base_level:5; - GLuint pad:1; + GLuint min_mag_neq:1; GLuint lod_preclamp:1; GLuint default_color_mode:1; GLuint pad0:1;
@@ -854,7 +633,8 @@ struct brw_sampler_state GLuint r_wrap_mode:3; GLuint t_wrap_mode:3; GLuint s_wrap_mode:3; - GLuint pad:3; + GLuint cube_control_mode:1; + GLuint pad:2; GLuint max_lod:10; GLuint min_lod:10; } ss1;
@@ -868,7 +648,9 @@ struct brw_sampler_statestruct { -GLuint pad:19 ; +GLuint non_normalized_coord:1 ; +GLuint pad:12 ; +GLuint address_round:6 ;GLuint max_aniso:3 ;GLuint chroma_key_mode:1 ;GLuint chroma_key_index:2 ;
@@ -878,6 +660,54 @@ struct brw_sampler_state } ss3; }; +struct gen7_sampler_state +{ +struct + { +GLuint aniso_algorithm:1 ; +GLuint lod_bias:13 ; +GLuint min_filter:3 ; +GLuint mag_filter:3 ; +GLuint mip_filter:2 ; +GLuint base_level:5 ; +GLuint pad1:1 ; +GLuint lod_preclamp:1 ; +GLuint default_color_mode:1 ; +GLuint pad0:1 ; +GLuint disable:1 ; + } ss0; + +struct + { +GLuint cube_control_mode:1 ; +GLuint shadow_function:3 ; +GLuint pad:4 ; +GLuint max_lod:12 ; +GLuint min_lod:12 ; + } ss1; + +struct + { +GLuint pad:5 ; +GLuint default_color_pointer:27 ; + } ss2; + +struct + { +GLuint r_wrap_mode:3 ; +GLuint t_wrap_mode:3 ; +GLuint s_wrap_mode:3 ; +GLuint pad:1 ; +GLuint non_normalized_coord:1 ; +GLuint trilinear_quality:2 ; +GLuint address_round:6 ; +GLuint max_aniso:3 ; +GLuint chroma_key_mode:1 ; +GLuint chroma_key_index:2 ; +GLuint chroma_key_enable:1 ; +GLuint pad0:6 ; + } ss3; +};struct brw_clipper_viewport {
@@ -901,94 +731,48 @@ struct brw_sf_viewportGLfloat m22;GLfloat m30;GLfloat m31; -GLfloat m32; - } viewport; - -struct { -GLshort xmin; -GLshort ymin; -GLshort xmax; -GLshort ymax; - } scissor; -}; - -/* Documented in the subsystem/shared-functions/sampler chapter... -*/ -struct brw_surface_state -{ -struct { -GLuint cube_pos_z:1 ; -GLuint cube_neg_z:1 ; -GLuint cube_pos_y:1 ; -GLuint cube_neg_y:1 ; -GLuint cube_pos_x:1 ; -GLuint cube_neg_x:1 ; -GLuint pad:4 ; -GLuint mipmap_layout_mode:1 ; -GLuint vert_line_stride_ofs:1 ; -GLuint vert_line_stride:1 ; -GLuint color_blend:1 ; -GLuint writedisable_blue:1 ; -GLuint writedisable_green:1 ; -GLuint writedisable_red:1 ; -GLuint writedisable_alpha:1 ; -GLuint surface_format:9 ; -GLuint data_return_format:1 ; -GLuint pad0:1 ; -GLuint surface_type:3 ; - } ss0; - -struct { -GLuint base_addr; - } ss1; - -struct { -GLuint pad:2 ; -GLuint mip_count:4 ; -GLuint width:13 ; -GLuint height:13 ; - } ss2; +GLfloat m32; + } viewport; +/* scissor coordinates are inclusive */ struct { -GLuint tile_walk:1 ; -GLuint tiled_surface:1 ; -GLuint pad:1 ; -GLuint pitch:18 ; -GLuint depth:11 ; - } ss3; - -struct { -GLuint pad:19 ; -GLuint min_array_elt:9 ; -GLuint min_lod:4 ; - } ss4; +GLshort xmin; +GLshort ymin; +GLshort xmax; +GLshort ymax; + } scissor; }; +struct gen6_sf_viewport { +GLfloat m00; +GLfloat m11; +GLfloat m22; +GLfloat m30; +GLfloat m31; +GLfloat m32; +}; - -struct brw_vertex_buffer_state -{ +struct gen7_sf_clip_viewport {struct { -GLuint pitch:11 ; -GLuint pad:15 ; -GLuint access_type:1 ; -GLuint vb_index:5 ; - } vb0; - -GLuint start_addr; -GLuint max_index; -#if 1 -GLuint instance_data_step_rate;/* not included for sequential/random vertices? */ -#endif -}; +GLfloat m00; +GLfloat m11; +GLfloat m22; +GLfloat m30; +GLfloat m31; +GLfloat m32; + } viewport; -#define BRW_VBP_MAX 17 +GLuint pad0[2 ]; -struct brw_vb_array_state { -struct header header; -struct brw_vertex_buffer_state vb[BRW_VBP_MAX ]; -}; +struct { +GLfloat xmin; +GLfloat xmax; +GLfloat ymin; +GLfloat ymax; + } guardband; +GLfloat pad1[4 ]; +};struct brw_vertex_element_state {
@@ -1013,14 +797,6 @@ struct brw_vertex_element_state } ve1; }; -#define BRW_VEP_MAX 18 - -struct brw_vertex_element_packet { -struct header header; -struct brw_vertex_element_state ve[BRW_VEP_MAX ];/* note: less than _TNL_ATTRIB_MAX */ -}; - -struct brw_urb_immediate {GLuint opcode:4 ;GLuint offset:6 ;
@@ -1067,18 +843,18 @@ struct brw_instructionunion {struct { -GLuint dest_reg_file:2 ;/* 0x00000003 */ -GLuint dest_reg_type:3 ;/* 0x0000001c */ -GLuint src0_reg_file:2 ;/* 0x00000060 */ -GLuint src0_reg_type:3 ;/* 0x00000380 */ -GLuint src1_reg_file:2 ;/* 0x00000c00 */ -GLuint src1_reg_type:3 ;/* 0x00007000 */ -GLuint pad:1 ;/* 0x00008000 */ -GLuint dest_subreg_nr:5 ;/* 0x001f0000 */ -GLuint dest_reg_nr:8 ;/* 0x1f700000 */ -GLuint dest_horiz_stride:2 ;/* 0x60000000 */ -GLuint dest_address_mode:1 ;/* 0x80000000 */ - } da1;/* direct align1 */ +GLuint dest_reg_file:2 ; +GLuint dest_reg_type:3 ; +GLuint src0_reg_file:2 ; +GLuint src0_reg_type:3 ; +GLuint src1_reg_file:2 ; +GLuint src1_reg_type:3 ; +GLuint pad:1 ; +GLuint dest_subreg_nr:5 ; +GLuint dest_reg_nr:8 ; +GLuint dest_horiz_stride:2 ; +GLuint dest_address_mode:1 ; + } da1;struct {
@@ -1086,14 +862,14 @@ struct brw_instruction GLuint dest_reg_type:3; GLuint src0_reg_file:2; GLuint src0_reg_type:3; - GLuint src1_reg_file:2; /* 0x00000c00 */ - GLuint src1_reg_type:3; /* 0x00007000 */ + GLuint src1_reg_file:2; /* 0x00000c00 */ + GLuint src1_reg_type:3; /* 0x00007000 */ GLuint pad:1; GLint dest_indirect_offset:10; /* offset against the deref'd address reg */ GLuint dest_subreg_nr:3; /* subnr for the address reg a0.x */ GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; - } ia1;/* indirect align1 */ + } ia1;struct {
@@ -1103,13 +879,13 @@ struct brw_instruction GLuint src0_reg_type:3; GLuint src1_reg_file:2; GLuint src1_reg_type:3; - GLuint pad0:1; + GLuint pad:1; GLuint dest_writemask:4; GLuint dest_subreg_nr:1; GLuint dest_reg_nr:8; GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; - } da16;/* direct align16 */ + } da16;struct {
@@ -1123,7 +899,7 @@ struct brw_instruction GLuint dest_subreg_nr:3; GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; - } ia16;/* indirect align16 */ + } ia16;struct {GLuint dest_reg_file:2 ;
@@ -1137,43 +913,46 @@ struct brw_instruction GLint jump_count:16; } branch_gen6; -struct - { -GLuint dest_reg_file:1 ;/* used in Gen6, deleted in Gen7 */ +struct { +GLuint dest_reg_file:1 ;GLuint flag_subreg_nr:1 ; -GLuint flag_reg_nr:1 ;/* not in Gen6. Add in Gen7 */ -GLuint pad1:1 ;/* reserved */ -GLuint src0_modifier:2 ; -GLuint src1_modifier:2 ; -GLuint src2_modifier:2 ; +GLuint flag_reg_nr:1 ; +GLuint pad0:1 ; +GLuint src0_abs:1 ; +GLuint src0_negate:1 ; +GLuint src1_abs:1 ; +GLuint src1_negate:1 ; +GLuint src2_abs:1 ; +GLuint src2_negate:1 ;GLuint src_reg_type:2 ;GLuint dest_reg_type:2 ; -GLuint pad2:1 ;/* reserved */ +GLuint pad1:1 ;GLuint nib_ctrl:1 ; -GLuint pad3:1 ;/* reserved */ +GLuint pad2:1 ;GLuint dest_writemask:4 ;GLuint dest_subreg_nr:3 ;GLuint dest_reg_nr:8 ; } da3src; +uint32_t ud; } bits1;union {struct { -GLuint src0_subreg_nr:5 ;/* 0x0000001f */ -GLuint src0_reg_nr:8 ;/* 0x00001fe0 */ -GLuint src0_abs:1 ;/* 0x00002000 */ -GLuint src0_negate:1 ;/* 0x00004000 */ -GLuint src0_address_mode:1 ;/* 0x00008000 */ -GLuint src0_horiz_stride:2 ;/* 0x00030000 */ -GLuint src0_width:3 ;/* 0x001c0000 */ -GLuint src0_vert_stride:4 ;/* 0x01e00000 */ -GLuint flag_subreg_nr:1 ;/* 0x02000000 */ -GLuint flag_reg_nr:1 ;/* 0x04000000 */ -GLuint pad:5 ;/* 0xf8000000 */ - } da1;/* direct align1 */ +GLuint src0_subreg_nr:5 ; +GLuint src0_reg_nr:8 ; +GLuint src0_abs:1 ; +GLuint src0_negate:1 ; +GLuint src0_address_mode:1 ; +GLuint src0_horiz_stride:2 ; +GLuint src0_width:3 ; +GLuint src0_vert_stride:4 ; +GLuint flag_subreg_nr:1 ; +GLuint flag_reg_nr:1 ; +GLuint pad:5 ; + } da1;struct {
@@ -1187,8 +966,8 @@ struct brw_instruction GLuint src0_vert_stride:4; GLuint flag_subreg_nr:1; GLuint flag_reg_nr:1; - GLuint pad:5; - } ia1;/* indirect align1 */ + GLuint pad:5; + } ia1;struct {
@@ -1206,7 +985,7 @@ struct brw_instruction GLuint flag_subreg_nr:1; GLuint flag_reg_nr:1; GLuint pad1:5; - } da16;/* direct align16 */ + } da16;struct {
@@ -1224,32 +1003,33 @@ struct brw_instruction GLuint flag_subreg_nr:1; GLuint flag_reg_nr:1; GLuint pad1:5; - } ia16;/* indirect align16 */ + } ia16; -struct - { +/* Extended Message Descriptor for Ironlake (Gen5) SEND instruction. +* +* Does not apply to Gen6+. The SFID/message target moved to bits +* 27:24 of the header (destreg__conditionalmod); EOT is in bits3. +*/ +struct + { +GLuint pad:26 ; +GLuint end_of_thread:1 ; +GLuint pad1:1 ; +GLuint sfid:4 ; + } send_gen5;/* for Ironlake only */ + +struct {GLuint src0_rep_ctrl:1 ;GLuint src0_swizzle:8 ;GLuint src0_subreg_nr:3 ;GLuint src0_reg_nr:8 ; -GLuint pad0:1 ;/* reserved */ +GLuint pad0:1 ;GLuint src1_rep_ctrl:1 ;GLuint src1_swizzle:8 ; -GLuint src1_subreg_nr_low:2 ;/* src1_subreg_nr spans on two DWORDs */ +GLuint src1_subreg_nr_low:2 ; } da3src; -struct - { -GLuint pad:26 ; -GLuint end_of_thread:1 ; -GLuint pad1:1 ; -GLuint sfid:4 ; - } send_gen5;/* for GEN5 only */ -struct - { -GLuint pad:26 ; -GLuint msg_ext:6 ; - } msg_ext; +uint32_t ud; } bits2; union
@@ -1265,7 +1045,7 @@ struct brw_instruction GLuint src1_width:3; GLuint src1_vert_stride:4; GLuint pad0:7; - } da1;/* direct align1 */ + } da1;struct {
@@ -1281,7 +1061,7 @@ struct brw_instruction GLuint pad1:1; GLuint src1_vert_stride:4; GLuint pad2:7; - } da16;/* direct align16 */ + } da16;struct {
@@ -1293,8 +1073,8 @@ struct brw_instruction GLuint src1_horiz_stride:2; GLuint src1_width:3; GLuint src1_vert_stride:4; - GLuint pad1:7; - } ia1;/* indirect align1 */ + GLuint pad1:7; + } ia1;struct {
@@ -1310,19 +1090,15 @@ struct brw_instruction GLuint pad1:1; GLuint src1_vert_stride:4; GLuint pad2:7; - } ia16;/* indirect align16 */ + } ia16; +struct { -GLuint src1_subreg_nr_high:1 ;/* src1_subreg_nr spans on two DWORDs */ -GLuint src1_reg_nr:8 ; -GLuint pad0:1 ;/* reserved */ -GLuint src2_rep_ctrl:1 ; -GLuint src2_swizzle:8 ; -GLuint src2_subreg_nr:3 ; -GLuint src2_reg_nr:8 ; -GLuint pad1:2 ;/* reserved */ - } da3src; +GLint jump_count:16 ;/* note: signed */ +GLuint pop_count:4 ; +GLuint pad0:12 ; + } if_else;/* This is also used for gen7 IF/ELSE instructions */ struct
@@ -1342,6 +1118,76 @@ struct brw_instructionGLint JIP ;/* used by Gen6 CALL instructions; Gen7 JMPI */ +/** +* \defgroup SEND instructions / Message Descriptors +* +* @{ +*/ + +/** +* Generic Message Descriptor for Gen4 SEND instructions. The structs +* below expand function_control to something specific for their +* message. Due to struct packing issues, they duplicate these bits. +* +* See the G45 PRM, Volume 4, Table 14-15. +*/ +struct { +GLuint function_control:16 ; +GLuint response_length:4 ; +GLuint msg_length:4 ; +GLuint msg_target:4 ; +GLuint pad1:3 ; +GLuint end_of_thread:1 ; + } generic; + +/** +* Generic Message Descriptor for Gen5-7 SEND instructions. +* +* See the Sandybridge PRM, Volume 2 Part 2, Table 8-15. (Sadly, most +* of the information on the SEND instruction is missing from the public +* Ironlake PRM.) +* +* The table claims that bit 31 is reserved/MBZ on Gen6+, but it lies. +* According to the SEND instruction description: +* "The MSb of the message description, the EOT field, always comes from +* bit 127 of the instruction word"...which is bit 31 of this field. +*/ +struct { +GLuint function_control:19 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } generic_gen5; + +struct { +GLuint opcode:1 ; +GLuint requester_type:1 ; +GLuint pad:2 ; +GLuint resource_select:1 ; +GLuint pad1:11 ; +GLuint response_length:4 ; +GLuint msg_length:4 ; +GLuint msg_target:4 ; +GLuint pad2:3 ; +GLuint end_of_thread:1 ; + } thread_spawner; + +struct { +GLuint opcode:1 ; +GLuint requester_type:1 ; +GLuint pad0:2 ; +GLuint resource_select:1 ; +GLuint pad1:14 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad2:2 ; +GLuint end_of_thread:1 ; + } thread_spawner_gen5; + +/** G45 PRM, Volume 4, Section 6.1.1.1 */ struct {GLuint function:4 ;GLuint int_type:1 ;
@@ -1356,6 +1202,23 @@ struct brw_instruction GLuint end_of_thread:1; } math; +/** Ironlake PRM, Volume 4 Part 1, Section 6.1.1.1 */ +struct { +GLuint function:4 ; +GLuint int_type:1 ; +GLuint precision:1 ; +GLuint saturate:1 ; +GLuint data_type:1 ; +GLuint snapshot:1 ; +GLuint pad0:10 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } math_gen5; + +/** G45 PRM, Volume 4, Section 4.8.1.1.1 [DevBW] and [DevCL] */ struct {GLuint binding_table_index:8 ;GLuint sampler:4 ;
@@ -1368,9 +1231,95 @@ struct brw_instruction GLuint end_of_thread:1; } sampler; +/** G45 PRM, Volume 4, Section 4.8.1.1.2 [DevCTG] */ +struct { +GLuint binding_table_index:8 ; +GLuint sampler:4 ; +GLuint msg_type:4 ; +GLuint response_length:4 ; +GLuint msg_length:4 ; +GLuint msg_target:4 ; +GLuint pad1:3 ; +GLuint end_of_thread:1 ; + } sampler_g4x; + +/** Ironlake PRM, Volume 4 Part 1, Section 4.11.1.1.3 */ +struct { +GLuint binding_table_index:8 ; +GLuint sampler:4 ; +GLuint msg_type:4 ; +GLuint simd_mode:2 ; +GLuint pad0:1 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } sampler_gen5; + +struct { +GLuint binding_table_index:8 ; +GLuint sampler:4 ; +GLuint msg_type:5 ; +GLuint simd_mode:2 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } sampler_gen7; +struct brw_urb_immediate urb;struct { +GLuint opcode:4 ; +GLuint offset:6 ; +GLuint swizzle_control:2 ; +GLuint pad:1 ; +GLuint allocate:1 ; +GLuint used:1 ; +GLuint complete:1 ; +GLuint pad0:3 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } urb_gen5; + +struct { +GLuint opcode:3 ; +GLuint offset:11 ; +GLuint swizzle_control:1 ; +GLuint complete:1 ; +GLuint per_slot_offset:1 ; +GLuint pad0:2 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } urb_gen7; + +struct { +GLuint binding_table_index:8 ; +GLuint search_path_index:3 ; +GLuint lut_subindex:2 ; +GLuint message_type:2 ; +GLuint pad0:4 ; +GLuint header_present:1 ; + } vme_gen6; + +struct { +GLuint binding_table_index:8 ; +GLuint pad0:5 ; +GLuint message_type:2 ; +GLuint pad1:4 ; +GLuint header_present:1 ; + } cre_gen75; + +/** 965 PRM, Volume 4, Section 5.10.1.1: Message Descriptor */ +struct {GLuint binding_table_index:8 ;GLuint msg_control:4 ;GLuint msg_type:2 ;
@@ -1382,109 +1331,61 @@ struct brw_instruction GLuint end_of_thread:1; } dp_read; +/** G45 PRM, Volume 4, Section 5.10.1.1.2 */ struct {GLuint binding_table_index:8 ;GLuint msg_control:3 ; -GLuint last_render_target:1 ; -GLuint msg_type:3 ; -GLuint send_commit_msg:1 ; +GLuint msg_type:3 ; +GLuint target_cache:2 ;GLuint response_length:4 ;GLuint msg_length:4 ;GLuint msg_target:4 ;GLuint pad1:3 ;GLuint end_of_thread:1 ; - } dp_write; + } dp_read_g4x; +/** Ironlake PRM, Volume 4 Part 1, Section 5.10.2.1.2. */ struct { -GLuint opcode:1 ; -GLuint requester_type:1 ; -GLuint pad:2 ; -GLuint resource_select:1 ; -GLuint pad1:11 ; -GLuint response_length:4 ; -GLuint msg_length:4 ; -GLuint msg_target:4 ; -GLuint pad2:3 ; -GLuint end_of_thread:1 ; - } thread_spawner; +GLuint binding_table_index:8 ; +GLuint msg_control:4 ; +GLuint msg_type:2 ; +GLuint target_cache:2 ; +GLuint pad0:3 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } dp_read_gen5; +/** G45 PRM, Volume 4, Section 5.10.1.1.2. For both Gen4 and G45. */ struct { -GLuint pad:16 ; +GLuint binding_table_index:8 ; +GLuint msg_control:3 ; +GLuint last_render_target:1 ; +GLuint msg_type:3 ; +GLuint send_commit_msg:1 ;GLuint response_length:4 ;GLuint msg_length:4 ;GLuint msg_target:4 ;GLuint pad1:3 ;GLuint end_of_thread:1 ; - } generic; - -struct { -GLuint function:4 ; -GLuint int_type:1 ; -GLuint precision:1 ; -GLuint saturate:1 ; -GLuint data_type:1 ; -GLuint snapshot:1 ; -GLuint pad0:10 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } math_gen5; - -struct { -GLuint opcode:4 ; -GLuint offset:6 ; -GLuint swizzle_control:2 ; -GLuint pad:1 ; -GLuint allocate:1 ; -GLuint used:1 ; -GLuint complete:1 ; -GLuint pad0:3 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } urb_gen5; - -struct { -GLuint binding_table_index:8 ; -GLuint sampler:4 ; -GLuint msg_type:4 ; -GLuint simd_mode:2 ; -GLuint pad0:1 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } sampler_gen5; - -struct { -GLuint binding_table_index:8 ; -GLuint sampler:4 ; -GLuint msg_type:5 ; -GLuint simd_mode:2 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } sampler_gen7; + } dp_write; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:4 ; -GLuint msg_type:2 ; -GLuint target_cache:2 ; -GLuint pad0:3 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_read_gen5; +/** Ironlake PRM, Volume 4 Part 1, Section 5.10.2.1.2. */ +struct { +GLuint binding_table_index:8 ; +GLuint msg_control:3 ; +GLuint last_render_target:1 ; +GLuint msg_type:3 ; +GLuint send_commit_msg:1 ; +GLuint pad0:3 ; +GLuint header_present:1 ; +GLuint response_length:5 ; +GLuint msg_length:4 ; +GLuint pad1:2 ; +GLuint end_of_thread:1 ; + } dp_write_gen5;/** * Message for the Sandybridge Sampler Cache or Constant Cache Data Port.
@@ -1503,20 +1404,6 @@ struct brw_instruction GLuint end_of_thread:1; } gen6_dp_sampler_const_cache; -struct { -GLuint binding_table_index:8 ; -GLuint msg_control:3 ; -GLuint last_render_target:1 ; -GLuint msg_type:3 ; -GLuint send_commit_msg:1 ; -GLuint pad0:3 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } dp_write_gen5; -/** * Message for the Sandybridge Render Cache Data Port. *
@@ -1561,51 +1448,47 @@ struct brw_instruction } gen7_dp;/** @} */ -struct { -GLuint opcode:1 ; -GLuint requester_type:1 ; -GLuint pad0:2 ; -GLuint resource_select:1 ; -GLuint pad1:14 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad2:2 ; -GLuint end_of_thread:1 ; - } thread_spawner_gen5; - -struct { -GLuint binding_table_index:8 ; -GLuint search_path_index:3 ; -GLuint lut_subindex:2 ; -GLuint message_type:2 ; -GLuint pad0:4 ; -GLuint header_present:1 ; - } vme_gen6; -struct { -GLuint binding_table_index:8 ; -GLuint pad0:5 ; -GLuint message_type:2 ; -GLuint pad1:4 ; -GLuint header_present:1 ; - } cre_gen75; -struct { -GLuint pad:19 ; -GLuint header_present:1 ; -GLuint response_length:5 ; -GLuint msg_length:4 ; -GLuint pad1:2 ; -GLuint end_of_thread:1 ; - } generic_gen5; +struct { +GLuint src1_subreg_nr_high:1 ; +GLuint src1_reg_nr:8 ; +GLuint pad0:1 ; +GLuint src2_rep_ctrl:1 ; +GLuint src2_swizzle:8 ; +GLuint src2_subreg_nr:3 ; +GLuint src2_reg_nr:8 ; +GLuint pad1:2 ; + } da3src; -GLuint ud;GLint d; - GLfloat f; +GLuint ud; +float f; } bits3;char *first_reloc_target, *second_reloc_target;// first for JIP, second for UIP GLint first_reloc_offset, second_reloc_offset;// in number of instructions }; +struct brw_compact_instruction { +struct { +unsigned opcode:7 ;/* 0- 6 */ +unsigned debug_control:1 ;/* 7- 7 */ +unsigned control_index:5 ;/* 8-12 */ +unsigned data_type_index:5 ;/* 13-17 */ +unsigned sub_reg_index:5 ;/* 18-22 */ +unsigned acc_wr_control:1 ;/* 23-23 */ +unsigned conditionalmod:4 ;/* 24-27 */ +unsigned flag_subreg_nr:1 ;/* 28-28 */ +unsigned cmpt_ctrl:1 ;/* 29-29 */ +unsigned src0_index:2 ;/* 30-31 */ + } dw0; + +struct { +unsigned src0_index:3 ;/* 32-24 */ +unsigned src1_index:5 ;/* 35-39 */ +unsigned dst_reg_nr:8 ;/* 40-47 */ +unsigned src0_reg_nr:8 ;/* 48-55 */ +unsigned src1_reg_nr:8 ;/* 56-63 */ + } dw1; +};#endif
Signature · 1 line
1.7.7.5
PATCH 17/90 assembler: Remove trailing white spaces from brw_structs.h
In reply to Damien Lespiau--- assembler/brw_structs.h | 488 +++++++++++++++++++++++----------------------- 1 files changed, 244 insertions(+), 244 deletions(-)
assembler/brw_structs.h +244 -244
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,13 +22,13 @@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 BRW_STRUCTS_H #define BRW_STRUCTS_H
@@ -45,30 +45,30 @@ struct brw_urb_fence {struct { -GLuint length:8 ; -GLuint vs_realloc:1 ; -GLuint gs_realloc:1 ; -GLuint clp_realloc:1 ; -GLuint sf_realloc:1 ; -GLuint vfe_realloc:1 ; -GLuint cs_realloc:1 ; +GLuint length:8 ; +GLuint vs_realloc:1 ; +GLuint gs_realloc:1 ; +GLuint clp_realloc:1 ; +GLuint sf_realloc:1 ; +GLuint vfe_realloc:1 ; +GLuint cs_realloc:1 ;GLuint pad:2 ; -GLuint opcode:16 ; +GLuint opcode:16 ; } header;struct { -GLuint vs_fence:10 ; -GLuint gs_fence:10 ; -GLuint clp_fence:10 ; +GLuint vs_fence:10 ; +GLuint gs_fence:10 ; +GLuint clp_fence:10 ;GLuint pad:2 ; } bits0;struct { -GLuint sf_fence:10 ; -GLuint vf_fence:10 ; -GLuint cs_fence:11 ; +GLuint sf_fence:10 ; +GLuint vf_fence:10 ; +GLuint cs_fence:11 ;GLuint pad:1 ; } bits1; };
@@ -80,46 +80,46 @@ struct brw_urb_fencestruct thread0 {GLuint pad0:1 ; -GLuint grf_reg_count:3 ; +GLuint grf_reg_count:3 ;GLuint pad1:2 ;GLuint kernel_start_pointer:26 ;/* Offset from GENERAL_STATE_BASE */ };struct thread1 { -GLuint ext_halt_exception_enable:1 ; -GLuint sw_exception_enable:1 ; -GLuint mask_stack_exception_enable:1 ; -GLuint timeout_exception_enable:1 ; -GLuint illegal_op_exception_enable:1 ; +GLuint ext_halt_exception_enable:1 ; +GLuint sw_exception_enable:1 ; +GLuint mask_stack_exception_enable:1 ; +GLuint timeout_exception_enable:1 ; +GLuint illegal_op_exception_enable:1 ;GLuint pad0:3 ;GLuint depth_coef_urb_read_offset:6 ;/* WM only */ GLuint pad1:2 ; -GLuint floating_point_mode:1 ; -GLuint thread_priority:1 ; -GLuint binding_table_entry_count:8 ; +GLuint floating_point_mode:1 ; +GLuint thread_priority:1 ; +GLuint binding_table_entry_count:8 ;GLuint pad3:5 ; -GLuint single_program_flow:1 ; +GLuint single_program_flow:1 ; };struct thread2 { -GLuint per_thread_scratch_space:4 ; +GLuint per_thread_scratch_space:4 ;GLuint pad0:6 ; -GLuint scratch_space_base_pointer:22 ; +GLuint scratch_space_base_pointer:22 ; }; - +struct thread3 { -GLuint dispatch_grf_start_reg:4 ; -GLuint urb_entry_read_offset:6 ; +GLuint dispatch_grf_start_reg:4 ; +GLuint urb_entry_read_offset:6 ;GLuint pad0:1 ; -GLuint urb_entry_read_length:6 ; +GLuint urb_entry_read_length:6 ;GLuint pad1:1 ; -GLuint const_urb_entry_read_offset:6 ; +GLuint const_urb_entry_read_offset:6 ;GLuint pad2:1 ; -GLuint const_urb_entry_read_length:6 ; +GLuint const_urb_entry_read_length:6 ;GLuint pad3:1 ; };
@@ -151,41 +151,41 @@ struct brw_clip_unit_state { GLuint pad0:9; GLuint gs_output_stats:1; /* not always */ - GLuint stats_enable:1; - GLuint nr_urb_entries:7; + GLuint stats_enable:1; + GLuint nr_urb_entries:7; GLuint pad1:1; - GLuint urb_entry_allocation_size:5; + GLuint urb_entry_allocation_size:5; GLuint pad2:1; GLuint max_threads:5; /* may be less */ GLuint pad3:2; - } thread4; - + } thread4; +struct {GLuint pad0:13 ; -GLuint clip_mode:3 ; -GLuint userclip_enable_flags:8 ; -GLuint userclip_must_clip:1 ; +GLuint clip_mode:3 ; +GLuint userclip_enable_flags:8 ; +GLuint userclip_must_clip:1 ;GLuint negative_w_clip_test:1 ; -GLuint guard_band_enable:1 ; -GLuint viewport_z_clip_enable:1 ; -GLuint viewport_xy_clip_enable:1 ; -GLuint vertex_position_space:1 ; -GLuint api_mode:1 ; +GLuint guard_band_enable:1 ; +GLuint viewport_z_clip_enable:1 ; +GLuint viewport_xy_clip_enable:1 ; +GLuint vertex_position_space:1 ; +GLuint api_mode:1 ;GLuint pad2:1 ; } clip5; - +struct {GLuint pad0:5 ; -GLuint clipper_viewport_state_ptr:27 ; +GLuint clipper_viewport_state_ptr:27 ; } clip6; - -GLfloat viewport_xmin; -GLfloat viewport_xmax; -GLfloat viewport_ymin; -GLfloat viewport_ymax; + +GLfloat viewport_xmin; +GLfloat viewport_xmax; +GLfloat viewport_ymin; +GLfloat viewport_ymax; };struct gen6_blend_state
@@ -293,88 +293,88 @@ struct brw_cc_unit_statestruct {GLuint pad0:3 ; -GLuint bf_stencil_pass_depth_pass_op:3 ; -GLuint bf_stencil_pass_depth_fail_op:3 ; -GLuint bf_stencil_fail_op:3 ; -GLuint bf_stencil_func:3 ; -GLuint bf_stencil_enable:1 ; +GLuint bf_stencil_pass_depth_pass_op:3 ; +GLuint bf_stencil_pass_depth_fail_op:3 ; +GLuint bf_stencil_fail_op:3 ; +GLuint bf_stencil_func:3 ; +GLuint bf_stencil_enable:1 ;GLuint pad1:2 ; -GLuint stencil_write_enable:1 ; -GLuint stencil_pass_depth_pass_op:3 ; -GLuint stencil_pass_depth_fail_op:3 ; -GLuint stencil_fail_op:3 ; -GLuint stencil_func:3 ; -GLuint stencil_enable:1 ; +GLuint stencil_write_enable:1 ; +GLuint stencil_pass_depth_pass_op:3 ; +GLuint stencil_pass_depth_fail_op:3 ; +GLuint stencil_fail_op:3 ; +GLuint stencil_func:3 ; +GLuint stencil_enable:1 ; } cc0; - +struct { -GLuint bf_stencil_ref:8 ; -GLuint stencil_write_mask:8 ; -GLuint stencil_test_mask:8 ; -GLuint stencil_ref:8 ; +GLuint bf_stencil_ref:8 ; +GLuint stencil_write_mask:8 ; +GLuint stencil_test_mask:8 ; +GLuint stencil_ref:8 ; } cc1; - +struct { -GLuint logicop_enable:1 ; +GLuint logicop_enable:1 ;GLuint pad0:10 ; -GLuint depth_write_enable:1 ; -GLuint depth_test_function:3 ; -GLuint depth_test:1 ; -GLuint bf_stencil_write_mask:8 ; -GLuint bf_stencil_test_mask:8 ; +GLuint depth_write_enable:1 ; +GLuint depth_test_function:3 ; +GLuint depth_test:1 ; +GLuint bf_stencil_write_mask:8 ; +GLuint bf_stencil_test_mask:8 ; } cc2; - +struct {GLuint pad0:8 ; -GLuint alpha_test_func:3 ; -GLuint alpha_test:1 ; -GLuint blend_enable:1 ; -GLuint ia_blend_enable:1 ; +GLuint alpha_test_func:3 ; +GLuint alpha_test:1 ; +GLuint blend_enable:1 ; +GLuint ia_blend_enable:1 ;GLuint pad1:1 ;GLuint alpha_test_format:1 ;GLuint pad2:16 ; } cc3; - +struct { -GLuint pad0:5 ; +GLuint pad0:5 ;GLuint cc_viewport_state_offset:27 ;/* Offset from GENERAL_STATE_BASE */ } cc4; - +struct {GLuint pad0:2 ; -GLuint ia_dest_blend_factor:5 ; -GLuint ia_src_blend_factor:5 ; -GLuint ia_blend_function:3 ; -GLuint statistics_enable:1 ; -GLuint logicop_func:4 ; +GLuint ia_dest_blend_factor:5 ; +GLuint ia_src_blend_factor:5 ; +GLuint ia_blend_function:3 ; +GLuint statistics_enable:1 ; +GLuint logicop_func:4 ;GLuint pad1:11 ; -GLuint dither_enable:1 ; +GLuint dither_enable:1 ; } cc5;struct { -GLuint clamp_post_alpha_blend:1 ; -GLuint clamp_pre_alpha_blend:1 ; -GLuint clamp_range:2 ; +GLuint clamp_post_alpha_blend:1 ; +GLuint clamp_pre_alpha_blend:1 ; +GLuint clamp_range:2 ;GLuint pad0:11 ; -GLuint y_dither_offset:2 ; -GLuint x_dither_offset:2 ; -GLuint dest_blend_factor:5 ; -GLuint src_blend_factor:5 ; -GLuint blend_function:3 ; +GLuint y_dither_offset:2 ; +GLuint x_dither_offset:2 ; +GLuint dest_blend_factor:5 ; +GLuint src_blend_factor:5 ; +GLuint blend_function:3 ; } cc6;struct {union { -GLfloat f; +GLfloat f;GLubyte ub[4 ]; } alpha_ref; } cc7;
@@ -390,51 +390,51 @@ struct brw_sf_unit_statestruct {GLuint pad0:10 ; -GLuint stats_enable:1 ; -GLuint nr_urb_entries:7 ; +GLuint stats_enable:1 ; +GLuint nr_urb_entries:7 ;GLuint pad1:1 ; -GLuint urb_entry_allocation_size:5 ; +GLuint urb_entry_allocation_size:5 ;GLuint pad2:1 ; -GLuint max_threads:6 ; +GLuint max_threads:6 ;GLuint pad3:1 ; - } thread4; + } thread4;struct { -GLuint front_winding:1 ; -GLuint viewport_transform:1 ; +GLuint front_winding:1 ; +GLuint viewport_transform:1 ;GLuint pad0:3 ;GLuint sf_viewport_state_offset:27 ;/* Offset from GENERAL_STATE_BASE */ } sf5; - +struct {GLuint pad0:9 ; -GLuint dest_org_vbias:4 ; -GLuint dest_org_hbias:4 ; -GLuint scissor:1 ; -GLuint disable_2x2_trifilter:1 ; -GLuint disable_zero_pix_trifilter:1 ; -GLuint point_rast_rule:2 ; -GLuint line_endcap_aa_region_width:2 ; -GLuint line_width:4 ; -GLuint fast_scissor_disable:1 ; -GLuint cull_mode:2 ; -GLuint aa_enable:1 ; +GLuint dest_org_vbias:4 ; +GLuint dest_org_hbias:4 ; +GLuint scissor:1 ; +GLuint disable_2x2_trifilter:1 ; +GLuint disable_zero_pix_trifilter:1 ; +GLuint point_rast_rule:2 ; +GLuint line_endcap_aa_region_width:2 ; +GLuint line_width:4 ; +GLuint fast_scissor_disable:1 ; +GLuint cull_mode:2 ; +GLuint aa_enable:1 ; } sf6;struct { -GLuint point_size:11 ; -GLuint use_point_size_state:1 ; -GLuint subpixel_precision:1 ; -GLuint sprite_point:1 ; +GLuint point_size:11 ; +GLuint use_point_size_state:1 ; +GLuint subpixel_precision:1 ; +GLuint sprite_point:1 ;GLuint pad0:10 ;GLuint aa_line_distance_mode:1 ; -GLuint trifan_pv:2 ; -GLuint linestrip_pv:2 ; -GLuint tristrip_pv:2 ; -GLuint line_last_pixel_enable:1 ; +GLuint trifan_pv:2 ; +GLuint linestrip_pv:2 ; +GLuint tristrip_pv:2 ; +GLuint line_last_pixel_enable:1 ; } sf7; };
@@ -459,33 +459,33 @@ struct brw_gs_unit_state GLuint pad0:8; GLuint rendering_enable:1; /* for Ironlake */ GLuint pad4:1; - GLuint stats_enable:1; - GLuint nr_urb_entries:7; + GLuint stats_enable:1; + GLuint nr_urb_entries:7; GLuint pad1:1; - GLuint urb_entry_allocation_size:5; + GLuint urb_entry_allocation_size:5; GLuint pad2:1; - GLuint max_threads:5; + GLuint max_threads:5; GLuint pad3:2; - } thread4; - + } thread4; +struct { -GLuint sampler_count:3 ; +GLuint sampler_count:3 ;GLuint pad0:2 ; -GLuint sampler_state_pointer:27 ; +GLuint sampler_state_pointer:27 ; } gs5; - +struct { -GLuint max_vp_index:4 ; +GLuint max_vp_index:4 ;GLuint pad0:12 ;GLuint svbi_post_inc_value:10 ;GLuint pad1:1 ;GLuint svbi_post_inc_enable:1 ;GLuint svbi_payload:1 ;GLuint discard_adjaceny:1 ; -GLuint reorder_enable:1 ; +GLuint reorder_enable:1 ;GLuint pad2:1 ; } gs6; };
@@ -497,30 +497,30 @@ struct brw_vs_unit_statestruct thread1 thread1;struct thread2 thread2;struct thread3 thread3; - +struct {GLuint pad0:10 ; -GLuint stats_enable:1 ; -GLuint nr_urb_entries:7 ; +GLuint stats_enable:1 ; +GLuint nr_urb_entries:7 ;GLuint pad1:1 ; -GLuint urb_entry_allocation_size:5 ; +GLuint urb_entry_allocation_size:5 ;GLuint pad2:1 ; -GLuint max_threads:6 ; +GLuint max_threads:6 ;GLuint pad3:1 ; - } thread4; + } thread4;struct { -GLuint sampler_count:3 ; +GLuint sampler_count:3 ;GLuint pad0:2 ; -GLuint sampler_state_pointer:27 ; +GLuint sampler_state_pointer:27 ; } vs5;struct { -GLuint vs_enable:1 ; -GLuint vert_cache_disable:1 ; +GLuint vs_enable:1 ; +GLuint vert_cache_disable:1 ;GLuint pad0:30 ; } vs6; };
@@ -532,19 +532,19 @@ struct brw_wm_unit_statestruct thread1 thread1;struct thread2 thread2;struct thread3 thread3; - +struct { -GLuint stats_enable:1 ; +GLuint stats_enable:1 ;GLuint depth_buffer_clear:1 ; -GLuint sampler_count:3 ; -GLuint sampler_state_pointer:27 ; +GLuint sampler_count:3 ; +GLuint sampler_state_pointer:27 ; } wm4; - +struct { -GLuint enable_8_pix:1 ; -GLuint enable_16_pix:1 ; -GLuint enable_32_pix:1 ; +GLuint enable_8_pix:1 ; +GLuint enable_16_pix:1 ; +GLuint enable_32_pix:1 ;GLuint enable_con_32_pix:1 ;GLuint enable_con_64_pix:1 ;GLuint pad0:1 ;
@@ -555,46 +555,46 @@ struct brw_wm_unit_state GLuint depth_buffer_resolve_enable:1; GLuint hierarchical_depth_buffer_resolve_enable:1; - GLuint legacy_global_depth_bias:1; - GLuint line_stipple:1; - GLuint depth_offset:1; - GLuint polygon_stipple:1; - GLuint line_aa_region_width:2; - GLuint line_endcap_aa_region_width:2; - GLuint early_depth_test:1; - GLuint thread_dispatch_enable:1; - GLuint program_uses_depth:1; - GLuint program_computes_depth:1; - GLuint program_uses_killpixel:1; - GLuint legacy_line_rast: 1; - GLuint transposed_urb_read_enable:1; - GLuint max_threads:7; + GLuint legacy_global_depth_bias:1; + GLuint line_stipple:1; + GLuint depth_offset:1; + GLuint polygon_stipple:1; + GLuint line_aa_region_width:2; + GLuint line_endcap_aa_region_width:2; + GLuint early_depth_test:1; + GLuint thread_dispatch_enable:1; + GLuint program_uses_depth:1; + GLuint program_computes_depth:1; + GLuint program_uses_killpixel:1; + GLuint legacy_line_rast: 1; + GLuint transposed_urb_read_enable:1; + GLuint max_threads:7; } wm5; - -GLfloat global_depth_offset_constant; -GLfloat global_depth_offset_scale; - + +GLfloat global_depth_offset_constant; +GLfloat global_depth_offset_scale; +/* for Ironlake only */ struct {GLuint pad0:1 ; -GLuint grf_reg_count_1:3 ; +GLuint grf_reg_count_1:3 ;GLuint pad1:2 ;GLuint kernel_start_pointer_1:26 ; - } wm8; + } wm8;struct {GLuint pad0:1 ; -GLuint grf_reg_count_2:3 ; +GLuint grf_reg_count_2:3 ;GLuint pad1:2 ;GLuint kernel_start_pointer_2:26 ; - } wm9; + } wm9;struct {GLuint pad0:1 ; -GLuint grf_reg_count_3:3 ; +GLuint grf_reg_count_3:3 ;GLuint pad1:2 ;GLuint kernel_start_pointer_3:26 ; - } wm10; + } wm10; };struct brw_sampler_default_color {
@@ -612,51 +612,51 @@ struct gen5_sampler_default_color {struct brw_sampler_state { - +struct { -GLuint shadow_function:3 ; -GLuint lod_bias:11 ; -GLuint min_filter:3 ; -GLuint mag_filter:3 ; -GLuint mip_filter:2 ; -GLuint base_level:5 ; +GLuint shadow_function:3 ; +GLuint lod_bias:11 ; +GLuint min_filter:3 ; +GLuint mag_filter:3 ; +GLuint mip_filter:2 ; +GLuint base_level:5 ;GLuint min_mag_neq:1 ; -GLuint lod_preclamp:1 ; -GLuint default_color_mode:1 ; +GLuint lod_preclamp:1 ; +GLuint default_color_mode:1 ;GLuint pad0:1 ; -GLuint disable:1 ; +GLuint disable:1 ; } ss0;struct { -GLuint r_wrap_mode:3 ; -GLuint t_wrap_mode:3 ; -GLuint s_wrap_mode:3 ; +GLuint r_wrap_mode:3 ; +GLuint t_wrap_mode:3 ; +GLuint s_wrap_mode:3 ;GLuint cube_control_mode:1 ;GLuint pad:2 ; -GLuint max_lod:10 ; -GLuint min_lod:10 ; +GLuint max_lod:10 ; +GLuint min_lod:10 ; } ss1; - +struct {GLuint pad:5 ; -GLuint default_color_pointer:27 ; +GLuint default_color_pointer:27 ; } ss2; - +struct {GLuint non_normalized_coord:1 ;GLuint pad:12 ;GLuint address_round:6 ; -GLuint max_aniso:3 ; -GLuint chroma_key_mode:1 ; -GLuint chroma_key_index:2 ; -GLuint chroma_key_enable:1 ; -GLuint monochrome_filter_width:3 ; -GLuint monochrome_filter_height:3 ; +GLuint max_aniso:3 ; +GLuint chroma_key_mode:1 ; +GLuint chroma_key_index:2 ; +GLuint chroma_key_enable:1 ; +GLuint monochrome_filter_width:3 ; +GLuint monochrome_filter_height:3 ; } ss3; };
@@ -711,27 +711,27 @@ struct gen7_sampler_statestruct brw_clipper_viewport { -GLfloat xmin; -GLfloat xmax; -GLfloat ymin; -GLfloat ymax; +GLfloat xmin; +GLfloat xmax; +GLfloat ymin; +GLfloat ymax; };struct brw_cc_viewport { -GLfloat min_depth; -GLfloat max_depth; +GLfloat min_depth; +GLfloat max_depth; };struct brw_sf_viewport {struct { -GLfloat m00; -GLfloat m11; -GLfloat m22; -GLfloat m30; -GLfloat m31; -GLfloat m32; +GLfloat m00; +GLfloat m11; +GLfloat m22; +GLfloat m30; +GLfloat m31; +GLfloat m32; } viewport;/* scissor coordinates are inclusive */
@@ -778,29 +778,29 @@ struct brw_vertex_element_state {struct { -GLuint src_offset:11 ; +GLuint src_offset:11 ;GLuint pad:5 ; -GLuint src_format:9 ; +GLuint src_format:9 ;GLuint pad0:1 ; -GLuint valid:1 ; -GLuint vertex_buffer_index:5 ; +GLuint valid:1 ; +GLuint vertex_buffer_index:5 ; } ve0; - +struct { -GLuint dst_offset:8 ; +GLuint dst_offset:8 ;GLuint pad:8 ; -GLuint vfcomponent3:4 ; -GLuint vfcomponent2:4 ; -GLuint vfcomponent1:4 ; -GLuint vfcomponent0:4 ; +GLuint vfcomponent3:4 ; +GLuint vfcomponent2:4 ; +GLuint vfcomponent1:4 ; +GLuint vfcomponent0:4 ; } ve1; };struct brw_urb_immediate {GLuint opcode:4 ;GLuint offset:6 ; -GLuint swizzle_control:2 ; +GLuint swizzle_control:2 ;GLuint pad:1 ;GLuint allocate:1 ;GLuint used:1 ;
@@ -814,10 +814,10 @@ struct brw_urb_immediate {/* Instruction format for the execution units: */ - +struct brw_instruction { -struct +struct {GLuint opcode:7 ;GLuint pad:1 ;
@@ -1010,7 +1010,7 @@ struct brw_instruction* Does not apply to Gen6+. The SFID/message target moved to bits * 27:24 of the header (destreg__conditionalmod); EOT is in bits3. */ -struct +struct {GLuint pad:26 ;GLuint end_of_thread:1 ;
@@ -1222,8 +1222,8 @@ struct brw_instructionstruct {GLuint binding_table_index:8 ;GLuint sampler:4 ; -GLuint return_format:2 ; -GLuint msg_type:2 ; +GLuint return_format:2 ; +GLuint msg_type:2 ;GLuint response_length:4 ;GLuint msg_length:4 ;GLuint msg_target:4 ;
@@ -1274,7 +1274,7 @@ struct brw_instructionstruct {GLuint opcode:4 ;GLuint offset:6 ; -GLuint swizzle_control:2 ; +GLuint swizzle_control:2 ;GLuint pad:1 ;GLuint allocate:1 ;GLuint used:1 ;
@@ -1321,9 +1321,9 @@ struct brw_instruction/** 965 PRM, Volume 4, Section 5.10.1.1: Message Descriptor */ struct {GLuint binding_table_index:8 ; -GLuint msg_control:4 ; -GLuint msg_type:2 ; -GLuint target_cache:2 ; +GLuint msg_control:4 ; +GLuint msg_type:2 ; +GLuint target_cache:2 ;GLuint response_length:4 ;GLuint msg_length:4 ;GLuint msg_target:4 ;
@@ -1347,9 +1347,9 @@ struct brw_instruction/** Ironlake PRM, Volume 4 Part 1, Section 5.10.2.1.2. */ struct {GLuint binding_table_index:8 ; -GLuint msg_control:4 ; -GLuint msg_type:2 ; -GLuint target_cache:2 ; +GLuint msg_control:4 ; +GLuint msg_type:2 ; +GLuint target_cache:2 ;GLuint pad0:3 ;GLuint header_present:1 ;GLuint response_length:5 ;
@@ -1363,7 +1363,7 @@ struct brw_instruction GLuint binding_table_index:8; GLuint msg_control:3; GLuint last_render_target:1; - GLuint msg_type:3; + GLuint msg_type:3; GLuint send_commit_msg:1; GLuint response_length:4; GLuint msg_length:4;
@@ -1377,7 +1377,7 @@ struct brw_instruction GLuint binding_table_index:8; GLuint msg_control:3; GLuint last_render_target:1; - GLuint msg_type:3; + GLuint msg_type:3; GLuint send_commit_msg:1; GLuint pad0:3; GLuint header_present:1;
Signature · 1 line
1.7.7.5
PATCH 18/90 assembler: Adopt enum brw_message_target from mesa
In reply to Damien Lespiau--- assembler/brw_defines.h | 44 +++++++++++++++++-------- assembler/disasm.c | 26 +++++++------- assembler/gram.y | 84 +++++++++++++++++++++------------------------- 3 files changed, 81 insertions(+), 73 deletions(-)
assembler/brw_defines.h +30 -14
@@ -717,20 +717,36 @@#define BRW_POLYGON_FACING_FRONT 0#define BRW_POLYGON_FACING_BACK 1 -#define BRW_MESSAGE_TARGET_NULL 0 -#define BRW_MESSAGE_TARGET_MATH 1 -#define BRW_MESSAGE_TARGET_SAMPLER 2 -#define BRW_MESSAGE_TARGET_GATEWAY 3 -#define BRW_MESSAGE_TARGET_DATAPORT_READ 4 -#define BRW_MESSAGE_TARGET_DP_SC 4/* data port sampler cache */ -#define BRW_MESSAGE_TARGET_DATAPORT_WRITE 5 -#define BRW_MESSAGE_TARGET_DP_RC 5/* data port render cache */ -#define BRW_MESSAGE_TARGET_URB 6 -#define BRW_MESSAGE_TARGET_THREAD_SPAWNER 7 -#define BRW_MESSAGE_TARGET_VME 8 -#define BRW_MESSAGE_TARGET_DP_CC 9/* data port constant cache */ -#define BRW_MESSAGE_TARGET_DP_DC 10/* data port data cache */ -#define BRW_MESSAGE_TARGET_CRE 0x0d/* check & refinement enginee */ + +/** +* Message target: Shared Function ID for where to SEND a message. +* +* These are enumerated in the ISA reference under "send - Send Message". +* In particular, see the following tables: +* - G45 PRM, Volume 4, Table 14-15 "Message Descriptor Definition" +* - Sandybridge PRM, Volume 4 Part 2, Table 8-16 "Extended Message Descriptor" +* - BSpec, Volume 1a (GPU Overview) / Graphics Processing Engine (GPE) / +* Overview / GPE Function IDs +*/ +enum brw_message_target { +BRW_SFID_NULL =0 , +BRW_SFID_MATH =1 ,/* Only valid on Gen4-5 */ +BRW_SFID_SAMPLER =2 , +BRW_SFID_MESSAGE_GATEWAY =3 , +BRW_SFID_DATAPORT_READ =4 , +BRW_SFID_DATAPORT_WRITE =5 , +BRW_SFID_URB =6 , +BRW_SFID_THREAD_SPAWNER =7 , + +GEN6_SFID_DATAPORT_SAMPLER_CACHE =4 , +GEN6_SFID_DATAPORT_RENDER_CACHE =5 , +GEN6_SFID_VME =8 , +GEN6_SFID_DATAPORT_CONSTANT_CACHE =9 , + +GEN7_SFID_DATAPORT_DATA_CACHE =10 , + +HSW_SFID_CRE =0x0d , +};#define BRW_SAMPLER_RETURN_FORMAT_FLOAT32 0#define BRW_SAMPLER_RETURN_FORMAT_UINT32 2
assembler/disasm.c +13 -13
@@ -275,14 +275,14 @@ char *end_of_thread[2] = { };char *target_function[16 ] = { - [BRW_MESSAGE_TARGET_NULL ] ="null" , - [BRW_MESSAGE_TARGET_MATH ] ="math" , - [BRW_MESSAGE_TARGET_SAMPLER ] ="sampler" , - [BRW_MESSAGE_TARGET_GATEWAY ] ="gateway" , - [BRW_MESSAGE_TARGET_DATAPORT_READ ] ="read" , - [BRW_MESSAGE_TARGET_DATAPORT_WRITE ] ="write" , - [BRW_MESSAGE_TARGET_URB ] ="urb" , - [BRW_MESSAGE_TARGET_THREAD_SPAWNER ] ="thread_spawner" + [BRW_SFID_NULL ] ="null" , + [BRW_SFID_MATH ] ="math" , + [BRW_SFID_SAMPLER ] ="sampler" , + [BRW_SFID_MESSAGE_GATEWAY ] ="gateway" , + [BRW_SFID_DATAPORT_READ ] ="read" , + [BRW_SFID_DATAPORT_WRITE ] ="write" , + [BRW_SFID_URB ] ="urb" , + [BRW_SFID_THREAD_SPAWNER ] ="thread_spawner" };char *math_function[16 ] = {
@@ -831,7 +831,7 @@ int disasm (FILE *file, struct brw_instruction *inst) err |=control (file,"target function" , target_function, inst->header.destreg__conditionalmod, &space);switch (inst->header.destreg__conditionalmod) { -case BRW_MESSAGE_TARGET_MATH : +case BRW_SFID_MATH : err |=control (file,"math function" , math_function, inst->bits3.math.function, &space); err |= control (file, "math saturate", math_saturate,
@@ -843,7 +843,7 @@ int disasm (FILE *file, struct brw_instruction *inst) err |=control (file,"math precision" , math_precision, inst->bits3.math.precision, &space);break ; -case BRW_MESSAGE_TARGET_SAMPLER : +case BRW_SFID_SAMPLER :format (file," (%d, %d, " , inst->bits3.sampler.binding_table_index, inst->bits3.sampler.sampler);
@@ -851,7 +851,7 @@ int disasm (FILE *file, struct brw_instruction *inst) inst->bits3.sampler.return_format, NULL);string (file,")" );break ; -case BRW_MESSAGE_TARGET_DATAPORT_WRITE : +case BRW_SFID_DATAPORT_WRITE : format (file, " (%d, %d, %d, %d)", inst->bits3.dp_write.binding_table_index, (inst->bits3.dp_write.last_render_target << 3) |
@@ -859,7 +859,7 @@ int disasm (FILE *file, struct brw_instruction *inst) inst->bits3.dp_write.msg_type, inst->bits3.dp_write.send_commit_msg);break ; -case BRW_MESSAGE_TARGET_URB : +case BRW_SFID_URB :format (file," %d" , inst->bits3.urb.offset); space =1 ; err |= control (file, "urb swizzle", urb_swizzle,
@@ -871,7 +871,7 @@ int disasm (FILE *file, struct brw_instruction *inst) err |=control (file,"urb complete" , urb_complete, inst->bits3.urb.complete, &space);break ; -case BRW_MESSAGE_TARGET_THREAD_SPAWNER : +case BRW_SFID_THREAD_SPAWNER :break ;default :format (file,"unsupported target %d" , inst->bits3.generic.msg_target);
assembler/gram.y +38 -46
252 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 19/90 assembler: Rename BRW_ACCWRCTRL_ACCWRCTRL
In reply to Damien LespiauTo a more self-describing define. This hopefully will help its inclusion into Mesa.
--- assembler/brw_defines.h | 4 ++-- assembler/gram.y | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
assembler/brw_defines.h +2 -2
@@ -552,8 +552,8 @@#define BRW_MASK_ENABLE 0#define BRW_MASK_DISABLE 1 -#define BRW_ACCWRCTRL_NONE 0 -#define BRW_ACCWRCTRL_ACCWRCTRL 1 +#define BRW_ACCUMULATOR_WRITE_DISABLE 0 +#define BRW_ACCUMULATOR_WRITE_ENABLE 1#define BRW_OPCODE_MOV 1#define BRW_OPCODE_SEL 2
assembler/gram.y +1 -1
@@ -2605,7 +2605,7 @@ instoption_list:instoption_list COMMA instoption $$.header.debug_control = BRW_DEBUG_BREAKPOINT; break; case ACCWRCTRL: - $$.header.acc_wr_control = BRW_ACCWRCTRL_ACCWRCTRL; + $$.header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; } } | instoption_list instoption
Signature · 1 line
1.7.7.5
PATCH 20/90 assembler: Import brw_defines.h from Mesa
In reply to Damien LespiauAlmost identical files now, the diff is:
-#include "intel_chipset.h"
+#define EX_DESC_SFID_MASK 0xF
+#define EX_DESC_EOT_MASK 0x20
--- assembler/brw_defines.h | 1223 +++++++++++++++++++++++++++++++++++++--------- 1 files changed, 983 insertions(+), 240 deletions(-)
assembler/brw_defines.h +983 -240
@@ -1,121 +1,43 @@ -/************************************************************************** -* -* Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. -* All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sub license, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice (including the -* next paragraph) shall be included in all copies or substantial portions -* of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -**************************************************************************/ +/* +Copyright (C) Intel Corp. 2006. All Rights Reserved. +Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to +develop this 3D driver. ++ 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]> +*/ + +#define INTEL_MASK (high, low) (((1<<((high)-(low)+1))-1)<<(low)) +#define SET_FIELD (value, field) (((value) << field ## _SHIFT) & field ## _MASK) +#define GET_FIELD (word, field) (((word) & field ## _MASK) >> field ## _SHIFT)#ifndef BRW_DEFINES_H #define BRW_DEFINES_H -/* -*/ -#define MI_NOOP 0x00 -#define MI_USER_INTERRUPT 0x02 -#define MI_WAIT_FOR_EVENT 0x03 -#define MI_FLUSH 0x04 -#define MI_REPORT_HEAD 0x07 -#define MI_ARB_ON_OFF 0x08 -#define MI_BATCH_BUFFER_END 0x0A -#define MI_OVERLAY_FLIP 0x11 -#define MI_LOAD_SCAN_LINES_INCL 0x12 -#define MI_LOAD_SCAN_LINES_EXCL 0x13 -#define MI_DISPLAY_BUFFER_INFO 0x14 -#define MI_SET_CONTEXT 0x18 -#define MI_STORE_DATA_IMM 0x20 -#define MI_STORE_DATA_INDEX 0x21 -#define MI_LOAD_REGISTER_IMM 0x22 -#define MI_STORE_REGISTER_MEM 0x24 -#define MI_BATCH_BUFFER_START 0x31 - -#define MI_SYNCHRONOUS_FLIP 0x0 -#define MI_ASYNCHRONOUS_FLIP 0x1 - -#define MI_BUFFER_SECURE 0x0 -#define MI_BUFFER_NONSECURE 0x1 - -#define MI_ARBITRATE_AT_CHAIN_POINTS 0x0 -#define MI_ARBITRATE_BETWEEN_INSTS 0x1 -#define MI_NO_ARBITRATION 0x3 - -#define MI_CONDITION_CODE_WAIT_DISABLED 0x0 -#define MI_CONDITION_CODE_WAIT_0 0x1 -#define MI_CONDITION_CODE_WAIT_1 0x2 -#define MI_CONDITION_CODE_WAIT_2 0x3 -#define MI_CONDITION_CODE_WAIT_3 0x4 -#define MI_CONDITION_CODE_WAIT_4 0x5 - -#define MI_DISPLAY_PIPE_A 0x0 -#define MI_DISPLAY_PIPE_B 0x1 - -#define MI_DISPLAY_PLANE_A 0x0 -#define MI_DISPLAY_PLANE_B 0x1 -#define MI_DISPLAY_PLANE_C 0x2 - -#define MI_STANDARD_FLIP 0x0 -#define MI_ENQUEUE_FLIP_PERFORM_BASE_FRAME_NUMBER_LOAD 0x1 -#define MI_ENQUEUE_FLIP_TARGET_FRAME_NUMBER_RELATIVE 0x2 -#define MI_ENQUEUE_FLIP_ABSOLUTE_TARGET_FRAME_NUMBER 0x3 - -#define MI_PHYSICAL_ADDRESS 0x0 -#define MI_VIRTUAL_ADDRESS 0x1 - -#define MI_BUFFER_MEMORY_MAIN 0x0 -#define MI_BUFFER_MEMORY_GTT 0x2 -#define MI_BUFFER_MEMORY_PER_PROCESS_GTT 0x3 - -#define MI_FLIP_CONTINUE 0x0 -#define MI_FLIP_ON 0x1 -#define MI_FLIP_OFF 0x2 - -#define MI_UNTRUSTED_REGISTER_SPACE 0x0 -#define MI_TRUSTED_REGISTER_SPACE 0x1 -/* 3D state: */ -#define _3DOP_3DSTATE_PIPELINED 0x0 -#define _3DOP_3DSTATE_NONPIPELINED 0x1 -#define _3DOP_3DCONTROL 0x2 -#define _3DOP_3DPRIMITIVE 0x3 - -#define _3DSTATE_PIPELINED_POINTERS 0x00 -#define _3DSTATE_BINDING_TABLE_POINTERS 0x01 -#define _3DSTATE_VERTEX_BUFFERS 0x08 -#define _3DSTATE_VERTEX_ELEMENTS 0x09 -#define _3DSTATE_INDEX_BUFFER 0x0A -#define _3DSTATE_VF_STATISTICS 0x0B -#define _3DSTATE_DRAWING_RECTANGLE 0x00 -#define _3DSTATE_CONSTANT_COLOR 0x01 -#define _3DSTATE_SAMPLER_PALETTE_LOAD 0x02 -#define _3DSTATE_CHROMA_KEY 0x04 -#define _3DSTATE_DEPTH_BUFFER 0x05 -#define _3DSTATE_POLY_STIPPLE_OFFSET 0x06 -#define _3DSTATE_POLY_STIPPLE_PATTERN 0x07 -#define _3DSTATE_LINE_STIPPLE 0x08 -#define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP 0x09 -#define _3DCONTROL 0x00 -#define _3DPRIMITIVE 0x00 -#define PIPE_CONTROL_NOWRITE 0x00#define PIPE_CONTROL_WRITEIMMEDIATE 0x01#define PIPE_CONTROL_WRITEDEPTH 0x02
@@ -124,6 +46,15 @@#define PIPE_CONTROL_GTTWRITE_PROCESS_LOCAL 0x00#define PIPE_CONTROL_GTTWRITE_GLOBAL 0x01 +#define CMD_3D_PRIM 0x7b00/* 3DPRIMITIVE */ +/* DW0 */ +# define GEN4_3DPRIM_TOPOLOGY_TYPE_SHIFT 10 +# define GEN4_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL (0 << 15) +# define GEN4_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM (1 << 15) +/* DW1 */ +# define GEN7_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL (0 << 8) +# define GEN7_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM (1 << 8) +#define _3DPRIM_POINTLIST 0x01#define _3DPRIM_LINELIST 0x02#define _3DPRIM_LINESTRIP 0x03
@@ -146,9 +77,6 @@#define _3DPRIM_LINESTRIP_CONT_BF 0x14#define _3DPRIM_TRIFAN_NOSTIPPLE 0x15 -#define _3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL 0 -#define _3DPRIM_VERTEXBUFFER_ACCESS_RANDOM 1 -#define BRW_ANISORATIO_2 0#define BRW_ANISORATIO_4 1#define BRW_ANISORATIO_6 2
@@ -198,6 +126,7 @@#define BRW_CLIPMODE_CLIP_NON_REJECTED 2#define BRW_CLIPMODE_REJECT_ALL 3#define BRW_CLIPMODE_ACCEPT_ALL 4 +#define BRW_CLIPMODE_KERNEL_CLIP 5#define BRW_CLIP_NDCSPACE 0#define BRW_CLIP_SCREENSPACE 1
@@ -227,6 +156,7 @@#define BRW_DEPTHFORMAT_D32_FLOAT_S8X24_UINT 0#define BRW_DEPTHFORMAT_D32_FLOAT 1#define BRW_DEPTHFORMAT_D24_UNORM_S8_UINT 2 +#define BRW_DEPTHFORMAT_D24_UNORM_X8_UINT 3/* GEN5 */ #define BRW_DEPTHFORMAT_D16_UNORM 5#define BRW_FLOATING_POINT_IEEE_754 0
@@ -235,6 +165,10 @@#define BRW_FRONTWINDING_CW 0#define BRW_FRONTWINDING_CCW 1 +#define BRW_SPRITE_POINT_ENABLE 16 + +#define BRW_CUT_INDEX_ENABLE (1 << 10) +#define BRW_INDEX_BYTE 0#define BRW_INDEX_WORD 1#define BRW_INDEX_DWORD 2
@@ -264,6 +198,13 @@#define BRW_MIPFILTER_NEAREST 1#define BRW_MIPFILTER_LINEAR 3 +#define BRW_ADDRESS_ROUNDING_ENABLE_U_MAG 0x20 +#define BRW_ADDRESS_ROUNDING_ENABLE_U_MIN 0x10 +#define BRW_ADDRESS_ROUNDING_ENABLE_V_MAG 0x08 +#define BRW_ADDRESS_ROUNDING_ENABLE_V_MIN 0x04 +#define BRW_ADDRESS_ROUNDING_ENABLE_R_MAG 0x02 +#define BRW_ADDRESS_ROUNDING_ENABLE_R_MIN 0x01 +#define BRW_POLYGON_FRONT_FACING 0#define BRW_POLYGON_BACK_FACING 1
@@ -282,6 +223,24 @@#define BRW_RASTRULE_UPPER_LEFT 0#define BRW_RASTRULE_UPPER_RIGHT 1 +/* These are listed as "Reserved, but not seen as useful" +* in Intel documentation (page 212, "Point Rasterization Rule", +* section 7.4 "SF Pipeline State Summary", of document +* "Intel® 965 Express Chipset Family and Intel® G35 Express +* Chipset Graphics Controller Programmer's Reference Manual, +* Volume 2: 3D/Media", Revision 1.0b as of January 2008, +* available at +* http://intellinuxgraphics.org/documentation.html +* at the time of this writing). +* +* These appear to be supported on at least some +* i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT +* is useful when using OpenGL to render to a FBO +* (which has the pixel coordinate Y orientation inverted +* with respect to the normal OpenGL pixel coordinate system). +*/ +#define BRW_RASTRULE_LOWER_LEFT 2 +#define BRW_RASTRULE_LOWER_RIGHT 3#define BRW_RENDERTARGET_CLAMPRANGE_UNORM 0#define BRW_RENDERTARGET_CLAMPRANGE_SNORM 1
@@ -296,8 +255,17 @@#define BRW_STENCILOP_DECR 6#define BRW_STENCILOP_INVERT 7 +/* Surface state DW0 */ +#define BRW_SURFACE_RC_READ_WRITE (1 << 8) +#define BRW_SURFACE_MIPLAYOUT_SHIFT 10#define BRW_SURFACE_MIPMAPLAYOUT_BELOW 0#define BRW_SURFACE_MIPMAPLAYOUT_RIGHT 1 +#define BRW_SURFACE_CUBEFACE_ENABLES 0x3f +#define BRW_SURFACE_BLEND_ENABLED (1 << 13) +#define BRW_SURFACE_WRITEDISABLE_B_SHIFT 14 +#define BRW_SURFACE_WRITEDISABLE_G_SHIFT 15 +#define BRW_SURFACE_WRITEDISABLE_R_SHIFT 16 +#define BRW_SURFACE_WRITEDISABLE_A_SHIFT 17#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000#define BRW_SURFACEFORMAT_R32G32B32A32_SINT 0x001
@@ -308,6 +276,7 @@#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006#define BRW_SURFACEFORMAT_R32G32B32A32_SSCALED 0x007#define BRW_SURFACEFORMAT_R32G32B32A32_USCALED 0x008 +#define BRW_SURFACEFORMAT_R32G32B32A32_SFIXED 0x020#define BRW_SURFACEFORMAT_R32G32B32_FLOAT 0x040#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041#define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042
@@ -315,6 +284,7 @@#define BRW_SURFACEFORMAT_R32G32B32_SNORM 0x044#define BRW_SURFACEFORMAT_R32G32B32_SSCALED 0x045#define BRW_SURFACEFORMAT_R32G32B32_USCALED 0x046 +#define BRW_SURFACEFORMAT_R32G32B32_SFIXED 0x050#define BRW_SURFACEFORMAT_R16G16B16A16_UNORM 0x080#define BRW_SURFACEFORMAT_R16G16B16A16_SNORM 0x081#define BRW_SURFACEFORMAT_R16G16B16A16_SINT 0x082
@@ -338,6 +308,7 @@#define BRW_SURFACEFORMAT_R16G16B16A16_USCALED 0x094#define BRW_SURFACEFORMAT_R32G32_SSCALED 0x095#define BRW_SURFACEFORMAT_R32G32_USCALED 0x096 +#define BRW_SURFACEFORMAT_R32G32_SFIXED 0x0A0#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM 0x0C0#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB 0x0C1#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM 0x0C2
@@ -406,9 +377,10 @@#define BRW_SURFACEFORMAT_L8A8_UNORM 0x114#define BRW_SURFACEFORMAT_I16_FLOAT 0x115#define BRW_SURFACEFORMAT_L16_FLOAT 0x116 -#define BRW_SURFACEFORMAT_A16_FLOAT 0x117 -#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM 0x119 -#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM 0x11A +#define BRW_SURFACEFORMAT_A16_FLOAT 0x117 +#define BRW_SURFACEFORMAT_L8A8_UNORM_SRGB 0x118 +#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM 0x119 +#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM 0x11A#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB 0x11B#define BRW_SURFACEFORMAT_R8G8_SSCALED 0x11C#define BRW_SURFACEFORMAT_R8G8_USCALED 0x11D
@@ -425,6 +397,8 @@#define BRW_SURFACEFORMAT_A4P4_UNORM 0x148#define BRW_SURFACEFORMAT_R8_SSCALED 0x149#define BRW_SURFACEFORMAT_R8_USCALED 0x14A +#define BRW_SURFACEFORMAT_L8_UNORM_SRGB 0x14C +#define BRW_SURFACEFORMAT_DXT1_RGB_SRGB 0x180#define BRW_SURFACEFORMAT_R1_UINT 0x181#define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182#define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183
@@ -453,10 +427,24 @@#define BRW_SURFACEFORMAT_R16G16B16_SNORM 0x19D#define BRW_SURFACEFORMAT_R16G16B16_SSCALED 0x19E#define BRW_SURFACEFORMAT_R16G16B16_USCALED 0x19F +#define BRW_SURFACEFORMAT_R32_SFIXED 0x1B2 +#define BRW_SURFACEFORMAT_R10G10B10A2_SNORM 0x1B3 +#define BRW_SURFACEFORMAT_R10G10B10A2_USCALED 0x1B4 +#define BRW_SURFACEFORMAT_R10G10B10A2_SSCALED 0x1B5 +#define BRW_SURFACEFORMAT_R10G10B10A2_SINT 0x1B6 +#define BRW_SURFACEFORMAT_B10G10R10A2_SNORM 0x1B7 +#define BRW_SURFACEFORMAT_B10G10R10A2_USCALED 0x1B8 +#define BRW_SURFACEFORMAT_B10G10R10A2_SSCALED 0x1B9 +#define BRW_SURFACEFORMAT_B10G10R10A2_UINT 0x1BA +#define BRW_SURFACEFORMAT_B10G10R10A2_SINT 0x1BB +#define BRW_SURFACE_FORMAT_SHIFT 18 +#define BRW_SURFACE_FORMAT_MASK INTEL_MASK(26, 18)#define BRW_SURFACERETURNFORMAT_FLOAT32 0#define BRW_SURFACERETURNFORMAT_S1 1 +#define BRW_SURFACE_TYPE_SHIFT 29 +#define BRW_SURFACE_TYPE_MASK INTEL_MASK(31, 29)#define BRW_SURFACE_1D 0#define BRW_SURFACE_2D 1#define BRW_SURFACE_3D 2
@@ -464,6 +452,80 @@#define BRW_SURFACE_BUFFER 4#define BRW_SURFACE_NULL 7 +#define GEN7_SURFACE_IS_ARRAY (1 << 28) +#define GEN7_SURFACE_VALIGN_2 (0 << 16) +#define GEN7_SURFACE_VALIGN_4 (1 << 16) +#define GEN7_SURFACE_HALIGN_4 (0 << 15) +#define GEN7_SURFACE_HALIGN_8 (1 << 15) +#define GEN7_SURFACE_TILING_NONE (0 << 13) +#define GEN7_SURFACE_TILING_X (2 << 13) +#define GEN7_SURFACE_TILING_Y (3 << 13) +#define GEN7_SURFACE_ARYSPC_FULL (0 << 10) +#define GEN7_SURFACE_ARYSPC_LOD0 (1 << 10) + +/* Surface state DW2 */ +#define BRW_SURFACE_HEIGHT_SHIFT 19 +#define BRW_SURFACE_HEIGHT_MASK INTEL_MASK(31, 19) +#define BRW_SURFACE_WIDTH_SHIFT 6 +#define BRW_SURFACE_WIDTH_MASK INTEL_MASK(18, 6) +#define BRW_SURFACE_LOD_SHIFT 2 +#define BRW_SURFACE_LOD_MASK INTEL_MASK(5, 2) +#define GEN7_SURFACE_HEIGHT_SHIFT 16 +#define GEN7_SURFACE_HEIGHT_MASK INTEL_MASK(29, 16) +#define GEN7_SURFACE_WIDTH_SHIFT 0 +#define GEN7_SURFACE_WIDTH_MASK INTEL_MASK(13, 0) + +/* Surface state DW3 */ +#define BRW_SURFACE_DEPTH_SHIFT 21 +#define BRW_SURFACE_DEPTH_MASK INTEL_MASK(31, 21) +#define BRW_SURFACE_PITCH_SHIFT 3 +#define BRW_SURFACE_PITCH_MASK INTEL_MASK(19, 3) +#define BRW_SURFACE_TILED (1 << 1) +#define BRW_SURFACE_TILED_Y (1 << 0) + +/* Surface state DW4 */ +#define BRW_SURFACE_MIN_LOD_SHIFT 28 +#define BRW_SURFACE_MIN_LOD_MASK INTEL_MASK(31, 28) +#define BRW_SURFACE_MULTISAMPLECOUNT_1 (0 << 4) +#define BRW_SURFACE_MULTISAMPLECOUNT_4 (2 << 4) +#define GEN7_SURFACE_MULTISAMPLECOUNT_1 (0 << 3) +#define GEN7_SURFACE_MULTISAMPLECOUNT_4 (2 << 3) +#define GEN7_SURFACE_MULTISAMPLECOUNT_8 (3 << 3) +#define GEN7_SURFACE_MSFMT_MSS (0 << 6) +#define GEN7_SURFACE_MSFMT_DEPTH_STENCIL (1 << 6) + +/* Surface state DW5 */ +#define BRW_SURFACE_X_OFFSET_SHIFT 25 +#define BRW_SURFACE_X_OFFSET_MASK INTEL_MASK(31, 25) +#define BRW_SURFACE_VERTICAL_ALIGN_ENABLE (1 << 24) +#define BRW_SURFACE_Y_OFFSET_SHIFT 20 +#define BRW_SURFACE_Y_OFFSET_MASK INTEL_MASK(23, 20) +#define GEN7_SURFACE_MIN_LOD_SHIFT 4 +#define GEN7_SURFACE_MIN_LOD_MASK INTEL_MASK(7, 4) + +/* Surface state DW6 */ +#define GEN7_SURFACE_MCS_ENABLE (1 << 0) +#define GEN7_SURFACE_MCS_PITCH_SHIFT 3 +#define GEN7_SURFACE_MCS_PITCH_MASK INTEL_MASK(11, 3) + +/* Surface state DW7 */ +#define GEN7_SURFACE_SCS_R_SHIFT 25 +#define GEN7_SURFACE_SCS_R_MASK INTEL_MASK(27, 25) +#define GEN7_SURFACE_SCS_G_SHIFT 22 +#define GEN7_SURFACE_SCS_G_MASK INTEL_MASK(24, 22) +#define GEN7_SURFACE_SCS_B_SHIFT 19 +#define GEN7_SURFACE_SCS_B_MASK INTEL_MASK(21, 19) +#define GEN7_SURFACE_SCS_A_SHIFT 16 +#define GEN7_SURFACE_SCS_A_MASK INTEL_MASK(18, 16) + +/* The actual swizzle values/what channel to use */ +#define HSW_SCS_ZERO 0 +#define HSW_SCS_ONE 1 +#define HSW_SCS_RED 4 +#define HSW_SCS_GREEN 5 +#define HSW_SCS_BLUE 6 +#define HSW_SCS_ALPHA 7 +#define BRW_TEXCOORDMODE_WRAP 0#define BRW_TEXCOORDMODE_MIRROR 1#define BRW_TEXCOORDMODE_CLAMP 2
@@ -480,20 +542,6 @@#define BRW_VERTEX_SUBPIXEL_PRECISION_8BITS 0#define BRW_VERTEX_SUBPIXEL_PRECISION_4BITS 1 -#define BRW_VERTEXBUFFER_ACCESS_VERTEXDATA 0 -#define BRW_VERTEXBUFFER_ACCESS_INSTANCEDATA 1 - -#define BRW_VFCOMPONENT_NOSTORE 0 -#define BRW_VFCOMPONENT_STORE_SRC 1 -#define BRW_VFCOMPONENT_STORE_0 2 -#define BRW_VFCOMPONENT_STORE_1_FLT 3 -#define BRW_VFCOMPONENT_STORE_1_INT 4 -#define BRW_VFCOMPONENT_STORE_VID 5 -#define BRW_VFCOMPONENT_STORE_IID 6 -#define BRW_VFCOMPONENT_STORE_PID 7 - - -/* Execution Unit (EU) defines */
@@ -508,9 +556,18 @@#define BRW_CHANNEL_Z 2#define BRW_CHANNEL_W 3 -#define BRW_COMPRESSION_NONE 0 -#define BRW_COMPRESSION_2NDHALF 1 -#define BRW_COMPRESSION_COMPRESSED 2 +enum brw_compression { +BRW_COMPRESSION_NONE =0 , +BRW_COMPRESSION_2NDHALF =1 , +BRW_COMPRESSION_COMPRESSED =2 , +}; + +#define GEN6_COMPRESSION_1Q 0 +#define GEN6_COMPRESSION_2Q 1 +#define GEN6_COMPRESSION_3Q 2 +#define GEN6_COMPRESSION_4Q 3 +#define GEN6_COMPRESSION_1H 0 +#define GEN6_COMPRESSION_2H 2#define BRW_CONDITIONAL_NONE 0#define BRW_CONDITIONAL_Z 1
@@ -521,10 +578,9 @@#define BRW_CONDITIONAL_GE 4#define BRW_CONDITIONAL_L 5#define BRW_CONDITIONAL_LE 6 -#define BRW_CONDITIONAL_C 7 -#define BRW_CONDITIONAL_R 7/* round increment */ -#define BRW_CONDITIONAL_O 8/* overflow */ -#define BRW_CONDITIONAL_U 9/* unordered */ +#define BRW_CONDITIONAL_R 7 +#define BRW_CONDITIONAL_O 8 +#define BRW_CONDITIONAL_U 9#define BRW_DEBUG_NONE 0#define BRW_DEBUG_BREAKPOINT 1
@@ -555,78 +611,147 @@#define BRW_ACCUMULATOR_WRITE_DISABLE 0#define BRW_ACCUMULATOR_WRITE_ENABLE 1 -#define BRW_OPCODE_MOV 1 -#define BRW_OPCODE_SEL 2 -#define BRW_OPCODE_NOT 4 -#define BRW_OPCODE_AND 5 -#define BRW_OPCODE_OR 6 -#define BRW_OPCODE_XOR 7 -#define BRW_OPCODE_SHR 8 -#define BRW_OPCODE_SHL 9 -#define BRW_OPCODE_RSR 10 -#define BRW_OPCODE_RSL 11 -#define BRW_OPCODE_ASR 12 -#define BRW_OPCODE_CMP 16 -#define BRW_OPCODE_CMPN 17 -#define BRW_OPCODE_F32TO16 19 -#define BRW_OPCODE_F16TO32 20 -#define BRW_OPCODE_BFREV 23 -#define BRW_OPCODE_BFE 24 -#define BRW_OPCODE_BFI1 25 -#define BRW_OPCODE_BFI2 26 -#define BRW_OPCODE_JMPI 32 -#define BRW_OPCODE_BRD 33 -#define BRW_OPCODE_IF 34 -#define BRW_OPCODE_BRC 35 -#define BRW_OPCODE_IFF 35 -#define BRW_OPCODE_ELSE 36 -#define BRW_OPCODE_ENDIF 37 -#define BRW_OPCODE_DO 38 -#define BRW_OPCODE_WHILE 39 -#define BRW_OPCODE_BREAK 40 -#define BRW_OPCODE_CONTINUE 41 -#define BRW_OPCODE_HALT 42 -#define BRW_OPCODE_MSAVE 44 -#define BRW_OPCODE_CALL 44 -#define BRW_OPCODE_MRESTORE 45 -#define BRW_OPCODE_RET 45 -#define BRW_OPCODE_PUSH 46 -#define BRW_OPCODE_POP 47 -#define BRW_OPCODE_WAIT 48 -#define BRW_OPCODE_SEND 49 -#define BRW_OPCODE_SENDC 50 -#define BRW_OPCODE_MATH 56 -#define BRW_OPCODE_ADD 64 -#define BRW_OPCODE_MUL 65 -#define BRW_OPCODE_AVG 66 -#define BRW_OPCODE_FRC 67 -#define BRW_OPCODE_RNDU 68 -#define BRW_OPCODE_RNDD 69 -#define BRW_OPCODE_RNDE 70 -#define BRW_OPCODE_RNDZ 71 -#define BRW_OPCODE_MAC 72 -#define BRW_OPCODE_MACH 73 -#define BRW_OPCODE_LZD 74 -#define BRW_OPCODE_FBH 75 -#define BRW_OPCODE_FBL 76 -#define BRW_OPCODE_CBIT 77 -#define BRW_OPCODE_ADDC 78 -#define BRW_OPCODE_SUBB 79 -#define BRW_OPCODE_SAD2 80 -#define BRW_OPCODE_SADA2 81 -#define BRW_OPCODE_DP4 84 -#define BRW_OPCODE_DPH 85 -#define BRW_OPCODE_DP3 86 -#define BRW_OPCODE_DP2 87 -#define BRW_OPCODE_DPA2 88 -#define BRW_OPCODE_LINE 89 -#define BRW_OPCODE_PLN 90 -#define BRW_OPCODE_MAD 91 -#define BRW_OPCODE_LRP 92 -#define BRW_OPCODE_NOP 126 - -#define BRW_PREDICATE_NONE 0 -#define BRW_PREDICATE_NORMAL 1 +/** @{ +* +* Gen6 has replaced "mask enable/disable" with WECtrl, which is +* effectively the same but much simpler to think about. Now, there +* are two contributors ANDed together to whether channels are +* executed: The predication on the instruction, and the channel write +* enable. +*/ +/** +* This is the default value. It means that a channel's write enable is set +* if the per-channel IP is pointing at this instruction. +*/ +#define BRW_WE_NORMAL 0 +/** +* This is used like BRW_MASK_DISABLE, and causes all channels to have +* their write enable set. Note that predication still contributes to +* whether the channel actually gets written. +*/ +#define BRW_WE_ALL 1 +/** @} */ + +enum opcode { +/* These are the actual hardware opcodes. */ +BRW_OPCODE_MOV =1 , +BRW_OPCODE_SEL =2 , +BRW_OPCODE_NOT =4 , +BRW_OPCODE_AND =5 , +BRW_OPCODE_OR =6 , +BRW_OPCODE_XOR =7 , +BRW_OPCODE_SHR =8 , +BRW_OPCODE_SHL =9 , +BRW_OPCODE_RSR =10 , +BRW_OPCODE_RSL =11 , +BRW_OPCODE_ASR =12 , +BRW_OPCODE_CMP =16 , +BRW_OPCODE_CMPN =17 , +BRW_OPCODE_F32TO16 =19 , +BRW_OPCODE_F16TO32 =20 , +BRW_OPCODE_BFREV =23 , +BRW_OPCODE_BFE =24 , +BRW_OPCODE_BFI1 =25 , +BRW_OPCODE_BFI2 =26 , +BRW_OPCODE_JMPI =32 , +BRW_OPCODE_BRD =33 , +BRW_OPCODE_IF =34 , +BRW_OPCODE_IFF =35 , +BRW_OPCODE_BRC =35 , +BRW_OPCODE_ELSE =36 , +BRW_OPCODE_ENDIF =37 , +BRW_OPCODE_DO =38 , +BRW_OPCODE_WHILE =39 , +BRW_OPCODE_BREAK =40 , +BRW_OPCODE_CONTINUE =41 , +BRW_OPCODE_HALT =42 , +BRW_OPCODE_MSAVE =44 , +BRW_OPCODE_CALL =44 , +BRW_OPCODE_MRESTORE =45 , +BRW_OPCODE_RET =45 , +BRW_OPCODE_PUSH =46 , +BRW_OPCODE_POP =47 , +BRW_OPCODE_WAIT =48 , +BRW_OPCODE_SEND =49 , +BRW_OPCODE_SENDC =50 , +BRW_OPCODE_MATH =56 , +BRW_OPCODE_ADD =64 , +BRW_OPCODE_MUL =65 , +BRW_OPCODE_AVG =66 , +BRW_OPCODE_FRC =67 , +BRW_OPCODE_RNDU =68 , +BRW_OPCODE_RNDD =69 , +BRW_OPCODE_RNDE =70 , +BRW_OPCODE_RNDZ =71 , +BRW_OPCODE_MAC =72 , +BRW_OPCODE_MACH =73 , +BRW_OPCODE_LZD =74 , +BRW_OPCODE_FBH =75 , +BRW_OPCODE_FBL =76 , +BRW_OPCODE_CBIT =77 , +BRW_OPCODE_ADDC =78 , +BRW_OPCODE_SUBB =79 , +BRW_OPCODE_SAD2 =80 , +BRW_OPCODE_SADA2 =81 , +BRW_OPCODE_DP4 =84 , +BRW_OPCODE_DPH =85 , +BRW_OPCODE_DP3 =86 , +BRW_OPCODE_DP2 =87 , +BRW_OPCODE_DPA2 =88 , +BRW_OPCODE_LINE =89 , +BRW_OPCODE_PLN =90 , +BRW_OPCODE_MAD =91 , +BRW_OPCODE_LRP =92 , +BRW_OPCODE_NOP =126 , + +/* These are compiler backend opcodes that get translated into other +* instructions. +*/ +FS_OPCODE_FB_WRITE =128 , +SHADER_OPCODE_RCP , +SHADER_OPCODE_RSQ , +SHADER_OPCODE_SQRT , +SHADER_OPCODE_EXP2 , +SHADER_OPCODE_LOG2 , +SHADER_OPCODE_POW , +SHADER_OPCODE_INT_QUOTIENT , +SHADER_OPCODE_INT_REMAINDER , +SHADER_OPCODE_SIN , +SHADER_OPCODE_COS , + +SHADER_OPCODE_TEX , +SHADER_OPCODE_TXD , +SHADER_OPCODE_TXF , +SHADER_OPCODE_TXL , +SHADER_OPCODE_TXS , +FS_OPCODE_TXB , + +SHADER_OPCODE_SHADER_TIME_ADD , + +FS_OPCODE_DDX , +FS_OPCODE_DDY , +FS_OPCODE_PIXEL_X , +FS_OPCODE_PIXEL_Y , +FS_OPCODE_CINTERP , +FS_OPCODE_LINTERP , +FS_OPCODE_SPILL , +FS_OPCODE_UNSPILL , +FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD , +FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GEN7 , +FS_OPCODE_VARYING_PULL_CONSTANT_LOAD , +FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GEN7 , +FS_OPCODE_MOV_DISPATCH_TO_FLAGS , +FS_OPCODE_DISCARD_JUMP , +FS_OPCODE_SET_GLOBAL_OFFSET , + +VS_OPCODE_URB_WRITE , +VS_OPCODE_SCRATCH_READ , +VS_OPCODE_SCRATCH_WRITE , +VS_OPCODE_PULL_CONSTANT_LOAD , +}; + +#define BRW_PREDICATE_NONE 0 +#define BRW_PREDICATE_NORMAL 1#define BRW_PREDICATE_ALIGN1_ANYV 2#define BRW_PREDICATE_ALIGN1_ALLV 3#define BRW_PREDICATE_ALIGN1_ANY2H 4
@@ -671,6 +796,10 @@#define BRW_ARF_CONTROL 0x80#define BRW_ARF_NOTIFICATION_COUNT 0x90#define BRW_ARF_IP 0xA0 +#define BRW_ARF_TDR 0xB0 +#define BRW_ARF_TIMESTAMP 0xC0 + +#define BRW_MRF_COMPR4 (1 << 7)#define BRW_AMASK 0#define BRW_IMASK 1
@@ -717,7 +846,6 @@#define BRW_POLYGON_FACING_FRONT 0#define BRW_POLYGON_FACING_BACK 1 -/** * Message target: Shared Function ID for where to SEND a message. *
@@ -762,13 +890,35 @@ enum brw_message_target {#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS 2#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE 0#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE 2 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_COMPARE 0 +#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD_COMPARE 1 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_COMPARE 1#define BRW_SAMPLER_MESSAGE_SIMD4X2_RESINFO 2 -#define BRW_SAMPLER_MESSAGE_SIMD8_RESINFO 2#define BRW_SAMPLER_MESSAGE_SIMD16_RESINFO 2#define BRW_SAMPLER_MESSAGE_SIMD4X2_LD 3#define BRW_SAMPLER_MESSAGE_SIMD8_LD 3#define BRW_SAMPLER_MESSAGE_SIMD16_LD 3 +#define GEN5_SAMPLER_MESSAGE_SAMPLE 0 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_BIAS 1 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_LOD 2 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_COMPARE 3 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS 4 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE 5 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE 6 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_LD 7 +#define GEN5_SAMPLER_MESSAGE_SAMPLE_RESINFO 10 +#define HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE 20 +#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD_MCS 29 +#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DMS 30 +#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DSS 31 + +/* for GEN5 only */ +#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0 +#define BRW_SAMPLER_SIMD_MODE_SIMD8 1 +#define BRW_SAMPLER_SIMD_MODE_SIMD16 2 +#define BRW_SAMPLER_SIMD_MODE_SIMD32_64 3 +#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW 0#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDHIGH 1#define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 2
@@ -781,10 +931,24 @@ enum brw_message_target {#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS 2#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS 3 +/* This one stays the same across generations. */ #define BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ 0 +/* GEN4 */ #define BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 1 -#define BRW_DATAPORT_READ_MESSAGE_DWORD_BLOCK_READ 2 +#define BRW_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 2#define BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 3 +/* G45, GEN5 */ +#define G45_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 1 +#define G45_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 2 +#define G45_DATAPORT_READ_MESSAGE_AVC_LOOP_FILTER_READ 3 +#define G45_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 4 +#define G45_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 6 +/* GEN6 */ +#define GEN6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 1 +#define GEN6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 2 +#define GEN6_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 4 +#define GEN6_DATAPORT_READ_MESSAGE_OWORD_UNALIGN_BLOCK_READ 5 +#define GEN6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 6#define BRW_DATAPORT_READ_TARGET_DATA_CACHE 0#define BRW_DATAPORT_READ_TARGET_RENDER_CACHE 1
@@ -798,12 +962,43 @@ enum brw_message_target {#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 0#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 1 -#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_BLOCK_WRITE 2 +#define BRW_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE 2#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 3#define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 4#define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE 5#define BRW_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE 7 +/* GEN6 */ +#define GEN6_DATAPORT_WRITE_MESSAGE_DWORD_ATOMIC_WRITE 7 +#define GEN6_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 8 +#define GEN6_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 9 +#define GEN6_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE 10 +#define GEN6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 11 +#define GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 12 +#define GEN6_DATAPORT_WRITE_MESSAGE_STREAMED_VB_WRITE 13 +#define GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE 14 + +/* GEN7 */ +#define GEN7_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 10 +#define GEN7_DATAPORT_DC_DWORD_SCATTERED_READ 3 + +/* dataport atomic operations. */ +#define BRW_AOP_AND 1 +#define BRW_AOP_OR 2 +#define BRW_AOP_XOR 3 +#define BRW_AOP_MOV 4 +#define BRW_AOP_INC 5 +#define BRW_AOP_DEC 6 +#define BRW_AOP_ADD 7 +#define BRW_AOP_SUB 8 +#define BRW_AOP_REVSUB 9 +#define BRW_AOP_IMAX 10 +#define BRW_AOP_IMIN 11 +#define BRW_AOP_UMAX 12 +#define BRW_AOP_UMIN 13 +#define BRW_AOP_CMPWR 14 +#define BRW_AOP_PREDEC 15 +#define BRW_MATH_FUNCTION_INV 1#define BRW_MATH_FUNCTION_LOG 2#define BRW_MATH_FUNCTION_EXP 3
@@ -812,7 +1007,8 @@ enum brw_message_target {#define BRW_MATH_FUNCTION_SIN 6/* was 7 */ #define BRW_MATH_FUNCTION_COS 7/* was 8 */ #define BRW_MATH_FUNCTION_SINCOS 8/* was 6 */ -#define BRW_MATH_FUNCTION_TAN 9 +#define BRW_MATH_FUNCTION_TAN 9/* gen4 */ +#define BRW_MATH_FUNCTION_FDIV 9/* gen6+ */ #define BRW_MATH_FUNCTION_POW 10#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER 11#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT 12
@@ -850,43 +1046,590 @@ enum brw_message_target {#define BRW_SCRATCH_SPACE_SIZE_2M 11 - -#define CMD_URB_FENCE 0x6000 -#define CMD_CONST_BUFFER_STATE 0x6001 +#define CMD_CS_URB_STATE 0x6001#define CMD_CONST_BUFFER 0x6002#define CMD_STATE_BASE_ADDRESS 0x6101 -#define CMD_STATE_INSN_POINTER 0x6102 -#define CMD_PIPELINE_SELECT 0x6104 +#define CMD_STATE_SIP 0x6102 +#define CMD_PIPELINE_SELECT_965 0x6104 +#define CMD_PIPELINE_SELECT_GM45 0x6904 + +#define _3DSTATE_PIPELINED_POINTERS 0x7800 +#define _3DSTATE_BINDING_TABLE_POINTERS 0x7801 +# define GEN6_BINDING_TABLE_MODIFY_VS (1 << 8) +# define GEN6_BINDING_TABLE_MODIFY_GS (1 << 9) +# define GEN6_BINDING_TABLE_MODIFY_PS (1 << 12) + +#define _3DSTATE_BINDING_TABLE_POINTERS_VS 0x7826/* GEN7+ */ +#define _3DSTATE_BINDING_TABLE_POINTERS_HS 0x7827/* GEN7+ */ +#define _3DSTATE_BINDING_TABLE_POINTERS_DS 0x7828/* GEN7+ */ +#define _3DSTATE_BINDING_TABLE_POINTERS_GS 0x7829/* GEN7+ */ +#define _3DSTATE_BINDING_TABLE_POINTERS_PS 0x782A/* GEN7+ */ + +#define _3DSTATE_SAMPLER_STATE_POINTERS 0x7802/* GEN6+ */ +# define PS_SAMPLER_STATE_CHANGE (1 << 12) +# define GS_SAMPLER_STATE_CHANGE (1 << 9) +# define VS_SAMPLER_STATE_CHANGE (1 << 8) +/* DW1: VS */ +/* DW2: GS */ +/* DW3: PS */ + +#define _3DSTATE_SAMPLER_STATE_POINTERS_VS 0x782B/* GEN7+ */ +#define _3DSTATE_SAMPLER_STATE_POINTERS_GS 0x782E/* GEN7+ */ +#define _3DSTATE_SAMPLER_STATE_POINTERS_PS 0x782F/* GEN7+ */ + +#define _3DSTATE_VERTEX_BUFFERS 0x7808 +# define BRW_VB0_INDEX_SHIFT 27 +# define GEN6_VB0_INDEX_SHIFT 26 +# define BRW_VB0_ACCESS_VERTEXDATA (0 << 26) +# define BRW_VB0_ACCESS_INSTANCEDATA (1 << 26) +# define GEN6_VB0_ACCESS_VERTEXDATA (0 << 20) +# define GEN6_VB0_ACCESS_INSTANCEDATA (1 << 20) +# define GEN7_VB0_ADDRESS_MODIFYENABLE (1 << 14) +# define BRW_VB0_PITCH_SHIFT 0 + +#define _3DSTATE_VERTEX_ELEMENTS 0x7809 +# define BRW_VE0_INDEX_SHIFT 27 +# define GEN6_VE0_INDEX_SHIFT 26 +# define BRW_VE0_FORMAT_SHIFT 16 +# define BRW_VE0_VALID (1 << 26) +# define GEN6_VE0_VALID (1 << 25) +# define GEN6_VE0_EDGE_FLAG_ENABLE (1 << 15) +# define BRW_VE0_SRC_OFFSET_SHIFT 0 +# define BRW_VE1_COMPONENT_NOSTORE 0 +# define BRW_VE1_COMPONENT_STORE_SRC 1 +# define BRW_VE1_COMPONENT_STORE_0 2 +# define BRW_VE1_COMPONENT_STORE_1_FLT 3 +# define BRW_VE1_COMPONENT_STORE_1_INT 4 +# define BRW_VE1_COMPONENT_STORE_VID 5 +# define BRW_VE1_COMPONENT_STORE_IID 6 +# define BRW_VE1_COMPONENT_STORE_PID 7 +# define BRW_VE1_COMPONENT_0_SHIFT 28 +# define BRW_VE1_COMPONENT_1_SHIFT 24 +# define BRW_VE1_COMPONENT_2_SHIFT 20 +# define BRW_VE1_COMPONENT_3_SHIFT 16 +# define BRW_VE1_DST_OFFSET_SHIFT 0 -#define CMD_PIPELINED_STATE_POINTERS 0x7800 -#define CMD_BINDING_TABLE_PTRS 0x7801 -#define CMD_VERTEX_BUFFER 0x7808 -#define CMD_VERTEX_ELEMENT 0x7809#define CMD_INDEX_BUFFER 0x780a -#define CMD_VF_STATISTICS 0x780b - -#define CMD_DRAW_RECT 0x7900 -#define CMD_BLEND_CONSTANT_COLOR 0x7901 -#define CMD_CHROMA_KEY 0x7904 -#define CMD_DEPTH_BUFFER 0x7905 -#define CMD_POLY_STIPPLE_OFFSET 0x7906 -#define CMD_POLY_STIPPLE_PATTERN 0x7907 -#define CMD_LINE_STIPPLE_PATTERN 0x7908 -#define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7908 +#define GEN4_3DSTATE_VF_STATISTICS 0x780b +#define GM45_3DSTATE_VF_STATISTICS 0x680b +#define _3DSTATE_CC_STATE_POINTERS 0x780e/* GEN6+ */ +#define _3DSTATE_BLEND_STATE_POINTERS 0x7824/* GEN7+ */ +#define _3DSTATE_DEPTH_STENCIL_STATE_POINTERS 0x7825/* GEN7+ */ + +#define _3DSTATE_URB 0x7805/* GEN6 */ +# define GEN6_URB_VS_SIZE_SHIFT 16 +# define GEN6_URB_VS_ENTRIES_SHIFT 0 +# define GEN6_URB_GS_ENTRIES_SHIFT 8 +# define GEN6_URB_GS_SIZE_SHIFT 0 + +#define _3DSTATE_VF 0x780c/* GEN7.5+ */ +#define HSW_CUT_INDEX_ENABLE (1 << 8) + +#define _3DSTATE_URB_VS 0x7830/* GEN7+ */ +#define _3DSTATE_URB_HS 0x7831/* GEN7+ */ +#define _3DSTATE_URB_DS 0x7832/* GEN7+ */ +#define _3DSTATE_URB_GS 0x7833/* GEN7+ */ +# define GEN7_URB_ENTRY_SIZE_SHIFT 16 +# define GEN7_URB_STARTING_ADDRESS_SHIFT 25 + +#define _3DSTATE_PUSH_CONSTANT_ALLOC_VS 0x7912/* GEN7+ */ +#define _3DSTATE_PUSH_CONSTANT_ALLOC_PS 0x7916/* GEN7+ */ +# define GEN7_PUSH_CONSTANT_BUFFER_OFFSET_SHIFT 16 + +#define _3DSTATE_VIEWPORT_STATE_POINTERS 0x780d/* GEN6+ */ +# define GEN6_CC_VIEWPORT_MODIFY (1 << 12) +# define GEN6_SF_VIEWPORT_MODIFY (1 << 11) +# define GEN6_CLIP_VIEWPORT_MODIFY (1 << 10) + +#define _3DSTATE_VIEWPORT_STATE_POINTERS_CC 0x7823/* GEN7+ */ +#define _3DSTATE_VIEWPORT_STATE_POINTERS_SF_CL 0x7821/* GEN7+ */ + +#define _3DSTATE_SCISSOR_STATE_POINTERS 0x780f/* GEN6+ */ + +#define _3DSTATE_VS 0x7810/* GEN6+ */ +/* DW2 */ +# define GEN6_VS_SPF_MODE (1 << 31) +# define GEN6_VS_VECTOR_MASK_ENABLE (1 << 30) +# define GEN6_VS_SAMPLER_COUNT_SHIFT 27 +# define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN6_VS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN6_VS_FLOATING_POINT_MODE_ALT (1 << 16) +/* DW4 */ +# define GEN6_VS_DISPATCH_START_GRF_SHIFT 20 +# define GEN6_VS_URB_READ_LENGTH_SHIFT 11 +# define GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT 4 +/* DW5 */ +# define GEN6_VS_MAX_THREADS_SHIFT 25 +# define HSW_VS_MAX_THREADS_SHIFT 23 +# define GEN6_VS_STATISTICS_ENABLE (1 << 10) +# define GEN6_VS_CACHE_DISABLE (1 << 1) +# define GEN6_VS_ENABLE (1 << 0) + +#define _3DSTATE_GS 0x7811/* GEN6+ */ +/* DW2 */ +# define GEN6_GS_SPF_MODE (1 << 31) +# define GEN6_GS_VECTOR_MASK_ENABLE (1 << 30) +# define GEN6_GS_SAMPLER_COUNT_SHIFT 27 +# define GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN6_GS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN6_GS_FLOATING_POINT_MODE_ALT (1 << 16) +/* DW4 */ +# define GEN6_GS_URB_READ_LENGTH_SHIFT 11 +# define GEN7_GS_INCLUDE_VERTEX_HANDLES (1 << 10) +# define GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT 4 +# define GEN6_GS_DISPATCH_START_GRF_SHIFT 0 +/* DW5 */ +# define GEN6_GS_MAX_THREADS_SHIFT 25 +# define GEN6_GS_STATISTICS_ENABLE (1 << 10) +# define GEN6_GS_SO_STATISTICS_ENABLE (1 << 9) +# define GEN6_GS_RENDERING_ENABLE (1 << 8) +# define GEN7_GS_ENABLE (1 << 0) +/* DW6 */ +# define GEN6_GS_REORDER (1 << 30) +# define GEN6_GS_DISCARD_ADJACENCY (1 << 29) +# define GEN6_GS_SVBI_PAYLOAD_ENABLE (1 << 28) +# define GEN6_GS_SVBI_POSTINCREMENT_ENABLE (1 << 27) +# define GEN6_GS_SVBI_POSTINCREMENT_VALUE_SHIFT 16 +# define GEN6_GS_SVBI_POSTINCREMENT_VALUE_MASK INTEL_MASK(25, 16) +# define GEN6_GS_ENABLE (1 << 15) + +# define BRW_GS_EDGE_INDICATOR_0 (1 << 8) +# define BRW_GS_EDGE_INDICATOR_1 (1 << 9) + +#define _3DSTATE_HS 0x781B/* GEN7+ */ +#define _3DSTATE_TE 0x781C/* GEN7+ */ +#define _3DSTATE_DS 0x781D/* GEN7+ */ + +#define _3DSTATE_CLIP 0x7812/* GEN6+ */ +/* DW1 */ +# define GEN7_CLIP_WINDING_CW (0 << 20) +# define GEN7_CLIP_WINDING_CCW (1 << 20) +# define GEN7_CLIP_VERTEX_SUBPIXEL_PRECISION_8 (0 << 19) +# define GEN7_CLIP_VERTEX_SUBPIXEL_PRECISION_4 (1 << 19) +# define GEN7_CLIP_EARLY_CULL (1 << 18) +# define GEN7_CLIP_CULLMODE_BOTH (0 << 16) +# define GEN7_CLIP_CULLMODE_NONE (1 << 16) +# define GEN7_CLIP_CULLMODE_FRONT (2 << 16) +# define GEN7_CLIP_CULLMODE_BACK (3 << 16) +# define GEN6_CLIP_STATISTICS_ENABLE (1 << 10) +/** +* Just does cheap culling based on the clip distance. Bits must be +* disjoint with USER_CLIP_CLIP_DISTANCE bits. +*/ +# define GEN6_USER_CLIP_CULL_DISTANCES_SHIFT 0 +/* DW2 */ +# define GEN6_CLIP_ENABLE (1 << 31) +# define GEN6_CLIP_API_OGL (0 << 30) +# define GEN6_CLIP_API_D3D (1 << 30) +# define GEN6_CLIP_XY_TEST (1 << 28) +# define GEN6_CLIP_Z_TEST (1 << 27) +# define GEN6_CLIP_GB_TEST (1 << 26) +/** 8-bit field of which user clip distances to clip aganist. */ +# define GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT 16 +# define GEN6_CLIP_MODE_NORMAL (0 << 13) +# define GEN6_CLIP_MODE_REJECT_ALL (3 << 13) +# define GEN6_CLIP_MODE_ACCEPT_ALL (4 << 13) +# define GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE (1 << 9) +# define GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE (1 << 8) +# define GEN6_CLIP_TRI_PROVOKE_SHIFT 4 +# define GEN6_CLIP_LINE_PROVOKE_SHIFT 2 +# define GEN6_CLIP_TRIFAN_PROVOKE_SHIFT 0 +/* DW3 */ +# define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT 17 +# define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT 6 +# define GEN6_CLIP_FORCE_ZERO_RTAINDEX (1 << 5) + +#define _3DSTATE_SF 0x7813/* GEN6+ */ +/* DW1 (for gen6) */ +# define GEN6_SF_NUM_OUTPUTS_SHIFT 22 +# define GEN6_SF_SWIZZLE_ENABLE (1 << 21) +# define GEN6_SF_POINT_SPRITE_UPPERLEFT (0 << 20) +# define GEN6_SF_POINT_SPRITE_LOWERLEFT (1 << 20) +# define GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT 11 +# define GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT 4 +/* DW2 */ +# define GEN6_SF_LEGACY_GLOBAL_DEPTH_BIAS (1 << 11) +# define GEN6_SF_STATISTICS_ENABLE (1 << 10) +# define GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID (1 << 9) +# define GEN6_SF_GLOBAL_DEPTH_OFFSET_WIREFRAME (1 << 8) +# define GEN6_SF_GLOBAL_DEPTH_OFFSET_POINT (1 << 7) +# define GEN6_SF_FRONT_SOLID (0 << 5) +# define GEN6_SF_FRONT_WIREFRAME (1 << 5) +# define GEN6_SF_FRONT_POINT (2 << 5) +# define GEN6_SF_BACK_SOLID (0 << 3) +# define GEN6_SF_BACK_WIREFRAME (1 << 3) +# define GEN6_SF_BACK_POINT (2 << 3) +# define GEN6_SF_VIEWPORT_TRANSFORM_ENABLE (1 << 1) +# define GEN6_SF_WINDING_CCW (1 << 0) +/* DW3 */ +# define GEN6_SF_LINE_AA_ENABLE (1 << 31) +# define GEN6_SF_CULL_BOTH (0 << 29) +# define GEN6_SF_CULL_NONE (1 << 29) +# define GEN6_SF_CULL_FRONT (2 << 29) +# define GEN6_SF_CULL_BACK (3 << 29) +# define GEN6_SF_LINE_WIDTH_SHIFT 18/* U3.7 */ +# define GEN6_SF_LINE_END_CAP_WIDTH_0_5 (0 << 16) +# define GEN6_SF_LINE_END_CAP_WIDTH_1_0 (1 << 16) +# define GEN6_SF_LINE_END_CAP_WIDTH_2_0 (2 << 16) +# define GEN6_SF_LINE_END_CAP_WIDTH_4_0 (3 << 16) +# define GEN6_SF_SCISSOR_ENABLE (1 << 11) +# define GEN6_SF_MSRAST_OFF_PIXEL (0 << 8) +# define GEN6_SF_MSRAST_OFF_PATTERN (1 << 8) +# define GEN6_SF_MSRAST_ON_PIXEL (2 << 8) +# define GEN6_SF_MSRAST_ON_PATTERN (3 << 8) +/* DW4 */ +# define GEN6_SF_TRI_PROVOKE_SHIFT 29 +# define GEN6_SF_LINE_PROVOKE_SHIFT 27 +# define GEN6_SF_TRIFAN_PROVOKE_SHIFT 25 +# define GEN6_SF_LINE_AA_MODE_MANHATTAN (0 << 14) +# define GEN6_SF_LINE_AA_MODE_TRUE (1 << 14) +# define GEN6_SF_VERTEX_SUBPIXEL_8BITS (0 << 12) +# define GEN6_SF_VERTEX_SUBPIXEL_4BITS (1 << 12) +# define GEN6_SF_USE_STATE_POINT_WIDTH (1 << 11) +# define GEN6_SF_POINT_WIDTH_SHIFT 0/* U8.3 */ +/* DW5: depth offset constant */ +/* DW6: depth offset scale */ +/* DW7: depth offset clamp */ +/* DW8 */ +# define ATTRIBUTE_1_OVERRIDE_W (1 << 31) +# define ATTRIBUTE_1_OVERRIDE_Z (1 << 30) +# define ATTRIBUTE_1_OVERRIDE_Y (1 << 29) +# define ATTRIBUTE_1_OVERRIDE_X (1 << 28) +# define ATTRIBUTE_1_CONST_SOURCE_SHIFT 25 +# define ATTRIBUTE_1_SWIZZLE_SHIFT 22 +# define ATTRIBUTE_1_SOURCE_SHIFT 16 +# define ATTRIBUTE_0_OVERRIDE_W (1 << 15) +# define ATTRIBUTE_0_OVERRIDE_Z (1 << 14) +# define ATTRIBUTE_0_OVERRIDE_Y (1 << 13) +# define ATTRIBUTE_0_OVERRIDE_X (1 << 12) +# define ATTRIBUTE_0_CONST_SOURCE_SHIFT 9 +# define ATTRIBUTE_0_SWIZZLE_SHIFT 6 +# define ATTRIBUTE_0_SOURCE_SHIFT 0 + +# define ATTRIBUTE_SWIZZLE_INPUTATTR 0 +# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING 1 +# define ATTRIBUTE_SWIZZLE_INPUTATTR_W 2 +# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING_W 3 +# define ATTRIBUTE_SWIZZLE_SHIFT 6 + +/* DW16: Point sprite texture coordinate enables */ +/* DW17: Constant interpolation enables */ +/* DW18: attr 0-7 wrap shortest enables */ +/* DW19: attr 8-16 wrap shortest enables */ + +/* On GEN7, many fields of 3DSTATE_SF were split out into a new command: +* 3DSTATE_SBE. The remaining fields live in different DWords, but retain +* the same bit-offset. The only new field: +*/ +/* GEN7/DW1: */ +# define GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT 12 +/* GEN7/DW2: */ +# define HSW_SF_LINE_STIPPLE_ENABLE 14 + +#define _3DSTATE_SBE 0x781F/* GEN7+ */ +/* DW1 */ +# define GEN7_SBE_SWIZZLE_CONTROL_MODE (1 << 28) +# define GEN7_SBE_NUM_OUTPUTS_SHIFT 22 +# define GEN7_SBE_SWIZZLE_ENABLE (1 << 21) +# define GEN7_SBE_POINT_SPRITE_LOWERLEFT (1 << 20) +# define GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT 11 +# define GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT 4 +/* DW2-9: Attribute setup (same as DW8-15 of gen6 _3DSTATE_SF) */ +/* DW10: Point sprite texture coordinate enables */ +/* DW11: Constant interpolation enables */ +/* DW12: attr 0-7 wrap shortest enables */ +/* DW13: attr 8-16 wrap shortest enables */ + +enum brw_wm_barycentric_interp_mode { +BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC =0 , +BRW_WM_PERSPECTIVE_CENTROID_BARYCENTRIC =1 , +BRW_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC =2 , +BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC =3 , +BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC =4 , +BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC =5 , +BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT =6 +}; +#define BRW_WM_NONPERSPECTIVE_BARYCENTRIC_BITS \ + ((1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC) | \ + (1 << BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC) | \ + (1 << BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC)) + +#define _3DSTATE_WM 0x7814/* GEN6+ */ +/* DW1: kernel pointer */ +/* DW2 */ +# define GEN6_WM_SPF_MODE (1 << 31) +# define GEN6_WM_VECTOR_MASK_ENABLE (1 << 30) +# define GEN6_WM_SAMPLER_COUNT_SHIFT 27 +# define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN6_WM_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN6_WM_FLOATING_POINT_MODE_ALT (1 << 16) +/* DW3: scratch space */ +/* DW4 */ +# define GEN6_WM_STATISTICS_ENABLE (1 << 31) +# define GEN6_WM_DEPTH_CLEAR (1 << 30) +# define GEN6_WM_DEPTH_RESOLVE (1 << 28) +# define GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE (1 << 27) +# define GEN6_WM_DISPATCH_START_GRF_SHIFT_0 16 +# define GEN6_WM_DISPATCH_START_GRF_SHIFT_1 8 +# define GEN6_WM_DISPATCH_START_GRF_SHIFT_2 0 +/* DW5 */ +# define GEN6_WM_MAX_THREADS_SHIFT 25 +# define GEN6_WM_KILL_ENABLE (1 << 22) +# define GEN6_WM_COMPUTED_DEPTH (1 << 21) +# define GEN6_WM_USES_SOURCE_DEPTH (1 << 20) +# define GEN6_WM_DISPATCH_ENABLE (1 << 19) +# define GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5 (0 << 16) +# define GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0 (1 << 16) +# define GEN6_WM_LINE_END_CAP_AA_WIDTH_2_0 (2 << 16) +# define GEN6_WM_LINE_END_CAP_AA_WIDTH_4_0 (3 << 16) +# define GEN6_WM_LINE_AA_WIDTH_0_5 (0 << 14) +# define GEN6_WM_LINE_AA_WIDTH_1_0 (1 << 14) +# define GEN6_WM_LINE_AA_WIDTH_2_0 (2 << 14) +# define GEN6_WM_LINE_AA_WIDTH_4_0 (3 << 14) +# define GEN6_WM_POLYGON_STIPPLE_ENABLE (1 << 13) +# define GEN6_WM_LINE_STIPPLE_ENABLE (1 << 11) +# define GEN6_WM_OMASK_TO_RENDER_TARGET (1 << 9) +# define GEN6_WM_USES_SOURCE_W (1 << 8) +# define GEN6_WM_DUAL_SOURCE_BLEND_ENABLE (1 << 7) +# define GEN6_WM_32_DISPATCH_ENABLE (1 << 2) +# define GEN6_WM_16_DISPATCH_ENABLE (1 << 1) +# define GEN6_WM_8_DISPATCH_ENABLE (1 << 0) +/* DW6 */ +# define GEN6_WM_NUM_SF_OUTPUTS_SHIFT 20 +# define GEN6_WM_POSOFFSET_NONE (0 << 18) +# define GEN6_WM_POSOFFSET_CENTROID (2 << 18) +# define GEN6_WM_POSOFFSET_SAMPLE (3 << 18) +# define GEN6_WM_POSITION_ZW_PIXEL (0 << 16) +# define GEN6_WM_POSITION_ZW_CENTROID (2 << 16) +# define GEN6_WM_POSITION_ZW_SAMPLE (3 << 16) +# define GEN6_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 15) +# define GEN6_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC (1 << 14) +# define GEN6_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC (1 << 13) +# define GEN6_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 12) +# define GEN6_WM_PERSPECTIVE_CENTROID_BARYCENTRIC (1 << 11) +# define GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC (1 << 10) +# define GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT 10 +# define GEN6_WM_POINT_RASTRULE_UPPER_RIGHT (1 << 9) +# define GEN6_WM_MSRAST_OFF_PIXEL (0 << 1) +# define GEN6_WM_MSRAST_OFF_PATTERN (1 << 1) +# define GEN6_WM_MSRAST_ON_PIXEL (2 << 1) +# define GEN6_WM_MSRAST_ON_PATTERN (3 << 1) +# define GEN6_WM_MSDISPMODE_PERSAMPLE (0 << 0) +# define GEN6_WM_MSDISPMODE_PERPIXEL (1 << 0) +/* DW7: kernel 1 pointer */ +/* DW8: kernel 2 pointer */ + +#define _3DSTATE_CONSTANT_VS 0x7815/* GEN6+ */ +#define _3DSTATE_CONSTANT_GS 0x7816/* GEN6+ */ +#define _3DSTATE_CONSTANT_PS 0x7817/* GEN6+ */ +# define GEN6_CONSTANT_BUFFER_3_ENABLE (1 << 15) +# define GEN6_CONSTANT_BUFFER_2_ENABLE (1 << 14) +# define GEN6_CONSTANT_BUFFER_1_ENABLE (1 << 13) +# define GEN6_CONSTANT_BUFFER_0_ENABLE (1 << 12) + +#define _3DSTATE_CONSTANT_HS 0x7819/* GEN7+ */ +#define _3DSTATE_CONSTANT_DS 0x781A/* GEN7+ */ + +#define _3DSTATE_STREAMOUT 0x781e/* GEN7+ */ +/* DW1 */ +# define SO_FUNCTION_ENABLE (1 << 31) +# define SO_RENDERING_DISABLE (1 << 30) +/* This selects which incoming rendering stream goes down the pipeline. The +* rendering stream is 0 if not defined by special cases in the GS state. +*/ +# define SO_RENDER_STREAM_SELECT_SHIFT 27 +# define SO_RENDER_STREAM_SELECT_MASK INTEL_MASK(28, 27) +/* Controls reordering of TRISTRIP_* elements in stream output (not rendering). +*/ +# define SO_REORDER_TRAILING (1 << 26) +/* Controls SO_NUM_PRIMS_WRITTEN_* and SO_PRIM_STORAGE_* */ +# define SO_STATISTICS_ENABLE (1 << 25) +# define SO_BUFFER_ENABLE (n) (1 << (8 + (n))) +/* DW2 */ +# define SO_STREAM_3_VERTEX_READ_OFFSET_SHIFT 29 +# define SO_STREAM_3_VERTEX_READ_OFFSET_MASK INTEL_MASK(29, 29) +# define SO_STREAM_3_VERTEX_READ_LENGTH_SHIFT 24 +# define SO_STREAM_3_VERTEX_READ_LENGTH_MASK INTEL_MASK(28, 24) +# define SO_STREAM_2_VERTEX_READ_OFFSET_SHIFT 21 +# define SO_STREAM_2_VERTEX_READ_OFFSET_MASK INTEL_MASK(21, 21) +# define SO_STREAM_2_VERTEX_READ_LENGTH_SHIFT 16 +# define SO_STREAM_2_VERTEX_READ_LENGTH_MASK INTEL_MASK(20, 16) +# define SO_STREAM_1_VERTEX_READ_OFFSET_SHIFT 13 +# define SO_STREAM_1_VERTEX_READ_OFFSET_MASK INTEL_MASK(13, 13) +# define SO_STREAM_1_VERTEX_READ_LENGTH_SHIFT 8 +# define SO_STREAM_1_VERTEX_READ_LENGTH_MASK INTEL_MASK(12, 8) +# define SO_STREAM_0_VERTEX_READ_OFFSET_SHIFT 5 +# define SO_STREAM_0_VERTEX_READ_OFFSET_MASK INTEL_MASK(5, 5) +# define SO_STREAM_0_VERTEX_READ_LENGTH_SHIFT 0 +# define SO_STREAM_0_VERTEX_READ_LENGTH_MASK INTEL_MASK(4, 0) + +/* 3DSTATE_WM for Gen7 */ +/* DW1 */ +# define GEN7_WM_STATISTICS_ENABLE (1 << 31) +# define GEN7_WM_DEPTH_CLEAR (1 << 30) +# define GEN7_WM_DISPATCH_ENABLE (1 << 29) +# define GEN7_WM_DEPTH_RESOLVE (1 << 28) +# define GEN7_WM_HIERARCHICAL_DEPTH_RESOLVE (1 << 27) +# define GEN7_WM_KILL_ENABLE (1 << 25) +# define GEN7_WM_PSCDEPTH_OFF (0 << 23) +# define GEN7_WM_PSCDEPTH_ON (1 << 23) +# define GEN7_WM_PSCDEPTH_ON_GE (2 << 23) +# define GEN7_WM_PSCDEPTH_ON_LE (3 << 23) +# define GEN7_WM_USES_SOURCE_DEPTH (1 << 20) +# define GEN7_WM_USES_SOURCE_W (1 << 19) +# define GEN7_WM_POSITION_ZW_PIXEL (0 << 17) +# define GEN7_WM_POSITION_ZW_CENTROID (2 << 17) +# define GEN7_WM_POSITION_ZW_SAMPLE (3 << 17) +# define GEN7_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT 11 +# define GEN7_WM_USES_INPUT_COVERAGE_MASK (1 << 10) +# define GEN7_WM_LINE_END_CAP_AA_WIDTH_0_5 (0 << 8) +# define GEN7_WM_LINE_END_CAP_AA_WIDTH_1_0 (1 << 8) +# define GEN7_WM_LINE_END_CAP_AA_WIDTH_2_0 (2 << 8) +# define GEN7_WM_LINE_END_CAP_AA_WIDTH_4_0 (3 << 8) +# define GEN7_WM_LINE_AA_WIDTH_0_5 (0 << 6) +# define GEN7_WM_LINE_AA_WIDTH_1_0 (1 << 6) +# define GEN7_WM_LINE_AA_WIDTH_2_0 (2 << 6) +# define GEN7_WM_LINE_AA_WIDTH_4_0 (3 << 6) +# define GEN7_WM_POLYGON_STIPPLE_ENABLE (1 << 4) +# define GEN7_WM_LINE_STIPPLE_ENABLE (1 << 3) +# define GEN7_WM_POINT_RASTRULE_UPPER_RIGHT (1 << 2) +# define GEN7_WM_MSRAST_OFF_PIXEL (0 << 0) +# define GEN7_WM_MSRAST_OFF_PATTERN (1 << 0) +# define GEN7_WM_MSRAST_ON_PIXEL (2 << 0) +# define GEN7_WM_MSRAST_ON_PATTERN (3 << 0) +/* DW2 */ +# define GEN7_WM_MSDISPMODE_PERSAMPLE (0 << 31) +# define GEN7_WM_MSDISPMODE_PERPIXEL (1 << 31) + +#define _3DSTATE_PS 0x7820/* GEN7+ */ +/* DW1: kernel pointer */ +/* DW2 */ +# define GEN7_PS_SPF_MODE (1 << 31) +# define GEN7_PS_VECTOR_MASK_ENABLE (1 << 30) +# define GEN7_PS_SAMPLER_COUNT_SHIFT 27 +# define GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN7_PS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN7_PS_FLOATING_POINT_MODE_ALT (1 << 16) +/* DW3: scratch space */ +/* DW4 */ +# define IVB_PS_MAX_THREADS_SHIFT 24 +# define HSW_PS_MAX_THREADS_SHIFT 23 +# define HSW_PS_SAMPLE_MASK_SHIFT 12 +# define HSW_PS_SAMPLE_MASK_MASK INTEL_MASK(19, 12) +# define GEN7_PS_PUSH_CONSTANT_ENABLE (1 << 11) +# define GEN7_PS_ATTRIBUTE_ENABLE (1 << 10) +# define GEN7_PS_OMASK_TO_RENDER_TARGET (1 << 9) +# define GEN7_PS_DUAL_SOURCE_BLEND_ENABLE (1 << 7) +# define GEN7_PS_POSOFFSET_NONE (0 << 3) +# define GEN7_PS_POSOFFSET_CENTROID (2 << 3) +# define GEN7_PS_POSOFFSET_SAMPLE (3 << 3) +# define GEN7_PS_32_DISPATCH_ENABLE (1 << 2) +# define GEN7_PS_16_DISPATCH_ENABLE (1 << 1) +# define GEN7_PS_8_DISPATCH_ENABLE (1 << 0) +/* DW5 */ +# define GEN7_PS_DISPATCH_START_GRF_SHIFT_0 16 +# define GEN7_PS_DISPATCH_START_GRF_SHIFT_1 8 +# define GEN7_PS_DISPATCH_START_GRF_SHIFT_2 0 +/* DW6: kernel 1 pointer */ +/* DW7: kernel 2 pointer */ + +#define _3DSTATE_SAMPLE_MASK 0x7818/* GEN6+ */ + +#define _3DSTATE_DRAWING_RECTANGLE 0x7900 +#define _3DSTATE_BLEND_CONSTANT_COLOR 0x7901 +#define _3DSTATE_CHROMA_KEY 0x7904 +#define _3DSTATE_DEPTH_BUFFER 0x7905/* GEN4-6 */ +#define _3DSTATE_POLY_STIPPLE_OFFSET 0x7906 +#define _3DSTATE_POLY_STIPPLE_PATTERN 0x7907 +#define _3DSTATE_LINE_STIPPLE_PATTERN 0x7908 +#define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909 +#define _3DSTATE_AA_LINE_PARAMETERS 0x790a/* G45+ */ + +#define _3DSTATE_GS_SVB_INDEX 0x790b/* CTG+ */ +/* DW1 */ +# define SVB_INDEX_SHIFT 29 +# define SVB_LOAD_INTERNAL_VERTEX_COUNT (1 << 0)/* SNB+ */ +/* DW2: SVB index */ +/* DW3: SVB maximum index */ + +#define _3DSTATE_MULTISAMPLE 0x790d/* GEN6+ */ +/* DW1 */ +# define MS_PIXEL_LOCATION_CENTER (0 << 4) +# define MS_PIXEL_LOCATION_UPPER_LEFT (1 << 4) +# define MS_NUMSAMPLES_1 (0 << 1) +# define MS_NUMSAMPLES_4 (2 << 1) +# define MS_NUMSAMPLES_8 (3 << 1) + +#define _3DSTATE_STENCIL_BUFFER 0x790e/* ILK, SNB */ +#define _3DSTATE_HIER_DEPTH_BUFFER 0x790f/* ILK, SNB */ + +#define GEN7_3DSTATE_CLEAR_PARAMS 0x7804 +#define GEN7_3DSTATE_DEPTH_BUFFER 0x7805 +#define GEN7_3DSTATE_STENCIL_BUFFER 0x7806 +# define HSW_STENCIL_ENABLED (1 << 31) +#define GEN7_3DSTATE_HIER_DEPTH_BUFFER 0x7807 + +#define _3DSTATE_CLEAR_PARAMS 0x7910/* ILK, SNB */ +# define GEN5_DEPTH_CLEAR_VALID (1 << 15) +/* DW1: depth clear value */ +/* DW2 */ +# define GEN7_DEPTH_CLEAR_VALID (1 << 0) + +#define _3DSTATE_SO_DECL_LIST 0x7917/* GEN7+ */ +/* DW1 */ +# define SO_STREAM_TO_BUFFER_SELECTS_3_SHIFT 12 +# define SO_STREAM_TO_BUFFER_SELECTS_3_MASK INTEL_MASK(15, 12) +# define SO_STREAM_TO_BUFFER_SELECTS_2_SHIFT 8 +# define SO_STREAM_TO_BUFFER_SELECTS_2_MASK INTEL_MASK(11, 8) +# define SO_STREAM_TO_BUFFER_SELECTS_1_SHIFT 4 +# define SO_STREAM_TO_BUFFER_SELECTS_1_MASK INTEL_MASK(7, 4) +# define SO_STREAM_TO_BUFFER_SELECTS_0_SHIFT 0 +# define SO_STREAM_TO_BUFFER_SELECTS_0_MASK INTEL_MASK(3, 0) +/* DW2 */ +# define SO_NUM_ENTRIES_3_SHIFT 24 +# define SO_NUM_ENTRIES_3_MASK INTEL_MASK(31, 24) +# define SO_NUM_ENTRIES_2_SHIFT 16 +# define SO_NUM_ENTRIES_2_MASK INTEL_MASK(23, 16) +# define SO_NUM_ENTRIES_1_SHIFT 8 +# define SO_NUM_ENTRIES_1_MASK INTEL_MASK(15, 8) +# define SO_NUM_ENTRIES_0_SHIFT 0 +# define SO_NUM_ENTRIES_0_MASK INTEL_MASK(7, 0) + +/* SO_DECL DW0 */ +# define SO_DECL_OUTPUT_BUFFER_SLOT_SHIFT 12 +# define SO_DECL_OUTPUT_BUFFER_SLOT_MASK INTEL_MASK(13, 12) +# define SO_DECL_HOLE_FLAG (1 << 11) +# define SO_DECL_REGISTER_INDEX_SHIFT 4 +# define SO_DECL_REGISTER_INDEX_MASK INTEL_MASK(9, 4) +# define SO_DECL_COMPONENT_MASK_SHIFT 0 +# define SO_DECL_COMPONENT_MASK_MASK INTEL_MASK(3, 0) + +#define _3DSTATE_SO_BUFFER 0x7918/* GEN7+ */ +/* DW1 */ +# define SO_BUFFER_INDEX_SHIFT 29 +# define SO_BUFFER_INDEX_MASK INTEL_MASK(30, 29) +# define SO_BUFFER_PITCH_SHIFT 0 +# define SO_BUFFER_PITCH_MASK INTEL_MASK(11, 0) +/* DW2: start address */ +/* DW3: end address. */ #define CMD_PIPE_CONTROL 0x7a00 -#define CMD_3D_PRIM 0x7b00 -#define CMD_MI_FLUSH 0x0200 -/* Various values from the R0 vertex header: +/* Bitfields for the URB_WRITE message, DW2 of message header: */ +#define URB_WRITE_PRIM_END 0x1 +#define URB_WRITE_PRIM_START 0x2 +#define URB_WRITE_PRIM_TYPE_SHIFT 2 + + +/* Maximum number of entries that can be addressed using a binding table +* pointer of type SURFTYPE_BUFFER */ -#define R02_PRIM_END 0x1 -#define R02_PRIM_START 0x2 +#define BRW_MAX_NUM_BUFFER_ENTRIES (1 << 27)#define EX_DESC_SFID_MASK 0xF#define EX_DESC_EOT_MASK 0x20
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 21/90 assembler: Remove trailing white space from brw_defines.h
In reply to Damien Lespiau--- assembler/brw_defines.h | 296 +++++++++++++++++++++++----------------------- 1 files changed, 148 insertions(+), 148 deletions(-)
assembler/brw_defines.h +148 -148
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,7 +22,7 @@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:
@@ -77,13 +77,13 @@#define _3DPRIM_LINESTRIP_CONT_BF 0x14#define _3DPRIM_TRIFAN_NOSTIPPLE 0x15 -#define BRW_ANISORATIO_2 0 -#define BRW_ANISORATIO_4 1 -#define BRW_ANISORATIO_6 2 -#define BRW_ANISORATIO_8 3 -#define BRW_ANISORATIO_10 4 -#define BRW_ANISORATIO_12 5 -#define BRW_ANISORATIO_14 6 +#define BRW_ANISORATIO_2 0 +#define BRW_ANISORATIO_4 1 +#define BRW_ANISORATIO_6 2 +#define BRW_ANISORATIO_8 3 +#define BRW_ANISORATIO_10 4 +#define BRW_ANISORATIO_12 5 +#define BRW_ANISORATIO_14 6#define BRW_ANISORATIO_16 7#define BRW_BLENDFACTOR_ONE 0x1
@@ -188,14 +188,14 @@#define BRW_LOGICOPFUNCTION_COPY 12#define BRW_LOGICOPFUNCTION_OR_REVERSE 13#define BRW_LOGICOPFUNCTION_OR 14 -#define BRW_LOGICOPFUNCTION_SET 15 +#define BRW_LOGICOPFUNCTION_SET 15 -#define BRW_MAPFILTER_NEAREST 0x0 -#define BRW_MAPFILTER_LINEAR 0x1 +#define BRW_MAPFILTER_NEAREST 0x0 +#define BRW_MAPFILTER_LINEAR 0x1#define BRW_MAPFILTER_ANISOTROPIC 0x2 -#define BRW_MIPFILTER_NONE 0 -#define BRW_MIPFILTER_NEAREST 1 +#define BRW_MIPFILTER_NONE 0 +#define BRW_MIPFILTER_NEAREST 1#define BRW_MIPFILTER_LINEAR 3#define BRW_ADDRESS_ROUNDING_ENABLE_U_MAG 0x20
@@ -208,7 +208,7 @@#define BRW_POLYGON_FRONT_FACING 0#define BRW_POLYGON_BACK_FACING 1 -#define BRW_PREFILTER_ALWAYS 0x0 +#define BRW_PREFILTER_ALWAYS 0x0#define BRW_PREFILTER_NEVER 0x1#define BRW_PREFILTER_LESS 0x2#define BRW_PREFILTER_EQUAL 0x3
@@ -218,10 +218,10 @@#define BRW_PREFILTER_GEQUAL 0x7#define BRW_PROVOKING_VERTEX_0 0 -#define BRW_PROVOKING_VERTEX_1 1 +#define BRW_PROVOKING_VERTEX_1 1#define BRW_PROVOKING_VERTEX_2 2 -#define BRW_RASTRULE_UPPER_LEFT 0 +#define BRW_RASTRULE_UPPER_LEFT 0#define BRW_RASTRULE_UPPER_RIGHT 1/* These are listed as "Reserved, but not seen as useful" * in Intel documentation (page 212, "Point Rasterization Rule",
@@ -229,7 +229,7 @@* "Intel® 965 Express Chipset Family and Intel® G35 Express * Chipset Graphics Controller Programmer's Reference Manual, * Volume 2: 3D/Media", Revision 1.0b as of January 2008, -* available at +* available at * http://intellinuxgraphics.org/documentation.html * at the time of this writing). *
@@ -267,88 +267,88 @@#define BRW_SURFACE_WRITEDISABLE_R_SHIFT 16#define BRW_SURFACE_WRITEDISABLE_A_SHIFT 17 -#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000 -#define BRW_SURFACEFORMAT_R32G32B32A32_SINT 0x001 -#define BRW_SURFACEFORMAT_R32G32B32A32_UINT 0x002 -#define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003 -#define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004 -#define BRW_SURFACEFORMAT_R64G64_FLOAT 0x005 -#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006 +#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000 +#define BRW_SURFACEFORMAT_R32G32B32A32_SINT 0x001 +#define BRW_SURFACEFORMAT_R32G32B32A32_UINT 0x002 +#define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003 +#define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004 +#define BRW_SURFACEFORMAT_R64G64_FLOAT 0x005 +#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006#define BRW_SURFACEFORMAT_R32G32B32A32_SSCALED 0x007#define BRW_SURFACEFORMAT_R32G32B32A32_USCALED 0x008#define BRW_SURFACEFORMAT_R32G32B32A32_SFIXED 0x020 -#define BRW_SURFACEFORMAT_R32G32B32_FLOAT 0x040 -#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041 -#define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042 -#define BRW_SURFACEFORMAT_R32G32B32_UNORM 0x043 -#define BRW_SURFACEFORMAT_R32G32B32_SNORM 0x044 -#define BRW_SURFACEFORMAT_R32G32B32_SSCALED 0x045 -#define BRW_SURFACEFORMAT_R32G32B32_USCALED 0x046 +#define BRW_SURFACEFORMAT_R32G32B32_FLOAT 0x040 +#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041 +#define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042 +#define BRW_SURFACEFORMAT_R32G32B32_UNORM 0x043 +#define BRW_SURFACEFORMAT_R32G32B32_SNORM 0x044 +#define BRW_SURFACEFORMAT_R32G32B32_SSCALED 0x045 +#define BRW_SURFACEFORMAT_R32G32B32_USCALED 0x046#define BRW_SURFACEFORMAT_R32G32B32_SFIXED 0x050 -#define BRW_SURFACEFORMAT_R16G16B16A16_UNORM 0x080 -#define BRW_SURFACEFORMAT_R16G16B16A16_SNORM 0x081 -#define BRW_SURFACEFORMAT_R16G16B16A16_SINT 0x082 -#define BRW_SURFACEFORMAT_R16G16B16A16_UINT 0x083 -#define BRW_SURFACEFORMAT_R16G16B16A16_FLOAT 0x084 -#define BRW_SURFACEFORMAT_R32G32_FLOAT 0x085 -#define BRW_SURFACEFORMAT_R32G32_SINT 0x086 -#define BRW_SURFACEFORMAT_R32G32_UINT 0x087 -#define BRW_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS 0x088 -#define BRW_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT 0x089 -#define BRW_SURFACEFORMAT_L32A32_FLOAT 0x08A -#define BRW_SURFACEFORMAT_R32G32_UNORM 0x08B -#define BRW_SURFACEFORMAT_R32G32_SNORM 0x08C -#define BRW_SURFACEFORMAT_R64_FLOAT 0x08D -#define BRW_SURFACEFORMAT_R16G16B16X16_UNORM 0x08E -#define BRW_SURFACEFORMAT_R16G16B16X16_FLOAT 0x08F -#define BRW_SURFACEFORMAT_A32X32_FLOAT 0x090 -#define BRW_SURFACEFORMAT_L32X32_FLOAT 0x091 -#define BRW_SURFACEFORMAT_I32X32_FLOAT 0x092 +#define BRW_SURFACEFORMAT_R16G16B16A16_UNORM 0x080 +#define BRW_SURFACEFORMAT_R16G16B16A16_SNORM 0x081 +#define BRW_SURFACEFORMAT_R16G16B16A16_SINT 0x082 +#define BRW_SURFACEFORMAT_R16G16B16A16_UINT 0x083 +#define BRW_SURFACEFORMAT_R16G16B16A16_FLOAT 0x084 +#define BRW_SURFACEFORMAT_R32G32_FLOAT 0x085 +#define BRW_SURFACEFORMAT_R32G32_SINT 0x086 +#define BRW_SURFACEFORMAT_R32G32_UINT 0x087 +#define BRW_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS 0x088 +#define BRW_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT 0x089 +#define BRW_SURFACEFORMAT_L32A32_FLOAT 0x08A +#define BRW_SURFACEFORMAT_R32G32_UNORM 0x08B +#define BRW_SURFACEFORMAT_R32G32_SNORM 0x08C +#define BRW_SURFACEFORMAT_R64_FLOAT 0x08D +#define BRW_SURFACEFORMAT_R16G16B16X16_UNORM 0x08E +#define BRW_SURFACEFORMAT_R16G16B16X16_FLOAT 0x08F +#define BRW_SURFACEFORMAT_A32X32_FLOAT 0x090 +#define BRW_SURFACEFORMAT_L32X32_FLOAT 0x091 +#define BRW_SURFACEFORMAT_I32X32_FLOAT 0x092#define BRW_SURFACEFORMAT_R16G16B16A16_SSCALED 0x093#define BRW_SURFACEFORMAT_R16G16B16A16_USCALED 0x094#define BRW_SURFACEFORMAT_R32G32_SSCALED 0x095#define BRW_SURFACEFORMAT_R32G32_USCALED 0x096#define BRW_SURFACEFORMAT_R32G32_SFIXED 0x0A0 -#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM 0x0C0 -#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB 0x0C1 -#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM 0x0C2 -#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB 0x0C3 -#define BRW_SURFACEFORMAT_R10G10B10A2_UINT 0x0C4 -#define BRW_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM 0x0C5 -#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM 0x0C7 -#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB 0x0C8 -#define BRW_SURFACEFORMAT_R8G8B8A8_SNORM 0x0C9 -#define BRW_SURFACEFORMAT_R8G8B8A8_SINT 0x0CA -#define BRW_SURFACEFORMAT_R8G8B8A8_UINT 0x0CB -#define BRW_SURFACEFORMAT_R16G16_UNORM 0x0CC -#define BRW_SURFACEFORMAT_R16G16_SNORM 0x0CD -#define BRW_SURFACEFORMAT_R16G16_SINT 0x0CE -#define BRW_SURFACEFORMAT_R16G16_UINT 0x0CF -#define BRW_SURFACEFORMAT_R16G16_FLOAT 0x0D0 -#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM 0x0D1 -#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB 0x0D2 -#define BRW_SURFACEFORMAT_R11G11B10_FLOAT 0x0D3 -#define BRW_SURFACEFORMAT_R32_SINT 0x0D6 -#define BRW_SURFACEFORMAT_R32_UINT 0x0D7 -#define BRW_SURFACEFORMAT_R32_FLOAT 0x0D8 -#define BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS 0x0D9 -#define BRW_SURFACEFORMAT_X24_TYPELESS_G8_UINT 0x0DA -#define BRW_SURFACEFORMAT_L16A16_UNORM 0x0DF -#define BRW_SURFACEFORMAT_I24X8_UNORM 0x0E0 -#define BRW_SURFACEFORMAT_L24X8_UNORM 0x0E1 -#define BRW_SURFACEFORMAT_A24X8_UNORM 0x0E2 -#define BRW_SURFACEFORMAT_I32_FLOAT 0x0E3 -#define BRW_SURFACEFORMAT_L32_FLOAT 0x0E4 -#define BRW_SURFACEFORMAT_A32_FLOAT 0x0E5 -#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM 0x0E9 -#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB 0x0EA -#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM 0x0EB -#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB 0x0EC -#define BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP 0x0ED -#define BRW_SURFACEFORMAT_B10G10R10X2_UNORM 0x0EE -#define BRW_SURFACEFORMAT_L16A16_FLOAT 0x0F0 -#define BRW_SURFACEFORMAT_R32_UNORM 0x0F1 -#define BRW_SURFACEFORMAT_R32_SNORM 0x0F2 +#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM 0x0C0 +#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB 0x0C1 +#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM 0x0C2 +#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB 0x0C3 +#define BRW_SURFACEFORMAT_R10G10B10A2_UINT 0x0C4 +#define BRW_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM 0x0C5 +#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM 0x0C7 +#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB 0x0C8 +#define BRW_SURFACEFORMAT_R8G8B8A8_SNORM 0x0C9 +#define BRW_SURFACEFORMAT_R8G8B8A8_SINT 0x0CA +#define BRW_SURFACEFORMAT_R8G8B8A8_UINT 0x0CB +#define BRW_SURFACEFORMAT_R16G16_UNORM 0x0CC +#define BRW_SURFACEFORMAT_R16G16_SNORM 0x0CD +#define BRW_SURFACEFORMAT_R16G16_SINT 0x0CE +#define BRW_SURFACEFORMAT_R16G16_UINT 0x0CF +#define BRW_SURFACEFORMAT_R16G16_FLOAT 0x0D0 +#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM 0x0D1 +#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB 0x0D2 +#define BRW_SURFACEFORMAT_R11G11B10_FLOAT 0x0D3 +#define BRW_SURFACEFORMAT_R32_SINT 0x0D6 +#define BRW_SURFACEFORMAT_R32_UINT 0x0D7 +#define BRW_SURFACEFORMAT_R32_FLOAT 0x0D8 +#define BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS 0x0D9 +#define BRW_SURFACEFORMAT_X24_TYPELESS_G8_UINT 0x0DA +#define BRW_SURFACEFORMAT_L16A16_UNORM 0x0DF +#define BRW_SURFACEFORMAT_I24X8_UNORM 0x0E0 +#define BRW_SURFACEFORMAT_L24X8_UNORM 0x0E1 +#define BRW_SURFACEFORMAT_A24X8_UNORM 0x0E2 +#define BRW_SURFACEFORMAT_I32_FLOAT 0x0E3 +#define BRW_SURFACEFORMAT_L32_FLOAT 0x0E4 +#define BRW_SURFACEFORMAT_A32_FLOAT 0x0E5 +#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM 0x0E9 +#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB 0x0EA +#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM 0x0EB +#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB 0x0EC +#define BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP 0x0ED +#define BRW_SURFACEFORMAT_B10G10R10X2_UNORM 0x0EE +#define BRW_SURFACEFORMAT_L16A16_FLOAT 0x0F0 +#define BRW_SURFACEFORMAT_R32_UNORM 0x0F1 +#define BRW_SURFACEFORMAT_R32_SNORM 0x0F2#define BRW_SURFACEFORMAT_R10G10B10X2_USCALED 0x0F3#define BRW_SURFACEFORMAT_R8G8B8A8_SSCALED 0x0F4#define BRW_SURFACEFORMAT_R8G8B8A8_USCALED 0x0F5
@@ -356,25 +356,25 @@#define BRW_SURFACEFORMAT_R16G16_USCALED 0x0F7#define BRW_SURFACEFORMAT_R32_SSCALED 0x0F8#define BRW_SURFACEFORMAT_R32_USCALED 0x0F9 -#define BRW_SURFACEFORMAT_B5G6R5_UNORM 0x100 -#define BRW_SURFACEFORMAT_B5G6R5_UNORM_SRGB 0x101 -#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM 0x102 -#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB 0x103 -#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM 0x104 -#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB 0x105 -#define BRW_SURFACEFORMAT_R8G8_UNORM 0x106 -#define BRW_SURFACEFORMAT_R8G8_SNORM 0x107 -#define BRW_SURFACEFORMAT_R8G8_SINT 0x108 -#define BRW_SURFACEFORMAT_R8G8_UINT 0x109 -#define BRW_SURFACEFORMAT_R16_UNORM 0x10A -#define BRW_SURFACEFORMAT_R16_SNORM 0x10B -#define BRW_SURFACEFORMAT_R16_SINT 0x10C -#define BRW_SURFACEFORMAT_R16_UINT 0x10D -#define BRW_SURFACEFORMAT_R16_FLOAT 0x10E -#define BRW_SURFACEFORMAT_I16_UNORM 0x111 -#define BRW_SURFACEFORMAT_L16_UNORM 0x112 -#define BRW_SURFACEFORMAT_A16_UNORM 0x113 -#define BRW_SURFACEFORMAT_L8A8_UNORM 0x114 +#define BRW_SURFACEFORMAT_B5G6R5_UNORM 0x100 +#define BRW_SURFACEFORMAT_B5G6R5_UNORM_SRGB 0x101 +#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM 0x102 +#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB 0x103 +#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM 0x104 +#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB 0x105 +#define BRW_SURFACEFORMAT_R8G8_UNORM 0x106 +#define BRW_SURFACEFORMAT_R8G8_SNORM 0x107 +#define BRW_SURFACEFORMAT_R8G8_SINT 0x108 +#define BRW_SURFACEFORMAT_R8G8_UINT 0x109 +#define BRW_SURFACEFORMAT_R16_UNORM 0x10A +#define BRW_SURFACEFORMAT_R16_SNORM 0x10B +#define BRW_SURFACEFORMAT_R16_SINT 0x10C +#define BRW_SURFACEFORMAT_R16_UINT 0x10D +#define BRW_SURFACEFORMAT_R16_FLOAT 0x10E +#define BRW_SURFACEFORMAT_I16_UNORM 0x111 +#define BRW_SURFACEFORMAT_L16_UNORM 0x112 +#define BRW_SURFACEFORMAT_A16_UNORM 0x113 +#define BRW_SURFACEFORMAT_L8A8_UNORM 0x114#define BRW_SURFACEFORMAT_I16_FLOAT 0x115#define BRW_SURFACEFORMAT_L16_FLOAT 0x116#define BRW_SURFACEFORMAT_A16_FLOAT 0x117
@@ -386,46 +386,46 @@#define BRW_SURFACEFORMAT_R8G8_USCALED 0x11D#define BRW_SURFACEFORMAT_R16_SSCALED 0x11E#define BRW_SURFACEFORMAT_R16_USCALED 0x11F -#define BRW_SURFACEFORMAT_R8_UNORM 0x140 -#define BRW_SURFACEFORMAT_R8_SNORM 0x141 -#define BRW_SURFACEFORMAT_R8_SINT 0x142 -#define BRW_SURFACEFORMAT_R8_UINT 0x143 -#define BRW_SURFACEFORMAT_A8_UNORM 0x144 -#define BRW_SURFACEFORMAT_I8_UNORM 0x145 -#define BRW_SURFACEFORMAT_L8_UNORM 0x146 -#define BRW_SURFACEFORMAT_P4A4_UNORM 0x147 +#define BRW_SURFACEFORMAT_R8_UNORM 0x140 +#define BRW_SURFACEFORMAT_R8_SNORM 0x141 +#define BRW_SURFACEFORMAT_R8_SINT 0x142 +#define BRW_SURFACEFORMAT_R8_UINT 0x143 +#define BRW_SURFACEFORMAT_A8_UNORM 0x144 +#define BRW_SURFACEFORMAT_I8_UNORM 0x145 +#define BRW_SURFACEFORMAT_L8_UNORM 0x146 +#define BRW_SURFACEFORMAT_P4A4_UNORM 0x147#define BRW_SURFACEFORMAT_A4P4_UNORM 0x148#define BRW_SURFACEFORMAT_R8_SSCALED 0x149#define BRW_SURFACEFORMAT_R8_USCALED 0x14A#define BRW_SURFACEFORMAT_L8_UNORM_SRGB 0x14C#define BRW_SURFACEFORMAT_DXT1_RGB_SRGB 0x180 -#define BRW_SURFACEFORMAT_R1_UINT 0x181 -#define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182 -#define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183 -#define BRW_SURFACEFORMAT_BC1_UNORM 0x186 -#define BRW_SURFACEFORMAT_BC2_UNORM 0x187 -#define BRW_SURFACEFORMAT_BC3_UNORM 0x188 -#define BRW_SURFACEFORMAT_BC4_UNORM 0x189 -#define BRW_SURFACEFORMAT_BC5_UNORM 0x18A -#define BRW_SURFACEFORMAT_BC1_UNORM_SRGB 0x18B -#define BRW_SURFACEFORMAT_BC2_UNORM_SRGB 0x18C -#define BRW_SURFACEFORMAT_BC3_UNORM_SRGB 0x18D -#define BRW_SURFACEFORMAT_MONO8 0x18E -#define BRW_SURFACEFORMAT_YCRCB_SWAPUV 0x18F -#define BRW_SURFACEFORMAT_YCRCB_SWAPY 0x190 -#define BRW_SURFACEFORMAT_DXT1_RGB 0x191 -#define BRW_SURFACEFORMAT_FXT1 0x192 -#define BRW_SURFACEFORMAT_R8G8B8_UNORM 0x193 -#define BRW_SURFACEFORMAT_R8G8B8_SNORM 0x194 -#define BRW_SURFACEFORMAT_R8G8B8_SSCALED 0x195 -#define BRW_SURFACEFORMAT_R8G8B8_USCALED 0x196 -#define BRW_SURFACEFORMAT_R64G64B64A64_FLOAT 0x197 -#define BRW_SURFACEFORMAT_R64G64B64_FLOAT 0x198 -#define BRW_SURFACEFORMAT_BC4_SNORM 0x199 -#define BRW_SURFACEFORMAT_BC5_SNORM 0x19A -#define BRW_SURFACEFORMAT_R16G16B16_UNORM 0x19C -#define BRW_SURFACEFORMAT_R16G16B16_SNORM 0x19D -#define BRW_SURFACEFORMAT_R16G16B16_SSCALED 0x19E +#define BRW_SURFACEFORMAT_R1_UINT 0x181 +#define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182 +#define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183 +#define BRW_SURFACEFORMAT_BC1_UNORM 0x186 +#define BRW_SURFACEFORMAT_BC2_UNORM 0x187 +#define BRW_SURFACEFORMAT_BC3_UNORM 0x188 +#define BRW_SURFACEFORMAT_BC4_UNORM 0x189 +#define BRW_SURFACEFORMAT_BC5_UNORM 0x18A +#define BRW_SURFACEFORMAT_BC1_UNORM_SRGB 0x18B +#define BRW_SURFACEFORMAT_BC2_UNORM_SRGB 0x18C +#define BRW_SURFACEFORMAT_BC3_UNORM_SRGB 0x18D +#define BRW_SURFACEFORMAT_MONO8 0x18E +#define BRW_SURFACEFORMAT_YCRCB_SWAPUV 0x18F +#define BRW_SURFACEFORMAT_YCRCB_SWAPY 0x190 +#define BRW_SURFACEFORMAT_DXT1_RGB 0x191 +#define BRW_SURFACEFORMAT_FXT1 0x192 +#define BRW_SURFACEFORMAT_R8G8B8_UNORM 0x193 +#define BRW_SURFACEFORMAT_R8G8B8_SNORM 0x194 +#define BRW_SURFACEFORMAT_R8G8B8_SSCALED 0x195 +#define BRW_SURFACEFORMAT_R8G8B8_USCALED 0x196 +#define BRW_SURFACEFORMAT_R64G64B64A64_FLOAT 0x197 +#define BRW_SURFACEFORMAT_R64G64B64_FLOAT 0x198 +#define BRW_SURFACEFORMAT_BC4_SNORM 0x199 +#define BRW_SURFACEFORMAT_BC5_SNORM 0x19A +#define BRW_SURFACEFORMAT_R16G16B16_UNORM 0x19C +#define BRW_SURFACEFORMAT_R16G16B16_SNORM 0x19D +#define BRW_SURFACEFORMAT_R16G16B16_SSCALED 0x19E#define BRW_SURFACEFORMAT_R16G16B16_USCALED 0x19F#define BRW_SURFACEFORMAT_R32_SFIXED 0x1B2#define BRW_SURFACEFORMAT_R10G10B10A2_SNORM 0x1B3
@@ -787,7 +787,7 @@ enum opcode {#define BRW_ARF_NULL 0x00#define BRW_ARF_ADDRESS 0x10 -#define BRW_ARF_ACCUMULATOR 0x20 +#define BRW_ARF_ACCUMULATOR 0x20#define BRW_ARF_FLAG 0x30#define BRW_ARF_MASK 0x40#define BRW_ARF_MASK_STACK 0x50
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 22/90 assembler: Update the disassembler code
In reply to Damien LespiauQuoted 1 line
From Mesa. This imports a bit more the of brw_eu* infrastructure (which
is going towards the right direction!) from mesa and the update is quite a significant improvement over what we had.
I also verified that the changes that were done on the assembler old version of brw_disasm.c were already supported by the Mesa version, and indeed they were.
---
assembler/Makefile.am | 4 +-
assembler/{disasm.c => brw_disasm.c} | 660 +++++++++++++++++++++++-----
assembler/brw_eu.h | 405 +++++++++++++++++
assembler/brw_reg.h | 808 ++++++++++++++++++++++++++++++++++
assembler/disasm-main.c | 20 +-
assembler/gen4asm.h | 3 -
6 files changed, 1783 insertions(+), 117 deletions(-)
rename assembler/{disasm.c => brw_disasm.c} (52%)
create mode 100644 assembler/brw_eu.h
create mode 100644 assembler/brw_reg.hassembler/Makefile.am +3 -1
@@ -11,6 +11,8 @@ gram.h: gram.c intel_gen4asm_SOURCES = \ brw_defines.h \ + brw_eu.h \ + brw_reg.h \ brw_structs.h \ gen4asm.h \ gram.y \
@@ -19,7 +21,7 @@ intel_gen4asm_SOURCES = \ $(NULL) intel_gen4disasm_SOURCES = \ - disasm.c disasm-main.c + brw_disasm.c disasm-main.c pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = intel-gen4asm.pc
assembler/brw_disasm.c renamed from assembler/disasm.c +550 -110
1,021 lines not on this page · raw message
assembler/brw_eu.h new file +405 -0
405 lines not on this page · raw message
assembler/brw_reg.h new file +808 -0
808 lines not on this page · raw message
assembler/disasm-main.c +17 -3
@@ -27,6 +27,7 @@#include <unistd.h> #include "gen4asm.h" +#include "brw_eu.h" static const struct option longopts[] = { {NULL ,0 ,NULL ,0 }
@@ -95,7 +96,10 @@ read_program_binary (FILE *input)static void usage (void ) { -fprintf (stderr,"usage: intel-gen4disasm [-o outputfile] [-b] inputfile\n" ); +fprintf (stderr,"usage: intel-gen4disasm [options] inputfile\n" ); +fprintf (stderr,"\t-b, --binary C style binary output\n" ); +fprintf (stderr,"\t-o, --output {outputfile} Specify output file\n" ); +fprintf (stderr,"\t-g, --gen <4|5|6|7> Specify GPU generation\n" ); }int main (int argc,char **argv)
@@ -107,9 +111,10 @@ int main(int argc, char **argv)char *output_file =NULL ;int byte_array_input =0 ;int o; +int gen =4 ;struct brw_program_instruction *inst; -while ((o =getopt_long (argc, argv,"o:b" , longopts,NULL )) !=-1 ) { +while ((o =getopt_long (argc, argv,"o:bg:" , longopts,NULL )) !=-1 ) {switch (o) {case 'o' :if (strcmp (optarg,"-" ) !=0 )
@@ -118,6 +123,15 @@ int main(int argc, char **argv)case 'b' : byte_array_input =1 ;break ; +case 'g' : + gen =strtol (optarg,NULL ,10 ); + +if (gen <4 || gen >7 ) { +usage (); +exit (1 ); + } + +break ;default :usage ();exit (1 );
@@ -153,6 +167,6 @@ int main(int argc, char **argv) }for (inst = program->first; inst; inst = inst->next) -disasm (output, &inst->instruction); +brw_disasm (output, &inst->instruction, gen);exit (0 ); }
assembler/gen4asm.h +0 -3
@@ -197,6 +197,3 @@ int yylex_destroy(void);char *lex_text (void ); - -int -disasm (FILE *output,struct brw_instruction *inst);
Signature · 1 line
1.7.7.5
PATCH 23/90 assembler: Import ralloc from Mesa
In reply to Damien LespiauThis also add a new brw_compat.h that should help maintaining the diff between mesa's version and our as small as possible.
--- assembler/Makefile.am | 3 + assembler/brw_compat.h | 64 +++++++ assembler/ralloc.c | 482 ++++++++++++++++++++++++++++++++++++++++++++++++ assembler/ralloc.h | 407 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 956 insertions(+), 0 deletions(-) create mode 100644 assembler/brw_compat.h create mode 100644 assembler/ralloc.c create mode 100644 assembler/ralloc.h
assembler/Makefile.am +3 -0
@@ -10,6 +10,9 @@ BUILT_SOURCES = gram.h gram.c lex.c gram.h: gram.c intel_gen4asm_SOURCES = \ + brw_compat.h \ + ralloc.c \ + ralloc.h \ brw_defines.h \ brw_eu.h \ brw_reg.h \
assembler/brw_compat.h new file +64 -0
64 lines not on this page · raw message
assembler/ralloc.c new file +482 -0
482 lines not on this page · raw message
assembler/ralloc.h new file +407 -0
407 lines not on this page · raw message
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 24/90 assembler: Remove white space from brw_eu.h
In reply to Damien Lespiau--- assembler/brw_eu.h | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
assembler/brw_eu.h +8 -8
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,13 +22,13 @@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 BRW_EU_H #define BRW_EU_H
@@ -308,7 +308,7 @@ void brw_shader_time_add(struct brw_compile *p,/* If/else/endif. Works by manipulating the execution flags on each * channel. */ -struct brw_instruction *brw_IF (struct brw_compile *p, +struct brw_instruction *brw_IF (struct brw_compile *p,GLuint execute_size);struct brw_instruction *gen6_IF (struct brw_compile *p,uint32_t conditional,struct brw_reg src0,struct brw_reg src1);
@@ -346,7 +346,7 @@ void brw_CMP(struct brw_compile *p,struct brw_reg src0, struct brw_reg src1); -/*********************************************************************** +/*********************************************************************** * brw_eu_util.c: */
@@ -370,7 +370,7 @@ void brw_copy8(struct brw_compile *p,struct brw_reg src, GLuint count); -void brw_math_invert (struct brw_compile *p, +void brw_math_invert (struct brw_compile *p,struct brw_reg dst,struct brw_reg src);
Signature · 1 line
1.7.7.5
PATCH 25/90 assembler: Introduce struct brw_context
In reply to Damien LespiauA lot of the mesa code use struct brw_context to get the GPU generation and various information. Let's stub this structure and initialize it ourselves to be able to resuse mesa's code untouched.
--- assembler/Makefile.am | 2 + assembler/brw_context.c | 44 ++++++++++++++++++++++++++++++++++ assembler/brw_context.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++ assembler/brw_eu.h | 1 + 4 files changed, 107 insertions(+), 0 deletions(-) create mode 100644 assembler/brw_context.c create mode 100644 assembler/brw_context.h
assembler/Makefile.am +2 -0
@@ -11,6 +11,8 @@ gram.h: gram.c intel_gen4asm_SOURCES = \ brw_compat.h \ + brw_context.c \ + brw_context.h \ ralloc.c \ ralloc.h \ brw_defines.h \
assembler/brw_context.c new file +44 -0
44 lines not on this page · raw message
assembler/brw_context.h new file +60 -0
60 lines not on this page · raw message
assembler/brw_eu.h +1 -0
@@ -34,6 +34,7 @@#define BRW_EU_H #include <stdbool.h> +#include "brw_context.h" #include "brw_structs.h" #include "brw_defines.h" #include "brw_reg.h"
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 26/90 assembler: Make an libbrw library
In reply to Damien LespiauWith the brw_* files imported from mesa.
There are still a few things in that library that needs gen4asm.h, for instance the GLuint and GLint types. The hope is that eventually libbrw can be split out in its own directory and shared.
--- assembler/Makefile.am | 30 +++++++++++++++++++----------- 1 files changed, 19 insertions(+), 11 deletions(-)
assembler/Makefile.am +19 -11
@@ -1,7 +1,22 @@ SUBDIRS = doc test +noinst_LTLIBRARIES = libbrw.la + bin_PROGRAMS = intel-gen4asm intel-gen4disasm +libbrw_la_SOURCES = \ + brw_compat.h \ + brw_context.c \ + brw_context.h \ + brw_disasm.c \ + brw_defines.h \ + brw_eu.h \ + brw_reg.h \ + brw_structs.h \ + ralloc.c \ + ralloc.h \ + $(NULL) + AM_YFLAGS = -d --warnings=all AM_CFLAGS= $(ASSEMBLER_WARN_CFLAGS)
@@ -10,23 +25,16 @@ BUILT_SOURCES = gram.h gram.c lex.c gram.h: gram.c intel_gen4asm_SOURCES = \ - brw_compat.h \ - brw_context.c \ - brw_context.h \ - ralloc.c \ - ralloc.h \ - brw_defines.h \ - brw_eu.h \ - brw_reg.h \ - brw_structs.h \ gen4asm.h \ gram.y \ lex.l \ main.c \ $(NULL) -intel_gen4disasm_SOURCES = \ - brw_disasm.c disasm-main.c +intel_gen4asm_LDADD = libbrw.la + +intel_gen4disasm_SOURCES = disasm-main.c +intel_gen4disasm_LDADD = libbrw.la pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = intel-gen4asm.pc
Signature · 1 line
1.7.7.5
PATCH 27/90 assembler: Protect gen4asm.h from multiple inclusions
In reply to Damien Lespiau--- assembler/gen4asm.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
assembler/gen4asm.h +5 -0
@@ -26,6 +26,9 @@* */ +#ifndef __GEN4ASM_H__ +#define __GEN4ASM_H__ +#include <inttypes.h> typedef unsigned char GLubyte ;
@@ -197,3 +200,5 @@ int yylex_destroy(void);char *lex_text (void ); + +#endif /* __GEN4ASM_H__ */
Signature · 1 line
1.7.7.5
PATCH 28/90 assembler: Import brw_eu_compact.c
In reply to Damien LespiauTo be able to import brw_eu.c and brw_eu_emit.c later on. This could be used to get the assembler generate compact instructions at some point.
--- assembler/Makefile.am | 23 +- assembler/brw_compat.h | 2 + assembler/brw_context.h | 4 + assembler/brw_eu.h | 16 + assembler/brw_eu_compact.c | 810 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 844 insertions(+), 11 deletions(-) create mode 100644 assembler/brw_eu_compact.c
assembler/Makefile.am +12 -11
@@ -4,17 +4,18 @@ noinst_LTLIBRARIES = libbrw.la bin_PROGRAMS = intel-gen4asm intel-gen4disasm -libbrw_la_SOURCES = \ - brw_compat.h \ - brw_context.c \ - brw_context.h \ - brw_disasm.c \ - brw_defines.h \ - brw_eu.h \ - brw_reg.h \ - brw_structs.h \ - ralloc.c \ - ralloc.h \ +libbrw_la_SOURCES = \ + brw_compat.h \ + brw_context.c \ + brw_context.h \ + brw_disasm.c \ + brw_defines.h \ + brw_eu.h \ + brw_eu_compact.c \ + brw_reg.h \ + brw_structs.h \ + ralloc.c \ + ralloc.h \ $(NULL) AM_YFLAGS = -d --warnings=all
assembler/brw_compat.h +2 -0
@@ -57,6 +57,8 @@ extern "C" {#define PRINTFLIKE (f, a)#endif +#define ARRAY_SIZE (x) (sizeof(x) / sizeof(x[0])) + #ifdef __cplusplus }/* end of extern "C" */ #endif
assembler/brw_context.h +4 -0
@@ -36,6 +36,10 @@extern "C" {#endif +#ifndef INTEL_DEBUG +#define INTEL_DEBUG (0) +#endif +struct intel_context {int gen;
assembler/brw_eu.h +16 -0
@@ -34,6 +34,8 @@#define BRW_EU_H #include <stdbool.h> +#include <stdio.h> +#include "gen4asm.h" #include "brw_context.h" #include "brw_structs.h" #include "brw_defines.h"
@@ -383,6 +385,20 @@ void brw_set_uip_jip(struct brw_compile *p);uint32_t brw_swap_cmod (uint32_t cmod); +/* brw_eu_compact.c */ +void brw_init_compaction_tables (struct intel_context *intel); +void brw_compact_instructions (struct brw_compile *p); +void brw_uncompact_instruction (struct intel_context *intel, +struct brw_instruction *dst, +struct brw_compact_instruction *src); +bool brw_try_compact_instruction (struct brw_compile *p, +struct brw_compact_instruction *dst, +struct brw_instruction *src); + +void brw_debug_compact_uncompact (struct intel_context *intel, +struct brw_instruction *orig, +struct brw_instruction *uncompacted); +/* brw_optimize.c */ void brw_optimize (struct brw_compile *p);void brw_remove_duplicate_mrf_moves (struct brw_compile *p);
assembler/brw_eu_compact.c new file +810 -0
810 lines not on this page · raw message
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 29/90 assembler: Import brw_eu.c
In reply to Damien LespiauAnother step the road of importing Mesa's emission code.
--- assembler/Makefile.am | 1 + assembler/brw_eu.c | 269 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 270 insertions(+), 0 deletions(-) create mode 100644 assembler/brw_eu.c
assembler/Makefile.am +1 -0
@@ -11,6 +11,7 @@ libbrw_la_SOURCES = \ brw_disasm.c \ brw_defines.h \ brw_eu.h \ + brw_eu.c \ brw_eu_compact.c \ brw_reg.h \ brw_structs.h \
assembler/brw_eu.c new file +269 -0
269 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 30/90 assembler: Don't use -Wpointer-arith
In reply to Damien LespiauMesa's code uses the GNU C extension that allows additions and soustractions on void* (+/- 1).
--- configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +1 -1
@@ -64,7 +64,7 @@ XORG_DEFAULT_OPTIONS # it generates waaaay to many warnings. ASSEMBLER_WARN_CFLAGS="" if test "x$GCC" = "xyes"; then - ASSEMBLER_WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ + ASSEMBLER_WARN_CFLAGS="-Wall -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wnested-externs -fno-strict-aliasing" fi
Signature · 1 line
1.7.7.5
PATCH 31/90 assembler: Import brw_eu_emit.c
In reply to Damien LespiauFinally importing the meaty brw_eu_emit.c code that emit instructions.
--- assembler/Makefile.am | 1 + assembler/brw_compat.h | 1 + assembler/brw_eu_emit.c | 2549 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2551 insertions(+), 0 deletions(-) create mode 100644 assembler/brw_eu_emit.c
assembler/Makefile.am +1 -0
@@ -13,6 +13,7 @@ libbrw_la_SOURCES = \ brw_eu.h \ brw_eu.c \ brw_eu_compact.c \ + brw_eu_emit.c \ brw_reg.h \ brw_structs.h \ ralloc.c \
assembler/brw_compat.h +1 -0
@@ -58,6 +58,7 @@ extern "C" {#endif #define ARRAY_SIZE (x) (sizeof(x) / sizeof(x[0])) +#define Elements (x) ARRAY_SIZE(x) #ifdef __cplusplus }/* end of extern "C" */
assembler/brw_eu_emit.c new file +2549 -0
2,549 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 32/90 assembler: Use BRW_WRITEMASK_XYZW instead of the 0xf constant
In reply to Damien Lespiau--- assembler/gram.y | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
assembler/gram.y +4 -3
@@ -32,6 +32,7 @@ #include <assert.h> #include "gen4asm.h" #include "brw_defines.h" +#include "brw_reg.h" #define DEFAULT_EXECSIZE (ffs(program_defaults.execute_size) - 1) #define DEFAULT_DSTREGION -1
@@ -58,7 +59,7 @@ static struct dst_operand ip_dst = .reg_type = BRW_REGISTER_TYPE_UD, .address_mode = BRW_ADDRESS_DIRECT, .horiz_stride = 1, - .writemask = 0xF, + .writemask = BRW_WRITEMASK_XYZW, }; static struct src_operand ip_src = {
@@ -2431,7 +2432,7 @@ chansel: X | Y | Z | W writemask: /* empty */ { $$.writemask_set = 0; - $$.writemask = 0xf; + $$.writemask = BRW_WRITEMASK_XYZW; } | DOT writemask_x writemask_y writemask_z writemask_w {
@@ -3134,7 +3135,7 @@ void set_direct_dst_operand(struct dst_operand *dst, struct direct_reg *reg, dst->reg_type = type; dst->horiz_stride = 1; dst->writemask_set = 0; - dst->writemask = 0xf; + dst->writemask = BRW_WRITEMASK_XYZW; } void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg,
Signature · 1 line
1.7.7.5
PATCH 33/90 assembler: Remove the writemask_set field of struct dest_operand
In reply to Damien Lespiauwritemask_set gets in the way of switching to using struct brw_reg and it's possible to derive it from the writemask value.
--- assembler/gen4asm.h | 1 - assembler/gram.y | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-)
assembler/gen4asm.h +0 -1
@@ -91,7 +91,6 @@ struct indirect_reg {struct dst_operand {int reg_file, reg_nr, subreg_nr, reg_type; -int writemask_set;int writemask;int horiz_stride;
assembler/gram.y +4 -6
@@ -1541,7 +1541,6 @@ dstoperand: symbol_reg dstregion $$.address_subreg_nr = $1.address_subreg_nr; $$.indirect_offset = $1.indirect_offset; $$.horiz_stride = $2; - $$.writemask_set = $3.writemask_set; $$.writemask = $3.writemask; $$.reg_type = $4.type; }
@@ -2431,12 +2430,10 @@ chansel: X | Y | Z | W */ writemask: /* empty */ { - $$.writemask_set = 0; $$.writemask = BRW_WRITEMASK_XYZW; } | DOT writemask_x writemask_y writemask_z writemask_w { - $$.writemask_set = 1; $$.writemask = $2 | $3 | $4 | $5; } ;
@@ -2843,7 +2840,8 @@ int set_instruction_dest(struct brw_instruction *instr, instr->bits1.da1.dest_reg_nr = dest->reg_nr; instr->bits1.da1.dest_horiz_stride = dest->horiz_stride; instr->bits1.da1.dest_address_mode = dest->address_mode; - if (dest->writemask_set) { + if (dest->writemask != 0 && + dest->writemask != BRW_WRITEMASK_XYZW) { fprintf(stderr, "error: write mask set in align1 " "instruction\n"); return 1;
@@ -2863,7 +2861,8 @@ int set_instruction_dest(struct brw_instruction *instr, instr->bits1.ia1.dest_horiz_stride = dest->horiz_stride; instr->bits1.ia1.dest_indirect_offset = dest->indirect_offset; instr->bits1.ia1.dest_address_mode = dest->address_mode; - if (dest->writemask_set) { + if (dest->writemask != 0 && + dest->writemask != BRW_WRITEMASK_XYZW) { fprintf(stderr, "error: write mask set in align1 " "instruction\n"); return 1;
@@ -3134,7 +3133,6 @@ void set_direct_dst_operand(struct dst_operand *dst, struct direct_reg *reg, dst->subreg_nr = reg->subreg_nr; dst->reg_type = type; dst->horiz_stride = 1; - dst->writemask_set = 0; dst->writemask = BRW_WRITEMASK_XYZW; }
Signature · 1 line
1.7.7.5
PATCH 34/90 assembler: Use subreg_nr to store the address register subreg
In reply to Damien LespiauAnother step towards using struct brw_reg for source and destination operands.
Instead of having a separate field to store the sub register number of the address register in indirect access mode, we can reuse the subreg_nr field that was only used for direct access so far.
--- assembler/gen4asm.h | 2 -- assembler/gram.y | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-)
assembler/gen4asm.h +0 -2
@@ -97,7 +97,6 @@ struct dst_operand {int address_mode;/* 0 if direct, 1 if register-indirect */ /* Indirect addressing */ -int address_subreg_nr;int indirect_offset; };
@@ -114,7 +113,6 @@ struct src_operand {int default_region;int address_mode;/* 0 if direct, 1 if register-indirect */ -int address_subreg_nr;int indirect_offset;/* XXX */ int swizzle_set;
assembler/gram.y +11 -11
@@ -1538,7 +1538,7 @@ dstoperand: symbol_reg dstregion $$.reg_nr = $1.reg_nr; $$.subreg_nr = $1.subreg_nr; $$.address_mode = $1.address_mode; - $$.address_subreg_nr = $1.address_subreg_nr; + $$.subreg_nr = $1.subreg_nr; $$.indirect_offset = $1.indirect_offset; $$.horiz_stride = $2; $$.writemask = $3.writemask;
@@ -1676,7 +1676,7 @@ dstreg: directgenreg memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; $$.reg_file = $1.reg_file; - $$.address_subreg_nr = $1.address_subreg_nr; + $$.subreg_nr = $1.address_subreg_nr; $$.indirect_offset = $1.indirect_offset; } | indirectmsgreg
@@ -1684,7 +1684,7 @@ dstreg: directgenreg memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; $$.reg_file = $1.reg_file; - $$.address_subreg_nr = $1.address_subreg_nr; + $$.subreg_nr = $1.address_subreg_nr; $$.indirect_offset = $1.indirect_offset; } ;
@@ -1908,7 +1908,7 @@ indirectsrcoperand: memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; $$.reg_file = $3.reg_file; - $$.address_subreg_nr = $3.address_subreg_nr; + $$.subreg_nr = $3.address_subreg_nr; $$.indirect_offset = $3.indirect_offset; $$.reg_type = $5.type; $$.vert_stride = $4.vert_stride;
@@ -2286,7 +2286,7 @@ relativelocation2: memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; $$.reg_file = $1.reg_file; - $$.address_subreg_nr = $1.address_subreg_nr; + $$.subreg_nr = $1.address_subreg_nr; $$.indirect_offset = $1.indirect_offset; $$.reg_type = $3.type; $$.vert_stride = $2.vert_stride;
@@ -2857,7 +2857,7 @@ int set_instruction_dest(struct brw_instruction *instr, } else if (instr->header.access_mode == BRW_ALIGN_1) { instr->bits1.ia1.dest_reg_file = dest->reg_file; instr->bits1.ia1.dest_reg_type = dest->reg_type; - instr->bits1.ia1.dest_subreg_nr = get_indirect_subreg_address(dest->address_subreg_nr); + instr->bits1.ia1.dest_subreg_nr = dest->subreg_nr; instr->bits1.ia1.dest_horiz_stride = dest->horiz_stride; instr->bits1.ia1.dest_indirect_offset = dest->indirect_offset; instr->bits1.ia1.dest_address_mode = dest->address_mode;
@@ -2870,7 +2870,7 @@ int set_instruction_dest(struct brw_instruction *instr, } else { instr->bits1.ia16.dest_reg_file = dest->reg_file; instr->bits1.ia16.dest_reg_type = dest->reg_type; - instr->bits1.ia16.dest_subreg_nr = get_indirect_subreg_address(dest->address_subreg_nr); + instr->bits1.ia16.dest_subreg_nr = get_indirect_subreg_address(dest->subreg_nr); instr->bits1.ia16.dest_writemask = dest->writemask; instr->bits1.ia16.dest_horiz_stride = ffs(1); instr->bits1.ia16.dest_indirect_offset = (dest->indirect_offset >> 4); /* half register aligned */
@@ -2921,7 +2921,7 @@ int set_instruction_src0(struct brw_instruction *instr, } else { if (instr->header.access_mode == BRW_ALIGN_1) { instr->bits2.ia1.src0_indirect_offset = src->indirect_offset; - instr->bits2.ia1.src0_subreg_nr = get_indirect_subreg_address(src->address_subreg_nr); + instr->bits2.ia1.src0_subreg_nr = get_indirect_subreg_address(src->subreg_nr); instr->bits2.ia1.src0_abs = src->abs; instr->bits2.ia1.src0_negate = src->negate; instr->bits2.ia1.src0_address_mode = src->address_mode;
@@ -2937,7 +2937,7 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits2.ia16.src0_swz_x = src->swizzle_x; instr->bits2.ia16.src0_swz_y = src->swizzle_y; instr->bits2.ia16.src0_indirect_offset = (src->indirect_offset >> 4); /* half register aligned */ - instr->bits2.ia16.src0_subreg_nr = get_indirect_subreg_address(src->address_subreg_nr); + instr->bits2.ia16.src0_subreg_nr = get_indirect_subreg_address(src->subreg_nr); instr->bits2.ia16.src0_abs = src->abs; instr->bits2.ia16.src0_negate = src->negate; instr->bits2.ia16.src0_address_mode = src->address_mode;
@@ -3004,7 +3004,7 @@ int set_instruction_src1(struct brw_instruction *instr, } else { if (instr->header.access_mode == BRW_ALIGN_1) { instr->bits3.ia1.src1_indirect_offset = src->indirect_offset; - instr->bits3.ia1.src1_subreg_nr = get_indirect_subreg_address(src->address_subreg_nr); + instr->bits3.ia1.src1_subreg_nr = get_indirect_subreg_address(src->subreg_nr); instr->bits3.ia1.src1_abs = src->abs; instr->bits3.ia1.src1_negate = src->negate; instr->bits3.ia1.src1_address_mode = src->address_mode;
@@ -3020,7 +3020,7 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits3.ia16.src1_swz_x = src->swizzle_x; instr->bits3.ia16.src1_swz_y = src->swizzle_y; instr->bits3.ia16.src1_indirect_offset = (src->indirect_offset >> 4); /* half register aligned */ - instr->bits3.ia16.src1_subreg_nr = get_indirect_subreg_address(src->address_subreg_nr); + instr->bits3.ia16.src1_subreg_nr = get_indirect_subreg_address(src->subreg_nr); instr->bits3.ia16.src1_abs = src->abs; instr->bits3.ia16.src1_negate = src->negate; instr->bits3.ia16.src1_address_mode = src->address_mode;
Signature · 1 line
1.7.7.5
PATCH 35/90 assembler: Simplify get_subreg_address()
In reply to Damien LespiauThis function can only be called to resolve subreg_nr in direct mode (there is an other function for the indirect case) and it makes no sense to call it with an immediate operand.
Express those facts with asserts and simplify the logic.
--- assembler/gram.y | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-)
assembler/gram.y +5 -12
@@ -2716,18 +2716,11 @@ static int get_subreg_address(GLuint regfile, GLuint type, GLuint subreg, GLuint { int unit_size = 1; - if (address_mode == BRW_ADDRESS_DIRECT) { - if (advanced_flag == 1) { - if ((regfile == BRW_GENERAL_REGISTER_FILE || - regfile == BRW_MESSAGE_REGISTER_FILE || - regfile == BRW_ARCHITECTURE_REGISTER_FILE)) { - - unit_size = get_type_size(type); - } - } - } else { - unit_size = 1; - } + assert(address_mode == BRW_ADDRESS_DIRECT); + assert(regfile != BRW_IMMEDIATE_VALUE); + + if (advanced_flag) + unit_size = get_type_size(type); return subreg * unit_size; }
Signature · 1 line
1.7.7.5
PATCH 36/90 assembler: Make print_instruction() take an instruction
In reply to Damien LespiauNo need to use a brw_program_instruction there as a brw_instruction is what you really dump anyway, espcially when the plan is to use brw_compile from Mesa sooner rather than later.
--- assembler/main.c | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-)
assembler/main.c +22 -22
@@ -239,35 +239,35 @@ static void free_entry_point_table(struct entry_point_item *p) { }static void -print_instruction (FILE *output,struct brw_program_instruction *entry) +print_instruction (FILE *output,struct brw_instruction *instruction) {if (binary_like_output) {fprintf (output,"\t0x%02x, 0x%02x, 0x%02x, 0x%02x, " "0x%02x, 0x%02x, 0x%02x, 0x%02x,\n" "\t0x%02x, 0x%02x, 0x%02x, 0x%02x, " "0x%02x, 0x%02x, 0x%02x, 0x%02x,\n" , - ((unsigned char *)(&entry->instruction))[0 ], - ((unsigned char *)(&entry->instruction))[1 ], - ((unsigned char *)(&entry->instruction))[2 ], - ((unsigned char *)(&entry->instruction))[3 ], - ((unsigned char *)(&entry->instruction))[4 ], - ((unsigned char *)(&entry->instruction))[5 ], - ((unsigned char *)(&entry->instruction))[6 ], - ((unsigned char *)(&entry->instruction))[7 ], - ((unsigned char *)(&entry->instruction))[8 ], - ((unsigned char *)(&entry->instruction))[9 ], - ((unsigned char *)(&entry->instruction))[10 ], - ((unsigned char *)(&entry->instruction))[11 ], - ((unsigned char *)(&entry->instruction))[12 ], - ((unsigned char *)(&entry->instruction))[13 ], - ((unsigned char *)(&entry->instruction))[14 ], - ((unsigned char *)(&entry->instruction))[15 ]); + ((unsigned char *)instruction)[0 ], + ((unsigned char *)instruction)[1 ], + ((unsigned char *)instruction)[2 ], + ((unsigned char *)instruction)[3 ], + ((unsigned char *)instruction)[4 ], + ((unsigned char *)instruction)[5 ], + ((unsigned char *)instruction)[6 ], + ((unsigned char *)instruction)[7 ], + ((unsigned char *)instruction)[8 ], + ((unsigned char *)instruction)[9 ], + ((unsigned char *)instruction)[10 ], + ((unsigned char *)instruction)[11 ], + ((unsigned char *)instruction)[12 ], + ((unsigned char *)instruction)[13 ], + ((unsigned char *)instruction)[14 ], + ((unsigned char *)instruction)[15 ]); }else {fprintf (output," { 0x%08x, 0x%08x, 0x%08x, 0x%08x },\n" , - ((int *)(&entry->instruction))[0 ], - ((int *)(&entry->instruction))[1 ], - ((int *)(&entry->instruction))[2 ], - ((int *)(&entry->instruction))[3 ]); + ((int *)instruction)[0 ], + ((int *)instruction)[1 ], + ((int *)instruction)[2 ], + ((int *)instruction)[3 ]); } }int main (int argc,char **argv)
@@ -470,7 +470,7 @@ int main(int argc, char **argv) entry = entry1) { entry1 = entry->next;if (!entry->islabel) -print_instruction (output, entry); +print_instruction (output, &entry->instruction);else free (entry->string);free (entry);
Signature · 1 line
1.7.7.5
PATCH 37/90 assembler: Refactor the code adding instructions and labels
In reply to Damien LespiauFactoring out the code from the grammar will allow us to switch to using brw_compile in a cleaner way.
--- assembler/gram.y | 84 ++++++++++++++++++++++++++++------------------------- 1 files changed, 44 insertions(+), 40 deletions(-)
assembler/gram.y +44 -40
@@ -97,6 +97,42 @@ void set_direct_dst_operand(struct dst_operand *dst, struct direct_reg *reg, void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg, int type); +static void brw_program_init(struct brw_program *p) +{ + memset(p, 0, sizeof(struct brw_program)); +} + +static void brw_program_append_entry(struct brw_program *p, + struct brw_program_instruction *entry) +{ + entry->next = NULL; + if (p->last) + p->last->next = entry; + else + p->first = entry; + p->last = entry; +} + +static void brw_program_add_instruction(struct brw_program *p, + struct brw_instruction *instruction) +{ + struct brw_program_instruction *list_entry; + + list_entry = calloc(sizeof(struct brw_program_instruction), 1); + list_entry->instruction = *instruction; + brw_program_append_entry(p, list_entry); +} + +static void brw_program_add_label(struct brw_program *p, const char *label) +{ + struct brw_program_instruction *list_entry; + + list_entry = calloc(sizeof(struct brw_program_instruction), 1); + list_entry->string = strdup(label); + list_entry->islabel = 1; + brw_program_append_entry(p, list_entry); +} + %} %start ROOT
@@ -345,59 +381,27 @@ instrseq: instrseq pragma } | instrseq instruction SEMICOLON { - struct brw_program_instruction *list_entry = - calloc(sizeof(struct brw_program_instruction), 1); - list_entry->instruction = $2; - list_entry->next = NULL; - if ($1.last) { - $1.last->next = list_entry; - } else { - $1.first = list_entry; - } - $1.last = list_entry; + brw_program_add_instruction(&$1, &$2); $$ = $1; } | instruction SEMICOLON { - struct brw_program_instruction *list_entry = - calloc(sizeof(struct brw_program_instruction), 1); - list_entry->instruction = $1; - - list_entry->next = NULL; - - $$.first = list_entry; - $$.last = list_entry; + brw_program_init(&$$); + brw_program_add_instruction(&$$, &$1); } - | instrseq SEMICOLON + | instrseq SEMICOLON { $$ = $1; } - | instrseq label + | instrseq label { - struct brw_program_instruction *list_entry = - calloc(sizeof(struct brw_program_instruction), 1); - list_entry->string = strdup($2); - list_entry->islabel = 1; - list_entry->next = NULL; - if ($1.last) { - $1.last->next = list_entry; - } else { - $1.first = list_entry; - } - $1.last = list_entry; + brw_program_add_label(&$1, $2); $$ = $1; } | label { - struct brw_program_instruction *list_entry = - calloc(sizeof(struct brw_program_instruction), 1); - list_entry->string = strdup($1); - list_entry->islabel = 1; - - list_entry->next = NULL; - - $$.first = list_entry; - $$.last = list_entry; + brw_program_init(&$$); + brw_program_add_label(&$$, $1); } | pragma {
Signature · 1 line
1.7.7.5
PATCH 38/90 assembler: Make explicit that labels are part of the instructions list
In reply to Damien LespiauThe output of the parsing is a list of struct brw_program_instruction. These instructions can be either GEN instructions aka struct brw_instruction or labels. To make this more explicit we now have a type to test to determine which instruction we are dealing with.
This will also allow to to pull the relocation bits into struct brw_program_instruction instead of having them in the structure representing the opcodes.
--- assembler/disasm-main.c | 2 +- assembler/gen4asm.h | 36 +++++++++++++++++++++---- assembler/gram.y | 7 +++-- assembler/main.c | 66 +++++++++++++++++++++++++++-------------------- 4 files changed, 73 insertions(+), 38 deletions(-)
assembler/disasm-main.c +1 -1
@@ -167,6 +167,6 @@ int main(int argc, char **argv) }for (inst = program->first; inst; inst = inst->next) -brw_disasm (output, &inst->instruction, gen); +brw_disasm (output, &inst->instruction.gen, gen);exit (0 ); }
assembler/gen4asm.h +30 -6
@@ -30,6 +30,8 @@#define __GEN4ASM_H__#include <inttypes.h> +#include <stdbool.h> +#include <assert.h> typedef unsigned char GLubyte ;typedef short GLshort ;
@@ -133,18 +135,40 @@ typedef struct { } u; } imm32_t; +enum assembler_instruction_type { +GEN4ASM_INSTRUCTION_GEN , +GEN4ASM_INSTRUCTION_LABEL , +}; + +struct label_instruction { +char *name; +}; +/** * This structure is just the list container for instructions accumulated by * the parser and labels. */ struct brw_program_instruction { -struct brw_instruction instruction; -struct brw_program_instruction *next; -GLuint islabel; -GLuint inst_offset; -char *string; +enum assembler_instruction_type type; +unsigned inst_offset; +union { +struct brw_instruction gen; +struct label_instruction label; + } instruction; +struct brw_program_instruction *next; }; +static inline bool is_label (struct brw_program_instruction *instruction) +{ +return instruction->type ==GEN4ASM_INSTRUCTION_LABEL ; +} + +static inline char *label_name (struct brw_program_instruction *i) +{ +assert (is_label (i)); +return i->instruction.label.name; +} +/** * This structure is a list of instructions. It is the final output of the * parser.
@@ -188,7 +212,7 @@ struct declared_register { };struct declared_register *find_register (char *name);void insert_register (struct declared_register *reg); -void add_label (char *name,int addr); +void add_label (struct brw_program_instruction *instruction);int label_to_addr (char *name,int start_addr);int yyparse (void );
assembler/gram.y +4 -3
@@ -119,7 +119,8 @@ static void brw_program_add_instruction(struct brw_program *p, struct brw_program_instruction *list_entry; list_entry = calloc(sizeof(struct brw_program_instruction), 1); - list_entry->instruction = *instruction; + list_entry->type = GEN4ASM_INSTRUCTION_GEN; + list_entry->instruction.gen = *instruction; brw_program_append_entry(p, list_entry); }
@@ -128,8 +129,8 @@ static void brw_program_add_label(struct brw_program *p, const char *label) struct brw_program_instruction *list_entry; list_entry = calloc(sizeof(struct brw_program_instruction), 1); - list_entry->string = strdup(label); - list_entry->islabel = 1; + list_entry->type = GEN4ASM_INSTRUCTION_LABEL; + list_entry->instruction.label.name = strdup(label); brw_program_append_entry(p, list_entry); }
assembler/main.c +38 -28
157 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 39/90 assembler: Don't change the size of opcodes!
In reply to Damien LespiauUntil now, the assembler had relocation-related fields added to struct brw_instruction. This changes the size of the structure and break code assuming the opcode structure is really 16 bytes, for instance the emission code in brw_eu_emit.c.
With this commit, we build on the infrastructure that slowly emerged in the few previous commits to add a relocatable instruction with the needed fields.
--- assembler/brw_structs.h | 3 - assembler/gen4asm.h | 13 +++ assembler/gram.y | 193 ++++++++++++++++++++++++++-------------------- assembler/main.c | 23 +++--- 4 files changed, 134 insertions(+), 98 deletions(-)
assembler/brw_structs.h +0 -3
@@ -1463,9 +1463,6 @@ struct brw_instructionGLuint ud;float f; } bits3; - -char *first_reloc_target, *second_reloc_target;// first for JIP, second for UIP -GLint first_reloc_offset, second_reloc_offset;// in number of instructions };struct brw_compact_instruction {
assembler/gen4asm.h +13 -0
@@ -137,6 +137,7 @@ typedef struct {enum assembler_instruction_type {GEN4ASM_INSTRUCTION_GEN , +GEN4ASM_INSTRUCTION_GEN_RELOCATABLE ,GEN4ASM_INSTRUCTION_LABEL , };
@@ -144,6 +145,12 @@ struct label_instruction {char *name; }; +struct relocatable_instruction { +struct brw_instruction gen; +char *first_reloc_target, *second_reloc_target;// JIP and UIP respectively +GLint first_reloc_offset, second_reloc_offset;// in number of instructions +}; +/** * This structure is just the list container for instructions accumulated by * the parser and labels.
@@ -153,6 +160,7 @@ struct brw_program_instruction {unsigned inst_offset;union {struct brw_instruction gen; +struct relocatable_instruction reloc;struct label_instruction label; } instruction;struct brw_program_instruction *next;
@@ -169,6 +177,11 @@ static inline char *label_name(struct brw_program_instruction *i)return i->instruction.label.name; } +static inline bool is_relocatable (struct brw_program_instruction *intruction) +{ +return intruction->type ==GEN4ASM_INSTRUCTION_GEN_RELOCATABLE ; +} +/** * This structure is a list of instructions. It is the final output of the * parser.
assembler/gram.y +109 -84
347 lines not on this page · raw message
assembler/main.c +12 -11
@@ -421,24 +421,25 @@ int main(int argc, char **argv) }for (entry = compiled_program.first; entry; entry = entry->next) { -struct brw_instruction *inst = & entry->instruction.gen; +struct relocatable_instruction *reloc = &entry->instruction.reloc; +struct brw_instruction *inst = &reloc->gen; -if (is_label (entry)) +if (!is_relocatable (entry))continue ; -if (inst->first_reloc_target) - inst->first_reloc_offset =label_to_addr (inst->first_reloc_target, entry->inst_offset) - entry->inst_offset; +if (reloc->first_reloc_target) + reloc->first_reloc_offset =label_to_addr (reloc->first_reloc_target, entry->inst_offset) - entry->inst_offset; -if (inst->second_reloc_target) - inst->second_reloc_offset =label_to_addr (inst->second_reloc_target, entry->inst_offset) - entry->inst_offset; +if (reloc->second_reloc_target) + reloc->second_reloc_offset =label_to_addr (reloc->second_reloc_target, entry->inst_offset) - entry->inst_offset; -if (inst->second_reloc_offset) { +if (reloc->second_reloc_offset) {// this is a branch instruction with two offset arguments - inst->bits3.break_cont.jip =jump_distance (inst->first_reloc_offset); - inst->bits3.break_cont.uip =jump_distance (inst->second_reloc_offset); - }else if (inst->first_reloc_offset) { + inst->bits3.break_cont.jip =jump_distance (reloc->first_reloc_offset); + inst->bits3.break_cont.uip =jump_distance (reloc->second_reloc_offset); + }else if (reloc->first_reloc_offset) {// this is a branch instruction with one offset argument -int offset = inst->first_reloc_offset; +int offset = reloc->first_reloc_offset;/* bspec: Unlike other flow control instructions, the offset used by JMPI is relative to the incremented instruction pointer rather than the IP value for the instruction itself. */ int is_jmpi = inst->header.opcode ==BRW_OPCODE_JMPI ;// target relative to the post-incremented IP, so delta == 1 if JMPI
Signature · 1 line
1.7.7.5
PATCH 40/90 assembler: Make sure nobody adds a field back to struct brw_instruction
In reply to Damien LespiauAdding something there will break the library, so we might as check for it.
--- assembler/gen4asm.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
assembler/gen4asm.h +9 -0
@@ -55,6 +55,15 @@ extern long int gen_level;void yyerror (char *msg); +#define STRUCT_SIZE_ASSERT (TYPE ,SIZE ) \ +typedef struct { \ + char compile_time_assert_ ## TYPE ## _size[ \ + (sizeof (struct TYPE) == (SIZE)) ? 1 : -1]; \ + } _ ## TYPE ## SizeCheck + +/* ensure nobody changes the size of struct brw_instruction */ +STRUCT_SIZE_ASSERT (brw_instruction,16 ); +/** * This structure is the internal representation of directly-addressed * registers in the parser.
Signature · 1 line
1.7.7.5
PATCH 41/90 assembler: Don't expose functions only used in main.c
In reply to Damien Lespiauand make then static.
--- assembler/gen4asm.h | 2 -- assembler/main.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
assembler/gen4asm.h +0 -2
@@ -234,8 +234,6 @@ struct declared_register { };struct declared_register *find_register (char *name);void insert_register (struct declared_register *reg); -void add_label (struct brw_program_instruction *instruction); -int label_to_addr (char *name,int start_addr);int yyparse (void );int yylex (void );
assembler/main.c +2 -2
@@ -155,7 +155,7 @@ void insert_register(struct declared_register *reg)insert_hash_item (declared_register_table, reg->name, reg); } -void add_label (struct brw_program_instruction *i) +static void add_label (struct brw_program_instruction *i) {struct label_item **p = &label_table;
@@ -170,7 +170,7 @@ void add_label(struct brw_program_instruction *i)/* Some assembly code have duplicated labels. Start from start_addr. Search as a loop. Return the first label found. */ -int label_to_addr (char *name,int start_addr) +static int label_to_addr (char *name,int start_addr) {/* return the first label just after start_addr, or the first label from the head */ struct label_item *p;
Signature · 1 line
1.7.7.5
PATCH 42/90 assembler: Make struct declared_register use struct brw_reg
In reply to Damien LespiauIt's time to start converting the emission code in gram.y to use libbrw infrastructure. Let's start with using brw_reg for declared register.
--- assembler/gen4asm.h | 4 +++- assembler/gram.y | 46 +++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 24 deletions(-)
assembler/gen4asm.h +3 -1
@@ -33,6 +33,8 @@#include <stdbool.h> #include <assert.h> +#include "brw_reg.h" +typedef unsigned char GLubyte ;typedef short GLshort ;typedef unsigned int GLuint ;
@@ -226,7 +228,7 @@ extern struct program_defaults program_defaults;struct declared_register {char *name; -struct direct_reg base; +struct brw_reg reg;int element_size;struct region src_region;int dst_region;
assembler/gram.y +23 -23
90 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 43/90 assembler: Replace struct direct_reg by struct brw_reg
In reply to Damien LespiauMore code simplification can be layered on top of that (by using some brw_* helpers to create registers), that'd be for another commit.
--- assembler/gen4asm.h | 8 -- assembler/gram.y | 202 +++++++++++++++++++++++++------------------------- 2 files changed, 101 insertions(+), 109 deletions(-)
assembler/gen4asm.h +0 -8
@@ -66,14 +66,6 @@ typedef struct { \/* ensure nobody changes the size of struct brw_instruction */ STRUCT_SIZE_ASSERT (brw_instruction,16 ); -/** -* This structure is the internal representation of directly-addressed -* registers in the parser. -*/ -struct direct_reg { -int reg_file, reg_nr, subreg_nr; -}; -struct condition {int cond;int flag_reg_nr;
assembler/gram.y +101 -101
449 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 44/90 assembler: Replace struct indirect_reg by struct brw_reg
In reply to Damien LespiauMore code simplification can be layered on top of that (by using some brw_* helpers to create registers), that'd be for another commit.
--- assembler/gen4asm.h | 8 -------- assembler/gram.y | 46 +++++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 31 deletions(-)
assembler/gen4asm.h +0 -8
@@ -80,14 +80,6 @@ struct regtype {int type;int is_default; }; -/** -* This structure is the internal representation of register-indirect addressed -* registers in the parser. -*/ - -struct indirect_reg { -int reg_file, address_subreg_nr, indirect_offset; -};/** * This structure is the internal representation of destination operands in the
assembler/gram.y +23 -23
97 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 45/90 assembler: Unify the direct and indirect register type
In reply to Damien LespiauThey are all struct brw_reg registers now.
--- assembler/gram.y | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-)
assembler/gram.y +9 -10
@@ -158,8 +158,7 @@ static void brw_program_add_label(struct brw_program *p, const char *label) struct brw_program program; struct region region; struct regtype regtype; - struct brw_reg direct_reg; - struct brw_reg indirect_reg; + struct brw_reg reg; struct condition condition; struct declared_register symbol_reg; imm32_t imm32;
@@ -262,13 +261,13 @@ static void brw_program_add_label(struct brw_program *p, const char *label) %type <integer> predctrl predstate %type <region> region region_wh indirectregion declare_srcregion; %type <regtype> regtype -%type <direct_reg> directgenreg directmsgreg addrreg accreg flagreg maskreg -%type <direct_reg> maskstackreg notifyreg -/* %type <direct_reg> maskstackdepthreg */ -%type <direct_reg> statereg controlreg ipreg nullreg -%type <direct_reg> dstoperandex_typed srcarchoperandex_typed -%type <direct_reg> sendleadreg -%type <indirect_reg> indirectgenreg indirectmsgreg addrparam +%type <reg> directgenreg directmsgreg addrreg accreg flagreg maskreg +%type <reg> maskstackreg notifyreg +/* %type <reg> maskstackdepthreg */ +%type <reg> statereg controlreg ipreg nullreg +%type <reg> dstoperandex_typed srcarchoperandex_typed +%type <reg> sendleadreg +%type <reg> indirectgenreg indirectmsgreg addrparam %type <integer> mask_subreg maskstack_subreg %type <integer> declare_elementsize declare_dstregion declare_type /* %type <intger> maskstackdepth_subreg */
@@ -1955,7 +1954,7 @@ indirectsrcoperand: ; /* 1.4.4: Address Registers */ -/* Returns a partially-completed indirect_reg consisting of the address +/* Returns a partially-completed struct brw_reg consisting of the address * register fields for register-indirect access. */ addrparam: addrreg COMMA immaddroffset
Signature · 1 line
1.7.7.5
PATCH 46/90 assembler: Replace struct dst_operand by struct brw_reg
In reply to Damien LespiauOne more step on the road to replacing all register-like structures by struct brw_reg.
Two things in this commit are worth noting:
* As we are using more and more brw_reg, a lot of the field-by-field assignments can be replaced by 1 assignment which results is a reduction of code
* As the destination horizontal stride is now stored on 2 bits in brw_reg, it's not possible to defer the handling of DEFAULT_DSTREGION (aka (int)-1) when setting the destination operand. It has to be done when parsing the region and resolve_dst_region() is a helper for that task.
--- assembler/gen4asm.h | 16 ---- assembler/gram.y | 227 ++++++++++++++++++++++----------------------------- 2 files changed, 97 insertions(+), 146 deletions(-)
assembler/gen4asm.h +0 -16
@@ -82,22 +82,6 @@ struct regtype { };/** -* This structure is the internal representation of destination operands in the -* parser. -*/ -struct dst_operand { -int reg_file, reg_nr, subreg_nr, reg_type; - -int writemask; - -int horiz_stride; -int address_mode;/* 0 if direct, 1 if register-indirect */ - -/* Indirect addressing */ -int indirect_offset; -}; - -/** * This structure is the internal representation of source operands in the * parser. */
assembler/gram.y +97 -130
393 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 47/90 assembler: Consolidate the swizzling configuration on 8 bits
In reply to Damien Lespiau--- assembler/gen4asm.h | 2 +- assembler/gram.y | 67 +++++++++++++++++--------------------------------- 2 files changed, 24 insertions(+), 45 deletions(-)
assembler/gen4asm.h +1 -1
@@ -97,7 +97,7 @@ struct src_operand {int indirect_offset;/* XXX */ int swizzle_set; -int swizzle_x, swizzle_y, swizzle_z, swizzle_w; + unsigned swizzle: 8;uint32_t imm32;/* set if reg_file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */ char *reloc_target;/* bspec: branching instructions JIP and UIP are source operands */
assembler/gram.y +23 -44
137 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 48/90 assembler: Get rid of src operand's swizzle_set
In reply to Damien Lespiauswizzle_set can be derived from the value of swizzle itself, no need for that field.
--- assembler/gen4asm.h | 1 - assembler/gram.y | 14 ++++---------- 2 files changed, 4 insertions(+), 11 deletions(-)
assembler/gen4asm.h +0 -1
@@ -96,7 +96,6 @@ struct src_operand {int address_mode;/* 0 if direct, 1 if register-indirect */ int indirect_offset;/* XXX */ -int swizzle_set; unsigned swizzle: 8;uint32_t imm32;/* set if reg_file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */
assembler/gram.y +4 -10
@@ -1891,7 +1891,6 @@ directsrcoperand: negate abs symbol_reg region regtype $$.default_region = $4.is_default; $$.negate = $1; $$.abs = $2; - $$.swizzle_set = $6.swizzle_set; $$.swizzle = $6.swizzle; } | srcarchoperandex
@@ -1911,7 +1910,6 @@ indirectsrcoperand: $$.horiz_stride = $4.horiz_stride; $$.negate = $1; $$.abs = $2; - $$.swizzle_set = $6.swizzle_set; $$.swizzle = $6.swizzle; } ;
@@ -2389,17 +2387,14 @@ srcimmtype: /* empty */ */ swizzle: /* empty */ { - $$.swizzle_set = 0; $$.swizzle = BRW_SWIZZLE_NOOP; } | DOT chansel { - $$.swizzle_set = 1; $$.swizzle = BRW_SWIZZLE4($2, $2, $2, $2); } | DOT chansel chansel chansel chansel { - $$.swizzle_set = 1; $$.swizzle = BRW_SWIZZLE4($2, $3, $4, $5); } ;
@@ -2875,7 +2870,7 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits2.da1.src0_negate = src->negate; instr->bits2.da1.src0_abs = src->abs; instr->bits2.da1.src0_address_mode = src->address_mode; - if (src->swizzle_set) { + if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) { fprintf(stderr, "error: swizzle bits set in align1 " "instruction\n"); return 1;
@@ -2902,7 +2897,7 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits2.ia1.src0_horiz_stride = src->horiz_stride; instr->bits2.ia1.src0_width = src->width; instr->bits2.ia1.src0_vert_stride = src->vert_stride; - if (src->swizzle_set) { + if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) { fprintf(stderr, "error: swizzle bits set in align1 " "instruction\n"); return 1;
@@ -2953,7 +2948,7 @@ int set_instruction_src1(struct brw_instruction *instr, return 1; } */ - if (src->swizzle_set) { + if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) { fprintf(stderr, "error: swizzle bits set in align1 " "instruction\n"); return 1;
@@ -2985,7 +2980,7 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits3.ia1.src1_horiz_stride = src->horiz_stride; instr->bits3.ia1.src1_width = src->width; instr->bits3.ia1.src1_vert_stride = src->vert_stride; - if (src->swizzle_set) { + if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) { fprintf(stderr, "error: swizzle bits set in align1 " "instruction\n"); return 1;
@@ -3121,6 +3116,5 @@ void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, src->horiz_stride = 0; src->negate = 0; src->abs = 0; - src->swizzle_set = 0; src->swizzle = BRW_SWIZZLE_NOOP; }
Signature · 1 line
1.7.7.5
PATCH 49/90 assembler: Use brw_reg in the source operand
In reply to Damien LespiauLast refactoring step in transition to struct brw_reg.
--- assembler/gen4asm.h | 14 +-- assembler/gram.y | 532 ++++++++++++++++++++++++++------------------------- 2 files changed, 269 insertions(+), 277 deletions(-)
assembler/gen4asm.h +2 -12
@@ -86,19 +86,9 @@ struct regtype {* parser. */ struct src_operand { -int reg_file, reg_nr, subreg_nr, reg_type; - -int abs, negate; - -int horiz_stride, width, vert_stride; +struct brw_reg reg;int default_region; - -int address_mode;/* 0 if direct, 1 if register-indirect */ -int indirect_offset;/* XXX */ - -unsigned swizzle:8 ; - -uint32_t imm32;/* set if reg_file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */ +uint32_t imm32;/* set if reg.file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */ char *reloc_target;/* bspec: branching instructions JIP and UIP are source operands */ } src_operand;
assembler/gram.y +267 -265
831 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 50/90 assembler: Factor out the destination register validation
In reply to Damien LespiauThe goal is to use brw_set_dest(), so let's start by validating the register we have before generating the opcode.
--- assembler/gram.y | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-)
assembler/gram.y +19 -12
@@ -29,6 +29,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <stdbool.h> #include <assert.h> #include "gen4asm.h" #include "brw_defines.h"
@@ -159,6 +160,21 @@ static int resolve_dst_region(struct declared_register *reference, int region) return resolved; } +static bool validate_dst_reg(struct brw_instruction *insn, struct brw_reg *reg) +{ + + if (reg->address_mode == BRW_ADDRESS_DIRECT && + insn->header.access_mode == BRW_ALIGN_1 && + reg->dw1.bits.writemask != 0 && + reg->dw1.bits.writemask != BRW_WRITEMASK_XYZW) + { + fprintf(stderr, "error: write mask set in align1 instruction\n"); + return false; + } + + return true; +} + %} %start ROOT
@@ -2803,6 +2819,9 @@ static void reset_instruction_src_region(struct brw_instruction *instr, int set_instruction_dest(struct brw_instruction *instr, struct brw_reg *dest) { + if (!validate_dst_reg(instr, dest)) + return 1; + if (dest->address_mode == BRW_ADDRESS_DIRECT && instr->header.access_mode == BRW_ALIGN_1) { instr->bits1.da1.dest_reg_file = dest->file;
@@ -2811,12 +2830,6 @@ int set_instruction_dest(struct brw_instruction *instr, instr->bits1.da1.dest_reg_nr = dest->nr; instr->bits1.da1.dest_horiz_stride = dest->hstride; instr->bits1.da1.dest_address_mode = dest->address_mode; - if (dest->dw1.bits.writemask != 0 && - dest->dw1.bits.writemask != BRW_WRITEMASK_XYZW) { - fprintf(stderr, "error: write mask set in align1 " - "instruction\n"); - return 1; - } } else if (dest->address_mode == BRW_ADDRESS_DIRECT) { instr->bits1.da16.dest_reg_file = dest->file; instr->bits1.da16.dest_reg_type = dest->type;
@@ -2832,12 +2845,6 @@ int set_instruction_dest(struct brw_instruction *instr, instr->bits1.ia1.dest_horiz_stride = dest->hstride; instr->bits1.ia1.dest_indirect_offset = dest->dw1.bits.indirect_offset; instr->bits1.ia1.dest_address_mode = dest->address_mode; - if (dest->dw1.bits.writemask != 0 && - dest->dw1.bits.writemask != BRW_WRITEMASK_XYZW) { - fprintf(stderr, "error: write mask set in align1 " - "instruction\n"); - return 1; - } } else { instr->bits1.ia16.dest_reg_file = dest->file; instr->bits1.ia16.dest_reg_type = dest->type;
Signature · 1 line
1.7.7.5
PATCH 51/90 assembler: Use brw_set_dest() to encode the destination
In reply to Damien LespiauA few notes:
I needed to introduce a brw context and compile structs. These are only used to get which generation we are compiling code for, but eventually we can use more of the infrastructure.
brw_set_dest() uses the destination register width to program the instruction execution size.
The assembler can either take subnr in bytes or in number of elements, so we need a resolve step when setting a brw_reg.
--- assembler/gen4asm.h | 3 + assembler/gram.y | 171 +++++++++++++++++++++++---------------------------- assembler/main.c | 11 +++ 3 files changed, 91 insertions(+), 94 deletions(-)
assembler/gen4asm.h +3 -0
@@ -43,6 +43,9 @@ typedef float GLfloat;extern long int gen_level; +extern struct brw_context genasm_context; +extern struct brw_compile genasm_compile; +/* Predicate for Gen X and above */ #define IS_GENp (x) (gen_level >= (x)*10)
assembler/gram.y +77 -94
394 lines not on this page · raw message
assembler/main.c +11 -0
@@ -33,7 +33,9 @@#include <unistd.h> #include <assert.h> +#include "ralloc.h" #include "gen4asm.h" +#include "brw_eu.h" extern FILE *yyin;
@@ -48,6 +50,9 @@ char *export_filename = NULL;const char const *binary_prepend ="static const char gen_eu_bytes[] = {\n" ; +struct brw_context genasm_brw_context; +struct brw_compile genasm_compile; +struct brw_program compiled_program;struct program_defaults program_defaults = {.register_type =BRW_REGISTER_TYPE_F };
@@ -286,6 +291,8 @@ int main(int argc, char **argv)struct brw_program_instruction *entry, *entry1, *tmp_entry;int err, inst_offset;char o; +void *mem_ctx; +while ((o =getopt_long (argc, argv,"e:l:o:g:ab" , longopts,NULL )) !=-1 ) {switch (o) {case 'o' :
@@ -358,6 +365,10 @@ int main(int argc, char **argv) } } +brw_init_context (&genasm_brw_context, gen_level); + mem_ctx =ralloc_context (NULL ); +brw_init_compile (&genasm_brw_context, &genasm_compile, mem_ctx); + err =yyparse ();if (strcmp (argv[0 ],"-" ))
Signature · 1 line
1.7.7.5
PATCH 52/90 assembler: Factor out the source register validation
In reply to Damien LespiauThe goal is to use brw_set_src[01](), so let's start by validating the register we have before generating the opcode.
--- assembler/gram.y | 61 ++++++++++++++++++++++------------------------------- 1 files changed, 25 insertions(+), 36 deletions(-)
assembler/gram.y +25 -36
@@ -174,6 +174,21 @@ static bool validate_dst_reg(struct brw_instruction *insn, struct brw_reg *reg) return true; } +static bool validate_src_reg(struct brw_instruction *insn, struct brw_reg reg) +{ + if (reg.file == BRW_IMMEDIATE_VALUE) + return true; + + if (insn->header.access_mode == BRW_ALIGN_1 && + SWIZZLE(reg) && SWIZZLE(reg) != BRW_SWIZZLE_NOOP) + { + fprintf(stderr, "error: swizzle bits set in align1 instruction\n"); + return false; + } + + return true; +} + static int get_subreg_address(GLuint regfile, GLuint type, GLuint subreg, GLuint address_mode) { int unit_size = 1;
@@ -2845,9 +2860,12 @@ int set_instruction_dest(struct brw_instruction *instr, int set_instruction_src0(struct brw_instruction *instr, struct src_operand *src) { - if (advanced_flag) { + if (advanced_flag) reset_instruction_src_region(instr, src); - } + + if (!validate_src_reg(instr, src->reg)) + return 1; + instr->bits1.da1.src0_reg_file = src->reg.file; instr->bits1.da1.src0_reg_type = src->reg.type; if (src->reg.file == BRW_IMMEDIATE_VALUE) {
@@ -2862,11 +2880,6 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits2.da1.src0_negate = src->reg.negate; instr->bits2.da1.src0_abs = src->reg.abs; instr->bits2.da1.src0_address_mode = src->reg.address_mode; - if (SWIZZLE(src->reg) && SWIZZLE(src->reg) != BRW_SWIZZLE_NOOP) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } } else { instr->bits2.da16.src0_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode); instr->bits2.da16.src0_reg_nr = src->reg.nr;
@@ -2889,11 +2902,6 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits2.ia1.src0_horiz_stride = src->reg.hstride; instr->bits2.ia1.src0_width = src->reg.width; instr->bits2.ia1.src0_vert_stride = src->reg.vstride; - if (SWIZZLE(src->reg) && SWIZZLE(src->reg) != BRW_SWIZZLE_NOOP) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } } else { instr->bits2.ia16.src0_swz_x = BRW_GET_SWZ(SWIZZLE(src->reg), 0); instr->bits2.ia16.src0_swz_y = BRW_GET_SWZ(SWIZZLE(src->reg), 1);
@@ -2916,9 +2924,12 @@ int set_instruction_src0(struct brw_instruction *instr, int set_instruction_src1(struct brw_instruction *instr, struct src_operand *src) { - if (advanced_flag) { + if (advanced_flag) reset_instruction_src_region(instr, src); - } + + if (!validate_src_reg(instr, src->reg)) + return 1; + instr->bits1.da1.src1_reg_file = src->reg.file; instr->bits1.da1.src1_reg_type = src->reg.type; if (src->reg.file == BRW_IMMEDIATE_VALUE) {
@@ -2933,18 +2944,6 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits3.da1.src1_negate = src->reg.negate; instr->bits3.da1.src1_abs = src->reg.abs; instr->bits3.da1.src1_address_mode = src->reg.address_mode; - /* XXX why? - if (src->address_mode != BRW_ADDRESS_DIRECT) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } - */ - if (SWIZZLE(src->reg) && SWIZZLE(src->reg) != BRW_SWIZZLE_NOOP) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } } else { instr->bits3.da16.src1_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode); instr->bits3.da16.src1_reg_nr = src->reg.nr;
@@ -2956,11 +2955,6 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits3.da16.src1_swz_z = BRW_GET_SWZ(SWIZZLE(src->reg), 2); instr->bits3.da16.src1_swz_w = BRW_GET_SWZ(SWIZZLE(src->reg), 3); instr->bits3.da16.src1_address_mode = src->reg.address_mode; - if (src->reg.address_mode != BRW_ADDRESS_DIRECT) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } } } else { if (instr->header.access_mode == BRW_ALIGN_1) {
@@ -2972,11 +2966,6 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits3.ia1.src1_horiz_stride = src->reg.hstride; instr->bits3.ia1.src1_width = src->reg.width; instr->bits3.ia1.src1_vert_stride = src->reg.vstride; - if (SWIZZLE(src->reg) && SWIZZLE(src->reg) != BRW_SWIZZLE_NOOP) { - fprintf(stderr, "error: swizzle bits set in align1 " - "instruction\n"); - return 1; - } } else { instr->bits3.ia16.src1_swz_x = BRW_GET_SWZ(SWIZZLE(src->reg), 0); instr->bits3.ia16.src1_swz_y = BRW_GET_SWZ(SWIZZLE(src->reg), 1);
Signature · 1 line
1.7.7.5
PATCH 53/90 assembler: ExecSize can be as big as 32 channels
In reply to Damien LespiauSee the IVB PRM, vol4 part3 5.2.3.
--- assembler/brw_eu_emit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
assembler/brw_eu_emit.c +1 -1
@@ -163,7 +163,7 @@ validate_reg(struct brw_instruction *insn, struct brw_reg reg)int hstride_for_reg[] = {0 ,1 ,2 ,4 };int vstride_for_reg[] = {0 ,1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 ,256 };int width_for_reg[] = {1 ,2 ,4 ,8 ,16 }; -int execsize_for_reg[] = {1 ,2 ,4 ,8 ,16 }; +int execsize_for_reg[] = {1 ,2 ,4 ,8 ,16 ,32 };int width, hstride, vstride, execsize;if (reg.file ==BRW_IMMEDIATE_VALUE ) {
Signature · 1 line
1.7.7.5
PATCH 54/90 assembler: Fix comparisons between reg.type and Architecture registers
In reply to Damien LespiauOf course the assertion is there to make sure GRF and MRF have a reg.nr < 128. To exclude ARF registers, reg.file has be checked, not reg.type (channel type). Most likely a typo never caught.
--- assembler/brw_eu_emit.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
assembler/brw_eu_emit.c +2 -2
@@ -240,7 +240,7 @@ brw_set_src0(struct brw_compile *p, struct brw_instruction *insn,struct brw_context *brw = p->brw;struct intel_context *intel = &brw->intel; -if (reg.type !=BRW_ARCHITECTURE_REGISTER_FILE ) +if (reg.file !=BRW_ARCHITECTURE_REGISTER_FILE )assert (reg.nr <128 );gen7_convert_mrf_to_grf (p, ®);
@@ -332,7 +332,7 @@ void brw_set_src1(struct brw_compile *p, {assert (reg.file !=BRW_MESSAGE_REGISTER_FILE ); -if (reg.type !=BRW_ARCHITECTURE_REGISTER_FILE ) +if (reg.file !=BRW_ARCHITECTURE_REGISTER_FILE )assert (reg.nr <128 );gen7_convert_mrf_to_grf (p, ®);
Signature · 1 line
1.7.7.5
PATCH 55/90 assembler: Store immediate values in reg.dw1.ud
In reply to Damien LespiauAnother step in pushing the parsing in struct brw_reg.
--- assembler/gen4asm.h | 2 +- assembler/gram.y | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-)
assembler/gen4asm.h +1 -1
@@ -91,7 +91,7 @@ struct regtype {struct src_operand {struct brw_reg reg;int default_region; -uint32_t imm32;/* set if reg.file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */ +uint32_t imm32;/* set if src_operand is expressing a branch offset */ char *reloc_target;/* bspec: branching instructions JIP and UIP are source operands */ } src_operand;
assembler/gram.y +10 -10
@@ -1030,7 +1030,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if ($7.reg.type != BRW_REGISTER_TYPE_UD && $7.reg.type != BRW_REGISTER_TYPE_D && $7.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.imm32, $7.reg.type); + fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.reg.dw1.ud, $7.reg.type); YYERROR; } memset(&$$, 0, sizeof($$));
@@ -1045,7 +1045,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; $$.bits1.da1.src1_reg_type = $7.reg.type; - $$.bits3.ud = $7.imm32; + $$.bits3.ud = $7.reg.dw1.ud; } | predicate SEND execsize dst sendleadreg sndopr imm32reg instoptions {
@@ -1059,7 +1059,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if ($7.reg.type != BRW_REGISTER_TYPE_UD && $7.reg.type != BRW_REGISTER_TYPE_D && $7.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.imm32, $7.reg.type); + fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.reg.dw1.ud, $7.reg.type); YYERROR; }
@@ -1089,7 +1089,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; $$.bits1.da1.src1_reg_type = $7.reg.type; - $$.bits3.ud = $7.imm32; + $$.bits3.ud = $7.reg.dw1.ud; $$.bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); } | predicate SEND execsize dst sendleadreg sndopr directsrcoperand instoptions
@@ -1141,7 +1141,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if ($8.reg.type != BRW_REGISTER_TYPE_UD && $8.reg.type != BRW_REGISTER_TYPE_D && $8.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $8.imm32, $8.reg.type); + fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $8.reg.dw1.ud, $8.reg.type); YYERROR; } memset(&$$, 0, sizeof($$));
@@ -1158,11 +1158,11 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget $$.bits1.da1.src1_reg_type = $8.reg.type; if (IS_GENx(5)) { $$.bits2.send_gen5.sfid = ($7 & EX_DESC_SFID_MASK); - $$.bits3.ud = $8.imm32; + $$.bits3.ud = $8.reg.dw1.ud; $$.bits3.generic_gen5.end_of_thread = !!($7 & EX_DESC_EOT_MASK); } else - $$.bits3.ud = $8.imm32; + $$.bits3.ud = $8.reg.dw1.ud; } | predicate SEND execsize dst sendleadreg payload exp directsrcoperand instoptions {
@@ -1837,7 +1837,7 @@ imm32reg: imm32 srcimmtype memset (&$$, '\0', sizeof ($$)); $$.reg.file = BRW_IMMEDIATE_VALUE; $$.reg.type = $2; - $$.imm32 = d; + $$.reg.dw1.ud = d; } ;
@@ -2869,7 +2869,7 @@ int set_instruction_src0(struct brw_instruction *instr, instr->bits1.da1.src0_reg_file = src->reg.file; instr->bits1.da1.src0_reg_type = src->reg.type; if (src->reg.file == BRW_IMMEDIATE_VALUE) { - instr->bits3.ud = src->imm32; + instr->bits3.ud = src->reg.dw1.ud; } else if (src->reg.address_mode == BRW_ADDRESS_DIRECT) { if (instr->header.access_mode == BRW_ALIGN_1) { instr->bits2.da1.src0_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode);
@@ -2933,7 +2933,7 @@ int set_instruction_src1(struct brw_instruction *instr, instr->bits1.da1.src1_reg_file = src->reg.file; instr->bits1.da1.src1_reg_type = src->reg.type; if (src->reg.file == BRW_IMMEDIATE_VALUE) { - instr->bits3.ud = src->imm32; + instr->bits3.ud = src->reg.dw1.ud; } else if (src->reg.address_mode == BRW_ADDRESS_DIRECT) { if (instr->header.access_mode == BRW_ALIGN_1) { instr->bits3.da1.src1_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode);
Signature · 1 line
1.7.7.5
PATCH 56/90 assembler: Don't warn if identical declared registers are redefined
In reply to Damien LespiauThere's no real need to warn when the same register is declared twice. Currently the libva driver does do that and this warning makes other errors really hide in a sea of warnings.
Redefining a register with different parameters is a real error though, so we should not allow that and error out in that case.
--- assembler/gram.y | 74 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 15 deletions(-)
assembler/gram.y +59 -15
@@ -96,6 +96,46 @@ void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, int type); +/* like strcmp, but handles NULL pointers */ +static bool strcmp0(const char *s1, const char* s2) +{ + if (!s1) + return -(s1 != s2); + if (!s2) + return s1 != s2; + return strcmp (s1, s2); +} + +static bool region_equal(struct region *r1, struct region *r2) +{ + return memcmp(r1, r2, sizeof(struct region)) == 0; +} + +static bool reg_equal(struct brw_reg *r1, struct brw_reg *r2) +{ + return memcmp(r1, r2, sizeof(struct brw_reg)) == 0; +} + +static bool declared_register_equal(struct declared_register *r1, + struct declared_register *r2) +{ + if (strcmp0(r1->name, r2->name) != 0) + return false; + + if (!reg_equal(&r1->reg, &r2->reg)) + return false; + + if (!region_equal(&r1->src_region, &r2->src_region)) + return false; + + if (r1->element_size != r2->element_size || + r1->dst_region != r2->dst_region || + r1->type != r2->type) + return false; + + return true; +} + static void brw_program_init(struct brw_program *p) { memset(p, 0, sizeof(struct brw_program));
@@ -431,23 +471,27 @@ declare_type: TYPE EQ regtype ; declare_pragma: DECLARE_PRAGMA STRING declare_base declare_elementsize declare_srcregion declare_dstregion declare_type { - struct declared_register *reg; - int defined; - defined = (reg = find_register($2)) != NULL; - if (defined) { - fprintf(stderr, "WARNING: %s already defined\n", $2); + struct declared_register reg, *found, *new_reg; + + reg.name = $2; + reg.reg = $3; + reg.element_size = $4; + reg.src_region = $5; + reg.dst_region = $6; + reg.type = $7; + + found = find_register($2); + if (found) { + if (!declared_register_equal(®, found)) { + fprintf(stderr, "Error: %s already defined and " + "definitions don't agree\n", $2); + YYERROR; + } free($2); // $2 has been malloc'ed by strdup } else { - reg = calloc(sizeof(struct declared_register), 1); - reg->name = $2; - } - reg->reg = $3; - reg->element_size = $4; - reg->src_region = $5; - reg->dst_region = $6; - reg->type = $7; - if (!defined) { - insert_register(reg); + new_reg = malloc(sizeof(struct declared_register)); + *new_reg = reg; + insert_register(new_reg); } } ;
Signature · 1 line
1.7.7.5
PATCH 57/90 assembler: Add location support
In reply to Damien LespiauLet's generate location information about the tokens we are parsing. This can be used to give accurate location when reporting errors and warnings.
--- assembler/gram.y | 1 + assembler/lex.l | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-)
assembler/gram.y +1 -0
@@ -276,6 +276,7 @@ static void resolve_subnr(struct brw_reg *reg) %} +%locations %start ROOT
assembler/lex.l +18 -6
@@ -9,6 +9,15 @@ int saved_state = 0; extern char *input_filename; +/* Locations */ +int yycolumn = 1; + +#define YY_USER_ACTION \ + yylloc.first_line = yylloc.last_line = yylineno; \ + yylloc.first_column = yycolumn; \ + yylloc.last_column = yycolumn+yyleng-1; \ + yycolumn += yyleng; + %} %x BLOCK_COMMENT %x CHANNEL
@@ -16,11 +25,11 @@ extern char *input_filename; %x FILENAME %% -\/\/.*[\r\n] { } /* eat up single-line comments */ -"\.kernel".*[\r\n] { } -"\.end_kernel".*[\r\n] { } -"\.code".*[\r\n] { } -"\.end_code".*[\r\n] { } +\/\/.*[\r\n] { yycolumn = 1; } /* eat up single-line comments */ +"\.kernel".*[\r\n] { yycolumn = 1; } +"\.end_kernel".*[\r\n] { yycolumn = 1; } +"\.code".*[\r\n] { yycolumn = 1; } +"\.end_code".*[\r\n] { yycolumn = 1; } /* eat up multi-line comments, non-nesting. */ \/\* {
@@ -33,6 +42,7 @@ extern char *input_filename; <BLOCK_COMMENT>. { } <BLOCK_COMMENT>[\r\n] { } "#line"" "* { + yycolumn = 1; saved_state = YYSTATE; BEGIN(LINENUMBER); }
@@ -407,7 +417,9 @@ yylval.integer = BRW_CHANNEL_W; return NUMBER; } -[ \t\n]+ { } /* eat up whitespace */ +[ \t]+ { } /* eat up whitespace */ + +\n { yycolumn = 1; } . { fprintf(stderr, "%s: %d: %s at \"%s\"\n",
Signature · 1 line
1.7.7.5
PATCH 58/90 assembler: Add error() and warn() shorthands and use them in set_src[01]
In reply to Damien LespiauNow that we have locations, we can write error() and warn() functions giving more information about where it's going wrong.
--- assembler/gen4asm.h | 2 + assembler/gram.y | 121 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 83 insertions(+), 40 deletions(-)
assembler/gen4asm.h +2 -0
@@ -69,6 +69,8 @@ typedef struct { \/* ensure nobody changes the size of struct brw_instruction */ STRUCT_SIZE_ASSERT (brw_instruction,16 ); +#define ARRAY_SIZE (x) (sizeof(x) / sizeof(x[0])) +struct condition {int cond;int flag_reg_nr;
assembler/gram.y +81 -40
307 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 59/90 assembler: Add a check for when width is 1 and hstride is not 0
In reply to Damien LespiauThe list of region restrictions in bspec do say that we can't have:
width == 1 && hstrize != 0
We do have plenty of assembly code that don't respect that behaviour. So let's hide the warning under a -W flag (for now) while we fix things.
--- assembler/gen4asm.h | 4 ++++ assembler/gram.y | 29 ++++++++++++++++++++++++++++- assembler/main.c | 7 ++++++- 3 files changed, 38 insertions(+), 2 deletions(-)
assembler/gen4asm.h +4 -0
@@ -43,6 +43,10 @@ typedef float GLfloat;extern long int gen_level; +#define WARN_ALWAYS (1 << 0) +#define WARN_ALL (1 << 31) +extern unsigned int warning_flags; +extern struct brw_context genasm_context;extern struct brw_compile genasm_compile;
assembler/gram.y +28 -1
@@ -130,7 +130,12 @@ static void message(enum message_level level, YYLTYPE *location, va_end(args); } -#define warn(l, fmt, ...) message(WARN, location, fmt, ## __VA_ARGS__) +#define warn(flag, l, fmt, ...) \ + do { \ + if (warning_flags & WARN_ ## flag) \ + message(WARN, location, fmt, ## __VA_ARGS__); \ + } while(0) + #define error(l, fmt, ...) message(ERROR, location, fmt, ## __VA_ARGS__) /* like strcmp, but handles NULL pointers */
@@ -255,6 +260,10 @@ static bool validate_src_reg(struct brw_instruction *insn, struct brw_reg reg, YYLTYPE *location) { + int hstride_for_reg[] = {0, 1, 2, 4}; + int width_for_reg[] = {1, 2, 4, 8, 16}; + int width, hstride; + if (reg.file == BRW_IMMEDIATE_VALUE) return true;
@@ -265,6 +274,24 @@ static bool validate_src_reg(struct brw_instruction *insn, return false; } + assert(reg.hstride >= 0 && reg.hstride < ARRAY_SIZE(hstride_for_reg)); + hstride = hstride_for_reg[reg.hstride]; + + assert(reg.width >= 0 && reg.width < ARRAY_SIZE(width_for_reg)); + width = width_for_reg[reg.width]; + + /* Register Region Restrictions */ + + /* D. If Width = 1, HorzStride must be 0 regardless of the values of + * ExecSize and VertStride. + * + * FIXME: In "advanced mode" hstride is set to 1, this is probably a bug + * to fix, but it changes the generated opcodes and thus needs validation. + */ + if (width == 1 && hstride != 0) + warn(ALL, location, "region width is 1 but horizontal stride is %d " + " (should be 0)\n", hstride); + return true; }
assembler/main.c +6 -1
@@ -43,6 +43,7 @@ extern int errors;long int gen_level =40 ;int advanced_flag =0 ;/* 0: in unit of byte, 1: in unit of data element size */ +unsigned int warning_flags =WARN_ALWAYS ;int binary_like_output =0 ;/* 0: default output style, 1: nice C-style output */ int need_export =0 ;char *input_filename ="<stdin>" ;
@@ -293,7 +294,7 @@ int main(int argc, char **argv)char o;void *mem_ctx; -while ((o =getopt_long (argc, argv,"e:l:o:g:ab" , longopts,NULL )) !=-1 ) { +while ((o =getopt_long (argc, argv,"e:l:o:g:abW" , longopts,NULL )) !=-1 ) {switch (o) {case 'o' :if (strcmp (optarg,"-" ) !=0 )
@@ -344,6 +345,10 @@ int main(int argc, char **argv) entry_table_file = optarg;break ; +case 'W' : + warning_flags |=WARN_ALL ; +break ; +default :usage ();exit (1 );
Signature · 1 line
1.7.7.5
PATCH 60/90 assembler: Add a check for when ExecSize and width are 1
In reply to Damien LespiauAnother check (that we hit if we try to use brw_set_src0()). Again, protect it with the -W option.
--- assembler/gram.y | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)
assembler/gram.y +25 -1
@@ -261,8 +261,10 @@ static bool validate_src_reg(struct brw_instruction *insn, YYLTYPE *location) { int hstride_for_reg[] = {0, 1, 2, 4}; + int vstride_for_reg[] = {0, 1, 2, 4, 8, 16, 32, 64, 128, 256}; int width_for_reg[] = {1, 2, 4, 8, 16}; - int width, hstride; + int execsize_for_reg[] = {1, 2, 4, 8, 16, 32}; + int width, hstride, vstride, execsize; if (reg.file == BRW_IMMEDIATE_VALUE) return true;
@@ -277,9 +279,20 @@ static bool validate_src_reg(struct brw_instruction *insn, assert(reg.hstride >= 0 && reg.hstride < ARRAY_SIZE(hstride_for_reg)); hstride = hstride_for_reg[reg.hstride]; + if (reg.vstride == 0xf) { + vstride = -1; + } else { + assert(reg.vstride >= 0 && reg.vstride < ARRAY_SIZE(vstride_for_reg)); + vstride = vstride_for_reg[reg.vstride]; + } + assert(reg.width >= 0 && reg.width < ARRAY_SIZE(width_for_reg)); width = width_for_reg[reg.width]; + assert(insn->header.execution_size >= 0 && + insn->header.execution_size < ARRAY_SIZE(execsize_for_reg)); + execsize = execsize_for_reg[insn->header.execution_size]; + /* Register Region Restrictions */ /* D. If Width = 1, HorzStride must be 0 regardless of the values of
@@ -292,6 +305,17 @@ static bool validate_src_reg(struct brw_instruction *insn, warn(ALL, location, "region width is 1 but horizontal stride is %d " " (should be 0)\n", hstride); + /* E. If ExecSize = Width = 1, both VertStride and HorzStride must be 0. + * This defines a scalar. */ + if (execsize == 1 && width == 1) { + if (hstride != 0) + warn(ALL, location, "execution size and region width are 1 but " + "horizontal stride is %d (should be 0)\n", hstride); + if (vstride != 0) + warn(ALL, location, "execution size and region width are 1 but " + "vertical stride is %d (should be 0)\n", vstride); + } + return true; }
Signature · 1 line
1.7.7.5
PATCH 61/90 assembler: Add the input filename to the error/warning messages
In reply to Damien Lespiau--- assembler/gen4asm.h | 2 ++ assembler/gram.y | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
assembler/gen4asm.h +2 -0
@@ -47,6 +47,8 @@ extern long int gen_level;#define WARN_ALL (1 << 31)extern unsigned int warning_flags; +extern char *input_filename; +extern struct brw_context genasm_context;extern struct brw_compile genasm_compile;
assembler/gram.y +2 -2
@@ -120,10 +120,10 @@ static void message(enum message_level level, YYLTYPE *location, va_list args; if (location) - fprintf(stderr, "%d:%d: %s: ", location->first_line, + fprintf(stderr, "%s:%d:%d: %s: ", input_filename, location->first_line, location->first_column, level_str[level]); else - fprintf(stderr, "%s: ", level_str[level]); + fprintf(stderr, "%s:%s: ", input_filename, level_str[level]); va_start(args, fmt); vfprintf(stderr, fmt, args);
Signature · 1 line
1.7.7.5
PATCH 62/90 assembler: Use brw_set_src0()
In reply to Damien LespiauUnfortunately, it's all a walk in the park. Both, internal code in the assembler and external shaders (libva) generate registers that trigger assertions in brw_eu_emit.c's brw_validate().
To fix all that I took the option to be able to emit warning with the -W flag but still make the assembler generate the same opcodes.
We can fix all this, but it requires validation, something that I cannot do right now.
--- assembler/brw_eu_emit.c | 25 ++++++++++++++++- assembler/gram.y | 66 ++++++++++++---------------------------------- 2 files changed, 40 insertions(+), 51 deletions(-)
assembler/brw_eu_emit.c +23 -2
@@ -204,10 +204,16 @@ validate_reg(struct brw_instruction *insn, struct brw_reg reg)/* 3. */ assert (execsize >= width); +/* FIXME: the assembler has a lot of code written that triggers the +* assertions commented it below. Let's paper over it (for now!) until we +* can re-validate the shaders with those little inconsistencies fixed. */ +/* 4. */ +#if 0 if (execsize == width && hstride !=0 ) {assert (vstride ==-1 || vstride == width * hstride); } +#endif /* 5. */ if (execsize == width && hstride ==0 ) {
@@ -215,15 +221,19 @@ validate_reg(struct brw_instruction *insn, struct brw_reg reg) }/* 6. */ +#if 0 if (width ==1 ) {assert (hstride ==0 ); } +#endif /* 7. */ +#if 0 if (execsize ==1 && width ==1 ) {assert (hstride ==0 );assert (vstride ==0 ); } +#endif /* 8. */ if (vstride ==0 && hstride ==0 ) {
@@ -269,8 +279,14 @@ brw_set_src0(struct brw_compile *p, struct brw_instruction *insn,/* Required to set some fields in src1 as well: */ - insn->bits1.da1.src1_reg_file =0 ;/* arf */ + +/* FIXME: This looks quite wrong, tempering with src1. I did not find +* anything in the bspec that was hinting it woud be needed when setting +* src0. before removing this one needs to run piglit. + +insn->bits1.da1.src1_reg_file = 0; insn->bits1.da1.src1_reg_type = reg.type; +*/ }else {
@@ -296,6 +312,10 @@ brw_set_src0(struct brw_compile *p, struct brw_instruction *insn, }if (insn->header.access_mode ==BRW_ALIGN_1 ) { + +/* FIXME: While this is correct, if the assembler uses that code path +* the opcode generated are different and thus needs a validation +* pass. if (reg.width == BRW_WIDTH_1 && insn->header.execution_size == BRW_EXECUTE_1) { insn->bits2.da1.src0_horiz_stride = BRW_HORIZONTAL_STRIDE_0;
@@ -303,10 +323,11 @@ brw_set_src0(struct brw_compile *p, struct brw_instruction *insn,insn->bits2.da1.src0_vert_stride = BRW_VERTICAL_STRIDE_0; } else { +*/ insn->bits2.da1.src0_horiz_stride = reg.hstride; insn->bits2.da1.src0_width = reg.width; insn->bits2.da1.src0_vert_stride = reg.vstride; - } +/* } */ }else { insn->bits2.da16.src0_swz_x =BRW_GET_SWZ (reg.dw1.bits.swizzle,BRW_CHANNEL_X );
assembler/gram.y +17 -49
90 lines not on this page · raw message
Signature · 6 lines
1.7.7.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 63/90 assembler: Port the warning and error reporting to warn()/error()
In reply to Damien LespiauThis way we ensure to have a single place where these are handled. The immediate benefit is that now line numbers are always printed out, which is quite handy.
--- assembler/gram.y | 274 ++++++++++++++++++++++-------------------------------- 1 files changed, 113 insertions(+), 161 deletions(-)
assembler/gram.y +113 -161
@@ -133,10 +133,13 @@ static void message(enum message_level level, YYLTYPE *location, #define warn(flag, l, fmt, ...) \ do { \ if (warning_flags & WARN_ ## flag) \ - message(WARN, location, fmt, ## __VA_ARGS__); \ + message(WARN, l, fmt, ## __VA_ARGS__); \ } while(0) -#define error(l, fmt, ...) message(ERROR, location, fmt, ## __VA_ARGS__) +#define error(l, fmt, ...) \ + do { \ + message(ERROR, l, fmt, ## __VA_ARGS__); \ + } while(0) /* like strcmp, but handles NULL pointers */ static bool strcmp0(const char *s1, const char* s2)
@@ -510,6 +513,18 @@ static void resolve_subnr(struct brw_reg *reg) %type <src_operand> indirectsrcoperand %type <src_operand> src srcimm imm32reg payload srcacc srcaccimm swizzle %type <src_operand> relativelocation relativelocation2 + +%code { + +#undef error +#define error(l, fmt, ...) \ + do { \ + message(ERROR, l, fmt, ## __VA_ARGS__); \ + YYERROR; \ + } while(0) + +} + %% simple_int: INTEGER { $$ = $1; } | MINUS INTEGER { $$ = -$2;}
@@ -584,11 +599,9 @@ declare_pragma: DECLARE_PRAGMA STRING declare_base declare_elementsize declare_s found = find_register($2); if (found) { - if (!declared_register_equal(®, found)) { - fprintf(stderr, "Error: %s already defined and " - "definitions don't agree\n", $2); - YYERROR; - } + if (!declared_register_equal(®, found)) + error(&@1, "%s already defined and definitions " + "don't agree\n", $2); free($2); // $2 has been malloc'ed by strdup } else { new_reg = malloc(sizeof(struct declared_register));
@@ -694,10 +707,8 @@ relocatableinstruction: ifelseinstruction ifelseinstruction: ENDIF { // for Gen4 - if(IS_GENp(6)) { // For gen6+. - fprintf(stderr, "ENDIF Syntax error: should be 'ENDIF execsize relativelocation'\n"); - YYERROR; - } + if(IS_GENp(6)) // For gen6+. + error(&@1, "should be 'ENDIF execsize relativelocation'\n"); memset(&$$, 0, sizeof($$)); $$.gen.header.opcode = $1; $$.gen.header.thread_control |= BRW_THREAD_SWITCH;
@@ -709,10 +720,8 @@ ifelseinstruction: ENDIF { // for Gen6+ /* Gen6, Gen7 bspec: predication is prohibited */ - if(!IS_GENp(6)) { // for gen6- - fprintf(stderr, "ENDIF Syntax error: should be 'ENDIF'\n"); - YYERROR; - } + if(!IS_GENp(6)) // for gen6- + error(&@1, "ENDIF Syntax error: should be 'ENDIF'\n"); memset(&$$, 0, sizeof($$)); $$.gen.header.opcode = $1; $$.gen.header.execution_size = $2;
@@ -742,24 +751,19 @@ ifelseinstruction: ENDIF $$.first_reloc_target = $3.reloc_target; $$.first_reloc_offset = $3.imm32; } else { - fprintf(stderr, "'ELSE' instruction is not implemented.\n"); - YYERROR; + error(&@1, "'ELSE' instruction is not implemented.\n"); } } | predicate IF execsize relativelocation { - /* for Gen4, Gen5 */ /* The branch instructions require that the IP register * be the destination and first source operand, while the * offset is the second source operand. The offset is added * to the pre-incremented IP. */ - /* for Gen6 */ - if(IS_GENp(7)) { - /* Error in Gen7+. */ - fprintf(stderr, "Syntax error: IF should be 'IF execsize JIP UIP'\n"); - YYERROR; - } + if(IS_GENp(7)) /* Error in Gen7+. */ + error(&@2, "IF should be 'IF execsize JIP UIP'\n"); + memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$.gen, &$1); $$.gen.header.opcode = $2;
@@ -776,10 +780,9 @@ ifelseinstruction: ENDIF | predicate IF execsize relativelocation relativelocation { /* for Gen7+ */ - if(!IS_GENp(7)) { - fprintf(stderr, "Syntax error: IF should be 'IF execsize relativelocation'\n"); - YYERROR; - } + if(!IS_GENp(7)) + error(&@2, "IF should be 'IF execsize relativelocation'\n"); + memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$.gen, &$1); $$.gen.header.opcode = $2;
@@ -820,8 +823,7 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions $$.first_reloc_target = $4.reloc_target; $$.first_reloc_offset = $4.imm32; } else { - fprintf(stderr, "'WHILE' instruction is not implemented!\n"); - YYERROR; + error(&@2, "'WHILE' instruction is not implemented!\n"); } } | DO
@@ -955,7 +957,9 @@ unaryinstruction: if ($$.header.predicate_control != BRW_PREDICATE_NONE && ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) - fprintf(stderr, "WARNING: must use the same flag register if both prediction and conditional modifier are enabled\n"); + warn(ALWAYS, &@3, "must use the same flag register if " + "both prediction and conditional modifier are " + "enabled\n"); $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr;
@@ -994,7 +998,9 @@ binaryinstruction: if ($$.header.predicate_control != BRW_PREDICATE_NONE && ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) - fprintf(stderr, "WARNING: must use the same flag register if both prediction and conditional modifier are enabled\n"); + warn(ALWAYS, &@3, "must use the same flag register if " + "both prediction and conditional modifier are " + "enabled\n"); $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr;
@@ -1033,7 +1039,9 @@ binaryaccinstruction: if ($$.header.predicate_control != BRW_PREDICATE_NONE && ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) - fprintf(stderr, "WARNING: must use the same flag register if both prediction and conditional modifier are enabled\n"); + warn(ALWAYS, &@3, "must use the same flag register if " + "both prediction and conditional modifier are " + "enabled\n"); $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr;
@@ -1082,7 +1090,9 @@ trinaryinstruction: if ($$.header.predicate_control != BRW_PREDICATE_NONE && ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) - fprintf(stderr, "WARNING: must use the same flag register if both prediction and conditional modifier are enabled\n"); + warn(ALWAYS, &@3, "must use the same flag register if " + "both prediction and conditional modifier are " + "enabled\n"); } } ;
@@ -1176,8 +1186,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if ($7.reg.type != BRW_REGISTER_TYPE_UD && $7.reg.type != BRW_REGISTER_TYPE_D && $7.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.reg.dw1.ud, $7.reg.type); - YYERROR; + error (&@7, "non-int D/UD/V representation: %d," + "type=%d\n", $7.reg.dw1.ud, $7.reg.type); } memset(&$$, 0, sizeof($$)); $$.header.opcode = $2;
@@ -1197,16 +1207,14 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget { struct src_operand src0; - if (!IS_GENp(6)) { - fprintf(stderr, "error: the syntax of send instruction\n"); - YYERROR; - } + if (!IS_GENp(6)) + error(&@2, "the syntax of send instruction\n"); if ($7.reg.type != BRW_REGISTER_TYPE_UD && $7.reg.type != BRW_REGISTER_TYPE_D && $7.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $7.reg.dw1.ud, $7.reg.type); - YYERROR; + error(&@7,"non-int D/UD/V representation: %d," + "type=%d\n", $7.reg.dw1.ud, $7.reg.type); } memset(&$$, 0, sizeof($$));
@@ -1242,17 +1250,14 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget { struct src_operand src0; - if (!IS_GENp(6)) { - fprintf(stderr, "error: the syntax of send instruction\n"); - YYERROR; - } + if (!IS_GENp(6)) + error(&@2, "the syntax of send instruction\n"); if ($7.reg.file != BRW_ARCHITECTURE_REGISTER_FILE || ($7.reg.nr & 0xF0) != BRW_ARF_ADDRESS || ($7.reg.nr & 0x0F) != 0 || $7.reg.subnr != 0) { - fprintf (stderr, "%d: scalar register must be a0.0<0;1,0>:ud\n", yylineno); - YYERROR; + error (&@7, "scalar register must be a0.0<0;1,0>:ud\n"); } memset(&$$, 0, sizeof($$));
@@ -1287,8 +1292,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if ($8.reg.type != BRW_REGISTER_TYPE_UD && $8.reg.type != BRW_REGISTER_TYPE_D && $8.reg.type != BRW_REGISTER_TYPE_V) { - fprintf (stderr, "%d: non-int D/UD/V representation: %d,type=%d\n", yylineno, $8.reg.dw1.ud, $8.reg.type); - YYERROR; + error(&@8, "non-int D/UD/V representation: %d," + "type=%d\n", $8.reg.dw1.ud, $8.reg.type); } memset(&$$, 0, sizeof($$)); $$.header.opcode = $2;
@@ -1476,8 +1481,7 @@ msgtarget: NULL_TOKEN | MATH math_function saturate math_signed math_scalar { if (IS_GENp(6)) { - fprintf (stderr, "Gen6+ doesn't have math function\n"); - YYERROR; + error (&@1, "Gen6+ doesn't have math function\n"); } else if (IS_GENx(5)) { $$.bits2.send_gen5.sfid = BRW_SFID_MATH; $$.bits3.generic_gen5.header_present = 0;
@@ -1682,16 +1686,14 @@ msgtarget: NULL_TOKEN $$.bits3.vme_gen6.message_type = $9; $$.bits3.generic_gen5.header_present = 1; } else { - fprintf (stderr, "Gen6- doesn't have vme function\n"); - YYERROR; + error (&@1, "Gen6- doesn't have vme function\n"); } } | CRE LPAREN INTEGER COMMA INTEGER RPAREN { - if (gen_level < 75) { - fprintf (stderr, "Below Gen7.5 doesn't have CRE function\n"); - YYERROR; - } + if (gen_level < 75) + error (&@1, "Below Gen7.5 doesn't have CRE function\n"); + $$.bits3.generic.msg_target = HSW_SFID_CRE; $$.bits2.send_gen5.sfid = HSW_SFID_CRE;
@@ -1711,8 +1713,7 @@ msgtarget: NULL_TOKEN $3 != GEN6_SFID_DATAPORT_RENDER_CACHE && $3 != GEN6_SFID_DATAPORT_CONSTANT_CACHE && $3 != GEN7_SFID_DATAPORT_DATA_CACHE) { - fprintf (stderr, "error: wrong cache type\n"); - YYERROR; + error (&@3, "error: wrong cache type\n"); } $$.bits3.gen7_dp.category = $11;
@@ -1723,8 +1724,7 @@ msgtarget: NULL_TOKEN if ($3 != GEN6_SFID_DATAPORT_SAMPLER_CACHE && $3 != GEN6_SFID_DATAPORT_RENDER_CACHE && $3 != GEN6_SFID_DATAPORT_CONSTANT_CACHE) { - fprintf (stderr, "error: wrong cache type\n"); - YYERROR; + error (&@3, "error: wrong cache type\n"); } $$.bits3.gen6_dp.send_commit_msg = $11;
@@ -1732,8 +1732,7 @@ msgtarget: NULL_TOKEN $$.bits3.gen6_dp.msg_control = $7; $$.bits3.gen6_dp.msg_type = $5; } else if (!IS_GENp(5)) { - fprintf (stderr, "Gen6- doesn't support data port for sampler/render/constant/data cache\n"); - YYERROR; + error (&@1, "Gen6- doesn't support data port for sampler/render/constant/data cache\n"); } } ;
@@ -1838,10 +1837,8 @@ symbol_reg: STRING %prec STR_SYMBOL_REG { struct declared_register *dcl_reg = find_register($1); - if (dcl_reg == NULL) { - fprintf(stderr, "can't find register %s\n", $1); - YYERROR; - } + if (dcl_reg == NULL) + error(&@1, "can't find register %s\n", $1); memcpy(&$$, dcl_reg, sizeof(*dcl_reg)); free($1); // $1 has been malloc'ed by strdup
@@ -1856,10 +1853,8 @@ symbol_reg_p: STRING LPAREN exp RPAREN { struct declared_register *dcl_reg = find_register($1); - if (dcl_reg == NULL) { - fprintf(stderr, "can't find register %s\n", $1); - YYERROR; - } + if (dcl_reg == NULL) + error(&@1, "can't find register %s\n", $1); memcpy(&$$, dcl_reg, sizeof(*dcl_reg)); $$.reg.nr += $3;
@@ -1869,10 +1864,8 @@ symbol_reg_p: STRING LPAREN exp RPAREN { struct declared_register *dcl_reg = find_register($1); - if (dcl_reg == NULL) { - fprintf(stderr, "can't find register %s\n", $1); - YYERROR; - } + if (dcl_reg == NULL) + error(&@1, "can't find register %s\n", $1); memcpy(&$$, dcl_reg, sizeof(*dcl_reg)); $$.reg.nr += $3;
@@ -1940,8 +1933,7 @@ imm32reg: imm32 srcimmtype d = $1.u.d; break; default: - fprintf (stderr, "%d: non-int D/UD/V/VF representation: %d,type=%d\n", yylineno, $1.r, $2); - YYERROR; + error (&@2, "non-int D/UD/V/VF representation: %d,type=%d\n", $1.r, $2); } break; case BRW_REGISTER_TYPE_UW:
@@ -1951,8 +1943,7 @@ imm32reg: imm32 srcimmtype d = $1.u.d; break; default: - fprintf (stderr, "non-int W/UW representation\n"); - YYERROR; + error (&@2, "non-int W/UW representation\n"); } d &= 0xffff; d |= d << 16;
@@ -1966,8 +1957,7 @@ imm32reg: imm32 srcimmtype intfloat.f = (float) $1.u.d; break; default: - fprintf (stderr, "non-float F representation\n"); - YYERROR; + error (&@2, "non-float F representation\n"); } d = intfloat.i; break;
@@ -1977,8 +1967,7 @@ imm32reg: imm32 srcimmtype YYERROR; #endif default: - fprintf(stderr, "unknown immediate type %d\n", $2); - YYERROR; + error(&@2, "unknown immediate type %d\n", $2); } memset (&$$, '\0', sizeof ($$)); $$.reg.file = BRW_IMMEDIATE_VALUE;
@@ -2145,11 +2134,8 @@ indirectsrcoperand: */ addrparam: addrreg COMMA immaddroffset { - if ($3 < -512 || $3 > 511) { - fprintf(stderr, "Address immediate offset %d out of" - "range %d\n", $3, yylineno); - YYERROR; - } + if ($3 < -512 || $3 > 511) + error(&@3, "Address immediate offset %d out of range\n", $3); memset (&$$, '\0', sizeof ($$)); $$.subnr = $1.subnr; $$.dw1.bits.indirect_offset = $3;
@@ -2220,11 +2206,9 @@ indirectmsgreg: MSGREGFILE LSQUARE addrparam RSQUARE addrreg: ADDRESSREG subregnum { - if ($1 != 0) { - fprintf(stderr, - "address register number %d out of range", $1); - YYERROR; - } + if ($1 != 0) + error(&@2, "address register number %d out of range", $1); + memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_ADDRESS | $1;
@@ -2234,11 +2218,8 @@ addrreg: ADDRESSREG subregnum accreg: ACCREG subregnum { - if ($1 > 1) { - fprintf(stderr, - "accumulator register number %d out of range", $1); - YYERROR; - } + if ($1 > 1) + error(&@1, "accumulator register number %d out of range", $1); memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_ACCUMULATOR | $1;
@@ -2250,16 +2231,11 @@ flagreg: FLAGREG subregnum { if ((!IS_GENp(7) && $1) > 0 || (IS_GENp(7) && $1 > 1)) { - fprintf(stderr, - "flag register number %d out of range\n", $1); - YYERROR; + error(&@2, "flag register number %d out of range\n", $1); } - if ($2 > 1) { - fprintf(stderr, - "flag subregister number %d out of range\n", $1); - YYERROR; - } + if ($2 > 1) + error(&@2, "flag subregister number %d out of range\n", $1); memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE;
@@ -2270,11 +2246,9 @@ flagreg: FLAGREG subregnum maskreg: MASKREG subregnum { - if ($1 > 0) { - fprintf(stderr, - "mask register number %d out of range", $1); - YYERROR; - } + if ($1 > 0) + error(&@1, "mask register number %d out of range", $1); + memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_MASK;
@@ -2294,11 +2268,8 @@ mask_subreg: AMASK | IMASK | LMASK | CMASK maskstackreg: MASKSTACKREG subregnum { - if ($1 > 0) { - fprintf(stderr, - "mask stack register number %d out of range", $1); - YYERROR; - } + if ($1 > 0) + error(&@1, "mask stack register number %d out of range", $1); memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_MASK_STACK;
@@ -2319,11 +2290,8 @@ maskstack_subreg: IMS | LMS /* maskstackdepthreg: MASKSTACKDEPTHREG subregnum { - if ($1 > 0) { - fprintf(stderr, - "mask stack register number %d out of range", $1); - YYERROR; - } + if ($1 > 0) + error(&@1, "mask stack register number %d out of range", $1); memset (&$$, '\0', sizeof ($$)); $$.reg_file = BRW_ARCHITECTURE_REGISTER_FILE; $$.reg_nr = BRW_ARF_MASK_STACK_DEPTH;
@@ -2346,12 +2314,10 @@ notifyreg: NOTIFYREG regtype { int num_notifyreg = (IS_GENp(6)) ? 3 : 2; - if ($1 > num_notifyreg) { - fprintf(stderr, - "notification register number %d out of range", - $1); - YYERROR; - } + if ($1 > num_notifyreg) + error(&@1, "notification register number %d out of range", + $1); + memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE;
@@ -2382,16 +2348,12 @@ notifyreg: NOTIFYREG regtype statereg: STATEREG subregnum { - if ($1 > 0) { - fprintf(stderr, - "state register number %d out of range", $1); - YYERROR; - } - if ($2 > 1) { - fprintf(stderr, - "state subregister number %d out of range", $1); - YYERROR; - } + if ($1 > 0) + error(&@1, "state register number %d out of range", $1); + + if ($2 > 1) + error(&@2, "state subregister number %d out of range", $1); + memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_STATE | $1;
@@ -2401,16 +2363,11 @@ statereg: STATEREG subregnum controlreg: CONTROLREG subregnum { - if ($1 > 0) { - fprintf(stderr, - "control register number %d out of range", $1); - YYERROR; - } - if ($2 > 2) { - fprintf(stderr, - "control subregister number %d out of range", $1); - YYERROR; - } + if ($1 > 0) + error(&@1, "control register number %d out of range", $1); + + if ($2 > 2) + error(&@2, "control subregister number %d out of range", $1); memset (&$$, '\0', sizeof ($$)); $$.file = BRW_ARCHITECTURE_REGISTER_FILE; $$.nr = BRW_ARF_CONTROL | $1;
@@ -2440,12 +2397,8 @@ nullreg: NULL_TOKEN relativelocation: simple_int { - if (($1 > 32767) || ($1 < -32768)) { - fprintf(stderr, - "error: relative offset %d out of range \n", - $1); - YYERROR; - } + if (($1 > 32767) || ($1 < -32768)) + error(&@1, "error: relative offset %d out of range \n", $1); memset (&$$, '\0', sizeof ($$)); $$.reg.file = BRW_IMMEDIATE_VALUE;
@@ -2520,9 +2473,9 @@ dstregion: /* empty */ /* Returns a value for a horiz_stride field of an * instruction. */ - if ($2 != 1 && $2 != 2 && $2 != 4) { - fprintf(stderr, "Invalid horiz size %d\n", $2); - } + if ($2 != 1 && $2 != 2 && $2 != 4) + error(&@2, "Invalid horiz size %d\n", $2); + $$ = ffs($2); } ;
@@ -2723,10 +2676,9 @@ execsize: /* empty */ %prec EMPTEXECSIZE * instruction. */ if ($2 != 1 && $2 != 2 && $2 != 4 && $2 != 8 && $2 != 16 && - $2 != 32) { - fprintf(stderr, "Invalid execution size %d\n", $2); - YYERROR; - } + $2 != 32) + error(&@2, "Invalid execution size %d\n", $2); + $$ = ffs($2) - 1; } ;
Signature · 1 line
1.7.7.5
PATCH 64/90 assembler: Cleanup visibility of a few global variables/functions
In reply to Damien LespiauNot everything has to be exported out the compilation unit. Do a small cleanup pass.
--- assembler/gen4asm.h | 2 + assembler/gram.y | 102 ++++++++++++++++++++++++--------------------------- assembler/main.c | 12 +++--- 3 files changed, 56 insertions(+), 60 deletions(-)
assembler/gen4asm.h +2 -0
@@ -42,6 +42,8 @@ typedef int GLint;typedef float GLfloat ;extern long int gen_level; +extern int advanced_flag; +extern int errors;#define WARN_ALWAYS (1 << 0)#define WARN_ALL (1 << 31)
assembler/gram.y +48 -54
186 lines not on this page · raw message
assembler/main.c +6 -6
@@ -39,17 +39,12 @@extern FILE *yyin; -extern int errors; -long int gen_level =40 ;int advanced_flag =0 ;/* 0: in unit of byte, 1: in unit of data element size */ unsigned int warning_flags =WARN_ALWAYS ; -int binary_like_output =0 ;/* 0: default output style, 1: nice C-style output */ int need_export =0 ;char *input_filename ="<stdin>" ; -char *export_filename =NULL ; - -const char const *binary_prepend ="static const char gen_eu_bytes[] = {\n" ; +int errors;struct brw_context genasm_brw_context;struct brw_compile genasm_compile;
@@ -57,6 +52,11 @@ struct brw_compile genasm_compile;struct brw_program compiled_program;struct program_defaults program_defaults = {.register_type =BRW_REGISTER_TYPE_F }; +/* 0: default output style, 1: nice C-style output */ +static int binary_like_output =0 ; +static char *export_filename =NULL ; +static const char binary_prepend[] ="static const char gen_eu_bytes[] = {\n" ; +#define HASH_SIZE 37struct hash_item {
Signature · 1 line
1.7.7.5
PATCH 65/90 assembler: Fix ')' placement in condition
In reply to Damien LespiauA small typo in the condition.
--- assembler/gram.y | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
assembler/gram.y +1 -1
@@ -2226,7 +2226,7 @@ accreg: ACCREG subregnum flagreg: FLAGREG subregnum { - if ((!IS_GENp(7) && $1) > 0 || + if ((!IS_GENp(7) && $1 > 0) || (IS_GENp(7) && $1 > 1)) { error(&@2, "flag register number %d out of range\n", $1); }
Signature · 1 line
1.7.7.5
PATCH 66/90 assembler: Implement register-indirect addressing mode in brw_set_src1()
In reply to Damien LespiauThe assembler allows people to do that and that's something available since Crestline.
--- assembler/brw_eu_emit.c | 39 +++++++++++++++++++++++++++------------ 1 files changed, 27 insertions(+), 12 deletions(-)
assembler/brw_eu_emit.c +27 -12
@@ -351,6 +351,9 @@ void brw_set_src1(struct brw_compile *p, struct brw_instruction *insn, struct brw_reg reg) { +struct brw_context *brw = p->brw; +struct intel_context *intel = &brw->intel; +assert (reg.file !=BRW_MESSAGE_REGISTER_FILE );if (reg.file !=BRW_ARCHITECTURE_REGISTER_FILE )
@@ -364,6 +367,7 @@ void brw_set_src1(struct brw_compile *p, insn->bits1.da1.src1_reg_type = reg.type; insn->bits3.da1.src1_abs = reg.abs; insn->bits3.da1.src1_negate = reg.negate; + insn->bits3.da1.src1_address_mode = reg.address_mode;/* Only src1 can be immediate in two-argument instructions. */
@@ -373,33 +377,44 @@ void brw_set_src1(struct brw_compile *p, insn->bits3.ud = reg.dw1.ud; }else { -/* This is a hardware restriction, which may or may not be lifted -* in the future: -*/ -assert (reg.address_mode ==BRW_ADDRESS_DIRECT ); -/* assert (reg.file == BRW_GENERAL_REGISTER_FILE); */ +/* It's only BRW that does not support register-indirect addressing on +* src1 */ +assert (intel->gen >=4 || reg.address_mode ==BRW_ADDRESS_DIRECT ); -if (insn->header.access_mode ==BRW_ALIGN_1 ) { - insn->bits3.da1.src1_subreg_nr = reg.subnr; - insn->bits3.da1.src1_reg_nr = reg.nr; +if (reg.address_mode ==BRW_ADDRESS_DIRECT ) { +if (insn->header.access_mode ==BRW_ALIGN_1 ) { + insn->bits3.da1.src1_subreg_nr = reg.subnr; + insn->bits3.da1.src1_reg_nr = reg.nr; + } +else { + insn->bits3.da16.src1_subreg_nr = reg.subnr /16 ; + insn->bits3.da16.src1_reg_nr = reg.nr; + } }else { - insn->bits3.da16.src1_subreg_nr = reg.subnr /16 ; - insn->bits3.da16.src1_reg_nr = reg.nr; + insn->bits3.ia1.src1_subreg_nr = reg.subnr; + +if (insn->header.access_mode ==BRW_ALIGN_1 ) + insn->bits3.ia1.src1_indirect_offset = reg.dw1.bits.indirect_offset; +else + insn->bits3.ia16.src1_indirect_offset = reg.dw1.bits.indirect_offset /16 ; }if (insn->header.access_mode ==BRW_ALIGN_1 ) { +/* FIXME: While this is correct, if the assembler uses that code path +* the opcode generated are different and thus needs a validation +* pass. if (reg.width == BRW_WIDTH_1 && insn->header.execution_size == BRW_EXECUTE_1) { insn->bits3.da1.src1_horiz_stride = BRW_HORIZONTAL_STRIDE_0; insn->bits3.da1.src1_width = BRW_WIDTH_1; insn->bits3.da1.src1_vert_stride = BRW_VERTICAL_STRIDE_0; } -else { +else { */ insn->bits3.da1.src1_horiz_stride = reg.hstride; insn->bits3.da1.src1_width = reg.width; insn->bits3.da1.src1_vert_stride = reg.vstride; - } +/* } */ }else { insn->bits3.da16.src1_swz_x =BRW_GET_SWZ (reg.dw1.bits.swizzle,BRW_CHANNEL_X );
Signature · 1 line
1.7.7.5
PATCH 67/90 assembler: Use brw_set_src1()
In reply to Damien LespiauEverything is now aligned to be able to use brw_set_src1() in the opcode generation, so use it.
--- assembler/gram.y | 54 +++++------------------------------------------------- 1 files changed, 5 insertions(+), 49 deletions(-)
assembler/gram.y +5 -49
@@ -2981,55 +2981,11 @@ static int set_instruction_src1(struct brw_instruction *instr, if (!validate_src_reg(instr, src->reg, location)) return 1; - instr->bits1.da1.src1_reg_file = src->reg.file; - instr->bits1.da1.src1_reg_type = src->reg.type; - if (src->reg.file == BRW_IMMEDIATE_VALUE) { - instr->bits3.ud = src->reg.dw1.ud; - } else if (src->reg.address_mode == BRW_ADDRESS_DIRECT) { - if (instr->header.access_mode == BRW_ALIGN_1) { - instr->bits3.da1.src1_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode); - instr->bits3.da1.src1_reg_nr = src->reg.nr; - instr->bits3.da1.src1_vert_stride = src->reg.vstride; - instr->bits3.da1.src1_width = src->reg.width; - instr->bits3.da1.src1_horiz_stride = src->reg.hstride; - instr->bits3.da1.src1_negate = src->reg.negate; - instr->bits3.da1.src1_abs = src->reg.abs; - instr->bits3.da1.src1_address_mode = src->reg.address_mode; - } else { - instr->bits3.da16.src1_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode); - instr->bits3.da16.src1_reg_nr = src->reg.nr; - instr->bits3.da16.src1_vert_stride = src->reg.vstride; - instr->bits3.da16.src1_negate = src->reg.negate; - instr->bits3.da16.src1_abs = src->reg.abs; - instr->bits3.da16.src1_swz_x = BRW_GET_SWZ(SWIZZLE(src->reg), 0); - instr->bits3.da16.src1_swz_y = BRW_GET_SWZ(SWIZZLE(src->reg), 1); - instr->bits3.da16.src1_swz_z = BRW_GET_SWZ(SWIZZLE(src->reg), 2); - instr->bits3.da16.src1_swz_w = BRW_GET_SWZ(SWIZZLE(src->reg), 3); - instr->bits3.da16.src1_address_mode = src->reg.address_mode; - } - } else { - if (instr->header.access_mode == BRW_ALIGN_1) { - instr->bits3.ia1.src1_indirect_offset = src->reg.dw1.bits.indirect_offset; - instr->bits3.ia1.src1_subreg_nr = get_indirect_subreg_address(src->reg.subnr); - instr->bits3.ia1.src1_abs = src->reg.abs; - instr->bits3.ia1.src1_negate = src->reg.negate; - instr->bits3.ia1.src1_address_mode = src->reg.address_mode; - instr->bits3.ia1.src1_horiz_stride = src->reg.hstride; - instr->bits3.ia1.src1_width = src->reg.width; - instr->bits3.ia1.src1_vert_stride = src->reg.vstride; - } else { - instr->bits3.ia16.src1_swz_x = BRW_GET_SWZ(SWIZZLE(src->reg), 0); - instr->bits3.ia16.src1_swz_y = BRW_GET_SWZ(SWIZZLE(src->reg), 1); - instr->bits3.ia16.src1_swz_z = BRW_GET_SWZ(SWIZZLE(src->reg), 2); - instr->bits3.ia16.src1_swz_w = BRW_GET_SWZ(SWIZZLE(src->reg), 3); - instr->bits3.ia16.src1_indirect_offset = (src->reg.dw1.bits.indirect_offset >> 4); /* half register aligned */ - instr->bits3.ia16.src1_subreg_nr = get_indirect_subreg_address(src->reg.subnr); - instr->bits3.ia16.src1_abs = src->reg.abs; - instr->bits3.ia16.src1_negate = src->reg.negate; - instr->bits3.ia16.src1_address_mode = src->reg.address_mode; - instr->bits3.ia16.src1_vert_stride = src->reg.vstride; - } - } + /* the assembler support expressing subnr in bytes or in number of + * elements. */ + resolve_subnr(&src->reg); + + brw_set_src1(&genasm_compile, instr, src->reg); return 0; }
Signature · 1 line
1.7.7.5
PATCH 68/90 assembler: Renamed the instruction field to insn
In reply to Damien LespiauThis will be less typing for the refactoring to come (which is use struct brw_program_instruction in gram.y for the type of all the instructions).
--- assembler/disasm-main.c | 6 +++--- assembler/gen4asm.h | 4 ++-- assembler/gram.y | 6 +++--- assembler/main.c | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-)
assembler/disasm-main.c +3 -3
@@ -51,7 +51,7 @@ read_program (FILE *input) ++n;if (n ==4 ) { entry =malloc (sizeof (struct brw_program_instruction )); -memcpy (&entry->instruction, inst,4 *sizeof (uint32_t )); +memcpy (&entry->insn, inst,4 *sizeof (uint32_t )); entry->next =NULL ; *prev = entry; prev = &entry->next;
@@ -82,7 +82,7 @@ read_program_binary (FILE *input) inst[n++] = (uint8_t )temp;if (n ==16 ) { entry =malloc (sizeof (struct brw_program_instruction )); -memcpy (&entry->instruction, inst,16 *sizeof (uint8_t )); +memcpy (&entry->insn, inst,16 *sizeof (uint8_t )); entry->next =NULL ; *prev = entry; prev = &entry->next;
@@ -167,6 +167,6 @@ int main(int argc, char **argv) }for (inst = program->first; inst; inst = inst->next) -brw_disasm (output, &inst->instruction.gen, gen); +brw_disasm (output, &inst->insn.gen, gen);exit (0 ); }
assembler/gen4asm.h +2 -2
@@ -143,7 +143,7 @@ struct brw_program_instruction {struct brw_instruction gen;struct relocatable_instruction reloc;struct label_instruction label; - } instruction; + } insn;struct brw_program_instruction *next; };
@@ -155,7 +155,7 @@ static inline bool is_label(struct brw_program_instruction *instruction)static inline char *label_name (struct brw_program_instruction *i) {assert (is_label (i)); -return i->instruction.label.name; +return i->insn.label.name; }static inline bool is_relocatable (struct brw_program_instruction *intruction)
assembler/gram.y +3 -3
@@ -201,7 +201,7 @@ static void brw_program_add_instruction(struct brw_program *p, list_entry = calloc(sizeof(struct brw_program_instruction), 1); list_entry->type = GEN4ASM_INSTRUCTION_GEN; - list_entry->instruction.gen = *instruction; + list_entry->insn.gen = *instruction; brw_program_append_entry(p, list_entry); }
@@ -212,7 +212,7 @@ static void brw_program_add_relocatable(struct brw_program *p, list_entry = calloc(sizeof(struct brw_program_instruction), 1); list_entry->type = GEN4ASM_INSTRUCTION_GEN_RELOCATABLE; - list_entry->instruction.reloc = *reloc; + list_entry->insn.reloc = *reloc; brw_program_append_entry(p, list_entry); }
@@ -222,7 +222,7 @@ static void brw_program_add_label(struct brw_program *p, const char *label) list_entry = calloc(sizeof(struct brw_program_instruction), 1); list_entry->type = GEN4ASM_INSTRUCTION_LABEL; - list_entry->instruction.label.name = strdup(label); + list_entry->insn.label.name = strdup(label); brw_program_append_entry(p, list_entry); }
assembler/main.c +5 -5
@@ -237,7 +237,7 @@ static int is_entry_point(struct brw_program_instruction *i)assert (i->type ==GEN4ASM_INSTRUCTION_LABEL );for (p = entry_point_table; p; p = p->next) { -if (strcmp (p->str, i->instruction.label.name) ==0 ) +if (strcmp (p->str, i->insn.label.name) ==0 )return 1 ; }return 0 ;
@@ -406,7 +406,7 @@ int main(int argc, char **argv)// insert NOP instructions until (inst_offset+1) % 4 == 0 while (((inst_offset+1 ) %4 ) !=0 ) { tmp_entry =calloc (sizeof (*tmp_entry),1 ); - tmp_entry->instruction.gen.header.opcode =BRW_OPCODE_NOP ; + tmp_entry->insn.gen.header.opcode =BRW_OPCODE_NOP ; entry->next = tmp_entry; tmp_entry->next = entry1; entry = tmp_entry;
@@ -437,7 +437,7 @@ int main(int argc, char **argv) }for (entry = compiled_program.first; entry; entry = entry->next) { -struct relocatable_instruction *reloc = &entry->instruction.reloc; +struct relocatable_instruction *reloc = &entry->insn.reloc;struct brw_instruction *inst = &reloc->gen;if (!is_relocatable (entry))
@@ -497,9 +497,9 @@ int main(int argc, char **argv) entry = entry1) { entry1 = entry->next;if (!is_label (entry)) -print_instruction (output, &entry->instruction.gen); +print_instruction (output, &entry->insn.gen);else -free (entry->instruction.label.name); +free (entry->insn.label.name);free (entry); }if (binary_like_output)
Signature · 1 line
1.7.7.5
PATCH 69/90 assembler: Unify all instructions to be brw_program_instructions
In reply to Damien LespiauTime to finally unify all instructions on the same structure.
--- assembler/gram.y | 880 +++++++++++++++++++++++++++--------------------------- 1 files changed, 441 insertions(+), 439 deletions(-)
assembler/gram.y +441 -439
@@ -40,6 +40,8 @@ #define SWIZZLE(reg) (reg.dw1.bits.swizzle) +#define GEN(i) (&(i)->insn.gen) + #define YYLTYPE YYLTYPE typedef struct YYLTYPE {
@@ -80,26 +82,26 @@ static struct src_operand ip_src = }; static int get_type_size(GLuint type); -static int set_instruction_dest(struct brw_instruction *instr, +static int set_instruction_dest(struct brw_program_instruction *instr, struct brw_reg *dest); -static int set_instruction_src0(struct brw_instruction *instr, +static int set_instruction_src0(struct brw_program_instruction *instr, struct src_operand *src, YYLTYPE *location); -static int set_instruction_src1(struct brw_instruction *instr, +static int set_instruction_src1(struct brw_program_instruction *instr, struct src_operand *src, YYLTYPE *location); -static int set_instruction_dest_three_src(struct brw_instruction *instr, +static int set_instruction_dest_three_src(struct brw_program_instruction *instr, struct brw_reg *dest); -static int set_instruction_src0_three_src(struct brw_instruction *instr, +static int set_instruction_src0_three_src(struct brw_program_instruction *instr, struct src_operand *src); -static int set_instruction_src1_three_src(struct brw_instruction *instr, +static int set_instruction_src1_three_src(struct brw_program_instruction *instr, struct src_operand *src); -static int set_instruction_src2_three_src(struct brw_instruction *instr, +static int set_instruction_src2_three_src(struct brw_program_instruction *instr, struct src_operand *src); -static void set_instruction_options(struct brw_instruction *instr, - struct brw_instruction *options); -static void set_instruction_predicate(struct brw_instruction *instr, - struct brw_instruction *predicate); +static void set_instruction_options(struct brw_program_instruction *instr, + struct brw_program_instruction *options); +static void set_instruction_predicate(struct brw_program_instruction *instr, + struct brw_program_instruction *p); static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, int type); static void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg,
@@ -194,25 +196,26 @@ static void brw_program_append_entry(struct brw_program *p, p->last = entry; } -static void brw_program_add_instruction(struct brw_program *p, - struct brw_instruction *instruction) +static void +brw_program_add_instruction(struct brw_program *p, + struct brw_program_instruction *instruction) { struct brw_program_instruction *list_entry; list_entry = calloc(sizeof(struct brw_program_instruction), 1); list_entry->type = GEN4ASM_INSTRUCTION_GEN; - list_entry->insn.gen = *instruction; + list_entry->insn.gen = instruction->insn.gen; brw_program_append_entry(p, list_entry); } static void brw_program_add_relocatable(struct brw_program *p, - struct relocatable_instruction *reloc) + struct brw_program_instruction *reloc) { struct brw_program_instruction *list_entry; list_entry = calloc(sizeof(struct brw_program_instruction), 1); list_entry->type = GEN4ASM_INSTRUCTION_GEN_RELOCATABLE; - list_entry->insn.reloc = *reloc; + list_entry->insn.reloc = reloc->insn.reloc; brw_program_append_entry(p, list_entry); }
@@ -385,8 +388,7 @@ static void resolve_subnr(struct brw_reg *reg) char *string; int integer; double number; - struct brw_instruction instruction; - struct relocatable_instruction relocatable; + struct brw_program_instruction instruction; struct brw_program program; struct region region; struct regtype regtype;
@@ -474,9 +476,9 @@ static void resolve_subnr(struct brw_reg *reg) %type <instruction> instoptions instoption_list predicate %type <instruction> mathinstruction %type <instruction> nopinstruction -%type <relocatable> relocatableinstruction breakinstruction -%type <relocatable> ifelseinstruction loopinstruction haltinstruction -%type <relocatable> multibranchinstruction subroutineinstruction jumpinstruction +%type <instruction> relocatableinstruction breakinstruction +%type <instruction> ifelseinstruction loopinstruction haltinstruction +%type <instruction> multibranchinstruction subroutineinstruction jumpinstruction %type <string> label %type <program> instrseq %type <integer> instoption
@@ -707,11 +709,11 @@ ifelseinstruction: ENDIF if(IS_GENp(6)) // For gen6+. error(&@1, "should be 'ENDIF execsize relativelocation'\n"); memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $1; - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; - $$.gen.bits1.da1.dest_horiz_stride = 1; - $$.gen.bits1.da1.src1_reg_file = BRW_ARCHITECTURE_REGISTER_FILE; - $$.gen.bits1.da1.src1_reg_type = BRW_REGISTER_TYPE_UD; + GEN(&$$)->header.opcode = $1; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; + GEN(&$$)->bits1.da1.dest_horiz_stride = 1; + GEN(&$$)->bits1.da1.src1_reg_file = BRW_ARCHITECTURE_REGISTER_FILE; + GEN(&$$)->bits1.da1.src1_reg_type = BRW_REGISTER_TYPE_UD; } | ENDIF execsize relativelocation instoptions {
@@ -720,10 +722,10 @@ ifelseinstruction: ENDIF if(!IS_GENp(6)) // for gen6- error(&@1, "ENDIF Syntax error: should be 'ENDIF'\n"); memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $1; - $$.gen.header.execution_size = $2; - $$.first_reloc_target = $3.reloc_target; - $$.first_reloc_offset = $3.imm32; + GEN(&$$)->header.opcode = $1; + GEN(&$$)->header.execution_size = $2; + $$.insn.reloc.first_reloc_target = $3.reloc_target; + $$.insn.reloc.first_reloc_offset = $3.imm32; } | ELSE execsize relativelocation instoptions {
@@ -733,20 +735,20 @@ ifelseinstruction: ENDIF $3.imm32 |= (1 << 16); memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $1; - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; + GEN(&$$)->header.opcode = $1; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; ip_dst.width = $2; - set_instruction_dest(&$$.gen, &ip_dst); - set_instruction_src0(&$$.gen, &ip_src, NULL); - set_instruction_src1(&$$.gen, &$3, NULL); - $$.first_reloc_target = $3.reloc_target; - $$.first_reloc_offset = $3.imm32; + set_instruction_dest(&$$, &ip_dst); + set_instruction_src0(&$$, &ip_src, NULL); + set_instruction_src1(&$$, &$3, NULL); + $$.insn.reloc.first_reloc_target = $3.reloc_target; + $$.insn.reloc.first_reloc_offset = $3.imm32; } else if(IS_GENp(6)) { memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $1; - $$.gen.header.execution_size = $2; - $$.first_reloc_target = $3.reloc_target; - $$.first_reloc_offset = $3.imm32; + GEN(&$$)->header.opcode = $1; + GEN(&$$)->header.execution_size = $2; + $$.insn.reloc.first_reloc_target = $3.reloc_target; + $$.insn.reloc.first_reloc_offset = $3.imm32; } else { error(&@1, "'ELSE' instruction is not implemented.\n"); }
@@ -762,17 +764,17 @@ ifelseinstruction: ENDIF error(&@2, "IF should be 'IF execsize JIP UIP'\n"); memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; if(!IS_GENp(6)) { - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; ip_dst.width = $3; - set_instruction_dest(&$$.gen, &ip_dst); - set_instruction_src0(&$$.gen, &ip_src, NULL); - set_instruction_src1(&$$.gen, &$4, NULL); + set_instruction_dest(&$$, &ip_dst); + set_instruction_src0(&$$, &ip_src, NULL); + set_instruction_src1(&$$, &$4, NULL); } - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; } | predicate IF execsize relativelocation relativelocation {
@@ -781,13 +783,13 @@ ifelseinstruction: ENDIF error(&@2, "IF should be 'IF execsize relativelocation'\n"); memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.execution_size = $3; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; - $$.second_reloc_target = $5.reloc_target; - $$.second_reloc_offset = $5.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.execution_size = $3; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; + $$.insn.reloc.second_reloc_target = $5.reloc_target; + $$.insn.reloc.second_reloc_offset = $5.imm32; } ;
@@ -800,25 +802,25 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions * to the pre-incremented IP. */ ip_dst.width = $3; - set_instruction_dest(&$$.gen, &ip_dst); + set_instruction_dest(&$$, &ip_dst); memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; - set_instruction_src0(&$$.gen, &ip_src, NULL); - set_instruction_src1(&$$.gen, &$4, NULL); - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; + set_instruction_src0(&$$, &ip_src, NULL); + set_instruction_src1(&$$, &$4, NULL); + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; } else if (IS_GENp(6)) { /* Gen6 spec: dest must have the same element size as src0. dest horizontal stride must be 1. */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.execution_size = $3; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.execution_size = $3; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; } else { error(&@2, "'WHILE' instruction is not implemented!\n"); }
@@ -827,7 +829,7 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions { // deprecated memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $1; + GEN(&$$)->header.opcode = $1; }; haltinstruction: predicate HALT execsize relativelocation relativelocation instoptions
@@ -835,15 +837,15 @@ haltinstruction: predicate HALT execsize relativelocation relativelocation insto // for Gen6, Gen7 /* Gen6, Gen7 bspec: dst and src0 must be the null reg. */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; - $$.second_reloc_target = $5.reloc_target; - $$.second_reloc_offset = $5.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; + $$.insn.reloc.second_reloc_target = $5.reloc_target; + $$.insn.reloc.second_reloc_offset = $5.imm32; dst_null_reg.width = $3; - set_instruction_dest(&$$.gen, &dst_null_reg); - set_instruction_src0(&$$.gen, &src_null_reg, NULL); + set_instruction_dest(&$$, &dst_null_reg); + set_instruction_src0(&$$, &src_null_reg, NULL); }; multibranchinstruction:
@@ -851,28 +853,28 @@ multibranchinstruction: { /* Gen7 bspec: dest must be null. use Switch option */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; dst_null_reg.width = $3; - set_instruction_dest(&$$.gen, &dst_null_reg); + set_instruction_dest(&$$, &dst_null_reg); } | predicate BRC execsize relativelocation relativelocation instoptions { /* Gen7 bspec: dest must be null. src0 must be null. use Switch option */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.thread_control |= BRW_THREAD_SWITCH; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; - $$.second_reloc_target = $5.reloc_target; - $$.second_reloc_offset = $5.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; + $$.insn.reloc.second_reloc_target = $5.reloc_target; + $$.insn.reloc.second_reloc_offset = $5.imm32; dst_null_reg.width = $3; - set_instruction_dest(&$$.gen, &dst_null_reg); - set_instruction_src0(&$$.gen, &src_null_reg, NULL); + set_instruction_dest(&$$, &dst_null_reg); + set_instruction_src0(&$$, &src_null_reg, NULL); } ;
@@ -894,12 +896,12 @@ subroutineinstruction: execution size must be 2. */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; $4.type = BRW_REGISTER_TYPE_D; /* dest type should be DWORD */ $4.width = 1; /* execution size must be 2. Here 1 is encoded 2. */ - set_instruction_dest(&$$.gen, &$4); + set_instruction_dest(&$$, &$4); struct src_operand src0; memset(&src0, 0, sizeof(src0));
@@ -908,10 +910,10 @@ subroutineinstruction: src0.reg.hstride = 1; /*encoded 1*/ src0.reg.width = 1; /*encoded 2*/ src0.reg.vstride = 2; /*encoded 2*/ - set_instruction_src0(&$$.gen, &src0, NULL); + set_instruction_src0(&$$, &src0, NULL); - $$.first_reloc_target = $5.reloc_target; - $$.first_reloc_offset = $5.imm32; + $$.insn.reloc.first_reloc_target = $5.reloc_target; + $$.insn.reloc.first_reloc_offset = $5.imm32; } | predicate RET execsize dstoperandex src instoptions {
@@ -922,15 +924,15 @@ subroutineinstruction: src0 region control must be <2,2,1> (not specified clearly. should be same as CALL) */ memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; dst_null_reg.width = 1; /* execution size of RET should be 2 */ - set_instruction_dest(&$$.gen, &dst_null_reg); + set_instruction_dest(&$$, &dst_null_reg); $5.reg.type = BRW_REGISTER_TYPE_D; $5.reg.hstride = 1; /*encoded 1*/ $5.reg.width = 1; /*encoded 2*/ $5.reg.vstride = 2; /*encoded 2*/ - set_instruction_src0(&$$.gen, &$5, NULL); + set_instruction_src0(&$$, &$5, NULL); } ;
@@ -939,9 +941,9 @@ unaryinstruction: dst srcaccimm instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $3.cond; - $$.header.saturate = $4; + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $3.cond; + GEN(&$$)->header.saturate = $4; $6.width = $5; set_instruction_options(&$$, &$8); set_instruction_predicate(&$$, &$1);
@@ -951,20 +953,20 @@ unaryinstruction: YYERROR; if ($3.flag_subreg_nr != -1) { - if ($$.header.predicate_control != BRW_PREDICATE_NONE && - ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || - $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) + if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && + (GEN(&$1)->bits2.da1.flag_reg_nr != $3.flag_reg_nr || + GEN(&$1)->bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) warn(ALWAYS, &@3, "must use the same flag register if " "both prediction and conditional modifier are " "enabled\n"); - $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; - $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; + GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; + GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; } if (!IS_GENp(6) && - get_type_size($$.bits1.da1.dest_reg_type) * (1 << $6.width) == 64) - $$.header.compression_control = BRW_COMPRESSION_COMPRESSED; + get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) + GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED; } ;
@@ -978,9 +980,9 @@ binaryinstruction: dst src srcimm instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $3.cond; - $$.header.saturate = $4; + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $3.cond; + GEN(&$$)->header.saturate = $4; set_instruction_options(&$$, &$9); set_instruction_predicate(&$$, &$1); $6.width = $5;
@@ -992,20 +994,20 @@ binaryinstruction: YYERROR; if ($3.flag_subreg_nr != -1) { - if ($$.header.predicate_control != BRW_PREDICATE_NONE && - ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || - $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) + if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && + (GEN(&$1)->bits2.da1.flag_reg_nr != $3.flag_reg_nr || + GEN(&$1)->bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) warn(ALWAYS, &@3, "must use the same flag register if " "both prediction and conditional modifier are " "enabled\n"); - $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; - $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; + GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; + GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; } if (!IS_GENp(6) && - get_type_size($$.bits1.da1.dest_reg_type) * (1 << $6.width) == 64) - $$.header.compression_control = BRW_COMPRESSION_COMPRESSED; + get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) + GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED; } ;
@@ -1019,9 +1021,9 @@ binaryaccinstruction: dst srcacc srcimm instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $3.cond; - $$.header.saturate = $4; + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $3.cond; + GEN(&$$)->header.saturate = $4; $6.width = $5; set_instruction_options(&$$, &$9); set_instruction_predicate(&$$, &$1);
@@ -1033,20 +1035,20 @@ binaryaccinstruction: YYERROR; if ($3.flag_subreg_nr != -1) { - if ($$.header.predicate_control != BRW_PREDICATE_NONE && - ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || - $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) + if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && + (GEN(&$1)->bits2.da1.flag_reg_nr != $3.flag_reg_nr || + GEN(&$1)->bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) warn(ALWAYS, &@3, "must use the same flag register if " "both prediction and conditional modifier are " "enabled\n"); - $$.bits2.da1.flag_reg_nr = $3.flag_reg_nr; - $$.bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; + GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; + GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; } if (!IS_GENp(6) && - get_type_size($$.bits1.da1.dest_reg_type) * (1 << $6.width) == 64) - $$.header.compression_control = BRW_COMPRESSION_COMPRESSED; + get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) + GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED; } ;
@@ -1063,15 +1065,15 @@ trinaryinstruction: { memset(&$$, 0, sizeof($$)); - $$.header.predicate_control = $1.header.predicate_control; - $$.header.predicate_inverse = $1.header.predicate_inverse; - $$.bits1.da3src.flag_reg_nr = $1.bits2.da1.flag_reg_nr; - $$.bits1.da3src.flag_subreg_nr = $1.bits2.da1.flag_subreg_nr; + GEN(&$$)->header.predicate_control = GEN(&$1)->header.predicate_control; + GEN(&$$)->header.predicate_inverse = GEN(&$1)->header.predicate_inverse; + GEN(&$$)->bits1.da3src.flag_reg_nr = GEN(&$1)->bits2.da1.flag_reg_nr; + GEN(&$$)->bits1.da3src.flag_subreg_nr = GEN(&$1)->bits2.da1.flag_subreg_nr; - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $3.cond; - $$.header.saturate = $4; - $$.header.execution_size = $5; + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $3.cond; + GEN(&$$)->header.saturate = $4; + GEN(&$$)->header.execution_size = $5; if (set_instruction_dest_three_src(&$$, &$6)) YYERROR;
@@ -1084,9 +1086,9 @@ trinaryinstruction: set_instruction_options(&$$, &$10); if ($3.flag_subreg_nr != -1) { - if ($$.header.predicate_control != BRW_PREDICATE_NONE && - ($1.bits2.da1.flag_reg_nr != $3.flag_reg_nr || - $1.bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) + if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && + (GEN(&$1)->bits2.da1.flag_reg_nr != $3.flag_reg_nr || + GEN(&$1)->bits2.da1.flag_subreg_nr != $3.flag_subreg_nr)) warn(ALWAYS, &@3, "must use the same flag register if " "both prediction and conditional modifier are " "enabled\n");
@@ -1107,9 +1109,9 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget * implicitly loaded if non-null. */ memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; + GEN(&$$)->header.opcode = $2; $5.width = $3; - $$.header.destreg__conditionalmod = $4; /* msg reg index */ + GEN(&$$)->header.destreg__conditionalmod = $4; /* msg reg index */ set_instruction_predicate(&$$, &$1); if (set_instruction_dest(&$$, &$5) != 0) YYERROR;
@@ -1134,37 +1136,37 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; } - $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - $$.bits1.da1.src1_reg_type = BRW_REGISTER_TYPE_D; + GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; + GEN(&$$)->bits1.da1.src1_reg_type = BRW_REGISTER_TYPE_D; if (IS_GENp(5)) { if (IS_GENp(6)) { - $$.header.destreg__conditionalmod = $7.bits2.send_gen5.sfid; + GEN(&$$)->header.destreg__conditionalmod = GEN(&$7)->bits2.send_gen5.sfid; } else { - $$.header.destreg__conditionalmod = $4; /* msg reg index */ - $$.bits2.send_gen5.sfid = $7.bits2.send_gen5.sfid; - $$.bits2.send_gen5.end_of_thread = $12.bits3.generic_gen5.end_of_thread; + GEN(&$$)->header.destreg__conditionalmod = $4; /* msg reg index */ + GEN(&$$)->bits2.send_gen5.sfid = GEN(&$7)->bits2.send_gen5.sfid; + GEN(&$$)->bits2.send_gen5.end_of_thread = GEN(&$12)->bits3.generic_gen5.end_of_thread; } - $$.bits3.generic_gen5 = $7.bits3.generic_gen5; - $$.bits3.generic_gen5.msg_length = $9; - $$.bits3.generic_gen5.response_length = $11; - $$.bits3.generic_gen5.end_of_thread = - $12.bits3.generic_gen5.end_of_thread; + GEN(&$$)->bits3.generic_gen5 = GEN(&$7)->bits3.generic_gen5; + GEN(&$$)->bits3.generic_gen5.msg_length = $9; + GEN(&$$)->bits3.generic_gen5.response_length = $11; + GEN(&$$)->bits3.generic_gen5.end_of_thread = + GEN(&$12)->bits3.generic_gen5.end_of_thread; } else { - $$.header.destreg__conditionalmod = $4; /* msg reg index */ - $$.bits3.generic = $7.bits3.generic; - $$.bits3.generic.msg_length = $9; - $$.bits3.generic.response_length = $11; - $$.bits3.generic.end_of_thread = - $12.bits3.generic.end_of_thread; + GEN(&$$)->header.destreg__conditionalmod = $4; /* msg reg index */ + GEN(&$$)->bits3.generic = GEN(&$7)->bits3.generic; + GEN(&$$)->bits3.generic.msg_length = $9; + GEN(&$$)->bits3.generic.response_length = $11; + GEN(&$$)->bits3.generic.end_of_thread = + GEN(&$12)->bits3.generic.end_of_thread; } } | predicate SEND execsize dst sendleadreg payload directsrcoperand instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $5.nr; /* msg reg index */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1187,8 +1189,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget "type=%d\n", $7.reg.dw1.ud, $7.reg.type); } memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $5.nr; /* msg reg index */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1); $4.width = $3;
@@ -1196,9 +1198,9 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; if (set_instruction_src0(&$$, &$6, &@6) != 0) YYERROR; - $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - $$.bits1.da1.src1_reg_type = $7.reg.type; - $$.bits3.ud = $7.reg.dw1.ud; + GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; + GEN(&$$)->bits1.da1.src1_reg_type = $7.reg.type; + GEN(&$$)->bits3.ud = $7.reg.dw1.ud; } | predicate SEND execsize dst sendleadreg sndopr imm32reg instoptions {
@@ -1215,8 +1217,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget } memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1); $4.width = $3;
@@ -1238,10 +1240,10 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget src0.reg.subnr = 0; set_instruction_src0(&$$, &src0, NULL); - $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - $$.bits1.da1.src1_reg_type = $7.reg.type; - $$.bits3.ud = $7.reg.dw1.ud; - $$.bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); + GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; + GEN(&$$)->bits1.da1.src1_reg_type = $7.reg.type; + GEN(&$$)->bits3.ud = $7.reg.dw1.ud; + GEN(&$$)->bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); } | predicate SEND execsize dst sendleadreg sndopr directsrcoperand instoptions {
@@ -1258,8 +1260,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget } memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1); $4.width = $3;
@@ -1282,7 +1284,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget set_instruction_src0(&$$, &src0, NULL); set_instruction_src1(&$$, &$7, &@7); - $$.bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); + GEN(&$$)->bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); } | predicate SEND execsize dst sendleadreg payload sndopr imm32reg instoptions {
@@ -1293,8 +1295,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget "type=%d\n", $8.reg.dw1.ud, $8.reg.type); } memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $5.nr; /* msg reg index */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1); $4.width = $3;
@@ -1302,21 +1304,21 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; if (set_instruction_src0(&$$, &$6, &@6) != 0) YYERROR; - $$.bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - $$.bits1.da1.src1_reg_type = $8.reg.type; + GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; + GEN(&$$)->bits1.da1.src1_reg_type = $8.reg.type; if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = ($7 & EX_DESC_SFID_MASK); - $$.bits3.ud = $8.reg.dw1.ud; - $$.bits3.generic_gen5.end_of_thread = !!($7 & EX_DESC_EOT_MASK); + GEN(&$$)->bits2.send_gen5.sfid = ($7 & EX_DESC_SFID_MASK); + GEN(&$$)->bits3.ud = $8.reg.dw1.ud; + GEN(&$$)->bits3.generic_gen5.end_of_thread = !!($7 & EX_DESC_EOT_MASK); } else - $$.bits3.ud = $8.reg.dw1.ud; + GEN(&$$)->bits3.ud = $8.reg.dw1.ud; } | predicate SEND execsize dst sendleadreg payload exp directsrcoperand instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $5.nr; /* msg reg index */ + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1329,7 +1331,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget if (set_instruction_src1(&$$, &$8, &@8) != 0) YYERROR; if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = $7; + GEN(&$$)->bits2.send_gen5.sfid = $7; } }
@@ -1349,24 +1351,24 @@ jumpinstruction: predicate JMPI execsize relativelocation2 * is the post-incremented IP plus the offset. */ memset(&$$, 0, sizeof($$)); - $$.gen.header.opcode = $2; + GEN(&$$)->header.opcode = $2; if(advanced_flag) - $$.gen.header.mask_control = BRW_MASK_DISABLE; - set_instruction_predicate(&$$.gen, &$1); + GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; + set_instruction_predicate(&$$, &$1); ip_dst.width = ffs(1) - 1; - set_instruction_dest(&$$.gen, &ip_dst); - set_instruction_src0(&$$.gen, &ip_src, NULL); - set_instruction_src1(&$$.gen, &$4, NULL); - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; + set_instruction_dest(&$$, &ip_dst); + set_instruction_src0(&$$, &ip_src, NULL); + set_instruction_src1(&$$, &$4, NULL); + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; } ; mathinstruction: predicate MATH_INST execsize dst src srcimm math_function instoptions { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; - $$.header.destreg__conditionalmod = $7; + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.destreg__conditionalmod = $7; set_instruction_options(&$$, &$8); set_instruction_predicate(&$$, &$1); $4.width = $3;
@@ -1383,13 +1385,13 @@ breakinstruction: predicate breakop execsize relativelocation relativelocation i { // for Gen6, Gen7 memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$.gen, &$1); - $$.gen.header.opcode = $2; - $$.gen.header.execution_size = $3; - $$.first_reloc_target = $4.reloc_target; - $$.first_reloc_offset = $4.imm32; - $$.second_reloc_target = $5.reloc_target; - $$.second_reloc_offset = $5.imm32; + set_instruction_predicate(&$$, &$1); + GEN(&$$)->header.opcode = $2; + GEN(&$$)->header.execution_size = $3; + $$.insn.reloc.first_reloc_target = $4.reloc_target; + $$.insn.reloc.first_reloc_offset = $4.imm32; + $$.insn.reloc.second_reloc_target = $5.reloc_target; + $$.insn.reloc.second_reloc_offset = $5.imm32; } ;
@@ -1407,7 +1409,7 @@ syncinstruction: predicate WAIT notifyreg struct src_operand notify_src; memset(&$$, 0, sizeof($$)); - $$.header.opcode = $2; + GEN(&$$)->header.opcode = $2; set_direct_dst_operand(¬ify_dst, &$3, BRW_REGISTER_TYPE_D); notify_dst.width = ffs(1) - 1; set_instruction_dest(&$$, ¬ify_dst);
@@ -1421,7 +1423,7 @@ syncinstruction: predicate WAIT notifyreg nopinstruction: NOP { memset(&$$, 0, sizeof($$)); - $$.header.opcode = $1; + GEN(&$$)->header.opcode = $1; }; /* XXX! */
@@ -1434,42 +1436,42 @@ post_dst: dst msgtarget: NULL_TOKEN { if (IS_GENp(5)) { - $$.bits2.send_gen5.sfid= BRW_SFID_NULL; - $$.bits3.generic_gen5.header_present = 0; /* ??? */ + GEN(&$$)->bits2.send_gen5.sfid= BRW_SFID_NULL; + GEN(&$$)->bits3.generic_gen5.header_present = 0; /* ??? */ } else { - $$.bits3.generic.msg_target = BRW_SFID_NULL; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_NULL; } } | SAMPLER LPAREN INTEGER COMMA INTEGER COMMA sampler_datatype RPAREN { if (IS_GENp(7)) { - $$.bits2.send_gen5.sfid = BRW_SFID_SAMPLER; - $$.bits3.generic_gen5.header_present = 1; /* ??? */ - $$.bits3.sampler_gen7.binding_table_index = $3; - $$.bits3.sampler_gen7.sampler = $5; - $$.bits3.sampler_gen7.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */ + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_SAMPLER; + GEN(&$$)->bits3.generic_gen5.header_present = 1; /* ??? */ + GEN(&$$)->bits3.sampler_gen7.binding_table_index = $3; + GEN(&$$)->bits3.sampler_gen7.sampler = $5; + GEN(&$$)->bits3.sampler_gen7.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */ } else if (IS_GENp(5)) { - $$.bits2.send_gen5.sfid = BRW_SFID_SAMPLER; - $$.bits3.generic_gen5.header_present = 1; /* ??? */ - $$.bits3.sampler_gen5.binding_table_index = $3; - $$.bits3.sampler_gen5.sampler = $5; - $$.bits3.sampler_gen5.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */ + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_SAMPLER; + GEN(&$$)->bits3.generic_gen5.header_present = 1; /* ??? */ + GEN(&$$)->bits3.sampler_gen5.binding_table_index = $3; + GEN(&$$)->bits3.sampler_gen5.sampler = $5; + GEN(&$$)->bits3.sampler_gen5.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */ } else { - $$.bits3.generic.msg_target = BRW_SFID_SAMPLER; - $$.bits3.sampler.binding_table_index = $3; - $$.bits3.sampler.sampler = $5; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_SAMPLER; + GEN(&$$)->bits3.sampler.binding_table_index = $3; + GEN(&$$)->bits3.sampler.sampler = $5; switch ($7) { case TYPE_F: - $$.bits3.sampler.return_format = + GEN(&$$)->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32; break; case TYPE_UD: - $$.bits3.sampler.return_format = + GEN(&$$)->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_UINT32; break; case TYPE_D: - $$.bits3.sampler.return_format = + GEN(&$$)->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_SINT32; break; }
@@ -1480,208 +1482,208 @@ msgtarget: NULL_TOKEN if (IS_GENp(6)) { error (&@1, "Gen6+ doesn't have math function\n"); } else if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = BRW_SFID_MATH; - $$.bits3.generic_gen5.header_present = 0; - $$.bits3.math_gen5.function = $2; + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_MATH; + GEN(&$$)->bits3.generic_gen5.header_present = 0; + GEN(&$$)->bits3.math_gen5.function = $2; if ($3 == BRW_INSTRUCTION_SATURATE) - $$.bits3.math_gen5.saturate = 1; + GEN(&$$)->bits3.math_gen5.saturate = 1; else - $$.bits3.math_gen5.saturate = 0; - $$.bits3.math_gen5.int_type = $4; - $$.bits3.math_gen5.precision = BRW_MATH_PRECISION_FULL; - $$.bits3.math_gen5.data_type = $5; + GEN(&$$)->bits3.math_gen5.saturate = 0; + GEN(&$$)->bits3.math_gen5.int_type = $4; + GEN(&$$)->bits3.math_gen5.precision = BRW_MATH_PRECISION_FULL; + GEN(&$$)->bits3.math_gen5.data_type = $5; } else { - $$.bits3.generic.msg_target = BRW_SFID_MATH; - $$.bits3.math.function = $2; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_MATH; + GEN(&$$)->bits3.math.function = $2; if ($3 == BRW_INSTRUCTION_SATURATE) - $$.bits3.math.saturate = 1; + GEN(&$$)->bits3.math.saturate = 1; else - $$.bits3.math.saturate = 0; - $$.bits3.math.int_type = $4; - $$.bits3.math.precision = BRW_MATH_PRECISION_FULL; - $$.bits3.math.data_type = $5; + GEN(&$$)->bits3.math.saturate = 0; + GEN(&$$)->bits3.math.int_type = $4; + GEN(&$$)->bits3.math.precision = BRW_MATH_PRECISION_FULL; + GEN(&$$)->bits3.math.data_type = $5; } } | GATEWAY { if (IS_GENp(5)) { - $$.bits2.send_gen5.sfid = BRW_SFID_MESSAGE_GATEWAY; - $$.bits3.generic_gen5.header_present = 0; /* ??? */ + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_MESSAGE_GATEWAY; + GEN(&$$)->bits3.generic_gen5.header_present = 0; /* ??? */ } else { - $$.bits3.generic.msg_target = BRW_SFID_MESSAGE_GATEWAY; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_MESSAGE_GATEWAY; } } | READ LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN { if (IS_GENx(7)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_SAMPLER_CACHE; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.gen7_dp.binding_table_index = $3; - $$.bits3.gen7_dp.msg_control = $7; - $$.bits3.gen7_dp.msg_type = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.gen7_dp.binding_table_index = $3; + GEN(&$$)->bits3.gen7_dp.msg_control = $7; + GEN(&$$)->bits3.gen7_dp.msg_type = $9; } else if (IS_GENx(6)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_SAMPLER_CACHE; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.gen6_dp_sampler_const_cache.binding_table_index = $3; - $$.bits3.gen6_dp_sampler_const_cache.msg_control = $7; - $$.bits3.gen6_dp_sampler_const_cache.msg_type = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.gen6_dp_sampler_const_cache.binding_table_index = $3; + GEN(&$$)->bits3.gen6_dp_sampler_const_cache.msg_control = $7; + GEN(&$$)->bits3.gen6_dp_sampler_const_cache.msg_type = $9; } else if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_DATAPORT_READ; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_read_gen5.binding_table_index = $3; - $$.bits3.dp_read_gen5.target_cache = $5; - $$.bits3.dp_read_gen5.msg_control = $7; - $$.bits3.dp_read_gen5.msg_type = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.dp_read_gen5.binding_table_index = $3; + GEN(&$$)->bits3.dp_read_gen5.target_cache = $5; + GEN(&$$)->bits3.dp_read_gen5.msg_control = $7; + GEN(&$$)->bits3.dp_read_gen5.msg_type = $9; } else { - $$.bits3.generic.msg_target = + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_DATAPORT_READ; - $$.bits3.dp_read.binding_table_index = $3; - $$.bits3.dp_read.target_cache = $5; - $$.bits3.dp_read.msg_control = $7; - $$.bits3.dp_read.msg_type = $9; + GEN(&$$)->bits3.dp_read.binding_table_index = $3; + GEN(&$$)->bits3.dp_read.target_cache = $5; + GEN(&$$)->bits3.dp_read.msg_control = $7; + GEN(&$$)->bits3.dp_read.msg_type = $9; } } | WRITE LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN { if (IS_GENx(7)) { - $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.gen7_dp.binding_table_index = $3; - $$.bits3.gen7_dp.msg_control = $5; - $$.bits3.gen7_dp.msg_type = $7; + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.gen7_dp.binding_table_index = $3; + GEN(&$$)->bits3.gen7_dp.msg_control = $5; + GEN(&$$)->bits3.gen7_dp.msg_type = $7; } else if (IS_GENx(6)) { - $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; /* Sandybridge supports headerlesss message for render target write. * Currently the GFX assembler doesn't support it. so the program must provide * message header */ - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.gen6_dp.binding_table_index = $3; - $$.bits3.gen6_dp.msg_control = $5; - $$.bits3.gen6_dp.msg_type = $7; - $$.bits3.gen6_dp.send_commit_msg = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.gen6_dp.binding_table_index = $3; + GEN(&$$)->bits3.gen6_dp.msg_control = $5; + GEN(&$$)->bits3.gen6_dp.msg_type = $7; + GEN(&$$)->bits3.gen6_dp.send_commit_msg = $9; } else if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_DATAPORT_WRITE; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.dp_write_gen5.binding_table_index = $3; - $$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; - $$.bits3.dp_write_gen5.msg_control = $5 & 0x7; - $$.bits3.dp_write_gen5.msg_type = $7; - $$.bits3.dp_write_gen5.send_commit_msg = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.dp_write_gen5.binding_table_index = $3; + GEN(&$$)->bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; + GEN(&$$)->bits3.dp_write_gen5.msg_control = $5 & 0x7; + GEN(&$$)->bits3.dp_write_gen5.msg_type = $7; + GEN(&$$)->bits3.dp_write_gen5.send_commit_msg = $9; } else { - $$.bits3.generic.msg_target = + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_DATAPORT_WRITE; - $$.bits3.dp_write.binding_table_index = $3; + GEN(&$$)->bits3.dp_write.binding_table_index = $3; /* The msg control field of brw_struct.h is split into * msg control and last_render_target, even though * last_render_target isn't common to all write messages. */ - $$.bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; - $$.bits3.dp_write.msg_control = $5 & 0x7; - $$.bits3.dp_write.msg_type = $7; - $$.bits3.dp_write.send_commit_msg = $9; + GEN(&$$)->bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; + GEN(&$$)->bits3.dp_write.msg_control = $5 & 0x7; + GEN(&$$)->bits3.dp_write.msg_type = $7; + GEN(&$$)->bits3.dp_write.send_commit_msg = $9; } } | WRITE LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN { if (IS_GENx(7)) { - $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; - $$.bits3.generic_gen5.header_present = ($11 != 0); - $$.bits3.gen7_dp.binding_table_index = $3; - $$.bits3.gen7_dp.msg_control = $5; - $$.bits3.gen7_dp.msg_type = $7; + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; + GEN(&$$)->bits3.generic_gen5.header_present = ($11 != 0); + GEN(&$$)->bits3.gen7_dp.binding_table_index = $3; + GEN(&$$)->bits3.gen7_dp.msg_control = $5; + GEN(&$$)->bits3.gen7_dp.msg_type = $7; } else if (IS_GENx(6)) { - $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; - $$.bits3.generic_gen5.header_present = ($11 != 0); - $$.bits3.gen6_dp.binding_table_index = $3; - $$.bits3.gen6_dp.msg_control = $5; - $$.bits3.gen6_dp.msg_type = $7; - $$.bits3.gen6_dp.send_commit_msg = $9; + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE; + GEN(&$$)->bits3.generic_gen5.header_present = ($11 != 0); + GEN(&$$)->bits3.gen6_dp.binding_table_index = $3; + GEN(&$$)->bits3.gen6_dp.msg_control = $5; + GEN(&$$)->bits3.gen6_dp.msg_type = $7; + GEN(&$$)->bits3.gen6_dp.send_commit_msg = $9; } else if (IS_GENx(5)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_DATAPORT_WRITE; - $$.bits3.generic_gen5.header_present = ($11 != 0); - $$.bits3.dp_write_gen5.binding_table_index = $3; - $$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; - $$.bits3.dp_write_gen5.msg_control = $5 & 0x7; - $$.bits3.dp_write_gen5.msg_type = $7; - $$.bits3.dp_write_gen5.send_commit_msg = $9; + GEN(&$$)->bits3.generic_gen5.header_present = ($11 != 0); + GEN(&$$)->bits3.dp_write_gen5.binding_table_index = $3; + GEN(&$$)->bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3; + GEN(&$$)->bits3.dp_write_gen5.msg_control = $5 & 0x7; + GEN(&$$)->bits3.dp_write_gen5.msg_type = $7; + GEN(&$$)->bits3.dp_write_gen5.send_commit_msg = $9; } else { - $$.bits3.generic.msg_target = + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_DATAPORT_WRITE; - $$.bits3.dp_write.binding_table_index = $3; + GEN(&$$)->bits3.dp_write.binding_table_index = $3; /* The msg control field of brw_struct.h is split into * msg control and last_render_target, even though * last_render_target isn't common to all write messages. */ - $$.bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; - $$.bits3.dp_write.msg_control = $5 & 0x7; - $$.bits3.dp_write.msg_type = $7; - $$.bits3.dp_write.send_commit_msg = $9; + GEN(&$$)->bits3.dp_write.last_render_target = ($5 & 0x8) >> 3; + GEN(&$$)->bits3.dp_write.msg_control = $5 & 0x7; + GEN(&$$)->bits3.dp_write.msg_type = $7; + GEN(&$$)->bits3.dp_write.send_commit_msg = $9; } } | URB INTEGER urb_swizzle urb_allocate urb_used urb_complete { - $$.bits3.generic.msg_target = BRW_SFID_URB; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_URB; if (IS_GENp(5)) { - $$.bits2.send_gen5.sfid = BRW_SFID_URB; - $$.bits3.generic_gen5.header_present = 1; - $$.bits3.urb_gen5.opcode = BRW_URB_OPCODE_WRITE; - $$.bits3.urb_gen5.offset = $2; - $$.bits3.urb_gen5.swizzle_control = $3; - $$.bits3.urb_gen5.pad = 0; - $$.bits3.urb_gen5.allocate = $4; - $$.bits3.urb_gen5.used = $5; - $$.bits3.urb_gen5.complete = $6; + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_URB; + GEN(&$$)->bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits3.urb_gen5.opcode = BRW_URB_OPCODE_WRITE; + GEN(&$$)->bits3.urb_gen5.offset = $2; + GEN(&$$)->bits3.urb_gen5.swizzle_control = $3; + GEN(&$$)->bits3.urb_gen5.pad = 0; + GEN(&$$)->bits3.urb_gen5.allocate = $4; + GEN(&$$)->bits3.urb_gen5.used = $5; + GEN(&$$)->bits3.urb_gen5.complete = $6; } else { - $$.bits3.generic.msg_target = BRW_SFID_URB; - $$.bits3.urb.opcode = BRW_URB_OPCODE_WRITE; - $$.bits3.urb.offset = $2; - $$.bits3.urb.swizzle_control = $3; - $$.bits3.urb.pad = 0; - $$.bits3.urb.allocate = $4; - $$.bits3.urb.used = $5; - $$.bits3.urb.complete = $6; + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_URB; + GEN(&$$)->bits3.urb.opcode = BRW_URB_OPCODE_WRITE; + GEN(&$$)->bits3.urb.offset = $2; + GEN(&$$)->bits3.urb.swizzle_control = $3; + GEN(&$$)->bits3.urb.pad = 0; + GEN(&$$)->bits3.urb.allocate = $4; + GEN(&$$)->bits3.urb.used = $5; + GEN(&$$)->bits3.urb.complete = $6; } } | THREAD_SPAWNER LPAREN INTEGER COMMA INTEGER COMMA INTEGER RPAREN { - $$.bits3.generic.msg_target = + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_THREAD_SPAWNER; if (IS_GENp(5)) { - $$.bits2.send_gen5.sfid = + GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_THREAD_SPAWNER; - $$.bits3.generic_gen5.header_present = 0; - $$.bits3.thread_spawner_gen5.opcode = $3; - $$.bits3.thread_spawner_gen5.requester_type = $5; - $$.bits3.thread_spawner_gen5.resource_select = $7; + GEN(&$$)->bits3.generic_gen5.header_present = 0; + GEN(&$$)->bits3.thread_spawner_gen5.opcode = $3; + GEN(&$$)->bits3.thread_spawner_gen5.requester_type = $5; + GEN(&$$)->bits3.thread_spawner_gen5.resource_select = $7; } else { - $$.bits3.generic.msg_target = + GEN(&$$)->bits3.generic.msg_target = BRW_SFID_THREAD_SPAWNER; - $$.bits3.thread_spawner.opcode = $3; - $$.bits3.thread_spawner.requester_type = $5; - $$.bits3.thread_spawner.resource_select = $7; + GEN(&$$)->bits3.thread_spawner.opcode = $3; + GEN(&$$)->bits3.thread_spawner.requester_type = $5; + GEN(&$$)->bits3.thread_spawner.resource_select = $7; } } | VME LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN { - $$.bits3.generic.msg_target = GEN6_SFID_VME; + GEN(&$$)->bits3.generic.msg_target = GEN6_SFID_VME; if (IS_GENp(6)) { - $$.bits2.send_gen5.sfid = GEN6_SFID_VME; - $$.bits3.vme_gen6.binding_table_index = $3; - $$.bits3.vme_gen6.search_path_index = $5; - $$.bits3.vme_gen6.lut_subindex = $7; - $$.bits3.vme_gen6.message_type = $9; - $$.bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits2.send_gen5.sfid = GEN6_SFID_VME; + GEN(&$$)->bits3.vme_gen6.binding_table_index = $3; + GEN(&$$)->bits3.vme_gen6.search_path_index = $5; + GEN(&$$)->bits3.vme_gen6.lut_subindex = $7; + GEN(&$$)->bits3.vme_gen6.message_type = $9; + GEN(&$$)->bits3.generic_gen5.header_present = 1; } else { error (&@1, "Gen6- doesn't have vme function\n"); }
@@ -1691,19 +1693,19 @@ msgtarget: NULL_TOKEN if (gen_level < 75) error (&@1, "Below Gen7.5 doesn't have CRE function\n"); - $$.bits3.generic.msg_target = HSW_SFID_CRE; + GEN(&$$)->bits3.generic.msg_target = HSW_SFID_CRE; - $$.bits2.send_gen5.sfid = HSW_SFID_CRE; - $$.bits3.cre_gen75.binding_table_index = $3; - $$.bits3.cre_gen75.message_type = $5; - $$.bits3.generic_gen5.header_present = 1; + GEN(&$$)->bits2.send_gen5.sfid = HSW_SFID_CRE; + GEN(&$$)->bits3.cre_gen75.binding_table_index = $3; + GEN(&$$)->bits3.cre_gen75.message_type = $5; + GEN(&$$)->bits3.generic_gen5.header_present = 1; } | DATA_PORT LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN { - $$.bits2.send_gen5.sfid = $3; - $$.bits3.generic_gen5.header_present = ($13 != 0); + GEN(&$$)->bits2.send_gen5.sfid = $3; + GEN(&$$)->bits3.generic_gen5.header_present = ($13 != 0); if (IS_GENp(7)) { if ($3 != GEN6_SFID_DATAPORT_SAMPLER_CACHE &&
@@ -1713,10 +1715,10 @@ msgtarget: NULL_TOKEN error (&@3, "error: wrong cache type\n"); } - $$.bits3.gen7_dp.category = $11; - $$.bits3.gen7_dp.binding_table_index = $9; - $$.bits3.gen7_dp.msg_control = $7; - $$.bits3.gen7_dp.msg_type = $5; + GEN(&$$)->bits3.gen7_dp.category = $11; + GEN(&$$)->bits3.gen7_dp.binding_table_index = $9; + GEN(&$$)->bits3.gen7_dp.msg_control = $7; + GEN(&$$)->bits3.gen7_dp.msg_type = $5; } else if (IS_GENx(6)) { if ($3 != GEN6_SFID_DATAPORT_SAMPLER_CACHE && $3 != GEN6_SFID_DATAPORT_RENDER_CACHE &&
@@ -1724,10 +1726,10 @@ msgtarget: NULL_TOKEN error (&@3, "error: wrong cache type\n"); } - $$.bits3.gen6_dp.send_commit_msg = $11; - $$.bits3.gen6_dp.binding_table_index = $9; - $$.bits3.gen6_dp.msg_control = $7; - $$.bits3.gen6_dp.msg_type = $5; + GEN(&$$)->bits3.gen6_dp.send_commit_msg = $11; + GEN(&$$)->bits3.gen6_dp.binding_table_index = $9; + GEN(&$$)->bits3.gen6_dp.msg_control = $7; + GEN(&$$)->bits3.gen6_dp.msg_type = $5; } else if (!IS_GENp(5)) { error (&@1, "Gen6- doesn't support data port for sampler/render/constant/data cache\n"); }
@@ -2615,21 +2617,21 @@ imm32: exp { $$.r = imm32_d; $$.u.d = $1; } /* 1.4.12: Predication and modifiers */ predicate: /* empty */ { - $$.header.predicate_control = BRW_PREDICATE_NONE; - $$.bits2.da1.flag_reg_nr = 0; - $$.bits2.da1.flag_subreg_nr = 0; - $$.header.predicate_inverse = 0; + GEN(&$$)->header.predicate_control = BRW_PREDICATE_NONE; + GEN(&$$)->bits2.da1.flag_reg_nr = 0; + GEN(&$$)->bits2.da1.flag_subreg_nr = 0; + GEN(&$$)->header.predicate_inverse = 0; } | LPAREN predstate flagreg predctrl RPAREN { - $$.header.predicate_control = $4; + GEN(&$$)->header.predicate_control = $4; /* XXX: Should deal with erroring when the user tries to * set a predicate for one flag register and conditional * modification on the other flag register. */ - $$.bits2.da1.flag_reg_nr = ($3.nr & 0xF); - $$.bits2.da1.flag_subreg_nr = $3.subnr; - $$.header.predicate_inverse = $2; + GEN(&$$)->bits2.da1.flag_reg_nr = ($3.nr & 0xF); + GEN(&$$)->bits2.da1.flag_subreg_nr = $3.subnr; + GEN(&$$)->header.predicate_inverse = $2; } ;
@@ -2722,40 +2724,40 @@ instoption_list:instoption_list COMMA instoption $$ = $1; switch ($3) { case ALIGN1: - $$.header.access_mode = BRW_ALIGN_1; + GEN(&$$)->header.access_mode = BRW_ALIGN_1; break; case ALIGN16: - $$.header.access_mode = BRW_ALIGN_16; + GEN(&$$)->header.access_mode = BRW_ALIGN_16; break; case SECHALF: - $$.header.compression_control |= BRW_COMPRESSION_2NDHALF; + GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; break; case COMPR: if (!IS_GENp(6)) { - $$.header.compression_control |= + GEN(&$$)->header.compression_control |= BRW_COMPRESSION_COMPRESSED; } break; case SWITCH: - $$.header.thread_control |= BRW_THREAD_SWITCH; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; break; case ATOMIC: - $$.header.thread_control |= BRW_THREAD_ATOMIC; + GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; break; case NODDCHK: - $$.header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; + GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; break; case NODDCLR: - $$.header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; + GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; break; case MASK_DISABLE: - $$.header.mask_control = BRW_MASK_DISABLE; + GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; break; case BREAKPOINT: - $$.header.debug_control = BRW_DEBUG_BREAKPOINT; + GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; break; case ACCWRCTRL: - $$.header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; + GEN(&$$)->header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; } } | instoption_list instoption
@@ -2763,41 +2765,41 @@ instoption_list:instoption_list COMMA instoption $$ = $1; switch ($2) { case ALIGN1: - $$.header.access_mode = BRW_ALIGN_1; + GEN(&$$)->header.access_mode = BRW_ALIGN_1; break; case ALIGN16: - $$.header.access_mode = BRW_ALIGN_16; + GEN(&$$)->header.access_mode = BRW_ALIGN_16; break; case SECHALF: - $$.header.compression_control |= BRW_COMPRESSION_2NDHALF; + GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; break; case COMPR: if (!IS_GENp(6)) { - $$.header.compression_control |= + GEN(&$$)->header.compression_control |= BRW_COMPRESSION_COMPRESSED; } break; case SWITCH: - $$.header.thread_control |= BRW_THREAD_SWITCH; + GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; break; case ATOMIC: - $$.header.thread_control |= BRW_THREAD_ATOMIC; + GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; break; case NODDCHK: - $$.header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; + GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; break; case NODDCLR: - $$.header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; + GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; break; case MASK_DISABLE: - $$.header.mask_control = BRW_MASK_DISABLE; + GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; break; case BREAKPOINT: - $$.header.debug_control = BRW_DEBUG_BREAKPOINT; + GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; break; case EOT: /* XXX: EOT shouldn't be an instoption, I don't think */ - $$.bits3.generic.end_of_thread = 1; + GEN(&$$)->bits3.generic.end_of_thread = 1; break; } }
@@ -2933,59 +2935,59 @@ static void reset_instruction_src_region(struct brw_instruction *instr, /** * Fills in the destination register information in instr from the bits in dst. */ -static int set_instruction_dest(struct brw_instruction *instr, +static int set_instruction_dest(struct brw_program_instruction *instr, struct brw_reg *dest) { - if (!validate_dst_reg(instr, dest)) + if (!validate_dst_reg(GEN(instr), dest)) return 1; /* the assembler support expressing subnr in bytes or in number of * elements. */ resolve_subnr(dest); - brw_set_dest(&genasm_compile, instr, *dest); + brw_set_dest(&genasm_compile, GEN(instr), *dest); return 0; } /* Sets the first source operand for the instruction. Returns 0 on success. */ -static int set_instruction_src0(struct brw_instruction *instr, +static int set_instruction_src0(struct brw_program_instruction *instr, struct src_operand *src, YYLTYPE *location) { if (advanced_flag) - reset_instruction_src_region(instr, src); + reset_instruction_src_region(GEN(instr), src); - if (!validate_src_reg(instr, src->reg, location)) + if (!validate_src_reg(GEN(instr), src->reg, location)) return 1; /* the assembler support expressing subnr in bytes or in number of * elements. */ resolve_subnr(&src->reg); - brw_set_src0(&genasm_compile, instr, src->reg); + brw_set_src0(&genasm_compile, GEN(instr), src->reg); return 0; } /* Sets the second source operand for the instruction. Returns 0 on success. */ -static int set_instruction_src1(struct brw_instruction *instr, +static int set_instruction_src1(struct brw_program_instruction *instr, struct src_operand *src, YYLTYPE *location) { if (advanced_flag) - reset_instruction_src_region(instr, src); + reset_instruction_src_region(GEN(instr), src); - if (!validate_src_reg(instr, src->reg, location)) + if (!validate_src_reg(GEN(instr), src->reg, location)) return 1; /* the assembler support expressing subnr in bytes or in number of * elements. */ resolve_subnr(&src->reg); - brw_set_src1(&genasm_compile, instr, src->reg); + brw_set_src1(&genasm_compile, GEN(instr), src->reg); return 0; }
@@ -3010,74 +3012,74 @@ static int reg_type_2_to_3(int reg_type) return r; } -static int set_instruction_dest_three_src(struct brw_instruction *instr, +static int set_instruction_dest_three_src(struct brw_program_instruction *instr, struct brw_reg *dest) { - instr->bits1.da3src.dest_reg_file = dest->file; - instr->bits1.da3src.dest_reg_nr = dest->nr; - instr->bits1.da3src.dest_subreg_nr = get_subreg_address(dest->file, dest->type, dest->subnr, dest->address_mode) / 4; // in DWORD - instr->bits1.da3src.dest_writemask = dest->dw1.bits.writemask; - instr->bits1.da3src.dest_reg_type = reg_type_2_to_3(dest->type); + GEN(instr)->bits1.da3src.dest_reg_file = dest->file; + GEN(instr)->bits1.da3src.dest_reg_nr = dest->nr; + GEN(instr)->bits1.da3src.dest_subreg_nr = get_subreg_address(dest->file, dest->type, dest->subnr, dest->address_mode) / 4; // in DWORD + GEN(instr)->bits1.da3src.dest_writemask = dest->dw1.bits.writemask; + GEN(instr)->bits1.da3src.dest_reg_type = reg_type_2_to_3(dest->type); return 0; } -static int set_instruction_src0_three_src(struct brw_instruction *instr, +static int set_instruction_src0_three_src(struct brw_program_instruction *instr, struct src_operand *src) { if (advanced_flag) { - reset_instruction_src_region(instr, src); + reset_instruction_src_region(GEN(instr), src); } // TODO: supporting src0 swizzle, src0 modifier, src0 rep_ctrl - instr->bits1.da3src.src_reg_type = reg_type_2_to_3(src->reg.type); - instr->bits2.da3src.src0_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - instr->bits2.da3src.src0_reg_nr = src->reg.nr; + GEN(instr)->bits1.da3src.src_reg_type = reg_type_2_to_3(src->reg.type); + GEN(instr)->bits2.da3src.src0_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD + GEN(instr)->bits2.da3src.src0_reg_nr = src->reg.nr; return 0; } -static int set_instruction_src1_three_src(struct brw_instruction *instr, +static int set_instruction_src1_three_src(struct brw_program_instruction *instr, struct src_operand *src) { if (advanced_flag) { - reset_instruction_src_region(instr, src); + reset_instruction_src_region(GEN(instr), src); } // TODO: supporting src1 swizzle, src1 modifier, src1 rep_ctrl int v = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - instr->bits2.da3src.src1_subreg_nr_low = v % 4; // lower 2 bits - instr->bits3.da3src.src1_subreg_nr_high = v / 4; // highest bit - instr->bits3.da3src.src1_reg_nr = src->reg.nr; + GEN(instr)->bits2.da3src.src1_subreg_nr_low = v % 4; // lower 2 bits + GEN(instr)->bits3.da3src.src1_subreg_nr_high = v / 4; // highest bit + GEN(instr)->bits3.da3src.src1_reg_nr = src->reg.nr; return 0; } -static int set_instruction_src2_three_src(struct brw_instruction *instr, +static int set_instruction_src2_three_src(struct brw_program_instruction *instr, struct src_operand *src) { if (advanced_flag) { - reset_instruction_src_region(instr, src); + reset_instruction_src_region(GEN(instr), src); } // TODO: supporting src2 swizzle, src2 modifier, src2 rep_ctrl - instr->bits3.da3src.src2_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - instr->bits3.da3src.src2_reg_nr = src->reg.nr; + GEN(instr)->bits3.da3src.src2_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD + GEN(instr)->bits3.da3src.src2_reg_nr = src->reg.nr; return 0; } -static void set_instruction_options(struct brw_instruction *instr, - struct brw_instruction *options) +static void set_instruction_options(struct brw_program_instruction *instr, + struct brw_program_instruction *options) { /* XXX: more instr options */ - instr->header.access_mode = options->header.access_mode; - instr->header.mask_control = options->header.mask_control; - instr->header.dependency_control = options->header.dependency_control; - instr->header.compression_control = - options->header.compression_control; + GEN(instr)->header.access_mode = GEN(options)->header.access_mode; + GEN(instr)->header.mask_control = GEN(options)->header.mask_control; + GEN(instr)->header.dependency_control = GEN(options)->header.dependency_control; + GEN(instr)->header.compression_control = + GEN(options)->header.compression_control; } -static void set_instruction_predicate(struct brw_instruction *instr, - struct brw_instruction *predicate) +static void set_instruction_predicate(struct brw_program_instruction *instr, + struct brw_program_instruction *p) { - instr->header.predicate_control = predicate->header.predicate_control; - instr->header.predicate_inverse = predicate->header.predicate_inverse; - instr->bits2.da1.flag_reg_nr = predicate->bits2.da1.flag_reg_nr; - instr->bits2.da1.flag_subreg_nr = predicate->bits2.da1.flag_subreg_nr; + GEN(instr)->header.predicate_control = GEN(p)->header.predicate_control; + GEN(instr)->header.predicate_inverse = GEN(p)->header.predicate_inverse; + GEN(instr)->bits2.da1.flag_reg_nr = GEN(p)->bits2.da1.flag_reg_nr; + GEN(instr)->bits2.da1.flag_subreg_nr = GEN(p)->bits2.da1.flag_subreg_nr; } static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg,
Signature · 1 line
1.7.7.5
PATCH 70/90 assembler: Move struct relocation out of relocatable instructions
In reply to Damien LespiauNow that all instructions (relocatable or not) are struct brw_program_instructions, this means we can move the relocation specific information out the "relocatable instruction" structure. This will allow us to share the relocation information between different types of instructions.
--- assembler/gen4asm.h | 5 +-- assembler/gram.y | 76 ++++++++++++++++++++++++++------------------------- assembler/main.c | 4 +- 3 files changed, 43 insertions(+), 42 deletions(-)
assembler/gen4asm.h +2 -3
@@ -126,8 +126,7 @@ struct label_instruction {char *name; }; -struct relocatable_instruction { -struct brw_instruction gen; +struct relocation {char *first_reloc_target, *second_reloc_target;// JIP and UIP respectively GLint first_reloc_offset, second_reloc_offset;// in number of instructions };
@@ -141,9 +140,9 @@ struct brw_program_instruction {unsigned inst_offset;union {struct brw_instruction gen; -struct relocatable_instruction reloc;struct label_instruction label; } insn; +struct relocation reloc;struct brw_program_instruction *next; };
assembler/gram.y +39 -37
163 lines not on this page · raw message
assembler/main.c +2 -2
@@ -437,8 +437,8 @@ int main(int argc, char **argv) }for (entry = compiled_program.first; entry; entry = entry->next) { -struct relocatable_instruction *reloc = &entry->insn.reloc; -struct brw_instruction *inst = &reloc->gen; +struct relocation *reloc = &entry->reloc; +struct brw_instruction *inst = &entry->insn.gen;if (!is_relocatable (entry))continue ;
Signature · 1 line
1.7.7.5
PATCH 71/90 assembler: Gather all predicate data in its own structure
In reply to Damien LespiauRather than user a full instruction for that. Also use set_instruction_predicate() for a case that coud not be done like that before the refactoring (because everyone now uses the same instruction structure).
--- assembler/gen4asm.h | 7 ++++++ assembler/gram.y | 53 +++++++++++++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 27 deletions(-)
assembler/gen4asm.h +7 -0
@@ -85,6 +85,13 @@ struct condition {int flag_subreg_nr; }; +struct predicate { +unsigned pred_control:4 ; +unsigned pred_inverse:1 ; +unsigned flag_reg_nr:1 ; +unsigned flag_subreg_nr:1 ; +}; +struct region {int vert_stride, width, horiz_stride;int is_default;
assembler/gram.y +26 -27
127 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 72/90 assembler: Unify adding options to the header
In reply to Damien LespiauRight now we have duplicated code for when the option is the last in the list or not. Put that code in a common function.
Interestingly it appears that both sides haven't been kept in sync and that EOT and ACCWRCTRL had limitations on where they had to be in the option list. It's fixed now!
--- assembler/gram.y | 121 ++++++++++++++++++++---------------------------------- 1 files changed, 45 insertions(+), 76 deletions(-)
assembler/gram.y +45 -76
@@ -526,6 +526,49 @@ static void resolve_subnr(struct brw_reg *reg) YYERROR; \ } while(0) +static void add_option(struct brw_program_instruction *insn, int option) +{ + switch (option) { + case ALIGN1: + GEN(insn)->header.access_mode = BRW_ALIGN_1; + break; + case ALIGN16: + GEN(insn)->header.access_mode = BRW_ALIGN_16; + break; + case SECHALF: + GEN(insn)->header.compression_control |= BRW_COMPRESSION_2NDHALF; + break; + case COMPR: + if (!IS_GENp(6)) + GEN(insn)->header.compression_control |= BRW_COMPRESSION_COMPRESSED; + break; + case SWITCH: + GEN(insn)->header.thread_control |= BRW_THREAD_SWITCH; + break; + case ATOMIC: + GEN(insn)->header.thread_control |= BRW_THREAD_ATOMIC; + break; + case NODDCHK: + GEN(insn)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; + break; + case NODDCLR: + GEN(insn)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; + break; + case MASK_DISABLE: + GEN(insn)->header.mask_control = BRW_MASK_DISABLE; + break; + case BREAKPOINT: + GEN(insn)->header.debug_control = BRW_DEBUG_BREAKPOINT; + break; + case ACCWRCTRL: + GEN(insn)->header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; + break; + case EOT: + GEN(insn)->bits3.generic.end_of_thread = 1; + break; + } +} + } %%
@@ -2723,86 +2766,12 @@ instoptions: /* empty */ instoption_list:instoption_list COMMA instoption { $$ = $1; - switch ($3) { - case ALIGN1: - GEN(&$$)->header.access_mode = BRW_ALIGN_1; - break; - case ALIGN16: - GEN(&$$)->header.access_mode = BRW_ALIGN_16; - break; - case SECHALF: - GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; - break; - case COMPR: - if (!IS_GENp(6)) { - GEN(&$$)->header.compression_control |= - BRW_COMPRESSION_COMPRESSED; - } - break; - case SWITCH: - GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; - break; - case ATOMIC: - GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; - break; - case NODDCHK: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; - break; - case NODDCLR: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; - break; - case MASK_DISABLE: - GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; - break; - case BREAKPOINT: - GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; - break; - case ACCWRCTRL: - GEN(&$$)->header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; - } + add_option(&$$, $3); } | instoption_list instoption { $$ = $1; - switch ($2) { - case ALIGN1: - GEN(&$$)->header.access_mode = BRW_ALIGN_1; - break; - case ALIGN16: - GEN(&$$)->header.access_mode = BRW_ALIGN_16; - break; - case SECHALF: - GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; - break; - case COMPR: - if (!IS_GENp(6)) { - GEN(&$$)->header.compression_control |= - BRW_COMPRESSION_COMPRESSED; - } - break; - case SWITCH: - GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; - break; - case ATOMIC: - GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; - break; - case NODDCHK: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; - break; - case NODDCLR: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; - break; - case MASK_DISABLE: - GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; - break; - case BREAKPOINT: - GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; - break; - case EOT: - /* XXX: EOT shouldn't be an instoption, I don't think */ - GEN(&$$)->bits3.generic.end_of_thread = 1; - break; - } + add_option(&$$, $2); } | /* empty, header defaults to zeroes. */ {
Signature · 1 line
1.7.7.5
PATCH 73/90 assembler: Isolate all the options in their own structure
In reply to Damien LespiauLike with the predicate fields before, there's no need to use the full instruction to collect the list of options. This allows us to decouple the list of options from a specific instruction encoding.
--- assembler/gen4asm.h | 12 +++++++++ assembler/gram.y | 65 ++++++++++++++++++++++++++------------------------- 2 files changed, 45 insertions(+), 32 deletions(-)
assembler/gen4asm.h +12 -0
@@ -92,6 +92,18 @@ struct predicate { unsigned flag_subreg_nr:1; }; +struct options { +unsigned access_mode:1 ; +unsigned compression_control:2 ;/* gen6: quater control */ +unsigned thread_control:2 ; +unsigned dependency_control:2 ; +unsigned mask_control:1 ; +unsigned debug_control:1 ; +unsigned acc_wr_control:1 ; + +unsigned end_of_thread:1 ; +}; +struct region {int vert_stride, width, horiz_stride;int is_default;
assembler/gram.y +33 -32
174 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 74/90 assembler: Introduce set_instruction_opcode()
In reply to Damien Lespiau--- assembler/gram.y | 72 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 40 insertions(+), 32 deletions(-)
assembler/gram.y +40 -32
@@ -82,6 +82,8 @@ static struct src_operand ip_src = }; static int get_type_size(GLuint type); +static void set_instruction_opcode(struct brw_program_instruction *instr, + unsigned opcode); static int set_instruction_dest(struct brw_program_instruction *instr, struct brw_reg *dest); static int set_instruction_src0(struct brw_program_instruction *instr,
@@ -757,7 +759,7 @@ ifelseinstruction: ENDIF if(IS_GENp(6)) // For gen6+. error(&@1, "should be 'ENDIF execsize relativelocation'\n"); memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; GEN(&$$)->bits1.da1.dest_horiz_stride = 1; GEN(&$$)->bits1.da1.src1_reg_file = BRW_ARCHITECTURE_REGISTER_FILE;
@@ -770,7 +772,7 @@ ifelseinstruction: ENDIF if(!IS_GENp(6)) // for gen6- error(&@1, "ENDIF Syntax error: should be 'ENDIF'\n"); memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); GEN(&$$)->header.execution_size = $2; $$.reloc.first_reloc_target = $3.reloc_target; $$.reloc.first_reloc_offset = $3.imm32;
@@ -783,7 +785,7 @@ ifelseinstruction: ENDIF $3.imm32 |= (1 << 16); memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; ip_dst.width = $2; set_instruction_dest(&$$, &ip_dst);
@@ -793,7 +795,7 @@ ifelseinstruction: ENDIF $$.reloc.first_reloc_offset = $3.imm32; } else if(IS_GENp(6)) { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); GEN(&$$)->header.execution_size = $2; $$.reloc.first_reloc_target = $3.reloc_target; $$.reloc.first_reloc_offset = $3.imm32;
@@ -813,7 +815,7 @@ ifelseinstruction: ENDIF memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); if(!IS_GENp(6)) { GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; ip_dst.width = $3;
@@ -832,7 +834,7 @@ ifelseinstruction: ENDIF memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.execution_size = $3; $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32;
@@ -853,7 +855,7 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions set_instruction_dest(&$$, &ip_dst); memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; set_instruction_src0(&$$, &ip_src, NULL); set_instruction_src1(&$$, &$4, NULL);
@@ -865,7 +867,7 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions dest horizontal stride must be 1. */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.execution_size = $3; $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32;
@@ -877,7 +879,7 @@ loopinstruction: predicate WHILE execsize relativelocation instoptions { // deprecated memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); }; haltinstruction: predicate HALT execsize relativelocation relativelocation instoptions
@@ -886,7 +888,7 @@ haltinstruction: predicate HALT execsize relativelocation relativelocation insto /* Gen6, Gen7 bspec: dst and src0 must be the null reg. */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32; $$.reloc.second_reloc_target = $5.reloc_target;
@@ -902,7 +904,7 @@ multibranchinstruction: /* Gen7 bspec: dest must be null. use Switch option */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32;
@@ -914,7 +916,7 @@ multibranchinstruction: /* Gen7 bspec: dest must be null. src0 must be null. use Switch option */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32;
@@ -945,7 +947,7 @@ subroutineinstruction: */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); $4.type = BRW_REGISTER_TYPE_D; /* dest type should be DWORD */ $4.width = 1; /* execution size must be 2. Here 1 is encoded 2. */
@@ -973,7 +975,7 @@ subroutineinstruction: */ memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); dst_null_reg.width = 1; /* execution size of RET should be 2 */ set_instruction_dest(&$$, &dst_null_reg); $5.reg.type = BRW_REGISTER_TYPE_D;
@@ -989,7 +991,7 @@ unaryinstruction: dst srcaccimm instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; $6.width = $5;
@@ -1028,7 +1030,7 @@ binaryinstruction: dst src srcimm instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; set_instruction_options(&$$, $9);
@@ -1069,7 +1071,7 @@ binaryaccinstruction: dst srcacc srcimm instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; $6.width = $5;
@@ -1115,7 +1117,7 @@ trinaryinstruction: set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; GEN(&$$)->header.execution_size = $5;
@@ -1154,7 +1156,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget * implicitly loaded if non-null. */ memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); $5.width = $3; GEN(&$$)->header.destreg__conditionalmod = $4; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1208,7 +1210,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget | predicate SEND execsize dst sendleadreg payload directsrcoperand instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1232,7 +1234,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget "type=%d\n", $7.reg.dw1.ud, $7.reg.type); } memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1260,7 +1262,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget } memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1);
@@ -1303,7 +1305,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget } memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = ($6 & EX_DESC_SFID_MASK); /* SFID */ set_instruction_predicate(&$$, &$1);
@@ -1338,7 +1340,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget "type=%d\n", $8.reg.dw1.ud, $8.reg.type); } memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1360,7 +1362,7 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget | predicate SEND execsize dst sendleadreg payload exp directsrcoperand instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $5.nr; /* msg reg index */ set_instruction_predicate(&$$, &$1);
@@ -1394,7 +1396,7 @@ jumpinstruction: predicate JMPI execsize relativelocation2 * is the post-incremented IP plus the offset. */ memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); if(advanced_flag) GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; set_instruction_predicate(&$$, &$1);
@@ -1410,7 +1412,7 @@ jumpinstruction: predicate JMPI execsize relativelocation2 mathinstruction: predicate MATH_INST execsize dst src srcimm math_function instoptions { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.destreg__conditionalmod = $7; set_instruction_options(&$$, $8); set_instruction_predicate(&$$, &$1);
@@ -1429,7 +1431,7 @@ breakinstruction: predicate breakop execsize relativelocation relativelocation i // for Gen6, Gen7 memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); GEN(&$$)->header.execution_size = $3; $$.reloc.first_reloc_target = $4.reloc_target; $$.reloc.first_reloc_offset = $4.imm32;
@@ -1452,7 +1454,7 @@ syncinstruction: predicate WAIT notifyreg struct src_operand notify_src; memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $2; + set_instruction_opcode(&$$, $2); set_direct_dst_operand(¬ify_dst, &$3, BRW_REGISTER_TYPE_D); notify_dst.width = ffs(1) - 1; set_instruction_dest(&$$, ¬ify_dst);
@@ -1466,7 +1468,7 @@ syncinstruction: predicate WAIT notifyreg nopinstruction: NOP { memset(&$$, 0, sizeof($$)); - GEN(&$$)->header.opcode = $1; + set_instruction_opcode(&$$, $1); }; /* XXX! */
@@ -1678,7 +1680,7 @@ msgtarget: NULL_TOKEN if (IS_GENp(5)) { GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_URB; GEN(&$$)->bits3.generic_gen5.header_present = 1; - GEN(&$$)->bits3.urb_gen5.opcode = BRW_URB_OPCODE_WRITE; + set_instruction_opcode(&$$, BRW_URB_OPCODE_WRITE); GEN(&$$)->bits3.urb_gen5.offset = $2; GEN(&$$)->bits3.urb_gen5.swizzle_control = $3; GEN(&$$)->bits3.urb_gen5.pad = 0;
@@ -1687,7 +1689,7 @@ msgtarget: NULL_TOKEN GEN(&$$)->bits3.urb_gen5.complete = $6; } else { GEN(&$$)->bits3.generic.msg_target = BRW_SFID_URB; - GEN(&$$)->bits3.urb.opcode = BRW_URB_OPCODE_WRITE; + set_instruction_opcode(&$$, BRW_URB_OPCODE_WRITE); GEN(&$$)->bits3.urb.offset = $2; GEN(&$$)->bits3.urb.swizzle_control = $3; GEN(&$$)->bits3.urb.pad = 0;
@@ -2901,6 +2903,12 @@ static void reset_instruction_src_region(struct brw_instruction *instr, } } +static void set_instruction_opcode(struct brw_program_instruction *instr, + unsigned opcode) +{ + GEN(instr)->header.opcode = opcode; +} + /** * Fills in the destination register information in instr from the bits in dst. */
Signature · 1 line
1.7.7.5
PATCH 75/90 assembler: Introduce set_intruction_pred_cond()
In reply to Damien LespiauThis allow us to factor out the test that checks if, when using both predicates and conditional modifiers, we are using the same flag register.
Also get rid of of a FIXME that we are now dealing with (the warning mentioned above).
--- assembler/gram.y | 88 +++++++++++++++++++----------------------------------- 1 files changed, 31 insertions(+), 57 deletions(-)
assembler/gram.y +31 -57
@@ -104,6 +104,10 @@ static void set_instruction_options(struct brw_program_instruction *instr, struct options options); static void set_instruction_predicate(struct brw_program_instruction *instr, struct predicate *p); +static void set_instruction_pred_cond(struct brw_program_instruction *instr, + struct predicate *p, + struct condition *c, + YYLTYPE *location); static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, int type); static void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg,
@@ -992,28 +996,15 @@ unaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; $6.width = $5; set_instruction_options(&$$, $8); - set_instruction_predicate(&$$, &$1); + set_instruction_pred_cond(&$$, &$1, &$3, &@3); if (set_instruction_dest(&$$, &$6) != 0) YYERROR; if (set_instruction_src0(&$$, &$7, &@7) != 0) YYERROR; - if ($3.flag_subreg_nr != -1) { - if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && - ($1.flag_reg_nr != $3.flag_reg_nr || - $1.flag_subreg_nr != $3.flag_subreg_nr)) - warn(ALWAYS, &@3, "must use the same flag register if " - "both prediction and conditional modifier are " - "enabled\n"); - - GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; - GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; - } - if (!IS_GENp(6) && get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED;
@@ -1031,10 +1022,9 @@ binaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; set_instruction_options(&$$, $9); - set_instruction_predicate(&$$, &$1); + set_instruction_pred_cond(&$$, &$1, &$3, &@3); $6.width = $5; if (set_instruction_dest(&$$, &$6) != 0) YYERROR;
@@ -1043,18 +1033,6 @@ binaryinstruction: if (set_instruction_src1(&$$, &$8, &@8) != 0) YYERROR; - if ($3.flag_subreg_nr != -1) { - if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && - ($1.flag_reg_nr != $3.flag_reg_nr || - $1.flag_subreg_nr != $3.flag_subreg_nr)) - warn(ALWAYS, &@3, "must use the same flag register if " - "both prediction and conditional modifier are " - "enabled\n"); - - GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; - GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; - } - if (!IS_GENp(6) && get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED;
@@ -1072,11 +1050,10 @@ binaryaccinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; $6.width = $5; set_instruction_options(&$$, $9); - set_instruction_predicate(&$$, &$1); + set_instruction_pred_cond(&$$, &$1, &$3, &@3); if (set_instruction_dest(&$$, &$6) != 0) YYERROR; if (set_instruction_src0(&$$, &$7, &@7) != 0)
@@ -1084,18 +1061,6 @@ binaryaccinstruction: if (set_instruction_src1(&$$, &$8, &@8) != 0) YYERROR; - if ($3.flag_subreg_nr != -1) { - if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && - ($1.flag_reg_nr != $3.flag_reg_nr || - $1.flag_subreg_nr != $3.flag_subreg_nr)) - warn(ALWAYS, &@3, "must use the same flag register if " - "both prediction and conditional modifier are " - "enabled\n"); - - GEN(&$$)->bits2.da1.flag_reg_nr = $3.flag_reg_nr; - GEN(&$$)->bits2.da1.flag_subreg_nr = $3.flag_subreg_nr; - } - if (!IS_GENp(6) && get_type_size(GEN(&$$)->bits1.da1.dest_reg_type) * (1 << $6.width) == 64) GEN(&$$)->header.compression_control = BRW_COMPRESSION_COMPRESSED;
@@ -1115,10 +1080,9 @@ trinaryinstruction: { memset(&$$, 0, sizeof($$)); - set_instruction_predicate(&$$, &$1); + set_instruction_pred_cond(&$$, &$1, &$3, &@3); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.destreg__conditionalmod = $3.cond; GEN(&$$)->header.saturate = $4; GEN(&$$)->header.execution_size = $5;
@@ -1131,15 +1095,6 @@ trinaryinstruction: if (set_instruction_src2_three_src(&$$, &$9)) YYERROR; set_instruction_options(&$$, $10); - - if ($3.flag_subreg_nr != -1) { - if (GEN(&$$)->header.predicate_control != BRW_PREDICATE_NONE && - ($1.flag_reg_nr != $3.flag_reg_nr || - $1.flag_subreg_nr != $3.flag_subreg_nr)) - warn(ALWAYS, &@3, "must use the same flag register if " - "both prediction and conditional modifier are " - "enabled\n"); - } } ;
@@ -2670,10 +2625,6 @@ predicate: /* empty */ | LPAREN predstate flagreg predctrl RPAREN { $$.pred_control = $4; - /* XXX: Should deal with erroring when the user tries to - * set a predicate for one flag register and conditional - * modification on the other flag register. - */ $$.flag_reg_nr = $3.nr; $$.flag_subreg_nr = $3.subnr; $$.pred_inverse = $2;
@@ -3061,6 +3012,29 @@ static void set_instruction_predicate(struct brw_program_instruction *instr, GEN(instr)->bits2.da1.flag_subreg_nr = p->flag_subreg_nr; } +static void set_instruction_pred_cond(struct brw_program_instruction *instr, + struct predicate *p, + struct condition *c, + YYLTYPE *location) +{ + set_instruction_predicate(instr, p); + GEN(instr)->header.destreg__conditionalmod = c->cond; + + if (c->flag_subreg_nr == -1) + return; + + if (p->pred_control != BRW_PREDICATE_NONE && + (p->flag_reg_nr != c->flag_reg_nr || + p->flag_subreg_nr != c->flag_subreg_nr)) + { + warn(ALWAYS, location, "must use the same flag register if both " + "prediction and conditional modifier are enabled\n"); + } + + GEN(instr)->bits2.da1.flag_reg_nr = c->flag_reg_nr; + GEN(instr)->bits2.da1.flag_subreg_nr = c->flag_subreg_nr; +} + static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, int type) {
Signature · 1 line
1.7.7.5
PATCH 76/90 assembler: Introduce set_instruction_saturate()
In reply to Damien LespiauAlso simplify the logic that was setting the saturate bit in the math instruction.
--- assembler/gram.y | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-)
assembler/gram.y +14 -12
@@ -100,6 +100,8 @@ static int set_instruction_src1_three_src(struct brw_program_instruction *instr, struct src_operand *src); static int set_instruction_src2_three_src(struct brw_program_instruction *instr, struct src_operand *src); +static void set_instruction_saturate(struct brw_program_instruction *instr, + int saturate); static void set_instruction_options(struct brw_program_instruction *instr, struct options options); static void set_instruction_predicate(struct brw_program_instruction *instr,
@@ -996,7 +998,7 @@ unaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); $6.width = $5; set_instruction_options(&$$, $8); set_instruction_pred_cond(&$$, &$1, &$3, &@3);
@@ -1022,7 +1024,7 @@ binaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); set_instruction_options(&$$, $9); set_instruction_pred_cond(&$$, &$1, &$3, &@3); $6.width = $5;
@@ -1050,7 +1052,7 @@ binaryaccinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); $6.width = $5; set_instruction_options(&$$, $9); set_instruction_pred_cond(&$$, &$1, &$3, &@3);
@@ -1083,7 +1085,7 @@ trinaryinstruction: set_instruction_pred_cond(&$$, &$1, &$3, &@3); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); GEN(&$$)->header.execution_size = $5; if (set_instruction_dest_three_src(&$$, &$6))
@@ -1485,20 +1487,14 @@ msgtarget: NULL_TOKEN GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_MATH; GEN(&$$)->bits3.generic_gen5.header_present = 0; GEN(&$$)->bits3.math_gen5.function = $2; - if ($3 == BRW_INSTRUCTION_SATURATE) - GEN(&$$)->bits3.math_gen5.saturate = 1; - else - GEN(&$$)->bits3.math_gen5.saturate = 0; + set_instruction_saturate(&$$, $3); GEN(&$$)->bits3.math_gen5.int_type = $4; GEN(&$$)->bits3.math_gen5.precision = BRW_MATH_PRECISION_FULL; GEN(&$$)->bits3.math_gen5.data_type = $5; } else { GEN(&$$)->bits3.generic.msg_target = BRW_SFID_MATH; GEN(&$$)->bits3.math.function = $2; - if ($3 == BRW_INSTRUCTION_SATURATE) - GEN(&$$)->bits3.math.saturate = 1; - else - GEN(&$$)->bits3.math.saturate = 0; + set_instruction_saturate(&$$, $3); GEN(&$$)->bits3.math.int_type = $4; GEN(&$$)->bits3.math.precision = BRW_MATH_PRECISION_FULL; GEN(&$$)->bits3.math.data_type = $5;
@@ -2990,6 +2986,12 @@ static int set_instruction_src2_three_src(struct brw_program_instruction *instr, return 0; } +static void set_instruction_saturate(struct brw_program_instruction *instr, + int saturate) +{ + GEN(instr)->header.saturate = saturate; +} + static void set_instruction_options(struct brw_program_instruction *instr, struct options options) {
Signature · 1 line
1.7.7.5
PATCH 77/90 assembler: Expose setters for 3src operands
In reply to Damien Lespiau--- assembler/brw_eu.h | 17 +++++++++++++++++ assembler/brw_eu_emit.c | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 8 deletions(-)
assembler/brw_eu.h +17 -0
@@ -385,6 +385,23 @@ void brw_set_uip_jip(struct brw_compile *p);uint32_t brw_swap_cmod (uint32_t cmod); +void +brw_set_3src_dest (struct brw_compile *p, +struct brw_instruction *insn, +struct brw_reg dest); +void +brw_set_3src_src0 (struct brw_compile *p, +struct brw_instruction *insn, +struct brw_reg src0); +void +brw_set_3src_src1 (struct brw_compile *p, +struct brw_instruction *insn, +struct brw_reg src1); +void +brw_set_3src_src2 (struct brw_compile *p, +struct brw_instruction *insn, +struct brw_reg src2); +/* brw_eu_compact.c */ void brw_init_compaction_tables (struct intel_context *intel);void brw_compact_instructions (struct brw_compile *p);
assembler/brw_eu_emit.c +35 -8
78 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 78/90 assembler: Add support for D and UD in 3-src instructions
In reply to Damien Lespiau--- assembler/brw_defines.h | 5 +++++ assembler/brw_eu_emit.c | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-)
assembler/brw_defines.h +5 -0
@@ -785,6 +785,11 @@ enum opcode {#define BRW_REGISTER_TYPE_V 6/* packed int vector, immediates only, uword dest only */ #define BRW_REGISTER_TYPE_F 7 +#define BRW_REGISTER_3SRC_TYPE_F 0 +#define BRW_REGISTER_3SRC_TYPE_D 1 +#define BRW_REGISTER_3SRC_TYPE_UD 2 +#define BRW_REGISTER_3SRC_TYPE_DF 3 +#define BRW_ARF_NULL 0x00#define BRW_ARF_ADDRESS 0x10#define BRW_ARF_ACCUMULATOR 0x20
assembler/brw_eu_emit.c +19 -4
@@ -813,6 +813,21 @@ get_3src_subreg_nr(struct brw_reg reg) } } +static int get_3src_type (int type) +{ +assert (type ==BRW_REGISTER_TYPE_F || + type ==BRW_REGISTER_TYPE_D || + type ==BRW_REGISTER_TYPE_UD ); + +switch (type) { +case BRW_REGISTER_TYPE_F :return BRW_REGISTER_3SRC_TYPE_F ; +case BRW_REGISTER_TYPE_D :return BRW_REGISTER_3SRC_TYPE_D ; +case BRW_REGISTER_TYPE_UD :return BRW_REGISTER_3SRC_TYPE_UD ; + } + +return BRW_REGISTER_3SRC_TYPE_F ; +} + void brw_set_3src_dest(struct brw_compile *p, struct brw_instruction *insn,
@@ -826,7 +841,7 @@ brw_set_3src_dest(struct brw_compile *p, dest.file == BRW_MESSAGE_REGISTER_FILE);assert (dest.nr <128 );assert (dest.address_mode ==BRW_ADDRESS_DIRECT ); -assert (dest.type ==BRW_REGISTER_TYPE_F ); + insn->bits1.da3src.dest_reg_type =get_3src_type (dest.type); insn->bits1.da3src.dest_reg_file = (dest.file ==BRW_MESSAGE_REGISTER_FILE ); insn->bits1.da3src.dest_reg_nr = dest.nr; insn->bits1.da3src.dest_subreg_nr = dest.subnr /16 ;
@@ -842,7 +857,7 @@ brw_set_3src_src0(struct brw_compile *p,assert (src0.file ==BRW_GENERAL_REGISTER_FILE );assert (src0.address_mode ==BRW_ADDRESS_DIRECT );assert (src0.nr <128 ); -assert (src0.type ==BRW_REGISTER_TYPE_F ); + insn->bits1.da3src.src_reg_type =get_3src_type (src0.type); insn->bits2.da3src.src0_swizzle = src0.dw1.bits.swizzle; insn->bits2.da3src.src0_subreg_nr =get_3src_subreg_nr (src0); insn->bits2.da3src.src0_reg_nr = src0.nr;
@@ -859,7 +874,7 @@ brw_set_3src_src1(struct brw_compile *p,assert (src1.file ==BRW_GENERAL_REGISTER_FILE );assert (src1.address_mode ==BRW_ADDRESS_DIRECT );assert (src1.nr <128 ); -assert (src1.type ==BRW_REGISTER_TYPE_F ); +assert (src1.type == insn->bits1.da3src.src_reg_type); insn->bits2.da3src.src1_swizzle = src1.dw1.bits.swizzle; insn->bits2.da3src.src1_subreg_nr_low =get_3src_subreg_nr (src1) &0x3 ; insn->bits3.da3src.src1_subreg_nr_high =get_3src_subreg_nr (src1) >>2 ;
@@ -877,7 +892,7 @@ brw_set_3src_src2(struct brw_compile *p,assert (src2.file ==BRW_GENERAL_REGISTER_FILE );assert (src2.address_mode ==BRW_ADDRESS_DIRECT );assert (src2.nr <128 ); -assert (src2.type ==BRW_REGISTER_TYPE_F ); +assert (src2.type == insn->bits1.da3src.src_reg_type); insn->bits3.da3src.src2_swizzle = src2.dw1.bits.swizzle; insn->bits3.da3src.src2_subreg_nr =get_3src_subreg_nr (src2); insn->bits3.da3src.src2_rep_ctrl = src2.vstride ==BRW_VERTICAL_STRIDE_0 ;
Signature · 1 line
1.7.7.5
PATCH 79/90 assembler: Use brw_*() functions for 3-src instructions
In reply to Damien Lespiau--- assembler/gram.y | 79 +++++++++++++++++++---------------------------------- 1 files changed, 28 insertions(+), 51 deletions(-)
assembler/gram.y +28 -51
@@ -1086,8 +1086,8 @@ trinaryinstruction: set_instruction_opcode(&$$, $2); set_instruction_saturate(&$$, $4); - GEN(&$$)->header.execution_size = $5; + $6.width = $5; if (set_instruction_dest_three_src(&$$, &$6)) YYERROR; if (set_instruction_src0_three_src(&$$, &$7))
@@ -2916,74 +2916,51 @@ static int set_instruction_src1(struct brw_program_instruction *instr, return 0; } -/* convert 2-src reg type to 3-src reg type - * - * 2-src reg type: - * 000=UD 001=D 010=UW 011=W 100=UB 101=B 110=DF 111=F - * - * 3-src reg type: - * 00=F 01=D 10=UD 11=DF - */ -static int reg_type_2_to_3(int reg_type) -{ - int r = 0; - switch(reg_type) { - case 7: r = 0; break; - case 1: r = 1; break; - case 0: r = 2; break; - // TODO: supporting DF - } - return r; -} - static int set_instruction_dest_three_src(struct brw_program_instruction *instr, struct brw_reg *dest) { - GEN(instr)->bits1.da3src.dest_reg_file = dest->file; - GEN(instr)->bits1.da3src.dest_reg_nr = dest->nr; - GEN(instr)->bits1.da3src.dest_subreg_nr = get_subreg_address(dest->file, dest->type, dest->subnr, dest->address_mode) / 4; // in DWORD - GEN(instr)->bits1.da3src.dest_writemask = dest->dw1.bits.writemask; - GEN(instr)->bits1.da3src.dest_reg_type = reg_type_2_to_3(dest->type); - return 0; + resolve_subnr(dest); + brw_set_3src_dest(&genasm_compile, GEN(instr), *dest); + return 0; } static int set_instruction_src0_three_src(struct brw_program_instruction *instr, struct src_operand *src) { - if (advanced_flag) { - reset_instruction_src_region(GEN(instr), src); - } - // TODO: supporting src0 swizzle, src0 modifier, src0 rep_ctrl - GEN(instr)->bits1.da3src.src_reg_type = reg_type_2_to_3(src->reg.type); - GEN(instr)->bits2.da3src.src0_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - GEN(instr)->bits2.da3src.src0_reg_nr = src->reg.nr; - return 0; + if (advanced_flag) + reset_instruction_src_region(GEN(instr), src); + + resolve_subnr(&src->reg); + + // TODO: src0 modifier, src0 rep_ctrl + brw_set_3src_src0(&genasm_compile, GEN(instr), src->reg); + return 0; } static int set_instruction_src1_three_src(struct brw_program_instruction *instr, struct src_operand *src) { - if (advanced_flag) { - reset_instruction_src_region(GEN(instr), src); - } - // TODO: supporting src1 swizzle, src1 modifier, src1 rep_ctrl - int v = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - GEN(instr)->bits2.da3src.src1_subreg_nr_low = v % 4; // lower 2 bits - GEN(instr)->bits3.da3src.src1_subreg_nr_high = v / 4; // highest bit - GEN(instr)->bits3.da3src.src1_reg_nr = src->reg.nr; - return 0; + if (advanced_flag) + reset_instruction_src_region(GEN(instr), src); + + resolve_subnr(&src->reg); + + // TODO: src1 modifier, src1 rep_ctrl + brw_set_3src_src1(&genasm_compile, GEN(instr), src->reg); + return 0; } static int set_instruction_src2_three_src(struct brw_program_instruction *instr, struct src_operand *src) { - if (advanced_flag) { - reset_instruction_src_region(GEN(instr), src); - } - // TODO: supporting src2 swizzle, src2 modifier, src2 rep_ctrl - GEN(instr)->bits3.da3src.src2_subreg_nr = get_subreg_address(src->reg.file, src->reg.type, src->reg.subnr, src->reg.address_mode) / 4; // in DWORD - GEN(instr)->bits3.da3src.src2_reg_nr = src->reg.nr; - return 0; + if (advanced_flag) + reset_instruction_src_region(GEN(instr), src); + + resolve_subnr(&src->reg); + + // TODO: src2 modifier, src2 rep_ctrl + brw_set_3src_src2(&genasm_compile, GEN(instr), src->reg); + return 0; } static void set_instruction_saturate(struct brw_program_instruction *instr,
Signature · 1 line
1.7.7.5
PATCH 80/90 assembler: Don't pollute the library files with gen4asm.h
In reply to Damien Lespiaugen4asm.h is assembler specific while we want the library files to be somewhat of a proper library.
This means that we have to redefine the GL* typedefs for brw_structs.h, not using any of thet GL typedef will be for a future commit.
--- assembler/brw_disasm.c | 1 - assembler/brw_eu.c | 1 - assembler/brw_eu.h | 1 - assembler/brw_structs.h | 8 ++++++++ 4 files changed, 8 insertions(+), 3 deletions(-)
assembler/brw_disasm.c +0 -1
@@ -27,7 +27,6 @@#include <unistd.h> #include <stdarg.h> -#include "gen4asm.h" #include "brw_eu.h" const struct opcode_desc opcode_descs[128 ] = {
assembler/brw_eu.c +0 -1
@@ -32,7 +32,6 @@#include <string.h> -#include "gen4asm.h" #include "brw_context.h" #include "brw_defines.h" #include "brw_eu.h"
assembler/brw_eu.h +0 -1
@@ -35,7 +35,6 @@#include <stdbool.h> #include <stdio.h> -#include "gen4asm.h" #include "brw_context.h" #include "brw_structs.h" #include "brw_defines.h"
assembler/brw_structs.h +8 -0
@@ -33,6 +33,14 @@#ifndef BRW_STRUCTS_H #define BRW_STRUCTS_H +#include <stdint.h> + +typedef unsigned char GLubyte ; +typedef short GLshort ; +typedef unsigned int GLuint ; +typedef int GLint ; +typedef float GLfloat ; +/* These seem to be passed around as function args, so it works out * better to keep them as #defines: */
Signature · 1 line
1.7.7.5
PATCH 81/90 assembler: Put struct opcode_desc back in brw_context.h
In reply to Damien LespiauI originally moved struct opcode_desc from brw_context.h to brw_eu.h on the mesa side, but that was before the realization we needed struct brw_context if we wanted to not touch the code too much.
So put it back there now that the mesa patch has been dropped.
--- assembler/brw_context.h | 14 ++++++++++++++ assembler/brw_disasm.c | 17 +++++++++-------- assembler/brw_eu.h | 11 ----------- 3 files changed, 23 insertions(+), 19 deletions(-)
assembler/brw_context.h +14 -0
@@ -31,6 +31,9 @@#define __BRW_CONTEXT_H__#include <stdbool.h> +#include <stdio.h> + +#include "brw_structs.h" #ifdef __cplusplusextern "C" {
@@ -57,6 +60,17 @@ struct brw_contextbool brw_init_context (struct brw_context *brw,int gen); +/* brw_disasm.c */ +struct opcode_desc { +char *name; +int nsrc; +int ndst; +}; + +extern const struct opcode_desc opcode_descs[128 ]; + +int brw_disasm (FILE *file,struct brw_instruction *inst,int gen); + #ifdef __cplusplus }/* end of extern "C" */ #endif
assembler/brw_disasm.c +9 -8
@@ -27,7 +27,8 @@#include <unistd.h> #include <stdarg.h> -#include "brw_eu.h" +#include "brw_context.h" +#include "brw_defines.h" const struct opcode_desc opcode_descs[128 ] = { [BRW_OPCODE_MOV ] = { .name ="mov" , .nsrc =1 , .ndst =1 },
@@ -99,7 +100,7 @@ static const char * const conditional_modifier[16] = { [BRW_CONDITIONAL_U] = ".u", }; -static const char *const negate_op[2 ] = { +static const char *const negate[2 ] = { [0 ] ="" , [1 ] ="-" , };
@@ -602,7 +603,7 @@ static int src_da1 (FILE *file, GLuint type, GLuint _reg_file, GLuint reg_num, GLuint sub_reg_num, GLuint __abs, GLuint _negate) { int err = 0; - err |=control (file,"negate" , negate_op, _negate,NULL ); + err |=control (file,"negate" , negate, _negate,NULL ); err |=control (file,"abs" , _abs, __abs,NULL ); err |=reg (file, _reg_file, reg_num);
@@ -628,7 +629,7 @@ static int src_ia1 (FILE *file, GLuint _vert_stride) {int err =0 ; - err |=control (file,"negate" , negate_op, _negate,NULL ); + err |=control (file,"negate" , negate, _negate,NULL ); err |=control (file,"abs" , _abs, __abs,NULL );string (file,"g[a0" );
@@ -656,7 +657,7 @@ static int src_da16 (FILE *file, GLuint swz_w) {int err =0 ; - err |=control (file,"negate" , negate_op, _negate,NULL ); + err |=control (file,"negate" , negate, _negate,NULL ); err |=control (file,"abs" , _abs, __abs,NULL ); err |=reg (file, _reg_file, _reg_nr);
@@ -707,7 +708,7 @@ static int src0_3src (FILE *file, struct brw_instruction *inst)GLuint swz_z = (inst->bits2.da3src.src0_swizzle >>4 ) &0x3 ;GLuint swz_w = (inst->bits2.da3src.src0_swizzle >>6 ) &0x3 ; - err |=control (file,"negate" , negate_op, inst->bits1.da3src.src0_negate,NULL ); + err |=control (file,"negate" , negate, inst->bits1.da3src.src0_negate,NULL ); err |=control (file,"abs" , _abs, inst->bits1.da3src.src0_abs,NULL ); err |=reg (file,BRW_GENERAL_REGISTER_FILE , inst->bits2.da3src.src0_reg_nr);
@@ -757,7 +758,7 @@ static int src1_3src (FILE *file, struct brw_instruction *inst)GLuint src1_subreg_nr = (inst->bits2.da3src.src1_subreg_nr_low | (inst->bits3.da3src.src1_subreg_nr_high <<2 )); - err |=control (file,"negate" , negate_op, inst->bits1.da3src.src1_negate, + err |=control (file,"negate" , negate, inst->bits1.da3src.src1_negate,NULL ); err |=control (file,"abs" , _abs, inst->bits1.da3src.src1_abs,NULL );
@@ -808,7 +809,7 @@ static int src2_3src (FILE *file, struct brw_instruction *inst)GLuint swz_z = (inst->bits3.da3src.src2_swizzle >>4 ) &0x3 ;GLuint swz_w = (inst->bits3.da3src.src2_swizzle >>6 ) &0x3 ; - err |=control (file,"negate" , negate_op, inst->bits1.da3src.src2_negate, + err |=control (file,"negate" , negate, inst->bits1.da3src.src2_negate,NULL ); err |=control (file,"abs" , _abs, inst->bits1.da3src.src2_abs,NULL );
assembler/brw_eu.h +0 -11
@@ -420,17 +420,6 @@ void brw_optimize(struct brw_compile *p);void brw_remove_duplicate_mrf_moves (struct brw_compile *p);void brw_remove_grf_to_mrf_moves (struct brw_compile *p); -/* brw_disasm.c */ -struct opcode_desc { -char *name; -int nsrc; -int ndst; -}; - -extern const struct opcode_desc opcode_descs[128 ]; - -int brw_disasm (FILE *file,struct brw_instruction *inst,int gen); - #ifdef __cplusplus }#endif
Signature · 1 line
1.7.7.5
PATCH 82/90 assembler: Use set_instruction_src1() in send
In reply to Damien LespiauNo reason not to!
--- assembler/gram.y | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-)
assembler/gram.y +6 -11
@@ -1200,9 +1200,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; if (set_instruction_src0(&$$, &$6, &@6) != 0) YYERROR; - GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - GEN(&$$)->bits1.da1.src1_reg_type = $7.reg.type; - GEN(&$$)->bits3.ud = $7.reg.dw1.ud; + if (set_instruction_src1(&$$, &$7, &@7) != 0) + YYERROR; } | predicate SEND execsize dst sendleadreg sndopr imm32reg instoptions {
@@ -1241,10 +1240,8 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget src0.reg.nr = $5.nr; src0.reg.subnr = 0; set_instruction_src0(&$$, &src0, NULL); + set_instruction_src1(&$$, &$7, NULL); - GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - GEN(&$$)->bits1.da1.src1_reg_type = $7.reg.type; - GEN(&$$)->bits3.ud = $7.reg.dw1.ud; GEN(&$$)->bits3.generic_gen5.end_of_thread = !!($6 & EX_DESC_EOT_MASK); } | predicate SEND execsize dst sendleadreg sndopr directsrcoperand instoptions
@@ -1306,15 +1303,13 @@ sendinstruction: predicate SEND execsize exp post_dst payload msgtarget YYERROR; if (set_instruction_src0(&$$, &$6, &@6) != 0) YYERROR; - GEN(&$$)->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE; - GEN(&$$)->bits1.da1.src1_reg_type = $8.reg.type; + if (set_instruction_src1(&$$, &$8, &@8) != 0) + YYERROR; + if (IS_GENx(5)) { GEN(&$$)->bits2.send_gen5.sfid = ($7 & EX_DESC_SFID_MASK); - GEN(&$$)->bits3.ud = $8.reg.dw1.ud; GEN(&$$)->bits3.generic_gen5.end_of_thread = !!($7 & EX_DESC_EOT_MASK); } - else - GEN(&$$)->bits3.ud = $8.reg.dw1.ud; } | predicate SEND execsize dst sendleadreg payload exp directsrcoperand instoptions {
Signature · 1 line
1.7.7.5
PATCH 83/90 assembler: Finish importing brw_eu_*c from mesa
In reply to Damien Lespiau--- assembler/Makefile.am | 2 + assembler/brw_eu_debug.c | 92 ++++++++++++++++++++++++++++++++++ assembler/brw_eu_util.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 219 insertions(+), 0 deletions(-) create mode 100644 assembler/brw_eu_debug.c create mode 100644 assembler/brw_eu_util.c
assembler/Makefile.am +2 -0
@@ -13,7 +13,9 @@ libbrw_la_SOURCES = \ brw_eu.h \ brw_eu.c \ brw_eu_compact.c \ + brw_eu_debug.c \ brw_eu_emit.c \ + brw_eu_util.c \ brw_reg.h \ brw_structs.h \ ralloc.c \
assembler/brw_eu_debug.c new file +92 -0
92 lines not on this page · raw message
assembler/brw_eu_util.c new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH 84/90 assembler: Merge declared_register's type into the reg structure
In reply to Damien Lespiau--- assembler/gen4asm.h | 1 - assembler/gram.y | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-)
assembler/gen4asm.h +0 -1
@@ -220,7 +220,6 @@ struct declared_register {int element_size;struct region src_region;int dst_region; -int type; };struct declared_register *find_register (char *name);void insert_register (struct declared_register *reg);
assembler/gram.y +5 -7
@@ -181,8 +181,7 @@ static bool declared_register_equal(struct declared_register *r1, return false; if (r1->element_size != r2->element_size || - r1->dst_region != r2->dst_region || - r1->type != r2->type) + r1->dst_region != r2->dst_region) return false; return true;
@@ -650,7 +649,7 @@ declare_pragma: DECLARE_PRAGMA STRING declare_base declare_elementsize declare_s reg.element_size = $4; reg.src_region = $5; reg.dst_region = $6; - reg.type = $7; + reg.reg.type = $7; found = find_register($2); if (found) {
@@ -1771,7 +1770,6 @@ dstoperand: symbol_reg dstregion { $$ = $1.reg; $$.hstride = resolve_dst_region(&$1, $2); - $$.type = $1.type; } | dstreg dstregion writemask regtype {
@@ -1860,7 +1858,7 @@ symbol_reg_p: STRING LPAREN exp RPAREN memcpy(&$$, dcl_reg, sizeof(*dcl_reg)); $$.reg.nr += $3; if(advanced_flag) { - int size = get_type_size(dcl_reg->type); + int size = get_type_size(dcl_reg->reg.type); $$.reg.nr += ($$.reg.subnr + $5) / (32 / size); $$.reg.subnr = ($$.reg.subnr + $5) % (32 / size); } else {
@@ -2047,7 +2045,7 @@ directsrcoperand: negate abs symbol_reg region regtype $$.reg.nr = $3.reg.nr; $$.reg.subnr = $3.reg.subnr; if ($5.is_default) { - $$.reg.type = $3.type; + $$.reg.type = $3.reg.type; } else { $$.reg.type = $5.type; }
@@ -2434,7 +2432,7 @@ relativelocation2: $$.reg.file = $1.reg.file; $$.reg.nr = $1.reg.nr; $$.reg.subnr = $1.reg.subnr; - $$.reg.type = $1.type; + $$.reg.type = $1.reg.type; $$.reg.vstride = $1.src_region.vert_stride; $$.reg.width = $1.src_region.width; $$.reg.hstride = $1.src_region.horiz_stride;
Signature · 1 line
1.7.7.5
PATCH 85/90 assembler: Use defines for width
In reply to Damien LespiauInstead of just using hardcoded numbers or resorting to ffs().
--- assembler/gram.y | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
assembler/gram.y +11 -11
@@ -618,7 +618,7 @@ declare_srcregion: /* empty */ /* XXX is this default correct?*/ memset (&$$, '\0', sizeof ($$)); $$.vert_stride = ffs(0); - $$.width = ffs(1) - 1; + $$.width = BRW_WIDTH_1; $$.horiz_stride = ffs(0); } | SRCREGION EQ region
@@ -955,7 +955,7 @@ subroutineinstruction: set_instruction_opcode(&$$, $2); $4.type = BRW_REGISTER_TYPE_D; /* dest type should be DWORD */ - $4.width = 1; /* execution size must be 2. Here 1 is encoded 2. */ + $4.width = BRW_WIDTH_2; /* execution size must be 2. */ set_instruction_dest(&$$, &$4); struct src_operand src0;
@@ -963,7 +963,7 @@ subroutineinstruction: src0.reg.type = BRW_REGISTER_TYPE_D; /* source type should be DWORD */ /* source0 region control must be <2,2,1>. */ src0.reg.hstride = 1; /*encoded 1*/ - src0.reg.width = 1; /*encoded 2*/ + src0.reg.width = BRW_WIDTH_2; src0.reg.vstride = 2; /*encoded 2*/ set_instruction_src0(&$$, &src0, NULL);
@@ -981,11 +981,11 @@ subroutineinstruction: memset(&$$, 0, sizeof($$)); set_instruction_predicate(&$$, &$1); set_instruction_opcode(&$$, $2); - dst_null_reg.width = 1; /* execution size of RET should be 2 */ + dst_null_reg.width = BRW_WIDTH_2; /* execution size of RET should be 2 */ set_instruction_dest(&$$, &dst_null_reg); $5.reg.type = BRW_REGISTER_TYPE_D; $5.reg.hstride = 1; /*encoded 1*/ - $5.reg.width = 1; /*encoded 2*/ + $5.reg.width = BRW_WIDTH_2; $5.reg.vstride = 2; /*encoded 2*/ set_instruction_src0(&$$, &$5, NULL); }
@@ -1351,7 +1351,7 @@ jumpinstruction: predicate JMPI execsize relativelocation2 if(advanced_flag) GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; set_instruction_predicate(&$$, &$1); - ip_dst.width = ffs(1) - 1; + ip_dst.width = BRW_WIDTH_1; set_instruction_dest(&$$, &ip_dst); set_instruction_src0(&$$, &ip_src, NULL); set_instruction_src1(&$$, &$4, NULL);
@@ -1407,7 +1407,7 @@ syncinstruction: predicate WAIT notifyreg memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); set_direct_dst_operand(¬ify_dst, &$3, BRW_REGISTER_TYPE_D); - notify_dst.width = ffs(1) - 1; + notify_dst.width = BRW_WIDTH_1; set_instruction_dest(&$$, ¬ify_dst); set_direct_src_operand(¬ify_src, &$3, BRW_REGISTER_TYPE_D); set_instruction_src0(&$$, ¬ify_src, NULL);
@@ -2473,7 +2473,7 @@ region: /* empty */ /* XXX is this default value correct?*/ memset (&$$, '\0', sizeof ($$)); $$.vert_stride = ffs(0); - $$.width = ffs(1) - 1; + $$.width = BRW_WIDTH_1; $$.horiz_stride = ffs(0); $$.is_default = 1; }
@@ -2482,7 +2482,7 @@ region: /* empty */ /* XXX is this default value correct for accreg?*/ memset (&$$, '\0', sizeof ($$)); $$.vert_stride = ffs($2); - $$.width = ffs(1) - 1; + $$.width = BRW_WIDTH_1; $$.horiz_stride = ffs(0); } |LANGLE exp COMMA exp COMMA exp RANGLE
@@ -2783,7 +2783,7 @@ static void reset_instruction_src_region(struct brw_instruction *instr, if (src->reg.file == BRW_ARCHITECTURE_REGISTER_FILE && ((src->reg.nr & 0xF0) == BRW_ARF_ADDRESS)) { src->reg.vstride = ffs(0); - src->reg.width = ffs(1) - 1; + src->reg.width = BRW_WIDTH_1; src->reg.hstride = ffs(0); } else if (src->reg.file == BRW_ARCHITECTURE_REGISTER_FILE && ((src->reg.nr & 0xF0) == BRW_ARF_ACCUMULATOR)) {
@@ -2805,7 +2805,7 @@ static void reset_instruction_src_region(struct brw_instruction *instr, (src->reg.nr == BRW_ARF_NULL) && (instr->header.opcode == BRW_OPCODE_SEND)) { src->reg.vstride = ffs(8); - src->reg.width = ffs(8) - 1; + src->reg.width = BRW_WIDTH_8; src->reg.hstride = ffs(1); } else {
Signature · 1 line
1.7.7.5
PATCH 86/90 assembler: Remove trailing white space
In reply to Damien Lespiau--- assembler/brw_eu.c | 16 +++++++------- assembler/brw_eu_debug.c | 20 +++++++++--------- assembler/brw_eu_emit.c | 48 +++++++++++++++++++++++----------------------- assembler/brw_eu_util.c | 18 ++++++++-------- assembler/disasm-main.c | 2 +- assembler/gen4asm.h | 4 +- assembler/main.c | 2 +- 7 files changed, 55 insertions(+), 55 deletions(-)
assembler/brw_eu.c +8 -8
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,13 +22,13 @@LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ **********************************************************************/ /* * Authors: * Keith Whitwell <[email protected]> */ - +#include <string.h>
@@ -78,7 +78,7 @@ void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint value ) } p->current->header.predicate_control =BRW_PREDICATE_NORMAL ; - } + } }void brw_set_predicate_control (struct brw_compile *p,GLuint pc )
@@ -165,7 +165,7 @@ void brw_push_insn_state( struct brw_compile *p )assert (p->current != &p->stack[BRW_EU_MAX_INSN_STACK -1 ]);memcpy (p->current+1 , p->current,sizeof (struct brw_instruction )); p->compressed_stack[p->current - p->stack] = p->compressed; - p->current++; + p->current++; }void brw_pop_insn_state (struct brw_compile *p )
@@ -203,7 +203,7 @@ brw_init_compile(struct brw_context *brw, struct brw_compile *p, void *mem_ctx)brw_set_mask_control (p,BRW_MASK_ENABLE );/* what does this do? */ brw_set_saturate (p,0 );brw_set_compression_control (p,BRW_COMPRESSION_NONE ); -brw_set_predicate_control_flag_value (p,0xff ); +brw_set_predicate_control_flag_value (p,0xff );/* Set up control flow stack */ p->if_stack_depth =0 ;
assembler/brw_eu_debug.c +10 -10
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,13 +22,13 @@LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ **********************************************************************/ /* * Authors: * Keith Whitwell <[email protected]> */ - +#include "brw_eu.h" void brw_print_reg (struct brw_reg hwreg )
@@ -51,10 +51,10 @@ void brw_print_reg( struct brw_reg hwreg )"f" }; -printf ("%s%s" , +printf ("%s%s" , hwreg.abs ?"abs/" :"" , hwreg.negate ?"-" :"" ); - + if (hwreg.file == BRW_GENERAL_REGISTER_FILE && hwreg.nr % 2 == 0 && hwreg.subnr == 0 &&
@@ -69,7 +69,7 @@ void brw_print_reg( struct brw_reg hwreg ) hwreg.vstride == BRW_VERTICAL_STRIDE_0 && hwreg.width == BRW_WIDTH_1 && hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 && - hwreg.type == BRW_REGISTER_TYPE_F) { + hwreg.type == BRW_REGISTER_TYPE_F) {/* "scalar" register */ printf ("scl%d.%d" , hwreg.nr, hwreg.subnr /4 ); }
@@ -77,13 +77,13 @@ void brw_print_reg( struct brw_reg hwreg )printf ("imm %f" , hwreg.dw1.f); }else { -printf ("%s%d.%d<%d;%d,%d>:%s" , +printf ("%s%d.%d<%d;%d,%d>:%s" , file[hwreg.file], hwreg.nr, hwreg.subnr /type_sz (hwreg.type), hwreg.vstride ? (1 <<(hwreg.vstride-1 )) :0 ,1 <<hwreg.width, - hwreg.hstride ? (1 <<(hwreg.hstride-1 )) :0 , + hwreg.hstride ? (1 <<(hwreg.hstride-1 )) :0 , type[hwreg.type]); } }
assembler/brw_eu_emit.c +24 -24
173 lines not on this page · raw message
assembler/brw_eu_util.c +9 -9
@@ -2,7 +2,7 @@ Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to develop this 3D driver. - + 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
@@ -10,11 +10,11 @@ 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.
@@ -22,29 +22,29 @@LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ **********************************************************************/ /* * Authors: * Keith Whitwell <[email protected]> */ - +#include "brw_context.h" #include "brw_defines.h" #include "brw_eu.h" -void brw_math_invert (struct brw_compile *p, +void brw_math_invert (struct brw_compile *p,struct brw_reg dst,struct brw_reg src) { -brw_math ( p, +brw_math ( p, dst, -BRW_MATH_FUNCTION_INV , +BRW_MATH_FUNCTION_INV ,0 , src, -BRW_MATH_PRECISION_FULL , +BRW_MATH_PRECISION_FULL ,BRW_MATH_DATA_VECTOR ); }
assembler/disasm-main.c +1 -1
@@ -165,7 +165,7 @@ int main(int argc, char **argv)exit (1 ); } } - +for (inst = program->first; inst; inst = inst->next)brw_disasm (output, &inst->insn.gen, gen);exit (0 );
assembler/gen4asm.h +2 -2
@@ -106,7 +106,7 @@ struct options {struct region {int vert_stride, width, horiz_stride; -int is_default; +int is_default; };struct regtype {int type;
@@ -114,7 +114,7 @@ struct regtype { };/** -* This structure is the internal representation of source operands in the +* This structure is the internal representation of source operands in the * parser. */ struct src_operand {
assembler/main.c +1 -1
@@ -457,7 +457,7 @@ int main(int argc, char **argv)// this is a branch instruction with one offset argument int offset = reloc->first_reloc_offset;/* bspec: Unlike other flow control instructions, the offset used by JMPI is relative to the incremented instruction pointer rather than the IP value for the instruction itself. */ - +int is_jmpi = inst->header.opcode ==BRW_OPCODE_JMPI ;// target relative to the post-incremented IP, so delta == 1 if JMPI if (is_jmpi) offset --;
Signature · 1 line
1.7.7.5