Skip to contentSkip to conversation

media: rkvdec: Fix .buf_prepare

RFC In review Andrzej Pietrasiewicz 2 participants 6 messages Apr 21, 2021 – Apr 29, 2021

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

RFC 1/3 media: rkvdec: Fix .buf_prepare

From: Ezequiel Garcia <[email protected]>

The driver should only set the payload on .buf_prepare if the buffer is CAPTURE type. If an OUTPUT buffer has a zero bytesused set by userspace then v4l2-core will set it to buffer length.

Fixes cd33c830448ba ("media: rkvdec: Add the rkvdec driver")
---
 drivers/staging/media/rkvdec/rkvdec.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec.c +9 -1
index d821661d30f3..ef2166043127 100644
@@ -481,7 +481,15 @@ static int rkvdec_buf_prepare(struct vb2_buffer *vb)
 		if (vb2_plane_size(vb, i) < sizeimage)
 			return -EINVAL;
 	}
-	vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage);
+
+	/*
+	 * Buffer bytesused is written by driver for CAPTURE buffers.
+	 * (if userspace passes 0 bytesused for OUTPUT buffers, v4l2-core sets
+	 * it to buffer length).
+	 */
+	if (!V4L2_TYPE_IS_OUTPUT(vq->type))
+		vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#1 lore raw

RFC 2/3 media: uapi: Add VP9 stateless decoder controls

Add the VP9 stateless decoder controls plus the documentation that goes with it.

---
 .../userspace-api/media/v4l/biblio.rst        |  10 +
 .../media/v4l/ext-ctrls-codec-stateless.rst   | 523 ++++++++++++++++++
 .../media/v4l/pixfmt-compressed.rst           |  15 +
 .../media/v4l/vidioc-g-ext-ctrls.rst          |   8 +
 .../media/v4l/vidioc-queryctrl.rst            |  12 +
 .../media/videodev2.h.rst.exceptions          |   2 +
 drivers/media/v4l2-core/v4l2-ctrls.c          | 244 ++++++++
 drivers/media/v4l2-core/v4l2-ioctl.c          |   1 +
 include/media/v4l2-ctrls.h                    |   4 +
 include/uapi/linux/v4l2-controls.h            | 455 +++++++++++++++
 include/uapi/linux/videodev2.h                |   6 +
 11 files changed, 1280 insertions(+)
Documentation/userspace-api/media/v4l/biblio.rst +10 -0
index 64d241daf63c..051982896375 100644
@@ -417,3 +417,13 @@ VP8
 :title:     RFC 6386: "VP8 Data Format and Decoding Guide"
 
 :author:    J. Bankoski et al.
+
+.. _vp9:
+
+VP9
+===
+
+
+:title:     VP9 Bitstream & Decoding Process Specification
+
+:author:    Adrian Grange (Google), Peter de Rivaz (Argon Design), Jonathan Hunt (Argon Design)
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +523 -0

526 lines not on this page · raw message

Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +15 -0
index 6dba70da822b..7e34aeb1cb92 100644
@@ -171,6 +171,21 @@ Compressed Formats
       - VP9 compressed video frame. The encoder generates one
 	compressed frame per buffer, and the decoder requires one
 	compressed frame per buffer.
+    * .. _V4L2-PIX-FMT-VP9_FRAME:
+
+      - ``V4L2_PIX_FMT_VP9_FRAME``
+      - 'VP9F'
+      - VP9 parsed frame, including the frame header, as extracted from the container.
+	This format is adapted for stateless video decoders that implement an
+	VP9 pipeline with the :ref:`stateless_decoder`.
+	Metadata associated with the frame to decode is required to be passed
+	through the ``V4L2_CID_STATELESS_VP9_FRAME_DECODE_PARAMS`` and
+	the ``V4L2_CID_STATELESS_VP9_COMPRESSED_HDR_PROBS`` controls.
+	See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-vp9>`.
+	Exactly one output and one capture buffer must be provided for use with
+	this pixel format. The output buffer must contain the appropriate number
+	of macroblocks to decode a full corresponding frame to the matching
+	capture buffer.
     * .. _V4L2-PIX-FMT-HEVC:
 
       - ``V4L2_PIX_FMT_HEVC``
Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst +8 -0
index 3ba22983d21f..3ff72ca63772 100644
@@ -221,6 +221,14 @@ still cause this situation.
       - ``p_vp8_frame``
       - A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_VP8_FRAME``.
+    * - struct :c:type:`v4l2_ctrl_vp9_compressed_hdr_probs` *
+      - ``p_vp9_compressed_hdr_probs``
+      - A pointer to a struct :c:type:`v4l2_ctrl_vp9_compressed_hdr_probs'. Valid if this contro is
+        of type ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR_PROBS``.
+    * - struct :c:type:`v4l2_ctrl_vp9_frame_decode_params` *
+      - ``p_vp9_frame_decode_params``
+      - A pointer to a struct :c:type:`v4l2_ctrl_vp9_frame_decode_params'. Valid if this contro is
+        of type ``V4L2_CTRL_TYPE_VP9_FRAME_DECODE_PARAMS``.
     * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` *
       - ``p_hdr10_cll``
       - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is
Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +12 -0
index 8a285daedc6a..85fb8b7a9428 100644
@@ -495,6 +495,18 @@ See also the examples in :ref:`control`.
       - n/a
       - A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8
 	frame parameters for stateless video decoders.
+    * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR_PROBS``
+      - n/a
+      - n/a
+      - n/a
+      - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr_probs`, containing VP9
+	probabilities updates for stateless video decoders.
+    * - ``V4L2_CTRL_TYPE_VP9_FRAME_DECODE_PARAMS``
+      - n/a
+      - n/a
+      - n/a
+      - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr_probs`, containing VP9
+	frame decode parameters for stateless video decoders.
 
 .. raw:: latex
 
Documentation/userspace-api/media/videodev2.h.rst.exceptions +2 -0
index f59940352faa..fdc6f2b22df8 100644
@@ -148,6 +148,8 @@ replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR_PROBS :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_VP9_FRAME_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`v4l2_ctrl_type`
 
drivers/media/v4l2-core/v4l2-ctrls.c +244 -0

280 lines not on this page · raw message

drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
index 6a5d1c6d11d6..dbdafa5ea127 100644
@@ -1431,6 +1431,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 		case V4L2_PIX_FMT_VP8:		descr = "VP8"; break;
 		case V4L2_PIX_FMT_VP8_FRAME:    descr = "VP8 Frame"; break;
 		case V4L2_PIX_FMT_VP9:		descr = "VP9"; break;
+		case V4L2_PIX_FMT_VP9_FRAME:    descr = "VP9 Frame"; break;
 		case V4L2_PIX_FMT_HEVC:		descr = "HEVC"; break; /* aka H.265 */
 		case V4L2_PIX_FMT_HEVC_SLICE:	descr = "HEVC Parsed Slice Data"; break;
 		case V4L2_PIX_FMT_FWHT:		descr = "FWHT"; break; /* used in vicodec */
include/media/v4l2-ctrls.h +4 -0
index a5953b812878..8c5fb22ff545 100644
@@ -50,6 +50,8 @@ struct video_device;
  * @p_h264_decode_params:	Pointer to a struct v4l2_ctrl_h264_decode_params.
  * @p_h264_pred_weights:	Pointer to a struct v4l2_ctrl_h264_pred_weights.
  * @p_vp8_frame:		Pointer to a VP8 frame params structure.
+ * @p_vp9_compressed_hdr_probs:	Pointer to a VP9 frame compressed header probs structure.
+ * @p_vp9_frame_decode_params:	Pointer to a VP9 frame params structure.
  * @p_hevc_sps:			Pointer to an HEVC sequence parameter set structure.
  * @p_hevc_pps:			Pointer to an HEVC picture parameter set structure.
  * @p_hevc_slice_params:	Pointer to an HEVC slice parameters structure.
@@ -79,6 +81,8 @@ union v4l2_ctrl_ptr {
 	struct v4l2_ctrl_hevc_sps *p_hevc_sps;
 	struct v4l2_ctrl_hevc_pps *p_hevc_pps;
 	struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
+	struct v4l2_ctrl_vp9_compressed_hdr_probs *p_vp9_compressed_hdr_probs;
+	struct v4l2_ctrl_vp9_frame_decode_params *p_vp9_frame_decode_params;
 	struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;
 	struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;
 	struct v4l2_area *p_area;
include/uapi/linux/v4l2-controls.h +455 -0

461 lines not on this page · raw message

include/uapi/linux/videodev2.h +6 -0
index 311a01cc5775..508e2d6825b1 100644
@@ -697,6 +697,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_VP8      v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frame */
 #define V4L2_PIX_FMT_VP9      v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
+#define V4L2_PIX_FMT_VP9_FRAME v4l2_fourcc('V', 'P', '9', 'F') /* VP9 parsed frame */
 #define V4L2_PIX_FMT_HEVC     v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */
 #define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */
 #define V4L2_PIX_FMT_FWHT_STATELESS     v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */
@@ -1747,6 +1748,8 @@ struct v4l2_ext_control {
 		struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params;
 		struct v4l2_ctrl_fwht_params __user *p_fwht_params;
 		struct v4l2_ctrl_vp8_frame __user *p_vp8_frame;
+		struct v4l2_ctrl_vp9_compressed_hdr_probs __user *p_vp9_compressed_hdr_probs;
+		struct v4l2_ctrl_vp9_frame_decode_params __user *p_vp9_frame_decode_params;
 		void __user *ptr;
 	};
 } __attribute__ ((packed));
@@ -1807,6 +1810,9 @@ enum v4l2_ctrl_type {
 	V4L2_CTRL_TYPE_FWHT_PARAMS	    = 0x0220,
 
 	V4L2_CTRL_TYPE_VP8_FRAME            = 0x0240,
+
+	V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR_PROBS	= 0x0260,
+	V4L2_CTRL_TYPE_VP9_FRAME_DECODE_PARAMS	= 0x0261,
 };
 
 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
Signature · 1 line
2.17.1
#2 lore raw

RFC 3/3 media: rkvdec: Add the VP9 backend

In reply to Andrzej Pietrasiewicz

From: Boris Brezillon <[email protected]>

The Rockchip VDEC supports VP9 profile 0 up to 4096x2304@30fps. Add a backend for this new format.

---
 drivers/staging/media/rkvdec/Makefile     |    2 +-
 drivers/staging/media/rkvdec/rkvdec-vp9.c | 2846 +++++++++++++++++++++
 drivers/staging/media/rkvdec/rkvdec.c     |   52 +-
 drivers/staging/media/rkvdec/rkvdec.h     |    6 +
 4 files changed, 2901 insertions(+), 5 deletions(-)
 create mode 100644 drivers/staging/media/rkvdec/rkvdec-vp9.c
drivers/staging/media/rkvdec/Makefile +1 -1
index c08fed0a39f9..cb86b429cfaa 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC) += rockchip-vdec.o
 
-rockchip-vdec-y += rkvdec.o rkvdec-h264.o
+rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-vp9.o
drivers/staging/media/rkvdec/rkvdec-vp9.c new file +2846 -0

2,846 lines not on this page · raw message

drivers/staging/media/rkvdec/rkvdec.c +48 -4

79 lines not on this page · raw message

drivers/staging/media/rkvdec/rkvdec.h +6 -0
index 52ac3874c5e5..8f534743eaf1 100644
@@ -50,6 +50,10 @@ struct rkvdec_vp9_decoded_buffer_info {
 struct rkvdec_decoded_buffer {
 	/* Must be the first field in this struct. */
 	struct v4l2_m2m_buffer base;
+
+	union {
+		struct rkvdec_vp9_decoded_buffer_info vp9;
+	};
 };
 
 static inline struct rkvdec_decoded_buffer *
@@ -116,4 +120,6 @@ void rkvdec_run_preamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run);
 void rkvdec_run_postamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run);
 
 extern const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops;
+extern const struct rkvdec_coded_fmt_ops rkvdec_vp9_fmt_ops;
+
 #endif /* RKVDEC_H_ */
Signature · 1 line
2.17.1
#3 lore raw

Re: [RFC 3/3] media: rkvdec: Add the VP9 backend

[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]

Hi Andrzej,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20210420]
[cannot apply to v5.12-rc8]
[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/Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601
base:   git://linuxtv.org/media_tree.git master
config: ia64-allmodconfig (attached as .config)
compiler: ia64-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/df37e41d68d9ab1326f8a5a54d001d9a241b4079
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601 git checkout df37e41d68d9ab1326f8a5a54d001d9a241b4079
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=ia64

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

All warnings (new ones prefixed by >>):

drivers/staging/media/rkvdec/rkvdec-vp9.c: In function 'init_intra_only_probs':

>> drivers/staging/media/rkvdec/rkvdec-vp9.c:1357:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]
    1357 |  const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
         |                                                  ^~~~~~~~~~
   drivers/staging/media/rkvdec/rkvdec-vp9.c: In function 'init_inter_probs':
   drivers/staging/media/rkvdec/rkvdec-vp9.c:1412:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]
    1412 |  const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
         |                                                  ^~~~~~~~~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS
Selected by
- FAULT_INJECTION_STACKTRACE_FILTER && FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT && !X86_64 && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86

vim +/dec_params +1357 drivers/staging/media/rkvdec/rkvdec-vp9.c

1353
1354 static void init_intra_only_probs(struct rkvdec_ctx *ctx,
1355 const struct rkvdec_vp9_run *run)
1356 {

> 1357		const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;

1358 struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv;
1359 struct rkvdec_vp9_priv_tbl *tbl = vp9_ctx->priv_tbl.cpu;
1360 struct rkvdec_vp9_intra_only_frame_probs *rkprobs;
1361 const struct rkvdec_vp9_frame_context *probs;
1362 unsigned int i, j, k, m;
1363
1364 rkprobs = &tbl->probs.intra_only;
1365 dec_params = run->decode_params;
1366 probs = &vp9_ctx->probability_tables;
1367
1368 /*
1369 * intra only 149 x 128 bits ,aligned to 152 x 128 bits coeff related
1370 * prob 64 x 128 bits
1371 */
1372 for (i = 0; i < ARRAY_SIZE(probs->coef); i++) {
1373 for (j = 0; j < ARRAY_SIZE(probs->coef[0]); j++)
1374 write_coeff_plane(probs->coef[i][j][0],
1375 rkprobs->coef_intra[i][j]);
1376 }
1377
1378 /* intra mode prob 80 x 128 bits */
1379 for (i = 0; i < ARRAY_SIZE(vp9_kf_y_mode_prob); i++) {
1380 u32 byte_count = 0;
1381 int idx = 0;
1382
1383 /* vp9_kf_y_mode_prob */
1384 for (j = 0; j < ARRAY_SIZE(vp9_kf_y_mode_prob[0]); j++) {
1385 for (k = 0; k < ARRAY_SIZE(vp9_kf_y_mode_prob[0][0]);
1386 k++) {
1387 u8 val = vp9_kf_y_mode_prob[i][j][k];
1388
1389 rkprobs->intra_mode[i].y_mode[idx++] = val;
1390 byte_count++;
1391 if (byte_count == 27) {
1392 byte_count = 0;
1393 idx += 5;
1394 }
1395 }
1396 }
1397
1398 idx = 0;
1399 if (i < 4) {
1400 for (m = 0; m < (i < 3 ? 23 : 21); m++) {
1401 const u8 *ptr = (const u8 *)kf_uv_mode_prob;
1402
1403 rkprobs->intra_mode[i].uv_mode[idx++] = ptr[i * 23 + m];
1404 }
1405 }
1406 }
1407 }
1408

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

#4 lore raw

Re: [RFC 3/3] media: rkvdec: Add the VP9 backend

In reply to Andrzej Pietrasiewicz
[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]

Hi Andrzej,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20210428]
[cannot apply to v5.12]
[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/Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-a003-20210428 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 87fc97169e7901dfe56ca0da0d92da0c02d2ef48)

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/df37e41d68d9ab1326f8a5a54d001d9a241b4079
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601 git checkout df37e41d68d9ab1326f8a5a54d001d9a241b4079
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/staging/media/rkvdec/rkvdec-vp9.c:1357:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]
           const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
                                                           ^
   drivers/staging/media/rkvdec/rkvdec-vp9.c:1412:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]
           const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
                                                           ^

2 warnings generated.

vim +/dec_params +1357 drivers/staging/media/rkvdec/rkvdec-vp9.c

1353
1354 static void init_intra_only_probs(struct rkvdec_ctx *ctx,
1355 const struct rkvdec_vp9_run *run)
1356 {

> 1357		const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;

1358 struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv;
1359 struct rkvdec_vp9_priv_tbl *tbl = vp9_ctx->priv_tbl.cpu;
1360 struct rkvdec_vp9_intra_only_frame_probs *rkprobs;
1361 const struct rkvdec_vp9_frame_context *probs;
1362 unsigned int i, j, k, m;
1363
1364 rkprobs = &tbl->probs.intra_only;
1365 dec_params = run->decode_params;
1366 probs = &vp9_ctx->probability_tables;
1367
1368 /*
1369 * intra only 149 x 128 bits ,aligned to 152 x 128 bits coeff related
1370 * prob 64 x 128 bits
1371 */
1372 for (i = 0; i < ARRAY_SIZE(probs->coef); i++) {
1373 for (j = 0; j < ARRAY_SIZE(probs->coef[0]); j++)
1374 write_coeff_plane(probs->coef[i][j][0],
1375 rkprobs->coef_intra[i][j]);
1376 }
1377
1378 /* intra mode prob 80 x 128 bits */
1379 for (i = 0; i < ARRAY_SIZE(vp9_kf_y_mode_prob); i++) {
1380 u32 byte_count = 0;
1381 int idx = 0;
1382
1383 /* vp9_kf_y_mode_prob */
1384 for (j = 0; j < ARRAY_SIZE(vp9_kf_y_mode_prob[0]); j++) {
1385 for (k = 0; k < ARRAY_SIZE(vp9_kf_y_mode_prob[0][0]);
1386 k++) {
1387 u8 val = vp9_kf_y_mode_prob[i][j][k];
1388
1389 rkprobs->intra_mode[i].y_mode[idx++] = val;
1390 byte_count++;
1391 if (byte_count == 27) {
1392 byte_count = 0;
1393 idx += 5;
1394 }
1395 }
1396 }
1397
1398 idx = 0;
1399 if (i < 4) {
1400 for (m = 0; m < (i < 3 ? 23 : 21); m++) {
1401 const u8 *ptr = (const u8 *)kf_uv_mode_prob;
1402
1403 rkprobs->intra_mode[i].uv_mode[idx++] = ptr[i * 23 + m];
1404 }
1405 }
1406 }
1407 }
1408

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

