intel: Add a batch flush between front-buffer downsample and X protocol.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_structs.h
index 8283abfd375dede3559681a9a294628c45176f0f..e1ba5f838d465e1e7c74dc64d55df43340d2c683 100644 (file)
 #ifndef BRW_STRUCTS_H
 #define BRW_STRUCTS_H
 
-
-/** Number of general purpose registers (VS, WM, etc) */
-#define BRW_MAX_GRF 128
-
-/**
- * First GRF used for the MRF hack.
- *
- * On gen7, MRFs are no longer used, and contiguous GRFs are used instead.  We
- * haven't converted our compiler to be aware of this, so it asks for MRFs and
- * brw_eu_emit.c quietly converts them to be accesses of the top GRFs.  The
- * register allocators have to be careful of this to avoid corrupting the "MRF"s
- * with actual GRF allocations.
- */
-#define GEN7_MRF_HACK_START 112.
-
-/** Number of message register file registers */
-#define BRW_MAX_MRF 16
-
-/* These seem to be passed around as function args, so it works out
- * better to keep them as #defines:
- */
-#define BRW_FLUSH_READ_CACHE           0x1
-#define BRW_FLUSH_STATE_CACHE          0x2
-#define BRW_INHIBIT_FLUSH_RENDER_CACHE 0x4
-#define BRW_FLUSH_SNAPSHOT_COUNTERS    0x8
-
 struct brw_urb_fence
 {
    struct
@@ -792,106 +766,6 @@ struct gen7_sf_clip_viewport {
    GLfloat pad1[4];
 };
 
-/* volume 5c Shared Functions - 1.13.4.1.2 */
-struct gen7_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 pad2:2;
-      GLuint render_cache_read_write:1;
-      GLuint pad1:1;
-      GLuint surface_array_spacing:1;
-      GLuint vert_line_stride_ofs:1;
-      GLuint vert_line_stride:1;
-      GLuint tile_walk:1;
-      GLuint tiled_surface:1;
-      GLuint horizontal_alignment:1;
-      GLuint vertical_alignment:2;
-      GLuint surface_format:9;     /**< BRW_SURFACEFORMAT_x */
-      GLuint pad0:1;
-      GLuint is_array:1;
-      GLuint surface_type:3;       /**< BRW_SURFACE_1D/2D/3D/CUBE */
-   } ss0;
-
-   struct {
-      GLuint base_addr;
-   } ss1;
-
-   struct {
-      GLuint width:14;
-      GLuint pad1:2;
-      GLuint height:14;
-      GLuint pad0:2;
-   } ss2;
-
-   struct {
-      GLuint pitch:18;
-      GLuint pad:3;
-      GLuint depth:11;
-   } ss3;
-
-   struct {
-      GLuint multisample_position_palette_index:3;
-      GLuint num_multisamples:3;
-      GLuint multisampled_surface_storage_format:1;
-      GLuint render_target_view_extent:11;
-      GLuint min_array_elt:11;
-      GLuint rotation:2;
-      GLuint pad0:1;
-   } ss4;
-
-   struct {
-      GLuint mip_count:4;
-      GLuint min_lod:4;
-      GLuint pad1:12;
-      GLuint y_offset:4;
-      GLuint pad0:1;
-      GLuint x_offset:7;
-   } ss5;
-
-   struct {
-      GLuint pad; /* Multisample Control Surface stuff */
-   } ss6;
-
-   struct {
-      GLuint resource_min_lod:12;
-      GLuint pad0:16;
-      GLuint alpha_clear_color:1;
-      GLuint blue_clear_color:1;
-      GLuint green_clear_color:1;
-      GLuint red_clear_color:1;
-   } ss7;
-};
-
-
-struct brw_vertex_element_state
-{
-   struct
-   {
-      GLuint src_offset:11; 
-      GLuint pad:5;
-      GLuint src_format:9; 
-      GLuint pad0:1;
-      GLuint valid:1; 
-      GLuint vertex_buffer_index:5; 
-   } ve0;
-   
-   struct
-   {
-      GLuint dst_offset:8; 
-      GLuint pad:8;
-      GLuint vfcomponent3:4; 
-      GLuint vfcomponent2:4; 
-      GLuint vfcomponent1:4; 
-      GLuint vfcomponent0:4; 
-   } ve1;
-};
-
 struct brw_urb_immediate {
    GLuint opcode:4;
    GLuint offset:6;
@@ -919,7 +793,7 @@ struct brw_instruction
       GLuint access_mode:1;
       GLuint mask_control:1;
       GLuint dependency_control:2;
-      GLuint compression_control:2; /* gen6: quater control */
+      GLuint compression_control:2; /* gen6: quarter control */
       GLuint thread_control:2;
       GLuint predicate_control:4;
       GLuint predicate_inverse:1;
@@ -944,7 +818,7 @@ struct brw_instruction
         GLuint src0_reg_type:3;
         GLuint src1_reg_file:2;
         GLuint src1_reg_type:3;
-        GLuint pad:1;
+         GLuint nibctrl:1; /* gen7+ */
         GLuint dest_subreg_nr:5;
         GLuint dest_reg_nr:8;
         GLuint dest_horiz_stride:2;
@@ -959,7 +833,7 @@ struct brw_instruction
         GLuint src0_reg_type:3;
         GLuint src1_reg_file:2;        /* 0x00000c00 */
         GLuint src1_reg_type:3;        /* 0x00007000 */
-        GLuint pad:1;
+         GLuint nibctrl:1; /* gen7+ */
         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;
@@ -974,7 +848,7 @@ struct brw_instruction
         GLuint src0_reg_type:3;
         GLuint src1_reg_file:2;
         GLuint src1_reg_type:3;
-        GLuint pad:1;
+         GLuint nibctrl:1; /* gen7+ */
         GLuint dest_writemask:4;
         GLuint dest_subreg_nr:1;
         GLuint dest_reg_nr:8;
@@ -988,7 +862,9 @@ struct brw_instruction
         GLuint dest_reg_type:3;
         GLuint src0_reg_file:2;
         GLuint src0_reg_type:3;
-        GLuint pad0:6;
+         GLuint src1_reg_file:2;
+         GLuint src1_reg_type:3;
+         GLuint nibctrl:1; /* gen7+ */
         GLuint dest_writemask:4;
         GLint dest_indirect_offset:6;
         GLuint dest_subreg_nr:3;
@@ -1009,20 +885,27 @@ struct brw_instruction
       } branch_gen6;
 
       struct {
-        GLuint dest_reg_file:1;
+         GLuint dest_reg_file:1; /* gen6, not gen7+ */
         GLuint flag_subreg_num:1;
-        GLuint pad0:2;
+         GLuint flag_reg_nr:1; /* gen7+ */
+         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 pad1:7;
+         GLuint src_type:2; /* gen7+ */
+         GLuint dst_type:2; /* gen7+ */
+         GLuint pad1:1;
+         GLuint nibctrl:1; /* gen7+ */
+         GLuint pad2:1;
         GLuint dest_writemask:4;
         GLuint dest_subreg_nr:3;
         GLuint dest_reg_nr:8;
       } da3src;
