[Mesa-dev] [PATCH v2 14/27] i965/blorp: Make the guts of brw_blorp_blit_miptrees miptree-unaware

Jason Ekstrand jason at jlekstrand.net
Tue Jul 26 22:11:18 UTC 2016


Now that we have the brw_blorp_surf struct, we can start to make bits of
blorp completely miptree-unaware.  To start things off, we split the guts
of brw_blorp_blit_miptrees into a brw_blorp_blit function which knows
nothing about miptrees.
---
 src/mesa/drivers/dri/i965/brw_blorp.h        | 14 ++++++++
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 54 +++++++++++++++++++---------
 2 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index 6ae82c7..576a078 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -61,6 +61,20 @@ brw_blorp_to_isl_format(struct brw_context *brw, mesa_format format,
                         bool is_render_target);
 
 void
+brw_blorp_blit(struct brw_context *brw,
+               const struct brw_blorp_surf *src_surf,
+               unsigned src_level, unsigned src_layer,
+               enum isl_format src_format, int src_swizzle,
+               const struct brw_blorp_surf *dst_surf,
+               unsigned dst_level, unsigned dst_layer,
+               enum isl_format dst_format,
+               float src_x0, float src_y0,
+               float src_x1, float src_y1,
+               float dst_x0, float dst_y0,
+               float dst_x1, float dst_y1,
+               GLenum filter, bool mirror_x, bool mirror_y);
+
+void
 brw_blorp_blit_miptrees(struct brw_context *brw,
                         struct intel_mipmap_tree *src_mt,
                         unsigned src_level, unsigned src_layer,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 40751c8..e328739 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -1770,21 +1770,46 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
    intel_miptree_check_level_layer(dst_mt, dst_level, dst_layer);
    intel_miptree_used_for_rendering(dst_mt);
 
+   struct isl_surf tmp_surfs[4];
+   struct brw_blorp_surf src_surf, dst_surf;
+   brw_blorp_surf_for_miptree(brw, &src_surf, src_mt, &src_level, &tmp_surfs[0]);
+   brw_blorp_surf_for_miptree(brw, &dst_surf, dst_mt, &dst_level, &tmp_surfs[2]);
+
+   brw_blorp_blit(brw, &src_surf, src_level, src_layer,
+                  brw_blorp_to_isl_format(brw, src_format, false), src_swizzle,
+                  &dst_surf, dst_level, dst_layer,
+                  brw_blorp_to_isl_format(brw, dst_format, true),
+                  src_x0, src_y0, src_x1, src_y1,
+                  dst_x0, dst_y0, dst_x1, dst_y1,
+                  filter, mirror_x, mirror_y);
+
+   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_layer);
+
+   if (intel_miptree_is_lossless_compressed(brw, dst_mt))
+      dst_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_UNRESOLVED;
+}
+
+void
+brw_blorp_blit(struct brw_context *brw,
+               const struct brw_blorp_surf *src_surf,
+               unsigned src_level, unsigned src_layer,
+               enum isl_format src_format, int src_swizzle,
+               const struct brw_blorp_surf *dst_surf,
+               unsigned dst_level, unsigned dst_layer,
+               enum isl_format dst_format,
+               float src_x0, float src_y0,
+               float src_x1, float src_y1,
+               float dst_x0, float dst_y0,
+               float dst_x1, float dst_y1,
+               GLenum filter, bool mirror_x, bool mirror_y)
+{
    struct brw_blorp_params params;
    brw_blorp_params_init(&params);
 
-   struct isl_surf isl_tmp[4];
-   struct brw_blorp_surf src_surf, dst_surf;
-   brw_blorp_surf_for_miptree(brw, &src_surf, src_mt, &src_level, &isl_tmp[0]);
-   brw_blorp_surface_info_init(brw, &params.src,
-                               &src_surf, src_level, src_layer,
-                               brw_blorp_to_isl_format(brw, src_format, false),
-                               false);
-   brw_blorp_surf_for_miptree(brw, &dst_surf, dst_mt, &dst_level, &isl_tmp[2]);
-   brw_blorp_surface_info_init(brw, &params.dst,
-                               &dst_surf, dst_level, dst_layer,
-                               brw_blorp_to_isl_format(brw, dst_format, true),
-                               true);
+   brw_blorp_surface_info_init(brw, &params.src, src_surf, src_level,
+                               src_layer, src_format, false);
+   brw_blorp_surface_info_init(brw, &params.dst, dst_surf, dst_level,
+                               dst_layer, dst_format, true);
 
    struct brw_blorp_blit_prog_key wm_prog_key;
    memset(&wm_prog_key, 0, sizeof(wm_prog_key));
@@ -2029,9 +2054,4 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
    }
 
    brw_blorp_exec(brw, &params);
-
-   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_layer);
-
-   if (intel_miptree_is_lossless_compressed(brw, dst_mt))
-      dst_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_UNRESOLVED;
 }
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list