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

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

Merge "msm: camera_v2: isp: Reserve rdi ub based on image size"

parents b802ba51 41d4fbff
Loading
Loading
Loading
Loading
+20 −62
Original line number Diff line number Diff line
@@ -1900,25 +1900,15 @@ void msm_vfe47_cfg_axi_ub_equal_default(
	uint32_t wm_ub_size;
	uint64_t delta;

	if (frame_src == VFE_PIX_0) {
	for (i = 0; i < axi_data->hw_info->num_wm; i++) {
			if (axi_data->free_wm[i] &&
				SRC_TO_INTF(
				HANDLE_TO_IDX(axi_data->free_wm[i])) ==
				VFE_PIX_0) {
		if (axi_data->free_wm[i]) {
			num_used_wms++;
			total_image_size +=
				axi_data->wm_image_size[i];
		}
	}
		ub_offset = (axi_data->hw_info->num_rdi * 2) *
			axi_data->hw_info->min_wm_ub;
	prop_size = vfe_dev->hw_info->vfe_ops.axi_ops.get_ub_size(
					vfe_dev) -
			axi_data->hw_info->min_wm_ub * (num_used_wms +
			axi_data->hw_info->num_rdi * 2);
	}

		vfe_dev) - axi_data->hw_info->min_wm_ub * num_used_wms;
	for (i = 0; i < axi_data->hw_info->num_wm; i++) {
		if (!axi_data->free_wm[i]) {
			msm_camera_io_w(0,
@@ -1932,52 +1922,20 @@ void msm_vfe47_cfg_axi_ub_equal_default(
			HANDLE_TO_IDX(axi_data->free_wm[i])))
			continue;

		if (frame_src == VFE_PIX_0) {
			if (total_image_size) {
		delta = (uint64_t)axi_data->wm_image_size[i] *
			(uint64_t)prop_size;
			do_div(delta, total_image_size);
		if (frame_src != VFE_PIX_0) {
			if (delta <= axi_data->hw_info->min_wm_ub)
				delta = axi_data->hw_info->min_wm_ub;
		}
		wm_ub_size = axi_data->hw_info->min_wm_ub +
				(uint32_t)delta;
				msm_camera_io_w(ub_offset << 16 |
					(wm_ub_size - 1),
					vfe_dev->vfe_base +
					vfe_dev->hw_info->vfe_ops.axi_ops
						.ub_reg_offset(vfe_dev, i));
				ub_offset += wm_ub_size;
			} else {
				pr_err("%s: image size is zero\n", __func__);
			}
		} else {
			uint32_t rdi_ub_offset;
			int plane;
			int vfe_idx;
			struct msm_vfe_axi_stream *stream_info;

			stream_info = msm_isp_get_stream_common_data(vfe_dev,
					HANDLE_TO_IDX(axi_data->free_wm[i]));
			if (!stream_info) {
				pr_err("%s: stream_info is NULL!", __func__);
				return;
			}
			vfe_idx = msm_isp_get_vfe_idx_for_stream(vfe_dev,
							stream_info);
			for (plane = 0; plane < stream_info->num_planes;
				plane++)
				if (stream_info->wm[vfe_idx][plane] ==
					axi_data->free_wm[i])
					break;

			rdi_ub_offset = (SRC_TO_INTF(
					HANDLE_TO_IDX(axi_data->free_wm[i])) -
					VFE_RAW_0) *
					axi_data->hw_info->min_wm_ub * 2;
			wm_ub_size = axi_data->hw_info->min_wm_ub * 2;
			msm_camera_io_w(rdi_ub_offset << 16 | (wm_ub_size - 1),
		msm_camera_io_w(ub_offset << 16 | (wm_ub_size - 1),
			vfe_dev->vfe_base +
			vfe_dev->hw_info->vfe_ops.axi_ops.ub_reg_offset(
				vfe_dev, i));
		}
		ub_offset += wm_ub_size;
	}
}