[Mesa-dev] [PATCH 01/31] i965/blorp: Add a blorp_context struct and init/finish funcs

Jason Ekstrand jason at jlekstrand.net
Fri Aug 19 16:55:38 UTC 2016


---
 src/mesa/drivers/dri/i965/blorp.c       | 14 ++++++++++++++
 src/mesa/drivers/dri/i965/blorp.h       | 10 ++++++++++
 src/mesa/drivers/dri/i965/brw_blorp.c   |  6 ++++++
 src/mesa/drivers/dri/i965/brw_blorp.h   |  2 ++
 src/mesa/drivers/dri/i965/brw_context.c |  7 +++++++
 src/mesa/drivers/dri/i965/brw_context.h |  3 +++
 6 files changed, 42 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/blorp.c b/src/mesa/drivers/dri/i965/blorp.c
index 3100615..4005ec7 100644
--- a/src/mesa/drivers/dri/i965/blorp.c
+++ b/src/mesa/drivers/dri/i965/blorp.c
@@ -31,6 +31,20 @@
 #include "brw_state.h"
 
 void
+blorp_init(struct blorp_context *blorp, void *driver_ctx,
+           struct isl_device *isl_dev)
+{
+   blorp->driver_ctx = driver_ctx;
+   blorp->isl_dev = isl_dev;
+}
+
+void
+blorp_finish(struct blorp_context *blorp)
+{
+   blorp->driver_ctx = NULL;
+}
+
+void
 brw_blorp_surface_info_init(struct brw_context *brw,
                             struct brw_blorp_surface_info *info,
                             const struct brw_blorp_surf *surf,
diff --git a/src/mesa/drivers/dri/i965/blorp.h b/src/mesa/drivers/dri/i965/blorp.h
index c20e2be..7dbf022 100644
--- a/src/mesa/drivers/dri/i965/blorp.h
+++ b/src/mesa/drivers/dri/i965/blorp.h
@@ -37,6 +37,16 @@ struct brw_wm_prog_key;
 extern "C" {
 #endif
 
+struct blorp_context {
+   void *driver_ctx;
+
+   const struct isl_device *isl_dev;
+};
+
+void blorp_init(struct blorp_context *blorp, void *driver_ctx,
+                struct isl_device *isl_dev);
+void blorp_finish(struct blorp_context *blorp);
+
 struct brw_blorp_surf
 {
    const struct isl_surf *surf;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index f4c2740..727be63 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -37,6 +37,12 @@
 
 #define FILE_DEBUG_FLAG DEBUG_BLORP
 
+void
+brw_blorp_init(struct brw_context *brw)
+{
+   blorp_init(&brw->blorp, brw, &brw->isl_dev);
+}
+
 static void
 apply_gen6_stencil_hiz_offset(struct isl_surf *surf,
                               struct intel_mipmap_tree *mt,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index 1291916..94de307 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -31,6 +31,8 @@
 extern "C" {
 #endif
 
+void brw_blorp_init(struct brw_context *brw);
+
 void
 brw_blorp_blit_miptrees(struct brw_context *brw,
                         struct intel_mipmap_tree *src_mt,
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index cb74200..f1479e4 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -51,6 +51,7 @@
 
 #include "brw_context.h"
 #include "brw_defines.h"
+#include "brw_blorp.h"
 #include "brw_compiler.h"
 #include "brw_draw.h"
 #include "brw_state.h"
@@ -1003,6 +1004,9 @@ brwCreateContext(gl_api api,
 
    brw_init_surface_formats(brw);
 
+   if (brw->gen >= 6)
+      brw_blorp_init(brw);
+
    brw->max_vs_threads = devinfo->max_vs_threads;
    brw->max_hs_threads = devinfo->max_hs_threads;
    brw->max_ds_threads = devinfo->max_ds_threads;
@@ -1110,6 +1114,9 @@ intelDestroyContext(__DRIcontext * driContextPriv)
       brw_destroy_shader_time(brw);
    }
 
+   if (brw->gen >= 6)
+      blorp_finish(&brw->blorp);
+
    brw_destroy_state(brw);
    brw_draw_destroy(brw);
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e0f7000..e305640 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -41,6 +41,7 @@
 #include "intel_aub.h"
 
 #include "isl/isl.h"
+#include "blorp.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -893,6 +894,8 @@ struct brw_context
 
    struct isl_device isl_dev;
 
+   struct blorp_context blorp;
+
    GLuint NewGLState;
    struct {
       struct brw_state_flags pipelines[BRW_NUM_PIPELINES];
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list