diff mbox series

[2/3] venus: Add a handling of QC8C compressed format

Message ID 20210429105815.2790770-3-stanimir.varbanov@linaro.org
State New
Headers show
Series Qualcomm custom compressed pixfmt | expand

Commit Message

Stanimir Varbanov April 29, 2021, 10:58 a.m. UTC
This adds QC8C compressed pixel format in the Venus driver, and
make it enumeratable from v4l2 clients.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
---
 drivers/media/platform/qcom/venus/helpers.c |  2 ++
 drivers/media/platform/qcom/venus/vdec.c    | 12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Hans Verkuil June 2, 2021, 9:59 a.m. UTC | #1
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 <stanimir.varbanov@linaro.org>

> ---

>  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;

>
diff mbox series

Patch

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;