Loading msm/vidc/msm_cvp_internal.c +4 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include "msm_cvp_internal.h" Loading Loading @@ -364,9 +364,6 @@ static int msm_cvp_register_buffer(struct msm_vidc_inst *inst, s_vpr_e(inst->sid, "%s: cbuf alloc failed\n", __func__); return -ENOMEM; } mutex_lock(&inst->cvpbufs.lock); list_add_tail(&cbuf->list, &inst->cvpbufs.list); mutex_unlock(&inst->cvpbufs.lock); memcpy(&cbuf->buf, buf, sizeof(struct msm_cvp_buffer)); cbuf->smem.buffer_type = get_hal_buftype(__func__, buf->type, Loading @@ -393,14 +390,14 @@ static int msm_cvp_register_buffer(struct msm_vidc_inst *inst, print_cvp_buffer(VIDC_ERR, "register failed", inst, cbuf); goto exit; } mutex_lock(&inst->cvpbufs.lock); list_add_tail(&cbuf->list, &inst->cvpbufs.list); mutex_unlock(&inst->cvpbufs.lock); return rc; exit: if (cbuf->smem.device_addr) inst->smem_ops->smem_unmap_dma_buf(inst, &cbuf->smem); mutex_lock(&inst->cvpbufs.lock); list_del(&cbuf->list); mutex_unlock(&inst->cvpbufs.lock); kfree(cbuf); cbuf = NULL; Loading msm/vidc/msm_vdec.c +1 −1 Original line number Diff line number Diff line Loading @@ -632,7 +632,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) { if (msm_vidc_check_for_vp9d_overload(inst->core)) { s_vpr_e(inst->sid, "VP9 Decode overload\n"); rc = -ENOTSUPP; rc = -ENOMEM; goto err_invalid_fmt; } } Loading msm/vidc/msm_vidc.c +6 −1 Original line number Diff line number Diff line Loading @@ -391,6 +391,8 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) return -EINVAL; } inst->last_qbuf_time_ns = ktime_get_ns(); for (i = 0; i < b->length; i++) { b->m.planes[i].m.fd = b->m.planes[i].reserved[MSM_VIDC_BUFFER_FD]; Loading Loading @@ -1171,7 +1173,9 @@ static void msm_vidc_buf_queue(struct vb2_buffer *vb2) if (rc) { print_vb2_buffer("failed vb2-qbuf", inst, vb2); msm_comm_generate_session_error(inst); vb2_buffer_done(vb2, VB2_BUF_STATE_DONE); msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_SYS_ERROR); } } Loading Loading @@ -1481,6 +1485,7 @@ void *msm_vidc_open(int core_id, int session_type) inst->max_filled_len = 0; inst->entropy_mode = HFI_H264_ENTROPY_CABAC; inst->full_range = COLOR_RANGE_UNSPECIFIED; inst->active = true; for (i = SESSION_MSG_INDEX(SESSION_MSG_START); i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) { Loading msm/vidc/msm_vidc.h +5 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ enum session_type { MSM_VIDC_MAX_DEVICES = MSM_VIDC_UNKNOWN, }; enum load_type { MSM_VIDC_VIDEO = 0, MSM_VIDC_IMAGE, }; union msm_v4l2_cmd { struct v4l2_decoder_cmd dec; struct v4l2_encoder_cmd enc; Loading msm/vidc/msm_vidc_buffer_calculations.c +12 −6 Original line number Diff line number Diff line Loading @@ -922,15 +922,24 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) div_factor = 4; base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max; } else { base_res_mbs = min_t(unsigned int, inst->capability.cap[CAP_MBS_PER_FRAME].max, NUM_MBS_4k); base_res_mbs = NUM_MBS_4k; if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) div_factor = 1; else div_factor = 2; } if (is_secure_session(inst)) div_factor = div_factor << 1; /* For targets that doesn't support 4k, consider max mb's for that * target and allocate max input buffer size for the same */ if (base_res_mbs > inst->capability.cap[CAP_MBS_PER_FRAME].max) { base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max; div_factor = 1; } frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor; /* multiply by 10/8 (1.25) to get size for 10 bit case */ Loading @@ -938,9 +947,6 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC)) frame_size = frame_size + (frame_size >> 2); if (is_secure_session(inst)) frame_size /= 2; if (inst->buffer_size_limit && (inst->buffer_size_limit < frame_size)) { frame_size = inst->buffer_size_limit; Loading Loading
msm/vidc/msm_cvp_internal.c +4 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include "msm_cvp_internal.h" Loading Loading @@ -364,9 +364,6 @@ static int msm_cvp_register_buffer(struct msm_vidc_inst *inst, s_vpr_e(inst->sid, "%s: cbuf alloc failed\n", __func__); return -ENOMEM; } mutex_lock(&inst->cvpbufs.lock); list_add_tail(&cbuf->list, &inst->cvpbufs.list); mutex_unlock(&inst->cvpbufs.lock); memcpy(&cbuf->buf, buf, sizeof(struct msm_cvp_buffer)); cbuf->smem.buffer_type = get_hal_buftype(__func__, buf->type, Loading @@ -393,14 +390,14 @@ static int msm_cvp_register_buffer(struct msm_vidc_inst *inst, print_cvp_buffer(VIDC_ERR, "register failed", inst, cbuf); goto exit; } mutex_lock(&inst->cvpbufs.lock); list_add_tail(&cbuf->list, &inst->cvpbufs.list); mutex_unlock(&inst->cvpbufs.lock); return rc; exit: if (cbuf->smem.device_addr) inst->smem_ops->smem_unmap_dma_buf(inst, &cbuf->smem); mutex_lock(&inst->cvpbufs.lock); list_del(&cbuf->list); mutex_unlock(&inst->cvpbufs.lock); kfree(cbuf); cbuf = NULL; Loading
msm/vidc/msm_vdec.c +1 −1 Original line number Diff line number Diff line Loading @@ -632,7 +632,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) { if (msm_vidc_check_for_vp9d_overload(inst->core)) { s_vpr_e(inst->sid, "VP9 Decode overload\n"); rc = -ENOTSUPP; rc = -ENOMEM; goto err_invalid_fmt; } } Loading
msm/vidc/msm_vidc.c +6 −1 Original line number Diff line number Diff line Loading @@ -391,6 +391,8 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) return -EINVAL; } inst->last_qbuf_time_ns = ktime_get_ns(); for (i = 0; i < b->length; i++) { b->m.planes[i].m.fd = b->m.planes[i].reserved[MSM_VIDC_BUFFER_FD]; Loading Loading @@ -1171,7 +1173,9 @@ static void msm_vidc_buf_queue(struct vb2_buffer *vb2) if (rc) { print_vb2_buffer("failed vb2-qbuf", inst, vb2); msm_comm_generate_session_error(inst); vb2_buffer_done(vb2, VB2_BUF_STATE_DONE); msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_SYS_ERROR); } } Loading Loading @@ -1481,6 +1485,7 @@ void *msm_vidc_open(int core_id, int session_type) inst->max_filled_len = 0; inst->entropy_mode = HFI_H264_ENTROPY_CABAC; inst->full_range = COLOR_RANGE_UNSPECIFIED; inst->active = true; for (i = SESSION_MSG_INDEX(SESSION_MSG_START); i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) { Loading
msm/vidc/msm_vidc.h +5 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ enum session_type { MSM_VIDC_MAX_DEVICES = MSM_VIDC_UNKNOWN, }; enum load_type { MSM_VIDC_VIDEO = 0, MSM_VIDC_IMAGE, }; union msm_v4l2_cmd { struct v4l2_decoder_cmd dec; struct v4l2_encoder_cmd enc; Loading
msm/vidc/msm_vidc_buffer_calculations.c +12 −6 Original line number Diff line number Diff line Loading @@ -922,15 +922,24 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) div_factor = 4; base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max; } else { base_res_mbs = min_t(unsigned int, inst->capability.cap[CAP_MBS_PER_FRAME].max, NUM_MBS_4k); base_res_mbs = NUM_MBS_4k; if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) div_factor = 1; else div_factor = 2; } if (is_secure_session(inst)) div_factor = div_factor << 1; /* For targets that doesn't support 4k, consider max mb's for that * target and allocate max input buffer size for the same */ if (base_res_mbs > inst->capability.cap[CAP_MBS_PER_FRAME].max) { base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max; div_factor = 1; } frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor; /* multiply by 10/8 (1.25) to get size for 10 bit case */ Loading @@ -938,9 +947,6 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC)) frame_size = frame_size + (frame_size >> 2); if (is_secure_session(inst)) frame_size /= 2; if (inst->buffer_size_limit && (inst->buffer_size_limit < frame_size)) { frame_size = inst->buffer_size_limit; Loading