Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 802bc162 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Timestamp fixes for 4.9" into msm-4.9

parents 6a1c7d8e 362d092a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1041,6 +1041,7 @@ static inline int vb2_bufq_init(struct msm_vidc_inst *inst,
	q->mem_ops = &msm_vidc_vb2_mem_ops;
	q->drv_priv = inst;
	q->allow_zero_bytesused = 1;
	q->copy_timestamp = 1;
	return vb2_queue_init(q);
}

+8 −11
Original line number Diff line number Diff line
@@ -2012,7 +2012,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
	struct vidc_hal_fbd *fill_buf_done;
	enum hal_buffer buffer_type;
	int extra_idx = 0;
	int64_t time_usec = 0;
	u64 time_nsec = 0;
	struct vb2_v4l2_buffer *vbuf = NULL;

	if (!response) {
@@ -2057,11 +2057,11 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
				vb->planes[0].length);
		if (!(fill_buf_done->flags1 &
			HAL_BUFFERFLAG_TIMESTAMPINVALID)) {
			time_usec = fill_buf_done->timestamp_hi;
			time_usec = (time_usec << 32) |
			time_nsec = fill_buf_done->timestamp_hi;
			time_nsec = (time_nsec << 32) |
				fill_buf_done->timestamp_lo;
		} else {
			time_usec = 0;
			time_nsec = 0;
			dprintk(VIDC_DBG,
					"Set zero timestamp for buffer %pa, filled: %d, (hi:%u, lo:%u)\n",
					&fill_buf_done->packet_buffer1,
@@ -2070,8 +2070,8 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
					fill_buf_done->timestamp_lo);
		}
		vbuf->flags = 0;
//		vb->timestamp = (u64)
//			ns_to_timeval(time_usec * NSEC_PER_USEC);
		vb->timestamp = time_nsec;

		extra_idx =
			EXTRADATA_IDX(inst->fmts[CAPTURE_PORT].num_planes);
		if (extra_idx && extra_idx < VIDEO_MAX_PLANES) {
@@ -2135,7 +2135,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
		dprintk(VIDC_DBG,
		"Got fbd from hal: device_addr: %pa, alloc: %d, filled: %d, offset: %d, ts: %lld, flags: %#x, crop: %d %d %d %d, pic_type: %#x, mark_data: %#x\n",
		&fill_buf_done->packet_buffer1, fill_buf_done->alloc_len1,
		fill_buf_done->filled_len1, fill_buf_done->offset1, time_usec,
		fill_buf_done->filled_len1, fill_buf_done->offset1, time_nsec,
		fill_buf_done->flags1, fill_buf_done->start_x_coord,
		fill_buf_done->start_y_coord, fill_buf_done->frame_width,
		fill_buf_done->frame_height, fill_buf_done->picture_type,
@@ -3583,18 +3583,15 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
static void populate_frame_data(struct vidc_frame_data *data,
		const struct vb2_buffer *vb, struct msm_vidc_inst *inst)
{
	int64_t time_usec = 0;
	int extra_idx;
	enum v4l2_buf_type type = vb->type;
	enum vidc_ports port = type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
		OUTPUT_PORT : CAPTURE_PORT;
	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);

	do_div(time_usec, NSEC_PER_USEC);

	data->alloc_len = vb->planes[0].length;
	data->device_addr = vb->planes[0].m.userptr;
	data->timestamp = time_usec;
	data->timestamp = vb->timestamp;
	data->flags = 0;
	data->clnt_data = data->device_addr;