2021-04-29 10:59:19

by Stanimir Varbanov

[permalink] [raw]
Subject: [PATCH 0/3] Qualcomm custom compressed pixfmt

Hello,

This patchset adds two compressed pixel formats used by
Qualcomm SoCs to optimize interconnect bandwidth.

Regards,
Stan

Stanimir Varbanov (3):
v4l: Add Qualcomm custom compressed pixel formats
venus: Add a handling of QC8C compressed format
venus: Add a handling of QC10C compressed format

.../media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
drivers/media/platform/qcom/venus/helpers.c | 4 ++++
drivers/media/platform/qcom/venus/vdec.c | 18 ++++++++++++++++--
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
include/uapi/linux/videodev2.h | 2 ++
5 files changed, 36 insertions(+), 2 deletions(-)

--
2.25.1


2021-04-29 11:00:02

by Stanimir Varbanov

[permalink] [raw]
Subject: [PATCH 1/3] v4l: Add Qualcomm custom compressed pixel formats

Here we add custom Qualcomm raw compressed pixel formats. They are
used in Qualcomm SoCs to optimaize the interconnect bandwidth.

Signed-off-by: Stanimir Varbanov <[email protected]>
---
.../userspace-api/media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
include/uapi/linux/videodev2.h | 2 ++
3 files changed, 16 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
index 0b879c0da713..30b9cef4cbf0 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
@@ -260,6 +260,18 @@ please make a proposal on the linux-media mailing list.
of tiles, resulting in 32-aligned resolutions for the luminance plane
and 16-aligned resolutions for the chrominance plane (with 2x2
subsampling).
+ * .. _V4L2-PIX-FMT-QC8C:
+
+ - ``V4L2_PIX_FMT_QC8C``
+ - 'QC8C'
+ - Compressed Macro-tile 8Bit YUV420 format used by Qualcomm platforms.
+ The compression is lossless. It contains four planes.
+ * .. _V4L2-PIX-FMT-QC10C:
+
+ - ``V4L2_PIX_FMT_QC10C``
+ - 'QC10C'
+ - Compressed Macro-tile 10Bit YUV420 format used by Qualcomm platforms.
+ The compression is lossless. It contains four planes.

.. raw:: latex

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 6a5d1c6d11d6..33ee12b97aa0 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1455,6 +1455,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break;
case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break;
case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
+ case V4L2_PIX_FMT_QC8C: descr = "QCOM Compressed 8bit Format"; break;
+ case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10bit Format"; break;
default:
if (fmt->description[0])
return;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 311a01cc5775..c57628a16cf4 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -737,6 +737,8 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */
+#define V4L2_PIX_FMT_QC8C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */
+#define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compresed */

/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
--
2.25.1

2021-04-29 11:00:30

by Stanimir Varbanov

[permalink] [raw]
Subject: [PATCH 3/3] venus: Add a handling of QC10C compressed format

This adds QC10C compressed pixel format in the Venus driver, and
make it enumeratable from v4l2 clients.

Note: The QC10C format shouldn't be possible to enumerate by the
client if the decoded bitstream is not 10bits. This is not
implemented in this patch yet.

