From patchwork Wed Jun 13 15:08: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: 138490 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp848992lji; Wed, 13 Jun 2018 08:10:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKuqnKLd5XpR9el4ru6+Xu0OuIzMQcdSBJQiKulF6V+7DdgsUPh7TA3CLJNHPEnfUD5O7L4 X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr5644666pld.103.1528902620945; Wed, 13 Jun 2018 08:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902620; cv=none; d=google.com; s=arc-20160816; b=v+KiMZr3zOuelRIQ3Vwv3tJao8Bj2L7+DaxrYqPLUPCcTOAaQlaZcKIO25qM3YNjyB BRn7jdhNrXUFnBnKc5w1D+DOdqRhl3h2tczPUx0DfWi0j5l0TeqMnQz7dty3ABmixffq Kfp2haABDxD5B7sfuvMcEUAdKYIoYlOMRp565JLaPruTxCz/i7lYjx2tMtYOb4RCzMzw 56nPA4aB2hPSvxx9EP1amGwK9aRgFmMTs+6Wc548HQntneMrJDSX8cOZ9Q5Iy6jRlh+E isF3bgHWxwG3lvemdshyT+zTqXIRsMvF2uVkMgHqqGRcc2sDZ2PzPQ/USTDyx0Km/0EU /HDw== 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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=H9q+5J3wrgZIupBM68layixvwFzfpnhPnSUcUP6hMK1uelZkcusfiB55XMai2/viXx SByal56TvWgCSWz6KwiJMMqzj/QPcgBlZWkMG2EFEDzNZJoab1Gd2TN2quPaSpxN6X3O vQF7DeXupRXbaZSILAaAQfaH3ZTm/kM/dddol8i5eJYjhWnw0Ky1iASx9qrlWjn/pDUf wxP6b/S8MA0omEhVA1FxryTG3EMc8fWugG1ykB1Dci2lR035sjorOJcIpnLhBHtlGfYv QZQfG/JM86AmQzRpEx1rVGLJFOmP8tlZj1JKFPnqUUq2JzKIdYj+9r0L7B6dpxfM3qaL V6lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FKaStwU6; 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 d13-v6si3152900pfe.214.2018.06.13.08.10.20; Wed, 13 Jun 2018 08:10:20 -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=FKaStwU6; 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 S936104AbeFMPKT (ORCPT + 30 others); Wed, 13 Jun 2018 11:10:19 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40341 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936081AbeFMPJp (ORCPT ); Wed, 13 Jun 2018 11:09:45 -0400 Received: by mail-wm0-f68.google.com with SMTP id n5-v6so6069688wmc.5 for ; Wed, 13 Jun 2018 08:09:45 -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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=FKaStwU6gRwmZ3HUd7N0XNz1roaYRpObvAtYy3LLmbwiwv7F0Nu56yncW5kpbSqnLF 8iAXTerKjhOFrYqphSzXcHHFgtagdGrC0nhJ/U3gkPRzia4keCmRD7to0CsuaaRrzWad zes1Jjp9G0W76uOiKblEEPvZPF6K4pnHbegL4= 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=jaIrs4Hlkn8/hSfPKZPaW9B0la4YriBdsqxKyEKBPSU=; b=CSicAI0WOX1ANVi4mrtw9sbc34OBcK62mzT5G2Uj27UQSg3KyywpzMYt0mqJ+g9o57 6yCbnZ3wgf2JFXLReowv8CCGwBD3vWU2TkR/KDhayWP1deicbYo8SP8/i+iva3FGleCe vXjJakszWi3+H7944ar4AEL9WbqUIkgRY/2Gh4F5ooj8tOL6b5eLqw7yWwQiC8NR3x7Z DdEVt9Ga3Rv9cXAxW45UMc3VQo/ZEmHF8DMH8vlhwxpXQbPx5AvJJwiCgBPKff3a38qp oQcCIpuHy00AsheUpd6egquiKI6+N0hlIJ4LAE6LR6XwFsw7+F7uMKR7GvN7kAkqcQ7P iBKg== X-Gm-Message-State: APt69E2X1nZ6DSX8dzXZo93mwJqdOeaFj0MXauVQXUMD0Mlgajnmj0UM FNG5dNdXLjJ0fHieSEfL5wLiEA== X-Received: by 2002:a1c:9bd0:: with SMTP id d199-v6mr3845405wme.16.1528902584439; Wed, 13 Jun 2018 08:09:44 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:43 -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 , Stanimir Varbanov Subject: [PATCH v3 27/27] venus: add HEVC codec support Date: Wed, 13 Jun 2018 18:08:01 +0300 Message-Id: <20180613150801.11702-28-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 a0c7ef5f9125..2da88aec5a21 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 9d509b3c1c7a..d079aebff550 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 be5dc3a2eb28..a2c6a4b7ac43 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;