Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +86 −51 Original line number Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -46,6 +46,8 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link) link->sync_link_sof_skip = false; link->open_req_cnt = 0; link->last_flush_id = 0; link->initial_sync_req = -1; link->in_msync_mode = false; } void cam_req_mgr_handle_core_shutdown(void) Loading Loading @@ -641,6 +643,7 @@ static int __cam_req_mgr_check_sync_for_mslave( struct cam_req_mgr_slot *slot) { struct cam_req_mgr_core_link *sync_link = NULL; struct cam_req_mgr_slot *sync_slot = NULL; int sync_slot_idx = 0, prev_idx, next_idx, rd_idx, rc = 0; int64_t req_id = 0, sync_req_id = 0; Loading @@ -653,8 +656,10 @@ static int __cam_req_mgr_check_sync_for_mslave( req_id = slot->req_id; CAM_DBG(CAM_CRM, "link_hdl %x req %lld frame_skip_flag %d ", link->link_hdl, req_id, link->sync_link_sof_skip); "link_hdl %x req %lld frame_skip_flag %d open_req_cnt:%d initial_sync_req [%lld,%lld] is_master:%d", link->link_hdl, req_id, link->sync_link_sof_skip, link->open_req_cnt, link->initial_sync_req, sync_link->initial_sync_req, link->is_master); if (sync_link->sync_link_sof_skip) { CAM_DBG(CAM_CRM, Loading Loading @@ -696,7 +701,8 @@ static int __cam_req_mgr_check_sync_for_mslave( rd_idx = sync_link->req.in_q->rd_idx; sync_req_id = link->req.in_q->slot[prev_idx].req_id; if (sync_req_id != -1) { if ((sync_link->initial_sync_req != -1) && (sync_link->initial_sync_req <= sync_req_id)) { sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, sync_req_id); Loading Loading @@ -734,23 +740,6 @@ static int __cam_req_mgr_check_sync_for_mslave( if (link->initial_skip) link->initial_skip = false; sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, req_id); if (sync_slot_idx == -1) { CAM_DBG(CAM_CRM, "Req: %lld not found on link: %x [master]", req_id, sync_link->link_hdl); return -EINVAL; } if (sync_link->req.in_q->slot[sync_slot_idx].status != CRM_SLOT_STATUS_REQ_APPLIED) { CAM_DBG(CAM_CRM, "Req: %lld [master] not applied yet: %x", req_id, sync_link->link_hdl); return -EAGAIN; } rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx); if (rc) { CAM_DBG(CAM_CRM, Loading @@ -760,6 +749,14 @@ static int __cam_req_mgr_check_sync_for_mslave( return rc; } rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true); if (rc) { CAM_DBG(CAM_CRM, "Req: %lld [slave] not ready on link: %x, rc=%d", req_id, link->link_hdl, rc); return rc; } next_idx = link->req.in_q->rd_idx; rd_idx = sync_link->req.in_q->rd_idx; __cam_req_mgr_inc_idx(&next_idx, Loading @@ -767,6 +764,9 @@ static int __cam_req_mgr_check_sync_for_mslave( link->req.in_q->num_slots); sync_req_id = link->req.in_q->slot[next_idx].req_id; if ((sync_link->initial_sync_req != -1) && (sync_link->initial_sync_req <= sync_req_id)) { sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, sync_req_id); if (sync_slot_idx == -1) { Loading @@ -787,9 +787,10 @@ static int __cam_req_mgr_check_sync_for_mslave( return -EINVAL; } sync_slot = &sync_link->req.in_q->slot[sync_slot_idx]; rc = __cam_req_mgr_check_link_is_ready(sync_link, sync_slot_idx, true); if (rc && (sync_link->req.in_q->slot[sync_slot_idx].status != if (rc && (sync_slot->status != CRM_SLOT_STATUS_REQ_APPLIED)) { CAM_DBG(CAM_CRM, "Next Req: %lld [slave] not ready on [master] link: %x, rc=%d", Loading @@ -797,6 +798,7 @@ static int __cam_req_mgr_check_sync_for_mslave( return rc; } } } CAM_DBG(CAM_REQ, "Req: %lld ready to apply on link: %x [validation successful]", Loading Loading @@ -979,13 +981,31 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if ((slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) && (link->sync_link)) { if (link->is_master || link->sync_link->is_master) if (link->is_master || link->sync_link->is_master) { if (!link->in_msync_mode) { CAM_DBG(CAM_CRM, "Settings master-slave sync mode for link 0x%x", link->link_hdl); link->in_msync_mode = true; } rc = __cam_req_mgr_check_sync_for_mslave( link, slot); else } else { rc = __cam_req_mgr_check_sync_req_is_ready( link, slot); } } else { if (link->in_msync_mode) { CAM_DBG(CAM_CRM, "Settings master-slave non sync mode for link 0x%x", link->link_hdl); link->in_msync_mode = false; link->initial_sync_req = -1; if (link->sync_link) link->sync_link->initial_sync_req = -1; } rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx); if (!rc) Loading Loading @@ -1710,9 +1730,11 @@ int cam_req_mgr_process_sched_req(void *priv, void *data) sched_req = (struct cam_req_mgr_sched_request *)&task_data->u; in_q = link->req.in_q; CAM_DBG(CAM_CRM, "link_hdl %x req_id %lld at slot %d sync_mode %d", CAM_DBG(CAM_CRM, "link_hdl %x req_id %lld at slot %d sync_mode %d is_master:%d", sched_req->link_hdl, sched_req->req_id, in_q->wr_idx, sched_req->sync_mode); in_q->wr_idx, sched_req->sync_mode, link->is_master); mutex_lock(&link->req.lock); slot = &in_q->slot[in_q->wr_idx]; Loading @@ -1728,6 +1750,14 @@ int cam_req_mgr_process_sched_req(void *priv, void *data) slot->recover = sched_req->bubble_enable; link->open_req_cnt++; __cam_req_mgr_inc_idx(&in_q->wr_idx, 1, in_q->num_slots); if (slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) { if (link->initial_sync_req == -1) link->initial_sync_req = slot->req_id; } else { link->initial_sync_req = -1; } mutex_unlock(&link->req.lock); end: Loading Loading @@ -2830,6 +2860,11 @@ int cam_req_mgr_sync_config( link1->initial_skip = false; link2->initial_skip = false; link1->in_msync_mode = false; link2->in_msync_mode = false; link1->initial_sync_req = -1; link2->initial_sync_req = -1; if (sync_info->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) { link1->sync_link = link2; link2->sync_link = link1; Loading drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +6 −2 Original line number Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -314,7 +314,9 @@ struct cam_req_mgr_connected_device { * is assigned as master * @initial_skip : Flag to determine if slave has started streaming in * master-slave sync * * @in_msync_mode : Flag to determine if a link is in master-slave mode * @initial_sync_req : The initial req which is required to sync with the * other link */ struct cam_req_mgr_core_link { int32_t link_hdl; Loading @@ -339,6 +341,8 @@ struct cam_req_mgr_core_link { atomic_t is_used; bool is_master; bool initial_skip; bool in_msync_mode; int64_t initial_sync_req; }; /** Loading Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.c +86 −51 Original line number Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -46,6 +46,8 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link) link->sync_link_sof_skip = false; link->open_req_cnt = 0; link->last_flush_id = 0; link->initial_sync_req = -1; link->in_msync_mode = false; } void cam_req_mgr_handle_core_shutdown(void) Loading Loading @@ -641,6 +643,7 @@ static int __cam_req_mgr_check_sync_for_mslave( struct cam_req_mgr_slot *slot) { struct cam_req_mgr_core_link *sync_link = NULL; struct cam_req_mgr_slot *sync_slot = NULL; int sync_slot_idx = 0, prev_idx, next_idx, rd_idx, rc = 0; int64_t req_id = 0, sync_req_id = 0; Loading @@ -653,8 +656,10 @@ static int __cam_req_mgr_check_sync_for_mslave( req_id = slot->req_id; CAM_DBG(CAM_CRM, "link_hdl %x req %lld frame_skip_flag %d ", link->link_hdl, req_id, link->sync_link_sof_skip); "link_hdl %x req %lld frame_skip_flag %d open_req_cnt:%d initial_sync_req [%lld,%lld] is_master:%d", link->link_hdl, req_id, link->sync_link_sof_skip, link->open_req_cnt, link->initial_sync_req, sync_link->initial_sync_req, link->is_master); if (sync_link->sync_link_sof_skip) { CAM_DBG(CAM_CRM, Loading Loading @@ -696,7 +701,8 @@ static int __cam_req_mgr_check_sync_for_mslave( rd_idx = sync_link->req.in_q->rd_idx; sync_req_id = link->req.in_q->slot[prev_idx].req_id; if (sync_req_id != -1) { if ((sync_link->initial_sync_req != -1) && (sync_link->initial_sync_req <= sync_req_id)) { sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, sync_req_id); Loading Loading @@ -734,23 +740,6 @@ static int __cam_req_mgr_check_sync_for_mslave( if (link->initial_skip) link->initial_skip = false; sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, req_id); if (sync_slot_idx == -1) { CAM_DBG(CAM_CRM, "Req: %lld not found on link: %x [master]", req_id, sync_link->link_hdl); return -EINVAL; } if (sync_link->req.in_q->slot[sync_slot_idx].status != CRM_SLOT_STATUS_REQ_APPLIED) { CAM_DBG(CAM_CRM, "Req: %lld [master] not applied yet: %x", req_id, sync_link->link_hdl); return -EAGAIN; } rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx); if (rc) { CAM_DBG(CAM_CRM, Loading @@ -760,6 +749,14 @@ static int __cam_req_mgr_check_sync_for_mslave( return rc; } rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true); if (rc) { CAM_DBG(CAM_CRM, "Req: %lld [slave] not ready on link: %x, rc=%d", req_id, link->link_hdl, rc); return rc; } next_idx = link->req.in_q->rd_idx; rd_idx = sync_link->req.in_q->rd_idx; __cam_req_mgr_inc_idx(&next_idx, Loading @@ -767,6 +764,9 @@ static int __cam_req_mgr_check_sync_for_mslave( link->req.in_q->num_slots); sync_req_id = link->req.in_q->slot[next_idx].req_id; if ((sync_link->initial_sync_req != -1) && (sync_link->initial_sync_req <= sync_req_id)) { sync_slot_idx = __cam_req_mgr_find_slot_for_req( sync_link->req.in_q, sync_req_id); if (sync_slot_idx == -1) { Loading @@ -787,9 +787,10 @@ static int __cam_req_mgr_check_sync_for_mslave( return -EINVAL; } sync_slot = &sync_link->req.in_q->slot[sync_slot_idx]; rc = __cam_req_mgr_check_link_is_ready(sync_link, sync_slot_idx, true); if (rc && (sync_link->req.in_q->slot[sync_slot_idx].status != if (rc && (sync_slot->status != CRM_SLOT_STATUS_REQ_APPLIED)) { CAM_DBG(CAM_CRM, "Next Req: %lld [slave] not ready on [master] link: %x, rc=%d", Loading @@ -797,6 +798,7 @@ static int __cam_req_mgr_check_sync_for_mslave( return rc; } } } CAM_DBG(CAM_REQ, "Req: %lld ready to apply on link: %x [validation successful]", Loading Loading @@ -979,13 +981,31 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if ((slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) && (link->sync_link)) { if (link->is_master || link->sync_link->is_master) if (link->is_master || link->sync_link->is_master) { if (!link->in_msync_mode) { CAM_DBG(CAM_CRM, "Settings master-slave sync mode for link 0x%x", link->link_hdl); link->in_msync_mode = true; } rc = __cam_req_mgr_check_sync_for_mslave( link, slot); else } else { rc = __cam_req_mgr_check_sync_req_is_ready( link, slot); } } else { if (link->in_msync_mode) { CAM_DBG(CAM_CRM, "Settings master-slave non sync mode for link 0x%x", link->link_hdl); link->in_msync_mode = false; link->initial_sync_req = -1; if (link->sync_link) link->sync_link->initial_sync_req = -1; } rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx); if (!rc) Loading Loading @@ -1710,9 +1730,11 @@ int cam_req_mgr_process_sched_req(void *priv, void *data) sched_req = (struct cam_req_mgr_sched_request *)&task_data->u; in_q = link->req.in_q; CAM_DBG(CAM_CRM, "link_hdl %x req_id %lld at slot %d sync_mode %d", CAM_DBG(CAM_CRM, "link_hdl %x req_id %lld at slot %d sync_mode %d is_master:%d", sched_req->link_hdl, sched_req->req_id, in_q->wr_idx, sched_req->sync_mode); in_q->wr_idx, sched_req->sync_mode, link->is_master); mutex_lock(&link->req.lock); slot = &in_q->slot[in_q->wr_idx]; Loading @@ -1728,6 +1750,14 @@ int cam_req_mgr_process_sched_req(void *priv, void *data) slot->recover = sched_req->bubble_enable; link->open_req_cnt++; __cam_req_mgr_inc_idx(&in_q->wr_idx, 1, in_q->num_slots); if (slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) { if (link->initial_sync_req == -1) link->initial_sync_req = slot->req_id; } else { link->initial_sync_req = -1; } mutex_unlock(&link->req.lock); end: Loading Loading @@ -2830,6 +2860,11 @@ int cam_req_mgr_sync_config( link1->initial_skip = false; link2->initial_skip = false; link1->in_msync_mode = false; link2->in_msync_mode = false; link1->initial_sync_req = -1; link2->initial_sync_req = -1; if (sync_info->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) { link1->sync_link = link2; link2->sync_link = link1; Loading
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_core.h +6 −2 Original line number Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -314,7 +314,9 @@ struct cam_req_mgr_connected_device { * is assigned as master * @initial_skip : Flag to determine if slave has started streaming in * master-slave sync * * @in_msync_mode : Flag to determine if a link is in master-slave mode * @initial_sync_req : The initial req which is required to sync with the * other link */ struct cam_req_mgr_core_link { int32_t link_hdl; Loading @@ -339,6 +341,8 @@ struct cam_req_mgr_core_link { atomic_t is_used; bool is_master; bool initial_skip; bool in_msync_mode; int64_t initial_sync_req; }; /** Loading