[PATCH i-g-t 2/2] tests/amdgpu: use 64x64 jpeg bitstream

Sathishkumar S sathishkumar.sundararaju at amd.com
Mon May 13 13:57:05 UTC 2024


height to be aligned to mcu boundary on chroma plane as well.
tested on jpeg_1, jpeg_2, jpeg_3, jpeg_4_0_5, jpeg_4_0_3

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju at amd.com>
Acked-by: Leo Liu <leo.liu at amd.com>
---
 lib/amdgpu/amd_mmd_decode_messages.h | 51 +++++++++++++++-------------
 tests/amdgpu/amd_jpeg_dec.c          | 31 +++++++++--------
 2 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/lib/amdgpu/amd_mmd_decode_messages.h b/lib/amdgpu/amd_mmd_decode_messages.h
index 22f223aaf733..20428d98549f 100644
--- a/lib/amdgpu/amd_mmd_decode_messages.h
+++ b/lib/amdgpu/amd_mmd_decode_messages.h
@@ -833,30 +833,33 @@ static const uint8_t feedback_msg[] = {
 };
 
 static const uint8_t jpeg_bitstream[] = {
-	0xFF, 0xD8, 0xFF, 0xDB, 0x01, 0x06, 0x00, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05,
-	0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
-	0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07, 0x08, 0x08, 0x08,
-	0x08, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0C, 0x0C, 0x0B,
-	0x0B, 0x0E, 0x0E, 0x0E, 0x11, 0x11, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC4, 0x00, 0x4B, 0x00, 0x01,
-	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x08, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x11, 0x08, 0x00, 0x08, 0x00, 0x08,
-	0x03, 0x00, 0x22, 0x00, 0x01, 0x11, 0x00, 0x02, 0x11, 0x00, 0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x00,
-	0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00, 0x9F, 0xC0, 0x07, 0xFF, 0xD9, 0xFF, 0xD9,
+	0xFF,0xD8,0xFF,0xDB,0x01,0x06,0x00,0x08,0x04,0x04,0x04,0x04,0x04,0x05,0x05,0x05,
+	0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
+	0x07,0x07,0x07,0x08,0x08,0x08,0x07,0x07,0x07,0x06,0x06,0x07,0x07,0x08,0x08,0x08,
+	0x08,0x09,0x09,0x09,0x08,0x08,0x08,0x08,0x09,0x09,0x0A,0x0A,0x0A,0x0C,0x0C,0x0B,
+	0x0B,0x0E,0x0E,0x0E,0x11,0x11,0x14,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC4,0x00,0x4B,0x00,0x01,
+	0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x08,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x11,0x08,0x00,0x40,0x00,0x40,
+	0x03,0x00,0x22,0x00,0x01,0x11,0x00,0x02,0x11,0x00,0xFF,0xDA,0x00,0x0C,0x03,0x00,
+	0x00,0x01,0x11,0x02,0x11,0x00,0x3F,0x00,0x9F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+	0x00,0x7F,0xFF,0xD9,0xFF,0xD9,
 };
 
+
 #endif /* _AMD_MMD_DECODE_MESSAGES_H_ */
diff --git a/tests/amdgpu/amd_jpeg_dec.c b/tests/amdgpu/amd_jpeg_dec.c
index 12f5bfcff556..8fcc471b8a88 100644
--- a/tests/amdgpu/amd_jpeg_dec.c
+++ b/tests/amdgpu/amd_jpeg_dec.c
@@ -113,13 +113,14 @@ static uint32_t jpeg_chroma_base0_0;
 #define TYPE0				0
 #define TYPE1				1
 #define TYPE3				3
-#define JPEG_DEC_DT_PITCH		0x100
-#define JPEG_DEC_BSD_SIZE		0x180
-#define JPEG_DEC_LUMA_OFFSET		0
-#define JPEG_DEC_CHROMA_OFFSET		0x1000
-#define JPEG_DEC_SUM			4096
-#define IB_SIZE				4096
-#define MAX_RESOURCES			16
+#define JPEG_DEC_DT_PITCH       0x100
+#define WIDTH                   64
+#define JPEG_DEC_BSD_SIZE       0x200
+#define JPEG_DEC_LUMA_OFFSET    0
+#define JPEG_DEC_CHROMA_OFFSET  0x4000
+#define JPEG_DEC_SUM            262144
+#define IB_SIZE                 4096
+#define MAX_RESOURCES           16
 
 static bool
 is_jpeg_tests_enable(amdgpu_device_handle device_handle,
@@ -472,7 +473,7 @@ amdgpu_cs_jpeg_decode(amdgpu_device_handle device_handle,
 	int sum = 0, i, j;
 	uint32_t idx;
 
-	size = 16 * 1024; /* 8K bitstream + 8K output */
+	size = 32 * 1024; /* 8K bitstream + 24K output */
 
 	context->num_resources = 0;
 	alloc_resource(device_handle, &dec_buf, size, AMDGPU_GEM_DOMAIN_VRAM);
@@ -486,10 +487,10 @@ amdgpu_cs_jpeg_decode(amdgpu_device_handle device_handle,
 
 	if (context->jpeg_direct_reg == true) {
 		send_cmd_bitstream_direct(context, dec_buf.addr, &idx);
-		send_cmd_target_direct(context, dec_buf.addr + (size / 2), &idx);
+		send_cmd_target_direct(context, dec_buf.addr + (size / 4), &idx);
 	} else {
 		send_cmd_bitstream(context, dec_buf.addr, &idx);
-		send_cmd_target(context, dec_buf.addr + (size / 2), &idx);
+		send_cmd_target(context, dec_buf.addr + (size / 4), &idx);
 	}
 
 	amdgpu_bo_cpu_unmap(dec_buf.handle);
@@ -499,14 +500,14 @@ amdgpu_cs_jpeg_decode(amdgpu_device_handle device_handle,
 	r = amdgpu_bo_cpu_map(dec_buf.handle, (void **)&dec_buf.ptr);
 	igt_assert_eq(r, 0);
 
-	dec = dec_buf.ptr + (size / 2);
+	dec = dec_buf.ptr + (size / 4);
 
 	/* calculate result checksum */
-	for (i = 0; i < 8; i++)
-		for (j = 0; j < 8; j++)
+	for (i = 0; i < WIDTH; i++)
+		for (j = 0; j < WIDTH; j++)
 			sum += *((dec + JPEG_DEC_LUMA_OFFSET + i * JPEG_DEC_DT_PITCH) + j);
-	for (i = 0; i < 4; i++)
-		for (j = 0; j < 8; j++)
+	for (i = 0; i < (WIDTH/2); i++)
+		for (j = 0; j < WIDTH; j++)
 			sum += *((dec + JPEG_DEC_CHROMA_OFFSET + i * JPEG_DEC_DT_PITCH) + j);
 
 	amdgpu_bo_cpu_unmap(dec_buf.handle);
-- 
2.25.1



More information about the igt-dev mailing list