Re: [PATCH v4 1/4] [media] videodev2: Add V4L2_BUF_FLAG_LAST

2015-04-13 Thread Philipp Zabel
Am Montag, den 13.04.2015, 14:42 +0900 schrieb Pawel Osciak:
 Hi,
 Thanks for working on this!
 
 On Wed, Mar 25, 2015 at 2:46 AM, Philipp Zabel p.za...@pengutronix.de wrote:
  From: Peter Seiderer ps.rep...@gmx.net
 
  This v4l2_buffer flag can be used by drivers to mark a capture buffer
  as the last generated buffer, for example after a V4L2_DEC_CMD_STOP
  command was issued.
  The DocBook is updated to mention mem2mem codecs and the mem2mem draining 
  flow
  signals in the VIDIOC_DECODER_CMD V4L2_DEC_CMD_STOP and VIDIOC_ENCODER_CMD
  V4L2_ENC_CMD_STOP documentation.
 
  Signed-off-by: Peter Seiderer ps.rep...@gmx.net
  Signed-off-by: Philipp Zabel p.za...@pengutronix.de
  ---
  Changes since v3:
   - Added DocBook update mentioning V4L2_BUF_FLAG_LAST in the encoder/decoder
 stop command documentation.
  ---
   Documentation/DocBook/media/v4l/io.xml | 10 ++
   Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml |  6 +-
   Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml |  5 -
   include/trace/events/v4l2.h|  3 ++-
   include/uapi/linux/videodev2.h |  2 ++
   5 files changed, 23 insertions(+), 3 deletions(-)
 
  diff --git a/Documentation/DocBook/media/v4l/io.xml 
  b/Documentation/DocBook/media/v4l/io.xml
  index 1c17f80..f3b8bc0 100644
  --- a/Documentation/DocBook/media/v4l/io.xml
  +++ b/Documentation/DocBook/media/v4l/io.xml
  @@ -1129,6 +1129,16 @@ in this buffer has not been created by the CPU but 
  by some DMA-capable unit,
   in which case caches have not been used./entry
/row
row
  +   entryconstantV4L2_BUF_FLAG_LAST/constant/entry
  +   entry0x0010/entry
  +   entryLast buffer produced by the hardware. mem2mem codec 
  drivers
  +set this flag on the capture queue for the last buffer when the
  +link linkend=vidioc-querybufVIDIOC_QUERYBUF/link or
  +link linkend=vidioc-qbufVIDIOC_DQBUF/link ioctl is called. After the
  +queue is drained, the link linkend=vidioc-qbufVIDIOC_DQBUF/link 
  ioctl will
 
 Perhaps just s/After the queue is drained, the/Any subsequent/ ? This
 would make it more clear I feel.
 DQBUF of LAST is the end of draining.

Concise, I like it.

  +not block anymore, but return an EPIPE;./entry
  + /row
  + row
  entryconstantV4L2_BUF_FLAG_TIMESTAMP_MASK/constant/entry
  entry0xe000/entry
  entryMask for timestamp types below. To test the
  diff --git a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml 
  b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
  index 9215627..cbb7135 100644
  --- a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
  +++ b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
  @@ -197,7 +197,11 @@ be muted when playing back at a non-standard speed.
   this command does nothing. This command has two flags:
   if constantV4L2_DEC_CMD_STOP_TO_BLACK/constant is set, then the 
  decoder will
   set the picture to black after it stopped decoding. Otherwise the last 
  image will
  -repeat. If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then 
  the decoder
  +repeat. mem2mem decoders will stop producing new frames altogether. They 
  will send
  +a constantV4L2_EVENT_EOS/constant event after the last frame was 
  decoded and
 
 s/was decoded/has been decoded and all frames are ready to be dequeued/

Yes.

  +will set the constantV4L2_BUF_FLAG_LAST/constant buffer flag when 
  there will
  +be no new buffers produced to dequeue.
 
 To make the timing description more explicit, s/when there will be no
 new buffers produced to dequeue./on the final buffer being dequeued/
 perhaps?
 EOS indicates no more buffers will be produced and all are ready to
 be dequeued, while LAST indicates final buffer being dequeued.

Yes.

  +If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then the 
  decoder
   stops immediately (ignoring the structfieldpts/structfield value), 
  otherwise it
   will keep decoding until timestamp = pts or until the last of the pending 
  data from
   its internal buffers was decoded.
  diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml 
  b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
  index 0619ca5..e9cf601 100644
  --- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
  +++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
  @@ -129,7 +129,10 @@ this command./entry
   encoding will continue until the end of the current wordaswordGroup
   Of Pictures/wordasword, otherwise encoding will stop immediately.
   When the encoder is already stopped, this command does
  -nothing./entry
  +nothing. mem2mem encoders will send a constantV4L2_EVENT_EOS/constant 
  event
  +after the last frame was encoded and will set the
  +constantV4L2_BUF_FLAG_LAST/constant buffer flag on the capture queue 
  when
  +there will be no new buffers produced to dequeue/entry
 
 I'd propose 

