Loading drivers/media/platform/msm/vidc/hfi_packetization.c +14 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, 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 Loading Loading @@ -1821,6 +1821,19 @@ int create_pkt_cmd_session_set_property( pkt->size += sizeof(u32) + sizeof(*work_mode); break; } case HAL_PARAM_VIDEO_WORK_ROUTE: { struct hal_video_work_route *hal = pdata; struct hfi_video_work_route *prop = (struct hfi_video_work_route *) &pkt->rg_property_data[1]; prop->video_work_route = hal->video_work_route; pkt->rg_property_data[0] = HFI_PROPERTY_PARAM_WORK_ROUTE; pkt->size += sizeof(u32) + sizeof(*prop); break; } case HAL_PARAM_VENC_HDR10_PQ_SEI: { struct hfi_hdr10_pq_sei *hfi; Loading drivers/media/platform/msm/vidc/msm_vidc.c +8 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,14 @@ static inline int start_streaming(struct msm_vidc_inst *inst) goto fail_start; } /* Decide work route for current session */ rc = msm_vidc_decide_work_route(inst); if (rc) { dprintk(VIDC_ERR, "Failed to decide work route for session %pK\n", inst); goto fail_start; } /* Decide work mode for current session */ rc = msm_vidc_decide_work_mode(inst); if (rc) { Loading drivers/media/platform/msm/vidc/msm_vidc_clocks.c +94 −7 Original line number Diff line number Diff line Loading @@ -948,12 +948,85 @@ int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst, inst->clk_data.extra_capture_buffer_count; } int msm_vidc_decide_work_route(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct hal_video_work_route pdata; u32 yuv_size = 0; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, "%s Invalid args: Inst = %pK\n", __func__, inst); return -EINVAL; } hdev = inst->core->device; pdata.video_work_route = 2; if (inst->session_type == MSM_VIDC_DECODER) { switch (inst->fmts[OUTPUT_PORT].fourcc) { case V4L2_PIX_FMT_MPEG2: pdata.video_work_route = 1; break; case V4L2_PIX_FMT_H264: if (inst->pic_struct != MSM_VIDC_PIC_STRUCT_PROGRESSIVE) pdata.video_work_route = 1; break; } } else if (inst->session_type == MSM_VIDC_ENCODER) { u32 rc_mode = 0; u32 slice_mode = 0; switch (inst->fmts[CAPTURE_PORT].fourcc) { case V4L2_PIX_FMT_VP8: case V4L2_PIX_FMT_TME: pdata.video_work_route = 1; goto decision_done; } yuv_size = inst->prop.height[CAPTURE_PORT] * inst->prop.width[CAPTURE_PORT]; if ((yuv_size <= 1920 * 1088) && inst->prop.fps <= 60) { rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); slice_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); if ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) || (slice_mode == V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES)) { pdata.video_work_route = 1; } } } else { return -EINVAL; } decision_done: inst->clk_data.work_route = pdata.video_work_route; rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VIDEO_WORK_ROUTE, (void *)&pdata); if (rc) dprintk(VIDC_WARN, " Failed to configure work route %pK\n", inst); return rc; } int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct hal_video_work_mode pdata; struct hal_enable latency; u32 yuv_size = 0; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, Loading @@ -963,8 +1036,10 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) } hdev = inst->core->device; if (inst->clk_data.low_latency_mode) { pdata.video_work_mode = VIDC_WORK_MODE_1; goto decision_done; } Loading @@ -976,19 +1051,33 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) break; case V4L2_PIX_FMT_H264: case V4L2_PIX_FMT_HEVC: if (inst->prop.height[OUTPUT_PORT] * inst->prop.width[OUTPUT_PORT] <= 1280 * 720) yuv_size = inst->prop.height[OUTPUT_PORT] * inst->prop.width[OUTPUT_PORT]; if ((inst->pic_struct != MSM_VIDC_PIC_STRUCT_PROGRESSIVE) || (yuv_size <= 1280 * 720)) pdata.video_work_mode = VIDC_WORK_MODE_1; break; } } else if (inst->session_type == MSM_VIDC_ENCODER) { u32 rc_mode = 0; u32 slice_mode = 0; pdata.video_work_mode = VIDC_WORK_MODE_1; switch (inst->fmts[CAPTURE_PORT].fourcc) { case V4L2_PIX_FMT_VP8: case V4L2_PIX_FMT_TME: goto decision_done; } slice_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) if ((slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE) && ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) || (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_MBR))) pdata.video_work_mode = VIDC_WORK_MODE_2; } else { return -EINVAL; Loading @@ -1014,8 +1103,6 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) (void *)&latency); } rc = msm_comm_scale_clocks_and_bus(inst); return rc; } Loading drivers/media/platform/msm/vidc/msm_vidc_clocks.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2018, 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 Loading Loading @@ -30,6 +30,7 @@ int msm_dcvs_try_enable(struct msm_vidc_inst *inst); int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst); int msm_comm_init_clocks_and_bus_data(struct msm_vidc_inst *inst); void msm_comm_free_freq_table(struct msm_vidc_inst *inst); int msm_vidc_decide_work_route(struct msm_vidc_inst *inst); int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst); int msm_vidc_decide_core_and_power_mode(struct msm_vidc_inst *inst); void msm_print_core_status(struct msm_vidc_core *core, u32 core_id); Loading drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ struct clock_data { enum hal_work_mode work_mode; bool low_latency_mode; bool turbo_mode; u32 work_route; }; struct profile_data { Loading Loading
drivers/media/platform/msm/vidc/hfi_packetization.c +14 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, 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 Loading Loading @@ -1821,6 +1821,19 @@ int create_pkt_cmd_session_set_property( pkt->size += sizeof(u32) + sizeof(*work_mode); break; } case HAL_PARAM_VIDEO_WORK_ROUTE: { struct hal_video_work_route *hal = pdata; struct hfi_video_work_route *prop = (struct hfi_video_work_route *) &pkt->rg_property_data[1]; prop->video_work_route = hal->video_work_route; pkt->rg_property_data[0] = HFI_PROPERTY_PARAM_WORK_ROUTE; pkt->size += sizeof(u32) + sizeof(*prop); break; } case HAL_PARAM_VENC_HDR10_PQ_SEI: { struct hfi_hdr10_pq_sei *hfi; Loading
drivers/media/platform/msm/vidc/msm_vidc.c +8 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,14 @@ static inline int start_streaming(struct msm_vidc_inst *inst) goto fail_start; } /* Decide work route for current session */ rc = msm_vidc_decide_work_route(inst); if (rc) { dprintk(VIDC_ERR, "Failed to decide work route for session %pK\n", inst); goto fail_start; } /* Decide work mode for current session */ rc = msm_vidc_decide_work_mode(inst); if (rc) { Loading
drivers/media/platform/msm/vidc/msm_vidc_clocks.c +94 −7 Original line number Diff line number Diff line Loading @@ -948,12 +948,85 @@ int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst, inst->clk_data.extra_capture_buffer_count; } int msm_vidc_decide_work_route(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct hal_video_work_route pdata; u32 yuv_size = 0; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, "%s Invalid args: Inst = %pK\n", __func__, inst); return -EINVAL; } hdev = inst->core->device; pdata.video_work_route = 2; if (inst->session_type == MSM_VIDC_DECODER) { switch (inst->fmts[OUTPUT_PORT].fourcc) { case V4L2_PIX_FMT_MPEG2: pdata.video_work_route = 1; break; case V4L2_PIX_FMT_H264: if (inst->pic_struct != MSM_VIDC_PIC_STRUCT_PROGRESSIVE) pdata.video_work_route = 1; break; } } else if (inst->session_type == MSM_VIDC_ENCODER) { u32 rc_mode = 0; u32 slice_mode = 0; switch (inst->fmts[CAPTURE_PORT].fourcc) { case V4L2_PIX_FMT_VP8: case V4L2_PIX_FMT_TME: pdata.video_work_route = 1; goto decision_done; } yuv_size = inst->prop.height[CAPTURE_PORT] * inst->prop.width[CAPTURE_PORT]; if ((yuv_size <= 1920 * 1088) && inst->prop.fps <= 60) { rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); slice_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); if ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) || (slice_mode == V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES)) { pdata.video_work_route = 1; } } } else { return -EINVAL; } decision_done: inst->clk_data.work_route = pdata.video_work_route; rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VIDEO_WORK_ROUTE, (void *)&pdata); if (rc) dprintk(VIDC_WARN, " Failed to configure work route %pK\n", inst); return rc; } int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct hal_video_work_mode pdata; struct hal_enable latency; u32 yuv_size = 0; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, Loading @@ -963,8 +1036,10 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) } hdev = inst->core->device; if (inst->clk_data.low_latency_mode) { pdata.video_work_mode = VIDC_WORK_MODE_1; goto decision_done; } Loading @@ -976,19 +1051,33 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) break; case V4L2_PIX_FMT_H264: case V4L2_PIX_FMT_HEVC: if (inst->prop.height[OUTPUT_PORT] * inst->prop.width[OUTPUT_PORT] <= 1280 * 720) yuv_size = inst->prop.height[OUTPUT_PORT] * inst->prop.width[OUTPUT_PORT]; if ((inst->pic_struct != MSM_VIDC_PIC_STRUCT_PROGRESSIVE) || (yuv_size <= 1280 * 720)) pdata.video_work_mode = VIDC_WORK_MODE_1; break; } } else if (inst->session_type == MSM_VIDC_ENCODER) { u32 rc_mode = 0; u32 slice_mode = 0; pdata.video_work_mode = VIDC_WORK_MODE_1; switch (inst->fmts[CAPTURE_PORT].fourcc) { case V4L2_PIX_FMT_VP8: case V4L2_PIX_FMT_TME: goto decision_done; } slice_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) if ((slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE) && ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) || (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_MBR))) pdata.video_work_mode = VIDC_WORK_MODE_2; } else { return -EINVAL; Loading @@ -1014,8 +1103,6 @@ int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst) (void *)&latency); } rc = msm_comm_scale_clocks_and_bus(inst); return rc; } Loading
drivers/media/platform/msm/vidc/msm_vidc_clocks.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2018, 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 Loading Loading @@ -30,6 +30,7 @@ int msm_dcvs_try_enable(struct msm_vidc_inst *inst); int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst); int msm_comm_init_clocks_and_bus_data(struct msm_vidc_inst *inst); void msm_comm_free_freq_table(struct msm_vidc_inst *inst); int msm_vidc_decide_work_route(struct msm_vidc_inst *inst); int msm_vidc_decide_work_mode(struct msm_vidc_inst *inst); int msm_vidc_decide_core_and_power_mode(struct msm_vidc_inst *inst); void msm_print_core_status(struct msm_vidc_core *core, u32 core_id); Loading
drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ struct clock_data { enum hal_work_mode work_mode; bool low_latency_mode; bool turbo_mode; u32 work_route; }; struct profile_data { Loading