Skip to content

Commit

Permalink
drivers: camera_v2-legacy: isp: Fix gcam crashes
Browse files Browse the repository at this point in the history
This reverts the following commits:
camera_v2-legacy: Revert "msm: camerav2: isp: Allocate UB for all source types"
camera_v2-legacy: Revert "msm: camerav2: isp: Reserve rdi ub based on image size"

Signed-off-by: TogoFire <togofire@mailfence.com>
Change-Id: I78a100659e39202953a7b7d7711027ce0d27ffcc
  • Loading branch information
TogoFire committed Jun 5, 2023
1 parent 392dfcb commit bab5d5e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ static void msm_vfe40_update_camif_state(struct vfe_device *vfe_dev,
msm_camera_io_w_mb((update_state == DISABLE_CAMIF ? 0x0 : 0x6),
vfe_dev->vfe_base + 0x2F4);
vfe_dev->axi_data.src_info[VFE_PIX_0].active = 0;
vfe_dev->axi_data.src_info[VFE_PIX_0].flag = 0;
/* testgen OFF*/
if (vfe_dev->axi_data.src_info[VFE_PIX_0].input_mux == TESTGEN)
msm_camera_io_w(1 << 1, vfe_dev->vfe_base + 0x93C);
Expand Down
70 changes: 27 additions & 43 deletions drivers/media/platform/msm/camera_v2-legacy/isp/msm_isp47.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,61 +1724,45 @@ void msm_vfe47_cfg_axi_ub_equal_default(
uint32_t prop_size = 0;
uint32_t wm_ub_size;
uint64_t delta;
uint32_t rdi_ub_offset;

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) {
num_used_wms++;
total_image_size +=
axi_data->wm_image_size[i];
}

for (i = 0; i < axi_data->hw_info->num_wm; i++) {
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);
}
if (!total_image_size) {
pr_err("%s: Error total_image_size is 0\n", __func__);
return;
}
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;
for (i = 0; i < axi_data->hw_info->num_wm; i++) {
if (!axi_data->free_wm[i]) {
msm_camera_io_w(0,
vfe_dev->vfe_base +
vfe_dev->hw_info->vfe_ops.axi_ops.
ub_reg_offset(vfe_dev, i));
}
if (!axi_data->free_wm[i] || frame_src != SRC_TO_INTF(
HANDLE_TO_IDX(axi_data->free_wm[i])))
if (!axi_data->free_wm[i])
continue;

if (frame_src == VFE_PIX_0) {
delta = (uint64_t)axi_data->wm_image_size[i] *
(uint64_t)prop_size;
do_div(delta, total_image_size);
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 {

rdi_ub_offset = (SRC_TO_INTF(
HANDLE_TO_IDX(axi_data->free_wm[i])) -
VFE_RAW_0) * 2 *
axi_data->hw_info->min_wm_ub;
wm_ub_size = axi_data->hw_info->min_wm_ub * 2;
msm_camera_io_w((rdi_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));
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;
}
}

Expand Down

0 comments on commit bab5d5e

Please sign in to comment.