[Mesa-dev] [PATCH v2 3/5] intel/blorp: Add blorp_surf_dump function
Jordan Justen
jordan.l.justen at intel.com
Thu Dec 1 03:57:01 UTC 2016
This function takes care of mapping and unmapping the buffers, and
then calls isl_surf_dump.
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/intel/blorp/blorp.c | 35 +++++++++++++++++++++++++++++++++++
src/intel/blorp/blorp.h | 6 ++++++
2 files changed, 41 insertions(+)
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
index 08ce97d..78aba03 100644
--- a/src/intel/blorp/blorp.c
+++ b/src/intel/blorp/blorp.c
@@ -279,3 +279,38 @@ blorp_gen6_hiz_op(struct blorp_batch *batch,
batch->blorp->exec(batch, ¶ms);
}
+
+void
+blorp_surf_dump(const struct blorp_context *blorp,
+ const struct blorp_surf *surf,
+ const char *basename)
+{
+ void *map, *aux_map;
+ unsigned int size, aux_size;
+ bool was_mapped, aux_was_mapped;
+
+ blorp->map(blorp, &surf->addr, &map, &size, &was_mapped);
+ if (map == NULL)
+ return;
+
+ if (surf->aux_addr.buffer) {
+ blorp->map(blorp, &surf->aux_addr, &aux_map, &aux_size, &aux_was_mapped);
+ if (aux_map == NULL) {
+ if (!was_mapped)
+ blorp->unmap(blorp, &surf->addr);
+ return;
+ }
+ } else {
+ aux_map = NULL;
+ aux_size = 0;
+ }
+
+ isl_surf_dump(blorp->isl_dev, surf->surf, map, size,
+ aux_map ? surf->aux_surf : NULL, aux_map, aux_size,
+ basename);
+
+ if (!was_mapped)
+ blorp->unmap(blorp, &surf->addr);
+ if (surf->aux_addr.buffer && !aux_was_mapped)
+ blorp->unmap(blorp, &surf->aux_addr);
+}
diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
index 006d7ac..9f29d9b 100644
--- a/src/intel/blorp/blorp.h
+++ b/src/intel/blorp/blorp.h
@@ -39,6 +39,7 @@ extern "C" {
struct blorp_batch;
struct blorp_params;
struct blorp_address;
+struct brw_blorp_surface_info;
struct blorp_context {
void *driver_ctx;
@@ -210,6 +211,11 @@ blorp_gen6_hiz_op(struct blorp_batch *batch,
struct blorp_surf *surf, unsigned level, unsigned layer,
enum blorp_hiz_op op);
+void
+blorp_surf_dump(const struct blorp_context *blorp,
+ const struct blorp_surf *surf,
+ const char *basename);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
--
2.10.2
More information about the mesa-dev
mailing list