msm: vidc: fix time stamp store after EOS for decoders

1. Add a new EOS flag to denote EOS pending status;
2. Set all existed time stamps with EOS flag as true
   after inserting EOS time stamp;
3. Ignore time stamp sorting to buffers with EOS pending
   flag as true;

Change-Id: I72b041150973e2a28d1039c5f906fdb222a86081
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
This commit is contained in:
Shi Zhongbo 2020-08-05 14:13:37 +08:00 committed by Gerrit - the friendly Code Review server
parent 10fbc8019e
commit 460c45b72a
4 changed files with 20 additions and 6 deletions

View File

@ -438,7 +438,8 @@ int msm_vidc_qbuf(void *instance, struct media_device *mdev,
inst->flush_timestamps = false;
if (!(b->flags & V4L2_BUF_FLAG_CODECCONFIG))
rc = msm_comm_store_timestamp(inst, timestamp_us);
rc = msm_comm_store_timestamp(inst, timestamp_us,
b->flags & V4L2_BUF_FLAG_EOS);
if (rc)
goto unlock;

View File

@ -7600,7 +7600,8 @@ void msm_comm_release_timestamps(struct msm_vidc_inst *inst)
mutex_unlock(&inst->timestamps.lock);
}
int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us,
bool is_eos)
{
struct msm_vidc_timestamps *entry, *node, *prev = NULL;
struct msm_vidc_timestamps *duplicate;
@ -7618,7 +7619,8 @@ int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
duplicate = NULL;
list_for_each_entry(node, &inst->timestamps.list, list) {
count++;
if (node->is_valid && node->timestamp_us == timestamp_us)
if (node->is_valid && node->timestamp_us == timestamp_us &&
!node->is_eos)
duplicate = node;
}
@ -7649,6 +7651,7 @@ int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
entry->timestamp_us = duplicate->timestamp_us;
entry->framerate = duplicate->framerate;
entry->is_valid = true;
entry->is_eos = is_eos;
/* add entry next to duplicate */
list_add(&entry->list, &duplicate->list);
goto unlock;
@ -7661,7 +7664,8 @@ int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
prev = NULL;
inserted = false;
list_for_each_entry(node, &inst->timestamps.list, list) {
if (entry->timestamp_us < node->timestamp_us) {
if (entry->timestamp_us < node->timestamp_us &&
!node->is_eos) {
/*
* if prev available add entry next to prev else
* entry is first so add it at head.
@ -7688,7 +7692,8 @@ int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
node->timestamp_us, prev->timestamp_us);
break;
}
if (node->timestamp_us == entry->timestamp_us) {
if (node->timestamp_us == entry->timestamp_us &&
!node->is_eos) {
if (prev)
node->framerate = msm_comm_calc_framerate(inst,
node->timestamp_us, prev->timestamp_us);
@ -7697,6 +7702,12 @@ int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us)
prev = node;
}
/* mark all entries as eos if is_eos is queued */
if (is_eos)
list_for_each_entry(node, &inst->timestamps.list, list) {
node->is_eos = true;
}
unlock:
mutex_unlock(&inst->timestamps.lock);
return rc;

View File

@ -400,7 +400,8 @@ int msm_comm_set_cvp_skip_ratio(struct msm_vidc_inst *inst,
uint32_t capture_rate, uint32_t cvp_rate);
int msm_comm_fetch_ts_framerate(struct msm_vidc_inst *inst,
struct v4l2_buffer *b);
int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us);
int msm_comm_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us,
bool is_eos);
void msm_comm_release_timestamps(struct msm_vidc_inst *inst);
u32 msm_comm_get_max_framerate(struct msm_vidc_inst *inst);
u32 msm_comm_calc_framerate(struct msm_vidc_inst *inst, u64 timestamp_us,

View File

@ -239,6 +239,7 @@ struct msm_vidc_timestamps {
u64 timestamp_us;
u32 framerate;
bool is_valid;
bool is_eos;
};
enum efuse_purpose {