media/doc: Allow sizeimage to be set by v4l clients
Subsystems (3)
RFC PATCH 1/1 media/doc: Allow sizeimage to be set by v4l clients
This changes v4l2_pix_format and v4l2_plane_pix_format sizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.
--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4 -1
@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacent
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +2 -1
@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32 - ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.
Signature · 1 line
2.17.1
Quoted 32 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32 - ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.
Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Only for MJPEG is this statement true since each buffer will contain a single compressed JPEG image.
Regards,
Hans
Hi Hans,
Quoted 39 lines · Hans Verkuil
Quoted 38 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32
Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 3 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0- ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Do you want me to change something in the current documentation, i.e. the quoted above?
Quoted 7 lines
Only for MJPEG is this statement true since each buffer will contain a single compressed JPEG image.
Regards,
Hans
Signature · 2 lines
regards, Stan
Quoted 52 lines · Stanimir Varbanov
Hi Hans,
Quoted 39 lines · Hans Verkuil
Quoted 38 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 3 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0- ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Quoted 2 lines
Do you want me to change something in the current documentation, i.e. the quoted above?
Hmm, it looks like this discussion stalled (i.e. I forgot to reply).
How about this:
"When the image consists of variable length compressed data this is the number of bytes required by the encoder to support the worst-case compression scenario. Clients are allowed to set this field. However, drivers may ignore the value or modify it."
Regards,
Hans
Quoted 9 lines
Quoted 8 lines
Only for MJPEG is this statement true since each buffer will contain a single compressed JPEG image.
Regards,
Hans
Hi Hans,
Quoted 56 lines · Hans Verkuil
Quoted 52 lines · Stanimir Varbanov
Hi Hans,
Quoted 39 lines · Hans Verkuil
Quoted 38 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 3 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0- ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Quoted 2 lines
Do you want me to change something in the current documentation, i.e. the quoted above?
Quoted 6 lines
Hmm, it looks like this discussion stalled (i.e. I forgot to reply).
How about this:
"When the image consists of variable length compressed data this is the number of bytes required by the encoder to support the worst-case
I don't think 'encoder' is the right word here:
s/encoder/encoder or decoder
Quoted 2 lines
compression scenario. Clients are allowed to set this field. However, drivers may ignore the value or modify it."
Can we rephrase to:
"Clients are allowed to set sizeimage field, but however drivers my ignore the value or modify it."
Signature · 2 lines
regards, Stan
Quoted 61 lines · Stanimir Varbanov
Hi Hans,
Quoted 58 lines · Hans Verkuil
Quoted 52 lines · Stanimir Varbanov
Hi Hans,
Quoted 39 lines · Hans Verkuil
Quoted 38 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 3 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0- ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Quoted 2 lines
Do you want me to change something in the current documentation, i.e. the quoted above?
Hmm, it looks like this discussion stalled (i.e. I forgot to reply).
Quoted 8 lines
Quoted 4 lines
How about this:
"When the image consists of variable length compressed data this is the number of bytes required by the encoder to support the worst-case
I don't think 'encoder' is the right word here:
s/encoder/encoder or decoder
or perhaps just 'codec'? Either is fine by me.
Quoted 9 lines
Quoted 3 lines
compression scenario. Clients are allowed to set this field. However, drivers may ignore the value or modify it."
Can we rephrase to:
"Clients are allowed to set sizeimage field, but however drivers my ignore the value or modify it."
How about this:
"Clients are allowed to set the sizeimage field, but drivers may
modify it."
'ignore the value' isn't right, since that suggests that the sizeimage value that is returned may not be in actual use. Since sizeimage can now be set by userspace, this means that a sanity check is needed in drivers as well (i.e. what if userspace sets sizeimage to ~0?)
This should be tested in v4l2-compliance as well.
Regards,
Hans
Quoted 64 lines · Hans Verkuil
Quoted 63 lines · Stanimir Varbanov
Hi Hans,
Quoted 60 lines · Hans Verkuil
Quoted 52 lines · Stanimir Varbanov
Hi Hans,
Quoted 39 lines · Hans Verkuil
Quoted 38 lines · Stanimir Varbanov
This changes
v4l2_pix_formatandv4l2_plane_pix_formatsizeimage field description to allow v4l clients to set bigger image size in case of variable length compressed data.Signed-off-by Stanimir Varbanov <[email protected]>--- Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 5 ++++- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +4
-1@@ -30,7 +30,10 @@ describing all planes of that format. * - __u32 - ``sizeimage`` - - Maximum size in bytes required for image data in this plane. + - Maximum size in bytes required for image data in this plane, + set by the driver. When the image consists of variable length + compressed data this is the maximum number of bytes required + to hold an image, and it is allowed to be set by the client. * - __u32 - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacentDocumentation/media/uapi/v4l/pixfmt-v4l2.rst +2
-1@@ -89,7 +89,8 @@ Single-planar format structure - Size in bytes of the buffer to hold a complete image, set by the driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. + maximum number of bytes required to hold an image, and it is + allowed to be set by the client. * - __u32Quoted 9 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst Single-planar format structure · line 96
Quoted 3 lines
Documentation/media/uapi/v4l/pixfmt-v4l2.rst +0
-0- ``colorspace`` - Image colorspace, from enum :c:type:`v4l2_colorspace`.Hmm. "maximum number of bytes required to hold an image": that's not actually true for bitstream formats like MPEG. It's just the size of the buffer used to store the bitstream, i.e. one buffer may actually contain multiple compressed images, or a compressed image is split over multiple buffers.
Quoted 2 lines
Do you want me to change something in the current documentation, i.e. the quoted above?
Hmm, it looks like this discussion stalled (i.e. I forgot to reply).
How about this:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
"When the image consists of variable length compressed data this is the number of bytes required by the encoder to support the worst-case
I don't think 'encoder' is the right word here:
s/encoder/encoder or decoder
or perhaps just 'codec'? Either is fine by me.
OK, then just 'codec'.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
compression scenario. Clients are allowed to set this field. However, drivers may ignore the value or modify it."
Can we rephrase to:
Quoted 8 lines
Quoted 3 lines
"Clients are allowed to set sizeimage field, but however drivers my ignore the value or modify it."
How about this:
"Clients are allowed to set the sizeimage field, but drivers may
modify it."
I'm fine with that.
I'll send with those changes and as regular patch. Thanks!
Quoted 12 lines
'ignore the value' isn't right, since that suggests that the sizeimage value that is returned may not be in actual use. Since sizeimage can now be set by userspace, this means that a sanity check is needed in drivers as well (i.e. what if userspace sets sizeimage to ~0?)
This should be tested in v4l2-compliance as well.
Regards,
Hans
Signature · 2 lines
regards, Stan