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

Commit d6ddd72a authored by Ahmed Abdul-Salam's avatar Ahmed Abdul-Salam
Browse files

msm: VPU: Allow polling for buffers before streaming



Allow VPU clients to poll for buffer events before start of streaming
without returning POLLERR. This is desired because driver might send
asynchronous events like hardware errors at any time, regardless of
streaming state.

Change-Id: Ie17b2e125e90468de122604692388cb93ba84a88
Signed-off-by: default avatarAhmed Abdul-Salam <aabdulsa@codeaurora.org>
parent baf64b5d
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -38,8 +38,7 @@ static int v4l2_vpu_close(struct file *file)
	return vpu_close_client(client);
}

static unsigned int __poll_vb2_queue(struct vpu_client *client, int port,
		struct file *file, poll_table *wait)
static unsigned int __poll_vb2_queue(struct vpu_client *client, int port)
{
	struct vpu_dev_session *session = client->session;
	struct vb2_queue *q = &session->vbqueue[port];
@@ -47,10 +46,6 @@ static unsigned int __poll_vb2_queue(struct vpu_client *client, int port,
	unsigned int res = 0;
	unsigned long flags;

	/* error if client not performing buffer I/O or not streaming */
	if (client != session->io_client[port] || !vb2_is_streaming(q))
		return POLLERR;

	spin_lock_irqsave(&q->done_lock, flags);
	if (!list_empty(&q->done_list))
		vb = list_first_entry(&q->done_list, struct vb2_buffer,
@@ -94,13 +89,13 @@ static unsigned int v4l2_vpu_poll(struct file *file,
	/* poll input queue */
	if (req_events & (POLLOUT | POLLWRNORM)) {
		poll_wait(file, &session->vbqueue[INPUT_PORT].done_wq, wait);
		mask |= __poll_vb2_queue(client, INPUT_PORT, file, wait);
		mask |= __poll_vb2_queue(client, INPUT_PORT);
	}

	/* poll output queue */
	if (req_events & (POLLIN | POLLRDNORM)) {
		poll_wait(file, &session->vbqueue[OUTPUT_PORT].done_wq, wait);
		mask |= __poll_vb2_queue(client, OUTPUT_PORT, file, wait);
		mask |= __poll_vb2_queue(client, OUTPUT_PORT);
	}

	return mask;
@@ -181,6 +176,7 @@ static long v4l2_vpu_private_ioctls(struct file *file, void *fh,
		break;

	default:
		pr_warn("Received unknown ioctl (%d)\n", cmd);
		return -ENOTTY;
		break;
	}