Re: [PATCH v4 1/4] [media] videodev2: Add V4L2_BUF_FLAG_LAST

2015-04-12 Thread Pawel Osciak
Hi,
Thanks for working on this!

On Wed, Mar 25, 2015 at 2:46 AM, Philipp Zabel p.za...@pengutronix.de wrote:
 From: Peter Seiderer ps.rep...@gmx.net

 This v4l2_buffer flag can be used by drivers to mark a capture buffer
 as the last generated buffer, for example after a V4L2_DEC_CMD_STOP
 command was issued.
 The DocBook is updated to mention mem2mem codecs and the mem2mem draining flow
 signals in the VIDIOC_DECODER_CMD V4L2_DEC_CMD_STOP and VIDIOC_ENCODER_CMD
 V4L2_ENC_CMD_STOP documentation.

 Signed-off-by: Peter Seiderer ps.rep...@gmx.net
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
 Changes since v3:
  - Added DocBook update mentioning V4L2_BUF_FLAG_LAST in the encoder/decoder
stop command documentation.
 ---
  Documentation/DocBook/media/v4l/io.xml | 10 ++
  Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml |  6 +-
  Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml |  5 -
  include/trace/events/v4l2.h|  3 ++-
  include/uapi/linux/videodev2.h |  2 ++
  5 files changed, 23 insertions(+), 3 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/io.xml 
 b/Documentation/DocBook/media/v4l/io.xml
 index 1c17f80..f3b8bc0 100644
 --- a/Documentation/DocBook/media/v4l/io.xml
 +++ b/Documentation/DocBook/media/v4l/io.xml
 @@ -1129,6 +1129,16 @@ in this buffer has not been created by the CPU but by 
 some DMA-capable unit,
  in which case caches have not been used./entry
   /row
   row
 +   entryconstantV4L2_BUF_FLAG_LAST/constant/entry
 +   entry0x0010/entry
 +   entryLast buffer produced by the hardware. mem2mem codec drivers
 +set this flag on the capture queue for the last buffer when the
 +link linkend=vidioc-querybufVIDIOC_QUERYBUF/link or
 +link linkend=vidioc-qbufVIDIOC_DQBUF/link ioctl is called. After the
 +queue is drained, the link linkend=vidioc-qbufVIDIOC_DQBUF/link ioctl 
 will

Perhaps just s/After the queue is drained, the/Any subsequent/ ? This
would make it more clear I feel.
DQBUF of LAST is the end of draining.

 +not block anymore, but return an EPIPE;./entry
 + /row
 + row
 entryconstantV4L2_BUF_FLAG_TIMESTAMP_MASK/constant/entry
 entry0xe000/entry
 entryMask for timestamp types below. To test the
 diff --git a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml 
 b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
 index 9215627..cbb7135 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
 @@ -197,7 +197,11 @@ be muted when playing back at a non-standard speed.
  this command does nothing. This command has two flags:
  if constantV4L2_DEC_CMD_STOP_TO_BLACK/constant is set, then the decoder 
 will
  set the picture to black after it stopped decoding. Otherwise the last image 
 will
 -repeat. If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then 
 the decoder
 +repeat. mem2mem decoders will stop producing new frames altogether. They 
 will send
 +a constantV4L2_EVENT_EOS/constant event after the last frame was decoded 
 and

s/was decoded/has been decoded and all frames are ready to be dequeued/

 +will set the constantV4L2_BUF_FLAG_LAST/constant buffer flag when there 
 will
 +be no new buffers produced to dequeue.

To make the timing description more explicit, s/when there will be no
new buffers produced to dequeue./on the final buffer being dequeued/
perhaps?
EOS indicates no more buffers will be produced and all are ready to
be dequeued, while LAST indicates final buffer being dequeued.

 +If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then the 
 decoder
  stops immediately (ignoring the structfieldpts/structfield value), 
 otherwise it
  will keep decoding until timestamp = pts or until the last of the pending 
 data from
  its internal buffers was decoded.
 diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml 
 b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
 index 0619ca5..e9cf601 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
 @@ -129,7 +129,10 @@ this command./entry
  encoding will continue until the end of the current wordaswordGroup
  Of Pictures/wordasword, otherwise encoding will stop immediately.
  When the encoder is already stopped, this command does
 -nothing./entry
 +nothing. mem2mem encoders will send a constantV4L2_EVENT_EOS/constant 
 event
 +after the last frame was encoded and will set the
 +constantV4L2_BUF_FLAG_LAST/constant buffer flag on the capture queue when
 +there will be no new buffers produced to dequeue/entry

I'd propose the same here.

-- 
Thanks,
Pawel
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH v4 1/4] [media] videodev2: Add V4L2_BUF_FLAG_LAST

2015-03-24 Thread Philipp Zabel
From: Peter Seiderer ps.rep...@gmx.net

This v4l2_buffer flag can be used by drivers to mark a capture buffer
as the last generated buffer, for example after a V4L2_DEC_CMD_STOP
command was issued.
The DocBook is updated to mention mem2mem codecs and the mem2mem draining flow
signals in the VIDIOC_DECODER_CMD V4L2_DEC_CMD_STOP and VIDIOC_ENCODER_CMD
V4L2_ENC_CMD_STOP documentation.

Signed-off-by: Peter Seiderer ps.rep...@gmx.net
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v3:
 - Added DocBook update mentioning V4L2_BUF_FLAG_LAST in the encoder/decoder
   stop command documentation.
---
 Documentation/DocBook/media/v4l/io.xml | 10 ++
 Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml |  6 +-
 Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml |  5 -
 include/trace/events/v4l2.h|  3 ++-
 include/uapi/linux/videodev2.h |  2 ++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 1c17f80..f3b8bc0 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -1129,6 +1129,16 @@ in this buffer has not been created by the CPU but by 
some DMA-capable unit,
 in which case caches have not been used./entry
  /row
  row
+   entryconstantV4L2_BUF_FLAG_LAST/constant/entry
+   entry0x0010/entry
+   entryLast buffer produced by the hardware. mem2mem codec drivers
+set this flag on the capture queue for the last buffer when the
+link linkend=vidioc-querybufVIDIOC_QUERYBUF/link or
+link linkend=vidioc-qbufVIDIOC_DQBUF/link ioctl is called. After the
+queue is drained, the link linkend=vidioc-qbufVIDIOC_DQBUF/link ioctl 
will
+not block anymore, but return an EPIPE;./entry
+ /row
+ row
entryconstantV4L2_BUF_FLAG_TIMESTAMP_MASK/constant/entry
entry0xe000/entry
entryMask for timestamp types below. To test the
diff --git a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml 
b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
index 9215627..cbb7135 100644
--- a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
@@ -197,7 +197,11 @@ be muted when playing back at a non-standard speed.
 this command does nothing. This command has two flags:
 if constantV4L2_DEC_CMD_STOP_TO_BLACK/constant is set, then the decoder 
will
 set the picture to black after it stopped decoding. Otherwise the last image 
will
-repeat. If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then the 
decoder
+repeat. mem2mem decoders will stop producing new frames altogether. They will 
send
+a constantV4L2_EVENT_EOS/constant event after the last frame was decoded 
and
+will set the constantV4L2_BUF_FLAG_LAST/constant buffer flag when there 
will
+be no new buffers produced to dequeue.
+If constantV4L2_DEC_CMD_STOP_IMMEDIATELY/constant is set, then the decoder
 stops immediately (ignoring the structfieldpts/structfield value), 
otherwise it
 will keep decoding until timestamp = pts or until the last of the pending 
data from
 its internal buffers was decoded.
diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml 
b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
index 0619ca5..e9cf601 100644
--- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
@@ -129,7 +129,10 @@ this command./entry
 encoding will continue until the end of the current wordaswordGroup
 Of Pictures/wordasword, otherwise encoding will stop immediately.
 When the encoder is already stopped, this command does
-nothing./entry
+nothing. mem2mem encoders will send a constantV4L2_EVENT_EOS/constant event
+after the last frame was encoded and will set the
+constantV4L2_BUF_FLAG_LAST/constant buffer flag on the capture queue when
+there will be no new buffers produced to dequeue/entry
  /row
  row
entryconstantV4L2_ENC_CMD_PAUSE/constant/entry
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index b9bb1f2..32c33aa 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -58,7 +58,8 @@
{ V4L2_BUF_FLAG_TIMESTAMP_MASK,  TIMESTAMP_MASK },  \
{ V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,   TIMESTAMP_UNKNOWN },   \
{ V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, TIMESTAMP_MONOTONIC }, \
-   { V4L2_BUF_FLAG_TIMESTAMP_COPY,  TIMESTAMP_COPY })
+   { V4L2_BUF_FLAG_TIMESTAMP_COPY,  TIMESTAMP_COPY },  \
+   { V4L2_BUF_FLAG_LAST,LAST })
 
 #define show_timecode_flags(flags)   \
__print_flags(flags, |, \
diff --git a/include/uapi/linux/videodev2.h