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

Commit 7bb4037d authored by Abdulla Anam's avatar Abdulla Anam Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Add port information to flush_done event



When video driver queues the flush event, it doesn't convey the
port which is flushed. Due to this userspace content has to
handle the event according to the flush status variables that it
maintains. This handling can go wrong when there are concurrent
flush commands from client. Address this by adding port detail
to flush event.

Change-Id: Ie9b7e35ad396ba8eed20dcca1f655b3e23f6626c
Signed-off-by: default avatarAbdulla Anam <abdullahanam@codeaurora.org>
parent 315f8d16
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1369,6 +1369,22 @@ static int hfi_process_session_flush_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = sizeof(u32);

	switch (pkt->flush_type) {
	case HFI_FLUSH_OUTPUT:
		cmd_done.data.flush_type = HAL_FLUSH_OUTPUT;
		break;
	case HFI_FLUSH_INPUT:
		cmd_done.data.flush_type = HAL_FLUSH_INPUT;
		break;
	case HFI_FLUSH_ALL:
		cmd_done.data.flush_type = HAL_FLUSH_ALL;
		break;
	default:
		dprintk(VIDC_ERR,
				"%s: invalid flush type!", __func__);
		return -EINVAL;
	}

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_FLUSH_DONE,
		.response.cmd = cmd_done,
+28 −2
Original line number Diff line number Diff line
@@ -1506,6 +1506,9 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
{
	struct msm_vidc_cb_cmd_done *response = data;
	struct msm_vidc_inst *inst;
	struct v4l2_event flush_event = {0};
	u32 *ptr = NULL;
	enum hal_flush flush_type;
	int rc;

	if (!response) {
@@ -1533,8 +1536,31 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
		}
	}
	atomic_dec(&inst->in_flush);
	dprintk(VIDC_DBG, "Notify flush complete to client\n");
	msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_FLUSH_DONE);
	flush_event.type = V4L2_EVENT_MSM_VIDC_FLUSH_DONE;
	ptr = (u32 *)flush_event.u.data;

	flush_type = response->data.flush_type;
	switch (flush_type) {
	case HAL_FLUSH_INPUT:
		ptr[0] = V4L2_QCOM_CMD_FLUSH_OUTPUT;
		break;
	case HAL_FLUSH_OUTPUT:
		ptr[0] = V4L2_QCOM_CMD_FLUSH_CAPTURE;
		break;
	case HAL_FLUSH_ALL:
		ptr[0] |= V4L2_QCOM_CMD_FLUSH_CAPTURE;
		ptr[0] |= V4L2_QCOM_CMD_FLUSH_OUTPUT;
		break;
	default:
		dprintk(VIDC_ERR, "Invalid flush type received!");
		goto exit;
	}

	dprintk(VIDC_DBG,
		"Notify flush complete, flush_type: %x\n", flush_type);
	v4l2_event_queue_fh(&inst->event_handler, &flush_event);

exit:
	put_inst(inst);
}

+1 −0
Original line number Diff line number Diff line
@@ -1343,6 +1343,7 @@ struct msm_vidc_cb_cmd_done {
		struct vidc_hal_session_init_done session_init_done;
		struct hal_buffer_info buffer_info;
		union hal_get_property property;
		enum hal_flush flush_type;
	} data;
};