forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/qcom/venus/hfi_cmds.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
34 * Copyright (C) 2017 Linaro Ltd.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 and
7
- * only version 2 as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
145 */
156 #include <linux/errno.h>
167 #include <linux/hash.h>
....@@ -649,6 +640,7 @@
649640 case HFI_RATE_CONTROL_CBR_VFR:
650641 case HFI_RATE_CONTROL_VBR_CFR:
651642 case HFI_RATE_CONTROL_VBR_VFR:
643
+ case HFI_RATE_CONTROL_CQ:
652644 break;
653645 default:
654646 ret = -EINVAL;
....@@ -1214,10 +1206,45 @@
12141206 break;
12151207 }
12161208 case HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE:
1209
+ case HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER:
1210
+ case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE:
1211
+ case HFI_PROPERTY_PARAM_VENC_SESSION_QP:
1212
+ case HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE:
12171213 /* not implemented on Venus 4xx */
1218
- break;
1214
+ return -ENOTSUPP;
12191215 default:
12201216 return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata);
1217
+ }
1218
+
1219
+ return 0;
1220
+}
1221
+
1222
+static int
1223
+pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt,
1224
+ void *cookie, u32 ptype, void *pdata)
1225
+{
1226
+ void *prop_data;
1227
+
1228
+ if (!pkt || !cookie || !pdata)
1229
+ return -EINVAL;
1230
+
1231
+ prop_data = &pkt->data[1];
1232
+
1233
+ pkt->shdr.hdr.size = sizeof(*pkt);
1234
+ pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
1235
+ pkt->shdr.session_id = hash32_ptr(cookie);
1236
+ pkt->num_properties = 1;
1237
+ pkt->data[0] = ptype;
1238
+
1239
+ switch (ptype) {
1240
+ case HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY: {
1241
+ struct hfi_heic_frame_quality *in = pdata, *cq = prop_data;
1242
+
1243
+ cq->frame_quality = in->frame_quality;
1244
+ pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq);
1245
+ break;
1246
+ } default:
1247
+ return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata);
12211248 }
12221249
12231250 return 0;
....@@ -1241,7 +1268,10 @@
12411268 if (hfi_ver == HFI_VERSION_3XX)
12421269 return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata);
12431270
1244
- return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata);
1271
+ if (hfi_ver == HFI_VERSION_4XX)
1272
+ return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata);
1273
+
1274
+ return pkt_session_set_property_6xx(pkt, cookie, ptype, pdata);
12451275 }
12461276
12471277 void pkt_set_version(enum hfi_version version)