From nobody Sun Nov 24 17:32:24 2024 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4C821D0143; Wed, 20 Nov 2024 14:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732114070; cv=none; b=rtMffzNia5kxxDuCk2I7DXB1b9LDtP36RdEUTKBBt0avxa53sbZ5Q/1q4f0Lw0/TdleQ5FpDDq8BbzYZf2N1qcQ9mPOho1cucwznlrkBuAQcs3dQGh7eYKPRHkroP//lCFHB6hgAFeHfA2igiy/fgwwMV2Y+SQ4SVjr6f1b4QZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732114070; c=relaxed/simple; bh=/Gme18RoYB9OpDVKIS+axuwD1HB0vxSIxefUNQ3nTEM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=VFND9IEgDMby+MyFmqLvj/84nrI/Fvzoxq3fuu8wgdx5A+mS61Aw8DfIWKYHToo1IIyrRCLi8GzOdcihyp7gN4zq0FR5VvTDCuK3Y+WL+3EEbHjRky2tafKxUwp3qAzyAjFwGAWf6m+EG2db8nu8tCnICUEqrOGq0VlGZiR4hpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=kKMs0Wjn; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="kKMs0Wjn" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AK9FRA5010551; Wed, 20 Nov 2024 14:47:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 7kPQuTEYoUwhidL2iTLm0TxtERLxgC0g9piedtihitw=; b=kKMs0WjnCXhrH+Y4 zQzsUUQnLokpmJOr4VQ1rnaBgH44zqXqoZfikPcsJPHAA2qsP1Csbr3mP++F+9Np +1UE1f0AkbqONagU+d1EwcL87EuJaeYRU3dMGu+Lxj1w7mH8YO3rfh0hOHe33CQJ JJvMKhfGul7eP6md8Q5JqW1yme73N/yQ8oez6CyGRvqLstrjbO47YL1ivrOQ7rio DeHh8P1Dxd54mKQHj1Fc4BclnrLg7x9QmUrwwdU2pS8BRrWszYfwPV9OlrU6zCdb WUFjFRkqXiFywDN068dyZfvQ8TLwpMU9hhGCG4Q5Hemwguu++Z0QwzXiPLR8UDZP Jdwwlw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43091me5au-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Nov 2024 14:47:40 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AKEldiS006167 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Nov 2024 14:47:39 GMT Received: from hu-dikshita-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 20 Nov 2024 06:47:33 -0800 From: Dikshita Agarwal Date: Wed, 20 Nov 2024 20:16:02 +0530 Subject: [PATCH v6 12/28] media: iris: implement enum_fmt and enum_framesizes ioctls Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241120-qcom-video-iris-v6-12-a8cf6704e992@quicinc.com> References: <20241120-qcom-video-iris-v6-0-a8cf6704e992@quicinc.com> In-Reply-To: <20241120-qcom-video-iris-v6-0-a8cf6704e992@quicinc.com> To: Vikash Garodia , Abhinav Kumar , Mauro Carvalho Chehab , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" , Philipp Zabel CC: Hans Verkuil , Sebastian Fricke , Bryan O'Donoghue , Dmitry Baryshkov , Neil Armstrong , Nicolas Dufresne , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jianhua Lu , , , , , "Dikshita Agarwal" , Vedang Nagar X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732113983; l=5747; i=quic_dikshita@quicinc.com; s=20240917; h=from:subject:message-id; bh=AQiv9ZBepjlPUvbFEuqLkMl3MC4L0WoODEmvTm3i2JU=; b=TyMYOHFF7UA6alHLsl1lbhze/ERbxVk2E/wjoWKKXb0mfOWAuZ1nk4vGRCYo2E5MHDMJuklTr HsWtBjFYDZuBVijMBYMVrTE1NnGtY3NEyfLq6aD1PEIFobtSZ0Xf+vn X-Developer-Key: i=quic_dikshita@quicinc.com; a=ed25519; pk=EEvKY6Ar1OI5SWf44FJ1Ebo1KuQEVbbf5UNPO+UHVhM= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: S--UnyHLwvPUqle38ECMsOlCS1YPrOwK X-Proofpoint-GUID: S--UnyHLwvPUqle38ECMsOlCS1YPrOwK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 clxscore=1015 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411200098 From: Vedang Nagar Implement enum_fmt and enum_framesizes ioctls with necessary hooks. Signed-off-by: Vedang Nagar Signed-off-by: Dikshita Agarwal --- .../platform/qcom/iris/iris_platform_common.h | 4 +++ .../platform/qcom/iris/iris_platform_sm8550.c | 4 +++ drivers/media/platform/qcom/iris/iris_vdec.c | 17 ++++++++++ drivers/media/platform/qcom/iris/iris_vdec.h | 1 + drivers/media/platform/qcom/iris/iris_vidc.c | 39 ++++++++++++++++++= ++++ 5 files changed, 65 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index d508477b066e..75d4932df910 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -43,6 +43,10 @@ struct ubwc_config_data { }; =20 struct platform_inst_caps { + u32 min_frame_width; + u32 max_frame_width; + u32 min_frame_height; + u32 max_frame_height; u32 max_mbpf; }; struct iris_core_power { diff --git a/drivers/media/platform/qcom/iris/iris_platform_sm8550.c b/driv= ers/media/platform/qcom/iris/iris_platform_sm8550.c index bc4769732aad..37c0130d7059 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_sm8550.c +++ b/drivers/media/platform/qcom/iris/iris_platform_sm8550.c @@ -11,6 +11,10 @@ #define VIDEO_ARCH_LX 1 =20 static struct platform_inst_caps platform_inst_cap_sm8550 =3D { + .min_frame_width =3D 96, + .max_frame_width =3D 8192, + .min_frame_height =3D 96, + .max_frame_height =3D 8192, .max_mbpf =3D (8192 * 4352) / 256, }; =20 diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/p= latform/qcom/iris/iris_vdec.c index 11a2507fc35f..742b45432481 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -58,6 +58,23 @@ void iris_vdec_inst_deinit(struct iris_inst *inst) kfree(inst->fmt_src); } =20 +int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) +{ + switch (f->type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: + f->pixelformat =3D V4L2_PIX_FMT_H264; + f->flags =3D V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_DYN_RESOLUTION; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + f->pixelformat =3D V4L2_PIX_FMT_NV12; + break; + default: + return -EINVAL; + } + + return 0; +} + int iris_vdec_try_fmt(struct iris_inst *inst, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; diff --git a/drivers/media/platform/qcom/iris/iris_vdec.h b/drivers/media/p= latform/qcom/iris/iris_vdec.h index 85e93f33e9e7..ae456676e578 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; =20 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); =20 diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index 6a32fd8d6123..bc77dfc2ba67 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -217,6 +217,16 @@ int iris_close(struct file *filp) return 0; } =20 +static int iris_enum_fmt(struct file *filp, void *fh, struct v4l2_fmtdesc = *f) +{ + struct iris_inst *inst =3D iris_get_inst(filp, NULL); + + if (f->index) + return -EINVAL; + + return iris_vdec_enum_fmt(inst, f); +} + static int iris_try_fmt_vid_mplane(struct file *filp, void *fh, struct v4l= 2_format *f) { struct iris_inst *inst =3D iris_get_inst(filp, NULL); @@ -259,6 +269,32 @@ static int iris_g_fmt_vid_mplane(struct file *filp, vo= id *fh, struct v4l2_format return ret; } =20 +static int iris_enum_framesizes(struct file *filp, void *fh, + struct v4l2_frmsizeenum *fsize) +{ + struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct platform_inst_caps *caps; + + if (fsize->index) + return -EINVAL; + + if (fsize->pixel_format !=3D V4L2_PIX_FMT_H264 && + fsize->pixel_format !=3D V4L2_PIX_FMT_NV12) + return -EINVAL; + + caps =3D inst->core->iris_platform_data->inst_caps; + + fsize->type =3D V4L2_FRMSIZE_TYPE_STEPWISE; + fsize->stepwise.min_width =3D caps->min_frame_width; + fsize->stepwise.max_width =3D caps->max_frame_width; + fsize->stepwise.step_width =3D STEP_WIDTH; + fsize->stepwise.min_height =3D caps->min_frame_height; + fsize->stepwise.max_height =3D caps->max_frame_height; + fsize->stepwise.step_height =3D STEP_HEIGHT; + + return 0; +} + static int iris_g_selection(struct file *filp, void *fh, struct v4l2_selec= tion *s) { struct iris_inst *inst =3D iris_get_inst(filp, NULL); @@ -300,12 +336,15 @@ static const struct vb2_ops iris_vb2_ops =3D { }; =20 static const struct v4l2_ioctl_ops iris_v4l2_ioctl_ops =3D { + .vidioc_enum_fmt_vid_cap =3D iris_enum_fmt, + .vidioc_enum_fmt_vid_out =3D iris_enum_fmt, .vidioc_try_fmt_vid_cap_mplane =3D iris_try_fmt_vid_mplane, .vidioc_try_fmt_vid_out_mplane =3D iris_try_fmt_vid_mplane, .vidioc_s_fmt_vid_cap_mplane =3D iris_s_fmt_vid_mplane, .vidioc_s_fmt_vid_out_mplane =3D iris_s_fmt_vid_mplane, .vidioc_g_fmt_vid_cap_mplane =3D iris_g_fmt_vid_mplane, .vidioc_g_fmt_vid_out_mplane =3D iris_g_fmt_vid_mplane, + .vidioc_enum_framesizes =3D iris_enum_framesizes, .vidioc_reqbufs =3D v4l2_m2m_ioctl_reqbufs, .vidioc_g_selection =3D iris_g_selection, }; --=20 2.34.1