diff --git a/msm/vidc/hfi_ar50_lt.c b/msm/vidc/hfi_ar50_lt.c index f883cdfc8d26..85b4909342e7 100644 --- a/msm/vidc/hfi_ar50_lt.c +++ b/msm/vidc/hfi_ar50_lt.c @@ -87,7 +87,6 @@ #define VIDC_WRAPPER_INTR_MASK_A2HCPU_BMSK_AR50_LT 0x4 #define VIDC_WRAPPER_INTR_MASK_A2HCPU_SHFT_AR50_LT 0x2 -#define VIDC_WRAPPER_INTR_CLEAR_AR50_LT (VIDC_WRAPPER_BASE_OFFS_AR50_LT + 0x14) #define VIDC_WRAPPER_INTR_CLEAR_A2HWD_BMSK_AR50_LT 0x10 #define VIDC_WRAPPER_INTR_CLEAR_A2HWD_SHFT_AR50_LT 0x4 #define VIDC_WRAPPER_INTR_CLEAR_A2H_BMSK_AR50_LT 0x4 @@ -246,7 +245,6 @@ void __core_clear_interrupt_ar50_lt(struct venus_hfi_device *device) } __write_register(device, VIDC_CPU_CS_A2HSOFTINTCLR_AR50_LT, 1, DEFAULT_SID); - __write_register(device, VIDC_WRAPPER_INTR_CLEAR_AR50_LT, intr_status, DEFAULT_SID); } int __boot_firmware_ar50_lt(struct venus_hfi_device *device, u32 sid) diff --git a/msm/vidc/msm_vdec.c b/msm/vidc/msm_vdec.c index 7d4b1de3b252..2e9780442231 100644 --- a/msm/vidc/msm_vdec.c +++ b/msm/vidc/msm_vdec.c @@ -904,7 +904,9 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDC_VIDEO_DECODE_ORDER: case V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_8BIT: case V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_10BIT: + break; case V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE: + inst->clk_data.frame_rate = ctrl->val; break; case V4L2_CID_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE: inst->flags &= ~VIDC_THUMBNAIL; diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c index 83df08a7d44e..b5499c609a50 100644 --- a/msm/vidc/msm_venc.c +++ b/msm/vidc/msm_venc.c @@ -3810,6 +3810,12 @@ int msm_venc_set_hp_max_layer(struct msm_vidc_inst *inst) __func__); return rc; } + if (!inst->hybrid_hp && max_layer->val > 4) { + update_ctrl(max_layer, 0, inst->sid); + s_vpr_h(inst->sid, + "%s: Hier-P requested beyond max capability\n", __func__); + return 0; + } /* * We send enhancement layer count to FW, diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index d5cb06e20b67..3052801b9589 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -264,6 +264,7 @@ #define HFI_VENUS_HEIGHT_ALIGNMENT 32 #define SYSTEM_LAL_TILE10 192 +#define NUM_MBS_360P (((480 + 15) >> 4) * ((360 + 15) >> 4)) #define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4)) #define NUM_MBS_4k (((4096 + 15) >> 4) * ((2304 + 15) >> 4)) #define MB_SIZE_IN_PIXEL (16 * 16) @@ -493,17 +494,17 @@ int msm_vidc_get_num_ref_frames(struct msm_vidc_inst *inst) max_layer = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_HEVC_MAX_HIER_CODING_LAYER); if (frame_t->val == V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P && - max_layer->val > 0) { + max_layer->val > 1) { codec = get_v4l2_codec(inst); /* LTR and B - frame not supported with hybrid HP */ if (inst->hybrid_hp) - num_ref = (max_layer->val - 1); + num_ref = (max_layer->val + 1) >> 1; else if (codec == V4L2_PIX_FMT_HEVC) num_ref = ((max_layer->val + 1) / 2) + ltr_count; - else if ((codec == V4L2_PIX_FMT_H264) && (max_layer->val <= 4)) - num_ref = ((1 << (max_layer->val - 1)) - 1) + ltr_count; + else if ((codec == V4L2_PIX_FMT_H264) && (max_layer->val < 4)) + num_ref = (max_layer->val - 1) + ltr_count; else - num_ref = ((max_layer->val + 1) / 2) + ltr_count; + num_ref = max_layer->val + ltr_count; } if (is_hier_b_session(inst)) { @@ -985,8 +986,8 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst) /* * Encoder output size calculation: 32 Align width/height * For CQ or heic session : YUVsize * 2 - * For resolution < 720p : YUVsize * 4 - * For resolution > 720p & <= 4K : YUVsize / 2 + * For resolution <= 480x360p : YUVsize * 2 + * For resolution > 360p & <= 4K : YUVsize / 2 * For resolution > 4k : YUVsize / 4 * Initially frame_size = YUVsize * 2; */ @@ -1003,8 +1004,8 @@ u32 msm_vidc_calculate_enc_output_frame_size(struct msm_vidc_inst *inst) is_grid_session(inst) || is_image_session(inst)) goto calc_done; - if (mbs_per_frame < NUM_MBS_720P) - frame_size = frame_size << 1; + if (mbs_per_frame <= NUM_MBS_360P) + goto calc_done; /* Default frame_size = YUVsize * 2 */ else if (mbs_per_frame <= NUM_MBS_4k) frame_size = frame_size >> 2; else diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index eccec057b747..0e32af28ef4c 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -1777,7 +1777,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data) } else if (rc == -ENOTSUPP) { msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_HW_UNSUPPORTED); - } else if (rc == -EBUSY) { + } else if (rc == -ENOMEM) { msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_HW_OVERLOAD); } @@ -5765,8 +5765,9 @@ static int msm_vidc_check_mbpf_supported(struct msm_vidc_inst *inst) mutex_lock(&core->lock); list_for_each_entry(temp, &core->instances, list) { - /* ignore invalid session */ - if (temp->state == MSM_VIDC_CORE_INVALID) + /* ignore invalid and completed session */ + if (temp->state == MSM_VIDC_CORE_INVALID || + temp->state >= MSM_VIDC_STOP_DONE) continue; /* ignore thumbnail session */ if (is_thumbnail_session(temp)) @@ -5782,7 +5783,7 @@ static int msm_vidc_check_mbpf_supported(struct msm_vidc_inst *inst) if (mbpf > core->resources.max_mbpf) { msm_vidc_print_running_insts(inst->core); - return -EBUSY; + return -ENOMEM; } return 0; @@ -5933,7 +5934,7 @@ static int msm_vidc_check_mbps_supported(struct msm_vidc_inst *inst) "H/W is overloaded. needed: %d max: %d\n", video_load, max_video_load); msm_vidc_print_running_insts(inst->core); - return -EBUSY; + return -ENOMEM; } if (video_load + image_load > max_video_load + max_image_load) { @@ -5942,7 +5943,7 @@ static int msm_vidc_check_mbps_supported(struct msm_vidc_inst *inst) video_load, image_load, max_video_load, max_image_load); msm_vidc_print_running_insts(inst->core); - return -EBUSY; + return -ENOMEM; } } return 0; @@ -7768,6 +7769,8 @@ u32 msm_comm_calc_framerate(struct msm_vidc_inst *inst, { u32 framerate = inst->clk_data.frame_rate; u32 interval; + struct msm_vidc_capability *capability; + capability = &inst->capability; if (timestamp_us <= prev_ts) { s_vpr_e(inst->sid, "%s: invalid ts %lld, prev ts %lld\n", @@ -7775,8 +7778,12 @@ u32 msm_comm_calc_framerate(struct msm_vidc_inst *inst, return framerate; } interval = (u32)(timestamp_us - prev_ts); - framerate = ((1000000 + interval / 2) / interval) << 16; - return framerate; + framerate = (1000000 + interval / 2) / interval; + if (framerate > capability->cap[CAP_FRAMERATE].max) + framerate = capability->cap[CAP_FRAMERATE].max; + if (framerate < 1) + framerate = 1; + return framerate << 16; } u32 msm_comm_get_max_framerate(struct msm_vidc_inst *inst) diff --git a/msm/vidc/msm_vidc_platform.c b/msm/vidc/msm_vidc_platform.c index 7c5f1a2b1ce5..be9fad4f1300 100644 --- a/msm/vidc/msm_vidc_platform.c +++ b/msm/vidc/msm_vidc_platform.c @@ -289,7 +289,7 @@ static struct msm_vidc_codec_capability holi_capabilities[] = { {CAP_SECURE_BITRATE, DOMAINS_ALL, CODECS_ALL, 1, 35000000, 1, 20000000}, /* All intra encoding usecase specific */ - {CAP_ALLINTRA_MAX_FPS, ENC, H264|HEVC, 1, 30, 1, 30}, + {CAP_ALLINTRA_MAX_FPS, ENC, H264|HEVC, 1, 60, 1, 30}, /* Image specific */ {CAP_HEVC_IMAGE_FRAME_WIDTH, ENC, HEVC, 128, 512, 2, 512},