Skip to contentSkip to conversation

hantro: Small nitpicks

PATCH In review Ezequiel Garcia 3 participants 6 messages Jun 21, 2021 – Jun 23, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover hantro: Small nitpicks

Just a couple nitpicks that I had in the backlog.

Ezequiel Garcia (2):
hantro: vp8: Move noisy WARN_ON to vpu_debug
hantro: Make struct hantro_variant.init() optional

 drivers/staging/media/hantro/hantro.h               |  4 ++--
 drivers/staging/media/hantro/hantro_drv.c           | 10 ++++++----
 drivers/staging/media/hantro/hantro_g1_vp8_dec.c    | 13 ++++++++++---
 .../staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c | 13 ++++++++++---
 drivers/staging/media/hantro/sama5d4_vdec_hw.c      |  6 ------
 5 files changed, 28 insertions(+), 18 deletions(-)
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/2 hantro: vp8: Move noisy WARN_ON to vpu_debug

When the VP8 decoders can't find a reference frame, the driver falls back to the current output frame.

This will probably produce some undesirable results, leading to frame corruption, but shouldn't cause noisy warnings.

---
 drivers/staging/media/hantro/hantro_g1_vp8_dec.c    | 13 ++++++++++---
 .../staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c | 13 ++++++++++---
 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/staging/media/hantro/hantro_g1_vp8_dec.c +10 -3
index 96622a7f8279..7f88dcee1473 100644
@@ -376,12 +376,17 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vb2_dst = hantro_get_dst_buf(ctx);
 
 	ref = hantro_get_ref(ctx, hdr->last_frame_ts);
-	if (!ref)
+	if (!ref) {
+		vpu_debug(0, "failed to find last frame ts=%ld\n",
+			  hdr->last_frame_ts);
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
+	}
 	vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(0));
 
 	ref = hantro_get_ref(ctx, hdr->golden_frame_ts);
-	WARN_ON(!ref && hdr->golden_frame_ts);
+	if (!ref && hdr->golden_frame_ts)
+		vpu_debug(0, "failed to find golden frame ts=%ld\n",
+			  hdr->golden_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN)
@@ -389,7 +394,9 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(4));
 
 	ref = hantro_get_ref(ctx, hdr->alt_frame_ts);
-	WARN_ON(!ref && hdr->alt_frame_ts);
+	if (!ref && hdr->alt_frame_ts)
+		vpu_debug(0, "failed to find alt frame ts=%ld\n",
+			  hdr->alt_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT)
drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c +10 -3
index 951b55f58a61..cd53748efe4e 100644
@@ -453,12 +453,17 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vb2_dst = hantro_get_dst_buf(ctx);
 
 	ref = hantro_get_ref(ctx, hdr->last_frame_ts);
-	if (!ref)
+	if (!ref) {
+		vpu_debug(0, "failed to find last frame ts=%ld\n",
+			  hdr->last_frame_ts);
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
+	}
 	vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF0);
 
 	ref = hantro_get_ref(ctx, hdr->golden_frame_ts);
-	WARN_ON(!ref && hdr->golden_frame_ts);
+	if (!ref && hdr->golden_frame_ts)
+		vpu_debug(0, "failed to find golden frame ts=%ld\n",
+			  hdr->golden_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN)
@@ -466,7 +471,9 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF2_5(2));
 
 	ref = hantro_get_ref(ctx, hdr->alt_frame_ts);
-	WARN_ON(!ref && hdr->alt_frame_ts);
+	if (!ref && hdr->alt_frame_ts)
+		vpu_debug(0, "failed to find alt frame ts=%ld\n",
+			  hdr->alt_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT)
Signature · 1 line
2.30.0
#2 lore raw

Re: [PATCH 1/2] hantro: vp8: Move noisy WARN_ON to vpu_debug

I love your patch! Perhaps something to improve:

Hi Ezequiel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on rockchip/for-next pza/reset/next v5.13-rc7 next-20210621] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ezequiel-Garcia/hantro-Small-nitpicks/20210622-071354
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-a006-20210622 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b3634d3e88b7f26534a5057bff182b7dced584fc)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/a4118b182653ffbf6229d186eb46052c34ae995c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ezequiel-Garcia/hantro-Small-nitpicks/20210622-071354 git checkout a4118b182653ffbf6229d186eb46052c34ae995c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/staging/media/hantro/hantro_g1_vp8_dec.c:381:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->last_frame_ts);
                             ^~~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:389:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->golden_frame_ts);
                             ^~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:399:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->alt_frame_ts);
                             ^~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   3 warnings generated.
--
>> drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:458:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->last_frame_ts);
                             ^~~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:466:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->golden_frame_ts);
                             ^~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:476:6: warning: format specifies type 'long' but the argument has type '__u64' (aka 'unsigned long long') [-Wformat]
                             hdr->alt_frame_ts);
                             ^~~~~~~~~~~~~~~~~
   drivers/staging/media/hantro/hantro.h:322:28: note: expanded from macro 'vpu_debug'
                                    __func__, __LINE__, ##args);   \
                                                          ^~~~
   include/linux/printk.h:373:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~

3 warnings generated.

vim +381 drivers/staging/media/hantro/hantro_g1_vp8_dec.c

368
369 static void cfg_ref(struct hantro_ctx *ctx,
370 const struct v4l2_ctrl_vp8_frame *hdr)
371 {
372 struct hantro_dev *vpu = ctx->dev;
373 struct vb2_v4l2_buffer *vb2_dst;
374 dma_addr_t ref;
375
376 vb2_dst = hantro_get_dst_buf(ctx);
377
378 ref = hantro_get_ref(ctx, hdr->last_frame_ts);
379 if (!ref) {
380 vpu_debug(0, "failed to find last frame ts=%ld\n",

 > 381				  hdr->last_frame_ts);

382 ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
383 }
384 vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(0));
385
386 ref = hantro_get_ref(ctx, hdr->golden_frame_ts);
387 if (!ref && hdr->golden_frame_ts)
388 vpu_debug(0, "failed to find golden frame ts=%ld\n",
389 hdr->golden_frame_ts);
390 if (!ref)
391 ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
392 if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN)
393 ref |= G1_REG_ADDR_REF_TOPC_E;
394 vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(4));
395
396 ref = hantro_get_ref(ctx, hdr->alt_frame_ts);
397 if (!ref && hdr->alt_frame_ts)
398 vpu_debug(0, "failed to find alt frame ts=%ld\n",
399 hdr->alt_frame_ts);
400 if (!ref)
401 ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
402 if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT)
403 ref |= G1_REG_ADDR_REF_TOPC_E;
404 vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(5));
405 }
406

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw

Re: [PATCH 1/2] hantro: vp8: Move noisy WARN_ON to vpu_debug

In reply to Ezequiel Garcia
I love your patch! Perhaps something to improve:

