From patchwork Tue Sep 8 12:32:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 292966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 389E7C43461 for ; Tue, 8 Sep 2020 19:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E528320658 for ; Tue, 8 Sep 2020 19:42:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="m9ej34LW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731610AbgIHTmT (ORCPT ); Tue, 8 Sep 2020 15:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730907AbgIHPwu (ORCPT ); Tue, 8 Sep 2020 11:52:50 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3176C061345 for ; Tue, 8 Sep 2020 05:33:30 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id c10so15793167edk.6 for ; Tue, 08 Sep 2020 05:33:30 -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=1+TohLeDYlN1Yf+ps+jhwsXTShnc7sKaopngyekPTD0=; b=m9ej34LWVzwItDY8WU/x8L+TqkZNInkR1/Skvw2d3ykFznu6wLP+B0oz+fyvbt4OPY 8uGbEHZ0D/5v4WVfNI4dQGbJSbY4VMehOiRRbJ9TPHfO1Oj+RASJtGk/A7eNeh8hCz1A SMvtjJobtXQu0rnyHarJ8WqJdmMYKVXkum88NY9KTvJb4NoiZLF09P+wGg5dJMull1Qg v3yCHevySMP01igaSY5eiaW8wd/l1JSgAiyodLHQuH3kPmz0IMwkXCzcPpklLCbxPoSS CSNBhQYz62feVI0pvXHIEToxFVNnDIAW43XXChCwb5aBdK1/j9fH8GKHqyZHEcb1Ldby IGHA== 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=1+TohLeDYlN1Yf+ps+jhwsXTShnc7sKaopngyekPTD0=; b=FL2fqGB03EAMQoUSJZsOgfEfpHFXGkcAxeTGzuGjbRktKTWfG6dnWBpqRbQwRphEub UEg5QDAdrIqmMGAekr25WUMQTZDH8YR1PzMCbbEnZk8F51rCHiedUgfFnVCqS9PUautj g9xJI+nQt6tVb1xS8C7KJRico0+ITy0c71CcGdVuo6VRbfvXQR0frIj8g8j6PzkHC5SN bXBthczbRT0wSazCsGN7eqzTpczHbc5SR9T0PtYTs3vGUd9v303y2ZXWvHdGkw1brIMf eUhhZTYIDH+np2ulTF/5K+HAzGwjb6mtOxjAJTXTHiENAIsM5uAc5BRVBSWgnkU6wmOQ l+jA== X-Gm-Message-State: AOAM5320UwpZv5CJnNBVyxRstW/gvA0Uw+EIpdqnS/1gZREJgcBdYlPf /r1ZBjmssJqiCLftnri5xtW1nYRB1cnTW1MV X-Google-Smtp-Source: ABdhPJx7ZLzA73WVBugJeh+bp5FAXxemrmcVuaOUhlQMnyasWc7Zd1BBQS2MQPiYvctkJg4skx5jEg== X-Received: by 2002:a50:cf0b:: with SMTP id c11mr10801599edk.87.1599568406173; Tue, 08 Sep 2020 05:33:26 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:25 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 1/6] v4l2-ctrl: Add VP9 codec levels Date: Tue, 8 Sep 2020 15:32:16 +0300 Message-Id: <20200908123221.2793-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add menu control for VP9 codec levels. A total of 14 levels are defined for Profile 0 (8bit) and Profile 2 (10bit). Each level is a set of constrained bitstreams coded with targeted resolutions, frame rates, and bitrates. The definitions have been taken from webm project [1]. [1] https://www.webmproject.org/vp9/levels/ Signed-off-by: Stanimir Varbanov Reviewed-by: Nicolas Dufresne --- .../media/v4l/ext-ctrls-codec.rst | 43 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 21 +++++++++ include/uapi/linux/v4l2-controls.h | 17 ++++++++ 3 files changed, 81 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 289d380e2cf0..ce728c757eaf 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3383,6 +3383,49 @@ enum v4l2_mpeg_video_vp9_profile - * - ``V4L2_MPEG_VIDEO_VP9_PROFILE_3`` - Profile 3 +.. _v4l2-mpeg-video-vp9-level: + +``V4L2_CID_MPEG_VIDEO_VP9_LEVEL (enum)`` + +enum v4l2_mpeg_video_vp9_level - + This control allows selecting the level for VP9 encoder. + This is also used to enumerate supported levels by VP9 encoder or decoder. + More information can be found at + `webmproject `__. Possible values are: + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_1_0`` + - Level 1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_1_1`` + - Level 1.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_2_0`` + - Level 2 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_2_1`` + - Level 2.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_3_0`` + - Level 3 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_3_1`` + - Level 3.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_4_0`` + - Level 4 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_4_1`` + - Level 4.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_5_0`` + - Level 5 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_5_1`` + - Level 5.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_5_2`` + - Level 5.2 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_6_0`` + - Level 6 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_6_1`` + - Level 6.1 + * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_6_2`` + - Level 6.2 + High Efficiency Video Coding (HEVC/H.265) Control Reference =========================================================== diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 73f3d65957ff..bd7f330c941c 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -475,6 +475,23 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "3", NULL, }; + static const char * const vp9_level[] = { + "1", + "1.1", + "2", + "2.1", + "3", + "3.1", + "4", + "4.1", + "5", + "5.1", + "5.2", + "6", + "6.1", + "6.2", + NULL, + }; static const char * const flash_led_mode[] = { "Off", @@ -694,6 +711,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return vp8_profile; case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: return vp9_profile; + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: + return vp9_level; case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: return jpeg_chroma_subsampling; case V4L2_CID_DV_TX_MODE: @@ -950,6 +969,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: return "VPX P-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: return "VP8 Profile"; case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: return "VP9 Profile"; + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: return "VP9 Level"; case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: return "VP8 Frame Header"; /* HEVC controls */ @@ -1307,6 +1327,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL: case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: case V4L2_CID_DETECT_MD_MODE: case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 053827cda8e6..a184c4939438 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -651,6 +651,23 @@ enum v4l2_mpeg_video_vp9_profile { V4L2_MPEG_VIDEO_VP9_PROFILE_2 = 2, V4L2_MPEG_VIDEO_VP9_PROFILE_3 = 3, }; +#define V4L2_CID_MPEG_VIDEO_VP9_LEVEL (V4L2_CID_MPEG_BASE+513) +enum v4l2_mpeg_video_vp9_level { + V4L2_MPEG_VIDEO_VP9_LEVEL_1_0 = 0, + V4L2_MPEG_VIDEO_VP9_LEVEL_1_1 = 1, + V4L2_MPEG_VIDEO_VP9_LEVEL_2_0 = 2, + V4L2_MPEG_VIDEO_VP9_LEVEL_2_1 = 3, + V4L2_MPEG_VIDEO_VP9_LEVEL_3_0 = 4, + V4L2_MPEG_VIDEO_VP9_LEVEL_3_1 = 5, + V4L2_MPEG_VIDEO_VP9_LEVEL_4_0 = 6, + V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 = 7, + V4L2_MPEG_VIDEO_VP9_LEVEL_5_0 = 8, + V4L2_MPEG_VIDEO_VP9_LEVEL_5_1 = 9, + V4L2_MPEG_VIDEO_VP9_LEVEL_5_2 = 10, + V4L2_MPEG_VIDEO_VP9_LEVEL_6_0 = 11, + V4L2_MPEG_VIDEO_VP9_LEVEL_6_1 = 12, + V4L2_MPEG_VIDEO_VP9_LEVEL_6_2 = 13, +}; /* CIDs for HEVC encoding. */ From patchwork Tue Sep 8 12:32:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 249373 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4842675ilg; Tue, 8 Sep 2020 12:38:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2IAgRZR+5hAT+4X8aL72xGl3qAWkMXuHnqFqQd+d4NYpvhdTKq0kvNOkhHQ9cbFSBMLVe X-Received: by 2002:aa7:cb83:: with SMTP id r3mr600297edt.35.1599593892826; Tue, 08 Sep 2020 12:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599593892; cv=none; d=google.com; s=arc-20160816; b=x2iyMb8ICpxFCmASw+OPaZPErBowdyzts3Iop0zvzsyZT8sJ9kdGerczl0tCrhZXE7 7SBGEf76hnIa0n/pgIm2ygqrBh8Zypgwfs401iaYq1WAujvIj/CWwKseDl4Aq6zePwwM ZkRZNtS9Y62a6cMqilMvMU66ZtufVjUgcz2qHIE9KWIfi/hqmWJhaToChrDoDgAkqS3f dBcPhc9JE3Dya7eQ5fbdLf7nFWAgv9hIsdoFK5HswoqVC++1KQ7gn1wEWFlNFDi+o6c/ DaGzmKGj3YTVGBX1Y5AIjGNfheWWMTRbUuNk6cS/J7u79IP6z7sf27ZY4z6o6z99ewpZ 4o9w== 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; bh=U/ytzC+Xy3Xxbn3dWyObssuKdvhh3djXX6G5KrguHpw=; b=PpSfot2kJzQh26FuAxgxtMu+4YG0sMGdCBrye/tqklZA5sR8xxQYhwwckJzT5rbIIK TilEoA0PnNYzxWq6oyaJ8hiTFcavytXRu392UoARPCorrGCWJZ6WzIfEQpiAg9t4qj3x bgiOOd45HavMYJMEK3BPx0mvxCBG+RLxtIDMMrFfrjmQW0VGjGGjXE3M4/1CHLvfz5mJ s2F5XXkBcJCXXiu4ZAxyAdAAi2KJTYG5u0k6V7pPX8iGdBuFuxPhEmQyLBhOmtyDxR1t sEKvJv4Rc5on1F5u87MXdlOwmB2Ayu8M9o/lpSLAZHDIUpwMrdpqokmuF21hqxqAycpE E04g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MjtH2eoL; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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. [23.128.96.18]) by mx.google.com with ESMTP id a26si12188851ejv.698.2020.09.08.12.38.12; Tue, 08 Sep 2020 12:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MjtH2eoL; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1732350AbgIHThw (ORCPT + 15 others); Tue, 8 Sep 2020 15:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730751AbgIHPzo (ORCPT ); Tue, 8 Sep 2020 11:55:44 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61FAFC061343 for ; Tue, 8 Sep 2020 05:33:30 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id i22so22247165eja.5 for ; Tue, 08 Sep 2020 05:33:30 -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=U/ytzC+Xy3Xxbn3dWyObssuKdvhh3djXX6G5KrguHpw=; b=MjtH2eoLRl2Yx7RGtVGNBFgZha7XbJDmTzJ4JjTcvphGudl1klnSeOMryTbu+Ily37 14AklWjovAy63brJ/GgEQIDkKrs/31qaZdDaaUTOc7blnCecsjH9LGMxMWo25+EQ/mJB MXuU3RBSzuDcC/KTnmqaYkvIrQLkgDbd4vdBW+3YRA+66uX2cNSZNvUWsqWytxCyZRUc XAK49sYqHBftaE3lz8/C8T5JtXldioVXGC78H2KCRFYlExr6qU/Co8K8+6dYMX3uXG8E mbfvO6nTM6/YTMqq2Oyl5p2FVdLxtGH8nsY2MUNe1JuQxigIbKnx5yUlCMnhSVOp0PKr yBTQ== 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=U/ytzC+Xy3Xxbn3dWyObssuKdvhh3djXX6G5KrguHpw=; b=NpyUsUYuXVlIwv8eCwwI6Ceml0gv90qSm6ondm1TpX5AwQ4xNsOPMzot2vp6eG1gkp pFY0sU8gbj2kH30O/LE0C+7v2PCTMGu55FnY9tKR1R1hYxX8KVF2OYTo+zNaDK1PHdE2 KifIhy9xoiNJNsMMzLlGfU0eg4UB1pLX7F/9poG7axzNckV+VRy+sqvtZb+lFH64IDlt qdrSHz+hrf9xm26LpwkErBE2eCRo/dMK2rIeax+bbMqdf3pgjqunzfH1p1OTZo4vnnoW KfZgYtK4ah4pDZqUrgL0H5PsI1uQ/o9AzmOKXQwaWrK9SMUc8uvUaHuNtBkf50qnMFQ9 uRrg== X-Gm-Message-State: AOAM530f8run0M0PfZlRdBwZ/mXpmNc5Kuc3NUPOFqZ08tx1dPnXBmuC EVyMinilu7F+i0SNRbQLTW7teSigN96oSmud X-Received: by 2002:a17:907:37b:: with SMTP id rs27mr27158410ejb.0.1599568408830; Tue, 08 Sep 2020 05:33:28 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:28 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 2/6] venus: hfi_helper: Add VP9 profile and levels Date: Tue, 8 Sep 2020 15:32:17 +0300 Message-Id: <20200908123221.2793-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add HFI defines for VP9 codec profile and levels. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_helper.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 758c70ac26fd..60ee2479f7a6 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -364,6 +364,24 @@ #define HFI_HEVC_TIER_MAIN 0x1 #define HFI_HEVC_TIER_HIGH0 0x2 +/* VP9 Profile 0, 8-bit */ +#define HFI_VP9_PROFILE_P0 0x00000001 +/* VP9 Profile 2, 10-bit */ +#define HFI_VP9_PROFILE_P2_10B 0x00000004 + +#define HFI_VP9_LEVEL_1 0x00000001 +#define HFI_VP9_LEVEL_11 0x00000002 +#define HFI_VP9_LEVEL_2 0x00000004 +#define HFI_VP9_LEVEL_21 0x00000008 +#define HFI_VP9_LEVEL_3 0x00000010 +#define HFI_VP9_LEVEL_31 0x00000020 +#define HFI_VP9_LEVEL_4 0x00000040 +#define HFI_VP9_LEVEL_41 0x00000080 +#define HFI_VP9_LEVEL_5 0x00000100 +#define HFI_VP9_LEVEL_51 0x00000200 +#define HFI_VP9_LEVEL_6 0x00000400 +#define HFI_VP9_LEVEL_61 0x00000800 + #define HFI_BUFFER_INPUT 0x1 #define HFI_BUFFER_OUTPUT 0x2 #define HFI_BUFFER_OUTPUT2 0x3 From patchwork Tue Sep 8 12:32:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 250357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52E98C433E2 for ; Tue, 8 Sep 2020 19:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 038F120658 for ; Tue, 8 Sep 2020 19:42:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CqzgBHY9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbgIHTmS (ORCPT ); Tue, 8 Sep 2020 15:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730917AbgIHPxO (ORCPT ); Tue, 8 Sep 2020 11:53:14 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7432C06134A for ; Tue, 8 Sep 2020 05:33:32 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id lo4so22247305ejb.8 for ; Tue, 08 Sep 2020 05:33:32 -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=Fz+8NPEyMXT6oRM4AXxnNIphaeEA1r9ivq1K+4WHmCo=; b=CqzgBHY9cx94bldkCTvaX9pw1Zw3+BqWRMvl7LhavrcR4Z0A0m6AQTAWzRex5/hafs 7T0pDh1jTPU3AuBzy9Pvi2g6TJsJtio7AKwCvIhNuqy89wQvqrUA3ViDPuT1LMWRpJdP 3PWpZoIwvZ15sMDJ4a0iFIce7xh9SCKaBPlmQLnIofWqk8dtp2IvAGVY+BV7Nh5e6kYD XtqJ8uQKXaZYHRyZMr5JU8xAbr+rGPP6UTMZxaa0i5wKUeVGfcjE9aywD7+btttC4QtK pTxf6IqRbdOl+7j8jpyXMKT+t6/8iENb1DxlPEKNF3FWrtnyay8hd34ZPMGQjwdxNtVl oikw== 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=Fz+8NPEyMXT6oRM4AXxnNIphaeEA1r9ivq1K+4WHmCo=; b=UyK5xo4EitD12BileuWV4/Wq9YOPOsXE4LrVRgk3b2+xjtiJzZ9tFyQgg6wMijuRtm 3I/8cEDx9EzxCAYdVFHn2BMzmuZP0HyAA+0OPQIY5J3XUROhxn5XnyGBbuIrsFCRL0vv ZB8UvYQfn+5vsQ9yXuC6yIhdopS1oLLXufcP620gfRhN0Ulrt/U+hIzBlUuE7TvHDhkE VuQiCPs4YRT70o+8IGEYVnFnoi4tvcd+9o/QEFHecchTf2eVlwbiGPoW6cxBxBWaJIcY Zq+wUpejQdhSEGYwxkf9hleY5RPRMKwODeXFjXBbZM1KPlgVPOBGvX97Oj/GKMYnd5nU sXdw== X-Gm-Message-State: AOAM5319l4u4QuZCZtkPqG/+beKl0qWhouooHCY853RbEpTDM/1mnvFI 0gkLQyjafbxlKGlb0u82sAUTiPhBe1OMBJW0 X-Google-Smtp-Source: ABdhPJwqC+56xbo1lHcIq1Y83iS0NSzEeBybGIQ8DCgpb1H12AA7ATTLyAmX/ezihA6v5n9h8KQFUQ== X-Received: by 2002:a17:906:a293:: with SMTP id i19mr7848334ejz.428.1599568411133; Tue, 08 Sep 2020 05:33:31 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:30 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 3/6] venus: helpers: Add a helper to map v4l2 ids to HFI ids Date: Tue, 8 Sep 2020 15:32:18 +0300 Message-Id: <20200908123221.2793-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce a helper to set and get profile and levels which includes the translation between v4l2 ctrl ids and HFI ids. The input arguments are always in v4l2 ids space. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 239 ++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + 2 files changed, 241 insertions(+) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 7147871d9dc1..50439eb1ffea 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -582,6 +583,244 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, } EXPORT_SYMBOL_GPL(venus_helper_get_bufreq); +struct id_mapping { + u32 hfi_id; + u32 v4l2_id; +}; + +static const struct id_mapping mpeg4_profiles[] = { + { HFI_MPEG4_PROFILE_SIMPLE, V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE }, + { HFI_MPEG4_PROFILE_ADVANCEDSIMPLE, V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE }, +}; + +static const struct id_mapping mpeg4_levels[] = { + { HFI_MPEG4_LEVEL_0, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 }, + { HFI_MPEG4_LEVEL_0b, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B }, + { HFI_MPEG4_LEVEL_1, V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 }, + { HFI_MPEG4_LEVEL_2, V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 }, + { HFI_MPEG4_LEVEL_3, V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 }, + { HFI_MPEG4_LEVEL_4, V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 }, + { HFI_MPEG4_LEVEL_5, V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 }, +}; + +static const struct id_mapping mpeg2_profiles[] = { + { HFI_MPEG2_PROFILE_SIMPLE, V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE }, + { HFI_MPEG2_PROFILE_MAIN, V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN }, + { HFI_MPEG2_PROFILE_SNR, V4L2_MPEG_VIDEO_MPEG2_PROFILE_SNR_SCALABLE }, + { HFI_MPEG2_PROFILE_SPATIAL, V4L2_MPEG_VIDEO_MPEG2_PROFILE_SPATIALLY_SCALABLE }, + { HFI_MPEG2_PROFILE_HIGH, V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH }, +}; + +static const struct id_mapping mpeg2_levels[] = { + { HFI_MPEG2_LEVEL_LL, V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW }, + { HFI_MPEG2_LEVEL_ML, V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN }, + { HFI_MPEG2_LEVEL_H14, V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440 }, + { HFI_MPEG2_LEVEL_HL, V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH }, +}; + +static const struct id_mapping h264_profiles[] = { + { HFI_H264_PROFILE_BASELINE, V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE }, + { HFI_H264_PROFILE_MAIN, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN }, + { HFI_H264_PROFILE_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH }, + { HFI_H264_PROFILE_STEREO_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH }, + { HFI_H264_PROFILE_MULTIVIEW_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH }, + { HFI_H264_PROFILE_CONSTRAINED_BASE, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE }, + { HFI_H264_PROFILE_CONSTRAINED_HIGH, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH }, +}; + +static const struct id_mapping h264_levels[] = { + { HFI_H264_LEVEL_1, V4L2_MPEG_VIDEO_H264_LEVEL_1_0 }, + { HFI_H264_LEVEL_1b, V4L2_MPEG_VIDEO_H264_LEVEL_1B }, + { HFI_H264_LEVEL_11, V4L2_MPEG_VIDEO_H264_LEVEL_1_1 }, + { HFI_H264_LEVEL_12, V4L2_MPEG_VIDEO_H264_LEVEL_1_2 }, + { HFI_H264_LEVEL_13, V4L2_MPEG_VIDEO_H264_LEVEL_1_3 }, + { HFI_H264_LEVEL_2, V4L2_MPEG_VIDEO_H264_LEVEL_2_0 }, + { HFI_H264_LEVEL_21, V4L2_MPEG_VIDEO_H264_LEVEL_2_1 }, + { HFI_H264_LEVEL_22, V4L2_MPEG_VIDEO_H264_LEVEL_2_2 }, + { HFI_H264_LEVEL_3, V4L2_MPEG_VIDEO_H264_LEVEL_3_0 }, + { HFI_H264_LEVEL_31, V4L2_MPEG_VIDEO_H264_LEVEL_3_1 }, + { HFI_H264_LEVEL_32, V4L2_MPEG_VIDEO_H264_LEVEL_3_2 }, + { HFI_H264_LEVEL_4, V4L2_MPEG_VIDEO_H264_LEVEL_4_0 }, + { HFI_H264_LEVEL_41, V4L2_MPEG_VIDEO_H264_LEVEL_4_1 }, + { HFI_H264_LEVEL_42, V4L2_MPEG_VIDEO_H264_LEVEL_4_2 }, + { HFI_H264_LEVEL_5, V4L2_MPEG_VIDEO_H264_LEVEL_5_0 }, + { HFI_H264_LEVEL_51, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 }, + { HFI_H264_LEVEL_52, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 }, +}; + +static const struct id_mapping hevc_profiles[] = { + { HFI_HEVC_PROFILE_MAIN, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN }, + { HFI_HEVC_PROFILE_MAIN_STILL_PIC, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE }, + { HFI_HEVC_PROFILE_MAIN10, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 }, +}; + +static const struct id_mapping hevc_levels[] = { + { HFI_HEVC_LEVEL_1, V4L2_MPEG_VIDEO_HEVC_LEVEL_1 }, + { HFI_HEVC_LEVEL_2, V4L2_MPEG_VIDEO_HEVC_LEVEL_2 }, + { HFI_HEVC_LEVEL_21, V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 }, + { HFI_HEVC_LEVEL_3, V4L2_MPEG_VIDEO_HEVC_LEVEL_3 }, + { HFI_HEVC_LEVEL_31, V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 }, + { HFI_HEVC_LEVEL_4, V4L2_MPEG_VIDEO_HEVC_LEVEL_4 }, + { HFI_HEVC_LEVEL_41, V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 }, + { HFI_HEVC_LEVEL_5, V4L2_MPEG_VIDEO_HEVC_LEVEL_5 }, + { HFI_HEVC_LEVEL_51, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1 }, + { HFI_HEVC_LEVEL_52, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2 }, + { HFI_HEVC_LEVEL_6, V4L2_MPEG_VIDEO_HEVC_LEVEL_6 }, + { HFI_HEVC_LEVEL_61, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 }, + { HFI_HEVC_LEVEL_62, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 }, +}; + +static const struct id_mapping vp8_profiles[] = { + { HFI_VPX_PROFILE_VERSION_0, V4L2_MPEG_VIDEO_VP8_PROFILE_0 }, + { HFI_VPX_PROFILE_VERSION_1, V4L2_MPEG_VIDEO_VP8_PROFILE_1 }, + { HFI_VPX_PROFILE_VERSION_2, V4L2_MPEG_VIDEO_VP8_PROFILE_2 }, + { HFI_VPX_PROFILE_VERSION_3, V4L2_MPEG_VIDEO_VP8_PROFILE_3 }, +}; + +static const struct id_mapping vp9_profiles[] = { + { HFI_VP9_PROFILE_P0, V4L2_MPEG_VIDEO_VP9_PROFILE_0 }, + { HFI_VP9_PROFILE_P2_10B, V4L2_MPEG_VIDEO_VP9_PROFILE_2 }, +}; + +static const struct id_mapping vp9_levels[] = { + { HFI_VP9_LEVEL_1, V4L2_MPEG_VIDEO_VP9_LEVEL_1_0 }, + { HFI_VP9_LEVEL_11, V4L2_MPEG_VIDEO_VP9_LEVEL_1_1 }, + { HFI_VP9_LEVEL_2, V4L2_MPEG_VIDEO_VP9_LEVEL_2_0}, + { HFI_VP9_LEVEL_21, V4L2_MPEG_VIDEO_VP9_LEVEL_2_1 }, + { HFI_VP9_LEVEL_3, V4L2_MPEG_VIDEO_VP9_LEVEL_3_0}, + { HFI_VP9_LEVEL_31, V4L2_MPEG_VIDEO_VP9_LEVEL_3_1 }, + { HFI_VP9_LEVEL_4, V4L2_MPEG_VIDEO_VP9_LEVEL_4_0 }, + { HFI_VP9_LEVEL_41, V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 }, + { HFI_VP9_LEVEL_5, V4L2_MPEG_VIDEO_VP9_LEVEL_5_0 }, + { HFI_VP9_LEVEL_51, V4L2_MPEG_VIDEO_VP9_LEVEL_5_1 }, + { HFI_VP9_LEVEL_6, V4L2_MPEG_VIDEO_VP9_LEVEL_6_0 }, + { HFI_VP9_LEVEL_61, V4L2_MPEG_VIDEO_VP9_LEVEL_6_1 }, +}; + +static u32 find_v4l2_id(u32 hfi_id, const struct id_mapping *array, unsigned int array_sz) +{ + unsigned int i; + + if (!array || !array_sz) + return 0; + + for (i = 0; i < array_sz; i++) + if (hfi_id == array[i].hfi_id) + return array[i].v4l2_id; + + return 0; +} + +static u32 find_hfi_id(u32 v4l2_id, const struct id_mapping *array, unsigned int array_sz) +{ + unsigned int i; + + if (!array || !array_sz) + return 0; + + for (i = 0; i < array_sz; i++) + if (v4l2_id == array[i].v4l2_id) + return array[i].hfi_id; + + return 0; +} + +static void +v4l2_id_profile_level(u32 hfi_codec, struct hfi_profile_level *pl, u32 *profile, u32 *level) +{ + u32 hfi_pf = pl->profile; + u32 hfi_lvl = pl->level; + + switch (hfi_codec) { + case HFI_VIDEO_CODEC_H264: + *profile = find_v4l2_id(hfi_pf, h264_profiles, ARRAY_SIZE(h264_profiles)); + *level = find_v4l2_id(hfi_lvl, h264_levels, ARRAY_SIZE(h264_levels)); + break; + case HFI_VIDEO_CODEC_MPEG2: + *profile = find_v4l2_id(hfi_pf, mpeg2_profiles, ARRAY_SIZE(mpeg2_profiles)); + *level = find_v4l2_id(hfi_lvl, mpeg2_levels, ARRAY_SIZE(mpeg2_levels)); + break; + case HFI_VIDEO_CODEC_MPEG4: + *profile = find_v4l2_id(hfi_pf, mpeg4_profiles, ARRAY_SIZE(mpeg4_profiles)); + *level = find_v4l2_id(hfi_lvl, mpeg4_levels, ARRAY_SIZE(mpeg4_levels)); + break; + case HFI_VIDEO_CODEC_VP8: + *profile = find_v4l2_id(hfi_pf, vp8_profiles, ARRAY_SIZE(vp8_profiles)); + *level = 0; + break; + case HFI_VIDEO_CODEC_VP9: + *profile = find_v4l2_id(hfi_pf, vp9_profiles, ARRAY_SIZE(vp9_profiles)); + *level = find_v4l2_id(hfi_lvl, vp9_levels, ARRAY_SIZE(vp9_levels)); + break; + case HFI_VIDEO_CODEC_HEVC: + *profile = find_v4l2_id(hfi_pf, hevc_profiles, ARRAY_SIZE(hevc_profiles)); + *level = find_v4l2_id(hfi_lvl, hevc_levels, ARRAY_SIZE(hevc_levels)); + break; + default: + break; + } +} + +static void +hfi_id_profile_level(u32 hfi_codec, u32 v4l2_pf, u32 v4l2_lvl, struct hfi_profile_level *pl) +{ + switch (hfi_codec) { + case HFI_VIDEO_CODEC_H264: + pl->profile = find_hfi_id(v4l2_pf, h264_profiles, ARRAY_SIZE(h264_profiles)); + pl->level = find_hfi_id(v4l2_lvl, h264_levels, ARRAY_SIZE(h264_levels)); + break; + case HFI_VIDEO_CODEC_MPEG2: + pl->profile = find_hfi_id(v4l2_pf, mpeg2_profiles, ARRAY_SIZE(mpeg2_profiles)); + pl->level = find_hfi_id(v4l2_lvl, mpeg2_levels, ARRAY_SIZE(mpeg2_levels)); + break; + case HFI_VIDEO_CODEC_MPEG4: + pl->profile = find_hfi_id(v4l2_pf, mpeg4_profiles, ARRAY_SIZE(mpeg4_profiles)); + pl->level = find_hfi_id(v4l2_lvl, mpeg4_levels, ARRAY_SIZE(mpeg4_levels)); + break; + case HFI_VIDEO_CODEC_VP8: + pl->profile = find_hfi_id(v4l2_pf, vp8_profiles, ARRAY_SIZE(vp8_profiles)); + pl->level = 0; + break; + case HFI_VIDEO_CODEC_VP9: + pl->profile = find_hfi_id(v4l2_pf, vp9_profiles, ARRAY_SIZE(vp9_profiles)); + pl->level = find_hfi_id(v4l2_lvl, vp9_levels, ARRAY_SIZE(vp9_levels)); + break; + case HFI_VIDEO_CODEC_HEVC: + pl->profile = find_hfi_id(v4l2_pf, hevc_profiles, ARRAY_SIZE(hevc_profiles)); + pl->level = find_hfi_id(v4l2_lvl, hevc_levels, ARRAY_SIZE(hevc_levels)); + break; + default: + break; + } +} + +int venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level) +{ + const u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT; + union hfi_get_property hprop; + int ret; + + ret = hfi_session_get_property(inst, ptype, &hprop); + if (ret) + return ret; + + v4l2_id_profile_level(inst->hfi_codec, &hprop.profile_level, profile, level); + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_get_profile_level); + +int venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level) +{ + const u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT; + struct hfi_profile_level pl; + + hfi_id_profile_level(inst->hfi_codec, profile, level, &pl); + + return hfi_session_set_property(inst, ptype, &pl); +} +EXPORT_SYMBOL_GPL(venus_helper_set_profile_level); + static u32 get_framesize_raw_nv12(u32 width, u32 height) { u32 y_stride, uv_stride, y_plane; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 8fbbda12a4fe..a4a0562bc83f 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -61,4 +61,6 @@ int venus_helper_process_initial_cap_bufs(struct venus_inst *inst); int venus_helper_process_initial_out_bufs(struct venus_inst *inst); void venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us, struct vb2_v4l2_buffer *vbuf); +int venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level); +int venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level); #endif From patchwork Tue Sep 8 12:32:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 292967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 517C0C43461 for ; Tue, 8 Sep 2020 19:39:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 115A12098B for ; Tue, 8 Sep 2020 19:39:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vBa7YSUi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730930AbgIHTjj (ORCPT ); Tue, 8 Sep 2020 15:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730942AbgIHPyo (ORCPT ); Tue, 8 Sep 2020 11:54:44 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB778C06134D for ; Tue, 8 Sep 2020 05:33:34 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id z22so22235775ejl.7 for ; Tue, 08 Sep 2020 05:33:34 -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=NcEeOZgUSVybaozrvzLOP4ZsIw0NJzWU1jk5v7jntbE=; b=vBa7YSUiMOArxRr8RYn5eMWXo+v3zACwmzTxGkJE5TSuaR0Pvugz/dUS4+/6GX2aTT u1pNNYLrANE3rkjF7hrp2TSp60/UBruOyThfQKtkN6RrezEOioNm0wsqP3XUXPRb1+nr eSsqXB+AkojP3vY0Ui544eY3EIx27JaQZhbcr1rhWSMxfdxnzw1HN+vrHrjmg98sGffC 54p8qXVm/QErO+a9emGrfC0SCcq0mbB5oRJg9OLkW2wgIIzsKAMZ9DW9+TvgmhW3RWzz F6Y82uraV0LRFwBmlLbAV+PHNoFARq4y8oPrFzfjBFqSYBULrP1IKc464lqiGHUdHU+G 41Nw== 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=NcEeOZgUSVybaozrvzLOP4ZsIw0NJzWU1jk5v7jntbE=; b=AXjarDG08PPCbl0XnyaAS9x9ujikaSj3PCtxyMYDxgTbfXdW6TT0sbXntxsbVAaO1R i2i59vCusdJVY6lO3Ka2oEue8HR1679WJgy55VCL1MdhSl/h7Fw8Z21KE45B2HklvIZa tAclX8EI++KyhuBK87jLFxKLrrFEK+EXlKz/zhOd1OFh0EIGCU/BIr1fDM0Gs2lq5lo8 ZyAuT8DFhbdduI0FAjZGA9BZ7XUzs3i/TEwDx1Z8F+BsB97WbpVf/4IA3zrM2pevtLQ8 g/vqtJZT2VXhAIdMFB8b8+7+pt+fSxc3SfbE8SDSOSHAbWDzCVqoUZxjzkwoF7JElkZK ovHA== X-Gm-Message-State: AOAM5315v8zb10A6EorLm+Gr7FcDIRQRHjU1+SCfJvFNeX4+XXYBr2fi wKbPJY7BONTB0pLgKddrspUM1vkdAZjzzjes X-Google-Smtp-Source: ABdhPJz4IJDBT7vUASqEAhfweZQi4at//aV2U5ukkwEvWdJ28fgPl6KV05PWHdqQJOWQOQfX3foC7A== X-Received: by 2002:a17:906:2c14:: with SMTP id e20mr26923490ejh.205.1599568413372; Tue, 08 Sep 2020 05:33:33 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:32 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 4/6] venus: vdec: Set/Get VP9 profile/level Date: Tue, 8 Sep 2020 15:32:19 +0300 Message-Id: <20200908123221.2793-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Get and set VP9 codec profile and levels. Signed-off-by: Stanimir Varbanov --- .../media/platform/qcom/venus/vdec_ctrls.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index 3a963cbd342a..f3f41c1baa6e 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -22,10 +22,12 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_H264_PROFILE: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: + case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: ctr->profile = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: ctr->level = ctrl->val; break; default: @@ -49,6 +51,7 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_H264_PROFILE: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: + case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: ret = hfi_session_get_property(inst, ptype, &hprop); if (!ret) ctr->profile = hprop.profile_level.profile; @@ -56,6 +59,7 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: ret = hfi_session_get_property(inst, ptype, &hprop); if (!ret) ctr->level = hprop.profile_level.level; @@ -86,7 +90,7 @@ int vdec_ctrl_init(struct venus_inst *inst) struct v4l2_ctrl *ctrl; int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 7); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 9); if (ret) return ret; @@ -133,6 +137,20 @@ int vdec_ctrl_init(struct venus_inst *inst) if (ctrl) ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; + ctrl = v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &vdec_ctrl_ops, + V4L2_CID_MPEG_VIDEO_VP9_PROFILE, + V4L2_MPEG_VIDEO_VP9_PROFILE_3, + 0, V4L2_MPEG_VIDEO_VP9_PROFILE_0); + if (ctrl) + ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; + + ctrl = v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &vdec_ctrl_ops, + V4L2_CID_MPEG_VIDEO_VP9_LEVEL, + V4L2_MPEG_VIDEO_VP9_LEVEL_6_2, + 0, V4L2_MPEG_VIDEO_VP9_LEVEL_1_0); + if (ctrl) + ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; + v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER, 0, 1, 1, 0); From patchwork Tue Sep 8 12:32:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 292977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31992C43461 for ; Tue, 8 Sep 2020 16:57:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED073208FE for ; Tue, 8 Sep 2020 16:57:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ugYmjN2x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730701AbgIHQ5c (ORCPT ); Tue, 8 Sep 2020 12:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731789AbgIHQ5M (ORCPT ); Tue, 8 Sep 2020 12:57:12 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B451C061350 for ; Tue, 8 Sep 2020 05:33:38 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id z23so22196440ejr.13 for ; Tue, 08 Sep 2020 05:33:38 -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=sN4+mZ5uhIAG0/WLkYctbIQcbAJtPn6Wi3GZq31qSIg=; b=ugYmjN2xSHhF+21F3d6hVWxMmiUDsryJHIXuwRUHRfhQ4TYfF/9IpxodOQvAjPwnrN KYGdkGCLqQgm9tAA6RaKgQALDbF1Y+Cn+PsB/1XAaBeUMoTNKilxf92q7/WiZxmXyO3n yR9eS3xfO/9Pg8zEzTGnoj59wcp+w/zE4FztcOxZhmW6/74rwJ4GapCfZ2wzJnSLmPFP StSHAYcGuP0QuR96/3HVpfU1mGfHnbHCXPHLCXN/Mrdf/g+22eWx5vM0gfLgQme42lB+ BgXWfzPbr0Ip5OzxRgOsw6ywurxu4bv2EyqV3k6B5UiNvbYCYsW7TNOwS+WH7skgLnrZ 4t4A== 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=sN4+mZ5uhIAG0/WLkYctbIQcbAJtPn6Wi3GZq31qSIg=; b=kjkf+GMYBiCNakFNwQEb3eyuBfL8S41roOqNB22Nj3JtTPUjl68MvZBEQSaSh/QNm0 c3HZIMYNqMRztkCbZPnyi5xC87A4TYKDjnb7IaiZH2cAxYILAvgBo5aFXqdT4ieU554d JFCX1XMjUO1QsU+TcazWAeB7WXXQrk6KtIfzgeqherBgPvw+QybpSFItsNbE5TcC3Wil Xyo6Pep0PWdEsajcfGR79JFo33ReKMk1qwF9jqc+2TfHPcIb+QtK8UwdQ4QjtFOy9DyV KGlt6JjfJWvdFgTFInHedtncpbDAa2WX8W+rRpugfwipVin3UAyUQKTktksrnhu7LZz9 oX3w== X-Gm-Message-State: AOAM531huvSmlIbFE7WBaxxl8p2BNU8GwncNeXeH1+yTNRwiqtYv/NnT w0EIkzkPyar9qUWCJnNpUXCEe9IFr4/Lvz2X X-Google-Smtp-Source: ABdhPJxHtd4i992YKOwmkNVnGZRsMiLfUfV15eGwYacP2ySW3da2CW4AtHELAQrxAQUN07P6vV4aUA== X-Received: by 2002:a17:906:e103:: with SMTP id gj3mr25132826ejb.153.1599568416595; Tue, 08 Sep 2020 05:33:36 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:35 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 5/6] venus: vdec: Use helper to get profile and level Date: Tue, 8 Sep 2020 15:32:20 +0300 Message-Id: <20200908123221.2793-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently the returned profile and level is not aligned with v4l2 ctrl id. Correct that by use the helpers which translate the v4l2 <-> hfi mapping internally. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec_ctrls.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index f3f41c1baa6e..974110b75b93 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -42,9 +42,8 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) struct venus_inst *inst = ctrl_to_inst(ctrl); struct vdec_controls *ctr = &inst->controls.dec; struct hfi_buffer_requirements bufreq; - union hfi_get_property hprop; enum hfi_version ver = inst->core->res->hfi_version; - u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT; + u32 profile, level; int ret; switch (ctrl->id) { @@ -52,17 +51,17 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: - ret = hfi_session_get_property(inst, ptype, &hprop); + ret = venus_helper_get_profile_level(inst, &profile, &level); if (!ret) - ctr->profile = hprop.profile_level.profile; + ctr->profile = profile; ctrl->val = ctr->profile; break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: - ret = hfi_session_get_property(inst, ptype, &hprop); + ret = venus_helper_get_profile_level(inst, &profile, &level); if (!ret) - ctr->level = hprop.profile_level.level; + ctr->level = level; ctrl->val = ctr->level; break; case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: From patchwork Tue Sep 8 12:32:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 249303 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4726750ilg; Tue, 8 Sep 2020 09:57:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvAfGoMlGFvvLOYTAg4NzA2oTJU63T+E8HkyvEuFyPgFR/HU6PMLx0927uHE3mhN6whLHp X-Received: by 2002:a50:e385:: with SMTP id b5mr20742161edm.39.1599584255069; Tue, 08 Sep 2020 09:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599584255; cv=none; d=google.com; s=arc-20160816; b=yyCtX0cy8cMHRSyDNMpdi1+M5t9VroeWJ7CtofPH1JNczqfheU1U/nugc7ozxi+q7z cEPvscR7HHKZPd+YksaX/gOpNnGBiFPWF7Kctjw+jmOwRz2swpGWcRmbKfiyfsJjog8E uFdESbhsmlLwi/PqeMmIs1qBc6fCxFIzxyCifM9iZ0U2zrQJG9c+fSnO9GWgxe03X6G9 5jzQc81/qH8ZcOwygZtGhY2HtbhqsEvyBX5j75DhMkqOazBKCj4Q0MEhJIWskJ3+Lmyv vydAP6rBeCDNB/i3CHeOZBLK6T8nRIR1//iuUcxW0lnUI0uRq1OAoi7H4Ur09YAh0D5C ueTA== 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; bh=07BSV6FZ4poiSm+/jd7LwQlNgIEpEAXaLzeC1JvctXE=; b=QWzwiQpSQiM3UtuB38eeuOtUIqFCwQKk+JmucS64jF7GJfVyxxBvnP4aHm1+f8xfMH HRJswAZpzujf4ILXJizQAOluqyDCxZ20MXm6uO5e4Es/kliHw6fZ6JvJ9qH4/NBWsIF3 HDrjLxTZG7VycvWXR71a4b+weq/7U1UB8Is7TjRpYMai5BGye+je3/YoLRzzMFHroqHm ZGpt42D6/yGa6H86G0AfoJr3PBuj475MBWb5giUPNTRUwLqc1cTzPlC5zmVPyi7/a7sI WRbbED1u2qr2tBDGXjlgOy5C1mPsr83fa6Tle5ar+Ts7TS6cAOOz4Iq8uVoxWaapwuxD uuCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SMnPVAVq; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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. [23.128.96.18]) by mx.google.com with ESMTP id p61si6094951edd.188.2020.09.08.09.57.34; Tue, 08 Sep 2020 09:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SMnPVAVq; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1731807AbgIHQ5c (ORCPT + 15 others); Tue, 8 Sep 2020 12:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730701AbgIHQ5M (ORCPT ); Tue, 8 Sep 2020 12:57:12 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2B2C061359 for ; Tue, 8 Sep 2020 05:33:40 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id n13so15789604edo.10 for ; Tue, 08 Sep 2020 05:33:40 -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=07BSV6FZ4poiSm+/jd7LwQlNgIEpEAXaLzeC1JvctXE=; b=SMnPVAVq+CNLCQ0T1LSMvvpTkQRhfvdC957DRxw55JGRxDy5/pS2LaaThhquaUeRgM WT0sbDcx7fSYus/UO1AvvQosPZ0EcmhZuOnInyVngJ/1/+16lk5G/xTyvSpGmuyFw0kP z0wvXwOtokUqe+li/riRJvOUQ1GkXVF7mJShxVUPHps33vmyLliIi341pj2pw7U/1U08 eVWq/GTiJFsUVybw3vTBvXwyNE3w9pNuqW94qCtkFUZDG8an5lFUTOuwoB/3LqE+LbYF LXJmvjlJXYSq+12BX2+o0TnlANatNc0GXbdeF8ZLxNTDlfSetrbq11lKZH/PbAclQhli ouKA== 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=07BSV6FZ4poiSm+/jd7LwQlNgIEpEAXaLzeC1JvctXE=; b=qBnGcYr7jSebwmHXLSwVddv78m948jkunpVjeFHo2hVMIJDW92JPz8HU1Og2+iZgNi PQWUyV+zS6WNkLtPV9gDwCin4S9sM6tRECTFjXpOVkAvEPM1SegJKwz8fQ0y7rpaw0NZ 9ipjfmoMB75Sg6BMx/nJNnJ+hBnWPRGQuGnTpDKV98fj2jrTqKmAg7VlpIOLfRLqq0kN MAXklxMb6w/5gWg1PZ0f5YgMNBHdyroEhWswACgAbzlmVyD6LC8G9ebAsbQbUAmOBCjH qobMZaE/6zoS3ZUvidNaEmawGYpUy93SEAO+fDIzhDyCUBpuNyfC8RXddS/FQHmPvfFD Rn6A== X-Gm-Message-State: AOAM530bkzCVTOmKkXrijxVwGWKcvafP9WXLZxyJCMNcm2dDb5s2n67I txH6kC4rEJtWTDz0jbUxZFDPj7CCUuZxdSqO X-Received: by 2002:a50:ee14:: with SMTP id g20mr15064878eds.32.1599568419058; Tue, 08 Sep 2020 05:33:39 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id y9sm17499744edo.37.2020.09.08.05.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:33:38 -0700 (PDT) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Paul Kocialkowski , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Neil Armstrong , nicolas.dufresne@collabora.com, Stanimir Varbanov Subject: [PATCH v3 6/6] venus: venc: Use helper to set profile and level Date: Tue, 8 Sep 2020 15:32:21 +0300 Message-Id: <20200908123221.2793-7-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908123221.2793-1-stanimir.varbanov@linaro.org> References: <20200908123221.2793-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We have a new helper to set profile and level use it instead. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 13 +- drivers/media/platform/qcom/venus/venc.c | 159 +----------------- .../media/platform/qcom/venus/venc_ctrls.c | 14 +- 3 files changed, 6 insertions(+), 180 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 1a7aee7ee628..2e70004ef195 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -239,17 +239,8 @@ struct venc_controls { u32 header_mode; - struct { - u32 mpeg4; - u32 h264; - u32 vpx; - u32 hevc; - } profile; - struct { - u32 mpeg4; - u32 h264; - u32 hevc; - } level; + u32 profile; + u32 level; }; struct venus_buffer { diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 6b758a33397e..f8b1484e7dcd 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -113,80 +113,6 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type) static int venc_v4l2_to_hfi(int id, int value) { switch (id) { - case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: - switch (value) { - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_0: - default: - return HFI_MPEG4_LEVEL_0; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B: - return HFI_MPEG4_LEVEL_0b; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_1: - return HFI_MPEG4_LEVEL_1; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_2: - return HFI_MPEG4_LEVEL_2; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_3: - return HFI_MPEG4_LEVEL_3; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_4: - return HFI_MPEG4_LEVEL_4; - case V4L2_MPEG_VIDEO_MPEG4_LEVEL_5: - return HFI_MPEG4_LEVEL_5; - } - case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: - switch (value) { - case V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE: - default: - return HFI_MPEG4_PROFILE_SIMPLE; - case V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE: - return HFI_MPEG4_PROFILE_ADVANCEDSIMPLE; - } - case V4L2_CID_MPEG_VIDEO_H264_PROFILE: - switch (value) { - case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: - return HFI_H264_PROFILE_BASELINE; - case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: - return HFI_H264_PROFILE_CONSTRAINED_BASE; - case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: - return HFI_H264_PROFILE_MAIN; - case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: - default: - return HFI_H264_PROFILE_HIGH; - } - case V4L2_CID_MPEG_VIDEO_H264_LEVEL: - switch (value) { - case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: - return HFI_H264_LEVEL_1; - case V4L2_MPEG_VIDEO_H264_LEVEL_1B: - return HFI_H264_LEVEL_1b; - case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: - return HFI_H264_LEVEL_11; - case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: - return HFI_H264_LEVEL_12; - case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: - return HFI_H264_LEVEL_13; - case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: - return HFI_H264_LEVEL_2; - case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: - return HFI_H264_LEVEL_21; - case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: - return HFI_H264_LEVEL_22; - case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: - return HFI_H264_LEVEL_3; - case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: - return HFI_H264_LEVEL_31; - case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: - return HFI_H264_LEVEL_32; - case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: - return HFI_H264_LEVEL_4; - case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: - return HFI_H264_LEVEL_41; - case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: - return HFI_H264_LEVEL_42; - case V4L2_MPEG_VIDEO_H264_LEVEL_5_0: - default: - return HFI_H264_LEVEL_5; - case V4L2_MPEG_VIDEO_H264_LEVEL_5_1: - return HFI_H264_LEVEL_51; - } case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: switch (value) { case V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC: @@ -195,18 +121,6 @@ static int venc_v4l2_to_hfi(int id, int value) case V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC: return HFI_H264_ENTROPY_CABAC; } - case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: - switch (value) { - case 0: - default: - return HFI_VPX_PROFILE_VERSION_0; - case 1: - return HFI_VPX_PROFILE_VERSION_1; - case 2: - return HFI_VPX_PROFILE_VERSION_2; - case 3: - return HFI_VPX_PROFILE_VERSION_3; - } case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: switch (value) { case V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED: @@ -217,46 +131,6 @@ 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; @@ -657,13 +531,12 @@ static int venc_set_properties(struct venus_inst *inst) { struct venc_controls *ctr = &inst->controls.enc; struct hfi_intra_period intra_period; - struct hfi_profile_level pl; struct hfi_framerate frate; struct hfi_bitrate brate; struct hfi_idr_period idrp; struct hfi_quantization quant; struct hfi_quantization_range quant_range; - u32 ptype, rate_control, bitrate, profile = 0, level = 0; + u32 ptype, rate_control, bitrate; int ret; ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); @@ -811,35 +684,7 @@ static int venc_set_properties(struct venus_inst *inst) if (ret) return ret; - if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) { - profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE, - ctr->profile.h264); - level = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_LEVEL, - ctr->level.h264); - } else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_VP8) { - profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_VP8_PROFILE, - ctr->profile.vpx); - level = 0; - } else if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_MPEG4) { - profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE, - ctr->profile.mpeg4); - level = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, - ctr->level.mpeg4); - } 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; - pl.profile = profile; - pl.level = level; - - ret = hfi_session_set_property(inst, ptype, &pl); + ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level); if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 22a7c045c6a9..0708b3b89d0c 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -103,25 +103,15 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ctr->h264_entropy_mode = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: - ctr->profile.mpeg4 = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_H264_PROFILE: - ctr->profile.h264 = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: - ctr->profile.hevc = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: - ctr->profile.vpx = ctrl->val; + ctr->profile = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: - ctr->level.mpeg4 = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: - ctr->level.h264 = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: - ctr->level.hevc = ctrl->val; + ctr->level = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: ctr->h264_i_qp = ctrl->val;