From mboxrd@z Thu Jan 1 00:00:00 1970 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 CB2723E95AD for ; Sat, 28 Feb 2026 08:29:03 +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=1772267347; cv=none; b=SNzw/gIFh5c36CuasujaGIAwr+qsvAyDMa1VehSjAJGhbQZoq9Vg7u2l6NdGr+PQAfUlOqjG79e9+2tX1J1WOWYUgrf/8jjb56cMQ/QwBdaIz7WYPQWIZzB1emQIz41+yIHfXVU/palDdsOqnw22sPM8MVQkJZDEuPqKHSYwSV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772267347; c=relaxed/simple; bh=+ySIBX4LSmJwOCTjpMuPd68caYQXqYzF98IRNCzeQjQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WgXrcXamu+/dIhbvslR5EAbul2EGvSZYn3MZ3jFrpKNdtUwe0ca0u7o3lpBuFNi/5UQVUbuZRBJnJEqH6ARgSW17o5Mz2mEMcuop96r+WgVQkp38Fiu3JfTnQtcaI3juXMrylDTX7mfcNIyEYZzlLpjSJohd8ZE/XXEzzBLXSWo= 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=aerP9j01; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EkBCajz4; 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="aerP9j01"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EkBCajz4" 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 61S6NYwa3830755 for ; Sat, 28 Feb 2026 08:29: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= NEyQLQByyxy9urnjJvJEI9YkeBQSmU6Zo1jDjLygxGY=; b=aerP9j01zRHMHM4F ow4TxzTdJRPWo2rWLLqYwO403KOTeHv85LyVRpBaX7PEAuTH6TqkV8a4u9u4Fx71 zwzEcKM8v5VP8HexjwJZl9UjFVR5AjJigEVtF16HZNmTCWD6RvejRE6/DLynj8BW j7MNbJyIhxB5w0AczAz3Fdgu0kXpp88e+BLzflSj8RzOMzWiUQrxG4JKLyvki1p6 gqWoRZTQWYNTXye4KiMHIXIqwwmyYQ+xefmhBZthUErWiiEoAYCm/JTgS9BkLA9F Ytoa+LO0FYeW3LNqwsLSRQBFDN7lxI37WRZ5ArE0prXrKcQ3UxDmaxzoN4gHzjqx rlzDVg== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cksf8gjg6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 28 Feb 2026 08:29:03 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb403842b6so2701058685a.1 for ; Sat, 28 Feb 2026 00:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772267342; x=1772872142; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NEyQLQByyxy9urnjJvJEI9YkeBQSmU6Zo1jDjLygxGY=; b=EkBCajz4dO7b+RC9sa2BWgTCM7fkP4MMLG2o0i7TYfAF38tgTV9hIYPtwtY89Dy9d4 b5UtT1HaFevEBdfHKFnuU+b7gsd7aD5nEl6On0xa06b7L5XF1XqCQ/XbaI23PaRe7bkf 1mXjn6uB9QGh2M6GjGCG4GAzUaQ3Ay/Atp1fVmIMsDqOldQC57Fusb9rxxit4N72zxuD 4VJ8GY5vNVooqlYGbUftQlq3IVqHGttlyj6MaQcJ3HcBMyiDADD8JUqNe86jzokIgqpa Bq+/co7CHyWfGpC6+o3sKJD7W3yPUCHgxp8CM/blbGAb0wOGn+a/bhjzOw8YREjsZej3 Qcpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772267342; x=1772872142; h=cc:to:in-reply-to:references: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=NEyQLQByyxy9urnjJvJEI9YkeBQSmU6Zo1jDjLygxGY=; b=oMnH75Mf36MM0sMyAtp8i44yWx1tCUTNNSRBGHS8yxMRM3tweNmAb2PvGj+P9AhHt6 T/MAQZ10v9SOhwyPC45MFgBBf5Ux51L9yFonED0BaiTk8y+krmUDKJVEwUP72X72ubon hypk4jC3pjbo3/A/TiWDoQGTALoSV3Q6QERUsgKP2m9mix1y0/kCSj88Tf/N3cclwq91 dSlP8aDzaACic4vEnL0HZqK6Za7z3gmh2BnY/tREBGIc3THkfCCxDPavmJ/FO87xP+x9 471Crhuj40TvfDnTktpACABtYVIPhWWQqncvnmNgVIgfTve7WlTMMUQ9rEcJ6ZdjZQba EXzg== X-Forwarded-Encrypted: i=1; AJvYcCVnTxyQaVkfeRgV6+eixKkFADwBc79d+/Yd0fSv8n+DZZMbZMaWUg7FOMTzlGikKYo890Sha6iX+p4hq7k=@vger.kernel.org X-Gm-Message-State: AOJu0Yym7w+7qmgtWtL40cnGdAaSNDC84sp8tlZvJWGiqnS9SpZQPfpK aKbPw9hVXIeszCDMe6RuQ2Ejo+gPXQHTyaXa9oGBKHPthdfO2Q3lENEoCNlHh+sLe36GhnUP22C vXUf0UtofpLjA2KE7JNSGXZL4V4U9xCDBqIgDlZWmRBJh3UTkV58aC1suAbiJgaet658= X-Gm-Gg: ATEYQzzpFM0puWVL92jF64HtMzUPdlVOIFuTvLrlInprVwGErJDJ+a16bQzoZO1pnnX 9NDgiBiSSKDNnCR2kM5VkMtgm21SVVaQf/kc7Ot1ffUtIqTjROGlLzIVqC1dIVcxe//sYMrTJGc C+RGn2Es923JeAqjNaog37/38EW2o94P5aLJ4zX3KC9+5isgPp6b8lg6Qs9/byUuby4qKv/2JhC M82RMp5zYhN419wV5yPQDv/sg+CFgjElr3OFe1q1FNnOsdKjYM6IEIeOIlyax/d9JcVWAZKMRv2 VLpNa5mQGGJVhHALGLBqtT3lLSQAbkUXpdBfMpZFhgDjsx2b0jPIlcbtp2ErkNkMW/Hn9IRt/1P tS1MuFpoA46hZZTz6I9jhZFWiY5BuChS0109Sh5uEqs2hHYA0bFdmFYoF9LxrWbq8sTGb2yC0Nk kLw9dkyIb4pVIsx8xP5oMENAz/BBsUwYBYGLg= X-Received: by 2002:a05:620a:4509:b0:8c5:338b:bfa0 with SMTP id af79cd13be357-8cbc8e7dc6dmr729778585a.20.1772267342005; Sat, 28 Feb 2026 00:29:02 -0800 (PST) X-Received: by 2002:a05:620a:4509:b0:8c5:338b:bfa0 with SMTP id af79cd13be357-8cbc8e7dc6dmr729776485a.20.1772267341428; Sat, 28 Feb 2026 00:29:01 -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-389f2f4b158sm17970711fa.6.2026.02.28.00.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Feb 2026 00:29:00 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 28 Feb 2026 10:28:49 +0200 Subject: [PATCH 04/11] media: qcom: iris: simplify HFI params handling 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: 7bit Message-Id: <20260228-iris-platform-data-v1-4-c2c53539f948@oss.qualcomm.com> References: <20260228-iris-platform-data-v1-0-c2c53539f948@oss.qualcomm.com> In-Reply-To: <20260228-iris-platform-data-v1-0-c2c53539f948@oss.qualcomm.com> 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.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=13960; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=+ySIBX4LSmJwOCTjpMuPd68caYQXqYzF98IRNCzeQjQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBpoqdA4afJEIUr6oOZ+xRFQwyX7C1+0/5P6mHiB S+6aFIDwkqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCaaKnQAAKCRCLPIo+Aiko 1ShjB/wJmtXKZEqdpsm0LDUTa6cqc6wjlVvGk16ge1/FA7zaN1wz95vlytmTDYDKTpzQwZO00O2 EyWsU9OMqGygQrpgMkMRIAG4YfJEbk3FpeMQcmvQpeUkpUcPuDL5yOyeOz8zG9/Lj3QX1xgraEJ mI9tLflULITETf0TXPrHWyPNOW9QcwzpfxesZmTwKwAqOY+IMi99uJUqb/AVuuCl5YqkSwYz8eg koB6z7f6QlRBuve8ktZiukKbMWSotlGA14gCHa+PcDNxTcjx5kJwaDOBUCmEUgiz1HAwMdSoB1S niisCO8teos89+6biwl4k/6Ywgyfy/mxVNR+9Jgj9GpshJo1 X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI4MDA3NyBTYWx0ZWRfXyYxGBgnaKNzl qF8nRe+sFj/PfREXT8d8vI5R2kKTQdrNRUDaj5MLspNtkugb6HYRTIRv2DjfC6cnfCPs4AOZ37N G/Qykua4pCL3TE3HAfIQ2vPnNTrXaFfPy68PKS2xItULb7hnRB07ThHuaS6aa2xGU4p7SGLd4zw xfn5iK9XGJBU0Z9AlqfpXJIymd+8BhT/fH37KFuRy/YmwrY51eaMO+I5Sv6VvI0U2AAS6hCtklJ Bb7qNhqvOaCKA7Ht1hR0d4yHsxVdDsEW4MWwR3yYPoX9lVy3+POxqgmSkS7WhRNg7n+6hiOpq9b Q732SVZiGipm0cJNWoeVaG+1oJ1QVzOEdBWVmLGYSuKBQLPGS1skDCeNDfPujVrU6/2Gk9IGZMo p3eb0ku3YBQm8CGhfTlFMio21HfDAiGP/WeBqPxkS9U42w88hdkVzW9BSD+UIyR/5LRZAI/DAYu 5PByfOtksAvF/88pM5A== X-Proofpoint-ORIG-GUID: 0zMWzdjuUrqNBcGd6JI0p5h4GXlnUU_9 X-Proofpoint-GUID: 0zMWzdjuUrqNBcGd6JI0p5h4GXlnUU_9 X-Authority-Analysis: v=2.4 cv=I5dohdgg c=1 sm=1 tr=0 ts=69a2a74f cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=vZ3IETys5ARFP0fKc9YA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-28_02,2026-02-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 clxscore=1015 phishscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602280077 Instead of looping over two tables to select the static order of functions, call necessary functsions directly in the correct order. Signed-off-by: Dmitry Baryshkov --- .../platform/qcom/iris/iris_hfi_gen1_command.c | 116 ++++----------- .../platform/qcom/iris/iris_hfi_gen2_command.c | 164 +++++++++++---------- 2 files changed, 110 insertions(+), 170 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 d5eaf8763f6d..b7aafda1d99e 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c @@ -978,107 +978,41 @@ static int iris_hfi_gen1_set_stride(struct iris_inst *inst, u32 plane) return hfi_gen1_set_property(inst, ptype, &plane_actual_info, sizeof(plane_actual_info)); } -static const u32 iris_hfi_gen1_vdec_input_config_param[] = { - HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE, - HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, - HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO, - HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, - HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM, - HFI_PROPERTY_PARAM_FRAME_SIZE, - HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL, - HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE, -}; - -static const u32 iris_hfi_gen1_venc_input_config_param[] = { - HFI_PROPERTY_CONFIG_FRAME_RATE, - HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO, - HFI_PROPERTY_PARAM_FRAME_SIZE, - HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, - HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, -}; - static int iris_hfi_gen1_session_set_config_params(struct iris_inst *inst, u32 plane) { - struct iris_hfi_prop_type_handle const *handler = NULL; - u32 handler_size = 0; - u32 config_params_size, i, j; - const u32 *config_params; int ret; - static const struct iris_hfi_prop_type_handle vdec_prop_type_handle_inp_arr[] = { - {HFI_PROPERTY_PARAM_FRAME_SIZE, - iris_hfi_gen1_set_resolution}, - {HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE, - iris_hfi_gen1_decide_core}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, - iris_hfi_gen1_set_raw_format}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO, - iris_hfi_gen1_set_format_constraints}, - {HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, - iris_hfi_gen1_set_num_bufs}, - {HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM, - iris_hfi_gen1_set_multistream}, - {HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL, - iris_hfi_gen1_set_bufsize}, - }; - - static const struct iris_hfi_prop_type_handle vdec_prop_type_handle_out_arr[] = { - {HFI_PROPERTY_PARAM_FRAME_SIZE, - iris_hfi_gen1_set_resolution}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, - iris_hfi_gen1_set_raw_format}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO, - iris_hfi_gen1_set_format_constraints}, - {HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, - iris_hfi_gen1_set_num_bufs}, - {HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM, - iris_hfi_gen1_set_multistream}, - {HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL, - iris_hfi_gen1_set_bufsize}, - }; - - static const struct iris_hfi_prop_type_handle venc_prop_type_handle_inp_arr[] = { - {HFI_PROPERTY_CONFIG_FRAME_RATE, - iris_hfi_gen1_set_frame_rate}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO, - iris_hfi_gen1_set_stride}, - {HFI_PROPERTY_PARAM_FRAME_SIZE, - iris_hfi_gen1_set_resolution}, - {HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, - iris_hfi_gen1_set_raw_format}, - {HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, - iris_hfi_gen1_set_num_bufs}, - }; - if (inst->domain == DECODER) { - config_params = iris_hfi_gen1_vdec_input_config_param; - config_params_size = ARRAY_SIZE(iris_hfi_gen1_vdec_input_config_param); if (V4L2_TYPE_IS_OUTPUT(plane)) { - handler = vdec_prop_type_handle_inp_arr; - handler_size = ARRAY_SIZE(vdec_prop_type_handle_inp_arr); - } else if (V4L2_TYPE_IS_CAPTURE(plane)) { - handler = vdec_prop_type_handle_out_arr; - handler_size = ARRAY_SIZE(vdec_prop_type_handle_out_arr); + ret = iris_hfi_gen1_decide_core(inst, plane); + if (ret) + return ret; } - } else { - config_params = iris_hfi_gen1_venc_input_config_param; - config_params_size = ARRAY_SIZE(iris_hfi_gen1_venc_input_config_param); - handler = venc_prop_type_handle_inp_arr; - handler_size = ARRAY_SIZE(venc_prop_type_handle_inp_arr); - } - for (i = 0; i < config_params_size; i++) { - for (j = 0; j < handler_size; j++) { - if (handler[j].type == config_params[i]) { - ret = handler[j].handle(inst, plane); - if (ret) - return ret; - break; - } - } + ret = iris_hfi_gen1_set_raw_format(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_format_constraints(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_num_bufs(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_multistream(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_bufsize(inst, plane); + } else { + ret = iris_hfi_gen1_set_frame_rate(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_stride(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_raw_format(inst, plane); + if (!ret) + ret = iris_hfi_gen1_set_num_bufs(inst, plane); } - return 0; + return ret; } static const struct iris_hfi_command_ops iris_hfi_gen1_command_ops = { diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c index de43d90b5a2d..28f352d99bf0 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c @@ -644,103 +644,109 @@ static const u32 iris_hfi_gen2_vdec_input_config_params_av1[] = { HFI_PROP_SIGNAL_COLOR_INFO, }; -static const u32 iris_hfi_gen2_venc_input_config_params[] = { - HFI_PROP_COLOR_FORMAT, - HFI_PROP_RAW_RESOLUTION, - HFI_PROP_CROP_OFFSETS, - HFI_PROP_LINEAR_STRIDE_SCANLINE, - HFI_PROP_SIGNAL_COLOR_INFO, -}; - -static const u32 iris_hfi_gen2_vdec_output_config_params[] = { - HFI_PROP_OPB_ENABLE, - HFI_PROP_COLOR_FORMAT, - HFI_PROP_LINEAR_STRIDE_SCANLINE, -}; - -static const u32 iris_hfi_gen2_venc_output_config_params[] = { - HFI_PROP_BITSTREAM_RESOLUTION, - HFI_PROP_CROP_OFFSETS, - HFI_PROP_FRAME_RATE, -}; - static int iris_hfi_gen2_session_set_config_params(struct iris_inst *inst, u32 plane) { - u32 config_params_size = 0, i, j; - const u32 *config_params = NULL; int ret; - static const struct iris_hfi_prop_type_handle prop_type_handle_arr[] = { - {HFI_PROP_RAW_RESOLUTION, iris_hfi_gen2_set_raw_resolution }, - {HFI_PROP_BITSTREAM_RESOLUTION, iris_hfi_gen2_set_bitstream_resolution }, - {HFI_PROP_CROP_OFFSETS, iris_hfi_gen2_set_crop_offsets }, - {HFI_PROP_CODED_FRAMES, iris_hfi_gen2_set_coded_frames }, - {HFI_PROP_LUMA_CHROMA_BIT_DEPTH, iris_hfi_gen2_set_bit_depth }, - {HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT, iris_hfi_gen2_set_min_output_count }, - {HFI_PROP_PIC_ORDER_CNT_TYPE, iris_hfi_gen2_set_picture_order_count }, - {HFI_PROP_SIGNAL_COLOR_INFO, iris_hfi_gen2_set_colorspace }, - {HFI_PROP_PROFILE, iris_hfi_gen2_set_profile }, - {HFI_PROP_LEVEL, iris_hfi_gen2_set_level }, - {HFI_PROP_OPB_ENABLE, iris_hfi_gen2_set_opb_enable }, - {HFI_PROP_COLOR_FORMAT, iris_hfi_gen2_set_colorformat }, - {HFI_PROP_LINEAR_STRIDE_SCANLINE, iris_hfi_gen2_set_linear_stride_scanline }, - {HFI_PROP_TIER, iris_hfi_gen2_set_tier }, - {HFI_PROP_FRAME_RATE, iris_hfi_gen2_set_frame_rate }, - {HFI_PROP_AV1_FILM_GRAIN_PRESENT, iris_hfi_gen2_set_film_grain }, - {HFI_PROP_AV1_SUPER_BLOCK_ENABLED, iris_hfi_gen2_set_super_block }, - {HFI_PROP_OPB_ENABLE, iris_hfi_gen2_set_opb_enable }, - }; - if (inst->domain == DECODER) { if (V4L2_TYPE_IS_OUTPUT(plane)) { if (inst->codec == V4L2_PIX_FMT_H264) { - config_params = iris_hfi_gen2_vdec_input_config_params_avc; - config_params_size = - ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_avc); + ret = iris_hfi_gen2_set_bitstream_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_bit_depth(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_coded_frames(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_min_output_count(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_picture_order_count(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_profile(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_level(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_colorspace(inst, plane); } else if (inst->codec == V4L2_PIX_FMT_HEVC) { - config_params = iris_hfi_gen2_vdec_input_config_params_hevc; - config_params_size = - ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_hevc); + ret = iris_hfi_gen2_set_bitstream_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_bit_depth(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_min_output_count(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_profile(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_level(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_tier(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_colorspace(inst, plane); } else if (inst->codec == V4L2_PIX_FMT_VP9) { - config_params = iris_hfi_gen2_vdec_input_config_params_vp9; - config_params_size = - ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_vp9); + ret = iris_hfi_gen2_set_bitstream_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_bit_depth(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_min_output_count(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_profile(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_level(inst, plane); } else if (inst->codec == V4L2_PIX_FMT_AV1) { - config_params = iris_hfi_gen2_vdec_input_config_params_av1; - config_params_size = - ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_av1); + ret = iris_hfi_gen2_set_bitstream_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_bit_depth(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_min_output_count(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_profile(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_level(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_tier(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_film_grain(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_super_block(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_colorspace(inst, plane); } else { - return -EINVAL; + ret = -EINVAL; } } else { - config_params = iris_hfi_gen2_vdec_output_config_params; - config_params_size = ARRAY_SIZE(iris_hfi_gen2_vdec_output_config_params); + ret = iris_hfi_gen2_set_opb_enable(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_colorformat(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_linear_stride_scanline(inst, plane); } } else { if (V4L2_TYPE_IS_OUTPUT(plane)) { - config_params = iris_hfi_gen2_venc_input_config_params; - config_params_size = ARRAY_SIZE(iris_hfi_gen2_venc_input_config_params); + ret = iris_hfi_gen2_set_colorformat(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_raw_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_linear_stride_scanline(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_colorspace(inst, plane); } else { - config_params = iris_hfi_gen2_venc_output_config_params; - config_params_size = ARRAY_SIZE(iris_hfi_gen2_venc_output_config_params); + ret = iris_hfi_gen2_set_bitstream_resolution(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_crop_offsets(inst, plane); + if (!ret) + ret = iris_hfi_gen2_set_frame_rate(inst, plane); } } - if (!config_params || !config_params_size) - return -EINVAL; - - for (i = 0; i < config_params_size; i++) { - for (j = 0; j < ARRAY_SIZE(prop_type_handle_arr); j++) { - if (prop_type_handle_arr[j].type == config_params[i]) { - ret = prop_type_handle_arr[j].handle(inst, plane); - if (ret) - return ret; - break; - } - } - } - - return 0; + return ret; } static int iris_hfi_gen2_session_set_codec(struct iris_inst *inst) @@ -917,8 +923,8 @@ static int iris_hfi_gen2_subscribe_change_param(struct iris_inst *inst, u32 plan switch (inst->codec) { case V4L2_PIX_FMT_H264: - change_param = iris_hfi_gen2_vdec_input_config_params_h264; - change_param_size = ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_h264); + change_param = iris_hfi_gen2_vdec_input_config_params_avc; + change_param_size = ARRAY_SIZE(iris_hfi_gen2_vdec_input_config_params_avc); break; case V4L2_PIX_FMT_HEVC: change_param = iris_hfi_gen2_vdec_input_config_params_hevc; -- 2.47.3