video: driver: Error handling for HW overload
- send '-ENOMEM' after max mbps is reached Change-Id: I6d597021046ea375f2131c2e40ac07d1aebdd9b8 Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
This commit is contained in:
@@ -5877,10 +5877,9 @@ 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, num_inactive_sessions = 0;
|
||||
u32 mbps = 0;
|
||||
struct msm_vidc_core *core;
|
||||
struct msm_vidc_inst *instance;
|
||||
u64 curr_time_ns;
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
@@ -5894,18 +5893,12 @@ int msm_vidc_check_core_mbps(struct msm_vidc_inst *inst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
curr_time_ns = ktime_get_ns();
|
||||
|
||||
core_lock(core, __func__);
|
||||
list_for_each_entry(instance, &core->instances, list) {
|
||||
/* ignore invalid/error session */
|
||||
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) ||
|
||||
@@ -5917,7 +5910,7 @@ 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;
|
||||
rc = -ENOMEM;
|
||||
i_vpr_e(inst, "%s: Hardware overloaded. needed %u, max %u", __func__,
|
||||
mbps, core->capabilities[MAX_MBPS].value);
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user