From nobody Sun May 24 23:29:38 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 941553E1232 for ; Wed, 20 May 2026 12:52:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779281545; cv=none; b=Jn09FftibQN5ZB6eHX2TRHzo3TcvWKm77LB/Z9BnRmnzU66bmH2CwOW42V3+qTAy0uIGMwJ2wZmrpKDyPqhQNKgd/YM5fXvP/jT3gAavlTAMQYK62W0KjWuipYdK2p/dQxjJH7Q1x33aplROCKPEcH0xhQS3vyp9PEFq0/vZVQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779281545; c=relaxed/simple; bh=a1x3PX1iaKMLfxjA33XePNA+XnOVe9pJTH02fuVJBIg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=fKewWWpqobmior7rN7K8g2ibzThPWSpXasF114iK0B2q3cyCy0zQFpDvaPRcoSVa7VQlX3DmyNeUhIeXh4MLBhnoOEUWQ3yFckn5wqSmCuAMxMSg0GmBGjj694ke5wyGCHn6i/elr/VL/WCFcEIU7F3w6mwyGTIGNuUcNGp+1IA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=WuTxrjHn; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dbcd9Gv1; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="WuTxrjHn"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dbcd9Gv1" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64K9oPxF1177884 for ; Wed, 20 May 2026 12:52:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=RPr2sjQVxk1gAzeHuQ/C99 sFybgLvBxV0RLYSJro0Mw=; b=WuTxrjHnC6hDl/tKTrynLDmJnQkNGaOx5fLGdv UeIMg+cgWJhkIb6ShOW8FVbLTU6K0kJF1JcuxZTL7iS+MQGHDjD0KXnbUtT/F6Ht nnQPnHzdTIuVe8JmokAp5ZceVA0K9MIYFB8j4oYVq+2R2UBHh4/33XlmBZGX4vnf oTEeiG+yMjZomByTw8sVt5twjRe+hF7Y0CgqVw/uaSkVAIDUrnCyZs7bEK1uePz8 2MwxB5xZNtBHVS1ixxa8iZsmQKe6m69QoTtmxE21weXI4QoHAtPs6t8cUm0SqLk/ m9iVF6pUwmowOrBRWCW5cicOVfONmSQiVTY3bpsq3tcBCe9Q== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e9ap6rmgu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 20 May 2026 12:52:22 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50fbc70cfbdso143527831cf.2 for ; Wed, 20 May 2026 05:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779281542; x=1779886342; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=RPr2sjQVxk1gAzeHuQ/C99sFybgLvBxV0RLYSJro0Mw=; b=dbcd9Gv11o2l+031VJHQtlDOew4MrsudYT206YqJtYPZs0M74bYFVdH+MVkUxauMLN g5dpirBD1Q7Ph2mH8fnXrXlH30ASyEQ+mYR1mNpaYpVIX1k/qwr+vMquSI0wDs+P6BEq IHk9mnbcLf5Gqgll5wuquhxM5MFTxbNZRl6q+o4mzWbQ+Bpg7ORzPrUpagmqcuWltua6 DmrV3OhD9fL6aUgXWkSn2fGALLwf+HudZKrDZyPCq7x1bn2zokAq4cPsTOIGOlCOAQl3 bkQXk3P0pkU1otptRjiG8h6f5eAteDTS3tZVKM9Sx66ZHdDx/x7lkCoL3d1xzzBcLget Mt3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779281542; x=1779886342; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RPr2sjQVxk1gAzeHuQ/C99sFybgLvBxV0RLYSJro0Mw=; b=C7pSKd3yeMhoSYx+XlnSRBzsYCeQbdRWLVpX48hvKspUY/K029GQB7VHtPR3pAtLes BaFUCbrlHE+xoIKVp8n0rxTkxZb/HdaSVEAg8wNY8mOnmtjtuhHKtIWzGOachYJyAQ91 /C16cnfZACC6Kyp0EYb8SzwW235OgByR473Xmzt35m3I8A2wWA08YbpOWMj6lAElYmMU xcL47mx87KN3kpO8f1+V1zVnveMtLtmrMZ64vGVJBsgS0ozAQQEdCAYs4rZCC7RuLk9S XUPzFm5n0mtdxcQ+0lFxxsxM3TVUwv6KuZp12G8b3c+Q1hESB/gghgHLDiKY0VXePCcZ veww== X-Forwarded-Encrypted: i=1; AFNElJ/6d7vBosBTES6PiJ7ToR5xLqgk7Ki3NIrNWETcD1TKsZRrl29F4WGs4W7wzE53G6bowyIejVZQhQoBVwI=@vger.kernel.org X-Gm-Message-State: AOJu0YxOmaArXW4TYCwCn6S0Erm2dcMbgI1yaSI/QaIlmY9ulpJAL2Ke w4D77v30nfgs+IRlojD6AVFNmEn4+A45IgrvWRksTc6BBuuKOP4B0oXpgjIHUO1yJATZKgMAbwR 3AVO1kC55L1DPbT5FYz3GRkMUAIg9AX+mYWhM8UwTw4uZLeR4vUA3c7/IA53HHOyEVbbGIh/c9H g= X-Gm-Gg: Acq92OF+MH6ZAKBa2FSTbQLPCwtR9XFqp0EGW3YtlkRjL4vNeew0f2C6+zhO0wAxgZj 153AnIBvYERhlILJSLN2omFhZ+r4CJEv6Z1uei0Sz2taeBE544BcH/JLZ0OFh/vpSHJJrYdSsQL YQ4Fr9RZibyOQhNMcH5QF0+vOcp10WvuAUlOguDcWYacxYrIQ32UMSjEUbpi8sZ1Pt0TRM6Ib7a VXlhNv5G35mdwLwr0R2yUY54mltmFIhj3l6apdHSXwcvxzWMwJ/KpkYsoiJMlUmUGx6pgGFAAoO G0qSyy4ZVJWXRayoY0FX/vbyFOodWWNVs/vBCG5N9F9/6Yz/Ul/NBtQ/iEIt2Gf4q6XR9RpnxTI +Q3DPXG+3FBkgE8f3xgJto8QWAtIKJc7taTHIQBtLECaWX733N01EUxlxKjIK1L56cDCYCR3qr7 YW6SWhsnlodhYPTp6IMiAAQ07WiWZEInEixYw= X-Received: by 2002:a05:622a:8e1c:b0:516:508b:bf4d with SMTP id d75a77b69052e-5165a276f74mr218948291cf.56.1779281541596; Wed, 20 May 2026 05:52:21 -0700 (PDT) X-Received: by 2002:a05:622a:8e1c:b0:516:508b:bf4d with SMTP id d75a77b69052e-5165a276f74mr218947901cf.56.1779281541010; Wed, 20 May 2026 05:52:21 -0700 (PDT) Received: from umbar.lan (2001-14ba-a073-af00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a073:af00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a90f10c8b2sm4920527e87.17.2026.05.20.05.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 05:52:20 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 20 May 2026 15:52:17 +0300 Subject: [PATCH v5] media: iris: drop struct iris_fmt 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: <20260520-iris-remote-fmts-v5-1-a4915476c072@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAICuDWoC/33RzW7DIAwH8FeJOI/OfISUnvYe0w6QOCvSCCvQq FXVd6/THtZDugvSH9k/S/aFFcwBC9s1F5ZxDiWkiUL71rB+76Zv5GGgzCRIA0oIHnIoPGNMFfk Ya+GtUsr00m+tA0ZtvxnHcLqTn1+U96HUlM/3CbNYfv/BZsEFHxBAa90qb7YfqZTN4eh++hTjh h62mLN8dtSKI8nBwQvRWeWFNS8c9eQoWHEUOU4a5y1aECBeOPrPaaFbcTQ5nRydRelGaWHFuT6 Wl/FwpDPUxwaZdwX5UhTqrpnwVN+jKxUz1V9v5qdTcb4BAAA= X-Change-ID: 20260311-iris-remote-fmts-53336c2b89a0 To: Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=16886; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=a1x3PX1iaKMLfxjA33XePNA+XnOVe9pJTH02fuVJBIg=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBqDa6D+s25Eq16BrZaLMbVRBT1kxRXvrl6e9rqF 4IQeinOMmuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCag2ugwAKCRCLPIo+Aiko 1YkgB/4zZK2KrZ5PcXCYFIdhNmoYOeUd05kYfFdi1jGIaJ5Z/msm+cxifu2aEMF5joddFTr+yxZ ZrZDgNacvCtfhdnIaX/mtNJLK4O5pnoZnCLFQOFIg9a7LzXLyzwEXpQcfhbB7G479QwY7Q7ayQe 3A3GLcZkFuRZx0vmnoP9xn05JbwtL0/HIBwaVvtggRNbujPCuk+XCynvojRpB0wN1+agTMQ5HRI rJFmVCbHmq+sVta3OBh8Zn8zZSFKLziNrx8QjUKYRk3qeQ3w63xL6VOQm1HW1FsDemtWJ/6Mpkj dN9cs3Ue63DLzNcJSS4XneUJqvFU0LsSikpwgRduyy9uTfYR X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-GUID: dHL8h-Y4C3iYLvJ6H6gBJUJ5YcOdc-wx X-Proofpoint-ORIG-GUID: dHL8h-Y4C3iYLvJ6H6gBJUJ5YcOdc-wx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIwMDEyNSBTYWx0ZWRfX76ILI4v3Nx4M 2oWvmqcZnczAaDMGtrRtOnq8DaHi2BsIkwwX2gcbABMO1mSVcCOmDrlKxwB/QvBjS0jeRzvvQe1 sb5OCsJ3LvVA9x1F+huFFq7w5YRmKbx474lHrq1C2r4gZd0sEDYCLcIzG4T5eg+a5zh76oJK8Ms relAugzcG5Qpz5KzxhhDijK76mKy9Ql9uTbUbg14NnSy3fYhNiNNi2mnSFcGfBe/HKVgnofRMyj jE784du7RvMHnvIG7B3jT1X/gXkqAvYm7eRqNwfkDgSAPZSwsPqiigJdlsu9I73kZlTFmm/S5Mb tXfRBY0IGxLjrxDw2DVkLLmZIW7GslGiXnDYfYCb/MSW6zj8ZFVcVT4i5UoP/1Q7W4+Gz/eSb32 IuNJQs5Fe7PQ/CXtcFekmeDu83t8viYvyDgWG741/JBE8QKmv1gSAsSbb4XlhWTS9wuJXVL3iwt NMNU0OL+EoBNL/tC9Cw== X-Authority-Analysis: v=2.4 cv=FesHAp+6 c=1 sm=1 tr=0 ts=6a0dae86 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=bC-a23v3AAAA:8 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=5MaIgx6z3_532Kf81nQA:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 a=FO4_E8m0qiDe52t0p3_H:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-20_02,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 priorityscore=1501 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605200125 The struct iris_fmt unites pixfmt with the plane type, however the type from the struct is not actually used. Drop the struct completely and use u32 pixfmt in all the callsites. Reviewed-by: Dikshita Agarwal Signed-off-by: Dmitry Baryshkov --- Changes in v5: - Rebased on linux-next tree, dropping the dependencies. - Link to v4: https://patch.msgid.link/20260507-iris-remote-fmts-v4-1-72fa9= e2af290@oss.qualcomm.com Changes in v4: - Rebased on top of Bryan's -next tree, fixing the conflicts. - Link to v3: https://patch.msgid.link/20260330-iris-remote-fmts-v3-1-a26ab= 9e90101@oss.qualcomm.com Changes in v3: - Rebased on top of the 20260227-iris-platform-data-c5c80e84d1a7:v11 (Dikshita) - Link to v2: https://lore.kernel.org/r/20260313-iris-remote-fmts-v2-1-edb1= 1793b196@oss.qualcomm.com Changes in v2: - Made platform_fmts_sm8250_dec const (Dikshita) - Sorted entries in find_format_by_index (Dikshita) - Link to v1: https://lore.kernel.org/r/20260311-iris-remote-fmts-v1-1-de00= 44453b68@oss.qualcomm.com --- drivers/media/platform/qcom/iris/iris_instance.h | 5 -- .../platform/qcom/iris/iris_platform_common.h | 2 +- .../media/platform/qcom/iris/iris_platform_vpu2.c | 17 +--- .../media/platform/qcom/iris/iris_platform_vpu3x.c | 22 ++--- drivers/media/platform/qcom/iris/iris_vdec.c | 78 ++++++++---------- drivers/media/platform/qcom/iris/iris_venc.c | 96 +++++++++---------= ---- 6 files changed, 80 insertions(+), 140 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_instance.h b/drivers/med= ia/platform/qcom/iris/iris_instance.h index 352af99699dd..476efa4d6a03 100644 --- a/drivers/media/platform/qcom/iris/iris_instance.h +++ b/drivers/media/platform/qcom/iris/iris_instance.h @@ -29,11 +29,6 @@ enum iris_fmt_type_cap { IRIS_FMT_QC08C, }; =20 -struct iris_fmt { - u32 pixfmt; - u32 type; -}; - /** * struct iris_inst - holds per video instance parameters * diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index 6a108173be35..0408d51188b2 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -280,7 +280,7 @@ struct iris_platform_data { const char * const *controller_rst_tbl; unsigned int controller_rst_tbl_size; u64 dma_mask; - struct iris_fmt *inst_iris_fmts; + const u32 *inst_iris_fmts; u32 inst_iris_fmts_size; struct platform_inst_caps *inst_caps; const struct tz_cp_config *tz_cp_config_data; diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c b/driver= s/media/platform/qcom/iris/iris_platform_vpu2.c index 41986af8313b..6e06a32822bb 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu2.c @@ -28,19 +28,10 @@ static const struct iris_firmware_desc iris_vpu20_p4_ge= n1_desc =3D { .fwname =3D "qcom/vpu/vpu20_p4.mbn", }; =20 -static struct iris_fmt iris_fmts_vpu2_dec[] =3D { - [IRIS_FMT_H264] =3D { - .pixfmt =3D V4L2_PIX_FMT_H264, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_HEVC] =3D { - .pixfmt =3D V4L2_PIX_FMT_HEVC, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_VP9] =3D { - .pixfmt =3D V4L2_PIX_FMT_VP9, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, +static const u32 iris_fmts_vpu2_dec[] =3D { + [IRIS_FMT_H264] =3D V4L2_PIX_FMT_H264, + [IRIS_FMT_HEVC] =3D V4L2_PIX_FMT_HEVC, + [IRIS_FMT_VP9] =3D V4L2_PIX_FMT_VP9, }; =20 static struct platform_inst_caps platform_inst_cap_vpu2 =3D { diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c b/drive= rs/media/platform/qcom/iris/iris_platform_vpu3x.c index c249ff827541..85aa0c87338b 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c @@ -41,23 +41,11 @@ static const struct iris_firmware_desc iris_vpu35_p4_ge= n2_desc =3D { .fwname =3D "qcom/vpu/vpu35_p4.mbn", }; =20 -static struct iris_fmt iris_fmts_vpu3x_dec[] =3D { - [IRIS_FMT_H264] =3D { - .pixfmt =3D V4L2_PIX_FMT_H264, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_HEVC] =3D { - .pixfmt =3D V4L2_PIX_FMT_HEVC, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_VP9] =3D { - .pixfmt =3D V4L2_PIX_FMT_VP9, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_AV1] =3D { - .pixfmt =3D V4L2_PIX_FMT_AV1, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, +static const u32 iris_fmts_vpu3x_dec[] =3D { + [IRIS_FMT_H264] =3D V4L2_PIX_FMT_H264, + [IRIS_FMT_HEVC] =3D V4L2_PIX_FMT_HEVC, + [IRIS_FMT_VP9] =3D V4L2_PIX_FMT_VP9, + [IRIS_FMT_AV1] =3D V4L2_PIX_FMT_AV1, }; =20 static const struct icc_info iris_icc_info_vpu3x[] =3D { diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/p= latform/qcom/iris/iris_vdec.c index dfccfb274492..762459d43e8e 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -61,23 +61,16 @@ int iris_vdec_inst_init(struct iris_inst *inst) return iris_ctrls_init(inst); } =20 -static const struct iris_fmt iris_vdec_formats_cap[] =3D { - [IRIS_FMT_NV12] =3D { - .pixfmt =3D V4L2_PIX_FMT_NV12, - .type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - }, - [IRIS_FMT_QC08C] =3D { - .pixfmt =3D V4L2_PIX_FMT_QC08C, - .type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - }, +static const u32 iris_vdec_formats_cap[] =3D { + [IRIS_FMT_NV12] =3D V4L2_PIX_FMT_NV12, + [IRIS_FMT_QC08C] =3D V4L2_PIX_FMT_QC08C, }; =20 -static const struct iris_fmt * -find_format(struct iris_inst *inst, u32 pixfmt, u32 type) +static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type) { - const struct iris_fmt *fmt =3D NULL; - unsigned int size =3D 0; - unsigned int i; + unsigned int size, i; + const u32 *fmt; + switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: fmt =3D inst->core->iris_platform_data->inst_iris_fmts; @@ -88,25 +81,21 @@ find_format(struct iris_inst *inst, u32 pixfmt, u32 typ= e) size =3D ARRAY_SIZE(iris_vdec_formats_cap); break; default: - return NULL; + return false; } =20 for (i =3D 0; i < size; i++) { - if (fmt[i].pixfmt =3D=3D pixfmt) - break; + if (fmt[i] =3D=3D pixfmt) + return true; } =20 - if (i =3D=3D size || fmt[i].type !=3D type) - return NULL; - - return &fmt[i]; + return false; } =20 -static const struct iris_fmt * -find_format_by_index(struct iris_inst *inst, u32 index, u32 type) +static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 typ= e) { - const struct iris_fmt *fmt =3D NULL; - unsigned int size =3D 0; + unsigned int size; + const u32 *fmt; =20 switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -118,18 +107,18 @@ find_format_by_index(struct iris_inst *inst, u32 inde= x, u32 type) size =3D ARRAY_SIZE(iris_vdec_formats_cap); break; default: - return NULL; + return 0; } =20 - if (index >=3D size || fmt[index].type !=3D type) - return NULL; + if (index >=3D size) + return 0; =20 - return &fmt[index]; + return fmt[index]; } =20 int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) { - const struct iris_fmt *fmt; + u32 fmt; =20 switch (f->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -137,14 +126,14 @@ int iris_vdec_enum_fmt(struct iris_inst *inst, struct= v4l2_fmtdesc *f) if (!fmt) return -EINVAL; =20 - f->pixelformat =3D fmt->pixfmt; + f->pixelformat =3D fmt; f->flags =3D V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_DYN_RESOLUTION; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: fmt =3D find_format_by_index(inst, f->index, f->type); if (!fmt) return -EINVAL; - f->pixelformat =3D fmt->pixfmt; + f->pixelformat =3D fmt; break; default: return -EINVAL; @@ -157,15 +146,15 @@ int iris_vdec_try_fmt(struct iris_inst *inst, struct = v4l2_format *f) { struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; struct v4l2_m2m_ctx *m2m_ctx =3D inst->m2m_ctx; - const struct iris_fmt *fmt; struct v4l2_format *f_inst; struct vb2_queue *src_q; + bool supported; =20 memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); - fmt =3D find_format(inst, pixmp->pixelformat, f->type); + supported =3D check_format(inst, pixmp->pixelformat, f->type); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - if (!fmt) { + if (!supported) { f_inst =3D inst->fmt_src; f->fmt.pix_mp.width =3D f_inst->fmt.pix_mp.width; f->fmt.pix_mp.height =3D f_inst->fmt.pix_mp.height; @@ -173,7 +162,7 @@ int iris_vdec_try_fmt(struct iris_inst *inst, struct v4= l2_format *f) } break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: - if (!fmt) { + if (!supported) { f_inst =3D inst->fmt_dst; f->fmt.pix_mp.pixelformat =3D f_inst->fmt.pix_mp.pixelformat; f->fmt.pix_mp.width =3D f_inst->fmt.pix_mp.width; @@ -222,7 +211,7 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2= _format *f) =20 switch (f->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - if (!(find_format(inst, f->fmt.pix_mp.pixelformat, f->type))) + if (!check_format(inst, f->fmt.pix_mp.pixelformat, f->type)) return -EINVAL; =20 fmt =3D inst->fmt_src; @@ -260,7 +249,7 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2= _format *f) inst->crop.height =3D f->fmt.pix_mp.height; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: - if (!(find_format(inst, f->fmt.pix_mp.pixelformat, f->type))) + if (!check_format(inst, f->fmt.pix_mp.pixelformat, f->type)) return -EINVAL; =20 fmt =3D inst->fmt_dst; @@ -289,16 +278,13 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4= l2_format *f) =20 int iris_vdec_validate_format(struct iris_inst *inst, u32 pixelformat) { - const struct iris_fmt *fmt =3D NULL; + bool supported; =20 - fmt =3D find_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE= ); - if (!fmt) { - fmt =3D find_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE= ); - if (!fmt) - return -EINVAL; - } + supported =3D check_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_CAPTURE= _MPLANE); + if (!supported) + supported =3D check_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_OUTPUT= _MPLANE); =20 - return 0; + return supported ? 0 : -EINVAL; } =20 int iris_vdec_subscribe_event(struct iris_inst *inst, const struct v4l2_ev= ent_subscription *sub) diff --git a/drivers/media/platform/qcom/iris/iris_venc.c b/drivers/media/p= latform/qcom/iris/iris_venc.c index c11fee4799cd..a945992f63aa 100644 --- a/drivers/media/platform/qcom/iris/iris_venc.c +++ b/drivers/media/platform/qcom/iris/iris_venc.c @@ -79,34 +79,21 @@ int iris_venc_inst_init(struct iris_inst *inst) return iris_ctrls_init(inst); } =20 -static const struct iris_fmt iris_venc_formats_cap[] =3D { - [IRIS_FMT_H264] =3D { - .pixfmt =3D V4L2_PIX_FMT_H264, - .type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - }, - [IRIS_FMT_HEVC] =3D { - .pixfmt =3D V4L2_PIX_FMT_HEVC, - .type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - }, +static const u32 iris_venc_formats_cap[] =3D { + [IRIS_FMT_H264] =3D V4L2_PIX_FMT_H264, + [IRIS_FMT_HEVC] =3D V4L2_PIX_FMT_HEVC, }; =20 -static const struct iris_fmt iris_venc_formats_out[] =3D { - [IRIS_FMT_NV12] =3D { - .pixfmt =3D V4L2_PIX_FMT_NV12, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, - [IRIS_FMT_QC08C] =3D { - .pixfmt =3D V4L2_PIX_FMT_QC08C, - .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - }, +static const u32 iris_venc_formats_out[] =3D { + [IRIS_FMT_NV12] =3D V4L2_PIX_FMT_NV12, + [IRIS_FMT_QC08C] =3D V4L2_PIX_FMT_QC08C, }; =20 -static const struct iris_fmt * -find_format(struct iris_inst *inst, u32 pixfmt, u32 type) +static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type) { - const struct iris_fmt *fmt =3D NULL; - unsigned int size =3D 0; - unsigned int i; + unsigned int size, i; + const u32 *fmt; + switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: fmt =3D iris_venc_formats_out; @@ -117,25 +104,21 @@ find_format(struct iris_inst *inst, u32 pixfmt, u32 t= ype) size =3D ARRAY_SIZE(iris_venc_formats_cap); break; default: - return NULL; + return false; } =20 for (i =3D 0; i < size; i++) { - if (fmt[i].pixfmt =3D=3D pixfmt) - break; + if (fmt[i] =3D=3D pixfmt) + return true; } =20 - if (i =3D=3D size || fmt[i].type !=3D type) - return NULL; - - return &fmt[i]; + return false; } =20 -static const struct iris_fmt * -find_format_by_index(struct iris_inst *inst, u32 index, u32 type) +static u32 find_format_by_index(struct iris_inst *inst, u32 index, u32 typ= e) { - const struct iris_fmt *fmt =3D NULL; - unsigned int size =3D 0; + unsigned int size; + const u32 *fmt; =20 switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -147,18 +130,18 @@ find_format_by_index(struct iris_inst *inst, u32 inde= x, u32 type) size =3D ARRAY_SIZE(iris_venc_formats_cap); break; default: - return NULL; + return 0; } =20 - if (index >=3D size || fmt[index].type !=3D type) - return NULL; + if (index >=3D size) + return 0; =20 - return &fmt[index]; + return fmt[index]; } =20 int iris_venc_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) { - const struct iris_fmt *fmt; + u32 fmt; =20 switch (f->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -166,14 +149,14 @@ int iris_venc_enum_fmt(struct iris_inst *inst, struct= v4l2_fmtdesc *f) if (!fmt) return -EINVAL; =20 - f->pixelformat =3D fmt->pixfmt; + f->pixelformat =3D fmt; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: fmt =3D find_format_by_index(inst, f->index, f->type); if (!fmt) return -EINVAL; =20 - f->pixelformat =3D fmt->pixfmt; + f->pixelformat =3D fmt; f->flags =3D V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_ENC_CAP_FRAME_INTE= RVAL; break; default: @@ -186,14 +169,14 @@ int iris_venc_enum_fmt(struct iris_inst *inst, struct= v4l2_fmtdesc *f) int iris_venc_try_fmt(struct iris_inst *inst, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; - const struct iris_fmt *fmt; struct v4l2_format *f_inst; + bool supported; =20 memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); - fmt =3D find_format(inst, pixmp->pixelformat, f->type); + supported =3D check_format(inst, pixmp->pixelformat, f->type); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - if (!fmt) { + if (!supported) { f_inst =3D inst->fmt_src; f->fmt.pix_mp.width =3D f_inst->fmt.pix_mp.width; f->fmt.pix_mp.height =3D f_inst->fmt.pix_mp.height; @@ -201,7 +184,7 @@ int iris_venc_try_fmt(struct iris_inst *inst, struct v4= l2_format *f) } break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: - if (!fmt) { + if (!supported) { f_inst =3D inst->fmt_dst; f->fmt.pix_mp.width =3D f_inst->fmt.pix_mp.width; f->fmt.pix_mp.height =3D f_inst->fmt.pix_mp.height; @@ -222,17 +205,17 @@ int iris_venc_try_fmt(struct iris_inst *inst, struct = v4l2_format *f) =20 static int iris_venc_s_fmt_output(struct iris_inst *inst, struct v4l2_form= at *f) { - const struct iris_fmt *venc_fmt; struct v4l2_format *fmt; u32 codec_align; + bool supported; =20 iris_venc_try_fmt(inst, f); =20 - venc_fmt =3D find_format(inst, f->fmt.pix_mp.pixelformat, f->type); - if (!venc_fmt) + supported =3D check_format(inst, f->fmt.pix_mp.pixelformat, f->type); + if (!supported) return -EINVAL; =20 - codec_align =3D venc_fmt->pixfmt =3D=3D V4L2_PIX_FMT_HEVC ? 32 : 16; + codec_align =3D (f->fmt.pix_mp.pixelformat =3D=3D V4L2_PIX_FMT_HEVC) ? 32= : 16; =20 fmt =3D inst->fmt_dst; fmt->type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; @@ -275,7 +258,7 @@ static int iris_venc_s_fmt_input(struct iris_inst *inst= , struct v4l2_format *f) =20 iris_venc_try_fmt(inst, f); =20 - if (!(find_format(inst, f->fmt.pix_mp.pixelformat, f->type))) + if (!check_format(inst, f->fmt.pix_mp.pixelformat, f->type)) return -EINVAL; =20 fmt =3D inst->fmt_src; @@ -344,16 +327,13 @@ int iris_venc_s_fmt(struct iris_inst *inst, struct v4= l2_format *f) =20 int iris_venc_validate_format(struct iris_inst *inst, u32 pixelformat) { - const struct iris_fmt *fmt =3D NULL; + bool supported; =20 - fmt =3D find_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); - if (!fmt) { - fmt =3D find_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLAN= E); - if (!fmt) - return -EINVAL; - } + supported =3D check_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_OUTPUT_= MPLANE); + if (!supported) + supported =3D check_format(inst, pixelformat, V4L2_BUF_TYPE_VIDEO_CAPTUR= E_MPLANE); =20 - return 0; + return supported ? 0 : -EINVAL; } =20 int iris_venc_subscribe_event(struct iris_inst *inst, --- base-commit: 687da68900cd1a46549f7d9430c7d40346cb86a0 change-id: 20260311-iris-remote-fmts-53336c2b89a0 Best regards, -- =20 With best wishes Dmitry