From 06545143b8e1ca005a4c0abf8fac286da26bbf36 Mon Sep 17 00:00:00 2001 From: "Rudra Venkatesh(Temp)" Date: Thu, 10 Sep 2020 13:41:34 +0530 Subject: [PATCH] msm: Changes to support 7.6k resolution feature -Add HFI changes to firmware to set the 7.6k resolution Change-Id: Ic7825d45648418c26744822a25096e38123fad58 Signed-off-by: Srinu Gorle --- .../platform/msm/vidc/hfi_packetization.c | 22 ++++++++++++++++++- .../platform/msm/vidc/hfi_packetization.h | 3 ++- drivers/media/platform/msm/vidc/venus_hfi.c | 17 ++++++++++++++ .../media/platform/msm/vidc/vidc_hfi_helper.h | 18 ++++++++++++++- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.c b/drivers/media/platform/msm/vidc/hfi_packetization.c index 8c801d5080c4..795dc60ebf12 100644 --- a/drivers/media/platform/msm/vidc/hfi_packetization.c +++ b/drivers/media/platform/msm/vidc/hfi_packetization.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -302,7 +302,26 @@ int create_pkt_cmd_sys_debug_config( hfi->debug_mode = msm_vidc_fw_debug_mode; return 0; } +static int create_pkt_cmd_sys_feature_config_packet( + struct hfi_cmd_sys_set_property_packet *pkt) +{ + struct hfi_feature_config *hfi; + if (!pkt) + return -EINVAL; + + pkt->size = sizeof(struct hfi_cmd_sys_set_property_packet) + + sizeof(struct hfi_feature_config) + sizeof(u32); + pkt->packet_type = HFI_CMD_SYS_SET_PROPERTY; + pkt->num_properties = 1; + pkt->rg_property_data[0] = HFI_PROPERTY_SYS_FEATURE_CONFIG; + + hfi = (struct hfi_feature_config *) &pkt->rg_property_data[1]; + hfi->enable_maxdec_resolution = 0; + hfi->enable_maxenc_resolution = 1; + hfi->reserved = 0; + return 0; +} int create_pkt_cmd_sys_coverage_config( struct hfi_cmd_sys_set_property_packet *pkt, u32 mode) @@ -2085,6 +2104,7 @@ static struct hfi_packetization_ops hfi_default = { .sys_release_resource = create_pkt_cmd_sys_release_resource, .sys_ping = create_pkt_cmd_sys_ping, .sys_image_version = create_pkt_cmd_sys_image_version, + .sys_feature_config = create_pkt_cmd_sys_feature_config_packet, .ssr_cmd = create_pkt_ssr_cmd, .session_init = create_pkt_cmd_sys_session_init, .session_cmd = create_pkt_cmd_session_cmd, diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.h b/drivers/media/platform/msm/vidc/hfi_packetization.h index 06c05743711f..ffeb16171070 100644 --- a/drivers/media/platform/msm/vidc/hfi_packetization.h +++ b/drivers/media/platform/msm/vidc/hfi_packetization.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, 2020 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -39,6 +39,7 @@ struct hfi_packetization_ops { void *resource_value); int (*sys_debug_config)(struct hfi_cmd_sys_set_property_packet *pkt, u32 mode); + int (*sys_feature_config)(struct hfi_cmd_sys_set_property_packet *pkt); int (*sys_coverage_config)(struct hfi_cmd_sys_set_property_packet *pkt, u32 mode); int (*sys_release_resource)( diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index 5c0419d300e1..de06a6361bdd 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -2093,6 +2093,7 @@ static int venus_hfi_session_init(void *device, void *session_id, void **new_session) { struct hfi_cmd_sys_session_init_packet pkt; + struct hfi_cmd_sys_set_property_packet feature_pkt; struct venus_hfi_device *dev; struct hal_session *s; @@ -2122,6 +2123,22 @@ static int venus_hfi_session_init(void *device, void *session_id, list_add_tail(&s->list, &dev->sess_head); __set_default_sys_properties(device); + if (dev->res) { + if (dev->res->enable_max_resolution) { + if (call_hfi_pkt_op(dev, sys_feature_config, + &feature_pkt)) { + dprintk(VIDC_ERR, + "Failed to create feature config pkt\n"); + goto err_session_init_fail; + } + + if (__iface_cmdq_write(dev, &feature_pkt)) { + dprintk(VIDC_WARN, + "Failed to set max resolutionfeature in f/w\n"); + goto err_session_init_fail; + } + } + } if (call_hfi_pkt_op(dev, session_init, &pkt, s, session_type, codec_type)) { diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_helper.h b/drivers/media/platform/msm/vidc/vidc_hfi_helper.h index f66d6c9bcee1..4aa70aad3085 100644 --- a/drivers/media/platform/msm/vidc/vidc_hfi_helper.h +++ b/drivers/media/platform/msm/vidc/vidc_hfi_helper.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -199,6 +199,8 @@ struct hfi_buffer_info { (HFI_PROPERTY_SYS_COMMON_START + 0x006) #define HFI_PROPERTY_SYS_CONFIG_COVERAGE \ (HFI_PROPERTY_SYS_COMMON_START + 0x007) +#define HFI_PROPERTY_SYS_FEATURE_CONFIG \ + (HFI_PROPERTY_SYS_COMMON_START + 0x009) #define HFI_PROPERTY_PARAM_COMMON_START \ (HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x1000) @@ -459,6 +461,20 @@ struct hfi_debug_config { u32 debug_config; u32 debug_mode; }; +struct hfi_feature_config { + /* Set 1 to enable max resolution (hardcoded in FW) + * decoder support + */ + u32 enable_maxdec_resolution : 1; + /* Set 1 to enable max resolution (hardcoded in FW) + * encoder support + */ + u32 enable_maxenc_resolution : 1; + /* Must be set to 0, otherwise other fields will + * be ignored + */ + u32 reserved : 30; +}; struct hfi_enable { u32 enable;