From nobody Mon Jun 8 11:02:04 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 19CB3239E76 for ; Fri, 29 May 2026 14:26:21 +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=1780064783; cv=none; b=ml+gdOVb0+a0MIfw1wfLsgQ3umrIDGnS0EA1MiSO0TnVR1t/lOneLbZjCVno1hDnL4RxWjgc3WYwSFyzjAsfeeJtORH32CwPd0PywTL+JSH1dLnc/I7HZBPPOaJHok37TmsQxM+zfo0Hz/Cg4AhHyhDaqcD+L3sdNLO8usX2iRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780064783; c=relaxed/simple; bh=KUxCyFLwxpiqUlho6ILAtO9rD6Sxu4LZsggc6KDtVws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=mlxjlY1BR5S48yUjDSIuvyjOI7Ly4nCe/88J3MIx3cenpOSUxL56KE3Nh+0KXgGZxsSxM6OsJviyW3xDyTuW1KIPlDY2cQen7YgDPSMjsYpeER80hKxCafHtbbjzRMCJ9r7djxDTGbwGmo0PJiko276ZhVz7b5d1NpBSWHqBRm4= 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=fcfEZPZA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ipCyjECm; 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="fcfEZPZA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ipCyjECm" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64TDaLW91279273 for ; Fri, 29 May 2026 14:26:21 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=tyjO8bpcivel8QxC8pyFpK Ak55fczHbnOqXf4pxmoac=; b=fcfEZPZA0ZRrhuBDJ3KNZucqHDgUrsrzk59oIm sy/j9xooBnTPvKE7EzkYIky1J/hOccvR0XxzP13giWtL75urRtRye5dvLTK3VngJ ysTDDx3bB3PnGbwEZKFdeoOxAG0Ibjwhliu1UbACRwtDnfhix6vvtCxoIAqF1irQ MfSU5/e2Wo7b0FWxSlimtZeso+g9PBSsh/+bf4Fcrb0xPpLu8djJ5OynpmofSnho GVtYcpnzY00dd38Yb+q+Z885xbvz/nIwMFjJ/eR2+5RewiX27Y4cH4Clxx1CmpK4 QEjgjGaKHMZczaw+/yENeFtd0auQc898/Fbkp6eqgTeiiU7Q== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4efbu5072y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 29 May 2026 14:26:21 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-6a2b8b91dc5so1726013137.2 for ; Fri, 29 May 2026 07:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1780064780; x=1780669580; 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=tyjO8bpcivel8QxC8pyFpKAk55fczHbnOqXf4pxmoac=; b=ipCyjECmGcwx2GV9AQyiQjBZpxqijBD6c4WCGC8cHu1+dmtA9dXY/VVYZPWPIgoNo6 YZrYx/1DQfPktxJ6Ewz0Mw9uz6gQdg4jRswt2WqQ0ENxrlZLeP2KiKi/l1sry+ca8+dw 9zMaHpZR1g2/l8CR0A71alT6NtCe6oqbdjZcoRjMkDT0j0Jy952aNLhcqdI74c2p/5MA cINNTAsat8XUwqccPg+eArq+sk20J8R2ZTtCJJRLiirDHcjiXwPAVYsy6Ig7/G2WS78m nWAkjtfbES9h3hy/vSYQ644Pmm7RVPsALOzhp+fIjj7ngLJvjprn61Id3XImXi1srJ/n /8yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780064780; x=1780669580; 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=tyjO8bpcivel8QxC8pyFpKAk55fczHbnOqXf4pxmoac=; b=a5faw4ICbTlL4irmbE6kySWp2J1JVm0Wwk4IiPEJRgZlMK9/xOVROnptR6DS/rpUF2 e+wSf9+nyDRJav3N5w0ZOivgRQN02COH37SkupJiHzq5Eb9mlutgMdWxhVOfNf0/jrr8 DqBVn+APQaP1r99RKUOvK+hR9zrJKnU+4cGJOTPFkls1E97a8lCTBVKJrnAcncI6MvFl 6kISRE56ZeCJQn9094h0grlajUDZ1WU8QXPLmfxzCgVPxiv6bNGGw9XzLXMGgWhSbCWz UTghsexxhzp8nh8JZ/G2vT142PHEWyANR/1EcxwOeMbSDXzAsjXVLC5PQ26cL5zASfha aN1A== X-Forwarded-Encrypted: i=1; AFNElJ/P+E7aA34QDtXxXpn7IG51X8EJY41wrJd8U/mlCIvyNpJFfDvLX0LfzjptUYPcuNSZCn9dJUZXLiL9AxU=@vger.kernel.org X-Gm-Message-State: AOJu0YzfQqYDweEHNJ+xMa1ido+BS4bv321m1rVWyiPKMAAPRFEqKMpa ETOsjQH3BqHhnoIbhV3pCUe6oNJtauu6SKKkL7rvdsSVlubdyAwcgomScal8HfxjWlwByEY7gFW tP7jXpGiToa7/uWQU/5lpR2i9NSMKC7aGGaMWGI8gqzqOyPubQH535AtdTy9tMIxB580= X-Gm-Gg: Acq92OFiL97BVJOGbgtkyS3zFIEfIATpP0riN56vydk9XmTh1uuU+ITLXq3bFj+8mQg BxbXlNqznZknyNQZJ1MM3kdd/bSSi5gzijWYNUTmntn3h6J1yk634Z+ymXWUp4RlPpIJGq9XWiQ XTsagETDt3hQRfHa3ch+GiA/wFFM0sNr3r/WqCXim9T8inf2FwTBZfeK7Fv7JSBldIeAe3dPMK0 tP/LWZ1Nzvn2KjiU1GLOcAXZhNS3NOLo7XpULV59m04FVAeYnabPClYAeD1QnzGddqrWzGnLFi0 ugzUm+PbHAoOx09BHJib+xp3JJNq15wT565FvE4DgJLdr5k7AHL9K7Ay2G13XMM1CrN/CHxnm2w y0EYCPPW+Da5AVqgthkkFcpb5JtMlSYLdQU2/0DpD61dE9QiuhYfmvPvDzHJ6YntVh7HZynCBCy XIWBkK8YNvGLLvoH2wCKEZ3PV4wp762GWnMK2VXYoV0eCR4A== X-Received: by 2002:a05:6122:e183:b0:588:33d2:9249 with SMTP id 71dfb90a1353d-599f6abd415mr1171488e0c.8.1780064775175; Fri, 29 May 2026 07:26:15 -0700 (PDT) X-Received: by 2002:a05:6122:e183:b0:588:33d2:9249 with SMTP id 71dfb90a1353d-599f6abd415mr1171428e0c.8.1780064774067; Fri, 29 May 2026 07:26:14 -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-5aa5fa14d3bsm21445e87.70.2026.05.29.07.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 07:26:12 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 29 May 2026 17:26:11 +0300 Subject: [PATCH v7] 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: <20260529-iris-remote-fmts-v7-1-a8bd57ac8b5a@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAAKiGWoC/33SS27DIBAG4KtYrEvKm5BV71F1Afa4QartBLCVK srdO3ak1gu7G6QfMR8jhjvJkCJkcqruJMEUcxx6DPalIvXZ959AY4OZCCYMk5zTmGKmCbqhAG2 7kqmWUppahKPzjGDZJUEbbwv5/oH5HHMZ0vdyw8Tn3X+wiVNOG2BMKaVlMMe3IefDdfRf9dB1B 1zIbE5i7cgNR6ADTeDcOhm4MzuOXDmSbTgSHS+MDw4c44zvOOrP0cxuOAodK1rvQPhWOLbj6JU jtvrRcz/Kca2sqZkVO45ZO27DMego72WLT+2DbDacx3OYCa4jfovynCgJPgOdD8Vyqha3h1t5n aAfM/3NWP34AWY7zuZcAgAA 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=17547; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=KUxCyFLwxpiqUlho6ILAtO9rD6Sxu4LZsggc6KDtVws=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBqGaIE74WDGJaeyrJJjsmpTWeocfbig2BhAJu4t eXGtmyHfpmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCahmiBAAKCRCLPIo+Aiko 1fYaB/0fnXNr3u4LX+XCXq4mTwp5ta1T43o3/uAeli4QXNCorQbUGnJg2AArndWMPfjUZzZbxOl RMagABhV80JGSitDEM04H8I+p7EY9RUnkfED5QnUCq23mH2taZ3PWsc3W8M2ygWf4RYsHP0uhRc X/mEmZrCxwowXwrigdAS2Y8OZJPWE0q+fsurP91YzywQ34LkEIsATQvh7qp0L7lyPEx98mjP+/a X1fKTHZbTWRjeBBQ8Qlg6do7B0aip5sWVLB6AGZMIUC1RzXdAVyoqQ1ezxxJhv+Ysj7TvcKZqkG siZTm2w84qnudbCe0qPmyOFjYqkqhXuyYnQIql/TjPadavLf X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Authority-Analysis: v=2.4 cv=SMRykuvH c=1 sm=1 tr=0 ts=6a19a20d cx=c_pps a=DUEm7b3gzWu7BqY5nP7+9g==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=bC-a23v3AAAA:8 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=GGcHrp4e3dvwrM2hqOMA:9 a=QEXdDO2ut3YA:10 a=-aSRE8QhW-JAV6biHavz:22 a=FO4_E8m0qiDe52t0p3_H:22 X-Proofpoint-GUID: kU3Rgi8UpMC2OU-lgNyUQmF2Ef8fQPPk X-Proofpoint-ORIG-GUID: kU3Rgi8UpMC2OU-lgNyUQmF2Ef8fQPPk X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI5MDE0NCBTYWx0ZWRfXzcRpKkBIPy30 p70qnwb+oPBP/0O71Hs3RlqCTVNUuNwUEkk3HGF71UWOJ8886TGgDOKTA9lvIsG6HYjwPMDprXi ywhYBz/WDbp7eMUx96pmH9jWNQDTx+6ikAClKYgYsbWGwzAgm0qmu9+JsXtb5WCRSLFfv8HkXy4 M/dfXpwBgTteIVmPWz5D051mLThC5PdirwhsVykswknU12BYVslYj0yyOkftcq0DUmUAOxNs20m d/W1ErWTiMhh7ULM0Z/6w95SSix2UXeY/0mxYZfDCdLHy4Bc/Eajf+vlxuQOQ7z8BlHfisA8QF3 Zl15o6kz17xuMfM59x1CQoiSbPI94qUocRV2093M/Vs21z66kqiHuAop5HbGctKYQWWZ2BNH5bo amvDwt3J+Ph897u2djk4sd15/53BsTME/1oC6J2jmS19Z1UfRhYRTfAwRbe8OiBizzqB2pjv5w3 Q6cP9H4RGVFRi5jgwkw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-29_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 phishscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2605290144 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 v7: - ... and fix the build failure - Link to v6: https://patch.msgid.link/20260529-iris-remote-fmts-v6-1-4aa3f= 004ab3d@oss.qualcomm.com Changes in v6: - Another rebase, now on Bryan's -next tree, again - Link to v5: https://patch.msgid.link/20260520-iris-remote-fmts-v5-1-a4915= 476c072@oss.qualcomm.com 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 To: Vikash Garodia To: Dikshita Agarwal To: Abhinav Kumar To: Bryan O'Donoghue To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- 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 1d8a22ea4809..c54d8ec8562a 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 982767faa51c..6d69a1e3dcd3 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -311,7 +311,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 541ddc40e3ae..2c63adbc5579 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c +++ b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c @@ -48,23 +48,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 dc7b051f2d01..b65832042dc8 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -68,23 +68,16 @@ void iris_vdec_inst_deinit(struct iris_inst *inst) kfree(inst->fmt_src); } =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; @@ -95,25 +88,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: @@ -125,18 +114,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: @@ -144,14 +133,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; @@ -164,15 +153,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; @@ -180,7 +169,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; @@ -229,7 +218,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; @@ -268,7 +257,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; @@ -297,16 +286,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 aeed756ee9ca..2398992d0596 100644 --- a/drivers/media/platform/qcom/iris/iris_venc.c +++ b/drivers/media/platform/qcom/iris/iris_venc.c @@ -85,34 +85,21 @@ void iris_venc_inst_deinit(struct iris_inst *inst) kfree(inst->fmt_src); } =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; @@ -123,25 +110,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: @@ -153,18 +136,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: @@ -172,14 +155,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: @@ -192,14 +175,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; @@ -207,7 +190,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; @@ -228,17 +211,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; @@ -281,7 +264,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; @@ -350,16 +333,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: c92057a181e8df8fd47426bb904c3253693cfced change-id: 20260311-iris-remote-fmts-53336c2b89a0 Best regards, -- =20 With best wishes Dmitry