i965/blorp: Add a blorp_context struct and init/finish funcs
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 15 Aug 2016 22:07:22 +0000 (15:07 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 29 Aug 2016 19:17:34 +0000 (12:17 -0700)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/blorp.c
src/mesa/drivers/dri/i965/blorp.h
src/mesa/drivers/dri/i965/brw_blorp.c
src/mesa/drivers/dri/i965/brw_blorp.h
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h

index de627deb6193755a3c50c9495cd6f00d6bde86af..cb2cb59eb7e94b990787905ef98619e668bb0577 100644 (file)
 #include "brw_nir.h"
 #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,
index c20e2be8b017241c66ef866030ec497d49b89e14..7dbf022b74bdf3abd0f48348f521f07d88a262e4 100644 (file)
@@ -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;
index f4c2740f6c18da6993f1856dd319e1b5e2e7dedc..727be6325609f823ed78d76ffff18e2b1cefd917 100644 (file)
 
 #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,
index 1291916e9f0b29cb9b5407b2b7d34e8e217c87bd..94de3075e9ca9a88ce8d8a8d6868bdb04d6e2994 100644 (file)
@@ -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,
index 888097d297a0b7b0d994337f8d384f61250412b7..41c972c568acd122d2a98844234c8481c5f55e8d 100644 (file)
@@ -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"
@@ -1048,6 +1049,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;
@@ -1130,6 +1134,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);
 
index 1a4efa3cb0cbd9385ba664e0c8e6274ef074b0f7..d8aa2ba47f36071a049ca82e1db40f4b1499329a 100644 (file)
@@ -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];