[Mesa-dev] [RFC 14/27] i965: Merge max_grf between stage compilers

Topi Pohjolainen topi.pohjolainen at intel.com
Sat Feb 22 01:05:40 PST 2014


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.h                | 2 --
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 2 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp      | 1 -
 src/mesa/drivers/dri/i965/brw_shader.cpp          | 3 ++-
 src/mesa/drivers/dri/i965/brw_shader.h            | 3 +++
 src/mesa/drivers/dri/i965/brw_vec4.h              | 1 -
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp    | 2 --
 7 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index d273560..b98d43b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -520,8 +520,6 @@ public:
    unsigned output_components[BRW_MAX_DRAW_BUFFERS];
    fs_reg dual_src_output;
    int first_non_payload_grf;
-   /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
-   int max_grf;
 
    fs_reg *fp_temp_regs;
    fs_reg *fp_input_regs;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 5b1741a..24dd1ae 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -63,7 +63,7 @@ fs_visitor::assign_regs_trivial()
       assign_reg(hw_reg_mapping, &inst->src[2], reg_width);
    }
 
-   if (this->grf_used >= max_grf) {
+   if ((unsigned)this->grf_used >= max_grf) {
       fail("Ran out of regs on trivial allocator (%d/%d)\n",
 	   this->grf_used, max_grf);
    }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 953c7ac..5758741 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2962,7 +2962,6 @@ fs_visitor::fs_visitor(struct brw_context *brw,
    memset(this->outputs, 0, sizeof(this->outputs));
    memset(this->output_components, 0, sizeof(this->output_components));
    this->first_non_payload_grf = 0;
-   this->max_grf = brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF;
 
    this->current_annotation = NULL;
    this->base_ir = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 50dab8b..23c060c 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -552,7 +552,8 @@ backend_visitor::backend_visitor(struct gl_shader_program *shader_prog,
 backend_emitter::backend_emitter(struct brw_context *brw)
    : brw(brw),
      ctx(&brw->ctx),
-     mem_ctx(ralloc_context(NULL))
+     mem_ctx(ralloc_context(NULL)),
+     max_grf(brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF)
 {
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 55c9268..e44a6dc 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -105,6 +105,9 @@ public:
     */
    exec_list instructions;
 
+   /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
+   const unsigned max_grf;
+
    virtual void dump_instruction(backend_instruction *inst) = 0;
    virtual void dump_instructions();
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 0ac9be5..bd69f96 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -329,7 +329,6 @@ public:
    int virtual_grf_count;
    int virtual_grf_array_size;
    int first_non_payload_grf;
-   unsigned int max_grf;
    int *virtual_grf_start;
    int *virtual_grf_end;
    dst_reg userplane[MAX_CLIP_PLANES];
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index de3519c..831f9ff 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3348,8 +3348,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
    this->virtual_grf_array_size = 0;
    this->live_intervals_valid = false;
 
-   this->max_grf = brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF;
-
    this->uniforms = 0;
 }
 
-- 
1.8.3.1



More information about the mesa-dev mailing list