From patchwork Thu Jul 5 13:04:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141126 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1919095ljj; Thu, 5 Jul 2018 06:05:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfA89HO6RBzYJVaDkPvcUd/3Ff0uTda/eg6XOiqwJAWbx8gPO1oppHWsS3PrAxIELJJkMFR X-Received: by 2002:a63:342:: with SMTP id 63-v6mr5428518pgd.290.1530795947653; Thu, 05 Jul 2018 06:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530795947; cv=none; d=google.com; s=arc-20160816; b=D9Vi8q6o8LNB8pAWldEvJSl1kSI/PJNlXaa4vDfxMHLhWYeGEzXJdlsHUXRvtVbzb5 r3xCzVZxsUsaDBpNoAb/VaNDIGwxjBS5bHA7UwlFcAno7OWjBtAeuk5fxmZAcxECHRIa KdGJ6fJm+8lR9xYxjx9z8N6JwPkc4R0P3grtM7Sfi/vhfJ8+bcybLIel1SJsDgjOLKk2 7SaVo9N36PEbUsJLQmEoK7Hma26oeJrtLxSf+yEBFv8F1OHgkcEtnA/P/54PxGMnkn3s i1AAn6jyUPCcV2n4AVKX1esXq3PhnU7qtm/izF2RKh1EihIIQAiqW2MxPVsWMEvYPbkl TXlg== 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=ydLhI+nILE8mOHyuZRipV0saHGZ9x1tIp4DKcQUt51Q=; b=Xokq2rKx7fJNY64vPeJsB6BGYbIFgEqBLGh9mPdu/z3RuV4oDG51FmU6miG+pdKWNU HV9oo4V5+rpu83VsUoLc/WHp3hUboUisVvWt5duX3uJqnNW6crHP7jKZyufaxn/NVl3S o3+be1UWcHVAk0PPFUCeN1uSjetPp1hNKtWXkEjOTnC6pRl+EfxZrTcovS1y6uGt0uWb IZdFMRpWikbeA9zvw8ZNCRBPkryQfgpXowGa4pcaJKKjd9M81vWu4FcgcEaL118LCLsn wX8owWG2/DyOpPGQAcIDeI+baktBVUe2ClLuQu7md6f2fhYMRV8rmueWGaqv061pEvuc qwHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgUhGluh; 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 a72-v6si5711148pge.497.2018.07.05.06.05.47; Thu, 05 Jul 2018 06:05:47 -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=LgUhGluh; 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 S1754581AbeGENFp (ORCPT + 31 others); Thu, 5 Jul 2018 09:05:45 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:53792 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754549AbeGENFi (ORCPT ); Thu, 5 Jul 2018 09:05:38 -0400 Received: by mail-wm0-f54.google.com with SMTP id b188-v6so11033403wme.3 for ; Thu, 05 Jul 2018 06:05:37 -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=ydLhI+nILE8mOHyuZRipV0saHGZ9x1tIp4DKcQUt51Q=; b=LgUhGluh6FJY67inoyBmTVUiOoV93QPR72mPK4abcWbyMBwl39Wf64WwyvIIysqP6/ Ofb2zfIMoGYaOQBNxdwrP0UF88iWguY8f1lTBNvUYpTOs1GUrF8WquoF3WGiWroArEvx M/y5LcS5okB0i9lBWba3IyoMuS8zzFz2ZYOQk= 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=ydLhI+nILE8mOHyuZRipV0saHGZ9x1tIp4DKcQUt51Q=; b=WNpJlejbV4c1r39VR6QjtSEX82En2Mv1PjuVwA0mRw9r3hOTjzcmb79+P61ZYdL3sN eEp5jCCwMlN/Q4ew0mlY0buPIooz11GEzp1PLKwYew/D1tWcXWM9Q8lqKSS3Or2+JUhN iMa7aNz+XRHR0f12JCkcw28YW0WqGsKMqGKn82HYhzndRRGAYwkZc+TroBVFKVRfkj+h cpCIYTsjJ8/yXS7EP4WLSh8f6pBKTPRstLK+Lw9lmlOR/2o6EhfwD0MGRgtq4BdgqB9f 5kikWS0+A2Pn0SeKdMdp3CHAERGnSbRYaWQG+AXX4U31IrRotNhz/moO6Uz3NBt3GofX HgHg== X-Gm-Message-State: APt69E0tbWoClHGyBZznFfkFF0Pp0GgAXpm+0XvDN6EUnhpVCE2acPpt eDIEVU2SuSVKG/leSZB8d09MDA== X-Received: by 2002:a1c:ac03:: with SMTP id v3-v6mr3963734wme.100.1530795937180; Thu, 05 Jul 2018 06:05:37 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:36 -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 , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 27/27] venus: add HEVC codec support Date: Thu, 5 Jul 2018 16:04:01 +0300 Message-Id: <20180705130401.24315-28-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 Reviewed-by: Tomasz Figa --- 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 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;