#5 lore raw

Re: [RFC 3/3] media: rkvdec: Add the VP9 backend

Hi,

W dniu 28.04.2021 o 19:47, kernel test robot pisze:

Quoted 9 lines

Hi Andrzej,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20210428]
[cannot apply to v5.12]
[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]

Ah, right, didn't use --base. It was rebased on top of media_tree as of the day I sent the series.

Thanks,

Andrzej

Quoted 94 lines
url:    https://github.com/0day-ci/linux/commits/Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-a003-20210428 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 87fc97169e7901dfe56ca0da0d92da0c02d2ef48)

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/df37e41d68d9ab1326f8a5a54d001d9a241b4079
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrzej-Pietrasiewicz/media-rkvdec-Fix-buf_prepare/20210421-175601 git checkout df37e41d68d9ab1326f8a5a54d001d9a241b4079
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/staging/media/rkvdec/rkvdec-vp9.c:1357:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]

            const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
                                                            ^
    drivers/staging/media/rkvdec/rkvdec-vp9.c:1412:50: warning: variable 'dec_params' set but not used [-Wunused-but-set-variable]
            const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
                                                            ^
    2 warnings generated.

vim +/dec_params +1357 drivers/staging/media/rkvdec/rkvdec-vp9.c

   1353	
   1354	static void init_intra_only_probs(struct rkvdec_ctx *ctx,
   1355					  const struct rkvdec_vp9_run *run)
   1356	{
Quoted 1 line

1357 const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;

   1358		struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv;
   1359		struct rkvdec_vp9_priv_tbl *tbl = vp9_ctx->priv_tbl.cpu;
   1360		struct rkvdec_vp9_intra_only_frame_probs *rkprobs;
   1361		const struct rkvdec_vp9_frame_context *probs;
   1362		unsigned int i, j, k, m;
   1363	
   1364		rkprobs = &tbl->probs.intra_only;
   1365		dec_params = run->decode_params;
   1366		probs = &vp9_ctx->probability_tables;
   1367	
   1368		/*
   1369		 * intra only 149 x 128 bits ,aligned to 152 x 128 bits coeff related
   1370		 * prob 64 x 128 bits
   1371		 */
   1372		for (i = 0; i < ARRAY_SIZE(probs->coef); i++) {
   1373			for (j = 0; j < ARRAY_SIZE(probs->coef[0]); j++)
   1374				write_coeff_plane(probs->coef[i][j][0],
   1375						  rkprobs->coef_intra[i][j]);
   1376		}
   1377	
   1378		/* intra mode prob  80 x 128 bits */
   1379		for (i = 0; i < ARRAY_SIZE(vp9_kf_y_mode_prob); i++) {
   1380			u32 byte_count = 0;
   1381			int idx = 0;
   1382	
   1383			/* vp9_kf_y_mode_prob */
   1384			for (j = 0; j < ARRAY_SIZE(vp9_kf_y_mode_prob[0]); j++) {
   1385				for (k = 0; k < ARRAY_SIZE(vp9_kf_y_mode_prob[0][0]);
   1386				     k++) {
   1387					u8 val = vp9_kf_y_mode_prob[i][j][k];
   1388	
   1389					rkprobs->intra_mode[i].y_mode[idx++] = val;
   1390					byte_count++;
   1391					if (byte_count == 27) {
   1392						byte_count = 0;
   1393						idx += 5;
   1394					}
   1395				}
   1396			}
   1397	
   1398			idx = 0;
   1399			if (i < 4) {
   1400				for (m = 0; m < (i < 3 ? 23 : 21); m++) {
   1401					const u8 *ptr = (const u8 *)kf_uv_mode_prob;
   1402	
   1403					rkprobs->intra_mode[i].uv_mode[idx++] = ptr[i * 23 + m];
   1404				}
   1405			}
   1406		}
   1407	}
   1408	

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