Loading msm/vidc/msm_v4l2_vidc.c +15 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -490,6 +490,11 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) return -ENOMEM; core->platform_data = vidc_get_drv_data(&pdev->dev); if(!core->platform_data) { d_vpr_e("Failed to get platform data\n"); rc = -EINVAL; goto err_core_init; } dev_set_drvdata(&pdev->dev, core); rc = msm_vidc_initialize_core(pdev, core); if (rc) { Loading @@ -504,6 +509,12 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) core->id = MSM_VIDC_CORE_VENUS; vidc_driver->ctxt = kcalloc(core->platform_data->max_inst_count, sizeof(*vidc_driver->ctxt), GFP_KERNEL); if (!vidc_driver->ctxt) goto err_vidc_context; vidc_driver->num_ctxt = core->platform_data->max_inst_count; rc = v4l2_device_register(&pdev->dev, &core->v4l2_dev); if (rc) { d_vpr_e("Failed to register v4l2 device\n"); Loading Loading @@ -616,6 +627,8 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) err_dec: v4l2_device_unregister(&core->v4l2_dev); err_v4l2_register: kfree(vidc_driver->ctxt); err_vidc_context: sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group); err_core_init: dev_set_drvdata(&pdev->dev, NULL); Loading Loading @@ -701,6 +714,7 @@ static int msm_vidc_remove(struct platform_device *pdev) mutex_destroy(&core->resources.cb_lock); mutex_destroy(&core->lock); kfree(core); kfree(vidc_driver->ctxt); return rc; } Loading msm/vidc/msm_vidc_buffer_calculations.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */ #include "msm_vidc_debug.h" Loading Loading @@ -1043,7 +1043,7 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst) goto calc_done; if (mbs_per_frame <= NUM_MBS_480P) goto calc_done; /* Default frame_size = YUVsize * 2 */ (void)frame_size; /* Default frame_size = YUVsize * 2 */ else if (mbs_per_frame <= NUM_MBS_4k) frame_size = frame_size >> 2; else Loading msm/vidc/msm_vidc_common.c +0 −1 Original line number Diff line number Diff line Loading @@ -3074,7 +3074,6 @@ static int msm_comm_init_core(struct msm_vidc_inst *inst) core->state = VIDC_CORE_INIT; core->smmu_fault_handled = false; core->trigger_ssr = false; core->resources.max_inst_count = MAX_SUPPORTED_INSTANCES; core->resources.max_secure_inst_count = core->resources.max_secure_inst_count ? core->resources.max_secure_inst_count : Loading msm/vidc/msm_vidc_debug.c +11 −13 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #define CREATE_TRACE_POINTS Loading Loading @@ -31,8 +31,6 @@ int msm_vidc_err_recovery_disable = !1; atomic_read(&__binfo->ref_count) >= 2 ? "video driver" : "firmware";\ }) struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; struct core_inst_pair { struct msm_vidc_core *core; struct msm_vidc_inst *inst; Loading Loading @@ -611,16 +609,16 @@ int get_sid(u32 *sid, u32 session_type) { int i; for (i = 0; i < MAX_SUPPORTED_INSTANCES; i++) { if (!ctxt[i].used) { ctxt[i].used = 1; for (i = 0; i < vidc_driver->num_ctxt; i++) { if (!vidc_driver->ctxt[i].used) { vidc_driver->ctxt[i].used = 1; *sid = i+1; update_log_ctxt(*sid, session_type, 0); break; } } return (i == MAX_SUPPORTED_INSTANCES); return (i == vidc_driver->num_ctxt); } inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) Loading @@ -629,7 +627,7 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) char type; u32 s_type = 0; if (!sid || sid > MAX_SUPPORTED_INSTANCES) { if (!sid || sid > vidc_driver->num_ctxt) { d_vpr_e("%s: invalid sid %#x\n", __func__, sid); } Loading Loading @@ -685,10 +683,10 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) break; } ctxt[sid-1].session_type = s_type; ctxt[sid-1].codec_type = fourcc; memcpy(&ctxt[sid-1].name, codec, 4); ctxt[sid-1].name[4] = type; ctxt[sid-1].name[5] = '\0'; vidc_driver->ctxt[sid-1].session_type = s_type; vidc_driver->ctxt[sid-1].codec_type = fourcc; memcpy(&vidc_driver->ctxt[sid-1].name, codec, 4); vidc_driver->ctxt[sid-1].name[4] = type; vidc_driver->ctxt[sid-1].name[5] = '\0'; } msm/vidc/msm_vidc_debug.h +8 −16 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #ifndef __MSM_VIDC_DEBUG__ Loading Loading @@ -69,13 +69,6 @@ enum vidc_err_recovery_disable { VIDC_DISABLE_NON_NOC_ERR_RECOV = 0x0002 }; struct log_cookie { u32 used; u32 session_type; u32 codec_type; char name[20]; }; extern int msm_vidc_debug; extern int msm_vidc_fw_debug_mode; extern bool msm_vidc_fw_coverage; Loading @@ -85,7 +78,6 @@ extern bool msm_vidc_syscache_disable; extern bool msm_vidc_lossless_encode; extern bool msm_vidc_cvp_usage; extern int msm_vidc_err_recovery_disable; extern struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; #define dprintk(__level, sid, __fmt, ...) \ do { \ Loading Loading @@ -213,10 +205,10 @@ static inline bool is_print_allowed(u32 sid, u32 level) if (!((msm_vidc_debug >> 8) & 0xF)) return true; if (!sid || sid > MAX_SUPPORTED_INSTANCES) if (!sid || sid > vidc_driver->num_ctxt) return true; if (ctxt[sid-1].session_type & msm_vidc_debug) if (vidc_driver->ctxt[sid-1].session_type & msm_vidc_debug) return true; return false; Loading @@ -224,21 +216,21 @@ static inline bool is_print_allowed(u32 sid, u32 level) static inline char *get_codec_name(u32 sid) { if (!sid || sid > MAX_SUPPORTED_INSTANCES) if (!sid || sid > vidc_driver->num_ctxt) return "....."; return ctxt[sid-1].name; return vidc_driver->ctxt[sid-1].name; } static inline void put_sid(u32 sid) { if (!sid || sid > MAX_SUPPORTED_INSTANCES) { if (!sid || sid > vidc_driver->num_ctxt) { d_vpr_e("%s: invalid sid %#x\n", __func__, sid); return; } if (ctxt[sid-1].used) ctxt[sid-1].used = 0; if (vidc_driver->ctxt[sid-1].used) vidc_driver->ctxt[sid-1].used = 0; } static inline void tic(struct msm_vidc_inst *i, enum profiling_points p, Loading Loading
msm/vidc/msm_v4l2_vidc.c +15 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -490,6 +490,11 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) return -ENOMEM; core->platform_data = vidc_get_drv_data(&pdev->dev); if(!core->platform_data) { d_vpr_e("Failed to get platform data\n"); rc = -EINVAL; goto err_core_init; } dev_set_drvdata(&pdev->dev, core); rc = msm_vidc_initialize_core(pdev, core); if (rc) { Loading @@ -504,6 +509,12 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) core->id = MSM_VIDC_CORE_VENUS; vidc_driver->ctxt = kcalloc(core->platform_data->max_inst_count, sizeof(*vidc_driver->ctxt), GFP_KERNEL); if (!vidc_driver->ctxt) goto err_vidc_context; vidc_driver->num_ctxt = core->platform_data->max_inst_count; rc = v4l2_device_register(&pdev->dev, &core->v4l2_dev); if (rc) { d_vpr_e("Failed to register v4l2 device\n"); Loading Loading @@ -616,6 +627,8 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) err_dec: v4l2_device_unregister(&core->v4l2_dev); err_v4l2_register: kfree(vidc_driver->ctxt); err_vidc_context: sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group); err_core_init: dev_set_drvdata(&pdev->dev, NULL); Loading Loading @@ -701,6 +714,7 @@ static int msm_vidc_remove(struct platform_device *pdev) mutex_destroy(&core->resources.cb_lock); mutex_destroy(&core->lock); kfree(core); kfree(vidc_driver->ctxt); return rc; } Loading
msm/vidc/msm_vidc_buffer_calculations.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */ #include "msm_vidc_debug.h" Loading Loading @@ -1043,7 +1043,7 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst) goto calc_done; if (mbs_per_frame <= NUM_MBS_480P) goto calc_done; /* Default frame_size = YUVsize * 2 */ (void)frame_size; /* Default frame_size = YUVsize * 2 */ else if (mbs_per_frame <= NUM_MBS_4k) frame_size = frame_size >> 2; else Loading
msm/vidc/msm_vidc_common.c +0 −1 Original line number Diff line number Diff line Loading @@ -3074,7 +3074,6 @@ static int msm_comm_init_core(struct msm_vidc_inst *inst) core->state = VIDC_CORE_INIT; core->smmu_fault_handled = false; core->trigger_ssr = false; core->resources.max_inst_count = MAX_SUPPORTED_INSTANCES; core->resources.max_secure_inst_count = core->resources.max_secure_inst_count ? core->resources.max_secure_inst_count : Loading
msm/vidc/msm_vidc_debug.c +11 −13 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #define CREATE_TRACE_POINTS Loading Loading @@ -31,8 +31,6 @@ int msm_vidc_err_recovery_disable = !1; atomic_read(&__binfo->ref_count) >= 2 ? "video driver" : "firmware";\ }) struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; struct core_inst_pair { struct msm_vidc_core *core; struct msm_vidc_inst *inst; Loading Loading @@ -611,16 +609,16 @@ int get_sid(u32 *sid, u32 session_type) { int i; for (i = 0; i < MAX_SUPPORTED_INSTANCES; i++) { if (!ctxt[i].used) { ctxt[i].used = 1; for (i = 0; i < vidc_driver->num_ctxt; i++) { if (!vidc_driver->ctxt[i].used) { vidc_driver->ctxt[i].used = 1; *sid = i+1; update_log_ctxt(*sid, session_type, 0); break; } } return (i == MAX_SUPPORTED_INSTANCES); return (i == vidc_driver->num_ctxt); } inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) Loading @@ -629,7 +627,7 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) char type; u32 s_type = 0; if (!sid || sid > MAX_SUPPORTED_INSTANCES) { if (!sid || sid > vidc_driver->num_ctxt) { d_vpr_e("%s: invalid sid %#x\n", __func__, sid); } Loading Loading @@ -685,10 +683,10 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) break; } ctxt[sid-1].session_type = s_type; ctxt[sid-1].codec_type = fourcc; memcpy(&ctxt[sid-1].name, codec, 4); ctxt[sid-1].name[4] = type; ctxt[sid-1].name[5] = '\0'; vidc_driver->ctxt[sid-1].session_type = s_type; vidc_driver->ctxt[sid-1].codec_type = fourcc; memcpy(&vidc_driver->ctxt[sid-1].name, codec, 4); vidc_driver->ctxt[sid-1].name[4] = type; vidc_driver->ctxt[sid-1].name[5] = '\0'; }
msm/vidc/msm_vidc_debug.h +8 −16 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #ifndef __MSM_VIDC_DEBUG__ Loading Loading @@ -69,13 +69,6 @@ enum vidc_err_recovery_disable { VIDC_DISABLE_NON_NOC_ERR_RECOV = 0x0002 }; struct log_cookie { u32 used; u32 session_type; u32 codec_type; char name[20]; }; extern int msm_vidc_debug; extern int msm_vidc_fw_debug_mode; extern bool msm_vidc_fw_coverage; Loading @@ -85,7 +78,6 @@ extern bool msm_vidc_syscache_disable; extern bool msm_vidc_lossless_encode; extern bool msm_vidc_cvp_usage; extern int msm_vidc_err_recovery_disable; extern struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; #define dprintk(__level, sid, __fmt, ...) \ do { \ Loading Loading @@ -213,10 +205,10 @@ static inline bool is_print_allowed(u32 sid, u32 level) if (!((msm_vidc_debug >> 8) & 0xF)) return true; if (!sid || sid > MAX_SUPPORTED_INSTANCES) if (!sid || sid > vidc_driver->num_ctxt) return true; if (ctxt[sid-1].session_type & msm_vidc_debug) if (vidc_driver->ctxt[sid-1].session_type & msm_vidc_debug) return true; return false; Loading @@ -224,21 +216,21 @@ static inline bool is_print_allowed(u32 sid, u32 level) static inline char *get_codec_name(u32 sid) { if (!sid || sid > MAX_SUPPORTED_INSTANCES) if (!sid || sid > vidc_driver->num_ctxt) return "....."; return ctxt[sid-1].name; return vidc_driver->ctxt[sid-1].name; } static inline void put_sid(u32 sid) { if (!sid || sid > MAX_SUPPORTED_INSTANCES) { if (!sid || sid > vidc_driver->num_ctxt) { d_vpr_e("%s: invalid sid %#x\n", __func__, sid); return; } if (ctxt[sid-1].used) ctxt[sid-1].used = 0; if (vidc_driver->ctxt[sid-1].used) vidc_driver->ctxt[sid-1].used = 0; } static inline void tic(struct msm_vidc_inst *i, enum profiling_points p, Loading