msm: camera: isp: Add support to handle pix for lite

If there is a use-case where lite can be used to support PIX resources,
as a part of acquire, a hint will be sent to indicate that lite can
be acquired. This hint is used to acquire the lite csid based on the
use-case.

CRs-Fixed: 2830502
Change-Id: Ib0a005ed64cd7ffec579195948f0fcb8b24ea837
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
This commit is contained in:
Gaurav Jindal
2020-11-19 15:48:49 +05:30
committed by Gerrit - the friendly Code Review server
parent f97ec2b211
commit a3c040b4d0
8 changed files with 130 additions and 66 deletions

View File

@@ -580,10 +580,10 @@ static const char *__cam_isp_resource_handle_id_to_type(
return "LTM_STATS"; return "LTM_STATS";
case CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST: case CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST:
return "STATS_GTM_BHIST"; return "STATS_GTM_BHIST";
case CAM_ISP_IFE_LITE_OUT_RES_STATS_BE: case CAM_ISP_IFE_LITE_OUT_RES_STATS_BG:
return "STATS_BE"; return "STATS_BG";
case CAM_ISP_IFE_LITE_OUT_RES_GAMMA: case CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW:
return "GAMMA"; return "PREPROCESS_RAW";
default: default:
return "CAM_ISP_Invalid_Resource_Type"; return "CAM_ISP_Invalid_Resource_Type";
} }

View File

