304 Commits

Author SHA1 Message Date
Damien Lespiau
c74c80c9a5 assembler: Make sure nobody adds a field back to struct brw_instruction
Adding something there will break the library, so we might as check for
it.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
79c62f1134 assembler: Don't change the size of opcodes!
Until 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
a45a47183a assembler: Make explicit that labels are part of the instructions list
The 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
73d58edab9 assembler: Refactor the code adding instructions and labels
Factoring out the code from the grammar will allow us to switch to
using brw_compile in a cleaner way.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
5e5861183d assembler: Make print_instruction() take an instruction
No 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
c716e2bdb4 assembler: Simplify get_subreg_address()
This 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
8322802acb assembler: Use subreg_nr to store the address register subreg
Another 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
02019d4d55 assembler: Remove the writemask_set field of struct dest_operand
writemask_set gets in the way of switching to using struct brw_reg and
it's possible to derive it from the writemask value.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
db6f5e08ba assembler: Use BRW_WRITEMASK_XYZW instead of the 0xf constant
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
042e9353e9 assembler: Import brw_eu_emit.c
Finally importing the meaty brw_eu_emit.c code that emit instructions.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
241c5a1322 assembler: Import brw_eu.c
Another step the road of importing Mesa's emission code.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
112075f8c2 assembler: Import brw_eu_compact.c
To 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
a66cd60f2d assembler: Protect gen4asm.h from multiple inclusions
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
8b10ceb61b assembler: Make an libbrw library
With 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
609a8453fb assembler: Introduce struct brw_context
A 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
3ee5808d63 assembler: Remove white space from brw_eu.h
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
14146b4037 assembler: Import ralloc from Mesa
This also add a new brw_compat.h that should help maintaining the
diff between mesa's version and our as small as possible.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
4ca1a04b85 assembler: Update the disassembler code
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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
66fdc85d5b assembler: Remove trailing white space from brw_defines.h
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
153aee37d7 assembler: Import brw_defines.h from Mesa
Almost identical files now, the diff is:

-#include "intel_chipset.h"
+#define EX_DESC_SFID_MASK 0xF
+#define EX_DESC_EOT_MASK  0x20

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
4431869bef assembler: Rename BRW_ACCWRCTRL_ACCWRCTRL
To a more self-describing define. This hopefully will help its inclusion
into Mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
5e7e3f43a5 assembler: Adopt enum brw_message_target from mesa
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
64e84284e3 assembler: Remove trailing white spaces from brw_structs.h
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
c35e0677fe assembler: Adopt brw_structs.h from mesa
Finally 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
f2059b7cc7 assembler: Rename bits3.id and bits3.fd
As always, to sync with mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
c7dac84953 assembler: Rename branch_2_offset to break_cont
Once again, import the equivalent struct from mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
cb425d6d20 assembler: Rename branch to branch_gen6
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
0fde3ddccc assembler: Rename gen5 DP pixel_scoreboard_clear to last_render_target
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
fe0bd3776e assembler: Remove struct dp_write_gen6 and struct use gen6_dp
We ended up with 2 structures that where exactly the same, so just use
one, which happens to be the one Mesa has.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
8fa561d4bb assembler: Rename dp_gen7 to gen7_dp and sync it with Mesa's
The 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
1f1ad59746 assembler: Rename dp_gen6 to gen6_dp and sync with Mesa's
The 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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
668e0dff7d assembler: Rename dp_read_gen6 to gen6_dp_sampler_const_cache
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
31259c5edc assembler: Rename three_src_gen6 to da3src
Mesa's brw_structs.h has named/renamed this field to da3src. Sync with
them.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
e71f1d2ad4 assembler: Sync brw_instruction's header with mesa's
Two changes there, a field has been renamed and one bit of padding is
now used for compressed instructions.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:35 +00:00
Damien Lespiau
191c85976d build: Integrate the merged gen assembler in the build system
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:35 +00:00
Xiang, Haihao
e466360df9 bump version to 1.3
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
2013-03-04 15:54:35 +00:00
Homer Hsing
5d72789848 Fix typo. "donesn't" -> "doesn't" 2013-03-04 15:54:35 +00:00
Zhao Yakui
93f2a4fc93 Add the CRE enginee for HSW+
This is also for media encoding like VME, which can do
the operation of check & refinement.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2013-03-04 15:54:35 +00:00
Gwenole Beauchesne
495c4e14e7 Fix JMPI encoding for Haswell.
It uses the byte-aligned jump instead of 64-bit units.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2013-03-04 15:54:35 +00:00
Gwenole Beauchesne
8aa952873c Add initial support for Haswell.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2013-03-04 15:54:35 +00:00
Gwenole Beauchesne
0c32e25c96 Allow Gen version decimals.
This is preparatory work for Haswell (Gen 7.5).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-03-04 15:54:35 +00:00
Gwenole Beauchesne
a5e5d94ce3 Bump gen_level to multiple of tens.
Add new helper macros to check versions:
- IS_GENp() meant to match Gen X and above
- IS_GENx() meant to match Gen X exactly.

Patch mechanically generated. No stale "gen_level" usage.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2013-03-04 15:54:35 +00:00
Homer Hsing
ee32188422 Fix Gen7 JMPI compilation
Gen7 JMPI Restrictions in bspec:
The JIP data type must be Signed DWord
2013-03-04 15:54:34 +00:00
Homer Hsing
e221b0aa78 Fix sub-register number of an address register encoding
The AddrSubRegNum field in the instruction binary code should be:
  code    value(advanced_flag==0)   value(advanced_flag==1)
  a0.0             0                         0
  a0.1        invalid input                  1
  a0.2             1                         2
  a0.3        invalid input                  3
  a0.4             2                         4
  a0.5        invalid input                  5
  a0.6             3                         6
  a0.7        invalid input                  7
  a0.8             4                  invalid input
  a0.10            5                  invalid input
  a0.12            6                  invalid input
  a0.14            7                  invalid input
2013-03-04 15:54:34 +00:00
Homer Hsing
599d7d244a Fix symbol register subreg number calculation rule symbol_reg_p
When in normal mode, subreg_nr should not be divided by type_size.
This patch fixes such bug.
2013-03-04 15:54:34 +00:00
Homer Hsing
460fdc041b Show warning when compiling the grammar parser 2013-03-04 15:54:34 +00:00
Homer Hsing
e8cb195c6d Support Gen6 WHILE instruction 2013-03-04 15:54:34 +00:00
Homer Hsing
2ad18c1c97 Make sure Gen6 IF works 2013-03-04 15:54:34 +00:00
Homer Hsing
c56d786116 Make sure Gen6 ENDIF work 2013-03-04 15:54:34 +00:00
Homer Hsing
397e1ccccb Fix JIP position for Gen6 JMPI 2013-03-04 15:54:34 +00:00