From mboxrd@z Thu Jan 1 00:00:00 1970 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=ON4vv8BlBNNURjyU4g0lBgFEujwoCGIy698VZSNkm4/qc95jR4mUqriZTrGYIGpDop1z SjrO+7Sn05wpWIqp8fzaHMc2RxvNlMnn/n1gjvdLNBpji/wKemNLkV36LdruMKrD4Xh+5 VvoQTcLJNxlImIVzhvYsVhx79s3otFyQxybDcum3xBdp9D9YgCEgQwJ52wY6IgcJl22NN jcFVayO84tYnKSUKlni/VnE00yjJqpdgqXv/Y3i19zNJv60bHqezjUb5zinK79YyqQgck S6/KBwm6NSV72u+51osZocBM14OhiFldH2xXhFf9EIbGj6PWSeyCFF/0wdTP9lijhmA== 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=V+Cpa9VCPf2I5owRMzr/DYfbRtmwTQdwKLwMEolrcaHdg5O8ckFWnLkjsYPkZHPGKaBs fsiDxlQOHi89YY9WorMBYADg5EvaAsapYldhl89CLlpJiwR937p5mf6ZIWxzL9sp0HeFI bpKqi5On+SfIvzwT5vcIJOlXUvISTcHjp0lzcrEIvj2HtVUvQDmm+XiGgRVMKC/1+R2Wu o3dM8j1qTjEN7hJKsURXl7MOVtOVxQOPg4/zQd3KzM/7oH0MVbqh6RcFpos3nT9y9+E9g /x2f6lwDeML/9Z8p01rP9IevzaWX6VEfisZCTmgAAuVU3FboChRfVvoiz50ZBgKHJVg== 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 CFC66606A68E for ; Fri, 4 Dec 2026 18:25:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CFC66606A68E 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 6B4I6ZSe1716908 for ; Fri, 4 Dec 2026 18:25:03 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-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jbq7ptff6-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-f197.google.com with SMTP id af79cd13be357-949b0d322fbso186083785a.3 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=1Gy82YF1RKDmIs9/jRIih8ptth96x98hWTzb9RkMSAVXMmj+MoIxVAb4TeZ7j+tAHY hpgr0dF2uvWTeh/oe49lE1NEB/HDoHmmqrGprj4aefrPYc4/MNQnk4vrnmXjfNbK6KXA DLZ86Zo/Ct14rGu70Rkd6HPU2iryX6k2m6Kf/dVdfWtxxZ2n5cOuIO6/CAYfA4OoIsCi Q3w79b7XW8Asn/i9Cp+h9vxhR0R/RUnfONapaD32bbaYAWcACDvV/iqLfhxq/EpX+Dmc JyBexdG0nSHGL5cjOgkmRyVnV+B2nGMjPGvQmHl78IilTAqqSFZRe9wFk4myM5S3xV6V iZWQ== X-Forwarded-Encrypted: i=1; AL+hErGtrCk4sm6RBakYAOi4Xha+8n4u4ZYT4H2OeB0L8Hv2D0sKz+DUE/zYpIv3ePgPYkwv1qTV7l2arSWOujs=@vger.kernel.org X-Gm-Message-State: APuU4Z+bxcf0x3CawHc8pHdgpjmo2H04Pu6Y0cz8NW4RGR7wnaawZ4OF 8TgHOwNdmFF3JYDbt1XsxfyReNhQrR3YTDLbJ05ku5VxSNJcK8z5KtInm+bT2r6hOwbOoJ8Ysah yWWCEdkZtZQsR7UGlAfQIlt67hT4Tazux6Z4nJwTA+9dTNbOTbYEbeYfkbwBjR4Mq9LOUz9/dE7 c= X-Gm-Gg: AZFdTZcZ8bCfw2TPmDXbyWvD7igdCz/bcJd//P87By0wUo33qtE8D6RoV7MiDJkQMaX ib5hKrIYBtj8EnkXjmm6F9b4bRwqz+zSP5Qqt3LBGG3dHpZ/EtgWtt3GnowULXwtHdFQ6MVlgVT 2hqRl8Jqp0bcmuFuQl0b9DOwa1OEYvQgJ7b68N2dl6AJXAzN7QJY7r1YS/3/kCwyJSQJVPxyPnq +0tfboaKuSZrtg9OLDeQKrXBswR5oJOZGGIvb3HmpEPe5PidOKYU4H5oIDuWZ0Q9Yz6dYB/O3oX effDwWHhmBtaxLV+HIhYpzi2PrBTXNZ6hjkLoKd87zjFrMrwthFz+sKsc9dq8mg9d7diw7BCyYu 9IT+2DUNrmv+vzS0sksUlGh1JvzYwx5dTE0qGNfkYQav6+4QP6QQAtUVMmycceB9VXSVewM92r1 hgcQnATWTvWH+rWVLD2fVFLxlTYqZ0ohR689cwt7dwFjXRh7dFVRjWdHVp2j4/9A== X-Received: by 2002:a05:620a:600e:b0:949:615d:c79e with SMTP id af79cd13be357-94a82e13d11mr434220585a.53.1796408702849; 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-kernel@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: AW1haW4tMjYxMjA0MDA3MyBTYWx0ZWRfX/a9hwe5YcPa6 yC6GX29uuZWbbquJaE8h8DSlGu+vDJX89sC4SE20yCX/kkIGy8Bdp4k6rG0W6RxKTaq6oqA+jAV V63jjHCZBQUhMY8pR5imY2idOV6MPoJoTnJTPU3oa4pFiXAlw4sVRkTKBrWVGqChpW7jAE3z7CO 6zvnIIIVPAWtMZWs9iaCOe9bB7cDBqxi/IbDOqBEYT82zpR3De0RWE64IvfVRimdeHtKyP7YNqN 84whDq74yXXtIRjmx22RcgwYgAEUKfqvQZ/XcE2o9vkbpXwBotzxb80vJOPjV9bGxztzgBoxm05 o/UzSxsoGGq0Cm481NNl9ScKwfGpC31p3vqrcJTWsX51Og2Gc/VE5YaSEMKnejhg6lbYL9jptNI weqw+tnBDDvkHPb2Eek3LNvXR4Dd3Wf3AoBqMgYIJ08UphD8D5n406u2WOzvCRhUK5g1yZY9Chf j920lswZ1QYeuZ1NhpQ== X-Authority-Analysis: v=2.4 cv=DMUacCNb c=1 sm=1 tr=0 ts=6b13057f cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==: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=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA3MyBTYWx0ZWRfX81Z+oAEWpOZG +pv4LEbrcGw9o6j7Ziw1Hp7pPz53X5KXKfGvJgC1pxSkbSVXompT7Mx0FOaVXGBG+o+tSMXUqfe CXhAqhM9rGbLvABH2GkWIG4QSFkqVsU= X-Proofpoint-ORIG-GUID: 3f_1sCTl9y75bjW_GiH0Dd5dzZnv5S4g X-Proofpoint-GUID: 3f_1sCTl9y75bjW_GiH0Dd5dzZnv5S4g 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