Hi Ezequiel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on rockchip/for-next pza/reset/next v5.13-rc7 next-20210622] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ezequiel-Garcia/hantro-Small-nitpicks/20210622-071354
base:   git://linuxtv.org/media_tree.git master
config: microblaze-randconfig-r026-20210622 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a4118b182653ffbf6229d186eb46052c34ae995c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ezequiel-Garcia/hantro-Small-nitpicks/20210622-071354 git checkout a4118b182653ffbf6229d186eb46052c34ae995c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:7,

                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:15:
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c: In function 'cfg_ref':
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:457:3: note: in expansion of macro 'vpu_debug'
     457 |   vpu_debug(0, "failed to find last frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:457:48: note: format string is defined here
     457 |   vpu_debug(0, "failed to find last frame ts=%ld\n",
         |                                              ~~^
         |                                                |
         |                                                long int
         |                                              %lld
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:15:
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:465:3: note: in expansion of macro 'vpu_debug'
     465 |   vpu_debug(0, "failed to find golden frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:465:50: note: format string is defined here
     465 |   vpu_debug(0, "failed to find golden frame ts=%ld\n",
         |                                                ~~^
         |                                                  |
         |                                                  long int
         |                                                %lld
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:15:
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:475:3: note: in expansion of macro 'vpu_debug'
     475 |   vpu_debug(0, "failed to find alt frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c:475:47: note: format string is defined here
     475 |   vpu_debug(0, "failed to find alt frame ts=%ld\n",
         |                                             ~~^
         |                                               |
         |                                               long int
         |                                             %lld
--
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/hantro_g1_vp8_dec.c:12:
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c: In function 'cfg_ref':
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:380:3: note: in expansion of macro 'vpu_debug'
     380 |   vpu_debug(0, "failed to find last frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:380:48: note: format string is defined here
     380 |   vpu_debug(0, "failed to find last frame ts=%ld\n",
         |                                              ~~^
         |                                                |
         |                                                long int
         |                                              %lld
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/hantro_g1_vp8_dec.c:12:
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:388:3: note: in expansion of macro 'vpu_debug'
     388 |   vpu_debug(0, "failed to find golden frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:388:50: note: format string is defined here
     388 |   vpu_debug(0, "failed to find golden frame ts=%ld\n",
         |                                                ~~^
         |                                                  |
         |                                                  long int
         |                                                %lld
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:17,
                    from include/linux/videodev2.h:60,
                    from include/media/videobuf2-v4l2.h:15,
                    from include/media/v4l2-mem2mem.h:16,
                    from drivers/staging/media/hantro/hantro_g1_vp8_dec.c:12:
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__u64' {aka 'const long long unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
      14 | #define KERN_INFO KERN_SOH "6" /* informational */
         |                   ^~~~~~~~
   include/linux/printk.h:373:9: note: in expansion of macro 'KERN_INFO'
     373 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~
   drivers/staging/media/hantro/hantro.h:321:4: note: in expansion of macro 'pr_info'
     321 |    pr_info("%s:%d: " fmt,                 \
         |    ^~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:398:3: note: in expansion of macro 'vpu_debug'
     398 |   vpu_debug(0, "failed to find alt frame ts=%ld\n",
         |   ^~~~~~~~~
   drivers/staging/media/hantro/hantro_g1_vp8_dec.c:398:47: note: format string is defined here
     398 |   vpu_debug(0, "failed to find alt frame ts=%ld\n",
         |                                             ~~^
         |                                               |
         |                                               long int
         |                                             %lld

vim +5 include/linux/kern_levels.h

314ba3520e513a Joe Perches 2012-07-30 4
04d2c8c83d0e3a Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c83d0e3a Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c83d0e3a Joe Perches 2012-07-30 7

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

Acked-by on v1 1/2
#4 lore raw

Re: [PATCH 1/2] hantro: vp8: Move noisy WARN_ON to vpu_debug

In reply to Ezequiel Garcia

Le lundi 21 juin 2021 à 20:11 -0300, Ezequiel Garcia a écrit :

Quoted 8 lines

When the VP8 decoders can't find a reference frame, the driver falls back to the current output frame.

This will probably produce some undesirable results, leading to frame corruption, but shouldn't cause noisy warnings.

Greatly appreciated fix.

Quoted 75 lines
---
 drivers/staging/media/hantro/hantro_g1_vp8_dec.c    | 13 ++++++++++---
 .../staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c | 13 ++++++++++---
 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/staging/media/hantro/hantro_g1_vp8_dec.c +10 -3
index 96622a7f8279..7f88dcee1473 100644
@@ -376,12 +376,17 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vb2_dst = hantro_get_dst_buf(ctx);
 
 	ref = hantro_get_ref(ctx, hdr->last_frame_ts);
-	if (!ref)
+	if (!ref) {
+		vpu_debug(0, "failed to find last frame ts=%ld\n",
+			  hdr->last_frame_ts);
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
+	}
 	vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(0));
 
 	ref = hantro_get_ref(ctx, hdr->golden_frame_ts);
-	WARN_ON(!ref && hdr->golden_frame_ts);
+	if (!ref && hdr->golden_frame_ts)
+		vpu_debug(0, "failed to find golden frame ts=%ld\n",
+			  hdr->golden_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN)
@@ -389,7 +394,9 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(4));
 
 	ref = hantro_get_ref(ctx, hdr->alt_frame_ts);
-	WARN_ON(!ref && hdr->alt_frame_ts);
+	if (!ref && hdr->alt_frame_ts)
+		vpu_debug(0, "failed to find alt frame ts=%ld\n",
+			  hdr->alt_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT)
drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c +10 -3
index 951b55f58a61..cd53748efe4e 100644
@@ -453,12 +453,17 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vb2_dst = hantro_get_dst_buf(ctx);
 
 	ref = hantro_get_ref(ctx, hdr->last_frame_ts);
-	if (!ref)
+	if (!ref) {
+		vpu_debug(0, "failed to find last frame ts=%ld\n",
+			  hdr->last_frame_ts);
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
+	}
 	vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF0);
 
 	ref = hantro_get_ref(ctx, hdr->golden_frame_ts);
-	WARN_ON(!ref && hdr->golden_frame_ts);
+	if (!ref && hdr->golden_frame_ts)
+		vpu_debug(0, "failed to find golden frame ts=%ld\n",
+			  hdr->golden_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN)
@@ -466,7 +471,9 @@ static void cfg_ref(struct hantro_ctx *ctx,
 	vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF2_5(2));
 
 	ref = hantro_get_ref(ctx, hdr->alt_frame_ts);
-	WARN_ON(!ref && hdr->alt_frame_ts);
+	if (!ref && hdr->alt_frame_ts)
+		vpu_debug(0, "failed to find alt frame ts=%ld\n",
+			  hdr->alt_frame_ts);
 	if (!ref)
 		ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0);
 	if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT)
#5 lore raw

PATCH 2/2 hantro: Make struct hantro_variant.init() optional

In reply to Ezequiel Garcia

The hantro_variant.init() function is there for platforms to perform hardware-specific initialization, such as clock rate bumping.

Not all platforms require it, so make it optional.

---
 drivers/staging/media/hantro/hantro.h          |  4 ++--
 drivers/staging/media/hantro/hantro_drv.c      | 10 ++++++----
 drivers/staging/media/hantro/sama5d4_vdec_hw.c |  6 ------
 3 files changed, 8 insertions(+), 12 deletions(-)
drivers/staging/media/hantro/hantro.h +2 -2
index a70c386de6f1..c2e2dca38628 100644
@@ -61,8 +61,8 @@ struct hantro_irq {
  * @num_postproc_fmts:		Number of post-processor formats.
  * @codec:			Supported codecs
  * @codec_ops:			Codec ops.
- * @init:			Initialize hardware.
- * @runtime_resume:		reenable hardware after power gating
+ * @init:			Initialize hardware, optional.
+ * @runtime_resume:		reenable hardware after power gating, optional.
  * @irqs:			array of irq names and interrupt handlers
  * @num_irqs:			number of irqs in the array
  * @clk_names:			array of clock names
drivers/staging/media/hantro/hantro_drv.c +6 -4
index 31d8449ca1d2..9b5415176bfe 100644
@@ -942,10 +942,12 @@ static int hantro_probe(struct platform_device *pdev)
 		}
 	}
 
-	ret = vpu->variant->init(vpu);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to init VPU hardware\n");
-		return ret;
+	if (vpu->variant->init) {
+		ret = vpu->variant->init(vpu);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to init VPU hardware\n");
+			return ret;
+		}
 	}
 
 	pm_runtime_set_autosuspend_delay(vpu->dev, 100);
drivers/staging/media/hantro/sama5d4_vdec_hw.c +0 -6
index 58ae72c2b723..9c3b8cd0b239 100644
@@ -64,11 +64,6 @@ static const struct hantro_fmt sama5d4_vdec_fmts[] = {
 	},
 };
 
-static int sama5d4_hw_init(struct hantro_dev *vpu)
-{
-	return 0;
-}
-
 /*
  * Supported codec ops.
  */
@@ -109,7 +104,6 @@ const struct hantro_variant sama5d4_vdec_variant = {
 	.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
 		 HANTRO_H264_DECODER,
 	.codec_ops = sama5d4_vdec_codec_ops,
-	.init = sama5d4_hw_init,
 	.irqs = sama5d4_irqs,
 	.num_irqs = ARRAY_SIZE(sama5d4_irqs),
 	.clk_names = sama5d4_clk_names,
Signature · 1 line
2.30.0