From: Xia Jiang <xia.jiang@mediatek.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
srv_heupstream <srv_heupstream@mediatek.com>,
Rick Chang <Rick.Chang@mediatek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Tomasz Figa <tfiga@chromium.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [PATCH v4 5/5] media: platform: Add jpeg dec/enc feature
Date: Fri, 6 Dec 2019 16:06:45 +0800 [thread overview]
Message-ID: <1575619605.17879.3.camel@mhfsdcap03> (raw)
In-Reply-To: <a2e66e05-3248-de84-85d5-b0c7e5a080f1@xs4all.nl>
On Mon, 2019-10-21 at 17:23 +0800, Hans Verkuil wrote:
> Hi Xia,
>
> Some comments about the selection code:
>
> On 10/17/19 10:40 AM, Xia Jiang wrote:
> > Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg
> > decode and encode have great similarities with function operation.
> >
> > Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
> > ---
> > v4: split mtk_jpeg_try_fmt_mplane() to two functions, one for encoder,
> > one for decoder.
> > split mtk_jpeg_set_default_params() to two functions, one for
> > encoder, one for decoder.
> > add cropping support for encoder in g/s_selection ioctls.
> > change exif mode support by using V4L2_JPEG_ACTIVE_MARKER_APP1.
> > change MTK_JPEG_MAX_WIDTH/MTK_JPEG_MAX_HEIGH from 8192 to 65535 by
> > specification.
> > move width shifting operation behind aligning operation in
> > mtk_jpeg_try_enc_fmt_mplane() for bug fix.
> > fix user abuseing data_offset issue for DMABUF in
> > mtk_jpeg_set_enc_src().
> > fix kbuild warings: change MTK_JPEG_MIN_HEIGHT/MTK_JPEG_MAX_HEIGHT
> > and MTK_JPEG_MIN_WIDTH/MTK_JPEG_MAX_WIDTH from
> > 'int' type to 'unsigned int' type.
> > fix msleadingly indented of 'else'.
> >
> > v3: delete Change-Id.
> > only test once handler->error after the last v4l2_ctrl_new_std().
> > seperate changes of v4l2-ctrls.c and v4l2-controls.h to new patch.
> >
> > v2: fix compliance test fail, check created buffer size in driver.
> > ---
> > drivers/media/platform/mtk-jpeg/Makefile | 5 +-
> > .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 731 +++++++++++++++---
> > .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 123 ++-
> > .../media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h | 7 +-
> > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 175 +++++
> > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h | 60 ++
> > .../platform/mtk-jpeg/mtk_jpeg_enc_reg.h | 49 ++
> > 7 files changed, 1004 insertions(+), 146 deletions(-)
> > create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c
> > create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h
> > create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_reg.h
> >
>
> <snip>
>
> > @@ -455,11 +679,19 @@ static int mtk_jpeg_g_selection(struct file *file, void *priv,
> > struct v4l2_selection *s)
> > {
> > struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
> > + struct mtk_jpeg_dev *jpeg = ctx->jpeg;
> >
> > - if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > + if (jpeg->mode == MTK_JPEG_ENC && s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > + return -EINVAL;
> > +
> > + if (jpeg->mode == MTK_JPEG_DEC &&
> > + s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > return -EINVAL;
> >
> > switch (s->target) {
> > + case V4L2_SEL_TGT_CROP:
> > + case V4L2_SEL_TGT_CROP_BOUNDS:
> > + case V4L2_SEL_TGT_CROP_DEFAULT:
>
> This is wrong...
>
> > case V4L2_SEL_TGT_COMPOSE:
> > case V4L2_SEL_TGT_COMPOSE_DEFAULT:
> > s->r.width = ctx->out_q.w;
> > @@ -484,11 +716,17 @@ static int mtk_jpeg_s_selection(struct file *file, void *priv,
> > struct v4l2_selection *s)
> > {
> > struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
> > + struct mtk_jpeg_dev *jpeg = ctx->jpeg;
> >
> > - if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > + if (jpeg->mode == MTK_JPEG_ENC && s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > + return -EINVAL;
> > +
> > + if (jpeg->mode == MTK_JPEG_DEC &&
> > + s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > return -EINVAL;
> >
> > switch (s->target) {
> > + case V4L2_SEL_TGT_CROP:
>
> ...and so is this.
>
> The decoder only supports COMPOSE, the encoder only supports CROP.
>
> This signals support for both cropping and composition for both encoder and
> decoder, and that's wrong. You can see this in the compliance output as well:
> it says that both cropping and composition are 'OK', meaning that both features
> are implemented.
>
> It also claims that the decoder supports scaling. Is that correct? Is there a
> scaler in the JPEG decoder? Usually codecs do not have a scaler.
>
> Regards,
>
> Hans
Dear Hans,
Crop only for encoder and compose only for decoder in the latest vesion.
Best Regards,
Xia Jiang
>
> > case V4L2_SEL_TGT_COMPOSE:
> > s->r.left = 0;
> > s->r.top = 0;
> > @@ -658,10 +896,92 @@ static void mtk_jpeg_set_queue_data(struct mtk_jpeg_ctx *ctx,
> > param->dec_w, param->dec_h);
> > }
>
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2019-12-06 8:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 8:40 [PATCH v4 0/5] Add support for mt2701 JPEG ENC support Xia Jiang
2019-10-17 8:40 ` [PATCH v4 1/5] media: dt-bindings: Add jpeg enc device tree node document Xia Jiang
2019-10-17 8:40 ` [PATCH v4 2/5] arm: dts: Add jpeg enc device tree node Xia Jiang
2019-10-17 8:40 ` [PATCH v4 3/5] media: platform: Rename jpeg dec file name Xia Jiang
2019-10-17 8:40 ` [PATCH v4 4/5] media: platform: Fix v4l2-compliance test bug Xia Jiang
2019-10-17 8:40 ` [PATCH v4 5/5] media: platform: Add jpeg dec/enc feature Xia Jiang
2019-10-21 9:23 ` Hans Verkuil
2019-12-06 8:06 ` Xia Jiang [this message]
2019-10-23 10:39 ` Tomasz Figa
2019-10-24 8:38 ` Xia Jiang
2019-10-24 9:23 ` Tomasz Figa
2019-10-28 2:25 ` Xia Jiang
2019-11-11 7:01 ` Tomasz Figa
2019-12-06 9:59 ` Xia Jiang
2020-03-10 4:17 ` Tomasz Figa
2020-04-22 7:00 ` Xia Jiang
2020-05-01 15:15 ` Tomasz Figa
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=1575619605.17879.3.camel@mhfsdcap03 \
--to=xia.jiang@mediatek.com \
--cc=Rick.Chang@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=m.szyprowski@samsung.com \
--cc=matthias.bgg@gmail.com \
--cc=mchehab+samsung@kernel.org \
--cc=robh+dt@kernel.org \
--cc=srv_heupstream@mediatek.com \
--cc=tfiga@chromium.org \
/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).