intel/batch-decoder: fix a vb end address calculation
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Thu, 24 Jan 2019 10:53:53 +0000 (12:53 +0200)
committerAndrii Simiklit <andrii.simiklit@globallogic.com>
Fri, 25 Jan 2019 13:12:30 +0000 (15:12 +0200)
According to the loop implementation (in 'ctx_print_buffer' function),
which advances dword by dword over vertex buffer(vb),
the vb size should be aligned by 4 bytes too.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109449
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_batch_decoder.c

index 2a9c8579a7c4c7cd41e733455821ed7e6984360a..916aa3c08971ebafd5b276b9d27d814bf5ec4189 100644 (file)
@@ -24,6 +24,7 @@
 #include "common/gen_decoder.h"
 #include "gen_disasm.h"
 #include "util/macros.h"
+#include "main/macros.h" /* Needed for ROUND_DOWN_TO */
 
 #include <string.h>
 
@@ -169,7 +170,8 @@ ctx_print_buffer(struct gen_batch_decode_ctx *ctx,
                  uint32_t pitch,
                  int max_lines)
 {
-   const uint32_t *dw_end = bo.map + MIN2(bo.size, read_length);
+   const uint32_t *dw_end =
+         bo.map + ROUND_DOWN_TO(MIN2(bo.size, read_length), 4);
 
    int column_count = 0, line_count = -1;
    for (const uint32_t *dw = bo.map; dw < dw_end; dw++) {