Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6efa4d19 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: refine decode batching logic"

parents 1e380f3b 37f9bbab
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -675,14 +675,6 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		memcpy(f, &fmt->v4l2_fmt, sizeof(struct v4l2_format));
	}

	/*
	 * if batching enabled previously then you may chose
	 * to disable it based on recent configuration changes.
	 * if batching already disabled do not enable it again
	 * as sufficient extra buffers (required for batch mode
	 * on both ports) may not have been updated to client.
	 */
	if (inst->batch.enable)
	inst->batch.enable = is_batching_allowed(inst);
	msm_dcvs_try_enable(inst);

@@ -884,6 +876,7 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		if (ctrl->val)
			inst->flags |= VIDC_THUMBNAIL;

		inst->batch.enable = is_batching_allowed(inst);
		rc = msm_vidc_calculate_buffer_counts(inst);
		if (rc) {
			s_vpr_e(inst->sid,
@@ -905,16 +898,6 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE:
		inst->clk_data.frame_rate = ctrl->val;
		if (inst->state >= MSM_VIDC_LOAD_RESOURCES)
			break;
		/* Only recalculate buffer counts before buffers allocated */
		rc = msm_vidc_calculate_buffer_counts(inst);
		if (rc) {
			s_vpr_e(inst->sid,
				"%s failed to calculate buffer count after set fps\n",
				__func__);
			return rc;
		}
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA:
		if (ctrl->val == EXTRADATA_NONE)
@@ -942,6 +925,7 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE:
		inst->clk_data.low_latency_mode = !!ctrl->val;
		inst->batch.enable = is_batching_allowed(inst);
		break;
	default:
		s_vpr_e(inst->sid, "Unknown control %#x\n", ctrl->id);
+1 −9
Original line number Diff line number Diff line
@@ -881,14 +881,6 @@ static inline int start_streaming(struct msm_vidc_inst *inst)
		}
	}

	/*
	 * if batching enabled previously then you may chose
	 * to disable it based on recent configuration changes.
	 * if batching already disabled do not enable it again
	 * as sufficient extra buffers (required for batch mode
	 * on both ports) may not have been updated to client.
	 */
	if (inst->batch.enable)
	inst->batch.enable = is_batching_allowed(inst);
	s_vpr_hp(inst->sid, "%s: batching %s for inst %pK\n",
		__func__, inst->batch.enable ? "enabled" : "disabled", inst);
+2 −8
Original line number Diff line number Diff line
@@ -776,13 +776,7 @@ static int msm_vidc_get_extra_input_buff_count(struct msm_vidc_inst *inst)
					f->fmt.pix_mp.height, 4096, 2160))
			goto exit;

		/*
		 * Allocating 2 extra buffers, assuming current session is
		 * always batch eligible. Cannot rely on inst->batch.enable
		 * as it can be enabled/disabled based on clip fps etc. But
		 * decoder input can not be reallocated at run time.
		 */
		if (core->resources.decode_batching)
		if (inst->batch.enable)
			extra_input_count = (BATCH_DEC_TOTAL_INPUT_BUFFERS -
				MIN_INPUT_BUFFERS);

@@ -873,7 +867,7 @@ static int msm_vidc_get_extra_output_buff_count(struct msm_vidc_inst *inst)
		 * If platform supports decode batching ensure minimum 6 extra
		 * output buffers. Else add 4 extra output buffers for DCVS.
		 */
		if (core->resources.decode_batching)
		if (inst->batch.enable)
			extra_output_count = BATCH_DEC_EXTRA_OUTPUT_BUFFERS;
	} else if (is_encode_session(inst)) {
		/*
+12 −4
Original line number Diff line number Diff line
@@ -1798,9 +1798,8 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
			"seq: V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");

		/* decide batching as configuration changed */
		if (inst->batch.enable)
		inst->batch.enable = is_batching_allowed(inst);
		s_vpr_hp(inst->sid, "seq : batching %s\n", __func__,
		s_vpr_hp(inst->sid, "seq : batching %s\n",
			inst->batch.enable ? "enabled" : "disabled");
		msm_dcvs_try_enable(inst);
		extra_buff_count = msm_vidc_get_extra_buff_count(inst,
@@ -2834,7 +2833,16 @@ bool is_batching_allowed(struct msm_vidc_inst *inst)
	maxmbs = inst->capability.cap[CAP_BATCH_MAX_MB_PER_FRAME].max;
	maxfps = inst->capability.cap[CAP_BATCH_MAX_FPS].max;

	return (is_single_session(inst, ignore_flags) &&
	/*
	 * if batching enabled previously then you may chose
	 * to disable it based on recent configuration changes.
	 * if batching already disabled do not enable it again
	 * as sufficient extra buffers (required for batch mode
	 * on both ports) may not have been updated to client.
	 */
	return (inst->batch.enable &&
		inst->core->resources.decode_batching &&
		is_single_session(inst, ignore_flags) &&
		is_decode_session(inst) &&
		!is_thumbnail_session(inst) &&
		!inst->clk_data.low_latency_mode &&