Signed-off-by: Stanimir Varbanov <[email protected]>
---
drivers/media/platform/qcom/venus/helpers.c | 2 ++
drivers/media/platform/qcom/venus/vdec.c | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 3a0b07d237a5..58bf2e0654ce 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -563,6 +563,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
return HFI_COLOR_FORMAT_NV21;
case V4L2_PIX_FMT_QC8C:
return HFI_COLOR_FORMAT_NV12_UBWC;
+ case V4L2_PIX_FMT_QC10C:
+ return HFI_COLOR_FORMAT_YUV420_TP10_UBWC;
default:
break;
}
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index d4cc51fc019c..7ad8cd66b8bc 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -35,6 +35,10 @@ static const struct venus_format vdec_formats[] = {
.num_planes = 1,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
}, {
+ .pixfmt = V4L2_PIX_FMT_QC10C,
+ .num_planes = 1,
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ },{
.pixfmt = V4L2_PIX_FMT_NV12,
.num_planes = 1,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
@@ -1508,7 +1512,7 @@ static const struct hfi_inst_ops vdec_hfi_ops = {
static void vdec_inst_init(struct venus_inst *inst)
{
inst->hfi_codec = HFI_VIDEO_CODEC_H264;
- inst->fmt_out = &vdec_formats[6];
+ inst->fmt_out = &vdec_formats[8];
inst->fmt_cap = &vdec_formats[0];
inst->width = frame_width_min(inst);
inst->height = ALIGN(frame_height_min(inst), 32);
--
2.25.1

2021-04-29 11:02:31

by Stanimir Varbanov

[permalink] [raw]
Subject: [PATCH 2/3] venus: Add a handling of QC8C compressed format

This adds QC8C compressed pixel format in the Venus driver, and
make it enumeratable from v4l2 clients.

Signed-off-by: Stanimir Varbanov <[email protected]>
---
drivers/media/platform/qcom/venus/helpers.c | 2 ++
drivers/media/platform/qcom/venus/vdec.c | 12 +++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 9b8ff76e3c43..3a0b07d237a5 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -561,6 +561,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
return HFI_COLOR_FORMAT_NV12;
case V4L2_PIX_FMT_NV21:
return HFI_COLOR_FORMAT_NV21;
+ case V4L2_PIX_FMT_QC8C:
+ return HFI_COLOR_FORMAT_NV12_UBWC;
default:
break;
}
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 5e5584fc21e9..d4cc51fc019c 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -31,6 +31,10 @@
*/
static const struct venus_format vdec_formats[] = {
{
+ .pixfmt = V4L2_PIX_FMT_QC8C,
+ .num_planes = 1,
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ }, {
.pixfmt = V4L2_PIX_FMT_NV12,
.num_planes = 1,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
@@ -696,7 +700,13 @@ static int vdec_output_conf(struct venus_inst *inst)
inst->output2_buf_size =
venus_helper_get_framesz_raw(out2_fmt, width, height);

- if (is_ubwc_fmt(out_fmt)) {
+ if (is_ubwc_fmt(out_fmt) && is_ubwc_fmt(out2_fmt)) {
+ inst->output2_buf_size = 0;
+ inst->opb_buftype = HFI_BUFFER_OUTPUT;
+ inst->opb_fmt = out_fmt;
+ inst->dpb_buftype = 0;
+ inst->dpb_fmt = 0;
+ } else if (is_ubwc_fmt(out_fmt)) {
inst->opb_buftype = HFI_BUFFER_OUTPUT2;
inst->opb_fmt = out2_fmt;
inst->dpb_buftype = HFI_BUFFER_OUTPUT;
--
2.25.1

2021-04-29 19:25:11

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH 1/3] v4l: Add Qualcomm custom compressed pixel formats

Le jeudi 29 avril 2021 à 13:58 +0300, Stanimir Varbanov a écrit :
> Here we add custom Qualcomm raw compressed pixel formats. They are
> used in Qualcomm SoCs to optimaize the interconnect bandwidth.

Wasn't reviewing, just skimming the lists, but s/optimaize/optimize/

>
> Signed-off-by: Stanimir Varbanov <[email protected]>
> ---
>  .../userspace-api/media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
>  drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
>  include/uapi/linux/videodev2.h | 2 ++
>  3 files changed, 16 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> index 0b879c0da713..30b9cef4cbf0 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> @@ -260,6 +260,18 @@ please make a proposal on the linux-media mailing list.
>   of tiles, resulting in 32-aligned resolutions for the luminance plane
>   and 16-aligned resolutions for the chrominance plane (with 2x2
>   subsampling).
> + * .. _V4L2-PIX-FMT-QC8C:
> +
> + - ``V4L2_PIX_FMT_QC8C``
> + - 'QC8C'
> + - Compressed Macro-tile 8Bit YUV420 format used by Qualcomm platforms.
> + The compression is lossless. It contains four planes.

Would be nice to document if the bytesperline is meaningful or not. Basically,
what information need to be carried to other drivers ?

> + * .. _V4L2-PIX-FMT-QC10C:
> +
> + - ``V4L2_PIX_FMT_QC10C``
> + - 'QC10C'
> + - Compressed Macro-tile 10Bit YUV420 format used by Qualcomm platforms.
> + The compression is lossless. It contains four planes.
>  
>
>
>
>
>
>
>
>  .. raw:: latex
>  
>
>
>
>
>
>
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 6a5d1c6d11d6..33ee12b97aa0 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1455,6 +1455,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
>   case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break;
>   case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break;
>   case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
> + case V4L2_PIX_FMT_QC8C: descr = "QCOM Compressed 8bit Format"; break;
> + case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10bit Format"; break;
>   default:
>   if (fmt->description[0])
>   return;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 311a01cc5775..c57628a16cf4 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -737,6 +737,8 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
>  #define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
>  #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */
> +#define V4L2_PIX_FMT_QC8C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */
> +#define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compresed */
>  
>
>
>
>
>
>
>
>  /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
>  #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */


2021-05-18 19:22:17

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 1/3] v4l: Add Qualcomm custom compressed pixel formats



On 4/29/21 10:10 PM, Nicolas Dufresne wrote:
> Le jeudi 29 avril 2021 à 13:58 +0300, Stanimir Varbanov a écrit :
>> Here we add custom Qualcomm raw compressed pixel formats. They are
>> used in Qualcomm SoCs to optimaize the interconnect bandwidth.
>
> Wasn't reviewing, just skimming the lists, but s/optimaize/optimize/
>
>>
>> Signed-off-by: Stanimir Varbanov <[email protected]>
>> ---
>>  .../userspace-api/media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
>>  drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
>>  include/uapi/linux/videodev2.h | 2 ++
>>  3 files changed, 16 insertions(+)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> index 0b879c0da713..30b9cef4cbf0 100644
>> --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> @@ -260,6 +260,18 @@ please make a proposal on the linux-media mailing list.
>>   of tiles, resulting in 32-aligned resolutions for the luminance plane
>>   and 16-aligned resolutions for the chrominance plane (with 2x2
>>   subsampling).
>> + * .. _V4L2-PIX-FMT-QC8C:
>> +
>> + - ``V4L2_PIX_FMT_QC8C``
>> + - 'QC8C'
>> + - Compressed Macro-tile 8Bit YUV420 format used by Qualcomm platforms.
>> + The compression is lossless. It contains four planes.
>
> Would be nice to document if the bytesperline is meaningful or not. Basically,
> what information need to be carried to other drivers ?

I don't think that bytesperline has some valuable information, the
important thing is the size of the memory buffer and it should be used
to negotiate between v4l2 and drm for example. The layout of the buffer
can be seen at [1].

[1]
https://android.googlesource.com/kernel/msm/+/android-msm-bullhead-3.10-marshmallow-dr/include/media/msm_media_info.h

--
regards,
Stan

2021-06-02 10:15:04

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 2/3] venus: Add a handling of QC8C compressed format

On 29/04/2021 12:58, Stanimir Varbanov wrote:
> This adds QC8C compressed pixel format in the Venus driver, and
> make it enumeratable from v4l2 clients.

enumeratable -> possible to discover

(or possibly 'enumerable', but I prefer the phrase suggested above)

Regards,

Hans

>
> Signed-off-by: Stanimir Varbanov <[email protected]>
> ---
> drivers/media/platform/qcom/venus/helpers.c | 2 ++
> drivers/media/platform/qcom/venus/vdec.c | 12 +++++++++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 9b8ff76e3c43..3a0b07d237a5 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -561,6 +561,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
> return HFI_COLOR_FORMAT_NV12;
> case V4L2_PIX_FMT_NV21:
> return HFI_COLOR_FORMAT_NV21;
> + case V4L2_PIX_FMT_QC8C:
> + return HFI_COLOR_FORMAT_NV12_UBWC;
> default:
> break;
> }
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 5e5584fc21e9..d4cc51fc019c 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -31,6 +31,10 @@
> */
> static const struct venus_format vdec_formats[] = {
> {
> + .pixfmt = V4L2_PIX_FMT_QC8C,
> + .num_planes = 1,
> + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
> + }, {
> .pixfmt = V4L2_PIX_FMT_NV12,
> .num_planes = 1,
> .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
> @@ -696,7 +700,13 @@ static int vdec_output_conf(struct venus_inst *inst)
> inst->output2_buf_size =
> venus_helper_get_framesz_raw(out2_fmt, width, height);
>
> - if (is_ubwc_fmt(out_fmt)) {
> + if (is_ubwc_fmt(out_fmt) && is_ubwc_fmt(out2_fmt)) {
> + inst->output2_buf_size = 0;
> + inst->opb_buftype = HFI_BUFFER_OUTPUT;
> + inst->opb_fmt = out_fmt;
> + inst->dpb_buftype = 0;
> + inst->dpb_fmt = 0;
> + } else if (is_ubwc_fmt(out_fmt)) {
> inst->opb_buftype = HFI_BUFFER_OUTPUT2;
> inst->opb_fmt = out2_fmt;
> inst->dpb_buftype = HFI_BUFFER_OUTPUT;
>

2021-06-02 11:55:32

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 3/3] venus: Add a handling of QC10C compressed format

On 29/04/2021 12:58, Stanimir Varbanov wrote:
> This adds QC10C compressed pixel format in the Venus driver, and
> make it enumeratable from v4l2 clients.

enumeratable -> possible to discover

(or possibly 'enumerable', but I prefer the phrase suggested above)

>
> Note: The QC10C format shouldn't be possible to enumerate by the
> client if the decoded bitstream is not 10bits. This is not

10bits -> 10-bits

> implemented in this patch yet.

Obvious question: will this be done in a later patch that is being
prepared? Would it be better to wait until such a patch is available?

Regards,

Hans

>
> Signed-off-by: Stanimir Varbanov <[email protected]>
> ---
> drivers/media/platform/qcom/venus/helpers.c | 2 ++
> drivers/media/platform/qcom/venus/vdec.c | 6 +++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 3a0b07d237a5..58bf2e0654ce 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -563,6 +563,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
> return HFI_COLOR_FORMAT_NV21;
> case V4L2_PIX_FMT_QC8C:
> return HFI_COLOR_FORMAT_NV12_UBWC;
> + case V4L2_PIX_FMT_QC10C:
> + return HFI_COLOR_FORMAT_YUV420_TP10_UBWC;
> default:
> break;
> }
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index d4cc51fc019c..7ad8cd66b8bc 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -35,6 +35,10 @@ static const struct venus_format vdec_formats[] = {
> .num_planes = 1,
> .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
> }, {
> + .pixfmt = V4L2_PIX_FMT_QC10C,
> + .num_planes = 1,
> + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
> + },{
> .pixfmt = V4L2_PIX_FMT_NV12,
> .num_planes = 1,
> .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
> @@ -1508,7 +1512,7 @@ static const struct hfi_inst_ops vdec_hfi_ops = {
> static void vdec_inst_init(struct venus_inst *inst)
> {
> inst->hfi_codec = HFI_VIDEO_CODEC_H264;
> - inst->fmt_out = &vdec_formats[6];
> + inst->fmt_out = &vdec_formats[8];
> inst->fmt_cap = &vdec_formats[0];
> inst->width = frame_width_min(inst);
> inst->height = ALIGN(frame_height_min(inst), 32);
>

2021-06-02 11:56:29

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 1/3] v4l: Add Qualcomm custom compressed pixel formats

On 29/04/2021 12:58, Stanimir Varbanov wrote:
> Here we add custom Qualcomm raw compressed pixel formats. They are
> used in Qualcomm SoCs to optimaize the interconnect bandwidth.

optimize

>
> Signed-off-by: Stanimir Varbanov <[email protected]>
> ---
> .../userspace-api/media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
> drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
> include/uapi/linux/videodev2.h | 2 ++
> 3 files changed, 16 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> index 0b879c0da713..30b9cef4cbf0 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
> @@ -260,6 +260,18 @@ please make a proposal on the linux-media mailing list.
> of tiles, resulting in 32-aligned resolutions for the luminance plane
> and 16-aligned resolutions for the chrominance plane (with 2x2
> subsampling).
> + * .. _V4L2-PIX-FMT-QC8C:
> +
> + - ``V4L2_PIX_FMT_QC8C``
> + - 'QC8C'
> + - Compressed Macro-tile 8Bit YUV420 format used by Qualcomm platforms.

8Bit -> 8-bit

> + The compression is lossless. It contains four planes.
> + * .. _V4L2-PIX-FMT-QC10C:
> +
> + - ``V4L2_PIX_FMT_QC10C``
> + - 'QC10C'
> + - Compressed Macro-tile 10Bit YUV420 format used by Qualcomm platforms.

10Bit -> 10-bit

> + The compression is lossless. It contains four planes.

What is not clear from this description is if these formats are opaque, i.e. the
only way to decompress is through hardware, or if they can be decompressed in
software. If so, a reference to Qualcomm documentation would be useful. See e.g.
the V4L2_PIX_FMT_MT21C description (that's an opaque format).

>
> .. raw:: latex
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 6a5d1c6d11d6..33ee12b97aa0 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1455,6 +1455,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break;
> case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break;
> case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
> + case V4L2_PIX_FMT_QC8C: descr = "QCOM Compressed 8bit Format"; break;
> + case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10bit Format"; break;

8bit -> 8-bit
10bit -> 10-bit

(similar to the other descriptions)

> default:
> if (fmt->description[0])
> return;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 311a01cc5775..c57628a16cf4 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -737,6 +737,8 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
> #define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
> #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */
> +#define V4L2_PIX_FMT_QC8C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */
> +#define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compresed */

compresed -> compressed

>
> /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
> #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
>

Regards,

Hans

2021-06-02 13:33:16

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 1/3] v4l: Add Qualcomm custom compressed pixel formats



On 6/2/21 12:56 PM, Hans Verkuil wrote:
> On 29/04/2021 12:58, Stanimir Varbanov wrote:
>> Here we add custom Qualcomm raw compressed pixel formats. They are
>> used in Qualcomm SoCs to optimaize the interconnect bandwidth.
>
> optimize
>
>>
>> Signed-off-by: Stanimir Varbanov <[email protected]>
>> ---
>> .../userspace-api/media/v4l/pixfmt-reserved.rst | 12 ++++++++++++
>> drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
>> include/uapi/linux/videodev2.h | 2 ++
>> 3 files changed, 16 insertions(+)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> index 0b879c0da713..30b9cef4cbf0 100644
>> --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
>> @@ -260,6 +260,18 @@ please make a proposal on the linux-media mailing list.
>> of tiles, resulting in 32-aligned resolutions for the luminance plane
>> and 16-aligned resolutions for the chrominance plane (with 2x2
>> subsampling).
>> + * .. _V4L2-PIX-FMT-QC8C:
>> +
>> + - ``V4L2_PIX_FMT_QC8C``
>> + - 'QC8C'
>> + - Compressed Macro-tile 8Bit YUV420 format used by Qualcomm platforms.
>
> 8Bit -> 8-bit
>
>> + The compression is lossless. It contains four planes.
>> + * .. _V4L2-PIX-FMT-QC10C:
>> +
>> + - ``V4L2_PIX_FMT_QC10C``
>> + - 'QC10C'
>> + - Compressed Macro-tile 10Bit YUV420 format used by Qualcomm platforms.
>
> 10Bit -> 10-bit
>
>> + The compression is lossless. It contains four planes.
>
> What is not clear from this description is if these formats are opaque, i.e. the
> only way to decompress is through hardware, or if they can be decompressed in
> software. If so, a reference to Qualcomm documentation would be useful. See e.g.
> the V4L2_PIX_FMT_MT21C description (that's an opaque format).

Yes, the formats are opaque and can be decompressed by hardware blocks
only. I'll clear that in v2. Thanks for the review.

--
regards,
Stan

2021-06-02 13:34:36

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 3/3] venus: Add a handling of QC10C compressed format



On 6/2/21 1:01 PM, Hans Verkuil wrote:
> On 29/04/2021 12:58, Stanimir Varbanov wrote:
>> This adds QC10C compressed pixel format in the Venus driver, and
>> make it enumeratable from v4l2 clients.
>
> enumeratable -> possible to discover
>
> (or possibly 'enumerable', but I prefer the phrase suggested above)
>
>>
>> Note: The QC10C format shouldn't be possible to enumerate by the
>> client if the decoded bitstream is not 10bits. This is not
>
> 10bits -> 10-bits
>
>> implemented in this patch yet.
>
> Obvious question: will this be done in a later patch that is being
> prepared? Would it be better to wait until such a patch is available?
>

Yes, It will be implemented in v2.

--
regards,
Stan