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

Commit e52cd53e authored by Govindaraj Rajagopal's avatar Govindaraj Rajagopal
Browse files

msm: vidc: use macro to get/set fields



[1] Use msm_vidc_plane_reserved_field_types for setting/getting
    plane reserve fields.
[2] Use msm_vidc_cb_event_types enum for setting/getting
    Seq_changed_event types.

Change-Id: Ie6cb908515c9714d26f00fdd25af2dfcd875d725
Signed-off-by: default avatarGovindaraj Rajagopal <grajagop@codeaurora.org>
parent 383a14c1
Loading
Loading
Loading
Loading
+0 −15
Original line number Original line Diff line number Diff line
@@ -111,7 +111,6 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
	struct hfi_pic_struct *pic_struct;
	struct hfi_pic_struct *pic_struct;
	struct hfi_buffer_requirements *buf_req;
	struct hfi_buffer_requirements *buf_req;
	struct hfi_dpb_counts *dpb_counts;
	struct hfi_dpb_counts *dpb_counts;
	struct hfi_index_extradata_input_crop_payload *crop_info;
	u32 rem_size,entropy_mode = 0;
	u32 rem_size,entropy_mode = 0;
	u8 *data_ptr;
	u8 *data_ptr;
	int prop_id;
	int prop_id;
@@ -281,20 +280,6 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
				     hfi_index_extradata_input_crop_payload)))
				     hfi_index_extradata_input_crop_payload)))
					return -E2BIG;
					return -E2BIG;
				data_ptr = data_ptr + sizeof(u32);
				data_ptr = data_ptr + sizeof(u32);
				crop_info = (struct
				hfi_index_extradata_input_crop_payload *)
						data_ptr;
				event_notify.crop_data.left = crop_info->left;
				event_notify.crop_data.top = crop_info->top;
				event_notify.crop_data.width = crop_info->width;
				event_notify.crop_data.height =
					crop_info->height;
				s_vpr_h(sid,
					"CROP info : Left = %d Top = %d\n",
					crop_info->left, crop_info->top);
				s_vpr_h(sid,
					"CROP info : Width = %d Height = %d\n",
					crop_info->width, crop_info->height);
				data_ptr +=
				data_ptr +=
					sizeof(struct
					sizeof(struct
					hfi_index_extradata_input_crop_payload);
					hfi_index_extradata_input_crop_payload);
