[Mesa-dev] [PATCH v4] intel/decoder: tools: gen_engine to drm_i915_gem_engine_class

Toni Lönnberg toni.lonnberg at intel.com
Thu Nov 8 12:41:01 UTC 2018


Removed the gen_engine enum and changed the involved functions to use the
drm_i915_gem_engine_class enum from UAPI instead.

v3: Wrong engine was being used for blocks in video ring

v4: Fixed aubinator_viewer.cpp
---
 src/intel/tools/aub_read.c           | 22 +++++++++++-----------
 src/intel/tools/aub_read.h           | 11 +++--------
 src/intel/tools/aubinator.c          |  5 ++---
 src/intel/tools/aubinator_viewer.cpp |  6 +++---
 4 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/intel/tools/aub_read.c b/src/intel/tools/aub_read.c
index d83e88ddced..1b6787d4a97 100644
--- a/src/intel/tools/aub_read.c
+++ b/src/intel/tools/aub_read.c
@@ -136,7 +136,7 @@ handle_trace_block(struct aub_read *read, const uint32_t *p)
    int type = p[1] & AUB_TRACE_TYPE_MASK;
    int address_space = p[1] & AUB_TRACE_ADDRESS_SPACE_MASK;
    int header_length = p[0] & 0xffff;
-   int engine = GEN_ENGINE_RENDER;
+   enum drm_i915_gem_engine_class engine = I915_ENGINE_CLASS_RENDER;
    const void *data = p + header_length + 2;
    uint64_t address = gen_48b_address((read->devinfo.gen >= 8 ? ((uint64_t) p[5] << 32) : 0) |
                                       ((uint64_t) p[3]));
