intel/blorp: Add capability to use pre-baked binding tables
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 22 Oct 2016 00:15:49 +0000 (17:15 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Nov 2016 18:11:29 +0000 (10:11 -0800)
When a pre-baked binding table is requested, no binding table is created,
instead the binding table offset (relative to surface state base address)
provided by the user is used verbatim.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/blorp/blorp_genX_exec.h
src/intel/blorp/blorp_priv.h

index d278c1f58b44640d4fdaec21570b0bb342ea85a9..66906fabbccab48cc2973032e2fab767deddd874 100644 (file)
@@ -1108,28 +1108,32 @@ blorp_emit_surface_states(struct blorp_batch *batch,
    uint32_t bind_offset, surface_offsets[2];
    void *surface_maps[2];
 
-   unsigned num_surfaces = 1 + params->src.enabled;
-   blorp_alloc_binding_table(batch, num_surfaces,
-                             isl_dev->ss.size, isl_dev->ss.align,
-                             &bind_offset, surface_offsets, surface_maps);
-
-   if (params->dst.enabled) {
-      blorp_emit_surface_state(batch, &params->dst,
-                               surface_maps[BLORP_RENDERBUFFER_BT_INDEX],
-                               surface_offsets[BLORP_RENDERBUFFER_BT_INDEX],
-                               true);
+   if (params->use_pre_baked_binding_table) {
+      bind_offset = params->pre_baked_binding_table_offset;
    } else {
-      assert(params->depth.enabled || params->stencil.enabled);
-      const struct brw_blorp_surface_info *surface =
-         params->depth.enabled ? &params->depth : &params->stencil;
-      blorp_emit_null_surface_state(batch, surface,
-                                    surface_maps[BLORP_RENDERBUFFER_BT_INDEX]);
-   }
+      unsigned num_surfaces = 1 + params->src.enabled;
+      blorp_alloc_binding_table(batch, num_surfaces,
+                                isl_dev->ss.size, isl_dev->ss.align,
+                                &bind_offset, surface_offsets, surface_maps);
+
+      if (params->dst.enabled) {
+         blorp_emit_surface_state(batch, &params->dst,
+                                  surface_maps[BLORP_RENDERBUFFER_BT_INDEX],
+                                  surface_offsets[BLORP_RENDERBUFFER_BT_INDEX],
+                                  true);
+      } else {
+         assert(params->depth.enabled || params->stencil.enabled);
+         const struct brw_blorp_surface_info *surface =
+            params->depth.enabled ? &params->depth : &params->stencil;
+         blorp_emit_null_surface_state(batch, surface,
+                                       surface_maps[BLORP_RENDERBUFFER_BT_INDEX]);
+      }
 
-   if (params->src.enabled) {
-      blorp_emit_surface_state(batch, &params->src,
-                               surface_maps[BLORP_TEXTURE_BT_INDEX],
-                               surface_offsets[BLORP_TEXTURE_BT_INDEX], false);
+      if (params->src.enabled) {
+         blorp_emit_surface_state(batch, &params->src,
+                                  surface_maps[BLORP_TEXTURE_BT_INDEX],
+                                  surface_offsets[BLORP_TEXTURE_BT_INDEX], false);
+      }
    }
 
 #if GEN_GEN >= 7
index b69babc0baba765160a7e414e55e7ad8ef2b0860..3d64fff3f2e80c24cc4610fbbff2d061783f500e 100644 (file)
@@ -197,6 +197,9 @@ struct blorp_params
    struct brw_vs_prog_data *vs_prog_data;
    uint32_t wm_prog_kernel;
    struct brw_wm_prog_data *wm_prog_data;
+
+   bool use_pre_baked_binding_table;
+   uint32_t pre_baked_binding_table_offset;
 };
 
 void blorp_params_init(struct blorp_params *params);