Mesa (master): i965: Factor out send_restrictions() function.

Matt Turner mattst88 at kemper.freedesktop.org
Fri Jan 20 20:10:58 UTC 2017


Module: Mesa
Branch: master
Commit: 9fd12666d0102c367e354187a899269e254b756b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fd12666d0102c367e354187a899269e254b756b

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Nov  6 21:23:34 2016 -0800

i965: Factor out send_restrictions() function.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_eu_validate.c | 34 +++++++++++++++++++----------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c b/src/mesa/drivers/dri/i965/brw_eu_validate.c
index 4874add..86f0ec8 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_validate.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c
@@ -154,6 +154,27 @@ sources_not_null(const struct gen_device_info *devinfo,
    return error_msg;
 }
 
+static struct string
+send_restrictions(const struct gen_device_info *devinfo,
+                  const brw_inst *inst)
+{
+   struct string error_msg = { .str = NULL, .len = 0 };
+
+   if (brw_inst_opcode(devinfo, inst) == BRW_OPCODE_SEND) {
+      ERROR_IF(brw_inst_src0_address_mode(devinfo, inst) != BRW_ADDRESS_DIRECT,
+               "send must use direct addressing");
+
+      if (devinfo->gen >= 7) {
+         ERROR_IF(!src0_is_grf(devinfo, inst), "send from non-GRF");
+         ERROR_IF(brw_inst_eot(devinfo, inst) &&
+                  brw_inst_src0_da_reg_nr(devinfo, inst) < 112,
+                  "send with EOT must use g112-g127");
+      }
+   }
+
+   return error_msg;
+}
+
 static bool
 is_unsupported_inst(const struct gen_device_info *devinfo,
                     const brw_inst *inst)
@@ -178,18 +199,7 @@ brw_validate_instructions(const struct brw_codegen *p, int start_offset,
          ERROR("Instruction not supported on this Gen");
       } else {
          CHECK(sources_not_null);
-      }
-
-      if (brw_inst_opcode(devinfo, inst) == BRW_OPCODE_SEND) {
-         ERROR_IF(brw_inst_src0_address_mode(devinfo, inst) !=
-                  BRW_ADDRESS_DIRECT, "send must use direct addressing");
-
-         if (devinfo->gen >= 7) {
-            ERROR_IF(!src0_is_grf(devinfo, inst), "send from non-GRF");
-            ERROR_IF(brw_inst_eot(devinfo, inst) &&
-                     brw_inst_src0_da_reg_nr(devinfo, inst) < 112,
-                     "send with EOT must use g112-g127");
-         }
+         CHECK(send_restrictions);
       }
 
       if (error_msg.str && annotation) {




More information about the mesa-commit mailing list