From fb12c96def94bea2b7c48935918d7e44fa79b0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:26:54 +0100 Subject: [PATCH 01/14] media: s5p-mfc: default the HEVC encoder maximum QP to 51 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP defaults to 0, and s5p_mfc_set_enc_params_hevc() writes the minimum and maximum QP as the QP bound. With the defaults every HEVC frame is coded at QP 0, whatever bitrate the client asks for, and the frame QP controls are clamped to [0, 0] until the client raises the maximum. Default it to 51, the top of the range, as the H.264 maximum QP. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 3f8701e561..a82d229541 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -747,7 +747,7 @@ static struct mfc_control controls[] = { .minimum = 0, .maximum = 51, .step = 1, - .default_value = 0, + .default_value = 51, }, { .id = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE, From 843618d5dca1b18b9dbc56b2b310da4118ec89fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:26:55 +0100 Subject: [PATCH 02/14] media: s5p-mfc: use the S_PARM frame rate for HEVC rate control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The other encoders program E_RC_FRAME_RATE from the frame rate set with VIDIOC_S_PARM. HEVC only uses the control V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION, which defaults to 1. So with frame rate control on, the firmware spreads the bitrate over one frame per second: on the Pixel 7 (MFC v15), 4 Mbit/s asked at 30 fps gave about 18 Mbit/s. Use the S_PARM frame rate when it is set, and the HEVC control otherwise. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 3f1e6e694f..97fba11aca 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -1755,13 +1755,19 @@ static int s5p_mfc_set_enc_params_hevc(struct s5p_mfc_ctx *ctx) reg |= p_hevc->rc_frame_qp; writel(reg, mfc_regs->e_rc_config); - /* frame rate */ + /* + * frame rate: the one set with S_PARM, as for the other codecs, or + * else the HEVC frame rate control (1 fps by default) + */ if (p->rc_frame) { reg = 0; - reg &= ~(0xFFFF << 16); - reg |= ((p_hevc->rc_framerate) << 16); - reg &= ~(0xFFFF); - reg |= FRAME_DELTA_DEFAULT; + if (p->rc_framerate_num && p->rc_framerate_denom) { + reg |= ((p->rc_framerate_num & 0xFFFF) << 16); + reg |= p->rc_framerate_denom & 0xFFFF; + } else { + reg |= ((p_hevc->rc_framerate) << 16); + reg |= FRAME_DELTA_DEFAULT; + } writel(reg, mfc_regs->e_rc_frame_rate); } From eefc1cbee1d73ba6c96f4673a62f9de63ba570d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:26:55 +0100 Subject: [PATCH 03/14] media: s5p-mfc: keep VP8 rate control when a frame rate is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit s5p_mfc_set_enc_params_vp8() writes the frame rate from reg and then uses reg again to set the frame QP in E_RC_CONFIG. When the client has set a frame rate, E_RC_CONFIG gets the frame rate value with the QP bits replaced, which clears the frame rate control enable bit: on the Pixel 7 (MFC v15) the asked bitrate was ignored. Read E_RC_CONFIG again before setting the frame QP. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 97fba11aca..6d764254b8 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -1580,7 +1580,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx) writel(reg, mfc_regs->e_rc_frame_rate); } - /* frame QP */ + /* frame QP: reg may hold the frame rate now */ + reg = readl(mfc_regs->e_rc_config); reg &= ~(0x7F); reg |= p_vp8->rc_frame_qp & 0x7F; writel(reg, mfc_regs->e_rc_config); From 0a0daa1632a5b237e0cb17ca27d9dc21e1964d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:26:55 +0100 Subject: [PATCH 04/14] media: s5p-mfc: accept the multiplanar type in the encoder G_PARM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encoder's VIDIOC_S_PARM takes V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE but its VIDIOC_G_PARM only takes V4L2_BUF_TYPE_VIDEO_OUTPUT, and neither reports V4L2_CAP_TIMEPERFRAME. GStreamer reads the parameters first and does not set the frame rate when that fails, so the encoder never gets it. Accept both types in G_PARM and report V4L2_CAP_TIMEPERFRAME. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index a82d229541..8e1aed6f70 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -2287,6 +2287,7 @@ static int vidioc_s_parm(struct file *file, void *priv, struct s5p_mfc_ctx *ctx = file_to_ctx(file); if (a->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + a->parm.output.capability = V4L2_CAP_TIMEPERFRAME; ctx->enc_params.rc_framerate_num = a->parm.output.timeperframe.denominator; ctx->enc_params.rc_framerate_denom = @@ -2303,7 +2304,9 @@ static int vidioc_g_parm(struct file *file, void *priv, { struct s5p_mfc_ctx *ctx = file_to_ctx(file); - if (a->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { + if (a->type == V4L2_BUF_TYPE_VIDEO_OUTPUT || + a->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + a->parm.output.capability = V4L2_CAP_TIMEPERFRAME; a->parm.output.timeperframe.denominator = ctx->enc_params.rc_framerate_num; a->parm.output.timeperframe.numerator = From 21334a1459f2759260c7e16f562648bd8b7b1497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:01 +0100 Subject: [PATCH 05/14] media: s5p-mfc: copy the source timestamp to encoded buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encoder never sets the timestamp of a CAPTURE buffer, so every encoded frame comes out with timestamp 0. GStreamer's V4L2 encoders match encoded frames to their input by timestamp and attach all of them to frame 0. Give the encoded buffer the timestamp of the source buffer the firmware reports as done with it. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 8e1aed6f70..8acde744f5 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1236,6 +1236,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) int slice_type; unsigned int strm_size; bool src_ready; + u64 timestamp = 0; slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); @@ -1263,6 +1264,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) == mb_c_1_addr) { list_del(&mb_entry->list); ctx->src_queue_cnt--; + timestamp = mb_entry->b->vb2_buf.timestamp; vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); break; @@ -1284,6 +1286,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) == mb_c_1_addr) { list_del(&mb_entry->list); ctx->ref_queue_cnt--; + timestamp = mb_entry->b->vb2_buf.timestamp; vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); break; @@ -1319,6 +1322,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) mb_entry->b->flags |= V4L2_BUF_FLAG_BFRAME; break; } + /* The frame just encoded is the source buffer found above */ + mb_entry->b->vb2_buf.timestamp = timestamp; vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, strm_size); vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); } From e39b05f50a5afb73a63477db01010ce3e860fb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:02 +0100 Subject: [PATCH 06/14] media: s5p-mfc: flag the last buffer of an encoder drain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After V4L2_ENC_CMD_STOP the encoder returns an empty CAPTURE buffer without V4L2_BUF_FLAG_LAST, so clients that wait for that flag (as the stateful encoder interface asks) never see the end of the drain. And when no CAPTURE buffer is queued at that moment, nothing is returned at all. Set V4L2_BUF_FLAG_LAST on that buffer and, when none is queued, return the next queued one empty with the flag. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 5 +++++ .../media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 3 +++ drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index d3ac63b53b..30a8c24507 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -653,13 +653,18 @@ static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx) ctx->state = MFCINST_FINISHED; + /* Called from the interrupt handler, under dev->irqlock */ if (!list_empty(&ctx->dst_queue)) { mb_entry = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); list_del(&mb_entry->list); ctx->dst_queue_cnt--; vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, 0); + /* Tell the client that the drain is done */ + mb_entry->b->flags |= V4L2_BUF_FLAG_LAST; vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); + } else { + ctx->last_pending = true; } clear_work_bit(ctx); diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h index 8abf5104e0..551a47100a 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h @@ -573,6 +573,8 @@ struct s5p_mfc_codec_ops { * @dst_queue_cnt: number of buffers queued on the dest internal queue * @type: type of the instance - decoder or encoder * @state: state of the context + * @last_pending: the encoder drained with no capture buffer queued: the + * next one is returned empty with V4L2_BUF_FLAG_LAST * @inst_no: number of hw instance associated with the context * @img_width: width of the image that is decoded or encoded * @img_height: height of the image that is decoded or encoded @@ -662,6 +664,7 @@ struct s5p_mfc_ctx { enum s5p_mfc_inst_type type; enum s5p_mfc_inst_state state; + bool last_pending; int inst_no; /* Image parameters */ diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 8acde744f5..2c605f8dd9 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -2608,6 +2608,7 @@ static void s5p_mfc_stop_streaming(struct vb2_queue *q) } ctx->state = MFCINST_FINISHED; spin_lock_irqsave(&dev->irqlock, flags); + ctx->last_pending = false; if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { s5p_mfc_cleanup_queue(&ctx->dst_queue, &ctx->vq_dst); INIT_LIST_HEAD(&ctx->dst_queue); @@ -2640,6 +2641,15 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb) mfc_buf->flags &= ~MFC_BUF_FLAG_USED; /* Mark destination as available for use by MFC */ spin_lock_irqsave(&dev->irqlock, flags); + if (ctx->last_pending) { + /* The drain ended while no buffer was queued */ + ctx->last_pending = false; + spin_unlock_irqrestore(&dev->irqlock, flags); + vb2_set_plane_payload(vb, 0, 0); + to_vb2_v4l2_buffer(vb)->flags |= V4L2_BUF_FLAG_LAST; + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); + return; + } list_add_tail(&mfc_buf->list, &ctx->dst_queue); ctx->dst_queue_cnt++; spin_unlock_irqrestore(&dev->irqlock, flags); From 21551b0c45bfbe929dd119715c6f1b772e74008c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:02 +0100 Subject: [PATCH 07/14] media: s5p-mfc: check only the queue being set in the encoder S_FMT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encoder's VIDIOC_S_FMT returns -EBUSY when either queue streams. That forbids setting the OUTPUT format while CAPTURE streams, which the stateful encoder interface allows. The decoder got the same fix earlier in this series. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 2c605f8dd9..c71536a7d4 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1485,7 +1485,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ret = vidioc_try_fmt(file, priv, f); if (ret) return ret; - if (ctx->vq_src.streaming || ctx->vq_dst.streaming) { + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ? + ctx->vq_dst.streaming : ctx->vq_src.streaming) { v4l2_err(&dev->v4l2_dev, "%s queue busy\n", __func__); ret = -EBUSY; goto out; From b95a8550c55a12d36c59b1948266053096eadef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:02 +0100 Subject: [PATCH 08/14] media: s5p-mfc: size the encoder bitstream buffer when the client does not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A client may leave the CAPTURE sizeimage to the driver (v4l2-ctl does). The encoder then keeps 0 and fails later when it allocates the buffers. Use the variant's CPB size. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index c71536a7d4..df95667791 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1496,6 +1496,10 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ctx->dst_fmt = find_format(f, MFC_FMT_ENC); ctx->state = MFCINST_INIT; ctx->codec_mode = ctx->dst_fmt->codec_mode; + /* A client may leave the bitstream buffer's size to us */ + if (!pix_fmt_mp->plane_fmt[0].sizeimage) + pix_fmt_mp->plane_fmt[0].sizeimage = + dev->variant->buf_size->cpb; ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; pix_fmt_mp->plane_fmt[0].bytesperline = 0; ctx->dst_bufs_cnt = 0; From 1efef2df0cc24737827fa7417f6eb07b55421b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:08 +0100 Subject: [PATCH 09/14] media: s5p-mfc: fill field and num_planes in the encoder TRY_FMT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encoder's VIDIOC_TRY_FMT for the OUTPUT queue leaves field and num_planes as the client passed them. GStreamer reports a driver bug for V4L2_FIELD_ANY, and a client cannot learn the plane count of a format before setting it. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index df95667791..57e846bd77 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1468,6 +1468,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) else v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1, &pix_fmt_mp ->height, 4, 1080, 1, 0); + pix_fmt_mp->field = V4L2_FIELD_NONE; + pix_fmt_mp->num_planes = fmt->num_planes; } else { mfc_err("invalid buf type\n"); return -EINVAL; From 8181194b7386170c85834a394077e3ae3854724b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:08 +0100 Subject: [PATCH 10/14] media: s5p-mfc: do not write the encoder frame size on MFC v15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MFC v15 has no E_FRAME_WIDTH and E_FRAME_HEIGHT: 0xF770 and 0xF774 are the decoder's payload registers there. The encoder takes the cropped size only, as in Google's exynos-mfc driver (kernel/google-modules/soc/gs, drivers/media/platform/exynos/mfc/, branch android-gs-pantah-6.1-android16). The other encoder registers that s5p-mfc writes match that driver's mfc_regs.h by address, 76 of 76. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 6d764254b8..683027feac 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -913,10 +913,17 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx) mfc_debug_enter(); - /* width */ - writel(ctx->img_width, mfc_regs->e_frame_width); /* 16 align */ - /* height */ - writel(ctx->img_height, mfc_regs->e_frame_height); /* 16 align */ + /* + * MFC v15 has no frame width and height registers: the encoder + * takes the cropped size, and 0xF770/0xF774 are the decoder's + * payload registers there (as in Google's exynos-mfc driver). + */ + if (!IS_MFCV15(dev)) { + /* width */ + writel(ctx->img_width, mfc_regs->e_frame_width); /* 16 align */ + /* height */ + writel(ctx->img_height, mfc_regs->e_frame_height); /* 16 align */ + } /* cropped width */ writel(ctx->img_width, mfc_regs->e_cropped_frame_width); @@ -1191,8 +1198,9 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) /* height */ if (p_h264->interlace) { - writel(ctx->img_height >> 1, - mfc_regs->e_frame_height); /* 32 align */ + if (!IS_MFCV15(dev)) + writel(ctx->img_height >> 1, + mfc_regs->e_frame_height); /* 32 align */ /* cropped height */ writel(ctx->img_height >> 1, mfc_regs->e_cropped_frame_height); From 76385dc80eb36ccce6c808667920771bc12c96e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:21 +0100 Subject: [PATCH 11/14] media: s5p-mfc: single-buffer NV12 encoder input on MFC v15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Offer V4L2_PIX_FMT_NV12 in one buffer as the encoder input on MFC v15, laid out as the decoder's NV12 output: 64 byte aligned stride, chroma right after bytesperline * height, and room after it for the rows the MFC reads past the chroma and its 256 byte padding. NV12M and NV21M are not offered on v15. GStreamer always prefers the non-contiguous variant and then places the chroma at stride * height, ignoring the padded luma sizeimage, so it writes past the luma buffer. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 81 ++++++++++++++----- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 21 ++++- 2 files changed, 82 insertions(+), 20 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 57e846bd77..9b5d8449a2 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -50,14 +50,14 @@ static const struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_MFC_CODEC_NONE, .type = MFC_FMT_RAW, .num_planes = 2, - .versions = MFC_V5PLUS_BITS, + .versions = MFC_V5PLUS_BITS & ~MFC_V15_BIT, }, { .fourcc = V4L2_PIX_FMT_NV21M, .codec_mode = S5P_MFC_CODEC_NONE, .type = MFC_FMT_RAW, .num_planes = 2, - .versions = MFC_V6PLUS_BITS, + .versions = MFC_V6PLUS_BITS & ~MFC_V15_BIT, }, { .fourcc = V4L2_PIX_FMT_YUV420M, @@ -73,6 +73,13 @@ static const struct s5p_mfc_fmt formats[] = { .num_planes = 3, .versions = MFC_V12_BIT, }, + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = S5P_MFC_CODEC_NONE, + .type = MFC_FMT_RAW, + .num_planes = 1, + .versions = MFC_V15_BIT, + }, { .fourcc = V4L2_PIX_FMT_H264, .codec_mode = S5P_MFC_CODEC_H264_ENC, @@ -1198,6 +1205,30 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) return 0; } +/* + * Bytes of a one-buffer NV12 source: both planes, then room for the rows + * the MFC reads past the chroma (its height rounded up to 16) and the + * 256 bytes it wants after a plane. + */ +static unsigned int enc_nv12_size(struct s5p_mfc_ctx *ctx) +{ + return ctx->luma_size + ctx->chroma_size + 8 * ctx->stride[1] + + MFC_CHROMA_PAD_BYTES_V12; +} + +/* + * Source plane addresses. NV12 in one buffer has its chroma right after + * the luma's bytesperline * height. + */ +static unsigned long enc_src_addr(struct s5p_mfc_ctx *ctx, + struct vb2_buffer *vb, unsigned int plane) +{ + if (ctx->src_fmt->num_planes == 1) + return vb2_dma_contig_plane_dma_addr(vb, 0) + + (plane ? ctx->luma_size : 0); + return vb2_dma_contig_plane_dma_addr(vb, plane); +} + static int enc_pre_frame_start(struct s5p_mfc_ctx *ctx) { struct s5p_mfc_dev *dev = ctx->dev; @@ -1207,8 +1238,8 @@ static int enc_pre_frame_start(struct s5p_mfc_ctx *ctx) unsigned int dst_size; src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); - src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0); - src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 1); + src_y_addr = enc_src_addr(ctx, &src_mb->b->vb2_buf, 0); + src_c_addr = enc_src_addr(ctx, &src_mb->b->vb2_buf, 1); if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) src_c_1_addr = @@ -1248,10 +1279,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) s5p_mfc_hw_call(dev->mfc_ops, get_enc_frame_buffer, ctx, &enc_y_addr, &enc_c_addr, &enc_c_1_addr); list_for_each_entry(mb_entry, &ctx->src_queue, list) { - mb_y_addr = vb2_dma_contig_plane_dma_addr( - &mb_entry->b->vb2_buf, 0); - mb_c_addr = vb2_dma_contig_plane_dma_addr( - &mb_entry->b->vb2_buf, 1); + mb_y_addr = enc_src_addr(ctx, &mb_entry->b->vb2_buf, 0); + mb_c_addr = enc_src_addr(ctx, &mb_entry->b->vb2_buf, 1); if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == @@ -1271,10 +1300,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) } } list_for_each_entry(mb_entry, &ctx->ref_queue, list) { - mb_y_addr = vb2_dma_contig_plane_dma_addr( - &mb_entry->b->vb2_buf, 0); - mb_c_addr = vb2_dma_contig_plane_dma_addr( - &mb_entry->b->vb2_buf, 1); + mb_y_addr = enc_src_addr(ctx, &mb_entry->b->vb2_buf, 0); + mb_c_addr = enc_src_addr(ctx, &mb_entry->b->vb2_buf, 1); if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) @@ -1426,6 +1453,8 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) pix_fmt_mp->plane_fmt[2].bytesperline = ctx->stride[2]; pix_fmt_mp->plane_fmt[2].sizeimage = ctx->chroma_size_1; } + if (ctx->src_fmt->num_planes == 1) + pix_fmt_mp->plane_fmt[0].sizeimage = enc_nv12_size(ctx); } else { mfc_err("invalid buf type\n"); return -EINVAL; @@ -1470,6 +1499,15 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) ->height, 4, 1080, 1, 0); pix_fmt_mp->field = V4L2_FIELD_NONE; pix_fmt_mp->num_planes = fmt->num_planes; + /* Same layout as enc_calc_src_size() and enc_nv12_size() */ + if (fmt->num_planes == 1) { + unsigned int stride = ALIGN(pix_fmt_mp->width, 64); + + pix_fmt_mp->plane_fmt[0].bytesperline = stride; + pix_fmt_mp->plane_fmt[0].sizeimage = + stride * pix_fmt_mp->height * 3 / 2 + + 8 * stride + MFC_CHROMA_PAD_BYTES_V12; + } } else { mfc_err("invalid buf type\n"); return -EINVAL; @@ -1527,6 +1565,10 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) pix_fmt_mp->plane_fmt[2].bytesperline = ctx->stride[2]; pix_fmt_mp->plane_fmt[2].sizeimage = ctx->chroma_size_1; } + if (ctx->src_fmt->num_planes == 1) { + pix_fmt_mp->num_planes = 1; + pix_fmt_mp->plane_fmt[0].sizeimage = enc_nv12_size(ctx); + } ctx->src_bufs_cnt = 0; ctx->output_state = QUEUE_FREE; @@ -2465,6 +2507,8 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[0] = ctx->luma_size; psize[1] = ctx->chroma_size; + if (ctx->src_fmt && ctx->src_fmt->num_planes == 1) + psize[0] = enc_nv12_size(ctx); if (ctx->src_fmt && (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)) @@ -2511,10 +2555,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb) return ret; i = vb->index; ctx->src_bufs[i].b = vbuf; - ctx->src_bufs[i].cookie.raw.luma = - vb2_dma_contig_plane_dma_addr(vb, 0); - ctx->src_bufs[i].cookie.raw.chroma = - vb2_dma_contig_plane_dma_addr(vb, 1); + ctx->src_bufs[i].cookie.raw.luma = enc_src_addr(ctx, vb, 0); + ctx->src_bufs[i].cookie.raw.chroma = enc_src_addr(ctx, vb, 1); if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) @@ -2552,7 +2594,9 @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb) vb2_plane_size(vb, 0), ctx->luma_size); mfc_debug(2, "plane size: %ld, chroma size: %d\n", vb2_plane_size(vb, 1), ctx->chroma_size); - if (vb2_plane_size(vb, 0) < ctx->luma_size || + if (ctx->src_fmt->num_planes == 1 ? + vb2_plane_size(vb, 0) < enc_nv12_size(ctx) : + vb2_plane_size(vb, 0) < ctx->luma_size || vb2_plane_size(vb, 1) < ctx->chroma_size) { mfc_err("plane size is too small for output\n"); return -EINVAL; @@ -2775,7 +2819,8 @@ void s5p_mfc_enc_ctrls_delete(struct s5p_mfc_ctx *ctx) void s5p_mfc_enc_init(struct s5p_mfc_ctx *ctx) { struct v4l2_format f; - f.fmt.pix_mp.pixelformat = DEF_SRC_FMT_ENC; + f.fmt.pix_mp.pixelformat = IS_MFCV15(ctx->dev) ? V4L2_PIX_FMT_NV12 : + DEF_SRC_FMT_ENC; ctx->src_fmt = find_format(&f, MFC_FMT_RAW); f.fmt.pix_mp.pixelformat = DEF_DST_FMT_ENC; ctx->dst_fmt = find_format(&f, MFC_FMT_ENC); diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 683027feac..75a372e397 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -563,6 +563,18 @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx) if (IS_MFCV12(ctx->dev)) { switch (ctx->src_fmt->fourcc) { + case V4L2_PIX_FMT_NV12: + /* + * One buffer, laid out as V4L2 NV12: a 64 byte aligned + * stride (as Google's NV12N) and the chroma right after + * bytesperline * height. + */ + ctx->stride[0] = ALIGN(ctx->img_width, 64); + ctx->stride[1] = ctx->stride[0]; + ctx->luma_size = ctx->stride[0] * ctx->img_height; + ctx->chroma_size = ctx->stride[1] * ctx->img_height / 2; + ctx->chroma_size_1 = 0; + return; case V4L2_PIX_FMT_NV12M: case V4L2_PIX_FMT_NV21M: ctx->stride[0] = ALIGN(ctx->img_width, S5P_FIMV_NV12M_HALIGN_V6); @@ -971,7 +983,8 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx) writel(reg, mfc_regs->e_enc_options); /* memory structure cur. frame */ - if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12M) { + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12M || + ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12) { /* 0: Linear, 1: 2D tiled*/ reg = readl(mfc_regs->e_enc_options); reg &= ~(0x1 << 7); @@ -2153,7 +2166,11 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) ctx->state = MFCINST_FINISHING; } else { src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0); - src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 1); + /* One-buffer NV12: the chroma follows the luma */ + if (ctx->src_fmt->num_planes == 1) + src_c_addr = src_y_addr + ctx->luma_size; + else + src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 1); if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) src_c_1_addr = vb2_dma_contig_plane_dma_addr From 1bd79304708f76988c79be92ff227f06a2098eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:21 +0100 Subject: [PATCH 12/14] media: s5p-mfc: v15 encoder: header with the first frame, bare VP8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On MFC v15: - default V4L2_CID_MPEG_VIDEO_HEADER_MODE to JOINED_WITH_1ST_FRAME. GStreamer expects one CAPTURE buffer per frame: with a separate header buffer it drops the next one, which is the keyframe. - set bit 12 of E_VP8_OPTION. Without it the firmware wraps VP8 in IVF file and frame headers, and V4L2_PIX_FMT_VP8 is bare frames. Google's driver sets it too. There is then no header to return at sequence start, so on v15 do not return an empty buffer that would read as the end of the stream. Other versions return the header buffer as before. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 22 ++++++++++++++++--- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 6 +++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 9b5d8449a2..a8fde64561 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1172,7 +1172,13 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) struct s5p_mfc_enc_params *p = &ctx->enc_params; struct s5p_mfc_buf *dst_mb; - if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { + /* + * VP8 on v15 has no header (no IVF), so the stream size reads 0 here: + * an empty buffer would look like the end of the stream. + */ + if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE && + (!IS_MFCV15(dev) || + s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev))) { if (!list_empty(&ctx->dst_queue)) { dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); @@ -2782,11 +2788,21 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) if ((controls[i].type == V4L2_CTRL_TYPE_MENU) || (controls[i].type == V4L2_CTRL_TYPE_INTEGER_MENU)) { + s32 def = controls[i].default_value; + + /* + * On v15 the header comes with the first frame + * by default: GStreamer expects one capture + * buffer per frame and drops the extra one. + */ + if (controls[i].id == + V4L2_CID_MPEG_VIDEO_HEADER_MODE && + IS_MFCV15(ctx->dev)) + def = V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME; ctx->ctrls[i] = v4l2_ctrl_new_std_menu( &ctx->ctrl_handler, &s5p_mfc_enc_ctrl_ops, controls[i].id, - controls[i].maximum, 0, - controls[i].default_value); + controls[i].maximum, 0, def); } else { ctx->ctrls[i] = v4l2_ctrl_new_std( &ctx->ctrl_handler, diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 75a372e397..eaad168047 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -1650,6 +1650,12 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx) } reg |= (val & 0xF) << 3; reg |= (p_vp8->num_ref & 0x2); + /* + * MFC v15 wraps VP8 in IVF (file and frame headers) unless bit 12 is + * set; V4L2_PIX_FMT_VP8 is bare frames (Google's driver sets it too). + */ + if (IS_MFCV15(dev)) + reg |= BIT(12); writel(reg, mfc_regs->e_vp8_options); mfc_debug_leave(); From 29d5e382fce02d75783125ba25e53e75232264fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:29:02 +0100 Subject: [PATCH 13/14] media: s5p-mfc: offer only H.264, HEVC and VP8 encode on MFC v15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the Pixel 7 the MFC v15 firmware takes MPEG-4 and H.263 encode sessions but they do not work: FFmpeg's h263_v4l2m2m fails, and mpeg4_v4l2m2m writes a stream with no decodable frame. Do not offer them on v15, as for the decoder. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index a8fde64561..2c8bcf6f54 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -92,14 +92,14 @@ static const struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_MFC_CODEC_MPEG4_ENC, .type = MFC_FMT_ENC, .num_planes = 1, - .versions = MFC_V5PLUS_BITS, + .versions = MFC_V5PLUS_BITS & ~MFC_V15_BIT, }, { .fourcc = V4L2_PIX_FMT_H263, .codec_mode = S5P_MFC_CODEC_H263_ENC, .type = MFC_FMT_ENC, .num_planes = 1, - .versions = MFC_V5PLUS_BITS, + .versions = MFC_V5PLUS_BITS & ~MFC_V15_BIT, }, { .fourcc = V4L2_PIX_FMT_VP8, From fb58ec326cad2ad6c550aed6b2664a38dde1dd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:27:21 +0100 Subject: [PATCH 14/14] media: s5p-mfc: register the encoder on MFC v15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the previous commits the encoder works on the Pixel 7. Through GStreamer's v4l2h264enc, v4l2h265enc and v4l2vp8enc, 60 frame 1080p clips are complete in 18 runs out of 18, 90 frame 3840x2160 clips at 20 Mbit/s too, and 1 and 4 Mbit/s asked are met. Through FFmpeg's *_v4l2m2m encoders at 4 Mbit/s, 720p, PSNR against the source is about 43 dB for H.264, HEVC and VP8. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com> --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 30a8c24507..9b2a42ebf7 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -1475,18 +1475,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) v4l2_info(&dev->v4l2_dev, "decoder registered as /dev/video%d\n", dev->vfd_dec->num); - /* - * The v15 encoder's registers differ from v12's (0xF770/0xF774 clash - * with the decoder's) and nothing here programs them yet: no encoder - * node rather than one that hangs the firmware. - */ - if (IS_MFCV15(dev)) { - video_device_release(dev->vfd_enc); - dev->vfd_enc = NULL; - pr_debug("%s--\n", __func__); - return 0; - } - ret = video_register_device(dev->vfd_enc, VFL_TYPE_VIDEO, 0); if (ret) { v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");