msm: eva: Support synx version update

The change makes it easier for eva driver to support backward
and forwardcompatibility of SynX versions.

Change-Id: I6382d5c904d30bd38692ce74e747749e113be621
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
This commit is contained in:
George Shen
2022-03-14 14:32:26 -07:00
orang tua 26396dd79a
melakukan 8205a08975
6 mengubah file dengan 58 tambahan dan 67 penghapusan

Melihat File

@@ -415,6 +415,8 @@ static int msm_probe_cvp_device(struct platform_device *pdev)
goto err_hfi_initialize;
}
cvp_synx_ftbl_init(core);
mutex_lock(&cvp_driver->lock);
list_add_tail(&core->list, &cvp_driver->cores);
mutex_unlock(&cvp_driver->lock);

Melihat File

@@ -473,7 +473,8 @@ static int cvp_fence_proc(struct msm_cvp_inst *inst,
sq = &inst->session_queue_fence;
ktid = pkt->client_data.kdata;
rc = cvp_synx_ops(inst, CVP_INPUT_SYNX, fc, &synx_state);
rc = inst->core->synx_ftbl->cvp_synx_ops(inst, CVP_INPUT_SYNX,
fc, &synx_state);
if (rc) {
msm_cvp_unmap_frame(inst, pkt->client_data.kdata);
goto exit;
@@ -538,7 +539,8 @@ static int cvp_fence_proc(struct msm_cvp_inst *inst,
}
exit:
rc = cvp_synx_ops(inst, CVP_OUTPUT_SYNX, fc, &synx_state);
rc = inst->core->synx_ftbl->cvp_synx_ops(inst, CVP_OUTPUT_SYNX,
fc, &synx_state);
if (clock_check)
cvp_check_clock(inst,
(struct cvp_hfi_msg_session_hdr_ext *)&hdr);
@@ -616,7 +618,7 @@ wait:
rc = cvp_fence_proc(inst, f, pkt);
mutex_lock(&q->lock);
cvp_release_synx(inst, f);
inst->core->synx_ftbl->cvp_release_synx(inst, f);
list_del_init(&f->list);
state = q->state;
mutex_unlock(&q->lock);
@@ -733,7 +735,7 @@ static int msm_cvp_session_process_hfi_fence(struct msm_cvp_inst *inst,
f->pkt->client_data.kdata |= FENCE_BIT;
rc = cvp_import_synx(inst, f, fence);
rc = inst->core->synx_ftbl->cvp_import_synx(inst, f, fence);
if (rc) {
kfree(f);
goto exit;
@@ -1054,7 +1056,7 @@ int msm_cvp_session_create(struct msm_cvp_inst *inst)
goto fail_init;
}
cvp_sess_init_synx(inst);
inst->core->synx_ftbl->cvp_sess_init_synx(inst);
sq = &inst->session_queue;
spin_lock(&sq->lock);
sq->state = QUEUE_ACTIVE;
@@ -1571,8 +1573,9 @@ static void cvp_clean_fence_queue(struct msm_cvp_inst *inst, int synx_state)
list_del_init(&f->list);
msm_cvp_unmap_frame(inst, f->pkt->client_data.kdata);
cvp_cancel_synx(inst, CVP_OUTPUT_SYNX, f, synx_state);
cvp_release_synx(inst, f);
inst->core->synx_ftbl->cvp_cancel_synx(inst, CVP_OUTPUT_SYNX,
f, synx_state);
inst->core->synx_ftbl->cvp_release_synx(inst, f);
cvp_free_fence_data(f);
}
@@ -1581,7 +1584,8 @@ static void cvp_clean_fence_queue(struct msm_cvp_inst *inst, int synx_state)
dprintk(CVP_SYNX, "%s: (%#x)flush frame %llu %llu sched_list\n",
__func__, hash32_ptr(inst->session), ktid, f->frame_id);
cvp_cancel_synx(inst, CVP_INPUT_SYNX, f, synx_state);
inst->core->synx_ftbl->cvp_cancel_synx(inst, CVP_INPUT_SYNX,
f, synx_state);
}
mutex_unlock(&q->lock);

Melihat File

@@ -325,7 +325,7 @@ wait:
dprintk(CVP_WARN, "Unprocessed frame %d\n",
frame->pkt_type);
mutex_unlock(&inst->frames.lock);
cvp_dump_fence_queue(inst);
inst->core->synx_ftbl->cvp_dump_fence_queue(inst);
}
if (cvp_release_arp_buffers(inst))
@@ -382,7 +382,7 @@ int msm_cvp_destroy(struct msm_cvp_inst *inst)
__deinit_session_queue(inst);
__deinit_fence_queue(inst);
cvp_sess_deinit_synx(inst);
core->synx_ftbl->cvp_sess_deinit_synx(inst);
pr_info(CVP_DBG_TAG "Closed cvp instance: %pK session_id = %d\n",
"sess", inst, hash32_ptr(inst->session));

