All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/7] remove unnecessary empty statements
@ 2018-01-26 11:32 Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit Eric Engestrom
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 amdgpu/amdgpu_cs.c                | 2 +-
 tests/exynos/exynos_fimg2d_test.c | 2 +-
 tests/modeprint/modeprint.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 987daa4036f2d99ff15f..46dffe1dffc7a68408fa 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -582,7 +582,7 @@ static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem)
 	if (!sem || !sem->signal_fence.context)
 		return -EINVAL;
 
-	sem->signal_fence.context = NULL;;
+	sem->signal_fence.context = NULL;
 	sem->signal_fence.ip_type = 0;
 	sem->signal_fence.ip_instance = 0;
 	sem->signal_fence.ring = 0;
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 03a79c4e9d2579d71ed3..dcb2e35ab3c5a15b3dd7 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -533,7 +533,7 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
 fail:
 	g2d_fini(ctx);
 
-	return ret;;
+	return ret;
 }
 
 #ifdef EXYNOS_G2D_USERPTR_TEST
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index 0d854103c5ae65b96004..c81dd91db74d0c301b20 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -244,7 +244,7 @@ static int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb)
 	printf("\thandle    : %i\n", fb->handle);
 	printf("\twidth     : %i\n", fb->width);
 	printf("\theight    : %i\n", fb->height);
-	printf("\tpitch     : %i\n", fb->pitch);;
+	printf("\tpitch     : %i\n", fb->pitch);
 	printf("\tbpp       : %i\n", fb->bpp);
 	printf("\tdepth     : %i\n", fb->depth);
 	printf("\tbuffer_id : %i\n", fb->handle);
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 13:26   ` Andrey Grodzovsky
  2018-01-26 11:32 ` [PATCH libdrm 3/7] tests/amdgpu: drop unused variables Eric Engestrom
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

While at it, align with the other half on the next line.

Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
Andrey, is that `0xfffffffc` right? It looks weird to me to be
discarding the bottom two bits.
---
 tests/amdgpu/basic_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 0f75e8961bb7c0c9ecd9..6ee0aa3b044aeffc6adf 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -1608,7 +1608,7 @@ static void amdgpu_sync_dependency_test(void)
 	j = i;
 	ptr[i++] = PACKET3(PACKET3_WRITE_DATA, 3);
 	ptr[i++] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
