Loading msm/vidc/hfi_common.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <asm/dma-iommu.h> Loading Loading @@ -80,7 +80,7 @@ const struct msm_vidc_bus_data DEFAULT_BUS_VOTE = { ((a) > (b) ? (a) - (b) < TRIVIAL_BW_THRESHOLD : \ (b) - (a) < TRIVIAL_BW_THRESHOLD) const int max_packets = 1000; const int max_packets = 480; /* 16 sessions x 30 packets */ static void venus_hfi_pm_handler(struct work_struct *work); static DECLARE_DELAYED_WORK(venus_hfi_pm_work, venus_hfi_pm_handler); Loading msm/vidc/msm_v4l2_vidc.c +10 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -207,6 +207,14 @@ static int msm_v4l2_queryctrl(struct file *file, void *fh, return msm_vidc_query_ctrl((void *)vidc_inst, ctrl); } static int msm_v4l2_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) { struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh); return msm_vidc_query_menu((void *)vidc_inst, qmenu); } static long msm_v4l2_default(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg) { Loading @@ -232,6 +240,7 @@ const struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = { .vidioc_s_ctrl = msm_v4l2_s_ctrl, .vidioc_g_ctrl = msm_v4l2_g_ctrl, .vidioc_queryctrl = msm_v4l2_queryctrl, .vidioc_querymenu = msm_v4l2_querymenu, .vidioc_subscribe_event = msm_v4l2_subscribe_event, .vidioc_unsubscribe_event = msm_v4l2_unsubscribe_event, .vidioc_decoder_cmd = msm_v4l2_decoder_cmd, Loading msm/vidc/msm_vdec.c +5 −0 Original line number Diff line number Diff line Loading @@ -1380,6 +1380,11 @@ int msm_vdec_set_extradata(struct msm_vidc_inst *inst) HFI_PROPERTY_PARAM_VDEC_INTERLACE_VIDEO_EXTRADATA, 0x1); msm_comm_set_extradata(inst, display_info, 0x1); if (codec == V4L2_PIX_FMT_VP9 || codec == V4L2_PIX_FMT_HEVC) { msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VDEC_HDR10_HIST_EXTRADATA, 0x1); } msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VDEC_NUM_CONCEALED_MB, 0x1); if (codec == V4L2_PIX_FMT_HEVC) { Loading msm/vidc/msm_venc.c +32 −11 Original line number Diff line number Diff line Loading @@ -938,10 +938,10 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = { { .id = V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS, .name = "Enable/Disable bitrate savings", .type = V4L2_CTRL_TYPE_BOOLEAN, .minimum = V4L2_MPEG_MSM_VIDC_DISABLE, .maximum = V4L2_MPEG_MSM_VIDC_ENABLE, .default_value = V4L2_MPEG_MSM_VIDC_ENABLE, .type = V4L2_CTRL_TYPE_INTEGER, .minimum = 0, .maximum = 3, .default_value = 3, .step = 1, }, { Loading Loading @@ -1132,11 +1132,13 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) int rc = 0; struct msm_vidc_format_desc *fmt_desc = NULL; struct v4l2_format *f = NULL; uint32_t vpu; if (!inst) { d_vpr_e("Invalid input = %pK\n", inst); return -EINVAL; } vpu = inst->core->platform_data->vpu_ver; f = &inst->fmts[OUTPUT_PORT].v4l2_fmt; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; f->fmt.pix_mp.height = DEFAULT_HEIGHT; Loading @@ -1162,9 +1164,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) f->fmt.pix_mp.height = DEFAULT_HEIGHT; f->fmt.pix_mp.width = DEFAULT_WIDTH; f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12_UBWC; if(inst->core->platform_data->vpu_ver == VPU_VERSION_IRIS1) f->fmt.pix_mp.num_planes = 1; else if (vpu == VPU_VERSION_IRIS2) f->fmt.pix_mp.num_planes = 2; f->fmt.pix_mp.plane_fmt[0].sizeimage = msm_vidc_calculate_enc_input_frame_size(inst); Loading Loading @@ -3315,8 +3316,10 @@ int msm_venc_set_bitrate_savings_mode(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct v4l2_ctrl *ctrl = NULL; struct v4l2_ctrl *cac; struct v4l2_ctrl *profile; struct hfi_enable enable; u32 codec; if (!inst || !inst->core) { d_vpr_e("%s: invalid params %pK\n", __func__, inst); Loading @@ -3324,12 +3327,30 @@ int msm_venc_set_bitrate_savings_mode(struct msm_vidc_inst *inst) } hdev = inst->core->device; ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS); enable.enable = !!ctrl->val; if (!ctrl->val && inst->rc_type != V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) { cac = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS); codec = get_v4l2_codec(inst); profile = get_ctrl(inst, V4L2_CID_MPEG_VIDEO_HEVC_PROFILE); /** * Enable CAC control: * 0x0 -> disabled, * 0x1 -> enabled for 8 bit * 0x2 -> enabled for 10 bit * 0x3 -> enabled for 8 and 10 bits both */ enable.enable = !!cac->val; if (cac->val == 0x1 && codec == V4L2_PIX_FMT_HEVC && profile->val == V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10) enable.enable = 0; else if (cac->val == 0x2 && !(codec == V4L2_PIX_FMT_HEVC && profile->val == V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10)) enable.enable = 0; if (!cac->val && inst->rc_type != V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) { s_vpr_h(inst->sid, "Can't disable bitrate savings for non-VBR_CFR\n"); enable.enable = 1; update_ctrl(cac, 3, inst->sid); } s_vpr_h(inst->sid, "%s: %d\n", __func__, enable.enable); Loading msm/vidc/msm_vidc.c +50 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <linux/dma-direction.h> Loading Loading @@ -143,22 +143,64 @@ int msm_vidc_query_ctrl(void *instance, struct v4l2_queryctrl *q_ctrl) } q_ctrl->minimum = ctrl->minimum; q_ctrl->maximum = ctrl->maximum; q_ctrl->default_value = ctrl->default_value; /* remove tier info for HEVC level */ if (q_ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_LEVEL) { q_ctrl->minimum &= ~(0xF << 28); q_ctrl->maximum &= ~(0xF << 28); } if (ctrl->type == V4L2_CTRL_TYPE_MENU) if (ctrl->type == V4L2_CTRL_TYPE_MENU) { q_ctrl->flags = ~(ctrl->menu_skip_mask); else } else { q_ctrl->flags = 0; s_vpr_h(inst->sid, "query ctrl: %s: min %d, max %d, flags %#x\n", ctrl->name, q_ctrl->minimum, q_ctrl->maximum, q_ctrl->flags); q_ctrl->step = ctrl->step; } s_vpr_h(inst->sid, "query ctrl: %s: min %d, max %d, default %d step %d flags %#x\n", ctrl->name, q_ctrl->minimum, q_ctrl->maximum, q_ctrl->default_value, q_ctrl->step, q_ctrl->flags); return rc; } EXPORT_SYMBOL(msm_vidc_query_ctrl); int msm_vidc_query_menu(void *instance, struct v4l2_querymenu *qmenu) { int rc = 0; struct msm_vidc_inst *inst = instance; struct v4l2_ctrl *ctrl; if (!inst || !qmenu) { d_vpr_e("%s: invalid params %pK %pK\n", __func__, inst, qmenu); return -EINVAL; } ctrl = v4l2_ctrl_find(&inst->ctrl_handler, qmenu->id); if (!ctrl) { s_vpr_e(inst->sid, "%s: get_ctrl failed for id %d\n", __func__, qmenu->id); return -EINVAL; } if (ctrl->type != V4L2_CTRL_TYPE_MENU) { s_vpr_e(inst->sid, "%s: ctrl: %s: type (%d) is not MENU type\n", __func__, ctrl->name, ctrl->type); return -EINVAL; } if (qmenu->index < ctrl->minimum || qmenu->index > ctrl->maximum) return -EINVAL; if (ctrl->menu_skip_mask & (1 << qmenu->index)) rc = -EINVAL; s_vpr_h(inst->sid, "%s: ctrl: %s: min %d, max %d, menu_skip_mask %#x, qmenu: id %d, index %d, %s\n", __func__, ctrl->name, ctrl->minimum, ctrl->maximum, ctrl->menu_skip_mask, qmenu->id, qmenu->index, rc ? "not supported" : "supported"); return rc; } EXPORT_SYMBOL(msm_vidc_query_menu); int msm_vidc_s_fmt(void *instance, struct v4l2_format *f) { int rc = 0; Loading Loading @@ -1359,7 +1401,8 @@ static int try_get_ctrl_for_instance(struct msm_vidc_inst *inst, return -EINVAL; vpu_ver = inst->core->platform_data->vpu_ver; ctrl->val = (vpu_ver == VPU_VERSION_IRIS1 || vpu_ver == VPU_VERSION_IRIS2) ? vpu_ver == VPU_VERSION_IRIS2 || vpu_ver == VPU_VERSION_IRIS2_1) ? V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BYTE : V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BIT; break; Loading Loading
msm/vidc/hfi_common.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <asm/dma-iommu.h> Loading Loading @@ -80,7 +80,7 @@ const struct msm_vidc_bus_data DEFAULT_BUS_VOTE = { ((a) > (b) ? (a) - (b) < TRIVIAL_BW_THRESHOLD : \ (b) - (a) < TRIVIAL_BW_THRESHOLD) const int max_packets = 1000; const int max_packets = 480; /* 16 sessions x 30 packets */ static void venus_hfi_pm_handler(struct work_struct *work); static DECLARE_DELAYED_WORK(venus_hfi_pm_work, venus_hfi_pm_handler); Loading
msm/vidc/msm_v4l2_vidc.c +10 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -207,6 +207,14 @@ static int msm_v4l2_queryctrl(struct file *file, void *fh, return msm_vidc_query_ctrl((void *)vidc_inst, ctrl); } static int msm_v4l2_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) { struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh); return msm_vidc_query_menu((void *)vidc_inst, qmenu); } static long msm_v4l2_default(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg) { Loading @@ -232,6 +240,7 @@ const struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = { .vidioc_s_ctrl = msm_v4l2_s_ctrl, .vidioc_g_ctrl = msm_v4l2_g_ctrl, .vidioc_queryctrl = msm_v4l2_queryctrl, .vidioc_querymenu = msm_v4l2_querymenu, .vidioc_subscribe_event = msm_v4l2_subscribe_event, .vidioc_unsubscribe_event = msm_v4l2_unsubscribe_event, .vidioc_decoder_cmd = msm_v4l2_decoder_cmd, Loading
msm/vidc/msm_vdec.c +5 −0 Original line number Diff line number Diff line Loading @@ -1380,6 +1380,11 @@ int msm_vdec_set_extradata(struct msm_vidc_inst *inst) HFI_PROPERTY_PARAM_VDEC_INTERLACE_VIDEO_EXTRADATA, 0x1); msm_comm_set_extradata(inst, display_info, 0x1); if (codec == V4L2_PIX_FMT_VP9 || codec == V4L2_PIX_FMT_HEVC) { msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VDEC_HDR10_HIST_EXTRADATA, 0x1); } msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VDEC_NUM_CONCEALED_MB, 0x1); if (codec == V4L2_PIX_FMT_HEVC) { Loading
msm/vidc/msm_venc.c +32 −11 Original line number Diff line number Diff line Loading @@ -938,10 +938,10 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = { { .id = V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS, .name = "Enable/Disable bitrate savings", .type = V4L2_CTRL_TYPE_BOOLEAN, .minimum = V4L2_MPEG_MSM_VIDC_DISABLE, .maximum = V4L2_MPEG_MSM_VIDC_ENABLE, .default_value = V4L2_MPEG_MSM_VIDC_ENABLE, .type = V4L2_CTRL_TYPE_INTEGER, .minimum = 0, .maximum = 3, .default_value = 3, .step = 1, }, { Loading Loading @@ -1132,11 +1132,13 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) int rc = 0; struct msm_vidc_format_desc *fmt_desc = NULL; struct v4l2_format *f = NULL; uint32_t vpu; if (!inst) { d_vpr_e("Invalid input = %pK\n", inst); return -EINVAL; } vpu = inst->core->platform_data->vpu_ver; f = &inst->fmts[OUTPUT_PORT].v4l2_fmt; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; f->fmt.pix_mp.height = DEFAULT_HEIGHT; Loading @@ -1162,9 +1164,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) f->fmt.pix_mp.height = DEFAULT_HEIGHT; f->fmt.pix_mp.width = DEFAULT_WIDTH; f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12_UBWC; if(inst->core->platform_data->vpu_ver == VPU_VERSION_IRIS1) f->fmt.pix_mp.num_planes = 1; else if (vpu == VPU_VERSION_IRIS2) f->fmt.pix_mp.num_planes = 2; f->fmt.pix_mp.plane_fmt[0].sizeimage = msm_vidc_calculate_enc_input_frame_size(inst); Loading Loading @@ -3315,8 +3316,10 @@ int msm_venc_set_bitrate_savings_mode(struct msm_vidc_inst *inst) { int rc = 0; struct hfi_device *hdev; struct v4l2_ctrl *ctrl = NULL; struct v4l2_ctrl *cac; struct v4l2_ctrl *profile; struct hfi_enable enable; u32 codec; if (!inst || !inst->core) { d_vpr_e("%s: invalid params %pK\n", __func__, inst); Loading @@ -3324,12 +3327,30 @@ int msm_venc_set_bitrate_savings_mode(struct msm_vidc_inst *inst) } hdev = inst->core->device; ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS); enable.enable = !!ctrl->val; if (!ctrl->val && inst->rc_type != V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) { cac = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS); codec = get_v4l2_codec(inst); profile = get_ctrl(inst, V4L2_CID_MPEG_VIDEO_HEVC_PROFILE); /** * Enable CAC control: * 0x0 -> disabled, * 0x1 -> enabled for 8 bit * 0x2 -> enabled for 10 bit * 0x3 -> enabled for 8 and 10 bits both */ enable.enable = !!cac->val; if (cac->val == 0x1 && codec == V4L2_PIX_FMT_HEVC && profile->val == V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10) enable.enable = 0; else if (cac->val == 0x2 && !(codec == V4L2_PIX_FMT_HEVC && profile->val == V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10)) enable.enable = 0; if (!cac->val && inst->rc_type != V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) { s_vpr_h(inst->sid, "Can't disable bitrate savings for non-VBR_CFR\n"); enable.enable = 1; update_ctrl(cac, 3, inst->sid); } s_vpr_h(inst->sid, "%s: %d\n", __func__, enable.enable); Loading
msm/vidc/msm_vidc.c +50 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include <linux/dma-direction.h> Loading Loading @@ -143,22 +143,64 @@ int msm_vidc_query_ctrl(void *instance, struct v4l2_queryctrl *q_ctrl) } q_ctrl->minimum = ctrl->minimum; q_ctrl->maximum = ctrl->maximum; q_ctrl->default_value = ctrl->default_value; /* remove tier info for HEVC level */ if (q_ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_LEVEL) { q_ctrl->minimum &= ~(0xF << 28); q_ctrl->maximum &= ~(0xF << 28); } if (ctrl->type == V4L2_CTRL_TYPE_MENU) if (ctrl->type == V4L2_CTRL_TYPE_MENU) { q_ctrl->flags = ~(ctrl->menu_skip_mask); else } else { q_ctrl->flags = 0; s_vpr_h(inst->sid, "query ctrl: %s: min %d, max %d, flags %#x\n", ctrl->name, q_ctrl->minimum, q_ctrl->maximum, q_ctrl->flags); q_ctrl->step = ctrl->step; } s_vpr_h(inst->sid, "query ctrl: %s: min %d, max %d, default %d step %d flags %#x\n", ctrl->name, q_ctrl->minimum, q_ctrl->maximum, q_ctrl->default_value, q_ctrl->step, q_ctrl->flags); return rc; } EXPORT_SYMBOL(msm_vidc_query_ctrl); int msm_vidc_query_menu(void *instance, struct v4l2_querymenu *qmenu) { int rc = 0; struct msm_vidc_inst *inst = instance; struct v4l2_ctrl *ctrl; if (!inst || !qmenu) { d_vpr_e("%s: invalid params %pK %pK\n", __func__, inst, qmenu); return -EINVAL; } ctrl = v4l2_ctrl_find(&inst->ctrl_handler, qmenu->id); if (!ctrl) { s_vpr_e(inst->sid, "%s: get_ctrl failed for id %d\n", __func__, qmenu->id); return -EINVAL; } if (ctrl->type != V4L2_CTRL_TYPE_MENU) { s_vpr_e(inst->sid, "%s: ctrl: %s: type (%d) is not MENU type\n", __func__, ctrl->name, ctrl->type); return -EINVAL; } if (qmenu->index < ctrl->minimum || qmenu->index > ctrl->maximum) return -EINVAL; if (ctrl->menu_skip_mask & (1 << qmenu->index)) rc = -EINVAL; s_vpr_h(inst->sid, "%s: ctrl: %s: min %d, max %d, menu_skip_mask %#x, qmenu: id %d, index %d, %s\n", __func__, ctrl->name, ctrl->minimum, ctrl->maximum, ctrl->menu_skip_mask, qmenu->id, qmenu->index, rc ? "not supported" : "supported"); return rc; } EXPORT_SYMBOL(msm_vidc_query_menu); int msm_vidc_s_fmt(void *instance, struct v4l2_format *f) { int rc = 0; Loading Loading @@ -1359,7 +1401,8 @@ static int try_get_ctrl_for_instance(struct msm_vidc_inst *inst, return -EINVAL; vpu_ver = inst->core->platform_data->vpu_ver; ctrl->val = (vpu_ver == VPU_VERSION_IRIS1 || vpu_ver == VPU_VERSION_IRIS2) ? vpu_ver == VPU_VERSION_IRIS2 || vpu_ver == VPU_VERSION_IRIS2_1) ? V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BYTE : V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BIT; break; Loading