From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: kernel@collabora.com, Hans Verkuil <hverkuil@xs4all.nl>,
Philipp Zabel <p.zabel@pengutronix.de>,
Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH 3/6] hantro: Rework how encoder and decoder are identified
Date: Thu, 25 Jun 2020 13:35:22 -0300 [thread overview]
Message-ID: <20200625163525.5119-4-ezequiel@collabora.com> (raw)
In-Reply-To: <20200625163525.5119-1-ezequiel@collabora.com>
So far we've been using the .buf_finish hook to distinguish
decoder from encoder. This is unnecessarily obfuscated.
Moreover, we want to move the buf_finish, so use a cleaner
scheme to distinguish the driver decoder/encoder type.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/staging/media/hantro/hantro.h | 2 ++
drivers/staging/media/hantro/hantro_drv.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
index 3005207fc6fb..028b788ad50f 100644
--- a/drivers/staging/media/hantro/hantro.h
+++ b/drivers/staging/media/hantro/hantro.h
@@ -199,6 +199,7 @@ struct hantro_dev {
*
* @dev: VPU driver data to which the context belongs.
* @fh: V4L2 file handler.
+ * @is_encoder: Decoder or encoder context?
*
* @sequence_cap: Sequence counter for capture queue
* @sequence_out: Sequence counter for output queue
@@ -223,6 +224,7 @@ struct hantro_dev {
struct hantro_ctx {
struct hantro_dev *dev;
struct v4l2_fh fh;
+ bool is_encoder;
u32 sequence_cap;
u32 sequence_out;
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index 0db8ad455160..112ed556eb90 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -197,7 +197,7 @@ static void device_run(void *priv)
bool hantro_is_encoder_ctx(const struct hantro_ctx *ctx)
{
- return ctx->buf_finish == hantro_enc_buf_finish;
+ return ctx->is_encoder;
}
static struct v4l2_m2m_ops vpu_m2m_ops = {
@@ -420,8 +420,10 @@ static int hantro_open(struct file *filp)
if (func->id == MEDIA_ENT_F_PROC_VIDEO_ENCODER) {
allowed_codecs = vpu->variant->codec & HANTRO_ENCODERS;
ctx->buf_finish = hantro_enc_buf_finish;
+ ctx->is_encoder = true;
} else if (func->id == MEDIA_ENT_F_PROC_VIDEO_DECODER) {
allowed_codecs = vpu->variant->codec & HANTRO_DECODERS;
+ ctx->is_encoder = false;
} else {
ret = -ENODEV;
goto err_ctx_free;
--
2.26.0.rc2
next prev parent reply other threads:[~2020-06-25 16:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 16:35 [PATCH 0/6] Hantro low-hanging cleanups Ezequiel Garcia
2020-06-25 16:35 ` [PATCH 1/6] hantro: h264: Remove unused macro definition Ezequiel Garcia
2020-06-25 16:35 ` [PATCH 2/6] hantro: h264: Rename scaling list handling function Ezequiel Garcia
2020-06-25 16:35 ` Ezequiel Garcia [this message]
2020-06-26 7:58 ` [PATCH 3/6] hantro: Rework how encoder and decoder are identified Philipp Zabel
2020-06-26 18:30 ` Ezequiel Garcia
2020-06-26 9:52 ` Robin Murphy
2020-06-26 18:31 ` Ezequiel Garcia
2020-06-25 16:35 ` [PATCH 4/6] hantro: Move hantro_enc_buf_finish to JPEG codec_ops.done Ezequiel Garcia
2020-06-25 16:35 ` [PATCH 5/6] hantro: Remove unused bytesused argument Ezequiel Garcia
2020-06-25 16:35 ` [PATCH 6/6] hantro: Make sure we don't use post-processor on an encoder Ezequiel Garcia
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=20200625163525.5119-4-ezequiel@collabora.com \
--to=ezequiel@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).