msm: vidc: Release non-requested internal buffers

during load resource firmware will check input buffer type
against requested buffer type. If there a mismatch it will
throw an error. So cleared non-requested buffer from the
scratch buffer list

Change-Id: Ifabf532982a393d4fc356ff3cad0ca3fd715fce0
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal 2019-05-24 19:31:54 +05:30 • committed by Gerrit - the friendly Code Review server
commit 12ac83a8c5
2 changed files with 37 additions and 0 deletions

View file

@ -3437,6 +3437,29 @@ static int get_flipped_state(int present_state,
return flipped_state;
}
int msm_comm_reset_bufreqs(struct msm_vidc_inst *inst, enum hal_buffer buf_type)
{
struct hal_buffer_requirements *bufreqs;
if (!inst) {
dprintk(VIDC_ERR, "%s: invalid params\n", __func__);
return -EINVAL;
}
bufreqs = get_buff_req_buffer(inst, buf_type);
if (!bufreqs) {
dprintk(VIDC_ERR, "%s: invalid buf type %d\n",
__func__, buf_type);
return -EINVAL;
}
bufreqs->buffer_size = bufreqs->buffer_region_size =
bufreqs->buffer_count_min = bufreqs->buffer_count_min_host =
bufreqs->buffer_count_actual = bufreqs->contiguous =
bufreqs->buffer_alignment = 0;
return 0;
}
struct hal_buffer_requirements *get_buff_req_buffer(
struct msm_vidc_inst *inst, enum hal_buffer buffer_type)
{
@ -4447,6 +4470,14 @@ int msm_comm_try_get_bufreqs(struct msm_vidc_inst *inst)
{
int rc = -EINVAL, i = 0;
union hal_get_property hprop;
enum hal_buffer int_buf[] = {
HAL_BUFFER_INTERNAL_SCRATCH,
HAL_BUFFER_INTERNAL_SCRATCH_1,
HAL_BUFFER_INTERNAL_SCRATCH_2,
HAL_BUFFER_INTERNAL_PERSIST,
HAL_BUFFER_INTERNAL_PERSIST_1,
HAL_BUFFER_INTERNAL_RECON,
};
memset(&hprop, 0x0, sizeof(hprop));
/*
@ -4473,6 +4504,10 @@ int msm_comm_try_get_bufreqs(struct msm_vidc_inst *inst)
return rc;
}
/* reset internal buffers */
for (i = 0; i < ARRAY_SIZE(int_buf); i++)
msm_comm_reset_bufreqs(inst, int_buf[i]);
for (i = 0; i < HAL_BUFFER_MAX; i++) {
struct hal_buffer_requirements req;
struct hal_buffer_requirements *curr_req;

View file

@ -174,6 +174,8 @@ int msm_comm_release_dpb_only_buffers(struct msm_vidc_inst *inst,
void msm_comm_validate_output_buffers(struct msm_vidc_inst *inst);
int msm_comm_force_cleanup(struct msm_vidc_inst *inst);
int msm_comm_suspend(int core_id);
int msm_comm_reset_bufreqs(struct msm_vidc_inst *inst,
enum hal_buffer buf_type);
struct hal_buffer_requirements *get_buff_req_buffer(
struct msm_vidc_inst *inst, u32 buffer_type);
#define IS_PRIV_CTRL(idx) (\