From 12ac83a8c55841b8ccc61089e4d7126fbd930556 Mon Sep 17 00:00:00 2001 From: Govindaraj Rajagopal Date: Fri, 24 May 2019 19:31:54 +0530 Subject: [PATCH] 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 --- msm/vidc/msm_vidc_common.c | 35 +++++++++++++++++++++++++++++++++++ msm/vidc/msm_vidc_common.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 9dce5919f84a..fe9c75deaf8b 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -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; diff --git a/msm/vidc/msm_vidc_common.h b/msm/vidc/msm_vidc_common.h index a71dabc61bde..7135d20436ef 100644 --- a/msm/vidc/msm_vidc_common.h +++ b/msm/vidc/msm_vidc_common.h @@ -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) (\