From patchwork Tue May 15 07:58:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135837 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp669043lji; Tue, 15 May 2018 01:00:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAJl0dJrOWcBvg9G/t+Ug7BZ3+gSTskdkhT/BOVbTCpGVwFfNdLIsinGvXA1f34nDt5hcJ X-Received: by 2002:a65:5c47:: with SMTP id v7-v6mr11290686pgr.425.1526371241485; Tue, 15 May 2018 01:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371241; cv=none; d=google.com; s=arc-20160816; b=gs9yu1xyE/UkOR2uu0ItwyzLE8G5tQ8d+xjS4BACB5S/CPZKYb0cLMN7ky0tDGQHJZ sWIFWt92xfmSYkdvupb8mrch3K1/Kr6Mjjamzalbn2OlTojLVPqPh/2lCk1tSMceOkpu F4s+q0WTIwx1TpVeBBcS+Y6VrgBlfCWhdDlhMsjhMTg3HvNhS6/zyCtFbZHMO1rGNIXg MD07oIlCOTdrsNKVvWM6L4BQgJ7cPEL4kP4+sbNnPubJTj2lc2kSwU8pEF7tArstLf68 fbAq9o/LieyymBeFAvOHfPBzkhgCH86TVDyj7HstMjSvrG3xLsPrQVDI+4iYvJXdmXwJ qdjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=vJbl5HE1l0ffxbXEUPuNmiSGts/P7yzkg6ymkMYMxOBFi2PNuK4k7/nRaPTRRXHy/A A+YbMOQ7LPMK2Ea/l2RI+kwwxr4rMxeiC5ut/QkzAW54X6ssghRprWiuEPKl298XfPFK KJiI8fkUibkrMwOPEIiAeQkmRgmkxtWX+lhBg5aiA3QWOX2V9Rw2+DtzME3aNkhEjwj7 64sAFOIAjWvHP5UPpN2fBpwSn5rXdEFP9duiqC6a62w7xP0rP10q6dD4BTu4NtYCLEOJ 4KQZiMx9zOfq4A26j5dc6Dt7Z2JcYti1SvseapJQA7epnXqkb8mGtgu8/Mc+ooV48u3Z yVzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gEvLzq6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34-v6si11074044pld.411.2018.05.15.01.00.41; Tue, 15 May 2018 01:00:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gEvLzq6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbeEOIA0 (ORCPT + 29 others); Tue, 15 May 2018 04:00:26 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:37225 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbeEOH77 (ORCPT ); Tue, 15 May 2018 03:59:59 -0400 Received: by mail-wr0-f195.google.com with SMTP id h5-v6so14903300wrm.4 for ; Tue, 15 May 2018 00:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=gEvLzq6D+QNfdLzuZ27cv9dKWRThjo3szx2Fy43tY7A7fSE9neojIv+HsnhCz2enE+ mNL2AwBkRScl2G9fR4xfqZBW7qiWRHynB+27XDDc0UhftSPVx22YzgSJHeo0PIez5Wkt HxlgsBF8qMgMYFO+qQJummcGKoT+bhmIiouWA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WQOQSGQ8+pOf2QfOZlURcvnuPEKjy5C3mdVmwEUxuhs=; b=PpcRW4WeLgXjnWGqVEs37cbn3uGvZjqvu5tT+Q5crxsH2jvtWbp29cLacBTcn/vfuP o/mA3gIziqzqowmxWPQTOnCxBONOCSj0OxVb46y3+8U3SozXwHPk6/wvwQGP+KKeo0Ek 66UBqwLFnKXDMLEJNqIfnNLJDw/NWnOrrkONoPM306lit2AQjdf4ZNBGfHM8mr6Ier5f huT7OkKoiGSQJC1JpoQFbXrn+vem7khkFLG+z9DSgWtR909QPwLbnWYNcK3FlMYsA7Tg KVr3mBIbmxMeGLS0QCV0lB3k0aq+p9GRN8mMcX2F8S/ShHymGIpbJuQJmvIKjpM5QO6j wviA== X-Gm-Message-State: ALKqPwcZfWs69bo7zzyLWeJkVcDlqBirbWXG2KAL3GSiWNVb0G6BYde+ ToLTkC91p7lgYOZPLrCklf5NVQ== X-Received: by 2002:adf:a00d:: with SMTP id k13-v6mr9461385wrk.39.1526371198352; Tue, 15 May 2018 00:59:58 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:57 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 29/29] venus: add HEVC codec support Date: Tue, 15 May 2018 10:58:59 +0300 Message-Id: <20180515075859.17217-30-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This add HEVC codec support for venus versions 3xx and 4xx. Signed-off-by: Stanimir Varbanov --- 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(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 85e66e2dd672..2a956d1b9bd1 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -185,10 +185,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 87dcf9973e6f..fecadba039cf 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 d2d082009686..d2ffd9bd44de 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 a703bce78abc..50a04cb1cc22 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;