Merge "msm: vidc: revise timestamp data type to s64"
This commit is contained in:
commit
c1ad7b0054
@ -366,7 +366,7 @@ int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
||||
int rc = 0;
|
||||
unsigned int i = 0;
|
||||
struct buf_queue *q = NULL;
|
||||
u64 timestamp_us = 0;
|
||||
s64 timestamp_us = 0;
|
||||
u32 cr = 0;
|
||||
|
||||
if (!inst || !inst->core || !b || !valid_v4l2_buffer(b, inst)) {
|
||||
@ -430,7 +430,7 @@ int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
||||
&& b->type == INPUT_MPLANE)
|
||||
b->flags |= V4L2_BUF_FLAG_PERF_MODE;
|
||||
|
||||
timestamp_us = (u64)((b->timestamp.tv_sec * 1000000ULL) +
|
||||
timestamp_us = (s64)((b->timestamp.tv_sec * 1000000) +
|
||||
b->timestamp.tv_usec);
|
||||
if (is_decode_session(inst) && b->type == INPUT_MPLANE) {
|
||||
if (inst->flush_timestamps)
|
||||
@ -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;
|
||||
|
@ -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, s64 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;
|
||||
@ -7783,8 +7794,8 @@ int msm_comm_fetch_ts_framerate(struct msm_vidc_inst *inst,
|
||||
if (!(b->flags & V4L2_BUF_FLAG_END_OF_SUBFRAME))
|
||||
node->is_valid = false;
|
||||
|
||||
b->timestamp.tv_sec = node->timestamp_us / 1000000ull;
|
||||
b->timestamp.tv_usec = node->timestamp_us % 1000000ull;
|
||||
b->timestamp.tv_sec = node->timestamp_us / 1000000;
|
||||
b->timestamp.tv_usec = node->timestamp_us % 1000000;
|
||||
b->m.planes[0].reserved[MSM_VIDC_FRAMERATE] = node->framerate;
|
||||
break;
|
||||
}
|
||||
|
@ -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, s64 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,
|
||||
|
@ -236,9 +236,10 @@ struct msm_vidc_codec {
|
||||
|
||||
struct msm_vidc_timestamps {
|
||||
struct list_head list;
|
||||
u64 timestamp_us;
|
||||
s64 timestamp_us;
|
||||
u32 framerate;
|
||||
bool is_valid;
|
||||
bool is_eos;
|
||||
};
|
||||
|
||||
enum efuse_purpose {
|
||||
|
Loading…
Reference in New Issue
Block a user