[Mesa-dev] [PATCH 1/7] i965: Make can_do_source_mods() a member of the instruction classes.

Matt Turner mattst88 at gmail.com
Tue Jun 24 12:16:49 PDT 2014


Pretty nonsensical to have it as a method of the visitor just for access
to brw.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp                    | 8 ++++----
 src/mesa/drivers/dri/i965/brw_fs.h                      | 3 +--
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp   | 2 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp                  | 8 ++++----
 src/mesa/drivers/dri/i965/brw_vec4.h                    | 3 +--
 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 2 +-
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 185a1f6..929379a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -371,15 +371,15 @@ fs_inst::is_send_from_grf() const
 }
 
 bool
-fs_visitor::can_do_source_mods(fs_inst *inst)
+fs_inst::can_do_source_mods(struct brw_context *brw)
 {
-   if (brw->gen == 6 && inst->is_math())
+   if (brw->gen == 6 && is_math())
       return false;
 
-   if (inst->is_send_from_grf())
+   if (is_send_from_grf())
       return false;
 
-   if (!inst->can_do_source_mods())
+   if (!backend_instruction::can_do_source_mods())
       return false;
 
    return true;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index b86a31c..0da79ba 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -208,6 +208,7 @@ public:
    bool is_send_from_grf() const;
    bool is_partial_write() const;
    int regs_read(fs_visitor *v, int arg) const;
+   bool can_do_source_mods(struct brw_context *brw);
 
    bool reads_flag() const;
    bool writes_flag() const;
@@ -285,8 +286,6 @@ public:
    uint32_t gather_channel(ir_texture *ir, int sampler);
    void swizzle_result(ir_texture *ir, fs_reg orig_val, int sampler);
 
-   bool can_do_source_mods(fs_inst *inst);
-
    fs_inst *emit(fs_inst *inst);
    void emit(exec_list list);
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index cc6e86f..0a7b8b8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -314,7 +314,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
 
    if ((has_source_modifiers || entry->src.file == UNIFORM ||
         !entry->src.is_contiguous()) &&
-       !can_do_source_mods(inst))
+       !inst->can_do_source_mods(brw))
       return false;
 
    /* Bail if the result of composing both strides would exceed the
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index ee5be56..24903f9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -250,15 +250,15 @@ vec4_instruction::is_send_from_grf()
 }
 
 bool
-vec4_visitor::can_do_source_mods(vec4_instruction *inst)
+vec4_instruction::can_do_source_mods(struct brw_context *brw)
 {
-   if (brw->gen == 6 && inst->is_math())
+   if (brw->gen == 6 && is_math())
       return false;
 
-   if (inst->is_send_from_grf())
+   if (is_send_from_grf())
       return false;
 
-   if (!inst->can_do_source_mods())
+   if (!backend_instruction::can_do_source_mods())
       return false;
 
    return true;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 20d717a..366ef02 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -265,6 +265,7 @@ public:
    bool is_send_from_grf();
    bool can_reswizzle_dst(int dst_writemask, int swizzle, int swizzle_mask);
    void reswizzle_dst(int dst_writemask, int swizzle);
+   bool can_do_source_mods(struct brw_context *brw);
 
    bool reads_flag()
    {
@@ -430,8 +431,6 @@ public:
    void opt_set_dependency_control();
    void opt_schedule_instructions();
 
-   bool can_do_source_mods(vec4_instruction *inst);
-
    vec4_instruction *emit(vec4_instruction *inst);
 
    vec4_instruction *emit(enum opcode opcode);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index abafe47..11571ad 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -263,7 +263,7 @@ vec4_visitor::try_copy_propagation(vec4_instruction *inst, int arg,
     * instructions.
     */
    if ((has_source_modifiers || value.file == UNIFORM ||
-        value.swizzle != BRW_SWIZZLE_XYZW) && !can_do_source_mods(inst))
+        value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(brw))
       return false;
 
    if (has_source_modifiers && value.type != inst->src[arg].type)
-- 
1.8.3.2



More information about the mesa-dev mailing list