[Mesa-dev] [PATCH 04/36] i965: Add an isl_device to the brw_context

Jason Ekstrand jason at jlekstrand.net
Thu Jun 30 00:37:23 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_blorp.c            |  6 +-----
 src/mesa/drivers/dri/i965/brw_context.c          |  2 ++
 src/mesa/drivers/dri/i965/brw_context.h          |  4 ++++
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++----------
 4 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index f4c80bc..8e36080 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -280,10 +280,6 @@ brw_blorp_emit_surface_state(struct brw_context *brw,
                              uint32_t read_domains, uint32_t write_domain,
                              bool is_render_target)
 {
-   /* TODO: This should go in the context */
-   struct isl_device isl_dev;
-   isl_device_init(&isl_dev, brw->intelScreen->devinfo, brw->has_swizzling);
-
    const struct surface_state_info ss_info = surface_state_infos[brw->gen];
 
    struct isl_surf surf;
@@ -375,7 +371,7 @@ brw_blorp_emit_surface_state(struct brw_context *brw,
 
    const uint32_t mocs = is_render_target ? ss_info.rb_mocs : ss_info.tex_mocs;
 
-   isl_surf_fill_state(&isl_dev, dw, .surf = &surf, .view = &view,
+   isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = &view,
                        .address = surface->mt->bo->offset64 + offset,
                        .aux_surf = aux_surf, .aux_usage = aux_usage,
                        .aux_address = aux_offset,
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index c7a66cb..3b9ec47 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -893,6 +893,8 @@ brwCreateContext(gl_api api,
    brw->must_use_separate_stencil = devinfo->must_use_separate_stencil;
    brw->has_swizzling = screen->hw_has_swizzling;
 
+   isl_device_init(&brw->isl_dev, devinfo, screen->hw_has_swizzling);
+
    brw->vs.base.stage = MESA_SHADER_VERTEX;
    brw->tcs.base.stage = MESA_SHADER_TESS_CTRL;
    brw->tes.base.stage = MESA_SHADER_TESS_EVAL;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6b6cfdf..996888b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -40,6 +40,8 @@
 #include "brw_compiler.h"
 #include "intel_aub.h"
 
+#include "isl/isl.h"
+
 #ifdef __cplusplus
 extern "C" {
 	/* Evil hack for using libdrm in a c++ compiler. */
@@ -889,6 +891,8 @@ struct brw_context
     */
    bool needs_unlit_centroid_workaround;
 
+   struct isl_device isl_dev;
+
    GLuint NewGLState;
    struct {
       struct brw_state_flags pipelines[BRW_NUM_PIPELINES];
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 3bff86d..ae1b900 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -79,10 +79,6 @@ brw_emit_surface_state(struct brw_context *brw,
                        uint32_t *surf_offset, int surf_index,
                        unsigned read_domains, unsigned write_domains)
 {
-   /* TODO: This should go in the context */
-   struct isl_device isl_dev;
-   isl_device_init(&isl_dev, brw->intelScreen->devinfo, brw->has_swizzling);
-
    const struct surface_state_info ss_info = surface_state_infos[brw->gen];
 
    struct isl_surf surf;
@@ -111,7 +107,7 @@ brw_emit_surface_state(struct brw_context *brw,
                                     ss_info.num_dwords * 4, ss_info.ss_align,
                                     surf_index, surf_offset);
 
-   isl_surf_fill_state(&isl_dev, dw, .surf = &surf, .view = view,
+   isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = view,
                        .address = mt->bo->offset64 + mt->offset,
                        .aux_surf = aux_surf, .aux_usage = aux_usage,
                        .aux_address = aux_offset,
@@ -496,17 +492,13 @@ brw_emit_buffer_surface_state(struct brw_context *brw,
                               unsigned pitch,
                               bool rw)
 {
-   /* TODO: This should go in the context */
-   struct isl_device isl_dev;
-   isl_device_init(&isl_dev, brw->intelScreen->devinfo, brw->has_swizzling);
-
    const struct surface_state_info ss_info = surface_state_infos[brw->gen];
 
    uint32_t *dw = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
                                   ss_info.num_dwords * 4, ss_info.ss_align,
                                   out_offset);
 
-   isl_buffer_fill_state(&isl_dev, dw,
+   isl_buffer_fill_state(&brw->isl_dev, dw,
                          .address = (bo ? bo->offset64 : 0) + buffer_offset,
                          .size = buffer_size,
                          .format = surface_format,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list