Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796408705; b=jKiH0SpXvu2SnKSa987PGNwZZbf/YldfFmCirvNiBKmm8n3egA5HmR/T5LosS9u89rC1 gcFq6YmUj5R4vTPpi3gdp+JXPXRqEPhFpiHSI6DD9nYzifTQmUEOGO302xnykZvOG51Od pey/gWc4GnmPhkVDxtm5TlH/5XSWRtdpiJ9z/+n+I4zyP0IjcTDdFjyRaPMPzUeMVL9d1 Y8BJp+TJk1xyG+fBycIxFou+8FBbCksc2bTgP8iSthC7pkQ4iIbXdlDpAamxfgUY18de1 e5j44y5gbA14yg44HQRAGfUA1Dy9duaDbqydSVjUPbyyaohIU+OAE/Hm9WADHDW19rA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796408705; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Proofpoint-Spam-Details-Enc: X-Authority-Analysis:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=btDTZHdgKUU8MQci4bd7fGJOuCSUrJ+sDIMCoqn+cd0=; b=y1uz2SMzMHS9der2SPwGf8X4CdJUX0cPRdoXt8LIBUoEhkqflp176NXvw8IVciXXYCKT FOvpr5V1JrCWW0o3Qp+l3Cpw6LHHWhCVOTx/Vc6sb7IAV8Bca/EMQ+Nk/SvPeOw0FBm/u hjAz2PXq70lh0dfWwEhRK7d0FP5bnYVx0dyn5f8zgWjDT6zthVC6D7DB5sXko2fO92fDX Z0JaZcsJRg5kNYXi2535qLPNId33xwgmwc4SsBySNSpM2vXOBYKO3krMusKI36T1FDEYI EqnaA/n3VTR8gT/ntxo3uk9HmecYjEAg94C+nlZSEApvPcPY+ag4rSVCtlDZq/5o27A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=Hu0eqGeN; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Mtj19gkh; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFC36606A68D for ; Fri, 4 Dec 2026 18:25:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CFC36606A68D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=Hu0eqGeN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Mtj19gkh Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B4I6ZSf1716908 for ; Fri, 4 Dec 2026 18:25:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= btDTZHdgKUU8MQci4bd7fGJOuCSUrJ+sDIMCoqn+cd0=; b=Hu0eqGeN7wg2j4K3 hto4yXRrLwmUEyUUg+a9LqUyuk0baz2p7lr8RWW0bJK+TGgcVj5uG6hLCuI5s6yL sEWkH5JfxkAQwy+7pLMmSKjCLiY4bkrgyzwx1Ty1IdvfdFd+fpDUcsq2ArWUdwNE 1dN4IQE1UGCGCHFtoOidItqUu72fMxaDXP+iscvLh77/yZzDBTASV/R9gjfzeeIj 9I+hlE9vOyFL/IKrhCIJHAWdG6JF0L5NJ0//sxv4+UXPYGSK+Welk90YxfPX8STC DB63T32bEeMMDH03oHEn0jaTRgiXAvd825I44iKlfYviujzHa6SpjA0RI0HM8nVZ kFF9Pw== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jbq7ptff7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 04 Dec 2026 18:25:03 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-93cb7f9bb86so232132385a.2 for ; Fri, 04 Dec 2026 10:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796408703; x=1797013503; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=btDTZHdgKUU8MQci4bd7fGJOuCSUrJ+sDIMCoqn+cd0=; b=Mtj19gkhjyH3s3ki2ZfxWEhaA01i1ZerjsZ8lTpLKBkrepesgjXvVAFld6Td+tLsbg 6NmCEDaFhoR4uLCH5qqdoY2+xSPrubRg0+2FfaatylKqm8mobUzbZTUP/fuYgjrjvmTl E1O4cRR2CbXZ/fvy+v4kvF3tgIcoC/6x1s73xk5ZGcD0WCsPlR0s4w4AaWKzuRFFdtgM /8MPnc+V6L+W8Ei5Q08dm5irNHpppyhZAbmdUlrArJZQHvqlEkEhXc+ZGkCuOlLU/dIt yBmiftyQ9g9pBbXqn7lWDSl0b7DreEw5z5s8acOt/e+e0OT29k4EjgDpPWSW9AZnBIzg riYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796408703; x=1797013503; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=btDTZHdgKUU8MQci4bd7fGJOuCSUrJ+sDIMCoqn+cd0=; b=YrR4QA29b04xr/0Zynh26RTvCLyFpPueOGvN0H9ADkZiUdGsmwL8aT8Q3NEbeQ29cP THQ+Up5QFJQBoi5ZRoTZ7GrH6uBm79B2CAC0/JsMpazynwZyRcCCeqfRB8jmHST0YtIi gh+8dNH4Bf3KigWeLPuY9Ie8eVNNWVHYzwAHu/P4saXWY2zBNMSJCbj86wq4BAkVpKos RbBbvpAKRzThW8qH8NeLt6KUvbllo1CyTb4+GT3zI60Nm+XKNPGlSZEM4mbFrWpgkRrN 2LuhriqP2YFxtprjA6EtWCY5Rh0BYlIcN632A8gttPnND7cQb1/BTIVFqV60xXCTnf4s WB/Q== X-Forwarded-Encrypted: i=1; AL+hErH9SYsyU+X2A4swkiJ18n0LJymDoOBp2iacBNaX0cwW/EwG8ccThNckOq3AjRm0vdTgusyJZ3QYX+yrSOTM@vger.kernel.org X-Gm-Message-State: APuU4Z8IFOvFlXU5iDkGm81SUS0qhPzEEhcfPFxq29aZjzLD2+EX91eg 32tpvg8AXkdyGivvbySm9lm2dSnVUyYG+x6Mrw2SArr4RCY4SI2gmHI0u7hOdi2bCeIbV5bS88O DaKdogFbidrlHBvphl/4yBBaEC00BNUxr7yN8hFKjdAuAHXKbuadg8Ue+BgeEcGxwc6lf X-Gm-Gg: AZFdTZdzLUhGuBmSof2BmpbH9hIU5kuJnr0Tsv/S+BaHISpf6vvf6hFsKV4uBsAz5iV si+fkW6jRvZKojqLaWPL4QhrW9WL8YXSjfJcr555pTvJyI13xTljAAKL25n8Q7NLNZwIAGOg0mR Z2mD9iI4Fjs64B/cVJCAwKmj/ZKi6Ah2dnuOGhRihJ81eAPYYnQeHUqj/ckQKdbt2arIpuOrYns qe21zQV8HxQ0SjkbSYygaZtnxMypOb763bFq0C9e0OocRa3A/fEDsDZy78OBth8vxfWt9pNFgfb 00UZfPvPnktGmwrcOMHAF0fALyrjjs4Nm55NaohII9mpMvI3Qfj/WZYgBTDaqJJPWw1rQO3MeRR OMzivN6YDpbQj5Qyfva8XP80yqw5Gpwf+jTHpoJTTmAnYDwvcxbEKxOSQXNbKwXPo6qH3g2gPMA H6AwSTlgIRHHHYYdAxKqbGE+NCsaolPRj6vWSouUzJ5J/6Zm7otbFic3liySvJSQ== X-Received: by 2002:a05:620a:600e:b0:949:615d:c79e with SMTP id af79cd13be357-94a82e13d11mr434221585a.53.1796408702907; Fri, 04 Dec 2026 10:25:02 -0800 (PST) X-Received: by 2002:a05:620a:600e:b0:949:615d:c79e with SMTP id af79cd13be357-94a82e13d11mr434215585a.53.1796408702298; Fri, 04 Dec 2026 10:25:02 -0800 (PST) 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 38308e7fff4ca-3b0037ac7fasm9647221fa.25.2026.12.04.10.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 10:25:00 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 04 Dec 2026 20:24:43 +0200 Subject: [PATCH v2 02/13] media: iris: translate Gen1 profile/level to HFI enumerants X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261204-iris-vp8-v2-2-462f9b48d246@oss.qualcomm.com> References: <20261204-iris-vp8-v2-0-462f9b48d246@oss.qualcomm.com> In-Reply-To: <20261204-iris-vp8-v2-0-462f9b48d246@oss.qualcomm.com> To: Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8789; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=1OQYxEwk6Sou4VflnHoFN/BYpxy7z1i15sks7gaKIgQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBrEwVyacenyyibN/BDLpsC27Hb4dhCoT5RWpQZL 9mGbODD0wWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCaxMFcgAKCRCLPIo+Aiko 1diUCACv0YKAxHl0V/0zVOI/1ipW7dQvw6NKxKcYYe0hK55p7TfO7isGo///+T/K8ZIBn0OGq0Q 0u8azu2myHO+Z9QmMtlzqk80z5r4qtilbxt7rZhx5bjv3MnJDBaAygKON+kUftREvecqmz12XyX 23vvA7MPAuMCSCUeCZfabWoQB2RURqzOrdqcf+ItraAckiwCPS54Z+GYj7pypovNhyEyZUluDE3 +K3XZU0OXCfAasS5v0zAJoxcD3wbhsHUsne7v7n/qKu54L8r8NEP23dSVGhUqdhsjnbKtw9saVj zLjXntx6nqu+i7pTmVwsgxEnw0sDbEeCwF2S8FNhIKm4MMaf X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA3MyBTYWx0ZWRfXyvTu9xzUpfXA XUPdw8VvAL0ciGDceQqApzKr/fMdKvcZO2xxQ4TKgcNUdhcns2cmGBC+eoFcXYWAaEAmNlswf24 +8j4oKeWyyAUhOL7tubB+qfigp6dLJwMiYeKs/lNglbYM5FsAivCEeGOJUDhFGKiJYkLOHIi72d SNg0XRkETavFh53Dn6mPmWqtwVPCHAaxtkR/mxfXzjdqiBTwl5NrcQu422YYqx5HjPw88HomkXd DeZkMaPIKTj/oe+JGDM8Vl1KCgMj3ODqgNCrk8y0Nzc0EL7WsjdVkpugYRTEtiA/gNF5ArwlkXs 1c8NOFudq/0Ly3mMnC34Ikd42WmwwGbCSAQ/+sb2Ypmu6ydw5hR54RZSVgYS+7TQjy2hfrnPOzh X6gbyFQ1v4el/QtzUDUHpAdthi02Yf8dho31PdcQFOAnMJvbxAurOmke06k/hdQFCJ25qmUmxo5 aVlGo3L71U4zAcheBIg== X-Authority-Analysis: v=2.4 cv=DMUacCNb c=1 sm=1 tr=0 ts=6b13057f cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=OLIzNnV6KVrhn8Jq-MwA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA3MyBTYWx0ZWRfX6AqW6SPzm6c5 5mN1RMg2RAKsyNu2El2pT08bWAn2rbmWiClEMhsLmOn4nDdeYNNYbq/AP4fovWa+fDpQqZXGhdW SAoZswltx2dzkw1TRnZuHykwZWho/do= X-Proofpoint-ORIG-GUID: 4Q1ZSKtDiayvYq3FpELgzZKUd9yStZJd X-Proofpoint-GUID: 4Q1ZSKtDiayvYq3FpELgzZKUd9yStZJd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-04_04,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040073 The Gen1 firmware expects the profile and level in the HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT property as HFI-specific enumerants (a one-hot bitmask), but the iris driver passed the raw V4L2 profile and level values straight through. Only the V4L2 H264 high profile happened to match its HFI value (both 0x4); every other profile and all levels were programmed with a wrong value. Translate the V4L2 profile and level to the HFI enumerants per codec before building the property, mirroring the mapping the venus driver performs for the same firmware interface. Fixes: d22037f3fd33 ("media: iris: Set platform capabilities to firmware for encoder video device") Reviewed-by: Vishnu Reddy Signed-off-by: Dmitry Baryshkov --- .../platform/qcom/iris/iris_hfi_gen1_command.c | 109 +++++++++++++++++++-- .../platform/qcom/iris/iris_hfi_gen1_defines.h | 44 +++++++++ 2 files changed, 144 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c index 47e9147a9b6d..ba0be31efa00 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c @@ -479,6 +479,105 @@ static int iris_hfi_gen1_session_drain(struct iris_inst *inst, u32 plane) return -EINVAL; } +struct iris_hfi_gen1_id_mapping { + u32 hfi_id; + u32 v4l2_id; +}; + +static const struct iris_hfi_gen1_id_mapping iris_hfi_gen1_h264_profiles[] = { + { HFI_H264_PROFILE_BASELINE, V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE }, + { HFI_H264_PROFILE_MAIN, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN }, + { HFI_H264_PROFILE_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH }, + { HFI_H264_PROFILE_STEREO_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH }, + { HFI_H264_PROFILE_MULTIVIEW_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH }, + { HFI_H264_PROFILE_CONSTRAINED_BASE, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE }, + { HFI_H264_PROFILE_CONSTRAINED_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH }, +}; + +static const struct iris_hfi_gen1_id_mapping iris_hfi_gen1_h264_levels[] = { + { HFI_H264_LEVEL_1, V4L2_MPEG_VIDEO_H264_LEVEL_1_0 }, + { HFI_H264_LEVEL_1b, V4L2_MPEG_VIDEO_H264_LEVEL_1B }, + { HFI_H264_LEVEL_11, V4L2_MPEG_VIDEO_H264_LEVEL_1_1 }, + { HFI_H264_LEVEL_12, V4L2_MPEG_VIDEO_H264_LEVEL_1_2 }, + { HFI_H264_LEVEL_13, V4L2_MPEG_VIDEO_H264_LEVEL_1_3 }, + { HFI_H264_LEVEL_2, V4L2_MPEG_VIDEO_H264_LEVEL_2_0 }, + { HFI_H264_LEVEL_21, V4L2_MPEG_VIDEO_H264_LEVEL_2_1 }, + { HFI_H264_LEVEL_22, V4L2_MPEG_VIDEO_H264_LEVEL_2_2 }, + { HFI_H264_LEVEL_3, V4L2_MPEG_VIDEO_H264_LEVEL_3_0 }, + { HFI_H264_LEVEL_31, V4L2_MPEG_VIDEO_H264_LEVEL_3_1 }, + { HFI_H264_LEVEL_32, V4L2_MPEG_VIDEO_H264_LEVEL_3_2 }, + { HFI_H264_LEVEL_4, V4L2_MPEG_VIDEO_H264_LEVEL_4_0 }, + { HFI_H264_LEVEL_41, V4L2_MPEG_VIDEO_H264_LEVEL_4_1 }, + { HFI_H264_LEVEL_42, V4L2_MPEG_VIDEO_H264_LEVEL_4_2 }, + { HFI_H264_LEVEL_5, V4L2_MPEG_VIDEO_H264_LEVEL_5_0 }, + { HFI_H264_LEVEL_51, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 }, + { HFI_H264_LEVEL_52, V4L2_MPEG_VIDEO_H264_LEVEL_5_2 }, +}; + +static const struct iris_hfi_gen1_id_mapping iris_hfi_gen1_hevc_profiles[] = { + { HFI_HEVC_PROFILE_MAIN, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN }, + { HFI_HEVC_PROFILE_MAIN_STILL_PIC, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE }, + { HFI_HEVC_PROFILE_MAIN10, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 }, +}; + +static const struct iris_hfi_gen1_id_mapping iris_hfi_gen1_hevc_levels[] = { + { HFI_HEVC_LEVEL_1, V4L2_MPEG_VIDEO_HEVC_LEVEL_1 }, + { HFI_HEVC_LEVEL_2, V4L2_MPEG_VIDEO_HEVC_LEVEL_2 }, + { HFI_HEVC_LEVEL_21, V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 }, + { HFI_HEVC_LEVEL_3, V4L2_MPEG_VIDEO_HEVC_LEVEL_3 }, + { HFI_HEVC_LEVEL_31, V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 }, + { HFI_HEVC_LEVEL_4, V4L2_MPEG_VIDEO_HEVC_LEVEL_4 }, + { HFI_HEVC_LEVEL_41, V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 }, + { HFI_HEVC_LEVEL_5, V4L2_MPEG_VIDEO_HEVC_LEVEL_5 }, + { HFI_HEVC_LEVEL_51, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1 }, + { HFI_HEVC_LEVEL_52, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2 }, + { HFI_HEVC_LEVEL_6, V4L2_MPEG_VIDEO_HEVC_LEVEL_6 }, + { HFI_HEVC_LEVEL_61, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 }, + { HFI_HEVC_LEVEL_62, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 }, +}; + +static u32 iris_hfi_gen1_find_hfi_id(u32 v4l2_id, + const struct iris_hfi_gen1_id_mapping *array, + unsigned int array_sz) +{ + unsigned int i; + + for (i = 0; i < array_sz; i++) + if (v4l2_id == array[i].v4l2_id) + return array[i].hfi_id; + + return 0; +} + +/* + * The Gen1 firmware expects profile and level as HFI enumerants, while the + * client provides raw V4L2 values. Translate them per codec, mirroring the + * mapping performed by the venus driver for the same firmware interface. + */ +static void +iris_hfi_gen1_profile_level(struct iris_inst *inst, u32 v4l2_pf, u32 v4l2_lvl, + struct hfi_profile_level *pl) +{ + switch (inst->codec) { + case V4L2_PIX_FMT_H264: + pl->profile = iris_hfi_gen1_find_hfi_id(v4l2_pf, iris_hfi_gen1_h264_profiles, + ARRAY_SIZE(iris_hfi_gen1_h264_profiles)); + pl->level = iris_hfi_gen1_find_hfi_id(v4l2_lvl, iris_hfi_gen1_h264_levels, + ARRAY_SIZE(iris_hfi_gen1_h264_levels)); + break; + case V4L2_PIX_FMT_HEVC: + pl->profile = iris_hfi_gen1_find_hfi_id(v4l2_pf, iris_hfi_gen1_hevc_profiles, + ARRAY_SIZE(iris_hfi_gen1_hevc_profiles)); + pl->level = iris_hfi_gen1_find_hfi_id(v4l2_lvl, iris_hfi_gen1_hevc_levels, + ARRAY_SIZE(iris_hfi_gen1_hevc_levels)); + break; + default: + pl->profile = 0; + pl->level = 0; + break; + } +} + static int iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *packet, struct iris_inst *inst, u32 ptype, void *pdata) @@ -582,15 +681,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p case HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT: { struct hfi_profile_level *in = pdata, *pl = prop_data; - pl->level = in->level; - pl->profile = in->profile; - if (pl->profile <= 0) - /* Profile not supported, falling back to high */ - pl->profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; - - if (!pl->level) - /* Level not supported, falling back to 1 */ - pl->level = 1; + iris_hfi_gen1_profile_level(inst, in->profile, in->level, pl); packet->shdr.hdr.size += sizeof(*pl); break; diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h b/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h index 6981e6e84fd8..699f22cc7255 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h @@ -17,6 +17,50 @@ #define HFI_VIDEO_CODEC_HEVC 0x00002000 #define HFI_VIDEO_CODEC_VP9 0x00004000 +#define HFI_H264_PROFILE_BASELINE 0x00000001 +#define HFI_H264_PROFILE_MAIN 0x00000002 +#define HFI_H264_PROFILE_HIGH 0x00000004 +#define HFI_H264_PROFILE_STEREO_HIGH 0x00000008 +#define HFI_H264_PROFILE_MULTIVIEW_HIGH 0x00000010 +#define HFI_H264_PROFILE_CONSTRAINED_BASE 0x00000020 +#define HFI_H264_PROFILE_CONSTRAINED_HIGH 0x00000040 + +#define HFI_H264_LEVEL_1 0x00000001 +#define HFI_H264_LEVEL_1b 0x00000002 +#define HFI_H264_LEVEL_11 0x00000004 +#define HFI_H264_LEVEL_12 0x00000008 +#define HFI_H264_LEVEL_13 0x00000010 +#define HFI_H264_LEVEL_2 0x00000020 +#define HFI_H264_LEVEL_21 0x00000040 +#define HFI_H264_LEVEL_22 0x00000080 +#define HFI_H264_LEVEL_3 0x00000100 +#define HFI_H264_LEVEL_31 0x00000200 +#define HFI_H264_LEVEL_32 0x00000400 +#define HFI_H264_LEVEL_4 0x00000800 +#define HFI_H264_LEVEL_41 0x00001000 +#define HFI_H264_LEVEL_42 0x00002000 +#define HFI_H264_LEVEL_5 0x00004000 +#define HFI_H264_LEVEL_51 0x00008000 +#define HFI_H264_LEVEL_52 0x00010000 + +#define HFI_HEVC_PROFILE_MAIN 0x00000001 +#define HFI_HEVC_PROFILE_MAIN10 0x00000002 +#define HFI_HEVC_PROFILE_MAIN_STILL_PIC 0x00000004 + +#define HFI_HEVC_LEVEL_1 0x00000001 +#define HFI_HEVC_LEVEL_2 0x00000002 +#define HFI_HEVC_LEVEL_21 0x00000004 +#define HFI_HEVC_LEVEL_3 0x00000008 +#define HFI_HEVC_LEVEL_31 0x00000010 +#define HFI_HEVC_LEVEL_4 0x00000020 +#define HFI_HEVC_LEVEL_41 0x00000040 +#define HFI_HEVC_LEVEL_5 0x00000080 +#define HFI_HEVC_LEVEL_51 0x00000100 +#define HFI_HEVC_LEVEL_52 0x00000200 +#define HFI_HEVC_LEVEL_6 0x00000400 +#define HFI_HEVC_LEVEL_61 0x00000800 +#define HFI_HEVC_LEVEL_62 0x00001000 + #define HFI_ERR_NONE 0x0 #define HFI_CMD_SYS_INIT 0x10001 -- 2.47.3