video: driver: misc synx fence changes

- Make synx fence debugfs support as module parameter
- Update sync fence related register device addresses to
  eliminate memory holes
- Enable hw fence config parameter to enable compilation
  of hw fence definitions in display driver
- Handle synx fence queue memory error in control status
  register.
- Fix msm_vidc_debug and msm_vidc_fw_dump module params
  ro accept values during module instantiation.

Change-Id: Ib3ab7e80cfc4e440c0b3170292e1943888298875
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
This commit is contained in:
Akshata Sahukar
2023-03-27 18:04:09 -07:00
parent 203f619b7f
commit be793d6501
6 changed files with 68 additions and 56 deletions

View File

@@ -634,7 +634,7 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
CAP_FLAG_VOLATILE}, CAP_FLAG_VOLATILE},
/* Fence type for input buffer. Currently unsed */ /* Fence type for input buffer. Currently unsed */
{INBUF_FENCE_TYPE, DEC, CODECS_ALL, {INBUF_FENCE_TYPE, DEC, H264|HEVC|VP9|AV1,
MSM_VIDC_FENCE_NONE, MSM_VIDC_FENCE_NONE, MSM_VIDC_FENCE_NONE, MSM_VIDC_FENCE_NONE,
BIT(MSM_VIDC_FENCE_NONE), BIT(MSM_VIDC_FENCE_NONE),
MSM_VIDC_FENCE_NONE, MSM_VIDC_FENCE_NONE,
@@ -642,7 +642,7 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
HFI_PROP_FENCE_TYPE, HFI_PROP_FENCE_TYPE,
CAP_FLAG_MENU | CAP_FLAG_INPUT_PORT}, CAP_FLAG_MENU | CAP_FLAG_INPUT_PORT},
{OUTBUF_FENCE_TYPE, DEC, CODECS_ALL, {OUTBUF_FENCE_TYPE, DEC, H264|HEVC|VP9|AV1,
MSM_VIDC_FENCE_NONE, MSM_VIDC_SYNX_V2_FENCE, MSM_VIDC_FENCE_NONE, MSM_VIDC_SYNX_V2_FENCE,
BIT(MSM_VIDC_FENCE_NONE) | BIT(MSM_VIDC_SW_FENCE) | BIT(MSM_VIDC_FENCE_NONE) | BIT(MSM_VIDC_SW_FENCE) |
BIT(MSM_VIDC_SYNX_V2_FENCE), BIT(MSM_VIDC_SYNX_V2_FENCE),
@@ -652,7 +652,7 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
CAP_FLAG_MENU | CAP_FLAG_OUTPUT_PORT}, CAP_FLAG_MENU | CAP_FLAG_OUTPUT_PORT},
/* Fence direction for input buffer. Currently unsed */ /* Fence direction for input buffer. Currently unsed */
{INBUF_FENCE_DIRECTION, DEC, CODECS_ALL, {INBUF_FENCE_DIRECTION, DEC, H264|HEVC|VP9|AV1,
MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_NONE,
BIT(MSM_VIDC_FENCE_DIR_NONE), BIT(MSM_VIDC_FENCE_DIR_NONE),
MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_NONE,
@@ -660,7 +660,7 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
HFI_PROP_FENCE_DIRECTION, HFI_PROP_FENCE_DIRECTION,
CAP_FLAG_MENU | CAP_FLAG_INPUT_PORT}, CAP_FLAG_MENU | CAP_FLAG_INPUT_PORT},
{OUTBUF_FENCE_DIRECTION, DEC, CODECS_ALL, {OUTBUF_FENCE_DIRECTION, DEC, H264|HEVC|VP9|AV1,
MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_RX, MSM_VIDC_FENCE_DIR_NONE, MSM_VIDC_FENCE_DIR_RX,
BIT(MSM_VIDC_FENCE_DIR_NONE) | BIT(MSM_VIDC_FENCE_DIR_TX) | BIT(MSM_VIDC_FENCE_DIR_NONE) | BIT(MSM_VIDC_FENCE_DIR_TX) |
BIT(MSM_VIDC_FENCE_DIR_RX), BIT(MSM_VIDC_FENCE_DIR_RX),
@@ -669,7 +669,7 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
HFI_PROP_FENCE_DIRECTION, HFI_PROP_FENCE_DIRECTION,
CAP_FLAG_MENU | CAP_FLAG_OUTPUT_PORT}, CAP_FLAG_MENU | CAP_FLAG_OUTPUT_PORT},
{FENCE_ERROR_DATA_CORRUPT, DEC, CODECS_ALL, {FENCE_ERROR_DATA_CORRUPT, DEC, H264|HEVC|VP9|AV1,
0, 1, 1, 0, 0, 1, 1, 0,
0, 0,
HFI_PROP_FENCE_ERROR_DATA_CORRUPT}, HFI_PROP_FENCE_ERROR_DATA_CORRUPT},
@@ -2111,27 +2111,27 @@ static struct msm_platform_inst_cap_dependency instance_cap_dependency_data_pine
msm_vidc_adjust_dec_outbuf_fence, msm_vidc_adjust_dec_outbuf_fence,
NULL}, NULL},
{INBUF_FENCE_TYPE, DEC, CODECS_ALL, {INBUF_FENCE_TYPE, DEC, H264|HEVC|VP9|AV1,
{0}, {0},
NULL, NULL,
NULL}, NULL},
{OUTBUF_FENCE_TYPE, DEC, CODECS_ALL, {OUTBUF_FENCE_TYPE, DEC, H264|HEVC|VP9|AV1,
{0}, {0},
msm_vidc_adjust_dec_outbuf_fence_type, msm_vidc_adjust_dec_outbuf_fence_type,
msm_vidc_set_outbuf_fence_type}, msm_vidc_set_outbuf_fence_type},
{INBUF_FENCE_DIRECTION, DEC, CODECS_ALL, {INBUF_FENCE_DIRECTION, DEC, H264|HEVC|VP9|AV1,
{0}, {0},
NULL, NULL,
NULL}, NULL},
{OUTBUF_FENCE_DIRECTION, DEC, CODECS_ALL, {OUTBUF_FENCE_DIRECTION, DEC, H264|HEVC|VP9|AV1,
{0}, {0},
msm_vidc_adjust_dec_outbuf_fence_direction, msm_vidc_adjust_dec_outbuf_fence_direction,
msm_vidc_set_outbuf_fence_direction}, msm_vidc_set_outbuf_fence_direction},
{FENCE_ERROR_DATA_CORRUPT, DEC, CODECS_ALL, {FENCE_ERROR_DATA_CORRUPT, DEC, H264|HEVC|VP9|AV1,
{0}, {0},
NULL, NULL,
msm_vidc_set_u32}, msm_vidc_set_u32},
@@ -2765,12 +2765,12 @@ static const struct device_region_table pineapple_device_region_table[] = {
}, },
{ {
"ipc_protocol4_client8_version-registers", "ipc_protocol4_client8_version-registers",
0x00508000, 0x1000, 0xFFADD000, 0x00508000, 0x1000, 0xFFADF000,
MSM_VIDC_PROTOCOL_FENCE_CLIENT_VPU MSM_VIDC_PROTOCOL_FENCE_CLIENT_VPU
}, },
{ {
"qtimer_f0v1_qtmr_v1_cntpct_lo", "qtimer_f0v1_qtmr_v1_cntpct_lo",
0x17421000, 0x1000, 0xFFADC000, 0x17421000, 0x1000, 0xFFADE000,
MSM_VIDC_QTIMER MSM_VIDC_QTIMER
}, },
}; };

