remove unnecessary empty statements
PATCH 1/7 remove unnecessary empty statements
--- amdgpu/amdgpu_cs.c | 2 +- tests/exynos/exynos_fimg2d_test.c | 2 +- tests/modeprint/modeprint.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu_cs.c +1 -1
@@ -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 ;
tests/exynos/exynos_fimg2d_test.c +1 -1
@@ -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
tests/modeprint/modeprint.c +1 -1
@@ -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);
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 tests/amdgpu: add parentheses to make operation priority explicit
While at it, align with the other half on the next line.
---
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(-)
tests/amdgpu/basic_tests.c +1 -1
@@ -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 ;
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/7 tests/amdgpu: drop unused variables
In reply to Eric Engestrom--- 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(-)
tests/amdgpu/amdgpu_test.c +0 -1
@@ -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 ;
tests/amdgpu/basic_tests.c +2 -2
@@ -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;
tests/amdgpu/cs_tests.c +1 -1
@@ -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;
tests/amdgpu/deadlock_tests.c +1 -2
@@ -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;
tests/amdgpu/uvd_enc_tests.c +1 -4
@@ -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 ;
tests/amdgpu/vcn_tests.c +1 -1
@@ -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;
tests/amdgpu/vm_tests.c +1 -3
@@ -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);
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 tests/amdgpu: fix bad sign comparisons
In reply to Eric Engestrom--- 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(-)
tests/amdgpu/cs_tests.c +1 -1
@@ -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 );
tests/amdgpu/uvd_enc_tests.c +5 -5
@@ -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); }
tests/amdgpu/vce_tests.c +5 -5
@@ -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); }
tests/amdgpu/vcn_tests.c +2 -2
@@ -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 */
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 tests/util: fix signed/unsigned comparisons
In reply to Eric Engestrom--- tests/util/pattern.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/util/pattern.c +2 -3
@@ -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 );
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/7 tests/util: drop unused parameters
In reply to Eric Engestrom--- tests/util/pattern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/util/pattern.c +3 -3
@@ -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);
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/7 tests/etnaviv: drop unused `return 0`
In reply to Eric Engestrom--- tests/etnaviv/write_bmp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tests/etnaviv/write_bmp.c +1 -3
@@ -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
Signature · 7 lines
Cheers, Eric _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
Quoted 1 line
Signed-off-by Eric Engestrom <[email protected]>
Quoted 37 lines
--- amdgpu/amdgpu_cs.c | 2 +- tests/exynos/exynos_fimg2d_test.c | 2 +- tests/modeprint/modeprint.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)amdgpu/amdgpu_cs.c +1
-1@@ -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 ;tests/exynos/exynos_fimg2d_test.c +1
-1@@ -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 tests/modeprint/modeprint.c +0
-0
tests/modeprint/modeprint.c static int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb) · line 250
Quoted 8 lines
tests/modeprint/modeprint.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
In reply to Eric EngestromAm 26.01.2018 um 12:32 schrieb Eric Engestrom:
Quoted 13 lines
Signed-off-by Eric Engestrom <[email protected]>--- 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(-)tests/amdgpu/cs_tests.c +0
-0
tests/amdgpu/cs_tests.c static void amdgpu_cs_uvd_decode(void) · line 399
Quoted 5 lines
tests/amdgpu/cs_tests.c +1
-1@@ -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.
Quoted 100 lines
tests/amdgpu/cs_tests.c +0
-0sum += ptr[i];CU_ASSERT_EQUAL (sum,SUM_DECODE );tests/amdgpu/uvd_enc_tests.c +5
-5@@ -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); }tests/amdgpu/vce_tests.c +5
-5@@ -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); }tests/amdgpu/vcn_tests.c +1
-1@@ -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;
tests/amdgpu/vcn_tests.c static void amdgpu_cs_vcn_dec_decode(void) · line 292
Quoted 8 lines
tests/amdgpu/vcn_tests.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit
In reply to Eric EngestromQuoted 7 lines · Eric Engestrom
While at it, align with the other half on the next line.
Cc Andrey Grodzovsky <[email protected]>Signed-off-by Eric Engestrom <[email protected]>---
Andrey, is that0xfffffffcright? 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
Quoted 9 lines
--- tests/amdgpu/basic_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/amdgpu/basic_tests.c +0
-0
tests/amdgpu/basic_tests.c static void amdgpu_sync_dependency_test(void) · line 1614
Quoted 8 lines
tests/amdgpu/basic_tests.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/7] tests/amdgpu: add parentheses to make operation priority explicit
Quoted 11 lines · Andrey Grodzovsky
Quoted 7 lines · Eric Engestrom
While at it, align with the other half on the next line.
Cc Andrey Grodzovsky <[email protected]>Signed-off-by Eric Engestrom <[email protected]>---
Andrey, is that0xfffffffcright? It looks weird to me to be discarding the bottom two bits.
Quoted 6 lines
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.4WRITE_DATA,DST_ADDR_LOfield, 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 :)
Quoted 8 lines
Thanks,
AndreyQuoted 4 lines
--- tests/amdgpu/basic_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
tests/amdgpu/basic_tests.c static void amdgpu_sync_dependency_test(void) · line 1613
Quoted 12 lines
tests/amdgpu/basic_tests.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
In reply to Christian KönigQuoted 9 lines · Christian König
Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
Quoted 8 lines
Signed-off-by Eric Engestrom <[email protected]>--- 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(-)
Quoted 11 lines
tests/amdgpu/cs_tests.c static void amdgpu_cs_uvd_decode(void) · line 398
Quoted 9 lines
tests/amdgpu/cs_tests.c +1
-1@@ -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).
Quoted 1 line
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?
Quoted 94 lines
Christian.
Quoted 91 lines
tests/amdgpu/cs_tests.c +0
-0sum += ptr[i];CU_ASSERT_EQUAL (sum,SUM_DECODE );tests/amdgpu/uvd_enc_tests.c +5
-5@@ -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); }tests/amdgpu/vce_tests.c +5
-5@@ -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); }tests/amdgpu/vcn_tests.c +1
-1@@ -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;
Quoted 9 lines
tests/amdgpu/vcn_tests.c static void amdgpu_cs_vcn_dec_decode(void) · line 291
Quoted 8 lines
tests/amdgpu/vcn_tests.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 4/7] tests/amdgpu: fix bad sign comparisons
Am 26.01.2018 um 18:15 schrieb Eric Engestrom:
Quoted 20 lines · Christian König
Quoted 9 lines
Am 26.01.2018 um 12:32 schrieb Eric Engestrom:
Quoted 8 lines
Signed-off-by Eric Engestrom <[email protected]>--- 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(-)Quoted 10 lines
tests/amdgpu/cs_tests.c static void amdgpu_cs_uvd_decode(void) · line 398
Quoted 9 lines
tests/amdgpu/cs_tests.c +1
-1@@ -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,
Quoted 1 line
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.
Quoted 6 lines
I'll send a v2 later (ie. next week).
Quoted 1 line
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.
Quoted 94 lines
Quoted 94 lines
Christian.
Quoted 91 lines
tests/amdgpu/cs_tests.c +0
-0sum += ptr[i];CU_ASSERT_EQUAL (sum,SUM_DECODE );tests/amdgpu/uvd_enc_tests.c +5
-5@@ -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); }tests/amdgpu/vce_tests.c +5
-5@@ -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); }tests/amdgpu/vcn_tests.c +1
-1@@ -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;
Quoted 8 lines
Quoted 8 lines
tests/amdgpu/vcn_tests.c static void amdgpu_cs_vcn_dec_decode(void) · line 291
Quoted 8 lines
tests/amdgpu/vcn_tests.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/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
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel