video: driver: Error handling for HW overload scenarios
- send error '-EAGAIN' when there are no inactive sessions, HAL will retry with low priority. - send error '-ENOMEM' when there are inactive sessions, Frameworks will close the inactive sessions Change-Id: Id28a6f3c5f9d537a2789ef1522505b6ebedccc0b Signed-off-by: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
4d51b2ba26
commit
1763bbebca
@@ -5187,15 +5187,18 @@ static int msm_vidc_print_insts_info(struct msm_vidc_core *core)
|
||||
|
||||
int msm_vidc_check_core_mbps(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 mbps = 0;
|
||||
u32 mbps = 0, num_inactive_sessions = 0;
|
||||
struct msm_vidc_core *core;
|
||||
struct msm_vidc_inst *instance;
|
||||
u64 curr_time_ns;
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
core = inst->core;
|
||||
curr_time_ns = ktime_get_ns();
|
||||
|
||||
core_lock(core, __func__);
|
||||
list_for_each_entry(instance, &core->instances, list) {
|
||||
@@ -5203,6 +5206,10 @@ int msm_vidc_check_core_mbps(struct msm_vidc_inst *inst)
|
||||
if (is_session_error(instance))
|
||||
continue;
|
||||
|
||||
if (!is_active_session(instance->last_qbuf_time_ns, curr_time_ns)) {
|
||||
num_inactive_sessions++;
|
||||
}
|
||||
|
||||
/* ignore thumbnail, image, and non realtime sessions */
|
||||
if (is_thumbnail_session(instance) ||
|
||||
is_image_session(instance) ||
|
||||
@@ -5214,9 +5221,10 @@ int msm_vidc_check_core_mbps(struct msm_vidc_inst *inst)
|
||||
core_unlock(core, __func__);
|
||||
|
||||
if (mbps > core->capabilities[MAX_MBPS].value) {
|
||||
rc = num_inactive_sessions ? -ENOMEM : -EAGAIN;
|
||||
i_vpr_e(inst, "%s: Hardware overloaded. needed %u, max %u", __func__,
|
||||
mbps, core->capabilities[MAX_MBPS].value);
|
||||
return -ENOMEM;
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user