From: Neil Armstrong <narmstrong@baylibre.com>
To: hverkuil-cisco@xs4all.nl
Cc: Maxime Jourdan <mjourdan@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>,
linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: [PATCH 2/5] media: meson: vdec: handle bitdepth on source change
Date: Thu, 4 Jun 2020 15:53:14 +0200 [thread overview]
Message-ID: <20200604135317.9235-3-narmstrong@baylibre.com> (raw)
In-Reply-To: <20200604135317.9235-1-narmstrong@baylibre.com>
From: Maxime Jourdan <mjourdan@baylibre.com>
In order to handle Compressed Framebuffer support, we need to handle
the switch between 8bit and 10bit frame output.
This handles the bitdepth in the codec amvdec_src_change() call to handle
a source change/decode resume when the stream bitdepth changes.
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/staging/media/meson/vdec/codec_h264.c | 3 ++-
drivers/staging/media/meson/vdec/codec_vp9.c | 3 ++-
drivers/staging/media/meson/vdec/vdec.h | 1 +
drivers/staging/media/meson/vdec/vdec_helpers.c | 10 ++++++----
drivers/staging/media/meson/vdec/vdec_helpers.h | 3 ++-
5 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c
index c61128fc4bb9..d53c9a464bde 100644
--- a/drivers/staging/media/meson/vdec/codec_h264.c
+++ b/drivers/staging/media/meson/vdec/codec_h264.c
@@ -353,7 +353,8 @@ static void codec_h264_src_change(struct amvdec_session *sess)
frame_width, frame_height, crop_right, crop_bottom);
codec_h264_set_par(sess);
- amvdec_src_change(sess, frame_width, frame_height, h264->max_refs + 5);
+ amvdec_src_change(sess, frame_width, frame_height,
+ h264->max_refs + 5, 8);
}
/*
diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c
index 897f5d7a6aad..4c6a644ab1a7 100644
--- a/drivers/staging/media/meson/vdec/codec_vp9.c
+++ b/drivers/staging/media/meson/vdec/codec_vp9.c
@@ -2132,7 +2132,8 @@ static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess)
codec_vp9_fetch_rpm(sess);
if (codec_vp9_process_rpm(vp9)) {
- amvdec_src_change(sess, vp9->width, vp9->height, 16);
+ amvdec_src_change(sess, vp9->width, vp9->height, 16,
+ vp9->is_10bit ? 10 : 8);
/* No frame is actually processed */
vp9->cur_frame = NULL;
diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h
index f95445ac0658..e3e4af73447a 100644
--- a/drivers/staging/media/meson/vdec/vdec.h
+++ b/drivers/staging/media/meson/vdec/vdec.h
@@ -234,6 +234,7 @@ struct amvdec_session {
u32 width;
u32 height;
u32 colorspace;
+ u32 bitdepth;
u8 ycbcr_enc;
u8 quantization;
u8 xfer_func;
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c
index 7f07a9175815..eed7a929c5d0 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.c
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.c
@@ -436,7 +436,7 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess,
EXPORT_SYMBOL_GPL(amvdec_set_par_from_dar);
void amvdec_src_change(struct amvdec_session *sess, u32 width,
- u32 height, u32 dpb_size)
+ u32 height, u32 dpb_size, u32 bitdepth)
{
static const struct v4l2_event ev = {
.type = V4L2_EVENT_SOURCE_CHANGE,
@@ -451,7 +451,8 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width,
if (sess->streamon_cap &&
sess->width == width &&
sess->height == height &&
- dpb_size <= sess->num_dst_bufs) {
+ dpb_size <= sess->num_dst_bufs &&
+ sess->bitdepth == bitdepth) {
sess->fmt_out->codec_ops->resume(sess);
return;
}
@@ -460,9 +461,10 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width,
sess->width = width;
sess->height = height;
sess->status = STATUS_NEEDS_RESUME;
+ sess->bitdepth = bitdepth;
- dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB size %u\n",
- width, height, dpb_size);
+ dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB %u, bitdepth %u\n",
+ width, height, dpb_size, bitdepth);
v4l2_event_queue_fh(&sess->fh, &ev);
}
EXPORT_SYMBOL_GPL(amvdec_src_change);
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h
index cfaed52ab526..f059cf195cca 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.h
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.h
@@ -76,9 +76,10 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess,
* @width: picture width detected by the hardware
* @height: picture height detected by the hardware
* @dpb_size: Decoded Picture Buffer size (= amount of buffers for decoding)
+ * @bitdepth: Bit depth (usually 10 or 8) of the coded content
*/
void amvdec_src_change(struct amvdec_session *sess, u32 width,
- u32 height, u32 dpb_size);
+ u32 height, u32 dpb_size, u32 bitdepth);
/**
* amvdec_abort() - Abort the current decoding session
--
2.22.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-04 13:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 13:53 [PATCH 0/5] media: meson: vdec: Add support for compressed framebuffer Neil Armstrong
2020-06-04 13:53 ` [PATCH 1/5] media: videodev2: add Compressed Framebuffer pixel formats Neil Armstrong
2020-06-05 15:35 ` Nicolas Dufresne
2020-06-05 15:37 ` Nicolas Dufresne
2020-06-08 8:16 ` Neil Armstrong
2020-06-08 9:26 ` Hans Verkuil
2020-06-08 14:14 ` Neil Armstrong
2020-06-08 14:43 ` Hans Verkuil
2020-06-08 18:59 ` Nicolas Dufresne
2020-06-09 7:43 ` Neil Armstrong
2020-06-09 10:28 ` Ezequiel Garcia
2020-06-09 15:44 ` Nicolas Dufresne
2020-06-11 12:26 ` Helen Koike
2020-06-04 13:53 ` Neil Armstrong [this message]
2020-06-04 13:53 ` [PATCH 3/5] media: meson: vdec: update compressed buffer helpers Neil Armstrong
2020-06-04 13:53 ` [PATCH 4/5] media: meson: vdec: add support for compressed output for VP9 decoder Neil Armstrong
2020-06-04 13:53 ` [PATCH 5/5] media: meson: vdec: handle compressed output pixel format negociation with consumer Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200604135317.9235-3-narmstrong@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mjourdan@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox