[Mesa-dev] [PATCH 10/23] intel/eu: Provide single descriptor argument to brw_send_indirect_surface_message().

Francisco Jerez currojerez at riseup.net
Tue Jun 12 02:26:02 UTC 2018


Instead of the current message_len, response_len and header_present
arguments.
---
 src/intel/compiler/brw_eu_emit.c | 65 ++++++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 29 deletions(-)

diff --git a/src/intel/compiler/brw_eu_emit.c b/src/intel/compiler/brw_eu_emit.c
index 6446a6eaa53..e442827a634 100644
--- a/src/intel/compiler/brw_eu_emit.c
+++ b/src/intel/compiler/brw_eu_emit.c
@@ -2481,11 +2481,8 @@ brw_send_indirect_surface_message(struct brw_codegen *p,
                                   struct brw_reg dst,
                                   struct brw_reg payload,
                                   struct brw_reg surface,
-                                  unsigned message_len,
-                                  unsigned response_len,
-                                  bool header_present)
+                                  unsigned desc_imm)
 {
-   const struct gen_device_info *devinfo = p->devinfo;
    struct brw_inst *insn;
 
    if (surface.file != BRW_IMMEDIATE_VALUE) {
@@ -2510,10 +2507,7 @@ brw_send_indirect_surface_message(struct brw_codegen *p,
       surface = addr;
    }
 
-   insn = brw_send_indirect_message(p, sfid, dst, payload, surface, 0);
-   brw_inst_set_mlen(devinfo, insn, message_len);
-   brw_inst_set_rlen(devinfo, insn, response_len);
-   brw_inst_set_header_present(devinfo, insn, header_present);
+   insn = brw_send_indirect_message(p, sfid, dst, payload, surface, desc_imm);
 
    return insn;
 }
@@ -2803,6 +2797,10 @@ brw_untyped_atomic(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN7_SFID_DATAPORT_DATA_CACHE);
+   const unsigned response_length = brw_surface_payload_size(
+      p, response_expected, devinfo->gen >= 8 || devinfo->is_haswell, true);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, response_length, header_present);
    const bool align1 = brw_get_default_access_mode(p) == BRW_ALIGN_1;
    /* Mask out unused components -- This is especially important in Align16
     * mode on generations that don't have native support for SIMD4x2 atomics,
@@ -2812,10 +2810,7 @@ brw_untyped_atomic(struct brw_codegen *p,
     */
    const unsigned mask = align1 ? WRITEMASK_XYZW : WRITEMASK_X;
    struct brw_inst *insn = brw_send_indirect_surface_message(
-      p, sfid, brw_writemask(dst, mask), payload, surface, msg_length,
-      brw_surface_payload_size(p, response_expected,
-                               devinfo->gen >= 8 || devinfo->is_haswell, true),
-      header_present);
+      p, sfid, brw_writemask(dst, mask), payload, surface, desc);
 
    brw_set_dp_untyped_atomic_message(
       p, insn, atomic_op, response_expected);
@@ -2856,10 +2851,12 @@ brw_untyped_surface_read(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN7_SFID_DATAPORT_DATA_CACHE);
+   const unsigned response_length =
+      brw_surface_payload_size(p, num_channels, true, true);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, response_length, false);
    struct brw_inst *insn = brw_send_indirect_surface_message(
-      p, sfid, dst, payload, surface, msg_length,
-      brw_surface_payload_size(p, num_channels, true, true),
-      false);
+      p, sfid, dst, payload, surface, desc);
 
    brw_set_dp_untyped_surface_read_message(
       p, insn, num_channels);
@@ -2905,13 +2902,15 @@ brw_untyped_surface_write(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN7_SFID_DATAPORT_DATA_CACHE);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, 0, header_present);
    const bool align1 = brw_get_default_access_mode(p) == BRW_ALIGN_1;
    /* Mask out unused components -- See comment in brw_untyped_atomic(). */
    const unsigned mask = devinfo->gen == 7 && !devinfo->is_haswell && !align1 ?
                           WRITEMASK_X : WRITEMASK_XYZW;
    struct brw_inst *insn = brw_send_indirect_surface_message(
       p, sfid, brw_writemask(brw_null_reg(), mask),
-      payload, surface, msg_length, 0, header_present);
+      payload, surface, desc);
 
    brw_set_dp_untyped_surface_write_message(
       p, insn, num_channels);
