From: Tiffany Lin <tiffany.lin@mediatek.com>
To: Hans Verkuil <hans.verkuil@cisco.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Daniel Kurtz <djkurtz@chromium.org>,
Pawel Osciak <posciak@chromium.org>
Cc: Eddie Huang <eddie.huang@mediatek.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
<linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <Tiffany.lin@mediatek.com>,
Tiffany Lin <tiffany.lin@mediatek.com>
Subject: [PATCH] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder
Date: Mon, 30 May 2016 15:52:48 +0800 [thread overview]
Message-ID: <1464594768-1993-1-git-send-email-tiffany.lin@mediatek.com> (raw)
This patch add g/s_selection support for MT8173
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 74 ++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 6e72d73..23ef9a1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -630,6 +630,77 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
return vidioc_try_fmt(f, fmt);
}
+static int vidioc_venc_g_selection(struct file *file, void *priv,
+ struct v4l2_selection *s)
+{
+ struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
+ struct mtk_q_data *q_data;
+
+ /* crop means compose for output devices */
+ switch (s->target) {
+ case V4L2_SEL_TGT_CROP_DEFAULT:
+ case V4L2_SEL_TGT_CROP_BOUNDS:
+ case V4L2_SEL_TGT_CROP:
+ case V4L2_SEL_TGT_COMPOSE_DEFAULT:
+ case V4L2_SEL_TGT_COMPOSE_BOUNDS:
+ case V4L2_SEL_TGT_COMPOSE:
+ if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
+ mtk_v4l2_err("Invalid s->type = %d", s->type);
+ return -EINVAL;
+ }
+ break;
+ default:
+ mtk_v4l2_err("Invalid s->target = %d", s->target);
+ return -EINVAL;
+ }
+
+ q_data = mtk_venc_get_q_data(ctx, s->type);
+ if (!q_data)
+ return -EINVAL;
+
+ s->r.top = 0;
+ s->r.left = 0;
+ s->r.width = q_data->visible_width;
+ s->r.height = q_data->visible_height;
+
+ return 0;
+}
+
+static int vidioc_venc_s_selection(struct file *file, void *priv,
+ struct v4l2_selection *s)
+{
+ struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
+ struct mtk_q_data *q_data;
+
+ switch (s->target) {
+ case V4L2_SEL_TGT_CROP_DEFAULT:
+ case V4L2_SEL_TGT_CROP_BOUNDS:
+ case V4L2_SEL_TGT_CROP:
+ case V4L2_SEL_TGT_COMPOSE_DEFAULT:
+ case V4L2_SEL_TGT_COMPOSE_BOUNDS:
+ case V4L2_SEL_TGT_COMPOSE:
+ if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
+ mtk_v4l2_err("Invalid s->type = %d", s->type);
+ return -EINVAL;
+ }
+ break;
+ default:
+ mtk_v4l2_err("Invalid s->target = %d", s->target);
+ return -EINVAL;
+ }
+
+ q_data = mtk_venc_get_q_data(ctx, s->type);
+ if (!q_data)
+ return -EINVAL;
+
+ s->r.top = 0;
+ s->r.left = 0;
+ q_data->visible_width = s->r.width;
+ q_data->visible_height = s->r.height;
+
+ return 0;
+}
+
static int vidioc_venc_qbuf(struct file *file, void *priv,
struct v4l2_buffer *buf)
{
@@ -688,6 +759,9 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
.vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs,
.vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf,
+
+ .vidioc_g_selection = vidioc_venc_g_selection,
+ .vidioc_s_selection = vidioc_venc_s_selection,
};
static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
--
1.7.9.5
next reply other threads:[~2016-05-30 7:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 7:52 Tiffany Lin [this message]
2016-07-11 4:32 ` [PATCH] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder Hans Verkuil
2016-07-11 8:09 ` tiffany lin
2016-07-14 6:27 ` tiffany lin
2016-07-15 17:50 ` Hans Verkuil
2016-07-18 12:28 ` tiffany lin
2016-07-18 12:44 ` Hans Verkuil
2016-07-19 16:44 ` tiffany lin
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=1464594768-1993-1-git-send-email-tiffany.lin@mediatek.com \
--to=tiffany.lin@mediatek.com \
--cc=djkurtz@chromium.org \
--cc=eddie.huang@mediatek.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@osg.samsung.com \
--cc=posciak@chromium.org \
--cc=yingjoe.chen@mediatek.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;
as well as URLs for NNTP newsgroup(s).