+
+      uint32_t ud;
    } bits1;
 
 
@@ -1037,8 +920,9 @@ struct brw_instruction
         GLuint src0_horiz_stride:2;
         GLuint src0_width:3;
         GLuint src0_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad:6;
+        GLuint flag_subreg_nr:1;
+         GLuint flag_reg_nr:1; /* gen7+ */
+        GLuint pad:5;
       } da1;
 
       struct
@@ -1051,8 +935,9 @@ struct brw_instruction
         GLuint src0_horiz_stride:2;
         GLuint src0_width:3;
         GLuint src0_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad:6;  
+        GLuint flag_subreg_nr:1;
+         GLuint flag_reg_nr:1; /* gen7+ */
+        GLuint pad:5;
       } ia1;
 
       struct
@@ -1068,8 +953,9 @@ struct brw_instruction
         GLuint src0_swz_w:2;
         GLuint pad0:1;
         GLuint src0_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad1:6;
+        GLuint flag_subreg_nr:1;
+         GLuint flag_reg_nr:1; /* gen7+ */
+        GLuint pad1:5;
       } da16;
 
       struct
@@ -1085,8 +971,9 @@ struct brw_instruction
         GLuint src0_swz_w:2;
         GLuint pad0:1;
         GLuint src0_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad1:6;
+        GLuint flag_subreg_nr:1;
+         GLuint flag_reg_nr:1; /* gen7+ */
+        GLuint pad1:5;
       } ia16;
 
       /* Extended Message Descriptor for Ironlake (Gen5) SEND instruction.
@@ -1112,6 +999,8 @@ struct brw_instruction
         GLuint src1_swizzle:8;
         GLuint src1_subreg_nr_low:2;
       } da3src;
+
+      uint32_t ud;
    } bits2;
 
    union
@@ -1155,8 +1044,7 @@ struct brw_instruction
         GLuint src1_horiz_stride:2;
         GLuint src1_width:3;
         GLuint src1_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad1:6; 
+        GLuint pad1:7;
       } ia1;
 
       struct
@@ -1172,8 +1060,7 @@ struct brw_instruction
         GLuint src1_swz_w:2;
         GLuint pad1:1;
         GLuint src1_vert_stride:4;
-        GLuint flag_reg_nr:1;
-        GLuint pad2:6;
+        GLuint pad2:7;
       } ia16;
 
 
@@ -1471,10 +1358,10 @@ struct brw_instruction
       /**
        * 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
+       * Most fields are defined in the Ivybridge PRM, Volume 4 Part 1,
+       * section 3.9.2.1.1 "Message Descriptor".  Once again, "Slot Group
        * Select" and "Last Render Target" are part of the 6-bit message
-       * control for Render Target Writes.
+       * control for Render Target Writes (section 3.9.11.2).
        */
       struct {
         GLuint binding_table_index:8;
@@ -1509,5 +1396,27 @@ struct brw_instruction
    } bits3;
 };
 
+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