-	ptr[i++] = 0xfffffffc & ib_result_mc_address + DATA_OFFSET * 4;
+	ptr[i++] =          0xfffffffc & (ib_result_mc_address + DATA_OFFSET * 4);
 	ptr[i++] = (0xffffffff00000000 & (ib_result_mc_address + DATA_OFFSET * 4)) >> 32;
 	ptr[i++] = 99;
 
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 3/7] tests/amdgpu: drop unused variables
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons Eric Engestrom
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 tests/amdgpu/amdgpu_test.c    | 1 -
 tests/amdgpu/basic_tests.c    | 4 ++--
 tests/amdgpu/cs_tests.c       | 2 +-
 tests/amdgpu/deadlock_tests.c | 3 +--
 tests/amdgpu/uvd_enc_tests.c  | 5 +----
 tests/amdgpu/vcn_tests.c      | 2 +-
 tests/amdgpu/vm_tests.c       | 4 +---
 7 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index 8fa3399a4101ccac3e2c..f28e7c6636e4b644bfd2 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -243,7 +243,6 @@ static const char options[]   = "hlrps:t:b:d:f";
 static int amdgpu_open_devices(int open_render_node)
 {
 	drmDevicePtr devices[MAX_CARDS_SUPPORTED];
-	int ret;
 	int i;
 	int drm_node;
 	int amd_index = 0;
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 6ee0aa3b044aeffc6adf..354b015758559c164415 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -681,7 +681,7 @@ static void amdgpu_command_submission_compute_nop(void)
 	struct amdgpu_cs_fence fence_status;
 	uint32_t *ptr;
 	uint32_t expired;
-	int i, r, instance;
+	int r, instance;
 	amdgpu_bo_list_handle bo_list;
 	amdgpu_va_handle va_handle;
 	struct drm_amdgpu_info_hw_ip info;
@@ -1473,7 +1473,7 @@ static void amdgpu_sync_dependency_test(void)
 	struct amdgpu_cs_ib_info ib_info;
 	struct amdgpu_cs_fence fence_status;
 	uint32_t expired;
-	int i, j, r, instance;
+	int i, j, r;
 	amdgpu_bo_list_handle bo_list;
 	amdgpu_va_handle va_handle;
 	static uint32_t *ptr;
diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
index 4880b74f8114d02ec1df..a5361cd59457d039dea9 100644
--- a/tests/amdgpu/cs_tests.c
+++ b/tests/amdgpu/cs_tests.c
@@ -273,7 +273,7 @@ static void amdgpu_cs_uvd_create(void)
 
 static void amdgpu_cs_uvd_decode(void)
 {
-	const unsigned dpb_size = 15923584, ctx_size = 5287680, dt_size = 737280;
+	const unsigned dpb_size = 15923584, dt_size = 737280;
 	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr;
 	struct amdgpu_bo_alloc_request req = {0};
 	amdgpu_bo_handle buf_handle;
diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c
index cd34cdf673a645dbdac0..b38a260fe83d33894003 100644
--- a/tests/amdgpu/deadlock_tests.c
+++ b/tests/amdgpu/deadlock_tests.c
@@ -109,7 +109,6 @@ CU_BOOL suite_deadlock_tests_enable(void)
 
 int suite_deadlock_tests_init(void)
 {
-	struct amdgpu_gpu_info gpu_info = {0};
 	int r;
 
 	r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
@@ -176,7 +175,7 @@ static void amdgpu_deadlock_helper(unsigned ip_type)
 	struct amdgpu_cs_ib_info ib_info;
 	struct amdgpu_cs_fence fence_status;
 	uint32_t expired;
-	int i, r, instance;
+	int i, r;
 	amdgpu_bo_list_handle bo_list;
 	amdgpu_va_handle va_handle;
 
diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
index bed8494a8b666fbda58e..0377c1a5d7e1b789d782 100644
--- a/tests/amdgpu/uvd_enc_tests.c
+++ b/tests/amdgpu/uvd_enc_tests.c
@@ -247,8 +247,6 @@ static void free_resource(struct amdgpu_uvd_enc_bo *uvd_enc_bo)
 
 static void amdgpu_cs_uvd_enc_create(void)
 {
-	int len, r;
-
 	enc.width = 160;
 	enc.height = 128;
 
@@ -263,7 +261,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
 	uint64_t sum;
 	uint32_t s = 175602;
 	uint32_t *ptr, size;
-	int i, j, r;
+	int j, r;
 
 	r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
 	CU_ASSERT_EQUAL(r, 0);
@@ -470,7 +468,6 @@ static void amdgpu_cs_uvd_enc_encode(void)
 
 static void amdgpu_cs_uvd_enc_destroy(void)
 {
-	struct amdgpu_uvd_enc_bo sw_ctx;
 	int len, r;
 
 	num_resources  = 0;
diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
index 9224bc371a462bea140a..2eb8c4347be094a70958 100644
--- a/tests/amdgpu/vcn_tests.c
+++ b/tests/amdgpu/vcn_tests.c
@@ -283,7 +283,7 @@ static void amdgpu_cs_vcn_dec_create(void)
 
 static void amdgpu_cs_vcn_dec_decode(void)
 {
-	const unsigned dpb_size = 15923584, ctx_size = 5287680, dt_size = 737280;
+	const unsigned dpb_size = 15923584, dt_size = 737280;
 	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr, sum;
 	struct amdgpu_vcn_bo dec_buf;
 	int size, len, i, r;
diff --git a/tests/amdgpu/vm_tests.c b/tests/amdgpu/vm_tests.c
index 5f1831076ef9c517197f..75fcb2dbb5bc1de0204b 100644
--- a/tests/amdgpu/vm_tests.c
+++ b/tests/amdgpu/vm_tests.c
@@ -35,7 +35,6 @@ static void amdgpu_vmid_reserve_test(void);
 
 int suite_vm_tests_init(void)
 {
-	struct amdgpu_gpu_info gpu_info = {0};
 	int r;
 
 	r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
@@ -78,10 +77,9 @@ static void amdgpu_vmid_reserve_test(void)
 	struct amdgpu_cs_ib_info ib_info;
 	struct amdgpu_cs_fence fence_status;
 	uint32_t expired, flags;
-	int i, r, instance;
+	int i, r;
 	amdgpu_bo_list_handle bo_list;
 	amdgpu_va_handle va_handle;
-	union drm_amdgpu_vm vm;
 	static uint32_t *ptr;
 
 	r = amdgpu_cs_ctx_create(device_handle, &context_handle);
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 3/7] tests/amdgpu: drop unused variables Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 11:38   ` Christian König
  2018-01-26 11:32 ` [PATCH libdrm 5/7] tests/util: fix signed/unsigned comparisons Eric Engestrom
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 tests/amdgpu/cs_tests.c      |  2 +-
 tests/amdgpu/uvd_enc_tests.c | 10 +++++-----
 tests/amdgpu/vce_tests.c     | 10 +++++-----
 tests/amdgpu/vcn_tests.c     |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
index a5361cd59457d039dea9..40700f53d35f3340b895 100644
--- a/tests/amdgpu/cs_tests.c
+++ b/tests/amdgpu/cs_tests.c
@@ -396,7 +396,7 @@ static void amdgpu_cs_uvd_decode(void)
 	CU_ASSERT_EQUAL(r, 0);
 
 	/* TODO: use a real CRC32 */
-	for (i = 0, sum = 0; i < dt_size; ++i)
+	for (uint64_t i = 0, sum = 0; i < dt_size; ++i)
 		sum += ptr[i];
 	CU_ASSERT_EQUAL(sum, SUM_DECODE);
 
diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
index 0377c1a5d7e1b789d782..c1b840e3e56d83d0a3af 100644
--- a/tests/amdgpu/uvd_enc_tests.c
+++ b/tests/amdgpu/uvd_enc_tests.c
@@ -261,7 +261,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
 	uint64_t sum;
 	uint32_t s = 175602;
 	uint32_t *ptr, size;
-	int j, r;
+	int r;
 
 	r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
 	CU_ASSERT_EQUAL(r, 0);
@@ -271,7 +271,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
 	CU_ASSERT_EQUAL(r, 0);
 	r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr);
 	CU_ASSERT_EQUAL(r, 0);
-	for (j = 0, sum = 0; j < size; ++j)
+	for (uint32_t j = 0, sum = 0; j < size; ++j)
 		sum += enc->bs.ptr[j];
 	CU_ASSERT_EQUAL(sum, s);
 	r = amdgpu_bo_cpu_unmap(enc->bs.handle);
@@ -331,7 +331,7 @@ static void amdgpu_cs_uvd_enc_session_init(void)
 
 static void amdgpu_cs_uvd_enc_encode(void)
 {
-	int len, r, i;
+	int len, r;
 	uint64_t luma_offset, chroma_offset;
 	uint32_t vbuf_size, bs_size = 0x003f4800, cpb_size;
 	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
@@ -354,11 +354,11 @@ static void amdgpu_cs_uvd_enc_encode(void)
 	CU_ASSERT_EQUAL(r, 0);
 
 	memset(enc.vbuf.ptr, 0, vbuf_size);
-	for (i = 0; i < enc.height; ++i) {
+	for (unsigned i = 0; i < enc.height; ++i) {
 		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
 		enc.vbuf.ptr += ALIGN(enc.width, align);
 	}
-	for (i = 0; i < enc.height / 2; ++i) {
+	for (unsigned i = 0; i < enc.height / 2; ++i) {
 		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
 		enc.vbuf.ptr += ALIGN(enc.width, align);
 	}
diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
index 75821bbb1e6c92e91fe7..6da6511793a1cf0ab488 100644
--- a/tests/amdgpu/vce_tests.c
+++ b/tests/amdgpu/vce_tests.c
@@ -425,8 +425,8 @@ static void check_result(struct amdgpu_vce_encode *enc)
 {
 	uint64_t sum;
 	uint32_t s[2] = {180325, 15946};
-	uint32_t *ptr, size;
-	int i, j, r;
+	uint32_t *ptr, i, j, size;
+	int r;
 
 	for (i = 0; i < 2; ++i) {
 		r = amdgpu_bo_cpu_map(enc->fb[i].handle, (void **)&enc->fb[i].ptr);
@@ -449,7 +449,7 @@ static void amdgpu_cs_vce_encode(void)
 {
 	uint32_t vbuf_size, bs_size = 0x154000, cpb_size;
 	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
-	int i, r;
+	int r;
 
 	vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5;
 	cpb_size = vbuf_size * 10;
@@ -472,11 +472,11 @@ static void amdgpu_cs_vce_encode(void)
 	CU_ASSERT_EQUAL(r, 0);
 
 	memset(enc.vbuf.ptr, 0, vbuf_size);
-	for (i = 0; i < enc.height; ++i) {
+	for (unsigned i = 0; i < enc.height; ++i) {
 		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
 		enc.vbuf.ptr += ALIGN(enc.width, align);
 	}
-	for (i = 0; i < enc.height / 2; ++i) {
+	for (unsigned i = 0; i < enc.height / 2; ++i) {
 		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
 		enc.vbuf.ptr += ALIGN(enc.width, align);
 	}
diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
index 2eb8c4347be094a70958..b228db609f0e0c0fefdd 100644
--- a/tests/amdgpu/vcn_tests.c
+++ b/tests/amdgpu/vcn_tests.c
@@ -239,7 +239,7 @@ static void free_resource(struct amdgpu_vcn_bo *vcn_bo)
 	memset(vcn_bo, 0, sizeof(*vcn_bo));
 }
 
-static void vcn_dec_cmd(uint64_t addr, unsigned cmd, int *idx)
+static void vcn_dec_cmd(uint64_t addr, unsigned cmd, unsigned *idx)
 {
 	ib_cpu[(*idx)++] = 0x81C4;
 	ib_cpu[(*idx)++] = addr;
@@ -286,7 +286,7 @@ static void amdgpu_cs_vcn_dec_decode(void)
 	const unsigned dpb_size = 15923584, dt_size = 737280;
 	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr, sum;
 	struct amdgpu_vcn_bo dec_buf;
-	int size, len, i, r;
+	unsigned size, len, i, r;
 	uint8_t *dec;
 
 	size = 4*1024; /* msg */
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 5/7] tests/util: fix signed/unsigned comparisons
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
                   ` (2 preceding siblings ...)
  2018-01-26 11:32 ` [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 6/7] tests/util: drop unused parameters Eric Engestrom
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 tests/util/pattern.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index 00b08a8cb8ebbd4e25f8..095eadf2fa459638c134 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -549,7 +549,6 @@ static void make_pwetty(void *data, unsigned int width, unsigned int height,
 #ifdef HAVE_CAIRO
 	cairo_surface_t *surface;
 	cairo_t *cr;
-	int x, y;
 	cairo_format_t cairo_format;
 
 	/* we can ignore the order of R,G,B channels */
@@ -576,8 +575,8 @@ static void make_pwetty(void *data, unsigned int width, unsigned int height,
 	cairo_surface_destroy(surface);
 
 	cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
-	for (x = 0; x < width; x += 250)
-		for (y = 0; y < height; y += 250) {
+	for (unsigned x = 0; x < width; x += 250)
+		for (unsigned y = 0; y < height; y += 250) {
 			char buf[64];
 
 			cairo_move_to(cr, x, y - 20);
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 6/7] tests/util: drop unused parameters
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
                   ` (3 preceding siblings ...)
  2018-01-26 11:32 ` [PATCH libdrm 5/7] tests/util: fix signed/unsigned comparisons Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 11:32 ` [PATCH libdrm 7/7] tests/etnaviv: drop unused `return 0` Eric Engestrom
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 tests/util/pattern.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index 095eadf2fa459638c134..2366b00613a7f1c63cde 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -823,8 +823,8 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3],
 	}
 }
 
-static void fill_plain(const struct util_format_info *info, void *planes[3],
-		       unsigned int width, unsigned int height,
+static void fill_plain(void *planes[3],
+		       unsigned int height,
 		       unsigned int stride)
 {
 	memset(planes[0], 0x77, stride * height);
@@ -860,7 +860,7 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,
 		return fill_smpte(info, planes, width, height, stride);
 
 	case UTIL_PATTERN_PLAIN:
-		return fill_plain(info, planes, width, height, stride);
+		return fill_plain(planes, height, stride);
 
 	default:
 		printf("Error: unsupported test pattern %u.\n", pattern);
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH libdrm 7/7] tests/etnaviv: drop unused `return 0`
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
                   ` (4 preceding siblings ...)
  2018-01-26 11:32 ` [PATCH libdrm 6/7] tests/util: drop unused parameters Eric Engestrom
@ 2018-01-26 11:32 ` Eric Engestrom
  2018-01-26 11:35 ` [PATCH libdrm 1/7] remove unnecessary empty statements Christian König
  2018-01-26 17:44 ` Emil Velikov
  7 siblings, 0 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 11:32 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 tests/etnaviv/write_bmp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/etnaviv/write_bmp.c b/tests/etnaviv/write_bmp.c
index 7ae0646c92b3d08eed70..f7b6bc69e5d20d0dfd07 100644
--- a/tests/etnaviv/write_bmp.c
+++ b/tests/etnaviv/write_bmp.c
@@ -63,7 +63,7 @@ struct dib_header {
 	unsigned int unused[12];
 } __attribute__((__packed__));
 
-static int
+static void
 bmp_header_write(int fd, int width, int height, int bgra, int noflip, int alpha)
 {
 	struct bmp_header bmp_header = {
@@ -98,8 +98,6 @@ bmp_header_write(int fd, int width, int height, int bgra, int noflip, int alpha)
 
 	write(fd, &bmp_header, sizeof(struct bmp_header));
 	write(fd, &dib_header, sizeof(struct dib_header));
-
-	return 0;
 }
 
 void
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 1/7] remove unnecessary empty statements
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
                   ` (5 preceding siblings ...)
  2018-01-26 11:32 ` [PATCH libdrm 7/7] tests/etnaviv: drop unused `return 0` Eric Engestrom
@ 2018-01-26 11:35 ` Christian König
  2018-01-26 17:44 ` Emil Velikov
  7 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2018-01-26 11:35 UTC (permalink / raw)
  To: Eric Engestrom, dri-devel

Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   amdgpu/amdgpu_cs.c                | 2 +-
>   tests/exynos/exynos_fimg2d_test.c | 2 +-
>   tests/modeprint/modeprint.c       | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
> index 987daa4036f2d99ff15f..46dffe1dffc7a68408fa 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -582,7 +582,7 @@ static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem)
>   	if (!sem || !sem->signal_fence.context)
>   		return -EINVAL;
>   
> -	sem->signal_fence.context = NULL;;
> +	sem->signal_fence.context = NULL;
>   	sem->signal_fence.ip_type = 0;
>   	sem->signal_fence.ip_instance = 0;
>   	sem->signal_fence.ring = 0;
> diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
> index 03a79c4e9d2579d71ed3..dcb2e35ab3c5a15b3dd7 100644
> --- a/tests/exynos/exynos_fimg2d_test.c
> +++ b/tests/exynos/exynos_fimg2d_test.c
> @@ -533,7 +533,7 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
>   fail:
>   	g2d_fini(ctx);
>   
> -	return ret;;
> +	return ret;
>   }
>   
>   #ifdef EXYNOS_G2D_USERPTR_TEST
> diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
> index 0d854103c5ae65b96004..c81dd91db74d0c301b20 100644
> --- a/tests/modeprint/modeprint.c
> +++ b/tests/modeprint/modeprint.c
> @@ -244,7 +244,7 @@ static int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb)
>   	printf("\thandle    : %i\n", fb->handle);
>   	printf("\twidth     : %i\n", fb->width);
>   	printf("\theight    : %i\n", fb->height);
> -	printf("\tpitch     : %i\n", fb->pitch);;
> +	printf("\tpitch     : %i\n", fb->pitch);
>   	printf("\tbpp       : %i\n", fb->bpp);
>   	printf("\tdepth     : %i\n", fb->depth);
>   	printf("\tbuffer_id : %i\n", fb->handle);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
  2018-01-26 11:32 ` [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons Eric Engestrom
@ 2018-01-26 11:38   ` Christian König
  2018-01-26 17:15     ` Eric Engestrom
  0 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2018-01-26 11:38 UTC (permalink / raw)
  To: Eric Engestrom, dri-devel

Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
>   tests/amdgpu/cs_tests.c      |  2 +-
>   tests/amdgpu/uvd_enc_tests.c | 10 +++++-----
>   tests/amdgpu/vce_tests.c     | 10 +++++-----
>   tests/amdgpu/vcn_tests.c     |  4 ++--
>   4 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
> index a5361cd59457d039dea9..40700f53d35f3340b895 100644
> --- a/tests/amdgpu/cs_tests.c
> +++ b/tests/amdgpu/cs_tests.c
> @@ -396,7 +396,7 @@ static void amdgpu_cs_uvd_decode(void)
>   	CU_ASSERT_EQUAL(r, 0);
>   
>   	/* TODO: use a real CRC32 */
> -	for (i = 0, sum = 0; i < dt_size; ++i)
> +	for (uint64_t i = 0, sum = 0; i < dt_size; ++i)

Please keep the define local to the function, even worse this seems to 
shadow a local defined i.

Christian.

>   		sum += ptr[i];
>   	CU_ASSERT_EQUAL(sum, SUM_DECODE);
>   
> diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
> index 0377c1a5d7e1b789d782..c1b840e3e56d83d0a3af 100644
> --- a/tests/amdgpu/uvd_enc_tests.c
> +++ b/tests/amdgpu/uvd_enc_tests.c
> @@ -261,7 +261,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
>   	uint64_t sum;
>   	uint32_t s = 175602;
>   	uint32_t *ptr, size;
> -	int j, r;
> +	int r;
>   
>   	r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
>   	CU_ASSERT_EQUAL(r, 0);
> @@ -271,7 +271,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
>   	CU_ASSERT_EQUAL(r, 0);
>   	r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr);
>   	CU_ASSERT_EQUAL(r, 0);
> -	for (j = 0, sum = 0; j < size; ++j)
> +	for (uint32_t j = 0, sum = 0; j < size; ++j)
>   		sum += enc->bs.ptr[j];
>   	CU_ASSERT_EQUAL(sum, s);
>   	r = amdgpu_bo_cpu_unmap(enc->bs.handle);
> @@ -331,7 +331,7 @@ static void amdgpu_cs_uvd_enc_session_init(void)
>   
>   static void amdgpu_cs_uvd_enc_encode(void)
>   {
> -	int len, r, i;
> +	int len, r;
>   	uint64_t luma_offset, chroma_offset;
>   	uint32_t vbuf_size, bs_size = 0x003f4800, cpb_size;
>   	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
> @@ -354,11 +354,11 @@ static void amdgpu_cs_uvd_enc_encode(void)
>   	CU_ASSERT_EQUAL(r, 0);
>   
>   	memset(enc.vbuf.ptr, 0, vbuf_size);
> -	for (i = 0; i < enc.height; ++i) {
> +	for (unsigned i = 0; i < enc.height; ++i) {
>   		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
>   		enc.vbuf.ptr += ALIGN(enc.width, align);
>   	}
> -	for (i = 0; i < enc.height / 2; ++i) {
> +	for (unsigned i = 0; i < enc.height / 2; ++i) {
>   		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
>   		enc.vbuf.ptr += ALIGN(enc.width, align);
>   	}
> diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
> index 75821bbb1e6c92e91fe7..6da6511793a1cf0ab488 100644
> --- a/tests/amdgpu/vce_tests.c
> +++ b/tests/amdgpu/vce_tests.c
> @@ -425,8 +425,8 @@ static void check_result(struct amdgpu_vce_encode *enc)
>   {
>   	uint64_t sum;
>   	uint32_t s[2] = {180325, 15946};
> -	uint32_t *ptr, size;
> -	int i, j, r;
> +	uint32_t *ptr, i, j, size;
> +	int r;
>   
>   	for (i = 0; i < 2; ++i) {
>   		r = amdgpu_bo_cpu_map(enc->fb[i].handle, (void **)&enc->fb[i].ptr);
> @@ -449,7 +449,7 @@ static void amdgpu_cs_vce_encode(void)
>   {
>   	uint32_t vbuf_size, bs_size = 0x154000, cpb_size;
>   	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
> -	int i, r;
> +	int r;
>   
>   	vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5;
>   	cpb_size = vbuf_size * 10;
> @@ -472,11 +472,11 @@ static void amdgpu_cs_vce_encode(void)
>   	CU_ASSERT_EQUAL(r, 0);
>   
>   	memset(enc.vbuf.ptr, 0, vbuf_size);
> -	for (i = 0; i < enc.height; ++i) {
> +	for (unsigned i = 0; i < enc.height; ++i) {
>   		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
>   		enc.vbuf.ptr += ALIGN(enc.width, align);
>   	}
> -	for (i = 0; i < enc.height / 2; ++i) {
> +	for (unsigned i = 0; i < enc.height / 2; ++i) {
>   		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
>   		enc.vbuf.ptr += ALIGN(enc.width, align);
>   	}
> diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
> index 2eb8c4347be094a70958..b228db609f0e0c0fefdd 100644
> --- a/tests/amdgpu/vcn_tests.c
> +++ b/tests/amdgpu/vcn_tests.c
> @@ -239,7 +239,7 @@ static void free_resource(struct amdgpu_vcn_bo *vcn_bo)
>   	memset(vcn_bo, 0, sizeof(*vcn_bo));
>   }
>   
> -static void vcn_dec_cmd(uint64_t addr, unsigned cmd, int *idx)
> +static void vcn_dec_cmd(uint64_t addr, unsigned cmd, unsigned *idx)
>   {
>   	ib_cpu[(*idx)++] = 0x81C4;
>   	ib_cpu[(*idx)++] = addr;
> @@ -286,7 +286,7 @@ static void amdgpu_cs_vcn_dec_decode(void)
>   	const unsigned dpb_size = 15923584, dt_size = 737280;
>   	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr, sum;
>   	struct amdgpu_vcn_bo dec_buf;
> -	int size, len, i, r;
> +	unsigned size, len, i, r;
>   	uint8_t *dec;
>   
>   	size = 4*1024; /* msg */

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit
  2018-01-26 11:32 ` [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit Eric Engestrom
@ 2018-01-26 13:26   ` Andrey Grodzovsky
  2018-01-26 16:50     ` Eric Engestrom
  0 siblings, 1 reply; 14+ messages in thread
From: Andrey Grodzovsky @ 2018-01-26 13:26 UTC (permalink / raw)
  To: Eric Engestrom, dri-devel



On 01/26/2018 06:32 AM, Eric Engestrom wrote:
> While at it, align with the other half on the next line.
>
> Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
> Andrey, is that `0xfffffffc` right? It looks weird to me to be
> discarding the bottom two bits.

That correct  according to the PM4 packet spec,
(e.g. 
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/si_programming_guide_v2.pdf
2.9.4 WRITE_DATA, DST_ADDR_LO field, when destination is memory the bits 
range is [31:2] for 32 bit addresses
and [31:3] for 64 bit addresses) Those 2 bits are always 0 in this case 
anyway.

Thanks,
Andrey

> ---
>   tests/amdgpu/basic_tests.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
> index 0f75e8961bb7c0c9ecd9..6ee0aa3b044aeffc6adf 100644
> --- a/tests/amdgpu/basic_tests.c
> +++ b/tests/amdgpu/basic_tests.c
> @@ -1608,7 +1608,7 @@ static void amdgpu_sync_dependency_test(void)
>   	j = i;
>   	ptr[i++] = PACKET3(PACKET3_WRITE_DATA, 3);
>   	ptr[i++] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
> -	ptr[i++] = 0xfffffffc & ib_result_mc_address + DATA_OFFSET * 4;
> +	ptr[i++] =          0xfffffffc & (ib_result_mc_address + DATA_OFFSET * 4);
>   	ptr[i++] = (0xffffffff00000000 & (ib_result_mc_address + DATA_OFFSET * 4)) >> 32;
>   	ptr[i++] = 99;
>   

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit
  2018-01-26 13:26   ` Andrey Grodzovsky
@ 2018-01-26 16:50     ` Eric Engestrom
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 16:50 UTC (permalink / raw)
  To: Andrey Grodzovsky; +Cc: dri-devel

On Friday, 2018-01-26 08:26:15 -0500, Andrey Grodzovsky wrote:
> 
> 
> On 01/26/2018 06:32 AM, Eric Engestrom wrote:
> > While at it, align with the other half on the next line.
> > 
> > Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> > Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> > ---
> > Andrey, is that `0xfffffffc` right? It looks weird to me to be
> > discarding the bottom two bits.
> 
> That correct  according to the PM4 packet spec,
> (e.g. http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/si_programming_guide_v2.pdf
> 2.9.4 WRITE_DATA, DST_ADDR_LO field, when destination is memory the bits
> range is [31:2] for 32 bit addresses
> and [31:3] for 64 bit addresses) Those 2 bits are always 0 in this case
> anyway.

Thanks for the confirmation :)

> 
> Thanks,
> Andrey
> 
> > ---
> >   tests/amdgpu/basic_tests.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
> > index 0f75e8961bb7c0c9ecd9..6ee0aa3b044aeffc6adf 100644
> > --- a/tests/amdgpu/basic_tests.c
> > +++ b/tests/amdgpu/basic_tests.c
> > @@ -1608,7 +1608,7 @@ static void amdgpu_sync_dependency_test(void)
> >   	j = i;
> >   	ptr[i++] = PACKET3(PACKET3_WRITE_DATA, 3);
> >   	ptr[i++] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
> > -	ptr[i++] = 0xfffffffc & ib_result_mc_address + DATA_OFFSET * 4;
> > +	ptr[i++] =          0xfffffffc & (ib_result_mc_address + DATA_OFFSET * 4);
> >   	ptr[i++] = (0xffffffff00000000 & (ib_result_mc_address + DATA_OFFSET * 4)) >> 32;
> >   	ptr[i++] = 99;
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
  2018-01-26 11:38   ` Christian König
@ 2018-01-26 17:15     ` Eric Engestrom
  2018-01-26 17:17       ` Christian König
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Engestrom @ 2018-01-26 17:15 UTC (permalink / raw)
  To: christian.koenig; +Cc: dri-devel

On Friday, 2018-01-26 12:38:35 +0100, Christian König wrote:
> Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
> > Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> > ---
> >   tests/amdgpu/cs_tests.c      |  2 +-
> >   tests/amdgpu/uvd_enc_tests.c | 10 +++++-----
> >   tests/amdgpu/vce_tests.c     | 10 +++++-----
> >   tests/amdgpu/vcn_tests.c     |  4 ++--
> >   4 files changed, 13 insertions(+), 13 deletions(-)
> > 
> > diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
> > index a5361cd59457d039dea9..40700f53d35f3340b895 100644
> > --- a/tests/amdgpu/cs_tests.c
> > +++ b/tests/amdgpu/cs_tests.c
> > @@ -396,7 +396,7 @@ static void amdgpu_cs_uvd_decode(void)
> >   	CU_ASSERT_EQUAL(r, 0);
> >   	/* TODO: use a real CRC32 */
> > -	for (i = 0, sum = 0; i < dt_size; ++i)
> > +	for (uint64_t i = 0, sum = 0; i < dt_size; ++i)
> 
> Please keep the define local to the function,

I assume this applies to all the hunks in this patch, right?
I'll send a v2 later (ie. next week).

> even worse this seems to shadow a local defined i.

It does shadow the function-wide `i`, because it's a different kind of
index. I guess really it should have a different name, but I don't know
enought about what this is all doing to think of a good name; any ideas?

> 
> Christian.
> 
> >   		sum += ptr[i];
> >   	CU_ASSERT_EQUAL(sum, SUM_DECODE);
> > diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
> > index 0377c1a5d7e1b789d782..c1b840e3e56d83d0a3af 100644
> > --- a/tests/amdgpu/uvd_enc_tests.c
> > +++ b/tests/amdgpu/uvd_enc_tests.c
> > @@ -261,7 +261,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
> >   	uint64_t sum;
> >   	uint32_t s = 175602;
> >   	uint32_t *ptr, size;
> > -	int j, r;
> > +	int r;
> >   	r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
> >   	CU_ASSERT_EQUAL(r, 0);
> > @@ -271,7 +271,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
> >   	CU_ASSERT_EQUAL(r, 0);
> >   	r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr);
> >   	CU_ASSERT_EQUAL(r, 0);
> > -	for (j = 0, sum = 0; j < size; ++j)
> > +	for (uint32_t j = 0, sum = 0; j < size; ++j)
> >   		sum += enc->bs.ptr[j];
> >   	CU_ASSERT_EQUAL(sum, s);
> >   	r = amdgpu_bo_cpu_unmap(enc->bs.handle);
> > @@ -331,7 +331,7 @@ static void amdgpu_cs_uvd_enc_session_init(void)
> >   static void amdgpu_cs_uvd_enc_encode(void)
> >   {
> > -	int len, r, i;
> > +	int len, r;
> >   	uint64_t luma_offset, chroma_offset;
> >   	uint32_t vbuf_size, bs_size = 0x003f4800, cpb_size;
> >   	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
> > @@ -354,11 +354,11 @@ static void amdgpu_cs_uvd_enc_encode(void)
> >   	CU_ASSERT_EQUAL(r, 0);
> >   	memset(enc.vbuf.ptr, 0, vbuf_size);
> > -	for (i = 0; i < enc.height; ++i) {
> > +	for (unsigned i = 0; i < enc.height; ++i) {
> >   		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
> >   		enc.vbuf.ptr += ALIGN(enc.width, align);
> >   	}
> > -	for (i = 0; i < enc.height / 2; ++i) {
> > +	for (unsigned i = 0; i < enc.height / 2; ++i) {
> >   		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
> >   		enc.vbuf.ptr += ALIGN(enc.width, align);
> >   	}
> > diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
> > index 75821bbb1e6c92e91fe7..6da6511793a1cf0ab488 100644
> > --- a/tests/amdgpu/vce_tests.c
> > +++ b/tests/amdgpu/vce_tests.c
> > @@ -425,8 +425,8 @@ static void check_result(struct amdgpu_vce_encode *enc)
> >   {
> >   	uint64_t sum;
> >   	uint32_t s[2] = {180325, 15946};
> > -	uint32_t *ptr, size;
> > -	int i, j, r;
> > +	uint32_t *ptr, i, j, size;
> > +	int r;
> >   	for (i = 0; i < 2; ++i) {
> >   		r = amdgpu_bo_cpu_map(enc->fb[i].handle, (void **)&enc->fb[i].ptr);
> > @@ -449,7 +449,7 @@ static void amdgpu_cs_vce_encode(void)
> >   {
> >   	uint32_t vbuf_size, bs_size = 0x154000, cpb_size;
> >   	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
> > -	int i, r;
> > +	int r;
> >   	vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5;
> >   	cpb_size = vbuf_size * 10;
> > @@ -472,11 +472,11 @@ static void amdgpu_cs_vce_encode(void)
> >   	CU_ASSERT_EQUAL(r, 0);
> >   	memset(enc.vbuf.ptr, 0, vbuf_size);
> > -	for (i = 0; i < enc.height; ++i) {
> > +	for (unsigned i = 0; i < enc.height; ++i) {
> >   		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
> >   		enc.vbuf.ptr += ALIGN(enc.width, align);
> >   	}
> > -	for (i = 0; i < enc.height / 2; ++i) {
> > +	for (unsigned i = 0; i < enc.height / 2; ++i) {
> >   		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
> >   		enc.vbuf.ptr += ALIGN(enc.width, align);
> >   	}
> > diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
> > index 2eb8c4347be094a70958..b228db609f0e0c0fefdd 100644
> > --- a/tests/amdgpu/vcn_tests.c
> > +++ b/tests/amdgpu/vcn_tests.c
> > @@ -239,7 +239,7 @@ static void free_resource(struct amdgpu_vcn_bo *vcn_bo)
> >   	memset(vcn_bo, 0, sizeof(*vcn_bo));
> >   }
> > -static void vcn_dec_cmd(uint64_t addr, unsigned cmd, int *idx)
> > +static void vcn_dec_cmd(uint64_t addr, unsigned cmd, unsigned *idx)
> >   {
> >   	ib_cpu[(*idx)++] = 0x81C4;
> >   	ib_cpu[(*idx)++] = addr;
> > @@ -286,7 +286,7 @@ static void amdgpu_cs_vcn_dec_decode(void)
> >   	const unsigned dpb_size = 15923584, dt_size = 737280;
> >   	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr, sum;
> >   	struct amdgpu_vcn_bo dec_buf;
> > -	int size, len, i, r;
> > +	unsigned size, len, i, r;
> >   	uint8_t *dec;
> >   	size = 4*1024; /* msg */
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
  2018-01-26 17:15     ` Eric Engestrom
@ 2018-01-26 17:17       ` Christian König
  0 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2018-01-26 17:17 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: dri-devel

Am 26.01.2018 um 18:15 schrieb Eric Engestrom:
> On Friday, 2018-01-26 12:38:35 +0100, Christian König wrote:
>> Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
>>> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
>>> ---
>>>    tests/amdgpu/cs_tests.c      |  2 +-
>>>    tests/amdgpu/uvd_enc_tests.c | 10 +++++-----
>>>    tests/amdgpu/vce_tests.c     | 10 +++++-----
>>>    tests/amdgpu/vcn_tests.c     |  4 ++--
>>>    4 files changed, 13 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
>>> index a5361cd59457d039dea9..40700f53d35f3340b895 100644
>>> --- a/tests/amdgpu/cs_tests.c
>>> +++ b/tests/amdgpu/cs_tests.c
>>> @@ -396,7 +396,7 @@ static void amdgpu_cs_uvd_decode(void)
>>>    	CU_ASSERT_EQUAL(r, 0);
>>>    	/* TODO: use a real CRC32 */
>>> -	for (i = 0, sum = 0; i < dt_size; ++i)
>>> +	for (uint64_t i = 0, sum = 0; i < dt_size; ++i)
>> Please keep the define local to the function,
> I assume this applies to all the hunks in this patch, right?

Yeah, in general we try to follow kernel coding style rules with the 
libdrm amdgpu stuff.

> I'll send a v2 later (ie. next week).
>
>> even worse this seems to shadow a local defined i.
> It does shadow the function-wide `i`, because it's a different kind of
> index. I guess really it should have a different name, but I don't know
> enought about what this is all doing to think of a good name; any ideas?

Just make the function wide i uint64_t, that should work and nothing of 
that code is performance critical.

Christian.

>
>> Christian.
>>
>>>    		sum += ptr[i];
>>>    	CU_ASSERT_EQUAL(sum, SUM_DECODE);
>>> diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
>>> index 0377c1a5d7e1b789d782..c1b840e3e56d83d0a3af 100644
>>> --- a/tests/amdgpu/uvd_enc_tests.c
>>> +++ b/tests/amdgpu/uvd_enc_tests.c
>>> @@ -261,7 +261,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
>>>    	uint64_t sum;
>>>    	uint32_t s = 175602;
>>>    	uint32_t *ptr, size;
>>> -	int j, r;
>>> +	int r;
>>>    	r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
>>>    	CU_ASSERT_EQUAL(r, 0);
>>> @@ -271,7 +271,7 @@ static void check_result(struct amdgpu_uvd_enc *enc)
>>>    	CU_ASSERT_EQUAL(r, 0);
>>>    	r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr);
>>>    	CU_ASSERT_EQUAL(r, 0);
>>> -	for (j = 0, sum = 0; j < size; ++j)
>>> +	for (uint32_t j = 0, sum = 0; j < size; ++j)
>>>    		sum += enc->bs.ptr[j];
>>>    	CU_ASSERT_EQUAL(sum, s);
>>>    	r = amdgpu_bo_cpu_unmap(enc->bs.handle);
>>> @@ -331,7 +331,7 @@ static void amdgpu_cs_uvd_enc_session_init(void)
>>>    static void amdgpu_cs_uvd_enc_encode(void)
>>>    {
>>> -	int len, r, i;
>>> +	int len, r;
>>>    	uint64_t luma_offset, chroma_offset;
>>>    	uint32_t vbuf_size, bs_size = 0x003f4800, cpb_size;
>>>    	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
>>> @@ -354,11 +354,11 @@ static void amdgpu_cs_uvd_enc_encode(void)
>>>    	CU_ASSERT_EQUAL(r, 0);
>>>    	memset(enc.vbuf.ptr, 0, vbuf_size);
>>> -	for (i = 0; i < enc.height; ++i) {
>>> +	for (unsigned i = 0; i < enc.height; ++i) {
>>>    		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
>>>    		enc.vbuf.ptr += ALIGN(enc.width, align);
>>>    	}
>>> -	for (i = 0; i < enc.height / 2; ++i) {
>>> +	for (unsigned i = 0; i < enc.height / 2; ++i) {
>>>    		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
>>>    		enc.vbuf.ptr += ALIGN(enc.width, align);
>>>    	}
>>> diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
>>> index 75821bbb1e6c92e91fe7..6da6511793a1cf0ab488 100644
>>> --- a/tests/amdgpu/vce_tests.c
>>> +++ b/tests/amdgpu/vce_tests.c
>>> @@ -425,8 +425,8 @@ static void check_result(struct amdgpu_vce_encode *enc)
>>>    {
>>>    	uint64_t sum;
>>>    	uint32_t s[2] = {180325, 15946};
>>> -	uint32_t *ptr, size;
>>> -	int i, j, r;
>>> +	uint32_t *ptr, i, j, size;
>>> +	int r;
>>>    	for (i = 0; i < 2; ++i) {
>>>    		r = amdgpu_bo_cpu_map(enc->fb[i].handle, (void **)&enc->fb[i].ptr);
>>> @@ -449,7 +449,7 @@ static void amdgpu_cs_vce_encode(void)
>>>    {
>>>    	uint32_t vbuf_size, bs_size = 0x154000, cpb_size;
>>>    	unsigned align = (family_id >= AMDGPU_FAMILY_AI) ? 256 : 16;
>>> -	int i, r;
>>> +	int r;
>>>    	vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5;
>>>    	cpb_size = vbuf_size * 10;
>>> @@ -472,11 +472,11 @@ static void amdgpu_cs_vce_encode(void)
>>>    	CU_ASSERT_EQUAL(r, 0);
>>>    	memset(enc.vbuf.ptr, 0, vbuf_size);
>>> -	for (i = 0; i < enc.height; ++i) {
>>> +	for (unsigned i = 0; i < enc.height; ++i) {
>>>    		memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
>>>    		enc.vbuf.ptr += ALIGN(enc.width, align);
>>>    	}
>>> -	for (i = 0; i < enc.height / 2; ++i) {
>>> +	for (unsigned i = 0; i < enc.height / 2; ++i) {
>>>    		memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
>>>    		enc.vbuf.ptr += ALIGN(enc.width, align);
>>>    	}
>>> diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
>>> index 2eb8c4347be094a70958..b228db609f0e0c0fefdd 100644
>>> --- a/tests/amdgpu/vcn_tests.c
>>> +++ b/tests/amdgpu/vcn_tests.c
>>> @@ -239,7 +239,7 @@ static void free_resource(struct amdgpu_vcn_bo *vcn_bo)
>>>    	memset(vcn_bo, 0, sizeof(*vcn_bo));
>>>    }
>>> -static void vcn_dec_cmd(uint64_t addr, unsigned cmd, int *idx)
>>> +static void vcn_dec_cmd(uint64_t addr, unsigned cmd, unsigned *idx)
>>>    {
>>>    	ib_cpu[(*idx)++] = 0x81C4;
>>>    	ib_cpu[(*idx)++] = addr;
>>> @@ -286,7 +286,7 @@ static void amdgpu_cs_vcn_dec_decode(void)
>>>    	const unsigned dpb_size = 15923584, dt_size = 737280;
>>>    	uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr, sum;
>>>    	struct amdgpu_vcn_bo dec_buf;
>>> -	int size, len, i, r;
>>> +	unsigned size, len, i, r;
>>>    	uint8_t *dec;
>>>    	size = 4*1024; /* msg */

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH libdrm 1/7] remove unnecessary empty statements
  2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
                   ` (6 preceding siblings ...)
  2018-01-26 11:35 ` [PATCH libdrm 1/7] remove unnecessary empty statements Christian König
@ 2018-01-26 17:44 ` Emil Velikov
  7 siblings, 0 replies; 14+ messages in thread
From: Emil Velikov @ 2018-01-26 17:44 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: ML dri-devel

I think you meant s/empty statements/double semi-colon/.

 - please keep the nouveau debug patch out for the time being
 - regardless if you keep as-is or fold the Wundef patch with the Werror one
 - with the shadowing issue pointed by Chrisian

Both 7 patch series are
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-01-26 17:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 11:32 [PATCH libdrm 1/7] remove unnecessary empty statements Eric Engestrom
2018-01-26 11:32 ` [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit Eric Engestrom
2018-01-26 13:26   ` Andrey Grodzovsky
2018-01-26 16:50     ` Eric Engestrom
2018-01-26 11:32 ` [PATCH libdrm 3/7] tests/amdgpu: drop unused variables Eric Engestrom
2018-01-26 11:32 ` [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons Eric Engestrom
2018-01-26 11:38   ` Christian König
2018-01-26 17:15     ` Eric Engestrom
2018-01-26 17:17       ` Christian König
2018-01-26 11:32 ` [PATCH libdrm 5/7] tests/util: fix signed/unsigned comparisons Eric Engestrom
2018-01-26 11:32 ` [PATCH libdrm 6/7] tests/util: drop unused parameters Eric Engestrom
2018-01-26 11:32 ` [PATCH libdrm 7/7] tests/etnaviv: drop unused `return 0` Eric Engestrom
2018-01-26 11:35 ` [PATCH libdrm 1/7] remove unnecessary empty statements Christian König
2018-01-26 17:44 ` Emil Velikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.