linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Vikash Garodia <vgarodia@codeaurora.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Alexandre Courbot <acourbot@chromium.org>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>
Subject: [PATCH v5 27/27] venus: add HEVC codec support
Date: Thu,  5 Jul 2018 16:04:01 +0300	[thread overview]
Message-ID: <20180705130401.24315-28-stanimir.varbanov@linaro.org> (raw)
In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org>

This add HEVC codec support for venus versions 3xx and 4xx.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
---
 drivers/media/platform/qcom/venus/core.h    |  2 ++
 drivers/media/platform/qcom/venus/helpers.c |  3 ++
 drivers/media/platform/qcom/venus/hfi.c     |  2 ++
 drivers/media/platform/qcom/venus/vdec.c    |  4 +++
 drivers/media/platform/qcom/venus/venc.c    | 49 +++++++++++++++++++++++++++++
 5 files changed, 60 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 8cc49f30a363..2f02365f4818 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -190,10 +190,12 @@ struct venc_controls {
 		u32 mpeg4;
 		u32 h264;
 		u32 vpx;
+		u32 hevc;
 	} profile;
 	struct {
 		u32 mpeg4;
 		u32 h264;
+		u32 hevc;
 	} level;
 };
 
diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index cea5b506dd51..cd3b96e6f24b 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -71,6 +71,9 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt)
 	case V4L2_PIX_FMT_XVID:
 		codec = HFI_VIDEO_CODEC_DIVX;
 		break;
+	case V4L2_PIX_FMT_HEVC:
+		codec = HFI_VIDEO_CODEC_HEVC;
+		break;
 	default:
 		return false;
 	}
diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c
index 94ca27b0bb99..24207829982f 100644
--- a/drivers/media/platform/qcom/venus/hfi.c
+++ b/drivers/media/platform/qcom/venus/hfi.c
@@ -49,6 +49,8 @@ static u32 to_codec_type(u32 pixfmt)
 		return HFI_VIDEO_CODEC_VP9;
 	case V4L2_PIX_FMT_XVID:
 		return HFI_VIDEO_CODEC_DIVX;
+	case V4L2_PIX_FMT_HEVC:
+		return HFI_VIDEO_CODEC_HEVC;
 	default:
 		return 0;
 	}
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index d53e487e3dfa..eeaf99380e3e 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -77,6 +77,10 @@ static const struct venus_format vdec_formats[] = {
 		.pixfmt = V4L2_PIX_FMT_XVID,
 		.num_planes = 1,
 		.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+	}, {
+		.pixfmt = V4L2_PIX_FMT_HEVC,
+		.num_planes = 1,
+		.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
 	},
 };
 
diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 5973bf1f8174..67e895965c93 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -59,6 +59,10 @@ static const struct venus_format venc_formats[] = {
 		.pixfmt = V4L2_PIX_FMT_VP8,
 		.num_planes = 1,
 		.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+	}, {
+		.pixfmt = V4L2_PIX_FMT_HEVC,
+		.num_planes = 1,
+		.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
 	},
 };
 
@@ -220,6 +224,46 @@ static int venc_v4l2_to_hfi(int id, int value)
 		case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY:
 			return HFI_H264_DB_MODE_SKIP_SLICE_BOUNDARY;
 		}
+	case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
+		switch (value) {
+		case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN:
+		default:
+			return HFI_HEVC_PROFILE_MAIN;
+		case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE:
+			return HFI_HEVC_PROFILE_MAIN_STILL_PIC;
+		case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10:
+			return HFI_HEVC_PROFILE_MAIN10;
+		}
+	case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
+		switch (value) {
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_1:
+		default:
+			return HFI_HEVC_LEVEL_1;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_2:
+			return HFI_HEVC_LEVEL_2;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1:
+			return HFI_HEVC_LEVEL_21;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_3:
+			return HFI_HEVC_LEVEL_3;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1:
+			return HFI_HEVC_LEVEL_31;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_4:
+			return HFI_HEVC_LEVEL_4;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1:
+			return HFI_HEVC_LEVEL_41;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_5:
+			return HFI_HEVC_LEVEL_5;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1:
+			return HFI_HEVC_LEVEL_51;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2:
+			return HFI_HEVC_LEVEL_52;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_6:
+			return HFI_HEVC_LEVEL_6;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1:
+			return HFI_HEVC_LEVEL_61;
+		case V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2:
+			return HFI_HEVC_LEVEL_62;
+		}
 	}
 
 	return 0;
@@ -744,6 +788,11 @@ static int venc_set_properties(struct venus_inst *inst)
 	} else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H263) {
 		profile = 0;
 		level = 0;
+	} else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) {
+		profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_HEVC_PROFILE,
+					   ctr->profile.hevc);
+		level = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_HEVC_LEVEL,
+					 ctr->level.hevc);
 	}
 
 	ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT;
-- 
2.14.1


  parent reply	other threads:[~2018-07-05 13:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05 13:03 [PATCH v5 00/27] Venus updates Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 01/27] venus: hfi_msgs: correct pointer increment Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 02/27] venus: hfi: preparation to support venus 4xx Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 03/27] venus: hfi: update sequence event to handle more properties Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 04/27] venus: hfi_cmds: add set_properties for 4xx version Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 05/27] venus: hfi: support session continue " Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 06/27] venus: hfi: handle buffer output2 type as well Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 07/27] venus: hfi_venus: add halt AXI support for Venus 4xx Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 08/27] venus: hfi_venus: fix suspend function for venus 3xx versions Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 09/27] venus: hfi_venus: move set of default properties to core init Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 10/27] venus: hfi_venus: add suspend functionality for Venus 4xx Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 11/27] venus: core,helpers: add two more clocks found in " Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 12/27] venus: hfi_parser: add common capability parser Stanimir Varbanov
2018-07-06 11:21   ` Hans Verkuil
2018-07-06 12:19     ` Stanimir Varbanov
2018-07-06 12:27       ` Hans Verkuil
2018-07-06 12:47   ` [PATCH v6 " Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 13/27] venus: helpers: rename a helper function and use buffer mode from caps Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 14/27] venus: helpers: add a helper function to set dynamic buffer mode Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 15/27] venus: helpers: add helper function to set actual buffer size Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 16/27] venus: core: delete not used buffer mode flags Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 17/27] venus: helpers: add buffer type argument to a helper Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 18/27] venus: helpers: add a new helper to set raw format Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 19/27] venus: helpers,vdec,venc: add helpers to set work mode and core usage Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 20/27] venus: helpers: extend set_num_bufs helper with one more argument Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 21/27] venus: helpers: add a helper to return opb buffer sizes Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 22/27] venus: vdec: get required input buffers as well Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 23/27] venus: vdec: a new function for output configuration Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 24/27] venus: helpers: move frame size calculations on common place Stanimir Varbanov
2018-07-05 13:03 ` [PATCH v5 25/27] venus: implementing multi-stream support Stanimir Varbanov
2018-07-05 13:04 ` [PATCH v5 26/27] venus: core: add sdm845 DT compatible and resource data Stanimir Varbanov
2018-07-05 13:04 ` Stanimir Varbanov [this message]
2018-07-05 14:07 ` [PATCH v5 00/27] Venus updates Tomasz Figa
2018-07-05 14:08   ` Hans Verkuil
2018-07-05 14:51     ` Stanimir Varbanov
2018-07-05 15:00       ` Alexandre Courbot
2018-07-06  3:55         ` Alexandre Courbot
2018-07-06  7:11           ` Stanimir Varbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180705130401.24315-28-stanimir.varbanov@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=acourbot@chromium.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tfiga@chromium.org \
    --cc=vgarodia@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).