From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Eric Engestrom <eric.engestrom@imgtec.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
Date: Fri, 26 Jan 2018 12:38:35 +0100 [thread overview]
Message-ID: <faf46446-323d-3b85-b265-23818be0574e@gmail.com> (raw)
In-Reply-To: <20180126113244.26946-4-eric.engestrom@imgtec.com>
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
next prev parent reply other threads:[~2018-01-26 11:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=faf46446-323d-3b85-b265-23818be0574e@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric.engestrom@imgtec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.