@@ -2177,6 +2177,34 @@ err:
return rc; return rc;
} }
static bool cam_ife_mgr_check_can_use_lite(
struct cam_csid_hw_reserve_resource_args *csid_acquire,
struct cam_ife_hw_mgr_ctx *ife_ctx)
{
bool can_use_lite = false;
if (ife_ctx->is_rdi_only_context ||
csid_acquire->in_port->can_use_lite) {
can_use_lite = true;
goto end;
}
switch (csid_acquire->res_id) {
case CAM_ISP_IFE_OUT_RES_RDI_0:
case CAM_ISP_IFE_OUT_RES_RDI_1:
case CAM_ISP_IFE_OUT_RES_RDI_2:
case CAM_ISP_IFE_OUT_RES_RDI_3:
can_use_lite = true;
break;
default:
can_use_lite = false;
goto end;
}
end:
return can_use_lite;
}
static int cam_ife_hw_mgr_acquire_res_ife_bus_rd( static int cam_ife_hw_mgr_acquire_res_ife_bus_rd(
struct cam_ife_hw_mgr_ctx *ife_ctx, struct cam_ife_hw_mgr_ctx *ife_ctx,
struct cam_isp_in_port_generic_info *in_port) struct cam_isp_in_port_generic_info *in_port)
@@ -2731,6 +2759,8 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
bool is_start_lower_idx = false; bool is_start_lower_idx = false;
struct cam_isp_hw_mgr_res *csid_res_iterator; struct cam_isp_hw_mgr_res *csid_res_iterator;
struct cam_isp_out_port_generic_info *out_port = NULL; struct cam_isp_out_port_generic_info *out_port = NULL;
struct cam_ife_csid_hw_caps *csid_caps = NULL;
bool can_use_lite = false;
if (!ife_ctx || !csid_acquire) { if (!ife_ctx || !csid_acquire) {
CAM_ERR(CAM_ISP, CAM_ERR(CAM_ISP,
@@ -2759,6 +2789,8 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
if (in_port->num_out_res) if (in_port->num_out_res)
out_port = &(in_port->data[0]); out_port = &(in_port->data[0]);
ife_ctx->is_dual = (bool)in_port->usage_type; ife_ctx->is_dual = (bool)in_port->usage_type;
can_use_lite = cam_ife_mgr_check_can_use_lite(
csid_acquire, ife_ctx);
/* Try acquiring CSID from previously acquired HW */ /* Try acquiring CSID from previously acquired HW */
list_for_each_entry(csid_res_iterator, &ife_ctx->res_list_ife_csid, list_for_each_entry(csid_res_iterator, &ife_ctx->res_list_ife_csid,
@@ -2778,6 +2810,15 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
continue; continue;
hw_intf = csid_res_iterator->hw_res[i]->hw_intf; hw_intf = csid_res_iterator->hw_res[i]->hw_intf;
csid_caps =
&ife_hw_mgr->csid_hw_caps[hw_intf->hw_idx];
if (csid_caps->is_lite && !can_use_lite) {
CAM_DBG(CAM_ISP, "CSID[%u] cannot use lite",
hw_intf->hw_idx);
continue;
}
rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv, rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv,
csid_acquire, sizeof(*csid_acquire)); csid_acquire, sizeof(*csid_acquire));
if (rc) { if (rc) {
@@ -2794,12 +2835,21 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
} }
} }
if (is_start_lower_idx) { if (is_start_lower_idx)
for (i = 0; i < CAM_IFE_CSID_HW_NUM_MAX; i++) { goto start_acquire_lower_idx;
for (i = CAM_IFE_CSID_HW_NUM_MAX - 1; i >= 0; i--) {
if (!ife_hw_mgr->csid_devices[i]) if (!ife_hw_mgr->csid_devices[i])
continue; continue;
hw_intf = ife_hw_mgr->csid_devices[i]; hw_intf = ife_hw_mgr->csid_devices[i];
if (ife_hw_mgr->csid_hw_caps[hw_intf->hw_idx].is_lite &&
!can_use_lite) {
CAM_DBG(CAM_ISP, "CSID[%u] cannot use lite",
hw_intf->hw_idx);
continue;
}
rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv, rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv,
csid_acquire, csid_acquire,
sizeof(struct sizeof(struct
@@ -2807,14 +2857,24 @@ static int cam_ife_hw_mgr_acquire_csid_hw(
if (!rc) if (!rc)
return rc; return rc;
} }
return rc;
}
for (i = CAM_IFE_CSID_HW_NUM_MAX - 1; i >= 0; i--) { return rc;
start_acquire_lower_idx:
for (i = 0; i < CAM_IFE_CSID_HW_NUM_MAX; i++) {
if (!ife_hw_mgr->csid_devices[i]) if (!ife_hw_mgr->csid_devices[i])
continue; continue;
hw_intf = ife_hw_mgr->csid_devices[i]; hw_intf = ife_hw_mgr->csid_devices[i];
if (ife_hw_mgr->csid_hw_caps[hw_intf->hw_idx].is_lite &&
!can_use_lite) {
CAM_DBG(CAM_ISP, "CSID[%u] cannot use lite",
hw_intf->hw_idx);
continue;
}
rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv, rc = hw_intf->hw_ops.reserve(hw_intf->hw_priv,
csid_acquire, csid_acquire,
sizeof(struct sizeof(struct
@@ -4214,6 +4274,8 @@ static int cam_ife_mgr_acquire_get_unified_structure_v2(
CAM_ISP_PARAM_FETCH_SECURITY_MODE); CAM_ISP_PARAM_FETCH_SECURITY_MODE);
in_port->dynamic_sensor_switch_en = (in->feature_flag & in_port->dynamic_sensor_switch_en = (in->feature_flag &
CAM_ISP_DYNAMIC_SENOR_SWITCH_EN); CAM_ISP_DYNAMIC_SENOR_SWITCH_EN);
in_port->can_use_lite = in->feature_flag &
CAM_ISP_CAN_USE_LITE_MODE;
in_port->data = kcalloc(in->num_out_res, in_port->data = kcalloc(in->num_out_res,
sizeof(struct cam_isp_out_port_generic_info), sizeof(struct cam_isp_out_port_generic_info),

View File

@@ -134,6 +134,7 @@ struct cam_isp_in_port_generic_info {
uint32_t sfe_ife_enable; uint32_t sfe_ife_enable;
uint32_t secure_mode; uint32_t secure_mode;
uint32_t dynamic_sensor_switch_en; uint32_t dynamic_sensor_switch_en;
uint32_t can_use_lite;
struct cam_isp_out_port_generic_info *data; struct cam_isp_out_port_generic_info *data;
}; };

View File

@@ -379,7 +379,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe680x_bus_hw_info = {
}, },
{ {
.vfe_out_type = .vfe_out_type =
CAM_VFE_BUS_VER3_VFE_OUT_GAMMA, CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW,
.max_width = 1920, .max_width = 1920,
.max_height = 1080, .max_height = 1080,
.source_group = CAM_VFE_BUS_VER3_SRC_GRP_0, .source_group = CAM_VFE_BUS_VER3_SRC_GRP_0,
@@ -389,7 +389,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe680x_bus_hw_info = {
}, },
}, },
{ {
.vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BE, .vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG,
.max_width = -1, .max_width = -1,
.max_height = -1, .max_height = -1,
.source_group = CAM_VFE_BUS_VER3_SRC_GRP_0, .source_group = CAM_VFE_BUS_VER3_SRC_GRP_0,

View File

@@ -659,11 +659,11 @@ static enum cam_vfe_bus_ver3_vfe_out_type
case CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST: case CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST:
vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST; vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST;
break; break;
case CAM_ISP_IFE_LITE_OUT_RES_STATS_BE: case CAM_ISP_IFE_LITE_OUT_RES_STATS_BG:
vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BE; vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG;
break; break;
case CAM_ISP_IFE_LITE_OUT_RES_GAMMA: case CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW:
vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_GAMMA; vfe_out_type = CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW;
break; break;
default: default:
CAM_WARN(CAM_ISP, "Invalid isp res id: %d , assigning max", CAM_WARN(CAM_ISP, "Invalid isp res id: %d , assigning max",
@@ -769,11 +769,11 @@ static int cam_vfe_bus_ver3_get_comp_vfe_out_res_id_list(
if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST)) if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST))
out_list[count++] = CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST; out_list[count++] = CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST;
if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_STATS_BE)) if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG))
out_list[count++] = CAM_ISP_IFE_LITE_OUT_RES_STATS_BE; out_list[count++] = CAM_ISP_IFE_LITE_OUT_RES_STATS_BG;
if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_GAMMA)) if (comp_mask & (1 << CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW))
out_list[count++] = CAM_ISP_IFE_LITE_OUT_RES_GAMMA; out_list[count++] = CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW;
*num_out = count; *num_out = count;
return 0; return 0;
@@ -1295,7 +1295,7 @@ static int cam_vfe_bus_ver3_acquire_wm(
rsrc_data->height = 0; rsrc_data->height = 0;
rsrc_data->stride = 1; rsrc_data->stride = 1;
rsrc_data->en_cfg = (0x1 << 16) | 0x1; rsrc_data->en_cfg = (0x1 << 16) | 0x1;
} else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_BE) { } else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW) {
switch (rsrc_data->format) { switch (rsrc_data->format) {
case CAM_FORMAT_MIPI_RAW_8: case CAM_FORMAT_MIPI_RAW_8:
case CAM_FORMAT_MIPI_RAW_10: case CAM_FORMAT_MIPI_RAW_10:
@@ -1315,7 +1315,7 @@ static int cam_vfe_bus_ver3_acquire_wm(
return -EINVAL; return -EINVAL;
} }
} else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_GAMMA) { } else if (vfe_out_res_id == CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG) {
switch (rsrc_data->format) { switch (rsrc_data->format) {
case CAM_FORMAT_PLAIN64: case CAM_FORMAT_PLAIN64:
rsrc_data->width = 0; rsrc_data->width = 0;

View File

@@ -82,8 +82,8 @@ enum cam_vfe_bus_ver3_vfe_out_type {
CAM_VFE_BUS_VER3_VFE_OUT_STATS_AEC_BE, CAM_VFE_BUS_VER3_VFE_OUT_STATS_AEC_BE,
CAM_VFE_BUS_VER3_VFE_OUT_LTM_STATS, CAM_VFE_BUS_VER3_VFE_OUT_LTM_STATS,
CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST, CAM_VFE_BUS_VER3_VFE_OUT_STATS_GTM_BHIST,
CAM_VFE_BUS_VER3_VFE_OUT_STATS_BE, CAM_VFE_BUS_VER3_VFE_OUT_STATS_BG,
CAM_VFE_BUS_VER3_VFE_OUT_GAMMA, CAM_VFE_BUS_VER3_VFE_OUT_PREPROCESS_RAW,
CAM_VFE_BUS_VER3_VFE_OUT_MAX, CAM_VFE_BUS_VER3_VFE_OUT_MAX,
}; };

View File

@@ -167,6 +167,7 @@
/* Feature Flag indicators */ /* Feature Flag indicators */
#define CAM_ISP_PARAM_FETCH_SECURITY_MODE BIT(0) #define CAM_ISP_PARAM_FETCH_SECURITY_MODE BIT(0)
#define CAM_ISP_CAN_USE_LITE_MODE BIT(1)
#define CAM_ISP_DYNAMIC_SENOR_SWITCH_EN BIT(2) #define CAM_ISP_DYNAMIC_SENOR_SWITCH_EN BIT(2)
/* ISP core cfg flag params */ /* ISP core cfg flag params */

View File

@@ -40,8 +40,8 @@
#define CAM_ISP_IFE_OUT_RES_STATS_AEC_BE (CAM_ISP_IFE_OUT_RES_BASE + 28) #define CAM_ISP_IFE_OUT_RES_STATS_AEC_BE (CAM_ISP_IFE_OUT_RES_BASE + 28)
#define CAM_ISP_IFE_OUT_RES_LTM_STATS (CAM_ISP_IFE_OUT_RES_BASE + 29) #define CAM_ISP_IFE_OUT_RES_LTM_STATS (CAM_ISP_IFE_OUT_RES_BASE + 29)
#define CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST (CAM_ISP_IFE_OUT_RES_BASE + 30) #define CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST (CAM_ISP_IFE_OUT_RES_BASE + 30)
#define CAM_ISP_IFE_LITE_OUT_RES_STATS_BE (CAM_ISP_IFE_OUT_RES_BASE + 31) #define CAM_ISP_IFE_LITE_OUT_RES_STATS_BG (CAM_ISP_IFE_OUT_RES_BASE + 31)
#define CAM_ISP_IFE_LITE_OUT_RES_GAMMA (CAM_ISP_IFE_OUT_RES_BASE + 32) #define CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW (CAM_ISP_IFE_OUT_RES_BASE + 32)
/* IFE input port resource type (global unique) */ /* IFE input port resource type (global unique) */
#define CAM_ISP_IFE_IN_RES_BASE 0x4000 #define CAM_ISP_IFE_IN_RES_BASE 0x4000