intel/decoders: read ring buffer length
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 9 Nov 2018 16:49:10 +0000 (16:49 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 16 Nov 2018 11:37:08 +0000 (11:37 +0000)
Use this value to limit reading the ring buffer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Toni Lönnberg <toni.lonnberg@intel.com>
src/intel/tools/aubinator.c
src/intel/tools/aubinator_viewer.cpp

index f3bd006a8ab72c9eea39de73e94410b457a632a3..4dc1fefaa5a2d90b1b58616cf8a57a76fa514288 100644 (file)
@@ -142,6 +142,7 @@ handle_execlist_write(void *user_data, enum drm_i915_gem_engine_class engine, ui
    uint32_t ring_buffer_head = context[5];
    uint32_t ring_buffer_tail = context[7];
    uint32_t ring_buffer_start = context[9];
+   uint32_t ring_buffer_length = (context[11] & 0x1ff000) + 4096;
 
    mem.pml4 = (uint64_t)context[49] << 32 | context[51];
    batch_ctx.user_data = &mem;
@@ -158,7 +159,8 @@ handle_execlist_write(void *user_data, enum drm_i915_gem_engine_class engine, ui
    }
 
    batch_ctx.engine = engine;
-   gen_print_batch(&batch_ctx, commands, ring_buffer_tail - ring_buffer_head,
+   gen_print_batch(&batch_ctx, commands,
+                   MIN2(ring_buffer_tail - ring_buffer_head, ring_buffer_length),
                    0);
    aub_mem_clear_bo_maps(&mem);
 }
index d3638c7001118559b9fd69b6fd65a35db8775a02..e7034fa88929e87aefe07bc5d5dbffe0b6b4c0f5 100644 (file)
@@ -723,6 +723,7 @@ display_batch_execlist_write(void *user_data,
    uint32_t ring_buffer_head = context_img[5];
    uint32_t ring_buffer_tail = context_img[7];
    uint32_t ring_buffer_start = context_img[9];
+   uint32_t ring_buffer_length = (context_img[11] & 0x1ff000) + 4096;
 
    window->mem.pml4 = (uint64_t)context_img[49] << 32 | context_img[51];
 
@@ -735,7 +736,7 @@ display_batch_execlist_write(void *user_data,
 
    window->decode_ctx.engine = engine;
    aub_viewer_render_batch(&window->decode_ctx, commands,
-                           ring_buffer_tail - ring_buffer_head,
+                           MIN2(ring_buffer_tail - ring_buffer_head, ring_buffer_length),
                            ring_buffer_start);
 }