[v3,09/14] media: platform: pxa_camera: add buffer sequencing
Commit Message
Add sequence numbers to completed buffers.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/media/platform/soc_camera/pxa_camera.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
Robert Jarzmik <robert.jarzmik@free.fr> writes:
> Add sequence numbers to completed buffers.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/media/platform/soc_camera/pxa_camera.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c
> index d66443ac1f4d..8a65f126d091 100644
> --- a/drivers/media/platform/soc_camera/pxa_camera.c
> +++ b/drivers/media/platform/soc_camera/pxa_camera.c
> @@ -401,6 +402,7 @@ static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev)
> unsigned long cicr0;
>
> dev_dbg(pcdev_to_dev(pcdev), "%s\n", __func__);
> + pcdev->buf_sequence = 0;
I'm not so sure this is the right place to reset the buffer sequence.
I've seen no documentation on the rules applicable to this sequence number:
- should it be reset if a "start streaming" operation occurs ?
- should it be reset if a streams stops by lack of video buffers queued ?
- should it be reset in queue_setup() like in other drivers ?
Or should it _never_ be reset and only be a monotonic raising number ?
Cheers.
--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On 08/15/2016 03:26 PM, Robert Jarzmik wrote:
> Robert Jarzmik <robert.jarzmik@free.fr> writes:
>
>> Add sequence numbers to completed buffers.
>>
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>> ---
>> drivers/media/platform/soc_camera/pxa_camera.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c
>> index d66443ac1f4d..8a65f126d091 100644
>> --- a/drivers/media/platform/soc_camera/pxa_camera.c
>> +++ b/drivers/media/platform/soc_camera/pxa_camera.c
>> @@ -401,6 +402,7 @@ static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev)
>> unsigned long cicr0;
>>
>> dev_dbg(pcdev_to_dev(pcdev), "%s\n", __func__);
>> + pcdev->buf_sequence = 0;
>
> I'm not so sure this is the right place to reset the buffer sequence.
>
> I've seen no documentation on the rules applicable to this sequence number:
> - should it be reset if a "start streaming" operation occurs ?
start_streaming is the recommended place for setting the counter to 0. It's what
v4l2-compliance expects.
It is not documented since 1) not every driver does this and 2) there may
be cases where this behavior is not desired.
That said, I have yet to see a driver where zeroing this in start_streaming
is not appropriate.
Regards,
Hans
> - should it be reset if a streams stops by lack of video buffers queued ?
> - should it be reset in queue_setup() like in other drivers ?
>
> Or should it _never_ be reset and only be a monotonic raising number ?
>
> Cheers.
>
> --
> Robert
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hans Verkuil <hverkuil@xs4all.nl> writes:
> On 08/15/2016 03:26 PM, Robert Jarzmik wrote:
>> Robert Jarzmik <robert.jarzmik@free.fr> writes:
>> I've seen no documentation on the rules applicable to this sequence number:
>> - should it be reset if a "start streaming" operation occurs ?
>
> start_streaming is the recommended place for setting the counter to 0. It's what
> v4l2-compliance expects.
>
> It is not documented since 1) not every driver does this and 2) there may
> be cases where this behavior is not desired.
>
> That said, I have yet to see a driver where zeroing this in start_streaming
> is not appropriate.
Thanks for the information Hans, I'll modify this patch accordingly.
Cheers.
--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -223,6 +223,7 @@ struct pxa_camera_dev {
struct list_head capture;
spinlock_t lock;
+ unsigned int buf_sequence;
struct pxa_buffer *active;
struct tasklet_struct task_eof;
@@ -401,6 +402,7 @@ static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev)
unsigned long cicr0;
dev_dbg(pcdev_to_dev(pcdev), "%s\n", __func__);
+ pcdev->buf_sequence = 0;
__raw_writel(__raw_readl(pcdev->base + CISR), pcdev->base + CISR);
/* Enable End-Of-Frame Interrupt */
cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB;
@@ -425,10 +427,13 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev,
struct pxa_buffer *buf)
{
struct vb2_buffer *vb = &buf->vbuf.vb2_buf;
+ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
/* _init is used to debug races, see comment in pxa_camera_reqbufs() */
list_del_init(&buf->queue);
vb->timestamp = ktime_get_ns();
+ vbuf->sequence = pcdev->buf_sequence++;
+ vbuf->field = V4L2_FIELD_NONE;
vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
dev_dbg(pcdev_to_dev(pcdev), "%s dequeud buffer (buf=0x%p)\n",
__func__, buf);