@@ -2945,11 +2944,13 @@ brw_byte_scattered_read(struct brw_codegen *p,
    assert(devinfo->gen > 7 || devinfo->is_haswell);
    assert(brw_get_default_access_mode(p) == BRW_ALIGN_1);
    const unsigned sfid =  GEN7_SFID_DATAPORT_DATA_CACHE;
+   const unsigned response_length =
+      brw_surface_payload_size(p, 1, true, true);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, response_length, false);
 
    struct brw_inst *insn = brw_send_indirect_surface_message(
-      p, sfid, dst, payload, surface, msg_length,
-      brw_surface_payload_size(p, 1, true, true),
-      false);
+      p, sfid, dst, payload, surface, desc);
 
    unsigned msg_control =
       brw_byte_scattered_data_element_from_bit_size(bit_size) << 2;
@@ -2976,10 +2977,12 @@ brw_byte_scattered_write(struct brw_codegen *p,
    assert(devinfo->gen > 7 || devinfo->is_haswell);
    assert(brw_get_default_access_mode(p) == BRW_ALIGN_1);
    const unsigned sfid = GEN7_SFID_DATAPORT_DATA_CACHE;
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, 0, header_present);
 
    struct brw_inst *insn = brw_send_indirect_surface_message(
       p, sfid, brw_writemask(brw_null_reg(), WRITEMASK_XYZW),
-      payload, surface, msg_length, 0, header_present);
+      payload, surface, desc);
 
    unsigned msg_control =
       brw_byte_scattered_data_element_from_bit_size(bit_size) << 2;
@@ -3041,14 +3044,15 @@ brw_typed_atomic(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN6_SFID_DATAPORT_RENDER_CACHE);
+   const unsigned response_length = brw_surface_payload_size(
+      p, response_expected, devinfo->gen >= 8 || devinfo->is_haswell, false);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, response_length, header_present);
    const bool align1 = brw_get_default_access_mode(p) == BRW_ALIGN_1;
    /* Mask out unused components -- See comment in brw_untyped_atomic(). */
    const unsigned mask = align1 ? WRITEMASK_XYZW : WRITEMASK_X;
    struct brw_inst *insn = brw_send_indirect_surface_message(
-      p, sfid, brw_writemask(dst, mask), payload, surface, msg_length,
-      brw_surface_payload_size(p, response_expected,
-                               devinfo->gen >= 8 || devinfo->is_haswell, false),
-      header_present);
+      p, sfid, brw_writemask(dst, mask), payload, surface, desc);
 
    brw_set_dp_typed_atomic_message(
       p, insn, atomic_op, response_expected);
@@ -3099,11 +3103,12 @@ brw_typed_surface_read(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN6_SFID_DATAPORT_RENDER_CACHE);
+   const unsigned response_length = brw_surface_payload_size(
+      p, num_channels, devinfo->gen >= 8 || devinfo->is_haswell, false);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, response_length, header_present);
    struct brw_inst *insn = brw_send_indirect_surface_message(
-      p, sfid, dst, payload, surface, msg_length,
-      brw_surface_payload_size(p, num_channels,
-                               devinfo->gen >= 8 || devinfo->is_haswell, false),
-      header_present);
+      p, sfid, dst, payload, surface, desc);
 
    brw_set_dp_typed_surface_read_message(
       p, insn, num_channels);
@@ -3154,13 +3159,15 @@ brw_typed_surface_write(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN6_SFID_DATAPORT_RENDER_CACHE);
+   const unsigned desc =
+      brw_message_desc(devinfo, msg_length, 0, header_present);
    const bool align1 = brw_get_default_access_mode(p) == BRW_ALIGN_1;
    /* Mask out unused components -- See comment in brw_untyped_atomic(). */
    const unsigned mask = (devinfo->gen == 7 && !devinfo->is_haswell && !align1 ?
                           WRITEMASK_X : WRITEMASK_XYZW);
    struct brw_inst *insn = brw_send_indirect_surface_message(
       p, sfid, brw_writemask(brw_null_reg(), mask),
-      payload, surface, msg_length, 0, header_present);
+      payload, surface, desc);
 
    brw_set_dp_typed_surface_write_message(
       p, insn, num_channels);
-- 
2.16.1



More information about the mesa-dev mailing list