+12 −8
Original line number Original line Diff line number Diff line
@@ -352,20 +352,22 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
	}
	}


	for (i = 0; i < b->length; i++) {
	for (i = 0; i < b->length; i++) {
		b->m.planes[i].m.fd = b->m.planes[i].reserved[0];
		b->m.planes[i].m.fd =
		b->m.planes[i].data_offset = b->m.planes[i].reserved[1];
				b->m.planes[i].reserved[MSM_VIDC_BUFFER_FD];
		b->m.planes[i].data_offset =
				b->m.planes[i].reserved[MSM_VIDC_DATA_OFFSET];
	}
	}


	/* Compression ratio is valid only for Encoder YUV buffers. */
	/* Compression ratio is valid only for Encoder YUV buffers. */
	if (inst->session_type == MSM_VIDC_ENCODER &&
	if (inst->session_type == MSM_VIDC_ENCODER &&
			b->type == INPUT_MPLANE) {
			b->type == INPUT_MPLANE) {
		cr = b->m.planes[0].reserved[2];
		cr = b->m.planes[0].reserved[MSM_VIDC_COMP_RATIO];
		msm_comm_update_input_cr(inst, b->index, cr);
		msm_comm_update_input_cr(inst, b->index, cr);
	}
	}


	if (b->type == INPUT_MPLANE) {
	if (b->type == INPUT_MPLANE) {
		client_data = msm_comm_store_client_data(inst,
		client_data = msm_comm_store_client_data(inst,
			b->m.planes[0].reserved[3]);
			b->m.planes[0].reserved[MSM_VIDC_INPUT_TAG_1]);
		if (!client_data) {
		if (!client_data) {
			s_vpr_e(inst->sid,
			s_vpr_e(inst->sid,
				"%s: failed to store client data\n", __func__);
				"%s: failed to store client data\n", __func__);
@@ -425,8 +427,10 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
	}
	}


	for (i = 0; i < b->length; i++) {
	for (i = 0; i < b->length; i++) {
		b->m.planes[i].reserved[0] = b->m.planes[i].m.fd;
		b->m.planes[i].reserved[MSM_VIDC_BUFFER_FD] =
		b->m.planes[i].reserved[1] = b->m.planes[i].data_offset;
					b->m.planes[i].m.fd;
		b->m.planes[i].reserved[MSM_VIDC_DATA_OFFSET] =
					b->m.planes[i].data_offset;
	}
	}
	/**
	/**
	 * Flush handling:
	 * Flush handling:
@@ -453,8 +457,8 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
					!(b->flags & V4L2_BUF_FLAG_CODECCONFIG);
					!(b->flags & V4L2_BUF_FLAG_CODECCONFIG);
			msm_comm_fetch_client_data(inst, remove,
			msm_comm_fetch_client_data(inst, remove,
				input_tag, input_tag2,
				input_tag, input_tag2,
				&b->m.planes[0].reserved[3],
				&b->m.planes[0].reserved[MSM_VIDC_INPUT_TAG_1],
				&b->m.planes[0].reserved[4]);
				&b->m.planes[0].reserved[MSM_VIDC_INPUT_TAG_2]);
		}
		}
	}
	}


+16 −40
Original line number Original line Diff line number Diff line
@@ -1719,30 +1719,17 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	 * codecs except HEVC
	 * codecs except HEVC
	 * event data is now as follows:
	 * event data is now as follows:
	 * u32 *ptr = seq_changed_event.u.data;
	 * u32 *ptr = seq_changed_event.u.data;
	 * ptr[0] = height
	 * ptr[MSM_VIDC_HEIGHT] = height
	 * ptr[1] = width
	 * ptr[MSM_VIDC_WIDTH] = width
	 * ptr[2] = bit depth
	 * ptr[MSM_VIDC_BIT_DEPTH] = bit depth
	 * ptr[3] = pic struct (progressive or interlaced)
	 * ptr[MSM_VIDC_PIC_STRUCT] = pic struct (progressive or interlaced)
	 * ptr[4] = colour space
	 * ptr[MSM_VIDC_COLOR_SPACE] = colour space
	 * ptr[5] = crop_data(top)
	 * ptr[MSM_VIDC_FW_MIN_COUNT] = fw min count
	 * ptr[6] = crop_data(left)
	 * ptr[7] = crop_data(height)
	 * ptr[8] = crop_data(width)
	 * ptr[9] = profile
	 * ptr[10] = level
	 */
	 */


	inst->profile = event_notify->profile;
	inst->profile = event_notify->profile;
	inst->level = event_notify->level;
	inst->level = event_notify->level;
	inst->entropy_mode = event_notify->entropy_mode;
	inst->entropy_mode = event_notify->entropy_mode;
	inst->prop.crop_info.left =
		event_notify->crop_data.left;
	inst->prop.crop_info.top =
		event_notify->crop_data.top;
	inst->prop.crop_info.height =
		event_notify->crop_data.height;
	inst->prop.crop_info.width =
		event_notify->crop_data.width;
	/* HW returns progressive_only flag in pic_struct. */
	/* HW returns progressive_only flag in pic_struct. */
	inst->pic_struct =
	inst->pic_struct =
		event_notify->pic_struct ?
		event_notify->pic_struct ?
@@ -1751,34 +1738,23 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	inst->colour_space = event_notify->colour_space;
	inst->colour_space = event_notify->colour_space;


	ptr = (u32 *)seq_changed_event.u.data;
	ptr = (u32 *)seq_changed_event.u.data;
	ptr[0] = event_notify->height;
	ptr[MSM_VIDC_HEIGHT] = event_notify->height;
	ptr[1] = event_notify->width;
	ptr[MSM_VIDC_WIDTH] = event_notify->width;
	ptr[2] = event_notify->bit_depth;
	ptr[MSM_VIDC_BIT_DEPTH] = event_notify->bit_depth;
	ptr[3] = event_notify->pic_struct;
	ptr[MSM_VIDC_PIC_STRUCT] = event_notify->pic_struct;
	ptr[4] = event_notify->colour_space;
	ptr[MSM_VIDC_COLOR_SPACE] = event_notify->colour_space;
	ptr[5] = event_notify->crop_data.top;
	ptr[MSM_VIDC_FW_MIN_COUNT] = event_notify->fw_min_cnt;
	ptr[6] = event_notify->crop_data.left;

	ptr[7] = event_notify->crop_data.height;
	s_vpr_h(inst->sid, "seq: height = %u width = %u\n",
	ptr[8] = event_notify->crop_data.width;
		event_notify->height, event_notify->width);
	ptr[9] = msm_comm_get_v4l2_profile(codec,
		event_notify->profile, inst->sid);
	ptr[10] = msm_comm_get_v4l2_level(codec,
		event_notify->level, inst->sid);
	ptr[11] = event_notify->fw_min_cnt;

	s_vpr_h(inst->sid,
		"seq: height = %u width = %u profile = %u level = %u\n",
		event_notify->height, event_notify->width, ptr[9], ptr[10]);


	s_vpr_h(inst->sid,
	s_vpr_h(inst->sid,
		"seq: bit_depth = %u pic_struct = %u colour_space = %u\n",
		"seq: bit_depth = %u pic_struct = %u colour_space = %u\n",
		event_notify->bit_depth, event_notify->pic_struct,
		event_notify->bit_depth, event_notify->pic_struct,
		event_notify->colour_space);
		event_notify->colour_space);


	s_vpr_h(inst->sid,
	s_vpr_h(inst->sid, "seq: fw_min_count = %u\n",
		"seq: CROP top = %u left = %u Height = %u Width = %u\n",
		event_notify->fw_min_cnt);
		event_notify->crop_data.top, event_notify->crop_data.left,
		event_notify->crop_data.height, event_notify->crop_data.width);


	mutex_lock(&inst->lock);
	mutex_lock(&inst->lock);
	inst->in_reconfig = true;
	inst->in_reconfig = true;
+0 −8
Original line number Original line Diff line number Diff line
@@ -346,15 +346,7 @@ struct msm_video_device {
	struct video_device vdev;
	struct video_device vdev;
};
};


struct session_crop {
	u32 left;
	u32 top;
	u32 width;
	u32 height;
};

struct session_prop {
struct session_prop {
	struct session_crop crop_info;
	u32 fps;
	u32 fps;
	u32 bitrate;
	u32 bitrate;
	bool bframe_changed;
	bool bframe_changed;
+0 −11
Original line number Original line Diff line number Diff line
@@ -597,16 +597,6 @@ struct msm_vidc_cb_cmd_done {
	} data;
	} data;
};
};


struct hal_index_extradata_input_crop_payload {
	u32 size;
	u32 version;
	u32 port_index;
	u32 left;
	u32 top;
	u32 width;
	u32 height;
};

struct msm_vidc_cb_event {
struct msm_vidc_cb_event {
	u32 device_id;
	u32 device_id;
	void *inst_id;
	void *inst_id;
@@ -627,7 +617,6 @@ struct msm_vidc_cb_event {
	u32 max_dec_buffering;
	u32 max_dec_buffering;
	u32 max_reorder_frames;
	u32 max_reorder_frames;
	u32 fw_min_cnt;
	u32 fw_min_cnt;
	struct hal_index_extradata_input_crop_payload crop_data;
};
};


struct msm_vidc_cb_data_done {
struct msm_vidc_cb_data_done {