@@ -151,13 +151,13 @@ handle_trace_block(struct aub_read *read, const uint32_t *p)
    case AUB_TRACE_OP_COMMAND_WRITE:
       switch (type) {
       case AUB_TRACE_TYPE_RING_PRB0:
-         engine = GEN_ENGINE_RENDER;
+         engine = I915_ENGINE_CLASS_RENDER;
          break;
       case AUB_TRACE_TYPE_RING_PRB1:
-         engine = GEN_ENGINE_VIDEO;
+         engine = I915_ENGINE_CLASS_VIDEO;
          break;
       case AUB_TRACE_TYPE_RING_PRB2:
-         engine = GEN_ENGINE_BLITTER;
+         engine = I915_ENGINE_CLASS_COPY;
          break;
       default:
          parse_error(read, p, "command write to unknown ring %d\n", type);
@@ -182,7 +182,7 @@ handle_memtrace_reg_write(struct aub_read *read, const uint32_t *p)
    if (read->reg_write)
       read->reg_write(read->user_data, offset, value);
 
-   int engine;
+   enum drm_i915_gem_engine_class engine;
    uint64_t context_descriptor;
 
    switch (offset) {
@@ -192,7 +192,7 @@ handle_memtrace_reg_write(struct aub_read *read, const uint32_t *p)
          return;
 
       read->render_elsp_index = 0;
-      engine = GEN_ENGINE_RENDER;
+      engine = I915_ENGINE_CLASS_RENDER;
       context_descriptor = (uint64_t)read->render_elsp[2] << 32 |
          read->render_elsp[3];
       break;
@@ -202,7 +202,7 @@ handle_memtrace_reg_write(struct aub_read *read, const uint32_t *p)
          return;
 
       read->video_elsp_index = 0;
-      engine = GEN_ENGINE_VIDEO;
+      engine = I915_ENGINE_CLASS_VIDEO;
       context_descriptor = (uint64_t)read->video_elsp[2] << 32 |
          read->video_elsp[3];
       break;
@@ -212,7 +212,7 @@ handle_memtrace_reg_write(struct aub_read *read, const uint32_t *p)
          return;
 
       read->blitter_elsp_index = 0;
-      engine = GEN_ENGINE_BLITTER;
+      engine = I915_ENGINE_CLASS_COPY;
       context_descriptor = (uint64_t)read->blitter_elsp[2] << 32 |
          read->blitter_elsp[3];
       break;
@@ -241,17 +241,17 @@ handle_memtrace_reg_write(struct aub_read *read, const uint32_t *p)
       return;
       break;
    case 0x2550: /* render elsc */
-      engine = GEN_ENGINE_RENDER;
+      engine = I915_ENGINE_CLASS_RENDER;
       context_descriptor = (uint64_t)read->render_elsp[2] << 32 |
          read->render_elsp[3];
       break;
    case 0x12550: /* video_elsc */
-      engine = GEN_ENGINE_VIDEO;
+      engine = I915_ENGINE_CLASS_VIDEO;
       context_descriptor = (uint64_t)read->video_elsp[2] << 32 |
          read->video_elsp[3];
       break;
    case 0x22550: /* blitter elsc */
-      engine = GEN_ENGINE_BLITTER;
+      engine = I915_ENGINE_CLASS_COPY;
       context_descriptor = (uint64_t)read->blitter_elsp[2] << 32 |
          read->blitter_elsp[3];
       break;
diff --git a/src/intel/tools/aub_read.h b/src/intel/tools/aub_read.h
index e48ac3164bc..1e788332dcb 100644
--- a/src/intel/tools/aub_read.h
+++ b/src/intel/tools/aub_read.h
@@ -28,17 +28,12 @@
 #include <stdint.h>
 
 #include "dev/gen_device_info.h"
+#include "drm-uapi/i915_drm.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-enum gen_engine {
-   GEN_ENGINE_RENDER = 1,
-   GEN_ENGINE_VIDEO = 2,
-   GEN_ENGINE_BLITTER = 3,
-};
-
 struct aub_read {
    /* Caller's data */
    void *user_data;
@@ -55,9 +50,9 @@ struct aub_read {
 
    void (*reg_write)(void *user_data, uint32_t reg_offset, uint32_t reg_value);
 
-   void (*ring_write)(void *user_data, enum gen_engine engine,
+   void (*ring_write)(void *user_data, enum drm_i915_gem_engine_class engine,
                       const void *data, uint32_t data_len);
-   void (*execlist_write)(void *user_data, enum gen_engine engine,
+   void (*execlist_write)(void *user_data, enum drm_i915_gem_engine_class engine,
                           uint64_t context_descriptor);
 
    /* Reader's data */
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 1458875a313..ed758a62503 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -40,7 +40,6 @@
 
 #include "util/macros.h"
 
-#include "common/gen_decoder.h"
 #include "aub_read.h"
 #include "aub_mem.h"
 
@@ -131,7 +130,7 @@ aubinator_init(void *user_data, int aub_pci_id, const char *app_name)
 }
 
 static void
-handle_execlist_write(void *user_data, enum gen_engine engine, uint64_t context_descriptor)
+handle_execlist_write(void *user_data, enum drm_i915_gem_engine_class engine, uint64_t context_descriptor)
 {
    const uint32_t pphwsp_size = 4096;
    uint32_t pphwsp_addr = context_descriptor & 0xfffff000;
@@ -165,7 +164,7 @@ handle_execlist_write(void *user_data, enum gen_engine engine, uint64_t context_
 }
 
 static void
-handle_ring_write(void *user_data, enum gen_engine engine,
+handle_ring_write(void *user_data, enum drm_i915_gem_engine_class engine,
                   const void *data, uint32_t data_len)
 {
    batch_ctx.user_data = &mem;
diff --git a/src/intel/tools/aubinator_viewer.cpp b/src/intel/tools/aubinator_viewer.cpp
index 27ef4f7e99b..fe7c32a92a4 100644
--- a/src/intel/tools/aubinator_viewer.cpp
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -97,7 +97,7 @@ handle_mem_write(void *user_data, uint64_t phys_addr,
 }
 
 static void
-handle_ring_write(void *user_data, enum gen_engine engine,
+handle_ring_write(void *user_data, enum drm_i915_gem_engine_class engine,
                   const void *ring_data, uint32_t ring_data_len)
 {
    struct aub_file *file = (struct aub_file *) user_data;
@@ -695,7 +695,7 @@ update_batch_window(struct batch_window *window, bool reset, int exec_idx)
 }
 
 static void
-display_batch_ring_write(void *user_data, enum gen_engine engine,
+display_batch_ring_write(void *user_data, enum drm_i915_gem_engine_class engine,
                          const void *data, uint32_t data_len)
 {
    struct batch_window *window = (struct batch_window *) user_data;
@@ -706,7 +706,7 @@ display_batch_ring_write(void *user_data, enum gen_engine engine,
 }
 
 static void
-display_batch_execlist_write(void *user_data, enum gen_engine engine,
+display_batch_execlist_write(void *user_data, enum drm_i915_gem_engine_class,
                              uint64_t context_descriptor)
 {
    struct batch_window *window = (struct batch_window *) user_data;
-- 
2.17.1



More information about the mesa-dev mailing list