Loading drivers/media/platform/msm/vidc/msm_vdec.c +17 −101 Original line number Diff line number Diff line Loading @@ -601,10 +601,6 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = { #define NUM_CTRLS ARRAY_SIZE(msm_vdec_ctrls) static int set_buffer_size(struct msm_vidc_inst *inst, u32 buffer_size, enum hal_buffer buffer_type); static int update_output_buffer_size(struct msm_vidc_inst *inst, struct v4l2_format *f, int num_planes); static int vdec_hal_to_v4l2(int id, int value); static u32 get_frame_size_nv12(int plane, Loading Loading @@ -1174,13 +1170,6 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) for (i = 0; i < fmt->num_planes; ++i) inst->bufq[CAPTURE_PORT].vb2_bufq.plane_sizes[i] = f->fmt.pix_mp.plane_fmt[i].sizeimage; rc = update_output_buffer_size(inst, f, fmt->num_planes); if (rc) { dprintk(VIDC_ERR, "%s - failed to update buffer size: %d\n", __func__, rc); goto exit; } } if (stride && scanlines) { Loading Loading @@ -1213,95 +1202,6 @@ exit: return rc; } static int set_buffer_size(struct msm_vidc_inst *inst, u32 buffer_size, enum hal_buffer buffer_type) { int rc = 0; struct hfi_device *hdev; struct hal_buffer_size_minimum b; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); return -EINVAL; } hdev = inst->core->device; dprintk(VIDC_DBG, "Set minimum buffer size = %d for buffer type %d to fw\n", buffer_size, buffer_type); b.buffer_type = buffer_type; b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); if (rc) dprintk(VIDC_ERR, "%s - failed to set actual buffer size %u on firmware\n", __func__, buffer_size); return rc; } static int update_output_buffer_size(struct msm_vidc_inst *inst, struct v4l2_format *f, int num_planes) { int rc = 0, i = 0; struct hal_buffer_requirements *bufreq; if (!inst || !f) return -EINVAL; /* * Firmware expects driver to always set the minimum buffer * size negotiated with the v4l2 client. Firmware will use this * size to check for buffer sufficiency in dynamic buffer mode. */ for (i = 0; i < num_planes; ++i) { enum hal_buffer type = msm_comm_get_hal_output_buffer(inst); if (EXTRADATA_IDX(num_planes) && i == EXTRADATA_IDX(num_planes)) continue; bufreq = get_buff_req_buffer(inst, type); if (!bufreq) goto exit; if (f->fmt.pix_mp.plane_fmt[i].sizeimage >= bufreq->buffer_size) { rc = set_buffer_size(inst, f->fmt.pix_mp.plane_fmt[i].sizeimage, type); if (rc) goto exit; } } /* * Set min buffer size for DPB buffers as well. * Firmware mandates setting of minimum buffer size * and actual buffer count for both OUTPUT and OUTPUT2. * Hence we are setting back the same buffer size * information back to firmware. */ if (msm_comm_get_stream_output_mode(inst) == HAL_VIDEO_DECODER_SECONDARY) { bufreq = get_buff_req_buffer(inst, HAL_BUFFER_OUTPUT); if (!bufreq) { rc = -EINVAL; goto exit; } rc = set_buffer_size(inst, bufreq->buffer_size, HAL_BUFFER_OUTPUT); if (rc) goto exit; } exit: return rc; } static int set_default_properties(struct msm_vidc_inst *inst) { struct hfi_device *hdev; Loading Loading @@ -1787,12 +1687,28 @@ static inline int start_streaming(struct msm_vidc_inst *inst) int rc = 0; struct hfi_device *hdev; bool slave_side_cp = inst->core->resources.slave_side_cp; struct hal_buffer_size_minimum b; unsigned int buffer_size; struct msm_vidc_format *fmt = NULL; fmt = inst->fmts[CAPTURE_PORT]; buffer_size = fmt->get_frame_size(0, inst->prop.height[CAPTURE_PORT], inst->prop.width[CAPTURE_PORT]); hdev = inst->core->device; if (msm_comm_get_stream_output_mode(inst) == HAL_VIDEO_DECODER_SECONDARY) HAL_VIDEO_DECODER_SECONDARY) { rc = msm_vidc_check_scaling_supported(inst); b.buffer_type = HAL_BUFFER_OUTPUT2; } else { b.buffer_type = HAL_BUFFER_OUTPUT; } b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); if (rc) { dprintk(VIDC_ERR, "H/w scaling is not in valid range\n"); return -EINVAL; Loading drivers/media/platform/msm/vidc/msm_vidc_common.c +6 −0 Original line number Diff line number Diff line Loading @@ -2978,6 +2978,7 @@ static int set_output_buffers(struct msm_vidc_inst *inst, struct hal_buffer_requirements *output_buf, *extradata_buf; int i; struct hfi_device *hdev; struct hal_buffer_size_minimum b; hdev = inst->core->device; Loading @@ -2994,6 +2995,11 @@ static int set_output_buffers(struct msm_vidc_inst *inst, output_buf->buffer_size); buffer_size = output_buf->buffer_size; b.buffer_type = buffer_type; b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); extradata_buf = get_buff_req_buffer(inst, HAL_BUFFER_EXTRADATA_OUTPUT); if (extradata_buf) { Loading Loading
drivers/media/platform/msm/vidc/msm_vdec.c +17 −101 Original line number Diff line number Diff line Loading @@ -601,10 +601,6 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = { #define NUM_CTRLS ARRAY_SIZE(msm_vdec_ctrls) static int set_buffer_size(struct msm_vidc_inst *inst, u32 buffer_size, enum hal_buffer buffer_type); static int update_output_buffer_size(struct msm_vidc_inst *inst, struct v4l2_format *f, int num_planes); static int vdec_hal_to_v4l2(int id, int value); static u32 get_frame_size_nv12(int plane, Loading Loading @@ -1174,13 +1170,6 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) for (i = 0; i < fmt->num_planes; ++i) inst->bufq[CAPTURE_PORT].vb2_bufq.plane_sizes[i] = f->fmt.pix_mp.plane_fmt[i].sizeimage; rc = update_output_buffer_size(inst, f, fmt->num_planes); if (rc) { dprintk(VIDC_ERR, "%s - failed to update buffer size: %d\n", __func__, rc); goto exit; } } if (stride && scanlines) { Loading Loading @@ -1213,95 +1202,6 @@ exit: return rc; } static int set_buffer_size(struct msm_vidc_inst *inst, u32 buffer_size, enum hal_buffer buffer_type) { int rc = 0; struct hfi_device *hdev; struct hal_buffer_size_minimum b; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); return -EINVAL; } hdev = inst->core->device; dprintk(VIDC_DBG, "Set minimum buffer size = %d for buffer type %d to fw\n", buffer_size, buffer_type); b.buffer_type = buffer_type; b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); if (rc) dprintk(VIDC_ERR, "%s - failed to set actual buffer size %u on firmware\n", __func__, buffer_size); return rc; } static int update_output_buffer_size(struct msm_vidc_inst *inst, struct v4l2_format *f, int num_planes) { int rc = 0, i = 0; struct hal_buffer_requirements *bufreq; if (!inst || !f) return -EINVAL; /* * Firmware expects driver to always set the minimum buffer * size negotiated with the v4l2 client. Firmware will use this * size to check for buffer sufficiency in dynamic buffer mode. */ for (i = 0; i < num_planes; ++i) { enum hal_buffer type = msm_comm_get_hal_output_buffer(inst); if (EXTRADATA_IDX(num_planes) && i == EXTRADATA_IDX(num_planes)) continue; bufreq = get_buff_req_buffer(inst, type); if (!bufreq) goto exit; if (f->fmt.pix_mp.plane_fmt[i].sizeimage >= bufreq->buffer_size) { rc = set_buffer_size(inst, f->fmt.pix_mp.plane_fmt[i].sizeimage, type); if (rc) goto exit; } } /* * Set min buffer size for DPB buffers as well. * Firmware mandates setting of minimum buffer size * and actual buffer count for both OUTPUT and OUTPUT2. * Hence we are setting back the same buffer size * information back to firmware. */ if (msm_comm_get_stream_output_mode(inst) == HAL_VIDEO_DECODER_SECONDARY) { bufreq = get_buff_req_buffer(inst, HAL_BUFFER_OUTPUT); if (!bufreq) { rc = -EINVAL; goto exit; } rc = set_buffer_size(inst, bufreq->buffer_size, HAL_BUFFER_OUTPUT); if (rc) goto exit; } exit: return rc; } static int set_default_properties(struct msm_vidc_inst *inst) { struct hfi_device *hdev; Loading Loading @@ -1787,12 +1687,28 @@ static inline int start_streaming(struct msm_vidc_inst *inst) int rc = 0; struct hfi_device *hdev; bool slave_side_cp = inst->core->resources.slave_side_cp; struct hal_buffer_size_minimum b; unsigned int buffer_size; struct msm_vidc_format *fmt = NULL; fmt = inst->fmts[CAPTURE_PORT]; buffer_size = fmt->get_frame_size(0, inst->prop.height[CAPTURE_PORT], inst->prop.width[CAPTURE_PORT]); hdev = inst->core->device; if (msm_comm_get_stream_output_mode(inst) == HAL_VIDEO_DECODER_SECONDARY) HAL_VIDEO_DECODER_SECONDARY) { rc = msm_vidc_check_scaling_supported(inst); b.buffer_type = HAL_BUFFER_OUTPUT2; } else { b.buffer_type = HAL_BUFFER_OUTPUT; } b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); if (rc) { dprintk(VIDC_ERR, "H/w scaling is not in valid range\n"); return -EINVAL; Loading
drivers/media/platform/msm/vidc/msm_vidc_common.c +6 −0 Original line number Diff line number Diff line Loading @@ -2978,6 +2978,7 @@ static int set_output_buffers(struct msm_vidc_inst *inst, struct hal_buffer_requirements *output_buf, *extradata_buf; int i; struct hfi_device *hdev; struct hal_buffer_size_minimum b; hdev = inst->core->device; Loading @@ -2994,6 +2995,11 @@ static int set_output_buffers(struct msm_vidc_inst *inst, output_buf->buffer_size); buffer_size = output_buf->buffer_size; b.buffer_type = buffer_type; b.buffer_size = buffer_size; rc = call_hfi_op(hdev, session_set_property, inst->session, HAL_PARAM_BUFFER_SIZE_MINIMUM, &b); extradata_buf = get_buff_req_buffer(inst, HAL_BUFFER_EXTRADATA_OUTPUT); if (extradata_buf) { Loading