Melihat File

@@ -352,6 +352,7 @@ struct msm_cvp_core {
struct device *dev;
struct cvp_hfi_device *device;
struct msm_cvp_platform_data *platform_data;
struct msm_cvp_synx_ops *synx_ftbl;
struct list_head instances;
struct dentry *debugfs_root;
enum cvp_core_state state;

Melihat File

@@ -10,7 +10,7 @@
#include "msm_cvp_dsp.h"
#ifdef CVP_SYNX_ENABLED
int cvp_sess_init_synx(struct msm_cvp_inst *inst)
static int cvp_sess_init_synx_v1(struct msm_cvp_inst *inst)
{
struct synx_initialization_params params;
@@ -23,7 +23,7 @@ int cvp_sess_init_synx(struct msm_cvp_inst *inst)
return 0;
}
int cvp_sess_deinit_synx(struct msm_cvp_inst *inst)
static int cvp_sess_deinit_synx(struct msm_cvp_inst *inst)
{
if (!inst) {
dprintk(CVP_ERR, "Used invalid sess in deinit_synx\n");
@@ -33,7 +33,7 @@ int cvp_sess_deinit_synx(struct msm_cvp_inst *inst)
return 0;
}
void cvp_dump_fence_queue(struct msm_cvp_inst *inst)
static void cvp_dump_fence_queue_v1(struct msm_cvp_inst *inst)
{
struct cvp_fence_queue *q;
struct cvp_fence_command *f;
@@ -68,7 +68,7 @@ void cvp_dump_fence_queue(struct msm_cvp_inst *inst)
mutex_unlock(&q->lock);
}
int cvp_import_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc,
static int cvp_import_synx_v1(struct msm_cvp_inst *inst, struct cvp_fence_command *fc,
u32 *fence)
{
int rc = 0, rr = 0;
@@ -107,7 +107,7 @@ int cvp_import_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc,
return rr;
}
int cvp_release_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc)
static int cvp_release_synx_v1(struct msm_cvp_inst *inst, struct cvp_fence_command *fc)
{
int rc = 0;
int i;
@@ -175,7 +175,7 @@ static int cvp_cancel_synx_impl(struct msm_cvp_inst *inst,
}
int cvp_cancel_synx(struct msm_cvp_inst *inst, enum cvp_synx_type type,
static int cvp_cancel_synx(struct msm_cvp_inst *inst, enum cvp_synx_type type,
struct cvp_fence_command *fc, int synx_state)
{
if (fc->signature != 0xFEEDFACE) {
@@ -242,7 +242,7 @@ static int cvp_signal_synx(struct synx_session ssid, u32 *synx, u32 num_synx,
return rc;
}
int cvp_synx_ops(struct msm_cvp_inst *inst, enum cvp_synx_type type,
static int cvp_synx_ops_v1(struct msm_cvp_inst *inst, enum cvp_synx_type type,
struct cvp_fence_command *fc, u32 *synx_state)
{
struct synx_session ssid;
@@ -267,3 +267,22 @@ int cvp_synx_ops(struct msm_cvp_inst *inst, enum cvp_synx_type type,
}
}
#endif
struct msm_cvp_synx_ops cvp_synx_v1 = {
.cvp_sess_init_synx = cvp_sess_init_synx_v1,
.cvp_sess_deinit_synx = cvp_sess_deinit_synx,
.cvp_release_synx = cvp_release_synx_v1,
.cvp_import_synx = cvp_import_synx_v1,
.cvp_synx_ops = cvp_synx_ops_v1,
.cvp_cancel_synx = cvp_cancel_synx,
.cvp_dump_fence_queue = cvp_dump_fence_queue_v1,
};
void cvp_synx_ftbl_init(struct msm_cvp_core *core)
{
if (!core)
return;
/* Synx API version check below if needed */
core->synx_ftbl = &cvp_synx_v1;
}

Melihat File

@@ -10,6 +10,7 @@
#include <media/msm_eva_private.h>
#include "cvp_comm_def.h"
struct msm_cvp_core;
struct cvp_fence_queue {
struct mutex lock;
@@ -44,60 +45,24 @@ enum cvp_synx_type {
CVP_INVALID_SYNX,
};
#ifdef CVP_SYNX_ENABLED
int cvp_sess_init_synx(struct msm_cvp_inst *inst);
int cvp_sess_deinit_synx(struct msm_cvp_inst *inst);
int cvp_import_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc,
u32 *fence);
int cvp_release_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc);
int cvp_cancel_synx(struct msm_cvp_inst *inst, enum cvp_synx_type type,
struct cvp_fence_command *fc, int synx_state);
int cvp_synx_ops(struct msm_cvp_inst *inst, enum cvp_synx_type type,
struct cvp_fence_command *fc, u32 *synx_state);
void cvp_dump_fence_queue(struct msm_cvp_inst *inst);
#else
static inline int cvp_sess_init_synx(struct msm_cvp_inst *inst)
{
return -ENODEV;
}
static inline int cvp_sess_deinit_synx(struct msm_cvp_inst *inst)
{
return -ENODEV;
}
static inline int cvp_import_synx(struct msm_cvp_inst *inst,
struct msm_cvp_synx_ops {
int (*cvp_sess_init_synx)(struct msm_cvp_inst *inst);
int (*cvp_sess_deinit_synx)(struct msm_cvp_inst *inst);
int (*cvp_release_synx)(struct msm_cvp_inst *inst,
struct cvp_fence_command *fc);
int (*cvp_import_synx)(struct msm_cvp_inst *inst,
struct cvp_fence_command *fc,
u32 *fence)
{
return -ENODEV;
}
static inline int cvp_release_synx(struct msm_cvp_inst *inst,
struct cvp_fence_command *fc)
{
return -ENODEV;
}
static inline int cvp_cancel_synx(struct msm_cvp_inst *inst,
u32 *fence);
int (*cvp_synx_ops)(struct msm_cvp_inst *inst,
enum cvp_synx_type type,
struct cvp_fence_command *fc,
int synx_state)
{
return -ENODEV;
}
static inline int cvp_synx_ops(struct msm_cvp_inst *inst,
u32 *synx_state);
int (*cvp_cancel_synx)(struct msm_cvp_inst *inst,
enum cvp_synx_type type,
struct cvp_fence_command *fc,
u32 *synx_state)
{
return -ENODEV;
}
int synx_state);
void (*cvp_dump_fence_queue)(struct msm_cvp_inst *inst);
};
static inline void cvp_dump_fence_queue(struct msm_cvp_inst *inst)
{
return;
}
#endif
void cvp_synx_ftbl_init(struct msm_cvp_core *core);
#endif