Add MPEG-2 decoding to Rockchip VPU
Subsystems (3)
v4 cover Add MPEG-2 decoding to Rockchip VPU
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on /dev/video0, and the VPU decoder is exposed on /dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device /dev/media0.
Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Regards,
Boris
v4:
* Fix issues in the probe/remove path preventing the driver from being unloaded/reloaded (Jonas)
* Rework the media controller registration code to simplify the error/remove path (Boris)
* Split the MPEG2 patches (one adding the generic code and one patch per platform)
v3:
* Share more code between the encoder/decoder logic (VB2/V4L2 interface implementation)
* Add a patch to support MPEG2 decoding on RK3288 (Jonas)
* Several fixes/improvements all over the place (see changelog in each patch for more details)
v2:
* Fixed some minor issues brought up by v4l2-compliance.
* Fixed bytesused wrongly assigned 0 on the MPEG-2 decoder.
* Addressed comments from Hans and Tomasz on the pixel format helpers.
Boris Brezillon (7):
rockchip/vpu: Remove a useless test
rockchip/vpu: Get vdev from the file arg in vidioc_querycap() rockchip/vpu: Initialize mdev->bus_info
rockchip/vpu: Rename rockchip_vpu_common.h into rockchip_vpu_v4l2.h rockchip/vpu: Move encoder logic to a common place rockchip/vpu: Provide a helper to reset both src and dst formats rockchip/vpu: Prepare things to support decoders
Ezequiel Garcia (8):
rockchip/vpu: Use pixel format helpers rockchip/vpu: Use v4l2_m2m_buf_copy_metadata rockchip/vpu: Cleanup macroblock alignment rockchip/vpu: Cleanup JPEG bounce buffer management rockchip/vpu: Open-code media controller register rockchip/vpu: Support the Request API rockchip/vpu: Add decoder boilerplate rockchip/vpu: Add support for non-standard controls
Jonas Karlman (6):
rockchip/vpu: Do not request id 0 for our video device rockchip/vpu: Add missing dont_use_autosuspend() calls rockchip/vpu: Fix/re-order probe-error/remove path rockchip/vpu: Add infra to support MPEG-2 decoding rockchip/vpu: Add MPEG2 decoding support to RK3399 rockchip/vpu: Add support for MPEG-2 decoding on RK3288
drivers/staging/media/rockchip/vpu/Kconfig | 1 + drivers/staging/media/rockchip/vpu/Makefile | 7 +- .../media/rockchip/vpu/rk3288_vpu_hw.c | 61 +- .../rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 6 +- .../rockchip/vpu/rk3288_vpu_hw_mpeg2_dec.c | 262 +++++++ .../media/rockchip/vpu/rk3288_vpu_regs.h | 1 + .../media/rockchip/vpu/rk3399_vpu_hw.c | 61 +- .../rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 12 +- .../rockchip/vpu/rk3399_vpu_hw_mpeg2_dec.c | 268 +++++++ .../staging/media/rockchip/vpu/rockchip_vpu.h | 119 +++- .../media/rockchip/vpu/rockchip_vpu_common.h | 30 +- .../media/rockchip/vpu/rockchip_vpu_drv.c | 484 ++++++++++--- .../media/rockchip/vpu/rockchip_vpu_enc.c | 670 ------------------ .../media/rockchip/vpu/rockchip_vpu_hw.h | 44 ++ .../media/rockchip/vpu/rockchip_vpu_jpeg.c | 29 + .../media/rockchip/vpu/rockchip_vpu_mpeg2.c | 61 ++ .../media/rockchip/vpu/rockchip_vpu_v4l2.c | 668 +++++++++++++++++ .../media/rockchip/vpu/rockchip_vpu_v4l2.h | 26 + 18 files changed, 2035 insertions(+), 775 deletions(-) create mode 100644 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_mpeg2_dec.c create mode 100644 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_mpeg2_dec.c delete mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_mpeg2.c create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.h
Signature · 7 lines
2.20.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v4 1/21 rockchip/vpu: Use pixel format helpers
From: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
Now that we've introduced the pixel format helpers, use them in vpu driver, and get rid of the internal helpers.
---
Changes from v3:
* None
Changes from v2:
* None
--- .../media/rockchip/vpu/rockchip_vpu_enc.c | 91 +------------------ 1 file changed, 2 insertions(+), 89 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +2 -89
@@ -30,93 +30,6 @@#include "rockchip_vpu_hw.h" #include "rockchip_vpu_common.h" -/** -* struct v4l2_format_info - information about a V4L2 format -* @format: 4CC format identifier (V4L2_PIX_FMT_*) -* @header_size: Size of header, optional and used by compressed formats -* @num_planes: Number of planes (1 to 3) -* @cpp: Number of bytes per pixel (per plane) -* @hsub: Horizontal chroma subsampling factor -* @vsub: Vertical chroma subsampling factor -* @is_compressed: Is it a compressed format? -* @multiplanar: Is it a multiplanar variant format? (e.g. NV12M) -*/ -struct rockchip_vpu_v4l2_format_info { -u32 format; -u32 header_size; -u8 num_planes; -u8 cpp[3 ]; -u8 hsub; -u8 vsub; -u8 is_compressed; -u8 multiplanar; -}; - -static const struct rockchip_vpu_v4l2_format_info * -rockchip_vpu_v4l2_format_info (u32 format) -{ -static const struct rockchip_vpu_v4l2_format_info formats[] = { - { .format =V4L2_PIX_FMT_YUV420M , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =2 , .multiplanar =1 }, - { .format =V4L2_PIX_FMT_NV12M , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =2 , .multiplanar =1 }, - { .format =V4L2_PIX_FMT_YUYV , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, - { .format =V4L2_PIX_FMT_UYVY , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, - }; -unsigned int i; - -for (i =0 ; i <ARRAY_SIZE (formats); ++i) { -if (formats[i].format == format) -return &formats[i]; - } - -vpu_err ("Unsupported V4L 4CC format (%08x)\n" , format); -return NULL ; -} - -static void -fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt, -int pixelformat,int width,int height) -{ -const struct rockchip_vpu_v4l2_format_info *info; -struct v4l2_plane_pix_format *plane; -int i; - - info =rockchip_vpu_v4l2_format_info (pixelformat); -if (!info) -return ; - - pixfmt->width = width; - pixfmt->height = height; - pixfmt->pixelformat = pixelformat; - -if (!info->multiplanar) { - pixfmt->num_planes =1 ; - plane = &pixfmt->plane_fmt[0 ]; - plane->bytesperline = info->is_compressed ? -0 : width * info->cpp[0 ]; - plane->sizeimage = info->header_size; -for (i =0 ; i < info->num_planes; i++) { -unsigned int hsub = (i ==0 ) ?1 : info->hsub; -unsigned int vsub = (i ==0 ) ?1 : info->vsub; - - plane->sizeimage += info->cpp[i] * -DIV_ROUND_UP (width, hsub) * -DIV_ROUND_UP (height, vsub); - } - }else { - pixfmt->num_planes = info->num_planes; -for (i =0 ; i < info->num_planes; i++) { -unsigned int hsub = (i ==0 ) ?1 : info->hsub; -unsigned int vsub = (i ==0 ) ?1 : info->vsub; - - plane = &pixfmt->plane_fmt[i]; - plane->bytesperline = - info->cpp[i] *DIV_ROUND_UP (width, hsub); - plane->sizeimage = - plane->bytesperline *DIV_ROUND_UP (height, vsub); - } - } -} -static const struct rockchip_vpu_fmt *rockchip_vpu_find_format (struct rockchip_vpu_ctx *ctx,u32 fourcc) {
@@ -339,7 +252,7 @@ vidioc_try_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f) height =round_up (height,JPEG_MB_DIM );/* Fill remaining fields */ -fill_pixfmt_mp (pix_mp, fmt->fourcc, width, height); +v4l2_fill_pixfmt_mp (pix_mp, fmt->fourcc, width, height);for (i =0 ; i < pix_mp->num_planes; i++) { memset(pix_mp->plane_fmt[i].reserved, 0,
@@ -393,7 +306,7 @@ void rockchip_vpu_enc_reset_src_fmt(struct rockchip_vpu_dev *vpu, fmt->quantization =V4L2_QUANTIZATION_DEFAULT ; fmt->xfer_func =V4L2_XFER_FUNC_DEFAULT ; -fill_pixfmt_mp (fmt, ctx->vpu_src_fmt->fourcc, width, height); +v4l2_fill_pixfmt_mp (fmt, ctx->vpu_src_fmt->fourcc, width, height); } static int
Signature · 1 line
2.20.1
PATCH v4 2/21 rockchip/vpu: Use v4l2_m2m_buf_copy_metadata
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
Use the recently introduced v4l2_m2m_buf_copy_metadata helper and get rid of some code.
---
Changes from v3:
* None
Changes from v2:
* None
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +1 -8
@@ -58,14 +58,7 @@ static void rockchip_vpu_job_finish(struct rockchip_vpu_dev *vpu, src->sequence = ctx->sequence_out++; dst->sequence = ctx->sequence_cap++; - dst->field = src->field; -if (src->flags &V4L2_BUF_FLAG_TIMECODE ) - dst->timecode = src->timecode; - dst->vb2_buf.timestamp = src->vb2_buf.timestamp; - dst->flags &= ~(V4L2_BUF_FLAG_TSTAMP_SRC_MASK | -V4L2_BUF_FLAG_TIMECODE ); - dst->flags |= src->flags & (V4L2_BUF_FLAG_TSTAMP_SRC_MASK | -V4L2_BUF_FLAG_TIMECODE ); +v4l2_m2m_buf_copy_metadata (src, dst, true); avail_size =vb2_plane_size (&dst->vb2_buf,0 ) - ctx->vpu_dst_fmt->header_size;
Signature · 1 line
2.20.1
PATCH v4 3/21 rockchip/vpu: Cleanup macroblock alignment
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
We need to make the macrobock alignment generic, in order to support multiple codecs.
---
Changes from v3:
* None
Changes from v2:
* None
--- .../media/rockchip/vpu/rockchip_vpu_enc.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +8 -12
@@ -203,8 +203,8 @@ vidioc_try_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f) fmt->frmsize.min_height, fmt->frmsize.max_height);/* Round up to macroblocks. */ - pix_mp->width =round_up (pix_mp->width,JPEG_MB_DIM ); - pix_mp->height =round_up (pix_mp->height,JPEG_MB_DIM ); + pix_mp->width =round_up (pix_mp->width, fmt->frmsize.step_width); + pix_mp->height =round_up (pix_mp->height, fmt->frmsize.step_height);/* * For compressed formats the application can specify
@@ -248,8 +248,8 @@ vidioc_try_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f) ctx->vpu_dst_fmt->frmsize.min_height, ctx->vpu_dst_fmt->frmsize.max_height);/* Round up to macroblocks. */ - width =round_up (width,JPEG_MB_DIM ); - height =round_up (height,JPEG_MB_DIM ); + width =round_up (width, ctx->vpu_dst_fmt->frmsize.step_width); + height =round_up (height, ctx->vpu_dst_fmt->frmsize.step_height);/* Fill remaining fields */ v4l2_fill_pixfmt_mp (pix_mp, fmt->fourcc, width, height);
@@ -338,10 +338,8 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f) ctx->dst_fmt.height = pix_mp->height;vpu_debug (0 ,"OUTPUT codec mode: %d\n" , ctx->vpu_src_fmt->codec_mode); -vpu_debug (0 ,"fmt - w: %d, h: %d, mb - w: %d, h: %d\n" , - pix_mp->width, pix_mp->height, -JPEG_MB_WIDTH (pix_mp->width), -JPEG_MB_HEIGHT (pix_mp->height)); +vpu_debug (0 ,"fmt - w: %d, h: %d\n" , + pix_mp->width, pix_mp->height);return 0 ; }
@@ -380,10 +378,8 @@ vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f) ctx->dst_fmt = *pix_mp;vpu_debug (0 ,"CAPTURE codec mode: %d\n" , ctx->vpu_dst_fmt->codec_mode); -vpu_debug (0 ,"fmt - w: %d, h: %d, mb - w: %d, h: %d\n" , - pix_mp->width, pix_mp->height, -JPEG_MB_WIDTH (pix_mp->width), -JPEG_MB_HEIGHT (pix_mp->height)); +vpu_debug (0 ,"fmt - w: %d, h: %d\n" , + pix_mp->width, pix_mp->height);/* * Current raw format might have become invalid with newly
Signature · 1 line
2.20.1
PATCH v4 4/21 rockchip/vpu: Cleanup JPEG bounce buffer management
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
In order to make the code more generic, introduce a pair of start/stop codec operations, and use them to allocate and release the JPEG bounce buffer.
---
Changes from v3:
* None
Changes from v2:
* Reword bounce buffer comment, so it's specific about JPEG.
* Rename helpers, start/stop to init/exit.
* Rename "jpeg_enc_ctx" to "jpeg_enc", since it's clear it's a member of a "_ctx" struct.
--- .../media/rockchip/vpu/rk3288_vpu_hw.c | 2 ++ .../rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 4 +-- .../media/rockchip/vpu/rk3399_vpu_hw.c | 2 ++ .../rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 4 +-- .../staging/media/rockchip/vpu/rockchip_vpu.h | 12 ++++---- .../media/rockchip/vpu/rockchip_vpu_drv.c | 9 ++++-- .../media/rockchip/vpu/rockchip_vpu_enc.c | 23 +++++---------- .../media/rockchip/vpu/rockchip_vpu_hw.h | 28 ++++++++++++++++++ .../media/rockchip/vpu/rockchip_vpu_jpeg.c | 29 +++++++++++++++++++ 9 files changed, 84 insertions(+), 29 deletions(-)
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c +2 -0
@@ -98,6 +98,8 @@ static const struct rockchip_vpu_codec_ops rk3288_vpu_codec_ops[] = { [RK_VPU_MODE_JPEG_ENC ] = { .run = rk3288_vpu_jpeg_enc_run, .reset = rk3288_vpu_enc_reset, + .init = rockchip_vpu_jpeg_enc_init, + .exit = rockchip_vpu_jpeg_enc_exit, }, };
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c +2 -2
@@ -37,9 +37,9 @@ static void rk3288_vpu_jpeg_enc_set_buffers(struct rockchip_vpu_dev *vpu,WARN_ON (pix_fmt->num_planes >3 ); -vepu_write_relaxed (vpu, ctx->bounce_dma_addr, +vepu_write_relaxed (vpu, ctx->jpeg_enc.bounce_buffer.dma,VEPU_REG_ADDR_OUTPUT_STREAM ); -vepu_write_relaxed (vpu, ctx->bounce_size, +vepu_write_relaxed (vpu, ctx->jpeg_enc.bounce_buffer.size,VEPU_REG_STR_BUF_LIMIT );if (pix_fmt->num_planes ==1 ) {
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw.c +2 -0
@@ -98,6 +98,8 @@ static const struct rockchip_vpu_codec_ops rk3399_vpu_codec_ops[] = { [RK_VPU_MODE_JPEG_ENC ] = { .run = rk3399_vpu_jpeg_enc_run, .reset = rk3399_vpu_enc_reset, + .init = rockchip_vpu_jpeg_enc_init, + .exit = rockchip_vpu_jpeg_enc_exit, }, };
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c +2 -2
@@ -69,9 +69,9 @@ static void rk3399_vpu_jpeg_enc_set_buffers(struct rockchip_vpu_dev *vpu,WARN_ON (pix_fmt->num_planes >3 ); -vepu_write_relaxed (vpu, ctx->bounce_dma_addr, +vepu_write_relaxed (vpu, ctx->jpeg_enc.bounce_buffer.dma,VEPU_REG_ADDR_OUTPUT_STREAM ); -vepu_write_relaxed (vpu, ctx->bounce_size, +vepu_write_relaxed (vpu, ctx->jpeg_enc.bounce_buffer.size,VEPU_REG_STR_BUF_LIMIT );if (pix_fmt->num_planes ==1 ) {
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +5 -7
@@ -124,10 +124,7 @@ struct rockchip_vpu_dev {* @jpeg_quality: User-specified JPEG compression quality. * * @codec_ops: Set of operations related to codec mode. -* -* @bounce_dma_addr: Bounce buffer bus address. -* @bounce_buf: Bounce buffer pointer. -* @bounce_size: Bounce buffer size. +* @jpeg_enc: JPEG-encoding context. */ struct rockchip_vpu_ctx {struct rockchip_vpu_dev *dev;
@@ -146,9 +143,10 @@ struct rockchip_vpu_ctx {const struct rockchip_vpu_codec_ops *codec_ops; -dma_addr_t bounce_dma_addr; -void *bounce_buf; -size_t bounce_size; +/* Specific for particular codec modes. */ +union { +struct rockchip_vpu_jpeg_enc_hw_ctx jpeg_enc; + }; };/**
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +7 -2
@@ -63,10 +63,15 @@ static void rockchip_vpu_job_finish(struct rockchip_vpu_dev *vpu, avail_size =vb2_plane_size (&dst->vb2_buf,0 ) - ctx->vpu_dst_fmt->header_size;if (bytesused <= avail_size) { -if (ctx->bounce_buf) { +/* +* The bounce buffer is only for the JPEG encoder. +* TODO: Rework the JPEG encoder to eliminate the need +* for a bounce buffer. +*/ +if (ctx->jpeg_enc.bounce_buffer.cpu) {memcpy (vb2_plane_vaddr (&dst->vb2_buf,0 ) + ctx->vpu_dst_fmt->header_size, - ctx->bounce_buf, bytesused); + ctx->jpeg_enc.bounce_buffer.cpu, bytesused); } dst->vb2_buf.planes[0 ].bytesused = ctx->vpu_dst_fmt->header_size + bytesused;
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +7 -16
@@ -514,6 +514,7 @@ static int rockchip_vpu_start_streaming(struct vb2_queue *q, unsigned int count) {struct rockchip_vpu_ctx *ctx =vb2_get_drv_priv (q);enum rockchip_vpu_codec_mode codec_mode; +int ret =0 ;if (V4L2_TYPE_IS_OUTPUT (q->type)) ctx->sequence_out =0 ;
@@ -526,17 +527,10 @@ static int rockchip_vpu_start_streaming(struct vb2_queue *q, unsigned int count)vpu_debug (4 ,"Codec mode = %d\n" , codec_mode); ctx->codec_ops = &ctx->dev->variant->codec_ops[codec_mode]; -/* A bounce buffer is needed for the JPEG payload */ -if (!V4L2_TYPE_IS_OUTPUT (q->type)) { - ctx->bounce_size = ctx->dst_fmt.plane_fmt[0 ].sizeimage - - ctx->vpu_dst_fmt->header_size; - ctx->bounce_buf =dma_alloc_attrs (ctx->dev->dev, - ctx->bounce_size, - &ctx->bounce_dma_addr, -GFP_KERNEL , -DMA_ATTR_ALLOC_SINGLE_PAGES ); - } -return 0 ; +if (!V4L2_TYPE_IS_OUTPUT (q->type)) +if (ctx->codec_ops && ctx->codec_ops->init) + ret = ctx->codec_ops->init (ctx); +return ret; }static void rockchip_vpu_stop_streaming (struct vb2_queue *q)
@@ -544,11 +538,8 @@ static void rockchip_vpu_stop_streaming(struct vb2_queue *q)struct rockchip_vpu_ctx *ctx =vb2_get_drv_priv (q);if (!V4L2_TYPE_IS_OUTPUT (q->type)) -dma_free_attrs (ctx->dev->dev, - ctx->bounce_size, - ctx->bounce_buf, - ctx->bounce_dma_addr, -DMA_ATTR_ALLOC_SINGLE_PAGES ); +if (ctx->codec_ops && ctx->codec_ops->exit) + ctx->codec_ops->exit (ctx);/* * The mem2mem framework calls v4l2_m2m_cancel_job before
drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h +28 -0
@@ -18,9 +18,33 @@ struct rockchip_vpu_ctx;struct rockchip_vpu_buf ;struct rockchip_vpu_variant ; +/** +* struct rockchip_vpu_aux_buf - auxiliary DMA buffer for hardware data +* @cpu: CPU pointer to the buffer. +* @dma: DMA address of the buffer. +* @size: Size of the buffer. +*/ +struct rockchip_vpu_aux_buf { +void *cpu; +dma_addr_t dma; +size_t size; +}; + +/** +* struct rockchip_vpu_jpeg_enc_hw_ctx +* @bounce_buffer: Bounce buffer +*/ +struct rockchip_vpu_jpeg_enc_hw_ctx { +struct rockchip_vpu_aux_buf bounce_buffer; +}; +/** * struct rockchip_vpu_codec_ops - codec mode specific operations * +* @init: If needed, can be used for initialization. +* Optional and called from process context. +* @exit: If needed, can be used to undo the .init phase. +* Optional and called from process context. * @run: Start single {en,de)coding job. Called from atomic context * to indicate that a pair of buffers is ready and the hardware * should be programmed and started.
@@ -28,6 +52,8 @@ struct rockchip_vpu_variant;* @reset: Reset the hardware in case of a timeout. */ struct rockchip_vpu_codec_ops { +int (*init)(struct rockchip_vpu_ctx *ctx); +void (*exit)(struct rockchip_vpu_ctx *ctx);void (*run)(struct rockchip_vpu_ctx *ctx);void (*done)(struct rockchip_vpu_ctx *ctx,enum vb2_buffer_state );void (*reset)(struct rockchip_vpu_ctx *ctx);
@@ -54,5 +80,7 @@ void rockchip_vpu_irq_done(struct rockchip_vpu_dev *vpu,void rk3288_vpu_jpeg_enc_run (struct rockchip_vpu_ctx *ctx);void rk3399_vpu_jpeg_enc_run (struct rockchip_vpu_ctx *ctx); +int rockchip_vpu_jpeg_enc_init (struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_jpeg_enc_exit (struct rockchip_vpu_ctx *ctx);#endif /* ROCKCHIP_VPU_HW_H_ */
drivers/staging/media/rockchip/vpu/rockchip_vpu_jpeg.c +29 -0
@@ -6,9 +6,11 @@* Copyright (C) Jean-Francois Moine (http://moinejf.free.fr) * Copyright (C) 2014 Philipp Zabel, Pengutronix */ +#include <linux/dma-mapping.h> #include <linux/kernel.h> #include <linux/string.h> #include "rockchip_vpu_jpeg.h" +#include "rockchip_vpu.h" #define LUMA_QUANT_OFF 7#define CHROMA_QUANT_OFF 72
@@ -288,3 +290,30 @@ void rockchip_vpu_jpeg_header_assemble(struct rockchip_vpu_jpeg_ctx *ctx)jpeg_set_quality (buf, ctx->quality); } + +int rockchip_vpu_jpeg_enc_init (struct rockchip_vpu_ctx *ctx) +{ + ctx->jpeg_enc.bounce_buffer.size = + ctx->dst_fmt.plane_fmt[0 ].sizeimage - + ctx->vpu_dst_fmt->header_size; + + ctx->jpeg_enc.bounce_buffer.cpu = +dma_alloc_attrs (ctx->dev->dev, + ctx->jpeg_enc.bounce_buffer.size, + &ctx->jpeg_enc.bounce_buffer.dma, +GFP_KERNEL , +DMA_ATTR_ALLOC_SINGLE_PAGES ); +if (!ctx->jpeg_enc.bounce_buffer.cpu) +return -ENOMEM ; + +return 0 ; +} + +void rockchip_vpu_jpeg_enc_exit (struct rockchip_vpu_ctx *ctx) +{ +dma_free_attrs (ctx->dev->dev, + ctx->jpeg_enc.bounce_buffer.size, + ctx->jpeg_enc.bounce_buffer.cpu, + ctx->jpeg_enc.bounce_buffer.dma, +DMA_ATTR_ALLOC_SINGLE_PAGES ); +}
Signature · 1 line
2.20.1
PATCH v4 5/21 rockchip/vpu: Remove a useless test
In reply to Boris Brezillonvdev is guaranteed to be equal to vpu->vfd_enc thanks a test done a few lines above. Remove this useless test.
---
Changes from v3:
* Move earlier in the series
Changes from v2:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +2 -4
@@ -271,10 +271,8 @@ static int rockchip_vpu_open(struct file *filp) filp->private_data = &ctx->fh;v4l2_fh_add (&ctx->fh); -if (vdev == vpu->vfd_enc) { -rockchip_vpu_enc_reset_dst_fmt (vpu, ctx); -rockchip_vpu_enc_reset_src_fmt (vpu, ctx); - } +rockchip_vpu_enc_reset_dst_fmt (vpu, ctx); +rockchip_vpu_enc_reset_src_fmt (vpu, ctx); ret =rockchip_vpu_ctrls_setup (vpu, ctx);if (ret) {
Signature · 1 line
2.20.1
PATCH v4 6/21 rockchip/vpu: Do not request id 0 for our video device
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
Pass -1 to video_register_device() to let the core assign the first free id instead of trying to get id 0.
In practice it doesn't make a difference since video_register_device() is not strict about id requests and will anyway pick the first free id starting at the id passed in argument, and passing -1 has the same effect as passing 0. But let's comply with the API doc and pass -1 here.
---
Changes from v3:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +1 -1
@@ -348,7 +348,7 @@ static int rockchip_vpu_video_device_register(struct rockchip_vpu_dev *vpu) vpu->vfd_enc = vfd;video_set_drvdata (vfd, vpu); - ret =video_register_device (vfd,VFL_TYPE_GRABBER ,0 ); + ret =video_register_device (vfd,VFL_TYPE_GRABBER ,-1 );if (ret) {v4l2_err (&vpu->v4l2_dev,"Failed to register video device\n" ); goto err_free_dev;
Signature · 1 line
2.20.1
PATCH v4 7/21 rockchip/vpu: Add missing dont_use_autosuspend() calls
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
Those calls are needed to restore a clean PM state when the probe fails or when the driver is unloaded such that future ->probe() calls can initialize runtime PM again.
---
Changes from v3:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +2 -0
@@ -485,6 +485,7 @@ static int rockchip_vpu_probe(struct platform_device *pdev)v4l2_device_unregister (&vpu->v4l2_dev); err_clk_unprepare:clk_bulk_unprepare (vpu->variant->num_clocks, vpu->clocks); +pm_runtime_dont_use_autosuspend (vpu->dev);pm_runtime_disable (vpu->dev);return ret; }
@@ -505,6 +506,7 @@ static int rockchip_vpu_remove(struct platform_device *pdev) }v4l2_device_unregister (&vpu->v4l2_dev);clk_bulk_unprepare (vpu->variant->num_clocks, vpu->clocks); +pm_runtime_dont_use_autosuspend (vpu->dev);pm_runtime_disable (vpu->dev);return 0 ; }
Signature · 1 line
2.20.1
PATCH v4 8/21 rockchip/vpu: Get vdev from the file arg in vidioc_querycap()
In reply to Boris BrezillonThis makes the function more generic so it can easily be re-used when adding support for the decoding functionality.
---
Changes from v3:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +2 -1
@@ -65,9 +65,10 @@ static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) {struct rockchip_vpu_dev *vpu =video_drvdata (file); +struct video_device *vdev =video_devdata (file);strscpy (cap->driver, vpu->dev->driver->name,sizeof (cap->driver)); -strscpy (cap->card, vpu->vfd_enc->name,sizeof (cap->card)); +strscpy (cap->card, vdev->name,sizeof (cap->card));snprintf (cap->bus_info,sizeof (cap->bus_info),"platform: %s" , vpu->dev->driver->name);return 0 ;
Signature · 1 line
2.20.1
PATCH v4 9/21 rockchip/vpu: Initialize mdev->bus_info
In reply to Boris Brezillonv4l2-compliance complains that ->bus_info is empty.
---
Changes from v3:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +2 -0
@@ -459,6 +459,8 @@ static int rockchip_vpu_probe(struct platform_device *pdev) vpu->mdev.dev = vpu->dev;strscpy (vpu->mdev.model,DRIVER_NAME ,sizeof (vpu->mdev.model)); +strscpy (vpu->mdev.bus_info,"platform: " DRIVER_NAME , +sizeof (vpu->mdev.model));media_device_init (&vpu->mdev); vpu->v4l2_dev.mdev = &vpu->mdev;
Signature · 1 line
2.20.1
PATCH v4 10/21 rockchip/vpu: Fix/re-order probe-error/remove path
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
media_device_cleanup() and v4l2_m2m_unregister_media_controller() were missing in the probe error path.
While at it, re-order calls in the remove path to unregister/cleanup things in the reverse order they were initialized/registered.
---
Changes from v3:
* New patch
--- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +5 -3
@@ -478,10 +478,12 @@ static int rockchip_vpu_probe(struct platform_device *pdev)return 0 ; err_video_dev_unreg:if (vpu->vfd_enc) { +v4l2_m2m_unregister_media_controller (vpu->m2m_dev);video_unregister_device (vpu->vfd_enc);video_device_release (vpu->vfd_enc); } err_m2m_rel: +media_device_cleanup (&vpu->mdev);v4l2_m2m_release (vpu->m2m_dev); err_v4l2_unreg:v4l2_device_unregister (&vpu->v4l2_dev);
@@ -499,13 +501,13 @@ static int rockchip_vpu_remove(struct platform_device *pdev)v4l2_info (&vpu->v4l2_dev,"Removing %s\n" , pdev->name);media_device_unregister (&vpu->mdev); -v4l2_m2m_unregister_media_controller (vpu->m2m_dev); -v4l2_m2m_release (vpu->m2m_dev); -media_device_cleanup (&vpu->mdev);if (vpu->vfd_enc) { +v4l2_m2m_unregister_media_controller (vpu->m2m_dev);video_unregister_device (vpu->vfd_enc);video_device_release (vpu->vfd_enc); } +media_device_cleanup (&vpu->mdev); +v4l2_m2m_release (vpu->m2m_dev);v4l2_device_unregister (&vpu->v4l2_dev);clk_bulk_unprepare (vpu->variant->num_clocks, vpu->clocks);pm_runtime_dont_use_autosuspend (vpu->dev);
Signature · 1 line
2.20.1
PATCH v4 11/21 rockchip/vpu: Open-code media controller register
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
In preparation to support decoders, using a single memory-to-memory device, we need to roll our own media controller entities registration.
To do that, we define a rockchip_vpu_func object that embeds the video_device object plus all the elements that are needed to attach this vdev to the media device.
--
Changes from v3:
* Rework the media controller registration logic (Boris)
* Fix media controller deregistration (Jonas)
Changes from v2:
* Use kvasprintf instead of kmalloc and snprintf.
* Fix missing kfree in error paths.
* Remove unneeded media_remove_intf_links on error paths.
--- .../staging/media/rockchip/vpu/rockchip_vpu.h | 39 +++- .../media/rockchip/vpu/rockchip_vpu_drv.c | 209 +++++++++++++++--- 2 files changed, 216 insertions(+), 32 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +37 -2
@@ -71,12 +71,47 @@ enum rockchip_vpu_codec_mode { RK_VPU_MODE_JPEG_ENC, }; +/* +* struct rockchip_vpu_func - rockchip VPU functionality +* +* @id: processing functionality ID (can be +* %MEDIA_ENT_F_PROC_VIDEO_ENCODER or +* %MEDIA_ENT_F_PROC_VIDEO_DECODER) +* @vdev: &struct video_device that exposes the encoder or +* decoder functionality +* @source_pad: &struct media_pad with the source pad. +* @sink: &struct media_entity pointer with the sink entity +* @sink_pad: &struct media_pad with the sink pad. +* @proc: &struct media_entity pointer with the M2M device itself. +* @proc_pads: &struct media_pad with the @proc pads. +* @intf_devnode: &struct media_intf devnode pointer with the interface +* with controls the M2M device. +* +* Contains everything needed to attach the video device to the media device. +*/ +struct rockchip_vpu_func { +unsigned int id; +struct video_device vdev; +struct media_pad source_pad; +struct media_entity sink; +struct media_pad sink_pad; +struct media_entity proc; +struct media_pad proc_pads[2 ]; +struct media_intf_devnode *intf_devnode; +}; + +static inline struct rockchip_vpu_func * +rockchip_vpu_vdev_to_func (struct video_device *vdev) +{ + return container_of(vdev, struct rockchip_vpu_func, vdev); +} +/** * struct rockchip_vpu_dev - driver data * @v4l2_dev: V4L2 device to register video devices for. * @m2m_dev: mem2mem device associated to this device. * @mdev: media device associated to this device. -* @vfd_enc: Video device for encoder. +* @encoder: encoder functionality. * @pdev: Pointer to VPU platform device. * @dev: Pointer to device for convenient logging using * dev_ macros.
@@ -93,7 +128,7 @@ struct rockchip_vpu_dev {struct v4l2_device v4l2_dev;struct v4l2_m2m_dev *m2m_dev;struct media_device mdev; -struct video_device *vfd_enc; +struct rockchip_vpu_func *encoder;struct platform_device *pdev;struct device *dev;struct clk_bulk_data clocks[ROCKCHIP_VPU_MAX_CLOCKS ];
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +179 -30
277 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 12/21 rockchip/vpu: Support the Request API
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
Introduce support for the Request API. Although the JPEG encoder does not mandate using the Request API, it's perfectly possible to use it, if the application wants to.
--
Changes from v3:
* None
Changes from v2:
* Drop unrelated mdev.bus_info changes.
* Remove the get_ref and get_ctrl helpers as they are not used yet.
--- .../rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 6 ++++++ .../media/rockchip/vpu/rockchip_vpu_drv.c | 7 +++++++ .../media/rockchip/vpu/rockchip_vpu_enc.c | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+)
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c +6 -0
@@ -113,11 +113,15 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx)struct rockchip_vpu_dev *vpu = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;struct rockchip_vpu_jpeg_ctx jpeg_ctx; +struct media_request *src_req;u32 reg; src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst_buf =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); + src_req = src_buf->vb2_buf.req_obj.req; +v4l2_ctrl_request_setup (src_req, &ctx->ctrl_handler); +memset (&jpeg_ctx,0 ,sizeof (jpeg_ctx)); jpeg_ctx.buffer =vb2_plane_vaddr (&dst_buf->vb2_buf,0 ); jpeg_ctx.width = ctx->dst_fmt.width;
@@ -153,6 +157,8 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx) | VEPU_REG_ENCODE_FORMAT_JPEG |VEPU_REG_ENCODE_ENABLE ; +v4l2_ctrl_request_complete (src_req, &ctx->ctrl_handler); +/* Kick the watchdog and start encoding */ schedule_delayed_work (&vpu->watchdog_work,msecs_to_jiffies (2000 ));vepu_write (vpu, reg,VEPU_REG_ENCODE_START );
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +7 -0
@@ -162,6 +162,7 @@ enc_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) src_vq->timestamp_flags =V4L2_BUF_FLAG_TIMESTAMP_COPY ; src_vq->lock = &ctx->dev->vpu_mutex; src_vq->dev = ctx->dev->v4l2_dev.dev; + src_vq->supports_requests = true; ret =vb2_queue_init (src_vq);if (ret)
@@ -525,6 +526,11 @@ static void rockchip_vpu_remove_enc_func(struct rockchip_vpu_dev *vpu)video_unregister_device (&func->vdev); } +static const struct media_device_ops rockchip_m2m_media_ops = { + .req_validate = vb2_request_validate, + .req_queue = v4l2_m2m_request_queue, +}; +static int rockchip_vpu_probe (struct platform_device *pdev) {const struct of_device_id *match;
@@ -617,6 +623,7 @@ static int rockchip_vpu_probe(struct platform_device *pdev)strscpy (vpu->mdev.bus_info,"platform: " DRIVER_NAME ,sizeof (vpu->mdev.model));media_device_init (&vpu->mdev); + vpu->mdev.ops = &rockchip_m2m_media_ops; vpu->v4l2_dev.mdev = &vpu->mdev; ret =rockchip_vpu_add_enc_func (vpu);
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +19 -0
@@ -556,14 +556,33 @@ static void rockchip_vpu_stop_streaming(struct vb2_queue *q) vbuf =v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx);if (!vbuf)break ; +v4l2_ctrl_request_complete (vbuf->vb2_buf.req_obj.req, + &ctx->ctrl_handler);v4l2_m2m_buf_done (vbuf,VB2_BUF_STATE_ERROR ); } } +static void rockchip_vpu_buf_request_complete (struct vb2_buffer *vb) +{ +struct rockchip_vpu_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); + +v4l2_ctrl_request_complete (vb->req_obj.req, &ctx->ctrl_handler); +} + +static int rockchip_vpu_buf_out_validate (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); + + vbuf->field =V4L2_FIELD_NONE ; +return 0 ; +} +const struct vb2_ops rockchip_vpu_enc_queue_ops = { .queue_setup = rockchip_vpu_queue_setup, .buf_prepare = rockchip_vpu_buf_prepare, .buf_queue = rockchip_vpu_buf_queue, + .buf_out_validate = rockchip_vpu_buf_out_validate, + .buf_request_complete = rockchip_vpu_buf_request_complete, .start_streaming = rockchip_vpu_start_streaming, .stop_streaming = rockchip_vpu_stop_streaming, .wait_prepare = vb2_ops_wait_prepare,
Signature · 1 line
2.20.1
PATCH v4 13/21 rockchip/vpu: Rename rockchip_vpu_common.h into rockchip_vpu_v4l2.h
In reply to Boris BrezillonWe're about to add prototypes for the vb2/v4l2 helpers shared by the encoder/decoder logic in this file, so let's pick a name that reflects that (rockchip_vpu_common.h was a bit to generic).
---
Changes from v3:
* None
Changes from v2:
* New patch
---
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 2 +-
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 2 +-
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 2 +-
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c | 2 +-
.../vpu/{rockchip_vpu_common.h => rockchip_vpu_v4l2.h} | 6 +++---
5 files changed, 7 insertions(+), 7 deletions(-)
rename drivers/staging/media/rockchip/vpu/{rockchip_vpu_common.h => rockchip_vpu_v4l2.h} (88%)drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c +1 -1
@@ -9,7 +9,7 @@#include <media/v4l2-mem2mem.h> #include "rockchip_vpu_jpeg.h" #include "rockchip_vpu.h" -#include "rockchip_vpu_common.h" +#include "rockchip_vpu_v4l2.h" #include "rockchip_vpu_hw.h" #include "rk3288_vpu_regs.h"
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c +1 -1
@@ -27,7 +27,7 @@#include <media/v4l2-mem2mem.h> #include "rockchip_vpu_jpeg.h" #include "rockchip_vpu.h" -#include "rockchip_vpu_common.h" +#include "rockchip_vpu_v4l2.h" #include "rockchip_vpu_hw.h" #include "rk3399_vpu_regs.h"
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +1 -1
@@ -24,7 +24,7 @@#include <media/videobuf2-core.h> #include <media/videobuf2-vmalloc.h> -#include "rockchip_vpu_common.h" +#include "rockchip_vpu_v4l2.h" #include "rockchip_vpu.h" #include "rockchip_vpu_hw.h"
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +1 -1
@@ -28,7 +28,7 @@#include "rockchip_vpu.h" #include "rockchip_vpu_hw.h" -#include "rockchip_vpu_common.h" +#include "rockchip_vpu_v4l2.h" static const struct rockchip_vpu_fmt *rockchip_vpu_find_format (struct rockchip_vpu_ctx *ctx,u32 fourcc)
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.h renamed from drivers/staging/media/rockchip/vpu/rockchip_vpu_common.h +3 -3
@@ -13,8 +13,8 @@* Copyright (C) 2011 Samsung Electronics Co., Ltd. */ -#ifndef ROCKCHIP_VPU_COMMON_H_ -#define ROCKCHIP_VPU_COMMON_H_ +#ifndef ROCKCHIP_VPU_V4L2_H_ +#define ROCKCHIP_VPU_V4L2_H_ #include "rockchip_vpu.h"
@@ -26,4 +26,4 @@ void rockchip_vpu_enc_reset_src_fmt(struct rockchip_vpu_dev *vpu,void rockchip_vpu_enc_reset_dst_fmt (struct rockchip_vpu_dev *vpu,struct rockchip_vpu_ctx *ctx); -#endif /* ROCKCHIP_VPU_COMMON_H_ */ +#endif /* ROCKCHIP_VPU_V4L2_H_ */
Signature · 1 line
2.20.1
PATCH v4 14/21 rockchip/vpu: Move encoder logic to a common place
In reply to Boris BrezillonThe V4L2/VB2 implementation for the encoder and decoder logic are very similar, so let's rename rockchip_vpu_enc.c file into rockchip_vpu_v4l2.c and remove the _enc_ part in objects/functions exposed in rockchip_vpu_v4l2.h. We also rename the enc_queue_init() function (in rockchip_vpu_drv.c) queue_init() since it will be used to initialize both type of queues.
The implementation itself will be patched to support the decoding case when decoder support is added.
---
Changes from v3:
* None
Changes from v2:
* New patch
---
drivers/staging/media/rockchip/vpu/Makefile | 2 +-
.../staging/media/rockchip/vpu/rockchip_vpu_drv.c | 14 +++++++-------
.../{rockchip_vpu_enc.c => rockchip_vpu_v4l2.c} | 14 +++++++-------
.../staging/media/rockchip/vpu/rockchip_vpu_v4l2.h | 12 ++++++------
4 files changed, 21 insertions(+), 21 deletions(-)
rename drivers/staging/media/rockchip/vpu/{rockchip_vpu_enc.c => rockchip_vpu_v4l2.c} (97%)drivers/staging/media/rockchip/vpu/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_VIDEO_ROCKCHIP_VPU) += rockchip-vpu.o rockchip-vpu-y += \ rockchip_vpu_drv.o \ - rockchip_vpu_enc.o \ + rockchip_vpu_v4l2.o \ rk3288_vpu_hw.o \ rk3288_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw.o \
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +7 -7
@@ -140,7 +140,7 @@ static struct v4l2_m2m_ops vpu_m2m_ops = { };static int -enc_queue_init (void *priv,struct vb2_queue *src_vq,struct vb2_queue *dst_vq) +queue_init (void *priv,struct vb2_queue *src_vq,struct vb2_queue *dst_vq) {struct rockchip_vpu_ctx *ctx = priv;int ret;
@@ -148,7 +148,7 @@ enc_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) src_vq->type =V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ; src_vq->io_modes =VB2_MMAP |VB2_DMABUF ; src_vq->drv_priv = ctx; - src_vq->ops = &rockchip_vpu_enc_queue_ops; + src_vq->ops = &rockchip_vpu_queue_ops; src_vq->mem_ops = &vb2_dma_contig_memops;/*
@@ -179,7 +179,7 @@ enc_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) dst_vq->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; dst_vq->io_modes =VB2_MMAP |VB2_DMABUF ; dst_vq->drv_priv = ctx; - dst_vq->ops = &rockchip_vpu_enc_queue_ops; + dst_vq->ops = &rockchip_vpu_queue_ops; dst_vq->mem_ops = &vb2_vmalloc_memops; dst_vq->buf_struct_size =sizeof (struct v4l2_m2m_buffer ); dst_vq->timestamp_flags =V4L2_BUF_FLAG_TIMESTAMP_COPY ;
@@ -260,7 +260,7 @@ static int rockchip_vpu_open(struct file *filp) ctx->dev = vpu;if (func->id ==MEDIA_ENT_F_PROC_VIDEO_ENCODER ) ctx->fh.m2m_ctx =v4l2_m2m_ctx_init (vpu->m2m_dev, ctx, - &enc_queue_init); + queue_init);else ctx->fh.m2m_ctx =ERR_PTR (-ENODEV );if (IS_ERR (ctx->fh.m2m_ctx)) {
@@ -273,8 +273,8 @@ static int rockchip_vpu_open(struct file *filp) filp->private_data = &ctx->fh;v4l2_fh_add (&ctx->fh); -rockchip_vpu_enc_reset_dst_fmt (vpu, ctx); -rockchip_vpu_enc_reset_src_fmt (vpu, ctx); +rockchip_vpu_reset_dst_fmt (vpu, ctx); +rockchip_vpu_reset_src_fmt (vpu, ctx); ret =rockchip_vpu_ctrls_setup (vpu, ctx);if (ret) {
@@ -487,7 +487,7 @@ static int rockchip_vpu_add_enc_func(struct rockchip_vpu_dev *vpu) vfd->v4l2_dev = &vpu->v4l2_dev; vfd->vfl_dir =VFL_DIR_M2M ; vfd->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_M2M_MPLANE ; - vfd->ioctl_ops = &rockchip_vpu_enc_ioctl_ops; + vfd->ioctl_ops = &rockchip_vpu_ioctl_ops;snprintf (vfd->name,sizeof (vfd->name),"%s-enc" , match->compatible); vpu->encoder = func;
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c renamed from drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c +7 -7
@@ -262,8 +262,8 @@ vidioc_try_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)return 0 ; } -void rockchip_vpu_enc_reset_dst_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx) +void rockchip_vpu_reset_dst_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx) {struct v4l2_pix_format_mplane *fmt = &ctx->dst_fmt;
@@ -287,8 +287,8 @@ void rockchip_vpu_enc_reset_dst_fmt(struct rockchip_vpu_dev *vpu, fmt->width * fmt->height * ctx->vpu_dst_fmt->max_depth; } -void rockchip_vpu_enc_reset_src_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx) +void rockchip_vpu_reset_src_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx) {struct v4l2_pix_format_mplane *fmt = &ctx->src_fmt;unsigned int width, height;
@@ -389,11 +389,11 @@ vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f)* the raw format again after we return, so we don't need * anything smarter. */ -rockchip_vpu_enc_reset_src_fmt (vpu, ctx); +rockchip_vpu_reset_src_fmt (vpu, ctx);return 0 ; } -const struct v4l2_ioctl_ops rockchip_vpu_enc_ioctl_ops = { +const struct v4l2_ioctl_ops rockchip_vpu_ioctl_ops = { .vidioc_querycap = vidioc_querycap, .vidioc_enum_framesizes = vidioc_enum_framesizes,
@@ -577,7 +577,7 @@ static int rockchip_vpu_buf_out_validate(struct vb2_buffer *vb)return 0 ; } -const struct vb2_ops rockchip_vpu_enc_queue_ops = { +const struct vb2_ops rockchip_vpu_queue_ops = { .queue_setup = rockchip_vpu_queue_setup, .buf_prepare = rockchip_vpu_buf_prepare, .buf_queue = rockchip_vpu_buf_queue,
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.h +6 -6
@@ -18,12 +18,12 @@#include "rockchip_vpu.h" -extern const struct v4l2_ioctl_ops rockchip_vpu_enc_ioctl_ops; -extern const struct vb2_ops rockchip_vpu_enc_queue_ops; +extern const struct v4l2_ioctl_ops rockchip_vpu_ioctl_ops; +extern const struct vb2_ops rockchip_vpu_queue_ops; -void rockchip_vpu_enc_reset_src_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx); -void rockchip_vpu_enc_reset_dst_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_reset_src_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_reset_dst_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx);#endif /* ROCKCHIP_VPU_V4L2_H_ */
Signature · 1 line
2.20.1
PATCH v4 15/21 rockchip/vpu: Provide a helper to reset both src and dst formats
In reply to Boris BrezillonWhen initializing a context, the core wants to reset both src and dst formats. Right now the order doesn't matter, but if we want to have a valid default width/height on the non-coded/raw format side (src in case of encoders, dst in case of decoders), we need to reset those formats in the right order: first the coded-format side, then the other, such that width and height on the raw format side can be taken from the coded format.
Let's provide a helper that will reset both formats and make sure this is done in the right order.
---
Changes from v2:
* None
Changes from v2:
* New patch
--- .../staging/media/rockchip/vpu/rockchip_vpu_drv.c | 3 +-- .../staging/media/rockchip/vpu/rockchip_vpu_v4l2.c | 14 ++++++++++---- .../staging/media/rockchip/vpu/rockchip_vpu_v4l2.h | 5 +---- 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +1 -2
@@ -273,8 +273,7 @@ static int rockchip_vpu_open(struct file *filp) filp->private_data = &ctx->fh;v4l2_fh_add (&ctx->fh); -rockchip_vpu_reset_dst_fmt (vpu, ctx); -rockchip_vpu_reset_src_fmt (vpu, ctx); +rockchip_vpu_reset_fmts (ctx); ret =rockchip_vpu_ctrls_setup (vpu, ctx);if (ret) {
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c +10 -4
@@ -262,8 +262,8 @@ vidioc_try_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)return 0 ; } -void rockchip_vpu_reset_dst_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx) +static void rockchip_vpu_reset_dst_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx) {struct v4l2_pix_format_mplane *fmt = &ctx->dst_fmt;
@@ -287,8 +287,8 @@ void rockchip_vpu_reset_dst_fmt(struct rockchip_vpu_dev *vpu, fmt->width * fmt->height * ctx->vpu_dst_fmt->max_depth; } -void rockchip_vpu_reset_src_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx) +static void rockchip_vpu_reset_src_fmt (struct rockchip_vpu_dev *vpu, +struct rockchip_vpu_ctx *ctx) {struct v4l2_pix_format_mplane *fmt = &ctx->src_fmt;unsigned int width, height;
@@ -310,6 +310,12 @@ void rockchip_vpu_reset_src_fmt(struct rockchip_vpu_dev *vpu,v4l2_fill_pixfmt_mp (fmt, ctx->vpu_src_fmt->fourcc, width, height); } +void rockchip_vpu_reset_fmts (struct rockchip_vpu_ctx *ctx) +{ +rockchip_vpu_reset_dst_fmt (ctx->dev, ctx); +rockchip_vpu_reset_src_fmt (ctx->dev, ctx); +} +static int vidioc_s_fmt_out_mplane (struct file *file,void *priv,struct v4l2_format *f) {
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.h +1 -4
@@ -21,9 +21,6 @@extern const struct v4l2_ioctl_ops rockchip_vpu_ioctl_ops;extern const struct vb2_ops rockchip_vpu_queue_ops; -void rockchip_vpu_reset_src_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx); -void rockchip_vpu_reset_dst_fmt (struct rockchip_vpu_dev *vpu, -struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_reset_fmts (struct rockchip_vpu_ctx *ctx);#endif /* ROCKCHIP_VPU_V4L2_H_ */
Signature · 1 line
2.20.1
PATCH v4 16/21 rockchip/vpu: Prepare things to support decoders
In reply to Boris BrezillonThe code in rockchip_vpu_v4l2 was hardcoded for encoder support. Modify it more generic to support the decoder case so that we can re-use the same vb2/v4l2 ops for both devices.
---
Changes from v3:
* None
Changes from v2:
* New patch
--- .../staging/media/rockchip/vpu/rockchip_vpu.h | 6 + .../media/rockchip/vpu/rockchip_vpu_v4l2.c | 501 ++++++++++-------- 2 files changed, 290 insertions(+), 217 deletions(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +6 -0
@@ -262,4 +262,10 @@ static inline u32 vepu_read(struct rockchip_vpu_dev *vpu, u32 reg) return val; } +static inline bool +rockchip_vpu_is_encoder_ctx (const struct rockchip_vpu_ctx *ctx) +{ +return true; +} +#endif /* ROCKCHIP_VPU_H_ */
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c +284 -217
688 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 17/21 rockchip/vpu: Add decoder boilerplate
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
This commit adds the needed boilerplate code to support the VPU in decoding operation. Two v4l2 interfaces are exposed, one for encoding and one for decoding, but a single m2m device is shared by them, so jobs are properly serialized.
--
Changes from v3:
* Update things according to changes done in the patch introducing custom media controller support (Boris)
* Move the rk3399 vdpu irq definition in the commit introducing MPGEG2 support on rk3399
* Fix media controller deregistration code (Jonas)
Changes from v2:
* Use the common vb2/v4l2 implementation
* Use strscpy instead of strlcpy.
* Abstract vidioc v4l2 api implementations into generic code, creating helpers that can be used by the encoder and the decoder.
* Only prevent S_FMT on the coded format queue, if the peer queue has buffers allocated.
* Refactor the code, adding a buf_finish callback to rockchip_vpu_ctx. With this change, is_enc field is not needed.
* Separate OUTPUT and CAPTURE queue ops (vb2_ops), and create common helpers that can be used by both.
* Pass a no kernel mapping attribute on both ends of the decoder.
--- drivers/staging/media/rockchip/vpu/Kconfig | 1 + .../staging/media/rockchip/vpu/rockchip_vpu.h | 42 ++++- .../media/rockchip/vpu/rockchip_vpu_common.h | 46 +++++ .../media/rockchip/vpu/rockchip_vpu_drv.c | 172 ++++++++++++++---- .../media/rockchip/vpu/rockchip_vpu_v4l2.c | 9 +- 5 files changed, 232 insertions(+), 38 deletions(-) create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_common.h
drivers/staging/media/rockchip/vpu/Kconfig +1 -0
@@ -2,6 +2,7 @@ config VIDEO_ROCKCHIP_VPU tristate "Rockchip VPU driver" depends on ARCH_ROCKCHIP || COMPILE_TEST depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on MEDIA_CONTROLLER_REQUEST_API select VIDEOBUF2_DMA_CONTIG select VIDEOBUF2_VMALLOC select V4L2_MEM2MEM_DEV
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +39 -3
107 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rockchip_vpu_common.h new file +46 -0
46 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +139 -33
286 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c +7 -2
@@ -36,8 +36,13 @@ rockchip_vpu_get_formats(const struct rockchip_vpu_ctx *ctx, {const struct rockchip_vpu_fmt *formats; - formats = ctx->dev->variant->enc_fmts; - *num_fmts = ctx->dev->variant->num_enc_fmts; +if (rockchip_vpu_is_encoder_ctx (ctx)) { + formats = ctx->dev->variant->enc_fmts; + *num_fmts = ctx->dev->variant->num_enc_fmts; + }else { + formats = ctx->dev->variant->dec_fmts; + *num_fmts = ctx->dev->variant->num_dec_fmts; + }return formats; }
Signature · 1 line
2.20.1
PATCH v4 18/21 rockchip/vpu: Add support for non-standard controls
In reply to Boris BrezillonFrom: Ezequiel Garcia <ezequiel-ZGY8ohtN/[email protected]>
Rework the way controls are registered by the driver, so it can support non-standard controls, such as those used by stateless codecs.
--
Changes from v3:
* None
Changes from v2:
* Got rid of unused ctrls related fields.
* Removed unndeeded is_std internal field.
--- .../media/rockchip/vpu/rk3288_vpu_hw.c | 2 +- .../media/rockchip/vpu/rk3399_vpu_hw.c | 2 +- .../staging/media/rockchip/vpu/rockchip_vpu.h | 17 ++++++- .../media/rockchip/vpu/rockchip_vpu_drv.c | 51 +++++++++++++++---- 4 files changed, 59 insertions(+), 13 deletions(-)
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c +1 -1
@@ -112,7 +112,7 @@ const struct rockchip_vpu_variant rk3288_vpu_variant = { .enc_fmts = rk3288_vpu_enc_fmts, .num_enc_fmts = ARRAY_SIZE(rk3288_vpu_enc_fmts), .codec_ops = rk3288_vpu_codec_ops, - .codec = RK_VPU_CODEC_JPEG, + .codec = RK_VPU_JPEG_ENCODER, .vepu_irq = rk3288_vepu_irq, .init = rk3288_vpu_hw_init, .clk_names = {"aclk", "hclk"},
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw.c +1 -1
@@ -111,7 +111,7 @@ const struct rockchip_vpu_variant rk3399_vpu_variant = { .enc_offset = 0x0, .enc_fmts = rk3399_vpu_enc_fmts, .num_enc_fmts = ARRAY_SIZE(rk3399_vpu_enc_fmts), - .codec = RK_VPU_CODEC_JPEG, + .codec = RK_VPU_JPEG_ENCODER, .codec_ops = rk3399_vpu_codec_ops, .vepu_irq = rk3399_vepu_irq, .init = rk3399_vpu_hw_init,
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +16 -1
@@ -34,7 +34,10 @@struct rockchip_vpu_ctx ;struct rockchip_vpu_codec_ops ; -#define RK_VPU_CODEC_JPEG BIT(0) +#define RK_VPU_JPEG_ENCODER BIT(0) +#define RK_VPU_ENCODERS 0x0000ffff + +#define RK_VPU_DECODERS 0xffff0000/** * struct rockchip_vpu_variant - information about VPU hardware variant
@@ -79,6 +82,18 @@ enum rockchip_vpu_codec_mode { RK_VPU_MODE_JPEG_ENC, }; +/* +* struct rockchip_vpu_ctrl - helper type to declare supported controls +* @id: V4L2 control ID (V4L2_CID_xxx) +* @codec: codec id this control belong to (RK_VPU_JPEG_ENCODER, etc.) +* @cfg: control configuration +*/ +struct rockchip_vpu_ctrl { +unsigned int id; +unsigned int codec; +struct v4l2_ctrl_config cfg; +}; +/* * struct rockchip_vpu_func - rockchip VPU functionality *
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +41 -10
87 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 19/21 rockchip/vpu: Add infra to support MPEG-2 decoding
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
Only adds structs and helpers to allow supporting MPEG-2 decoding on rockchip SoCs. Support for RK3399 and RK3288 will be added in separate commits
--
Changes from v3:
* Coding style improvements (Jonas)
* Move RK3399 support in a separate commit
Changes from v2:
* Remove uneeded check from rockchip_vpu_get_ctrl.
* Use user negotiated resolution when programming the hardware.
--- drivers/staging/media/rockchip/vpu/Makefile | 3 +- .../staging/media/rockchip/vpu/rockchip_vpu.h | 9 +++ .../media/rockchip/vpu/rockchip_vpu_common.h | 3 + .../media/rockchip/vpu/rockchip_vpu_drv.c | 30 +++++++++ .../media/rockchip/vpu/rockchip_vpu_hw.h | 14 +++++ .../media/rockchip/vpu/rockchip_vpu_mpeg2.c | 61 +++++++++++++++++++ 6 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_mpeg2.c
drivers/staging/media/rockchip/vpu/Makefile +2 -1
@@ -7,4 +7,5 @@ rockchip-vpu-y += \ rk3288_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw.o \ rk3399_vpu_hw_jpeg_enc.o \ - rockchip_vpu_jpeg.o + rockchip_vpu_jpeg.o \ + rockchip_vpu_mpeg2.o
drivers/staging/media/rockchip/vpu/rockchip_vpu.h +9 -0
@@ -27,6 +27,10 @@#define ROCKCHIP_VPU_MAX_CLOCKS 4 +#define MPEG2_MB_DIM 16 +#define MPEG2_MB_WIDTH (w) DIV_ROUND_UP(w, MPEG2_MB_DIM) +#define MPEG2_MB_HEIGHT (h) DIV_ROUND_UP(h, MPEG2_MB_DIM) +#define JPEG_MB_DIM 16#define JPEG_MB_WIDTH (w) DIV_ROUND_UP(w, JPEG_MB_DIM)#define JPEG_MB_HEIGHT (h) DIV_ROUND_UP(h, JPEG_MB_DIM)
@@ -37,6 +41,7 @@ struct rockchip_vpu_codec_ops;#define RK_VPU_JPEG_ENCODER BIT(0)#define RK_VPU_ENCODERS 0x0000ffff +#define RK_VPU_MPEG2_DECODER BIT(16)#define RK_VPU_DECODERS 0xffff0000/**
@@ -76,10 +81,12 @@ struct rockchip_vpu_variant {* enum rockchip_vpu_codec_mode - codec operating mode. * @RK_VPU_MODE_NONE: No operating mode. Used for RAW video formats. * @RK_VPU_MODE_JPEG_ENC: JPEG encoder. +* @RK_VPU_MODE_MPEG2_DEC: MPEG-2 decoder. */ enum rockchip_vpu_codec_mode {RK_VPU_MODE_NONE =-1 ,RK_VPU_MODE_JPEG_ENC , +RK_VPU_MODE_MPEG2_DEC , };/*
@@ -190,6 +197,7 @@ struct rockchip_vpu_dev {* calling v4l2_m2m_job_finish. * @codec_ops: Set of operations related to codec mode. * @jpeg_enc: JPEG-encoding context. +* @mpeg2_dec: MPEG-2-decoding context. */ struct rockchip_vpu_ctx {struct rockchip_vpu_dev *dev;
@@ -215,6 +223,7 @@ struct rockchip_vpu_ctx {/* Specific for particular codec modes. */ union {struct rockchip_vpu_jpeg_enc_hw_ctx jpeg_enc; +struct rockchip_vpu_mpeg2_dec_hw_ctx mpeg2_dec; }; };
drivers/staging/media/rockchip/vpu/rockchip_vpu_common.h +3 -0
@@ -43,4 +43,7 @@ int rockchip_vpu_dst_buf_prepare(struct vb2_buffer *vb);int rockchip_vpu_start (struct vb2_queue *q,unsigned int count);void rockchip_vpu_stop (struct vb2_queue *q); +void *rockchip_vpu_get_ctrl (struct rockchip_vpu_ctx *ctx,u32 id); +dma_addr_t rockchip_vpu_get_ref (struct vb2_queue *q,u64 ts); +#endif /* ROCKCHIP_VPU_COMMON_H_ */
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +30 -0
@@ -35,6 +35,24 @@ module_param_named(debug, rockchip_vpu_debug, int, 0644);MODULE_PARM_DESC (debug,"Debug level - higher value produces more verbose messages" ); +void *rockchip_vpu_get_ctrl (struct rockchip_vpu_ctx *ctx,u32 id) +{ +struct v4l2_ctrl *ctrl; + + ctrl =v4l2_ctrl_find (&ctx->ctrl_handler, id); +return ctrl ? ctrl->p_cur.p :NULL ; +} + +dma_addr_t rockchip_vpu_get_ref (struct vb2_queue *q,u64 ts) +{ +int index; + + index =vb2_find_timestamp (q, ts,0 ); +if (index >=0 ) +return vb2_dma_contig_plane_dma_addr (q->bufs[index],0 ); +return 0 ; +} + static int rockchip_vpu_enc_buf_finish(struct rockchip_vpu_ctx *ctx, struct vb2_buffer *buf,
@@ -258,6 +276,18 @@ static struct rockchip_vpu_ctrl controls[] = { .step = 1, .def = 50, }, + }, { + .id = V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS, + .codec = RK_VPU_MPEG2_DECODER, + .cfg = { + .elem_size = sizeof(struct v4l2_ctrl_mpeg2_slice_params), + }, + }, { + .id = V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION, + .codec = RK_VPU_MPEG2_DECODER, + .cfg = { + .elem_size = sizeof(struct v4l2_ctrl_mpeg2_quantization), + }, }, };
drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h +14 -0
@@ -11,6 +11,7 @@#include <linux/interrupt.h> #include <linux/v4l2-controls.h> +#include <media/mpeg2-ctrls.h> #include <media/videobuf2-core.h> struct rockchip_vpu_dev ;
@@ -38,6 +39,14 @@ struct rockchip_vpu_jpeg_enc_hw_ctx {struct rockchip_vpu_aux_buf bounce_buffer; }; +/** +* struct rockchip_vpu_mpeg2_dec_hw_ctx +* @qtable: Quantization table +*/ +struct rockchip_vpu_mpeg2_dec_hw_ctx { +struct rockchip_vpu_aux_buf qtable; +}; +/** * struct rockchip_vpu_codec_ops - codec mode specific operations *
@@ -83,4 +92,9 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx);int rockchip_vpu_jpeg_enc_init (struct rockchip_vpu_ctx *ctx);void rockchip_vpu_jpeg_enc_exit (struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_mpeg2_dec_copy_qtable (u8 *qtable, +const struct v4l2_ctrl_mpeg2_quantization *ctrl); +int rockchip_vpu_mpeg2_dec_init (struct rockchip_vpu_ctx *ctx); +void rockchip_vpu_mpeg2_dec_exit (struct rockchip_vpu_ctx *ctx); +#endif /* ROCKCHIP_VPU_HW_H_ */
drivers/staging/media/rockchip/vpu/rockchip_vpu_mpeg2.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 20/21 rockchip/vpu: Add MPEG2 decoding support to RK3399
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
Add the necessary bits to support MPEG2 decoding on RK3399.
---
Changes from v3:
* New patch (was part of another patch before)
--- drivers/staging/media/rockchip/vpu/Makefile | 1 + .../media/rockchip/vpu/rk3399_vpu_hw.c | 59 +++- .../rockchip/vpu/rk3399_vpu_hw_mpeg2_dec.c | 268 ++++++++++++++++++ .../media/rockchip/vpu/rockchip_vpu_hw.h | 1 + 4 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_mpeg2_dec.c
drivers/staging/media/rockchip/vpu/Makefile +1 -0
@@ -7,5 +7,6 @@ rockchip-vpu-y += \ rk3288_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw.o \ rk3399_vpu_hw_jpeg_enc.o \ + rk3399_vpu_hw_mpeg2_dec.o \ rockchip_vpu_jpeg.o \ rockchip_vpu_mpeg2.o
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw.c +58 -1
91 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_mpeg2_dec.c new file +268 -0
268 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h +1 -0
@@ -92,6 +92,7 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx);int rockchip_vpu_jpeg_enc_init (struct rockchip_vpu_ctx *ctx);void rockchip_vpu_jpeg_enc_exit (struct rockchip_vpu_ctx *ctx); +void rk3399_vpu_mpeg2_dec_run (struct rockchip_vpu_ctx *ctx);void rockchip_vpu_mpeg2_dec_copy_qtable (u8 *qtable,const struct v4l2_ctrl_mpeg2_quantization *ctrl);int rockchip_vpu_mpeg2_dec_init (struct rockchip_vpu_ctx *ctx);
Signature · 1 line
2.20.1
PATCH v4 21/21 rockchip/vpu: Add support for MPEG-2 decoding on RK3288
In reply to Boris BrezillonFrom: Jonas Karlman <[email protected]>
Add necessary bits to support MPEG2 decoding on RK3288.
---
Changes from v3:
* Coding style improvements (Jonas)
* Use ALIGN() instead of div+shift (Jonas)
Changes from v2:
* New patch
--- drivers/staging/media/rockchip/vpu/Makefile | 1 + .../media/rockchip/vpu/rk3288_vpu_hw.c | 59 +++- .../rockchip/vpu/rk3288_vpu_hw_mpeg2_dec.c | 262 ++++++++++++++++++ .../media/rockchip/vpu/rk3288_vpu_regs.h | 1 + .../media/rockchip/vpu/rockchip_vpu_hw.h | 1 + 5 files changed, 323 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_mpeg2_dec.c
drivers/staging/media/rockchip/vpu/Makefile +1 -0
@@ -5,6 +5,7 @@ rockchip-vpu-y += \ rockchip_vpu_v4l2.o \ rk3288_vpu_hw.o \ rk3288_vpu_hw_jpeg_enc.o \ + rk3288_vpu_hw_mpeg2_dec.o \ rk3399_vpu_hw.o \ rk3399_vpu_hw_jpeg_enc.o \ rk3399_vpu_hw_mpeg2_dec.o \
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c +58 -1
91 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_mpeg2_dec.c new file +262 -0
262 lines not on this page · raw message
drivers/staging/media/rockchip/vpu/rk3288_vpu_regs.h +1 -0
@@ -438,5 +438,6 @@#define VDPU_REG_REF_BUF_CTRL2_REFBU2_THR (x) (((x) & 0xfff) << 19)#define VDPU_REG_REF_BUF_CTRL2_REFBU2_PICID (x) (((x) & 0x1f) << 14)#define VDPU_REG_REF_BUF_CTRL2_APF_THRESHOLD (x) (((x) & 0x3fff) << 0) +#define VDPU_REG_SOFT_RESET 0x194#endif /* RK3288_VPU_REGS_H_ */
drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h +1 -0
@@ -92,6 +92,7 @@ void rk3399_vpu_jpeg_enc_run(struct rockchip_vpu_ctx *ctx);int rockchip_vpu_jpeg_enc_init (struct rockchip_vpu_ctx *ctx);void rockchip_vpu_jpeg_enc_exit (struct rockchip_vpu_ctx *ctx); +void rk3288_vpu_mpeg2_dec_run (struct rockchip_vpu_ctx *ctx);void rk3399_vpu_mpeg2_dec_run (struct rockchip_vpu_ctx *ctx);void rockchip_vpu_mpeg2_dec_copy_qtable (u8 *qtable,const struct v4l2_ctrl_mpeg2_quantization *ctrl);
Signature · 1 line
2.20.1
Quoted 47 lines · On Thu, 25 Apr 2019 09:12:21 +0200 Boris Brezillon…
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on
/dev/video0, and the VPU decoder is exposed on/dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device/dev/media0.Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘
Quoted 3 lines
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Forgot to provide the v4l2-compliance results, so here it is:
"
v4l2-compliance SHA: 95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bits
Compliance test for rockchip-vpu device /dev/media0:
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0
Required ioctls:
test MEDIA_IOC_DEVICE_INFO: OK
Allow for multiple opens:
test second /dev/media0 open: OK
test MEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OK
Media Controller ioctls:
test MEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK
Total for rockchip-vpu device /dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device /dev/video0:
Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
fail: v4l2-test-buffers.cpp(709): q.create_bufs(node, 1, &fmt) != EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
test VIDIOC_EXPBUF: OK
testRequests:1760 ret 0
fail: v4l2-test-buffers.cpp(1820): !supports_requests test Requests: FAIL
Total for rockchip-vpu device /dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device /dev/video1:
Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673): try_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806): fmt_cap.g_colorspace() != col
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
fail: v4l2-test-buffers.cpp(709): q.create_bufs(node, 1, &fmt) != EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for rockchip-vpu device /dev/video1: 45, Succeeded: 42, Failed: 3, Warnings: 0
Grand Total for rockchip-vpu device /dev/media0: 97, Succeeded: 92, Failed: 5, Warnings: 0
"
2 of those failures are expected:
* "fail: v4l2-test-formats.cpp(806): fmt_cap.g_colorspace() != col": is caused by the reset done by the driver on the non-coded end when the coded end of the pipeline is modified (which follows the behavior described in stateless decoder spec)
* "fail: v4l2-test-controls.cpp(673): try_ext_ctrls returned an error (22)":
default values for mpeg2 ctrls are not suitable, so doing get_ext_ctrl()+try_ext_ctrl() does not work.
I'm looking into the other failures which were not present in v3 (yes, I know, shame on me for not running v4l2-compliance before sending the series :-)).
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 313 lines · On Thu, 25 Apr 2019 10:06:28 +0200 Boris Brezillon…
Quoted 47 lines · On Thu, 25 Apr 2019 09:12:21 +0200 Boris Brezillon…
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on
/dev/video0, and the VPU decoder is exposed on/dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device/dev/media0.Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘Quoted 3 lines
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Forgot to provide the v4l2-compliance results, so here it is:
"
v4l2-compliance SHA:95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bitsCompliance test for rockchip-vpu device
/dev/media0:Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for rockchip-vpu device
/dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video0:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
testRequests:1760 ret 0fail: v4l2-test-buffers.cpp(1820): !supports_requests test Requests: FAILTotal for rockchip-vpu device
/dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video1:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673):try_ext_ctrlsreturned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806):fmt_cap.g_colorspace()!= col
testVIDIOC_S_FMT: FAIL
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for rockchip-vpu device
/dev/video1: 45, Succeeded: 42, Failed: 3, Warnings: 0Grand Total for rockchip-vpu device
/dev/media0: 97, Succeeded: 92, Failed: 5, Warnings: 0"
2 of those failures are expected:
* "fail: v4l2-test-formats.cpp(806):
fmt_cap.g_colorspace()!= col": is caused by the reset done by the driver on the non-coded end when the coded end of the pipeline is modified (which follows the behavior described in stateless decoder spec)
Quoted 6 lines
* "fail: v4l2-test-controls.cpp(673):
try_ext_ctrlsreturned an error (22)":
default values for mpeg2 ctrls are not suitable, so doing get_ext_ctrl()+try_ext_ctrl() does not work.I'm looking into the other failures which were not present in v3 (yes, I know, shame on me for not running v4l2-compliance before sending the series :-)).
Rectification, after booting the right kernel those new errors are gone, sorry for the noise:
v4l2-compliance SHA: 95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bits
Compliance test for rockchip-vpu device /dev/media0:
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0
Required ioctls:
test MEDIA_IOC_DEVICE_INFO: OK
Allow for multiple opens:
test second /dev/media0 open: OK
test MEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OK
Media Controller ioctls:
test MEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK
Total for rockchip-vpu device /dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device /dev/video0:
Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
testRequests:1760 ret 0
test Requests: OK
Total for rockchip-vpu device /dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device /dev/video1:
Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673): try_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806): fmt_cap.g_colorspace() != col
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
test Requests: OK
Total for rockchip-vpu device /dev/video1: 45, Succeeded: 43, Failed: 2, Warnings: 0
Grand Total for rockchip-vpu device /dev/media0: 97, Succeeded: 95, Failed: 2, Warnings: 0
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 304 lines · Boris Brezillon
Quoted 47 lines · On Thu, 25 Apr 2019 09:12:21 +0200 Boris Brezillon…
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on
/dev/video0, and the VPU decoder is exposed on/dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device/dev/media0.Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘Quoted 3 lines
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Forgot to provide the v4l2-compliance results, so here it is:
"
v4l2-compliance SHA:95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bitsCompliance test for rockchip-vpu device
/dev/media0:Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for rockchip-vpu device
/dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video0:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
testRequests:1760 ret 0fail: v4l2-test-buffers.cpp(1820): !supports_requests test Requests: FAILTotal for rockchip-vpu device
/dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video1:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673):try_ext_ctrlsreturned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806):fmt_cap.g_colorspace()!= col
testVIDIOC_S_FMT: FAIL
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for rockchip-vpu device
/dev/video1: 45, Succeeded: 42, Failed: 3, Warnings: 0Grand Total for rockchip-vpu device
/dev/media0: 97, Succeeded: 92, Failed: 5, Warnings: 0
Quoted 8 lines
"
2 of those failures are expected:
* "fail: v4l2-test-formats.cpp(806):
fmt_cap.g_colorspace()!= col": is caused by the reset done by the driver on the non-coded end when the coded end of the pipeline is modified (which follows the behavior described in stateless decoder spec)
So is this a driver FIXME, or an issue in the compliance test itself?
Quoted 4 lines
* "fail: v4l2-test-controls.cpp(673):
try_ext_ctrlsreturned an error (22)":
default values for mpeg2 ctrls are not suitable, so doing get_ext_ctrl()+try_ext_ctrl() does not work.
Hmm, this might require some changes to this test. Where does it fail in the driver? Is that the std_validate() check in v4l2-ctrls.c?
If so, then I think it would be wise to add an initializer for V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS to std_init() so that it creates a proper default.
I also noticed that support for these new compound types is missing in the std_log() function in v4l2-ctrls.c. It should probably log the type. Check with v4l2-ctl --log-status to see how it looks in the kernel log. Obviously, this can be done in a separate patch since it's independent of the rockchip driver.
Regards,
Hans
Quoted 4 lines
I'm looking into the other failures which were not present in v3 (yes, I know, shame on me for not running v4l2-compliance before sending the series :-)).
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 307 lines · On Thu, 25 Apr 2019 10:21:16 +0200 Hans Verkuil <[email protected]> wrote:
Quoted 306 lines · Boris Brezillon
Quoted 47 lines · On Thu, 25 Apr 2019 09:12:21 +0200 Boris Brezillon…
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on
/dev/video0, and the VPU decoder is exposed on/dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device/dev/media0.Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘Quoted 3 lines
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Forgot to provide the v4l2-compliance results, so here it is:
"
v4l2-compliance SHA:95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bitsCompliance test for rockchip-vpu device
/dev/media0:Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for rockchip-vpu device
/dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video0:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
testRequests:1760 ret 0fail: v4l2-test-buffers.cpp(1820): !supports_requests test Requests: FAILTotal for rockchip-vpu device
/dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video1:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673):try_ext_ctrlsreturned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806):fmt_cap.g_colorspace()!= col
testVIDIOC_S_FMT: FAIL
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for rockchip-vpu device
/dev/video1: 45, Succeeded: 42, Failed: 3, Warnings: 0Grand Total for rockchip-vpu device
/dev/media0: 97, Succeeded: 92, Failed: 5, Warnings: 0"
Quoted 8 lines
Quoted 6 lines
2 of those failures are expected:
* "fail: v4l2-test-formats.cpp(806):
fmt_cap.g_colorspace()!= col": is caused by the reset done by the driver on the non-coded end when the coded end of the pipeline is modified (which follows the behavior described in stateless decoder spec)So is this a driver FIXME, or an issue in the compliance test itself?
Looks like the spec mandates the opposite, so it's a driver bug. I'll fix that. The main issue I see is that the RK encoder code has this comment:
/*
* Current raw format might have become invalid with newly
* selected codec, so reset it to default just to be safe and
* keep internal driver state sane. User is mandated to set
* the raw format again after we return, so we don't need
* anything smarter.
*/
Does that mean we have a different behavior between encoders and decoders?
Quoted 8 lines
Quoted 5 lines
* "fail: v4l2-test-controls.cpp(673):
try_ext_ctrlsreturned an error (22)":
default values for mpeg2 ctrls are not suitable, so doing get_ext_ctrl()+try_ext_ctrl() does not work.Hmm, this might require some changes to this test. Where does it fail in the driver? Is that the
std_validate()check inv4l2-ctrls.c?
Don't remember where it complained exactly, but it was in some generic function, yes.
Quoted 3 lines
If so, then I think it would be wise to add an initializer for
V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMStostd_init()so that it creates a proper default.
Okay.
Quoted 5 lines
I also noticed that support for these new compound types is missing in the
std_log()function inv4l2-ctrls.c. It should probably log the type. Check with v4l2-ctl --log-status to see how it looks in the kernel log.
Will look at it too.
Quoted 2 lines
Obviously, this can be done in a separate patch since it's independent of the rockchip driver.
Sure.
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 331 lines · Boris Brezillon
Quoted 307 lines · On Thu, 25 Apr 2019 10:21:16 +0200 Hans Verkuil <[email protected]> wrote:
Quoted 306 lines · Boris Brezillon
Quoted 47 lines · On Thu, 25 Apr 2019 09:12:21 +0200 Boris Brezillon…
This series introduces the decoding infrastructure that will be used to add support for other codecs such as VP8, VP9 and H.264.
As explained in the cover letter for the v1 patchset, the driver is now exposing two video device nodes. The VPU encoder is exposed on
/dev/video0, and the VPU decoder is exposed on/dev/video1. Both devices are tied to the same memory-to-memory queue, and same media device/dev/media0.Therefore there are two media graphs:
┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-source │ │ /dev/video0 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-enc-sink │ │ /dev/video0 │ └────────────────────────────────┘┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-source │ │ /dev/video1 │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-proc │ └────────────────────────────────┘ ┃ ┃ ▼ ┌────────────────────────────────┐ │ rockchip,rk3399-vpu-dec-sink │ │ /dev/video1 │ └────────────────────────────────┘Quoted 3 lines
Of course, this work has been possible thanks to Jonas Karlman, who did the initial MPEG-2 decoding work and also got mpv+ffmpeg working using the Request API.
Forgot to provide the v4l2-compliance results, so here it is:
"
v4l2-compliance SHA:95f39aae48c6e8e5cc81e6ae6293d999f70a909b, 64 bitsCompliance test for rockchip-vpu device
/dev/media0:Media Driver Info:
Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 6 Interfaces: 2 Pads: 8 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for rockchip-vpu device
/dev/media0: 7, Succeeded: 7, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video0:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected JPEG Encoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300000c Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x01000002 : 0: Source Link 0x02000008: to remote pad 0x1000005 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
testRequests:1760 ret 0fail: v4l2-test-buffers.cpp(1820): !supports_requests test Requests: FAILTotal for rockchip-vpu device
/dev/video0: 45, Succeeded: 43, Failed: 2, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for rockchip-vpu device/dev/video1:Driver Info:
Driver name : rockchip-vpu Card type : rockchip,rk3399-vpu-dec Bus info : platform: rockchip-vpu Driver version : 5.1.0 Capabilities : 0x84204000Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateless Decoder
Media Driver Info:Driver name : rockchip-vpu Model : rockchip-vpu Serial : Bus info : platform: rockchip-vpu Media version : 5.1.0 Hardware revision: 0x00000000 (0) Driver version : 5.1.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x0000000f (15) Name : rockchip,rk3399-vpu-dec-source Function : V4L2 I/O Pad 0x01000010 : 0: Source Link 0x02000016: to remote pad 0x1000013 of entity 'rockchip,rk3399-vpu-dec-proc': Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(673):try_ext_ctrlsreturned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
fail: v4l2-test-formats.cpp(806):fmt_cap.g_colorspace()!= col
testVIDIOC_S_FMT: FAIL
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
fail: v4l2-test-buffers.cpp(709):q.create_bufs(node, 1, &fmt)!= EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for rockchip-vpu device
/dev/video1: 45, Succeeded: 42, Failed: 3, Warnings: 0Grand Total for rockchip-vpu device
/dev/media0: 97, Succeeded: 92, Failed: 5, Warnings: 0"
Quoted 8 lines
Quoted 6 lines
2 of those failures are expected:
* "fail: v4l2-test-formats.cpp(806):
fmt_cap.g_colorspace()!= col": is caused by the reset done by the driver on the non-coded end when the coded end of the pipeline is modified (which follows the behavior described in stateless decoder spec)So is this a driver FIXME, or an issue in the compliance test itself?
Looks like the spec mandates the opposite, so it's a driver bug. I'll fix that. The main issue I see is that the RK encoder code has this comment:
/*
* Current raw format might have become invalid with newly
* selected codec, so reset it to default just to be safe and
* keep internal driver state sane. User is mandated to set
* the raw format again after we return, so we don't need
* anything smarter.
*/
Quoted 2 lines
Does that mean we have a different behavior between encoders and decoders?
Yes. This is true for the stateful encoder as well: setting the capture format can change the output format.
For a decoder it is the other way around: setting the output format can change the capture format.
Note that we don't have a stateless encoder spec yet, but it makes sense that it behaves in the same way in this respect as the stateful encoder.
Quoted 25 lines
Quoted 9 lines
Quoted 6 lines
* "fail: v4l2-test-controls.cpp(673):
try_ext_ctrlsreturned an error (22)":
default values for mpeg2 ctrls are not suitable, so doing get_ext_ctrl()+try_ext_ctrl() does not work.Hmm, this might require some changes to this test. Where does it fail in the driver? Is that the
std_validate()check inv4l2-ctrls.c?Don't remember where it complained exactly, but it was in some generic function, yes.
Quoted 3 lines
If so, then I think it would be wise to add an initializer for
V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMStostd_init()so that it creates a proper default.Okay.
Quoted 5 lines
I also noticed that support for these new compound types is missing in the
std_log()function inv4l2-ctrls.c. It should probably log the type. Check with v4l2-ctl --log-status to see how it looks in the kernel log.
Quoted 7 lines
Will look at it too.
Quoted 2 lines
Obviously, this can be done in a separate patch since it's independent of the rockchip driver.
Sure.
Regards,
Hans
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Compile tested this series and I get the following sparse/smatch wanings:
sparse: WARNINGS
SPARSE:/home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:38:6: warning: symbol 'rockchip_vpu_get_ctrl' was not declared. Should it be static? SPARSE:/home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:46:12: warning: symbol 'rockchip_vpu_get_ref' was not declared. Should it be static? /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:38:7: warning: no previous prototype for 'rockchip_vpu_get_ctrl' [-Wmissing-prototypes] /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:46:12: warning: no previous prototype for 'rockchip_vpu_get_ref' [-Wmissing-prototypes] /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:298:6: warning: variable 'j' set but not used [-Wunused-but-set-variable]
smatch: WARNINGS/home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:38:7: warning: no previous prototype for 'rockchip_vpu_get_ctrl' [-Wmissing-prototypes] /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:46:12: warning: no previous prototype for 'rockchip_vpu_get_ref' [-Wmissing-prototypes] /home/hans/work/build/media-git/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c:298:6: warning: variable 'j' set but not used [-Wunused-but-set-variable]
Looks trivial to fix.
Regards,
Hans