msm: camera: sync: Add extra support for monitor dump
Add monitor dump when dma/synx is already in signaled state or has registered a cb, and when sync fails to signal its corresponding dma/synx. CRs-Fixed: 3350863 Change-Id: I4b52647f1d3f53eff119df1ab143be6848dd0d5d Signed-off-by: Haochen Yang <quic_haocyang@quicinc.com>
This commit is contained in:

committed by
Camera Software Integration

parent
69aaaa4e89
commit
ae91bc4768
@@ -144,8 +144,7 @@ int cam_sync_register_callback(sync_callback cb_func,
|
|||||||
{
|
{
|
||||||
struct sync_callback_info *sync_cb;
|
struct sync_callback_info *sync_cb;
|
||||||
struct sync_table_row *row = NULL;
|
struct sync_table_row *row = NULL;
|
||||||
int status = 0;
|
int status = 0, rc = 0;
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
if ((sync_obj >= CAM_SYNC_MAX_OBJS) || (sync_obj <= 0) || (!cb_func))
|
if ((sync_obj >= CAM_SYNC_MAX_OBJS) || (sync_obj <= 0) || (!cb_func))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -156,8 +155,7 @@ int cam_sync_register_callback(sync_callback cb_func,
|
|||||||
if (row->state == CAM_SYNC_STATE_INVALID) {
|
if (row->state == CAM_SYNC_STATE_INVALID) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj %s[%d]",
|
"Error: accessing an uninitialized sync obj %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
@@ -243,15 +241,13 @@ int cam_sync_deregister_callback(sync_callback cb_func,
|
|||||||
if (row->state == CAM_SYNC_STATE_INVALID) {
|
if (row->state == CAM_SYNC_STATE_INVALID) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj = %s[%d]",
|
"Error: accessing an uninitialized sync obj = %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAM_DBG(CAM_SYNC, "deregistered callback for sync object:%s[%d]",
|
CAM_DBG(CAM_SYNC, "deregistered callback for sync object:%s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
list_for_each_entry_safe(sync_cb, temp, &row->callback_list, list) {
|
list_for_each_entry_safe(sync_cb, temp, &row->callback_list, list) {
|
||||||
if ((sync_cb->callback_func == cb_func) &&
|
if ((sync_cb->callback_func == cb_func) &&
|
||||||
(sync_cb->cb_data == userdata)) {
|
(sync_cb->cb_data == userdata)) {
|
||||||
@@ -435,10 +431,12 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause)
|
|||||||
*/
|
*/
|
||||||
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &row->ext_fence_mask)) {
|
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &row->ext_fence_mask)) {
|
||||||
rc = cam_sync_signal_dma_fence_util(row, status);
|
rc = cam_sync_signal_dma_fence_util(row, status);
|
||||||
if (rc)
|
if (rc) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: Failed to signal associated dma fencefd = %d for sync_obj = %s[%d]",
|
"Error: Failed to signal associated dma fencefd = %d for sync_obj = %s[%d]",
|
||||||
row->dma_fence_info.dma_fence_fd, row->name, sync_obj);
|
row->dma_fence_info.dma_fence_fd, row->name, sync_obj);
|
||||||
|
cam_sync_dump_monitor_array(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
|
#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
|
||||||
@@ -454,10 +452,12 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause)
|
|||||||
spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
||||||
rc = cam_synx_obj_internal_signal(synx_row_idx, &signal_synx_obj);
|
rc = cam_synx_obj_internal_signal(synx_row_idx, &signal_synx_obj);
|
||||||
spin_lock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
spin_lock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
||||||
if (rc)
|
if (rc) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: Failed to signal associated synx obj = %d for sync_obj = %d",
|
"Error: Failed to signal associated synx obj = %d for sync_obj = %d",
|
||||||
signal_synx_obj.synx_obj, sync_obj);
|
signal_synx_obj.synx_obj, sync_obj);
|
||||||
|
cam_sync_dump_monitor_array(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -488,10 +488,9 @@ monitor_dump:
|
|||||||
|
|
||||||
int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj)
|
int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc, i;
|
||||||
long idx = 0;
|
long idx = 0;
|
||||||
bool bit;
|
bool bit;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if ((!sync_obj) || (!merged_obj)) {
|
if ((!sync_obj) || (!merged_obj)) {
|
||||||
CAM_ERR(CAM_SYNC, "Invalid pointer(s)");
|
CAM_ERR(CAM_SYNC, "Invalid pointer(s)");
|
||||||
@@ -526,8 +525,7 @@ int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj)
|
|||||||
|
|
||||||
spin_lock_bh(&sync_dev->row_spinlocks[idx]);
|
spin_lock_bh(&sync_dev->row_spinlocks[idx]);
|
||||||
rc = cam_sync_init_group_object(sync_dev->sync_table,
|
rc = cam_sync_init_group_object(sync_dev->sync_table,
|
||||||
idx, sync_obj,
|
idx, sync_obj, num_objs);
|
||||||
num_objs);
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
CAM_ERR(CAM_SYNC, "Error: Unable to init row at idx = %ld",
|
CAM_ERR(CAM_SYNC, "Error: Unable to init row at idx = %ld",
|
||||||
idx);
|
idx);
|
||||||
@@ -555,8 +553,7 @@ int cam_sync_get_obj_ref(int32_t sync_obj)
|
|||||||
if (row->state != CAM_SYNC_STATE_ACTIVE) {
|
if (row->state != CAM_SYNC_STATE_ACTIVE) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj = %s[%d]",
|
"Error: accessing an uninitialized sync obj = %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
@@ -605,8 +602,7 @@ int cam_sync_check_valid(int32_t sync_obj)
|
|||||||
|
|
||||||
if (!test_bit(sync_obj, sync_dev->bitmap)) {
|
if (!test_bit(sync_obj, sync_dev->bitmap)) {
|
||||||
CAM_ERR(CAM_SYNC, "Error: Released sync obj received %s[%d]",
|
CAM_ERR(CAM_SYNC, "Error: Released sync obj received %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
@@ -614,8 +610,7 @@ int cam_sync_check_valid(int32_t sync_obj)
|
|||||||
if (row->state == CAM_SYNC_STATE_INVALID) {
|
if (row->state == CAM_SYNC_STATE_INVALID) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj = %s[%d]",
|
"Error: accessing an uninitialized sync obj = %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
@@ -642,8 +637,7 @@ int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms)
|
|||||||
if (row->state == CAM_SYNC_STATE_INVALID) {
|
if (row->state == CAM_SYNC_STATE_INVALID) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj = %s[%d]",
|
"Error: accessing an uninitialized sync obj = %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto monitor_dump;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
@@ -706,8 +700,7 @@ static int cam_sync_handle_create(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
if (!result)
|
if (!result)
|
||||||
if (copy_to_user(
|
if (copy_to_user(
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
||||||
&sync_create,
|
&sync_create, k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -725,8 +718,7 @@ static int cam_sync_handle_signal(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(&sync_signal,
|
if (copy_from_user(&sync_signal,
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* need to get ref for UMD signaled fences */
|
/* need to get ref for UMD signaled fences */
|
||||||
@@ -758,8 +750,7 @@ static int cam_sync_handle_merge(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(&sync_merge,
|
if (copy_from_user(&sync_merge,
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (sync_merge.num_objs >= CAM_SYNC_MAX_OBJS)
|
if (sync_merge.num_objs >= CAM_SYNC_MAX_OBJS)
|
||||||
@@ -781,14 +772,12 @@ static int cam_sync_handle_merge(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
num_objs = sync_merge.num_objs;
|
num_objs = sync_merge.num_objs;
|
||||||
|
|
||||||
result = cam_sync_merge(sync_objs,
|
result = cam_sync_merge(sync_objs,
|
||||||
num_objs,
|
num_objs, &sync_merge.merged);
|
||||||
&sync_merge.merged);
|
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
if (copy_to_user(
|
if (copy_to_user(
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
||||||
&sync_merge,
|
&sync_merge, k_ioctl->size)) {
|
||||||
k_ioctl->size)) {
|
|
||||||
kfree(sync_objs);
|
kfree(sync_objs);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
@@ -809,8 +798,7 @@ static int cam_sync_handle_wait(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(&sync_wait,
|
if (copy_from_user(&sync_wait,
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
k_ioctl->result = cam_sync_wait(sync_wait.sync_obj,
|
k_ioctl->result = cam_sync_wait(sync_wait.sync_obj,
|
||||||
@@ -830,8 +818,7 @@ static int cam_sync_handle_destroy(struct cam_private_ioctl_arg *k_ioctl)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(&sync_create,
|
if (copy_from_user(&sync_create,
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return cam_sync_destroy(sync_create.sync_obj);
|
return cam_sync_destroy(sync_create.sync_obj);
|
||||||
@@ -876,8 +863,7 @@ static int cam_sync_handle_register_user_payload(
|
|||||||
if (row->state == CAM_SYNC_STATE_INVALID) {
|
if (row->state == CAM_SYNC_STATE_INVALID) {
|
||||||
CAM_ERR(CAM_SYNC,
|
CAM_ERR(CAM_SYNC,
|
||||||
"Error: accessing an uninitialized sync obj = %s[%d]",
|
"Error: accessing an uninitialized sync obj = %s[%d]",
|
||||||
row->name,
|
row->name, sync_obj);
|
||||||
sync_obj);
|
|
||||||
spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
|
||||||
kfree(user_payload_kernel);
|
kfree(user_payload_kernel);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -893,8 +879,7 @@ static int cam_sync_handle_register_user_payload(
|
|||||||
CAM_FENCE_OP_SKIP_REGISTER_CB);
|
CAM_FENCE_OP_SKIP_REGISTER_CB);
|
||||||
|
|
||||||
cam_sync_util_send_v4l2_event(CAM_SYNC_V4L_EVENT_ID_CB_TRIG,
|
cam_sync_util_send_v4l2_event(CAM_SYNC_V4L_EVENT_ID_CB_TRIG,
|
||||||
sync_obj,
|
sync_obj, row->state,
|
||||||
row->state,
|
|
||||||
user_payload_kernel->payload_data,
|
user_payload_kernel->payload_data,
|
||||||
CAM_SYNC_USER_PAYLOAD_SIZE * sizeof(__u64),
|
CAM_SYNC_USER_PAYLOAD_SIZE * sizeof(__u64),
|
||||||
CAM_SYNC_COMMON_REG_PAYLOAD_EVENT);
|
CAM_SYNC_COMMON_REG_PAYLOAD_EVENT);
|
||||||
@@ -905,9 +890,7 @@ static int cam_sync_handle_register_user_payload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry_safe(user_payload_iter,
|
list_for_each_entry_safe(user_payload_iter,
|
||||||
temp_upayload_kernel,
|
temp_upayload_kernel, &row->user_payload_list, list) {
|
||||||
&row->user_payload_list,
|
|
||||||
list) {
|
|
||||||
if (user_payload_iter->payload_data[0] ==
|
if (user_payload_iter->payload_data[0] ==
|
||||||
user_payload_kernel->payload_data[0] &&
|
user_payload_kernel->payload_data[0] &&
|
||||||
user_payload_iter->payload_data[1] ==
|
user_payload_iter->payload_data[1] ==
|
||||||
@@ -955,8 +938,7 @@ static int cam_sync_handle_deregister_user_payload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (copy_from_user(&userpayload_info,
|
if (copy_from_user(&userpayload_info,
|
||||||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
|
||||||
k_ioctl->size))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
sync_obj = userpayload_info.sync_obj;
|
sync_obj = userpayload_info.sync_obj;
|
||||||
@@ -1783,7 +1765,6 @@ static int cam_generic_fence_handle_synx_import(
|
|||||||
goto out_copy;
|
goto out_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((fence_cfg->sync_obj > 0) && (fence_cfg->sync_obj < CAM_SYNC_MAX_OBJS)) {
|
if ((fence_cfg->sync_obj > 0) && (fence_cfg->sync_obj < CAM_SYNC_MAX_OBJS)) {
|
||||||
/* Associate synx object with existing sync object */
|
/* Associate synx object with existing sync object */
|
||||||
rc = cam_sync_synx_associate_obj(fence_cfg->sync_obj,
|
rc = cam_sync_synx_associate_obj(fence_cfg->sync_obj,
|
||||||
@@ -2453,8 +2434,7 @@ static int cam_sync_open(struct file *filep)
|
|||||||
|
|
||||||
static int cam_sync_close(struct file *filep)
|
static int cam_sync_close(struct file *filep)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0, i;
|
||||||
int i;
|
|
||||||
struct sync_device *sync_dev = video_drvdata(filep);
|
struct sync_device *sync_dev = video_drvdata(filep);
|
||||||
|
|
||||||
if (!sync_dev) {
|
if (!sync_dev) {
|
||||||
@@ -2775,8 +2755,7 @@ static void cam_sync_configure_synx_obj(struct synx_register_params *object)
|
|||||||
static int cam_sync_component_bind(struct device *dev,
|
static int cam_sync_component_bind(struct device *dev,
|
||||||
struct device *master_dev, void *data)
|
struct device *master_dev, void *data)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc, idx;
|
||||||
int idx;
|
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
|
|
||||||
sync_dev = kzalloc(sizeof(*sync_dev), GFP_KERNEL);
|
sync_dev = kzalloc(sizeof(*sync_dev), GFP_KERNEL);
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CAM_SYNC_API_H__
|
#ifndef __CAM_SYNC_API_H__
|
||||||
@@ -38,14 +39,13 @@ int cam_sync_create(int32_t *sync_obj, const char *name);
|
|||||||
/**
|
/**
|
||||||
* @brief: Registers a callback with a sync object
|
* @brief: Registers a callback with a sync object
|
||||||
*
|
*
|
||||||
* @param cb_func: Pointer to callback to be registered
|
* @param cb_func : Pointer to callback to be registered
|
||||||
* @param userdata: Opaque pointer which will be passed back with callback.
|
* @param userdata : Opaque pointer which will be passed back with callback.
|
||||||
* @param sync_obj: int referencing the sync object.
|
* @param sync_obj : int referencing the sync object.
|
||||||
*
|
*
|
||||||
* @return Status of operation. Zero in case of success.
|
* @return Status of operation. Zero in case of success.
|
||||||
* -EINVAL will be returned if userdata is invalid.
|
* -EINVAL will be returned if userdata is invalid.
|
||||||
* -ENOMEM will be returned if cb_func is invalid.
|
* -ENOMEM will be returned if cb_func is invalid.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
int cam_sync_register_callback(sync_callback cb_func,
|
int cam_sync_register_callback(sync_callback cb_func,
|
||||||
void *userdata, int32_t sync_obj);
|
void *userdata, int32_t sync_obj);
|
||||||
@@ -53,13 +53,14 @@ int cam_sync_register_callback(sync_callback cb_func,
|
|||||||
/**
|
/**
|
||||||
* @brief: De-registers a callback with a sync object
|
* @brief: De-registers a callback with a sync object
|
||||||
*
|
*
|
||||||
* @param cb_func: Pointer to callback to be de-registered
|
* @param cb_func : Pointer to callback to be de-registered
|
||||||
* @param userdata: Opaque pointer which will be passed back with callback.
|
* @param userdata : Opaque pointer which will be passed back with callback.
|
||||||
* @param sync_obj: int referencing the sync object.
|
* @param sync_obj : int referencing the sync object.
|
||||||
*
|
*
|
||||||
* @return Status of operation. Zero in case of success.
|
* @return Status of operation. Zero in case of success.
|
||||||
* -EINVAL will be returned if userdata is invalid.
|
* -EINVAL will be returned if userdata is invalid.
|
||||||
* -ENOMEM will be returned if cb_func is invalid.
|
* -ENOMEM will be returned if cb_func is invalid.
|
||||||
|
* -ENOENT will be returned if call back not found
|
||||||
*/
|
*/
|
||||||
int cam_sync_deregister_callback(sync_callback cb_func,
|
int cam_sync_deregister_callback(sync_callback cb_func,
|
||||||
void *userdata, int32_t sync_obj);
|
void *userdata, int32_t sync_obj);
|
||||||
@@ -73,10 +74,10 @@ int cam_sync_deregister_callback(sync_callback cb_func,
|
|||||||
* is not guaranteed. The status parameter will indicate whether the entity
|
* is not guaranteed. The status parameter will indicate whether the entity
|
||||||
* performing the signaling wants to convey an error case or a success case.
|
* performing the signaling wants to convey an error case or a success case.
|
||||||
*
|
*
|
||||||
* @param sync_obj: int referencing the sync object.
|
* @param sync_obj : int referencing the sync object.
|
||||||
* @param status: Status of the signaling. Can be either SYNC_SIGNAL_ERROR or
|
* @param status : Status of the signaling. Can be either SYNC_SIGNAL_ERROR or
|
||||||
* SYNC_SIGNAL_SUCCESS.
|
* SYNC_SIGNAL_SUCCESS.
|
||||||
* @param evt_param: Event parameter
|
* @param evt_param : Event parameter
|
||||||
*
|
*
|
||||||
* @return Status of operation. Negative in case of error. Zero otherwise.
|
* @return Status of operation. Negative in case of error. Zero otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -87,8 +88,8 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t evt_param);
|
|||||||
*
|
*
|
||||||
* This function will merge multiple sync objects into a sync group.
|
* This function will merge multiple sync objects into a sync group.
|
||||||
*
|
*
|
||||||
* @param sync_obj: pointer to a block of ints to be merged
|
* @param sync_obj : pointer to a block of ints to be merged
|
||||||
* @param num_objs: Number of ints in the block
|
* @param num_objs : Number of ints in the block
|
||||||
*
|
*
|
||||||
* @return Status of operation. Negative in case of error. Zero otherwise.
|
* @return Status of operation. Negative in case of error. Zero otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -133,11 +134,12 @@ int cam_sync_destroy(int32_t sync_obj);
|
|||||||
* of timeout_ms milliseconds. Must not be called from interrupt context as
|
* of timeout_ms milliseconds. Must not be called from interrupt context as
|
||||||
* this API can sleep. Should be called from process context only.
|
* this API can sleep. Should be called from process context only.
|
||||||
*
|
*
|
||||||
* @param sync_obj: int referencing the sync object to be waited upon
|
* @param sync_obj : int referencing the sync object to be waited upon
|
||||||
* @timeout_ms sync_obj: Timeout in ms.
|
* @param timeout_ms : Timeout in ms.
|
||||||
*
|
*
|
||||||
* @return 0 upon success, -EINVAL if sync object is in bad state or arguments
|
* @return Status of operation. Zero in case of success
|
||||||
* are invalid, -ETIMEDOUT if wait times out.
|
* -EINVAL if sync object is in bad state or arguments are invalid
|
||||||
|
* -ETIMEDOUT if wait times out
|
||||||
*/
|
*/
|
||||||
int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
|
int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
|
||||||
|
|
||||||
@@ -146,13 +148,14 @@ int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
|
|||||||
*
|
*
|
||||||
* @param sync_obj: int referencing the sync object to be checked
|
* @param sync_obj: int referencing the sync object to be checked
|
||||||
*
|
*
|
||||||
* @return 0 upon success, -EINVAL if sync object is in bad state or arguments
|
* @return Status of operation. Zero in case of success
|
||||||
* are invalid
|
* -EINVAL if sync object is in bad state or arguments are invalid
|
||||||
*/
|
*/
|
||||||
int cam_sync_check_valid(int32_t sync_obj);
|
int cam_sync_check_valid(int32_t sync_obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : API to register SYNC to platform framework.
|
* @brief : API to register SYNC to platform framework.
|
||||||
|
*
|
||||||
* @return struct platform_device pointer on on success, or ERR_PTR() on error.
|
* @return struct platform_device pointer on on success, or ERR_PTR() on error.
|
||||||
*/
|
*/
|
||||||
int cam_sync_init(void);
|
int cam_sync_init(void);
|
||||||
|
@@ -350,8 +350,7 @@ struct dma_fence *cam_dma_fence_get_fence_from_fd(
|
|||||||
int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
|
int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
|
||||||
cam_sync_callback_for_dma_fence sync_cb)
|
cam_sync_callback_for_dma_fence sync_cb)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0, dma_fence_row_idx;
|
||||||
int dma_fence_row_idx = 0;
|
|
||||||
struct cam_dma_fence_row *row = NULL;
|
struct cam_dma_fence_row *row = NULL;
|
||||||
struct dma_fence *dma_fence = NULL;
|
struct dma_fence *dma_fence = NULL;
|
||||||
|
|
||||||
@@ -403,7 +402,7 @@ int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
|
|||||||
CAM_WARN(CAM_DMA_FENCE,
|
CAM_WARN(CAM_DMA_FENCE,
|
||||||
"dma fence at idx: %d fd: %d seqno: %llu has already registered a cb for sync: %d - same fd for 2 fences?",
|
"dma fence at idx: %d fd: %d seqno: %llu has already registered a cb for sync: %d - same fd for 2 fences?",
|
||||||
dma_fence_row_idx, row->fd, dma_fence->seqno, row->sync_obj);
|
dma_fence_row_idx, row->fd, dma_fence->seqno, row->sync_obj);
|
||||||
goto end;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dma_fence_add_callback(row->fence, &row->fence_cb,
|
rc = dma_fence_add_callback(row->fence, &row->fence_cb,
|
||||||
@@ -432,8 +431,6 @@ int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
|
|||||||
|
|
||||||
monitor_dump:
|
monitor_dump:
|
||||||
__cam_dma_fence_dump_monitor_array(dma_fence_row_idx);
|
__cam_dma_fence_dump_monitor_array(dma_fence_row_idx);
|
||||||
|
|
||||||
end:
|
|
||||||
spin_unlock_bh(&g_cam_dma_fence_dev->row_spinlocks[dma_fence_row_idx]);
|
spin_unlock_bh(&g_cam_dma_fence_dev->row_spinlocks[dma_fence_row_idx]);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -496,11 +493,11 @@ int cam_dma_fence_internal_signal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (row->state == CAM_DMA_FENCE_STATE_SIGNALED) {
|
if (row->state == CAM_DMA_FENCE_STATE_SIGNALED) {
|
||||||
spin_unlock_bh(&g_cam_dma_fence_dev->row_spinlocks[dma_fence_row_idx]);
|
|
||||||
CAM_WARN(CAM_DMA_FENCE,
|
CAM_WARN(CAM_DMA_FENCE,
|
||||||
"dma fence fd: %d[seqno: %llu] already in signaled state",
|
"dma fence fd: %d[seqno: %llu] already in signaled state",
|
||||||
signal_dma_fence->dma_fence_fd, dma_fence->seqno);
|
signal_dma_fence->dma_fence_fd, dma_fence->seqno);
|
||||||
return 0;
|
rc = 0;
|
||||||
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &cam_sync_monitor_mask))
|
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &cam_sync_monitor_mask))
|
||||||
|
@@ -69,13 +69,13 @@
|
|||||||
* dumps on any error, to explicitly trigger a dump on every fence release
|
* dumps on any error, to explicitly trigger a dump on every fence release
|
||||||
* below BIT(fence_type_dump) needs to be used at the same time
|
* below BIT(fence_type_dump) needs to be used at the same time
|
||||||
*/
|
*/
|
||||||
#define CAM_GENERIC_FENCE_DUMP 0x10
|
#define CAM_GENERIC_FENCE_DUMP_ALWAYS 0x10
|
||||||
#define CAM_GENERIC_FENCE_TYPE_SYNC_OBJ_DUMP \
|
#define CAM_GENERIC_FENCE_TYPE_SYNC_OBJ_DUMP \
|
||||||
(CAM_GENERIC_FENCE_TYPE_SYNC_OBJ + (CAM_GENERIC_FENCE_DUMP))
|
(CAM_GENERIC_FENCE_TYPE_SYNC_OBJ + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
|
||||||
#define CAM_GENERIC_FENCE_TYPE_DMA_FENCE_DUMP \
|
#define CAM_GENERIC_FENCE_TYPE_DMA_FENCE_DUMP \
|
||||||
(CAM_GENERIC_FENCE_TYPE_DMA_FENCE + (CAM_GENERIC_FENCE_DUMP))
|
(CAM_GENERIC_FENCE_TYPE_DMA_FENCE + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
|
||||||
#define CAM_GENERIC_FENCE_TYPE_SYNX_OBJ_DUMP \
|
#define CAM_GENERIC_FENCE_TYPE_SYNX_OBJ_DUMP \
|
||||||
(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ + (CAM_GENERIC_FENCE_DUMP))
|
(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enum sync_type - Enum to indicate the type of sync object,
|
* enum sync_type - Enum to indicate the type of sync object,
|
||||||
|
@@ -276,10 +276,12 @@ static int __cam_synx_obj_release(int32_t row_idx)
|
|||||||
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
||||||
rc = __cam_synx_deregister_cb_util(synx_hdl, row);
|
rc = __cam_synx_deregister_cb_util(synx_hdl, row);
|
||||||
spin_lock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
spin_lock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
||||||
if (rc)
|
if (rc) {
|
||||||
CAM_DBG(CAM_SYNX,
|
CAM_DBG(CAM_SYNX,
|
||||||
"Failed to deregister cb for synx hdl: %u rc: %d",
|
"Failed to deregister cb for synx hdl: %u rc: %d",
|
||||||
synx_hdl, rc);
|
synx_hdl, rc);
|
||||||
|
__cam_synx_obj_dump_monitor_array(row_idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,8 +348,7 @@ static void __cam_synx_obj_init_row(uint32_t idx, const char *name,
|
|||||||
static int __cam_synx_obj_release_row(int32_t row_idx)
|
static int __cam_synx_obj_release_row(int32_t row_idx)
|
||||||
{
|
{
|
||||||
if ((row_idx < 0) || (row_idx >= CAM_SYNX_MAX_OBJS)) {
|
if ((row_idx < 0) || (row_idx >= CAM_SYNX_MAX_OBJS)) {
|
||||||
CAM_ERR(CAM_SYNX, "synx row idx: %d is invalid",
|
CAM_ERR(CAM_SYNX, "synx row idx: %d is invalid", row_idx);
|
||||||
row_idx);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,18 +540,16 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
|
|||||||
if (row->state != CAM_SYNX_OBJ_STATE_ACTIVE) {
|
if (row->state != CAM_SYNX_OBJ_STATE_ACTIVE) {
|
||||||
CAM_ERR(CAM_SYNX, "synx obj: %u not in right state: %d to signal",
|
CAM_ERR(CAM_SYNX, "synx obj: %u not in right state: %d to signal",
|
||||||
signal_synx_obj->synx_obj, row->state);
|
signal_synx_obj->synx_obj, row->state);
|
||||||
__cam_synx_obj_dump_monitor_array(row_idx);
|
rc = -EINVAL;
|
||||||
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
goto monitor_dump;
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row->synx_obj != signal_synx_obj->synx_obj) {
|
if (row->synx_obj != signal_synx_obj->synx_obj) {
|
||||||
CAM_WARN(CAM_SYNX,
|
CAM_WARN(CAM_SYNX,
|
||||||
"Trying to signal synx obj: %u in row: %u having a different synx obj: %u",
|
"Trying to signal synx obj: %u in row: %u having a different synx obj: %u",
|
||||||
signal_synx_obj->synx_obj, row_idx, row->synx_obj);
|
signal_synx_obj->synx_obj, row_idx, row->synx_obj);
|
||||||
__cam_synx_obj_dump_monitor_array(row_idx);
|
rc = 0;
|
||||||
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
goto monitor_dump;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = __cam_synx_obj_map_sync_status_util(signal_synx_obj->status, &signal_status);
|
rc = __cam_synx_obj_map_sync_status_util(signal_synx_obj->status, &signal_status);
|
||||||
@@ -578,9 +577,10 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
|
|||||||
if (deregister_cb) {
|
if (deregister_cb) {
|
||||||
rc = __cam_synx_deregister_cb_util(signal_synx_obj->synx_obj, row);
|
rc = __cam_synx_deregister_cb_util(signal_synx_obj->synx_obj, row);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
spin_lock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
||||||
CAM_ERR(CAM_SYNX, "Failed to deregister cb for synx: %u rc: %d",
|
CAM_ERR(CAM_SYNX, "Failed to deregister cb for synx: %u rc: %d",
|
||||||
signal_synx_obj->synx_obj, rc);
|
signal_synx_obj->synx_obj, rc);
|
||||||
goto end;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,6 +594,11 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
|
|||||||
CAM_DBG(CAM_SYNX, "synx obj: %d signaled with status: %d rc: %d",
|
CAM_DBG(CAM_SYNX, "synx obj: %d signaled with status: %d rc: %d",
|
||||||
signal_synx_obj->synx_obj, signal_status, rc);
|
signal_synx_obj->synx_obj, signal_status, rc);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
monitor_dump:
|
||||||
|
__cam_synx_obj_dump_monitor_array(row_idx);
|
||||||
|
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
||||||
end:
|
end:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -678,7 +683,7 @@ int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
|
|||||||
CAM_WARN(CAM_SYNX,
|
CAM_WARN(CAM_SYNX,
|
||||||
"synx obj at idx: %d handle: %d has already registered a cb for sync: %d",
|
"synx obj at idx: %d handle: %d has already registered a cb for sync: %d",
|
||||||
row_idx, row->synx_obj, row->sync_obj);
|
row_idx, row->synx_obj, row->sync_obj);
|
||||||
goto end;
|
goto monitor_dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
row->sync_cb = sync_cb;
|
row->sync_cb = sync_cb;
|
||||||
@@ -712,7 +717,6 @@ int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
|
|||||||
|
|
||||||
monitor_dump:
|
monitor_dump:
|
||||||
__cam_synx_obj_dump_monitor_array(row_idx);
|
__cam_synx_obj_dump_monitor_array(row_idx);
|
||||||
end:
|
|
||||||
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -762,7 +766,6 @@ void cam_synx_obj_close(void)
|
|||||||
|
|
||||||
mutex_lock(&g_cam_synx_obj_dev->dev_lock);
|
mutex_lock(&g_cam_synx_obj_dev->dev_lock);
|
||||||
for (i = 0; i < CAM_SYNX_MAX_OBJS; i++) {
|
for (i = 0; i < CAM_SYNX_MAX_OBJS; i++) {
|
||||||
|
|
||||||
row = &g_cam_synx_obj_dev->rows[i];
|
row = &g_cam_synx_obj_dev->rows[i];
|
||||||
if (row->state == CAM_SYNX_OBJ_STATE_INVALID)
|
if (row->state == CAM_SYNX_OBJ_STATE_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -102,7 +102,8 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
|
|||||||
* @param synx_obj : New synx obj handle
|
* @param synx_obj : New synx obj handle
|
||||||
* @param row_idx : Imported obj table row idx
|
* @param row_idx : Imported obj table row idx
|
||||||
*
|
*
|
||||||
* @return 0 upon success, -EINVAL if synx object is bad state
|
* @return Status of operation. Zero in case of success
|
||||||
|
* -EINVAL if synx object is bad state
|
||||||
*/
|
*/
|
||||||
int cam_synx_obj_import_dma_fence(const char *name, uint32_t flags, void *fence,
|
int cam_synx_obj_import_dma_fence(const char *name, uint32_t flags, void *fence,
|
||||||
uint32_t *synx_obj, int32_t *row_idx);
|
uint32_t *synx_obj, int32_t *row_idx);
|
||||||
@@ -112,7 +113,7 @@ int cam_synx_obj_import_dma_fence(const char *name, uint32_t flags, void *fence,
|
|||||||
*
|
*
|
||||||
* @param release_params : Synx obj release info
|
* @param release_params : Synx obj release info
|
||||||
*
|
*
|
||||||
* @return 0 upon success, negative value otherwise
|
* @return Status of operation. Zero upon success. Negative value otherwise
|
||||||
*/
|
*/
|
||||||
int cam_synx_obj_release(struct cam_synx_obj_release_params *release_params);
|
int cam_synx_obj_release(struct cam_synx_obj_release_params *release_params);
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ int cam_synx_obj_release(struct cam_synx_obj_release_params *release_params);
|
|||||||
*
|
*
|
||||||
* @param signal_synx_obj : Signal info
|
* @param signal_synx_obj : Signal info
|
||||||
*
|
*
|
||||||
* @return 0 upon success, negative value otherwise
|
* @return Status of operation. Zero upon success. Negative value otherwise
|
||||||
*/
|
*/
|
||||||
int cam_synx_obj_signal_obj(struct cam_synx_obj_signal *signal_synx_obj);
|
int cam_synx_obj_signal_obj(struct cam_synx_obj_signal *signal_synx_obj);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user