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

Commit f128c5be authored by Paras Nagda's avatar Paras Nagda
Browse files

msm: vidc: copy the crop info during dequeue buf



User-space expects the crop data to be notified from the
driver as it was done in kernel 3.16 as part-of
reserved field of v4l2planes.
On 4.9 kernel, as the v4l2planes are removed this
change is required for indicating the crop info
to user client.
 
Change-Id: Ib51ba533977968f682fc428ab0ca0d9e20cd6ed6
Signed-off-by: default avatarParas Nagda <pnagda@codeaurora.org>
parent 463d8c28
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -948,6 +948,15 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
		b->m.planes[i].m.userptr = buffer_info->uvaddr[i];
		b->m.planes[i].reserved[0] = buffer_info->fd[i];
		b->m.planes[i].reserved[1] = buffer_info->buff_off[i];

		b->m.planes[i].reserved[2] = buffer_info->crop_data.nLeft;
		b->m.planes[i].reserved[3] = buffer_info->crop_data.nTop;
		b->m.planes[i].reserved[4] = buffer_info->crop_data.nWidth;
		b->m.planes[i].reserved[5] = buffer_info->crop_data.nHeight;
		b->m.planes[i].reserved[6] =
				buffer_info->crop_data.width_height[0];
		b->m.planes[i].reserved[7] =
				buffer_info->crop_data.width_height[1];
		if (!(inst->flags & VIDC_SECURE) && !b->m.planes[i].m.userptr) {
			dprintk(VIDC_ERR,
			"%s: Failed to find user virtual address, %#lx, %d, %d\n",
+21 −0
Original line number Diff line number Diff line
@@ -2005,6 +2005,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
	int64_t time_usec = 0;
	static int first_enc_frame = 1;
	struct vb2_v4l2_buffer *vbuf = NULL;
	struct buffer_info *buffer_info = NULL;

	if (!response) {
		dprintk(VIDC_ERR, "Invalid response from vidc_hal\n");
@@ -2046,6 +2047,26 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
				"fbd:Overflow bytesused = %d; length = %d\n",
				vb->planes[0].bytesused,
				vb->planes[0].length);

		buffer_info = device_to_uvaddr(&inst->registeredbufs,
			fill_buf_done->packet_buffer1);

		if (!buffer_info) {
			dprintk(VIDC_ERR,
				"%s buffer not found in registered list\n",
				__func__);
			return;
		}

		buffer_info->crop_data.nLeft = fill_buf_done->start_x_coord;
		buffer_info->crop_data.nTop = fill_buf_done->start_y_coord;
		buffer_info->crop_data.nWidth = fill_buf_done->frame_width;
		buffer_info->crop_data.nHeight = fill_buf_done->frame_height;
		buffer_info->crop_data.width_height[0] =
						inst->prop.width[CAPTURE_PORT];
		buffer_info->crop_data.width_height[1] =
						inst->prop.height[CAPTURE_PORT];

		if (!(fill_buf_done->flags1 &
			HAL_BUFFERFLAG_TIMESTAMPINVALID)) {
			time_usec = fill_buf_done->timestamp_hi;
+9 −0
Original line number Diff line number Diff line
@@ -328,6 +328,14 @@ int msm_vidc_check_session_supported(struct msm_vidc_inst *inst);
int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst);
void msm_vidc_queue_v4l2_event(struct msm_vidc_inst *inst, int event_type);

struct crop_info {
	u32 nLeft;
	u32 nTop;
	u32 nWidth;
	u32 nHeight;
	u32 width_height[MAX_PORT_NUM];
};

struct buffer_info {
	struct list_head list;
	int type;
@@ -347,6 +355,7 @@ struct buffer_info {
	bool mapped[VIDEO_MAX_PLANES];
	int same_fd_ref[VIDEO_MAX_PLANES];
	struct timeval timestamp;
	struct crop_info crop_data;
};

struct buffer_info *device_to_uvaddr(struct msm_vidc_list *buf_list,