View File

@@ -954,7 +954,8 @@ static int __boot_firmware_iris33(struct msm_vidc_core *vidc_core)
return rc; return rc;
if ((ctrl_status & HFI_CTRL_ERROR_FATAL) || if ((ctrl_status & HFI_CTRL_ERROR_FATAL) ||
(ctrl_status & HFI_CTRL_ERROR_UC_REGION_NOT_SET)) { (ctrl_status & HFI_CTRL_ERROR_UC_REGION_NOT_SET) ||
(ctrl_status & HFI_CTRL_ERROR_HW_FENCE_QUEUE)) {
d_vpr_e("%s: boot firmware failed, ctrl status %#x\n", d_vpr_e("%s: boot firmware failed, ctrl status %#x\n",
__func__, ctrl_status); __func__, ctrl_status);
return -EINVAL; return -EINVAL;

View File

@@ -39,7 +39,7 @@ extern int msm_vidc_ddr_bw;
extern int msm_vidc_llc_bw; extern int msm_vidc_llc_bw;
extern bool msm_vidc_fw_dump; extern bool msm_vidc_fw_dump;
extern unsigned int msm_vidc_enable_bugon; extern unsigned int msm_vidc_enable_bugon;
extern bool msm_vidc_disable_synx_fence; extern bool msm_vidc_synx_fence_enable;
/* do not modify the log message as it is used in test scripts */ /* do not modify the log message as it is used in test scripts */
#define FMT_STRING_SET_CTRL \ #define FMT_STRING_SET_CTRL \

View File

@@ -22,6 +22,8 @@ extern struct msm_vidc_core *g_core;
#define MSM_VIDC_MAX_STATS_DELAY_MS 10000 #define MSM_VIDC_MAX_STATS_DELAY_MS 10000
unsigned int msm_vidc_debug = (DRV_LOG | FW_LOG); unsigned int msm_vidc_debug = (DRV_LOG | FW_LOG);
/* disabled synx fence by default temporarily */
bool msm_vidc_synx_fence_enable = false;
static int debug_level_set(const char *val, static int debug_level_set(const char *val,
const struct kernel_param *kp) const struct kernel_param *kp)
@@ -34,12 +36,6 @@ static int debug_level_set(const char *val,
d_vpr_e("%s: Invalid params\n", __func__); d_vpr_e("%s: Invalid params\n", __func__);
return -EINVAL; return -EINVAL;
} }
core = *(struct msm_vidc_core **)kp->arg;
if (!core || !core->capabilities) {
d_vpr_e("%s: Invalid core/capabilities\n", __func__);
return -EINVAL;
}
ret = kstrtouint(val, 0, &dvalue); ret = kstrtouint(val, 0, &dvalue);
if (ret) if (ret)
@@ -47,6 +43,13 @@ static int debug_level_set(const char *val,
msm_vidc_debug = dvalue; msm_vidc_debug = dvalue;
core = *(struct msm_vidc_core **)kp->arg;
if (!core || !core->capabilities) {
d_vpr_e("%s: Invalid core/capabilities\n", __func__);
return 0;
}
/* check if driver or FW logmask is more than default level */ /* check if driver or FW logmask is more than default level */
if (((dvalue & DRV_LOGMASK) & ~(DRV_LOG)) || if (((dvalue & DRV_LOGMASK) & ~(DRV_LOG)) ||
((dvalue & FW_LOGMASK) & ~(FW_LOG))) { ((dvalue & FW_LOGMASK) & ~(FW_LOG))) {
@@ -82,7 +85,6 @@ static const struct kernel_param_ops msm_vidc_debug_fops = {
static int fw_dump_set(const char *val, static int fw_dump_set(const char *val,
const struct kernel_param *kp) const struct kernel_param *kp)
{ {
struct msm_vidc_core *core = NULL;
unsigned int dvalue; unsigned int dvalue;
int ret; int ret;
@@ -90,12 +92,6 @@ static int fw_dump_set(const char *val,
d_vpr_e("%s: Invalid params\n", __func__); d_vpr_e("%s: Invalid params\n", __func__);
return -EINVAL; return -EINVAL;
} }
core = *(struct msm_vidc_core **) kp->arg;
if (!core || !core->capabilities) {
d_vpr_e("%s: Invalid core/capabilities\n", __func__);
return -EINVAL;
}
ret = kstrtouint(val, 0, &dvalue); ret = kstrtouint(val, 0, &dvalue);
if (ret) if (ret)
@@ -118,16 +114,44 @@ static const struct kernel_param_ops msm_vidc_fw_dump_fops = {
.get = fw_dump_get, .get = fw_dump_get,
}; };
static int synx_fence_set(const char *val,
const struct kernel_param *kp)
{
unsigned int dvalue;
int ret;
if (!kp || !kp->arg || !val) {
d_vpr_e("%s: Invalid params\n", __func__);
return -EINVAL;
}
ret = kstrtouint(val, 0, &dvalue);
if (ret)
return ret;
msm_vidc_synx_fence_enable = dvalue;
return 0;
}
static int synx_fence_get(char *buffer, const struct kernel_param *kp)
{
return scnprintf(buffer, PAGE_SIZE, "%#x", msm_vidc_synx_fence_enable);
}
static const struct kernel_param_ops msm_vidc_synx_fence_debug_fops = {
.set = synx_fence_set,
.get = synx_fence_get,
};
module_param_cb(msm_vidc_debug, &msm_vidc_debug_fops, &g_core, 0644); module_param_cb(msm_vidc_debug, &msm_vidc_debug_fops, &g_core, 0644);
module_param_cb(msm_vidc_fw_dump, &msm_vidc_fw_dump_fops, &g_core, 0644); module_param_cb(msm_vidc_fw_dump, &msm_vidc_fw_dump_fops, &g_core, 0644);
module_param_cb(msm_vidc_synx_fence_enable,
&msm_vidc_synx_fence_debug_fops, &g_core, 0644);
bool msm_vidc_lossless_encode = !true; bool msm_vidc_lossless_encode = !true;
EXPORT_SYMBOL(msm_vidc_lossless_encode); EXPORT_SYMBOL(msm_vidc_lossless_encode);
/* disabled synx fence by default temporarily */
bool msm_vidc_disable_synx_fence = !false;
EXPORT_SYMBOL(msm_vidc_disable_synx_fence);
bool msm_vidc_syscache_disable = !true; bool msm_vidc_syscache_disable = !true;
EXPORT_SYMBOL(msm_vidc_syscache_disable); EXPORT_SYMBOL(msm_vidc_syscache_disable);
@@ -402,8 +426,6 @@ struct dentry* msm_vidc_debugfs_init_drv(void)
&msm_vidc_syscache_disable); &msm_vidc_syscache_disable);
debugfs_create_bool("lossless_encoding", 0644, dir, debugfs_create_bool("lossless_encoding", 0644, dir,
&msm_vidc_lossless_encode); &msm_vidc_lossless_encode);
debugfs_create_bool("disable_synx_v2_fence", 0644, dir,
&msm_vidc_disable_synx_fence);
debugfs_create_u32("enable_bugon", 0644, dir, debugfs_create_u32("enable_bugon", 0644, dir,
&msm_vidc_enable_bugon); &msm_vidc_enable_bugon);

View File

@@ -569,7 +569,16 @@ static int msm_vidc_component_master_bind(struct device *dev)
} }
if (core->capabilities[SUPPORTS_SYNX_FENCE].value) { if (core->capabilities[SUPPORTS_SYNX_FENCE].value) {
if (msm_vidc_disable_synx_fence) { if (msm_vidc_synx_fence_enable) {
/* register for synx fence */
rc = call_fence_op(core, fence_register, core);
if (rc) {
d_vpr_e("%s: failed to register synx fence\n",
__func__);
core->capabilities[SUPPORTS_SYNX_FENCE].value = 0;
return rc;
}
} else {
/* override synx fence ops with dma fence ops */ /* override synx fence ops with dma fence ops */
core->fence_ops = get_dma_fence_ops(); core->fence_ops = get_dma_fence_ops();
if (!core->fence_ops) { if (!core->fence_ops) {
@@ -577,28 +586,6 @@ static int msm_vidc_component_master_bind(struct device *dev)
return -EINVAL; return -EINVAL;
} }
core->capabilities[SUPPORTS_SYNX_FENCE].value = 0; core->capabilities[SUPPORTS_SYNX_FENCE].value = 0;
} else {
/* register for synx fence */
rc = call_fence_op(core, fence_register, core);
if (rc) {
d_vpr_e("%s: failed to register synx fence\n",
__func__);
core->capabilities[SUPPORTS_SYNX_FENCE].value = 0;
/*
* - Bail out the session for time being for this
* case where synx fence register call retunrs error
* to help with debugging
* - Re-initialize fence ops with dma_fence_ops.
* This is required once we start ignoring this
* synx fence register call error.
*/
core->fence_ops = get_dma_fence_ops();
if (!core->fence_ops) {
d_vpr_e("%s: invalid dma fence ops\n", __func__);
return -EINVAL;
}
return rc;
}
} }
} }

View File

@@ -145,6 +145,7 @@ static int msm_vidc_synx_fence_register(struct msm_vidc_core *core)
"video synx fence"); "video synx fence");
params.name = synx_session_name; params.name = synx_session_name;
params.ptr = &queue_desc; params.ptr = &queue_desc;
params.flags = SYNX_INIT_MAX; /* unused */
session = session =
(struct synx_session *)synx_hwfence_initialize(&params); (struct synx_session *)synx_hwfence_initialize(&params);
@@ -155,6 +156,7 @@ static int msm_vidc_synx_fence_register(struct msm_vidc_core *core)
/* fill core synx fence data */ /* fill core synx fence data */
core->synx_fence_data.client_id = (u32)params.id; core->synx_fence_data.client_id = (u32)params.id;
core->synx_fence_data.client_flags = (u32)params.flags;
core->synx_fence_data.session = (void *)session; core->synx_fence_data.session = (void *)session;
core->synx_fence_data.queue.size = (u32)queue_desc.size; core->synx_fence_data.queue.size = (u32)queue_desc.size;
core->synx_fence_data.queue.kvaddr = queue_desc.vaddr; core->synx_fence_data.queue.kvaddr = queue_desc.vaddr;