[Mesa-dev] [PATCH 20/20] intel/aub_viewer: make pphwsp/context image visible
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue Sep 25 08:23:59 UTC 2018
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/tools/aubinator_viewer.cpp | 64 ++++++++++++++++++++--------
1 file changed, 46 insertions(+), 18 deletions(-)
diff --git a/src/intel/tools/aubinator_viewer.cpp b/src/intel/tools/aubinator_viewer.cpp
index b3cc1909bfa..21c76bb2f11 100644
--- a/src/intel/tools/aubinator_viewer.cpp
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -486,13 +486,18 @@ display_edit_window(struct window *win)
{
struct edit_window *window = (struct edit_window *) win;
- if (window->aub_bo.map && window->gtt_bo.map) {
+ if (window->gtt_bo.map) {
ImGui::BeginChild(ImGui::GetID("##block"));
- window->editor.DrawContents((uint8_t *) window,
- MIN3(window->len,
- window->gtt_bo.size - window->gtt_offset,
- window->aub_bo.size - window->aub_offset),
- window->address);
+
+ size_t mem_size =
+ window->aub_bo.map ?
+ MIN3(window->len,
+ window->gtt_bo.size - window->gtt_offset,
+ window->aub_bo.size - window->aub_offset) :
+ MIN2(window->len,
+ window->gtt_bo.size - window->gtt_offset);
+
+ window->editor.DrawContents((uint8_t *) window, mem_size, window->address);
ImGui::EndChild();
} else {
ImGui::Text("Memory view at 0x%lx not available", window->address);
@@ -510,13 +515,11 @@ destroy_edit_window(struct window *win)
}
static struct edit_window *
-new_edit_window(struct aub_mem *mem, uint64_t address, uint32_t len)
+new_edit_window(const char *title, struct aub_mem *mem,
+ bool ppgtt, uint64_t address, uint32_t len)
{
struct edit_window *window = xtzalloc(*window);
- snprintf(window->base.name, sizeof(window->base.name),
- "Editing aub at 0x%lx##%p", address, window);
-
list_inithead(&window->base.parent_link);
window->base.position = ImVec2(-1, -1);
window->base.size = ImVec2(500, 600);
@@ -526,14 +529,24 @@ new_edit_window(struct aub_mem *mem, uint64_t address, uint32_t len)
window->mem = mem;
window->address = address;
- window->aub_bo = aub_mem_get_ppgtt_addr_aub_data(mem, address);
- window->gtt_bo = aub_mem_get_ppgtt_addr_data(mem, address);
+ if (ppgtt) {
+ window->aub_bo = aub_mem_get_ppgtt_addr_aub_data(mem, address);
+ window->gtt_bo = aub_mem_get_ppgtt_addr_data(mem, address);
+ } else {
+ window->gtt_bo = aub_mem_get_ggtt_bo(mem, address);
+ }
window->len = len;
window->editor = MemoryEditor();
+ window->editor.Cols = 16;
window->editor.OptShowDataPreview = true;
window->editor.OptShowAscii = false;
window->editor.ReadFn = read_edit_window;
window->editor.WriteFn = write_edit_window;
+ window->editor.ReadOnly = window->aub_bo.map == NULL;
+
+ snprintf(window->base.name, sizeof(window->base.name),
+ "%s at 0x%lx (%s) ##%p", title, address,
+ window->aub_bo.map ? "read/write" : "read only", window);
if (window->aub_bo.map) {
uint64_t unaligned_map = (uint64_t) window->aub_bo.map;
@@ -677,7 +690,7 @@ batch_edit_address(void *user_data, uint64_t address, uint32_t len)
{
struct batch_window *window = (struct batch_window *) user_data;
struct edit_window *edit_window =
- new_edit_window(&window->mem, address, len);
+ new_edit_window("Edit instruction", &window->mem, true /* PPGTT */, address, len);
list_add(&edit_window->base.parent_link, &window->base.children_windows);
}
@@ -743,9 +756,26 @@ display_batch_execlist_write(void *user_data, enum gen_engine engine,
window->uses_ppgtt = true;
+ if (ImGui::Button("Show context image")) {
+ struct edit_window *edit_window =
+ new_edit_window("Context image", &window->mem, false /* GGTT */,
+ pphwsp_bo.addr + pphwsp_size, pphwsp_bo.size - pphwsp_size);
+ list_add(&edit_window->base.parent_link, &window->base.children_windows);
+ } ImGui::SameLine();
+ if (ImGui::Button("Show HWSP image")) {
+ struct edit_window *edit_window =
+ new_edit_window("HWSP image", &window->mem, false /* GGTT */,
+ pphwsp_bo.addr, pphwsp_size);
+ list_add(&edit_window->base.parent_link, &window->base.children_windows);
+ }
+
+ ImGui::BeginChild(ImGui::GetID("##block"));
+
aub_viewer_render_batch(&window->decode_ctx, commands,
MIN2(ring_buffer_tail - ring_buffer_head, ring_buffer_length),
ring_buffer_start + ring_buffer_head, true);
+
+ ImGui::EndChild();
}
static void
@@ -767,9 +797,9 @@ display_batch_window(struct window *win)
update_batch_window(window, true, window->exec_idx + 1);
ImGui::Text("execbuf %i", window->exec_idx);
- if (ImGui::Button("Show PPGTT")) { show_pml4_window(&window->pml4_window, &window->mem); }
-
- ImGui::BeginChild(ImGui::GetID("##block"));
+ if (ImGui::Button("Show PPGTT")) {
+ show_pml4_window(&window->pml4_window, &window->mem);
+ } ImGui::SameLine();
struct aub_read read = {};
read.user_data = window;
@@ -781,8 +811,6 @@ display_batch_window(struct window *win)
iter += aub_read_command(&read, iter,
context.file->execs[window->exec_idx].end - iter);
}
-
- ImGui::EndChild();
}
static void
--
2.19.0
More information about the mesa-dev
mailing list