From: Dikshita Agarwal via B4 Relay <devnull+quic_dikshita.quicinc.com@kernel.org>
To: Vikash Garodia <quic_vgarodia@quicinc.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Dikshita Agarwal <quic_dikshita@quicinc.com>,
Vedang Nagar <quic_vnagar@quicinc.com>
Subject: [PATCH v3 14/29] media: iris: implement enum_fmt and enum_frameintervals ioctls
Date: Tue, 27 Aug 2024 15:35:39 +0530 [thread overview]
Message-ID: <20240827-iris_v3-v3-14-c5fdbbe65e70@quicinc.com> (raw)
In-Reply-To: <20240827-iris_v3-v3-0-c5fdbbe65e70@quicinc.com>
From: Vedang Nagar <quic_vnagar@quicinc.com>
Implement enum_fmt and enum_frameintervals ioctls in the
driver with necessary hooks.
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
drivers/media/platform/qcom/iris/iris_vdec.c | 22 +++++++++++
drivers/media/platform/qcom/iris/iris_vdec.h | 1 +
drivers/media/platform/qcom/iris/iris_vidc.c | 57 ++++++++++++++++++++++++++++
3 files changed, 80 insertions(+)
diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
index fd04f56b405d..a38903eefa1c 100644
--- a/drivers/media/platform/qcom/iris/iris_vdec.c
+++ b/drivers/media/platform/qcom/iris/iris_vdec.c
@@ -60,6 +60,28 @@ void iris_vdec_inst_deinit(struct iris_inst *inst)
kfree(inst->fmt_src);
}
+int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f)
+{
+ if (f->index)
+ return -EINVAL;
+
+ if (V4L2_TYPE_IS_OUTPUT(f->type)) {
+ f->pixelformat = V4L2_PIX_FMT_H264;
+ f->flags = V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_DYN_RESOLUTION;
+ strscpy(f->description, "codec", sizeof(f->description));
+ } else if (V4L2_TYPE_IS_CAPTURE(f->type)) {
+ f->pixelformat = V4L2_PIX_FMT_NV12;
+ strscpy(f->description, "colorformat", sizeof(f->description));
+ }
+
+ if (!f->pixelformat)
+ return -EINVAL;
+
+ memset(f->reserved, 0, sizeof(f->reserved));
+
+ return 0;
+}
+
int iris_vdec_try_fmt(struct iris_inst *inst, struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp;
diff --git a/drivers/media/platform/qcom/iris/iris_vdec.h b/drivers/media/platform/qcom/iris/iris_vdec.h
index 4f2557d15ca2..eb8a1121ae92 100644
--- a/drivers/media/platform/qcom/iris/iris_vdec.h
+++ b/drivers/media/platform/qcom/iris/iris_vdec.h
@@ -10,6 +10,7 @@ struct iris_inst;
void iris_vdec_inst_init(struct iris_inst *inst);
void iris_vdec_inst_deinit(struct iris_inst *inst);
+int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f);
int iris_vdec_try_fmt(struct iris_inst *inst, struct v4l2_format *f);
int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f);
diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/platform/qcom/iris/iris_vidc.c
index e09c0a156387..488be6afd999 100644
--- a/drivers/media/platform/qcom/iris/iris_vidc.c
+++ b/drivers/media/platform/qcom/iris/iris_vidc.c
@@ -15,6 +15,10 @@
#define IRIS_DRV_NAME "iris_driver"
#define IRIS_BUS_NAME "platform:iris_icc"
+#define MIN_FRAME_WIDTH 128
+#define MAX_FRAME_WIDTH 8192
+#define MIN_FRAME_HEIGHT 128
+#define MAX_FRAME_HEIGHT 8192
#define STEP_WIDTH 1
#define STEP_HEIGHT 1
@@ -255,6 +259,22 @@ int iris_close(struct file *filp)
return 0;
}
+static int iris_enum_fmt(struct file *filp, void *fh, struct v4l2_fmtdesc *f)
+{
+ struct iris_inst *inst;
+ int ret;
+
+ inst = iris_get_inst(filp, fh);
+ if (!inst)
+ return -EINVAL;
+
+ mutex_lock(&inst->lock);
+ ret = iris_vdec_enum_fmt(inst, f);
+ mutex_unlock(&inst->lock);
+
+ return ret;
+}
+
static int iris_try_fmt_vid_mplane(struct file *filp, void *fh, struct v4l2_format *f)
{
struct iris_inst *inst;
@@ -309,6 +329,40 @@ static int iris_g_fmt_vid_mplane(struct file *filp, void *fh, struct v4l2_format
return ret;
}
+static int iris_enum_framesizes(struct file *filp, void *fh,
+ struct v4l2_frmsizeenum *fsize)
+{
+ struct iris_inst *inst;
+ int ret = 0;
+
+ inst = iris_get_inst(filp, fh);
+ if (!inst || !fsize)
+ return -EINVAL;
+
+ if (fsize->index)
+ return -EINVAL;
+
+ mutex_lock(&inst->lock);
+ if (fsize->pixel_format != V4L2_PIX_FMT_H264 &&
+ fsize->pixel_format != V4L2_PIX_FMT_NV12) {
+ ret = -EINVAL;
+ goto unlock;
+ }
+
+ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
+ fsize->stepwise.min_width = MIN_FRAME_WIDTH;
+ fsize->stepwise.max_width = MAX_FRAME_WIDTH;
+ fsize->stepwise.step_width = STEP_WIDTH;
+ fsize->stepwise.min_height = MIN_FRAME_HEIGHT;
+ fsize->stepwise.max_height = MAX_FRAME_HEIGHT;
+ fsize->stepwise.step_height = STEP_HEIGHT;
+
+unlock:
+ mutex_unlock(&inst->lock);
+
+ return ret;
+}
+
static int iris_g_selection(struct file *filp, void *fh, struct v4l2_selection *s)
{
struct iris_inst *inst;
@@ -362,12 +416,15 @@ static const struct vb2_ops iris_vb2_ops = {
};
static const struct v4l2_ioctl_ops iris_v4l2_ioctl_ops = {
+ .vidioc_enum_fmt_vid_cap = iris_enum_fmt,
+ .vidioc_enum_fmt_vid_out = iris_enum_fmt,
.vidioc_try_fmt_vid_cap_mplane = iris_try_fmt_vid_mplane,
.vidioc_try_fmt_vid_out_mplane = iris_try_fmt_vid_mplane,
.vidioc_s_fmt_vid_cap_mplane = iris_s_fmt_vid_mplane,
.vidioc_s_fmt_vid_out_mplane = iris_s_fmt_vid_mplane,
.vidioc_g_fmt_vid_cap_mplane = iris_g_fmt_vid_mplane,
.vidioc_g_fmt_vid_out_mplane = iris_g_fmt_vid_mplane,
+ .vidioc_enum_framesizes = iris_enum_framesizes,
.vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs,
.vidioc_g_selection = iris_g_selection,
};
--
2.34.1
next prev parent reply other threads:[~2024-08-27 10:06 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 10:05 [PATCH v3 00/29] Qualcomm iris video decoder driver Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 01/29] dt-bindings: media: Add sm8550 dt schema Dikshita Agarwal via B4 Relay
2024-08-27 10:42 ` Krzysztof Kozlowski
2024-09-05 5:41 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 02/29] media: MAINTAINERS: Add Qualcomm Iris video accelerator driver Dikshita Agarwal via B4 Relay
2024-08-27 10:42 ` Krzysztof Kozlowski
2024-09-05 5:47 ` Dikshita Agarwal
2024-09-05 10:10 ` Dmitry Baryshkov
2024-09-05 11:02 ` Dikshita Agarwal
2024-09-05 11:02 ` Dmitry Baryshkov
2024-09-05 11:14 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 03/29] media: iris: add platform driver for iris video device Dikshita Agarwal via B4 Relay
2024-08-27 14:08 ` Bryan O'Donoghue
2024-08-29 9:13 ` Dmitry Baryshkov
2024-08-29 9:36 ` Bryan O'Donoghue
2024-09-05 6:12 ` Dikshita Agarwal
2024-09-05 6:15 ` Dikshita Agarwal
2024-09-05 10:11 ` Dmitry Baryshkov
2024-09-05 10:59 ` Dikshita Agarwal
2024-09-05 11:07 ` Dmitry Baryshkov
2024-09-05 11:13 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 04/29] media: iris: initialize power resources Dikshita Agarwal via B4 Relay
2024-08-27 10:51 ` Krzysztof Kozlowski
2024-09-05 11:53 ` Dikshita Agarwal
2024-09-05 11:57 ` Krzysztof Kozlowski
2024-09-06 11:21 ` Vikash Garodia
2024-09-06 12:04 ` Krzysztof Kozlowski
2024-09-06 19:47 ` Vikash Garodia
2024-09-07 9:07 ` Krzysztof Kozlowski
2024-08-27 10:05 ` [PATCH v3 05/29] media: iris: implement iris v4l2 file ops Dikshita Agarwal via B4 Relay
2024-09-06 19:05 ` Markus Elfring
2024-09-07 8:52 ` Markus Elfring
2024-08-27 10:05 ` [PATCH v3 06/29] media: iris: introduce iris core state management with shared queues Dikshita Agarwal via B4 Relay
2024-08-28 2:38 ` kernel test robot
2024-08-27 10:05 ` [PATCH v3 07/29] media: iris: implement video firmware load/unload Dikshita Agarwal via B4 Relay
2024-08-27 23:13 ` kernel test robot
2024-08-31 13:18 ` Bryan O'Donoghue
2024-09-02 0:04 ` Dmitry Baryshkov
2024-09-05 6:17 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 08/29] media: iris: implement boot sequence of the firmware Dikshita Agarwal via B4 Relay
2024-09-05 12:34 ` Bryan O'Donoghue
2024-09-06 11:27 ` Vikash Garodia
2024-08-27 10:05 ` [PATCH v3 09/29] media: iris: introduce Host firmware interface with necessary hooks Dikshita Agarwal via B4 Relay
2024-09-05 12:36 ` Bryan O'Donoghue
2024-09-24 9:13 ` Dikshita Agarwal
2024-09-05 13:10 ` Bryan O'Donoghue
2024-09-06 13:31 ` Vikash Garodia
2024-08-27 10:05 ` [PATCH v3 10/29] media: iris: implement power management Dikshita Agarwal via B4 Relay
2024-09-05 13:23 ` Bryan O'Donoghue
2024-09-05 13:46 ` Krzysztof Kozlowski
2024-09-24 8:38 ` Dikshita Agarwal
2024-09-24 8:36 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 11/29] media: iris: implement reqbuf ioctl with vb2_queue_setup Dikshita Agarwal via B4 Relay
2024-09-06 12:50 ` Bryan O'Donoghue
2024-09-06 13:05 ` Bryan O'Donoghue
2024-09-26 10:47 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 12/29] media: iris: implement s_fmt, g_fmt and try_fmt ioctls Dikshita Agarwal via B4 Relay
2024-09-24 14:41 ` Bryan O'Donoghue
2024-09-26 10:49 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 13/29] media: iris: implement g_selection ioctl Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` Dikshita Agarwal via B4 Relay [this message]
2024-08-27 10:05 ` [PATCH v3 15/29] media: iris: implement subscribe_event and unsubscribe_event ioctls Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 16/29] media: iris: implement iris v4l2_ctrl_ops and prepare capabilities Dikshita Agarwal via B4 Relay
2024-08-29 9:33 ` Dmitry Baryshkov
2024-10-01 13:01 ` Vedang Nagar
2024-10-06 16:46 ` Dmitry Baryshkov
2024-08-27 10:05 ` [PATCH v3 17/29] media: iris: implement query_cap, query_ctrl and query_menu ioctls Dikshita Agarwal via B4 Relay
2024-09-24 14:49 ` Bryan O'Donoghue
2024-09-26 10:50 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 18/29] media: iris: implement vb2 streaming ops Dikshita Agarwal via B4 Relay
2024-08-28 0:26 ` kernel test robot
2024-08-27 10:05 ` [PATCH v3 19/29] media: iris: implement set properties to firmware during streamon Dikshita Agarwal via B4 Relay
2024-09-24 15:09 ` Bryan O'Donoghue
2024-08-27 10:05 ` [PATCH v3 20/29] media: iris: subscribe parameters and properties to firmware for hfi_gen2 Dikshita Agarwal via B4 Relay
2024-09-24 15:16 ` Bryan O'Donoghue
2024-09-26 10:55 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 21/29] media: iris: allocate, initialize and queue internal buffers Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 22/29] media: iris: implement vb2 ops for buf_queue and firmware response Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 23/29] media: iris: add support for dynamic resolution change Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 24/29] media: iris: handle streamoff/on from client in " Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 25/29] media: iris: add support for drain sequence Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 26/29] media: iris: add check whether the video session is supported or not Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 27/29] media: iris: implement power scaling for vpu2 and vpu3 Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 28/29] media: iris: add allow checks for v4l2 ioctls Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 29/29] media: iris: add check to allow sub states transitions Dikshita Agarwal via B4 Relay
2024-08-27 13:41 ` [PATCH v3 00/29] Qualcomm iris video decoder driver neil.armstrong
2024-09-24 9:13 ` Dikshita Agarwal
2024-10-01 13:28 ` Neil Armstrong
2024-08-31 15:18 ` Bryan O'Donoghue
2024-09-02 0:02 ` Dmitry Baryshkov
2024-09-06 14:19 ` Nicolas Dufresne
2024-09-06 19:26 ` Vikash Garodia
2024-09-06 16:28 ` Abhinav Kumar
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=20240827-iris_v3-v3-14-c5fdbbe65e70@quicinc.com \
--to=devnull+quic_dikshita.quicinc.com@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_dikshita@quicinc.com \
--cc=quic_vgarodia@quicinc.com \
--cc=quic_vnagar@quicinc.com \
--cc=robh@kernel.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).