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: 249374 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4844346ilg; Tue, 8 Sep 2020 12:41:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpDRoZhlT6HpEt32m3/S4Lolvc2idFpxh4qsO1RCcprQyQj0GGXHJ5f5TLljApljUMNLlU X-Received: by 2002:a17:906:692:: with SMTP id u18mr24728ejb.43.1599594067542; Tue, 08 Sep 2020 12:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599594067; cv=none; d=google.com; s=arc-20160816; b=T9mNHsMJAmKlPljLQNNEDi4KcCcDyZmO/0PwN+usXKahvXMGVu30FlAnsYhVIWiOdj thKxl4KUufFtbhFDQe4GUTSN469s0Nenf4h1R7tOmMcxhOUJHmHWsBAsgLtPSVrMnkRh TcEKFG7dJZmraFwkeTPaIuo3URaKeHqVomYfANOK6d/6Y0TWgguKiqOpUijrS3oOoXp8 mvH77o4DL7RxIr53tlJFL+KddredvejHSiibeFIpWlp4LhzLrccDdQ0q3h/R7zMcFLJn SJl2qdkK1sE3MCwQ7rLlzGdYSclUSWtcjNZZiDOK8bOwlV+9Rs+GVTUi5wZiHMH2GXO8 l34A== 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=1+TohLeDYlN1Yf+ps+jhwsXTShnc7sKaopngyekPTD0=; b=OZG16rxk+4pbwuWpZsg6egbicdt4/puP7A0fg1hW23fY7MEwBkQQheNjuzzfF6EVmZ jmvEubsXO/Lc1Zmh7tRsMGBR4AhTfxavh7x/TZQ5EVEGOMIAbbCdx7MiPmjJv2jLRZlJ SsyQWU/OtyujyLBi0WSO/icDM2j5njDMzRGa382HXEUPP75AYhW8a4kCvJpMGr5GFAEZ Rk1ALE/hvuYcvI4DF6BGSjNBzHJ6y1H4hjUFZuJiRcLfDnz4+em/FdrF1G0og2H4+6Z6 TcjpmyKQ5isPRsMp9amR5ZdncEgxHXAvHFytx7sfC6SXmFkwyYm280Y/nsCl0OE0NhAd JPUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m9ej34LW; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 t25si398ejs.675.2020.09.08.12.41.07; Tue, 08 Sep 2020 12:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=m9ej34LW; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S1731696AbgIHTlF (ORCPT + 4 others); Tue, 8 Sep 2020 15:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730935AbgIHPyn (ORCPT ); Tue, 8 Sep 2020 11:54:43 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA7F8C061346 for ; Tue, 8 Sep 2020 05:33:30 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id c8so15798664edv.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=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=DS48r9nUAlvnGLMioIIwdr9Wm6oGc/5n8Yo3w2ehASvcp3HgY5FaM6MDUTp0qswkqb xUgvdUG+V+KfsgT+biqfY2JgkYkdMtj8aTom7GeyKFppicRwkgduHKmBz1rtvrQ9cDA8 4DYUroBS4tJRXgDd432N4z0+y8bYBgv7Y/jMipfo3pt4wMOW+MGO6CGvnFe1bkhhw20U YXO8c+un2YIbSeEPIFLEIJiWTVXqK8Ai44xTdC7oNlMGpl97ggm9ODCqAE3XSUsZ5cAJ miuG/fAiisQi3HtwYd9sq4g9Am3MpTJxhrFztllL0NCmN0P72ZwFZAwacgJnoa8EHa9b IR8A== X-Gm-Message-State: AOAM531AweX4JLB4qT48IKcrxOr0ZygEkiCtNITGXQxG3XzUs2VwSoCV XB2DQR8WfRHP1j4BqOSYnAMrBw== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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(+) -- 2.17.1 Reviewed-by: Hans Verkuil 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: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: 249301 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4723594ilg; Tue, 8 Sep 2020 09:52:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmh5uwOXM3k9ocydwma4m9pTeJRZnVKhSFG1flGBaozJ8tUSVXVtt6asTY5vxBRAfR69d6 X-Received: by 2002:a17:906:c1d2:: with SMTP id bw18mr19282194ejb.240.1599583967396; Tue, 08 Sep 2020 09:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599583967; cv=none; d=google.com; s=arc-20160816; b=Tgwmaa20EN6WO4MjfqbO6qRnqEe5xv6euTzD0VlFJMDvApnAYMYFLT8fuRJxp8LkAq /J1KmcYLI4DdwI8ZJZoD/QOOmS/YXs8y21nBuPrBBdbXjFjmfUTs4N/aFyzZ7c84/vpD j+Im5oeQuRwMlgscw+4wtPMDobIQaHvQ+YEg1gYxIdwmUZc0f1FzWX1OhEKhqqq6+PUY Hbr4lQxddpfp2BITF+35TsHpnQCKstOE6BrOZvXj2UTsjZqia78O/uwIpgWlNixRbXr7 LLssEBwjLq4NceXVHATNynkB7sqO5i+s4Czer4l1BKWXQsxtzki5hUn9VC4OF7lAdFpu NJwQ== 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=Fz+8NPEyMXT6oRM4AXxnNIphaeEA1r9ivq1K+4WHmCo=; b=ERDuaOic+ZoMy19yEsoFRoeiHdryrTTc1lRcDK6x4ELOphaZjUtcxUE5dyUDKpXYbH 6L/UkMKUikQ4PoPya2Bay4nty4bb/S8PLkuKQTneRzUyFxa0gVXZORgUEdt3zLJE1dYn ttTlpciJNYvgr96+stN/ewiNv95DLlseiXwfAISgcVo05ZbKD/WtJMbYLsmFSjvSRlhu BzghTBqH8lHI8f6uB4Y6ayjUcAu82dYZplTJVkOHn53ezWjv6NITA5XjlqiVd/gfeHT3 bcXeo9EA9/kWGaWqBI3eHlD+pU+njnbHO3F5FACd3/iiE3QMom9aV0aLavNDR4Mo5EeR KeDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CqzgBHY9; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 qt8si12160851ejb.159.2020.09.08.09.52.47; Tue, 08 Sep 2020 09:52:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=CqzgBHY9; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S1731977AbgIHQwn (ORCPT + 4 others); Tue, 8 Sep 2020 12:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732091AbgIHQwM (ORCPT ); Tue, 8 Sep 2020 12:52:12 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B09EC061349 for ; Tue, 8 Sep 2020 05:33:32 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id y1so2738145ejq.2 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=CfOSRoRLl50md41m7ZtGagBVKqwd6dba6jWD5Hcqy33CldL3kqLqP7tzaJQg853tpg cYJuRYYJyR/ZIm4lXLoU+0NVsnE4/suO1hlzcfrKva/yyO10oOyy3B9NHhF64WC+H2Z2 vOu4yGXVEKJvRSdXp4ZEhVK4LLBep8MXkuTeadubIyPKPWPdLHLlmwMtmFJGew5gj3DA BnooFcLeY4LNOMYVSc9C8IPNj4juHf9B3m1bch3mNvamgnSvw5PAWQob9b1wPROSoe1V HCcTRIPF1FIPpTOT9K3/rZ5vKef7Hbfdz5rhJoOSllYNAk5X0uqHQQy0BDFA8om2wWs8 e9+g== X-Gm-Message-State: AOAM53158yQjJHdqyQzrDUTBkBqw4LGfQQWXBkcq2rj44v6xseUw5bx4 w/x4qxeuZCAVDGu8U2E5dzraTQ== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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(+) -- 2.17.1 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: 249372 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4842179ilg; Tue, 8 Sep 2020 12:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjqMK6cMRckfDrnVrqVJoA+FtcVrfyvF2jLGnJUJCuDDLPTg5UgQ0RpoeKhXc7mRkq1mr0 X-Received: by 2002:aa7:dc05:: with SMTP id b5mr621551edu.137.1599593839203; Tue, 08 Sep 2020 12:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599593839; cv=none; d=google.com; s=arc-20160816; b=Q3CmTVYi/wRRSI1/Tn304ZB5CMj71zy9mi6kgL53ygz+tgiSk/ZRC0cmGc67cCixQt QdugY/tzL8/oHl4I7d0DXawwECM9/4eyAHCioSKCg2SUHelRIaL0YlqN86tjzyay+5vQ NkXLOr9uCCHHit9Qrsa0Ha02rkVShrauyxZN2lYgMVR1qqyrRHotLO4pj2ggBvIYlB1O QT7zTN0A7UW8S9bLJbesKu2N1zmE0g4EJOsAGMQRMRNbV1jlbVDieCzF6FPnKnE6wr8R wT03X4y3dn6dbanCXfaioQfEQlGU/JFQXljwsWDK1JXTFw9DLu3LwEMHOart7nOOBBPp 5ijw== 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=NcEeOZgUSVybaozrvzLOP4ZsIw0NJzWU1jk5v7jntbE=; b=bJfFNCnRG3MkN3IAPgCYEubHJawviLp3oGBx6aVYYzvd+HjJ3p2YCEkOdjgnx3VgJa xe0nfPrn6juTA+e1953PTz0jPmLhqi0yA+VnBTwuarR5YpaRpJ7n9FOa1iyj67qlBA8J Q//YNXJrfATK91ypJU+N17+PrMJ6hjc8qvvbQCDR6cg1jruamg86JkBIgp/LPkNG7r2N VWSEYqWmVbhFxiOolQBU8a/FIfxdi7/p1ZuBlBKU5Mi2jydNPl1Yy+H/zFKCTAxMwKIa sirX/4EQHvJQziQaW+9ScYI+MvDGfvj5vDukJRM8na/+lAr2pIXie4iVNukFa/mCHKHX TIyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vBa7YSUi; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 e4si52464edq.182.2020.09.08.12.37.19; Tue, 08 Sep 2020 12:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=vBa7YSUi; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S1730851AbgIHThR (ORCPT + 4 others); Tue, 8 Sep 2020 15:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730943AbgIHP4x (ORCPT ); Tue, 8 Sep 2020 11:56:53 -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 AABA7C06134C for ; Tue, 8 Sep 2020 05:33:34 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id y1so2738314ejq.2 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=r84mzK7pX7gAXw60sxrQaf30ZbvYQbbNaRAKrZmCVVGpGaktTS8Kvw5o8zwvpP9JeM mSoLQDqjIcaUU0VfGSV9P9DjT61iisLE0K647cGjCCob8PpSOzoLhOPqHvo2hyJuJErs 5MiiexrF3ekvb5sN+fNXJZJhBBIO6clqF3NtM9AyJJKdZFiL4civ1sSmv95ZQ65On94H 4FvRos0EAq8E3LF/Hsd64SP23zm5pATa5yk3XVqS4znmnPpqN95+u9W7FK8dvbXL3aug KLBvU6Yf2Jus3yJXtjcwaPNfu9TndBEXMkxh4X3QyMS3paL774bDKYnbgxFn1ax2HG94 zSBw== X-Gm-Message-State: AOAM532Rj7gBlHGYEZ9dED4IDkXTfFuxdp87w684ocOWEJx48xV8KASB IhrCvhVCRM5RIum7oHvCA/FdzA== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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(-) -- 2.17.1 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: 249302 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4723763ilg; Tue, 8 Sep 2020 09:53:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlTR9vbDfWlhLZpO7QcvpeaNqnM78S9j4gWj7Q1KbU3HpRQo/t51OgcGBP3mqlxty3PQmK X-Received: by 2002:aa7:db47:: with SMTP id n7mr23944333edt.315.1599583984313; Tue, 08 Sep 2020 09:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599583984; cv=none; d=google.com; s=arc-20160816; b=OKEg0mvgDGYZwSdOGZsBlO7Mg0kL5BCL9iABU5jNNDPDqjjCwmRs6KKR/CHL4x9tfG O8bhdcuT9gUgXhe+fD7aE2hnvlxGrkv6HEBhNrFB5yUQiDKb9qJzZRU1n5CG2q5jcUYk +NKrFz8C/7GHHiYB4W4hjHk0TQIO1GQ+S02fb7kvZQKPQFpvZQggP/3hxvKuKvIaIkz/ Zz4qxG8vSTHV8ukfdVSw+RTBoyCnsm2trf7U1tgFhvxk8zKjh4NBmFY7bs1AzUm8OlEQ 1dOjloL4oILJ7kD7GXjrc1OWC7KIfNWQkH9HsIrU+OZuSauLW40bs12xHWV243cSyKlc 0X/A== 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=sN4+mZ5uhIAG0/WLkYctbIQcbAJtPn6Wi3GZq31qSIg=; b=MDza9LTIWdyn4mKOb8XzQsWjoZWjgRBYKQ0OWdCbtOYW8rEHkMf9fWh7swQKTt52Ln 2ftQtLb0wal986hz4ki1NPJfqv0J6/JKB3PMIHWInj4aBSaivSPQTxbdiwfYo1pHf7AN P+nHKvt62qgJ7BPFaOa0SF902itmp8mVa27fOln/p95mbhcrEL4Zruzm4gSK+7v9ZelQ CyJpegTA/EeYqVh96hw+bANHtxKjJaUl17vpzU5mkiJII+o4lP9EqtoCklklmkl9lMU+ QQ+8uqsrCWzu21mnjwJo3Jb04YzuiT6x8Pa8pPxepetrhOPQqFT4tH3r8lm17cmtu10P iYvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ugYmjN2x; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 k14si11871695edr.96.2020.09.08.09.53.04; Tue, 08 Sep 2020 09:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=ugYmjN2x; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S1731909AbgIHQwm (ORCPT + 4 others); Tue, 8 Sep 2020 12:52:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732090AbgIHQwM (ORCPT ); Tue, 8 Sep 2020 12:52:12 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8633C06134E for ; Tue, 8 Sep 2020 05:33:37 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id o8so9060383ejb.10 for ; Tue, 08 Sep 2020 05:33: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=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=QPdF48VHTZY9F0qP4s3opYXKFzcKcl8RguwAMhPt+zep0PsXZwZwEwWiGR/L6OB2oC +OKKxTxTfy1QPTDxv0+pVmZ+Yl1I8wTZIFnF4GZHlsc/aUYEzFGcEHmNnY1C+Ez69LbT IyoHE4TAuxmk1xhmBNUc3xJA+FS7aTefDsWWUXYb9vwN5WBhAOC7FS4zC5NomKpIFuGi GHMTRZ622/xi5QupbDsWTnxtigyKFoBMnN0titqj9re2KDPjewB9J226WlLt5zY26F5L 53o4VNhuK3rH1FUDMXz8h9aQ2gED8t01t4NuExHKEtYsI+dpFLFi/DPHpZ7KOXqkmCz+ AnCQ== X-Gm-Message-State: AOAM531ruXIPP01dV9x0DDPJamGQybDPv8RieAw8Pg+rPk1MvNVfmnJK NIjqagkOLB36vnordh2DH/e0Aw== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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(-) -- 2.17.1 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: 255876 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 B3791C433E2 for ; Tue, 8 Sep 2020 19:38:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79B5C2177B for ; Tue, 8 Sep 2020 19:38:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SMnPVAVq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732360AbgIHTit (ORCPT ); Tue, 8 Sep 2020 15:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730957AbgIHPzg (ORCPT ); Tue, 8 Sep 2020 11:55:36 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 623F2C061358 for ; Tue, 8 Sep 2020 05:33:40 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id n22so15825888edt.4 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=D5L18zYccJTba7YTZWOvcHXKmuU2yetCwUEdpcStOBfd4DE7tB0is+/lrTQMFvxpHv XNzA5hencJdqqTEvolaG58GrROw0KkoMIMHXl1mSFJCvOqF+Xl1Film6oZtr3DTMlpM5 xvYt53DLIFkBK+hAfzdlv5IFJCjkjQcMtqTiQamcpMP8F8Qr48Ie0qWhaO+QFyQym4GO oInI2wS8bqxD3LKJZd4RCRzPmKH+KkqE4ZbE4gHlwC1pmaMDV0LCeGbTX6xFRumRJaLF GgY4SzcUq3nBF1A0VkJlklS2TmnKt+rXwT3uVf8X34m3btvPfd4W/nuYFp9vprh5UdDD mCpw== X-Gm-Message-State: AOAM531fZKMprv1OrU1ZIInzTIySyTmZCaPSD/M7yBIZrzDUNYVGXnv9 mgiu0N9mlJb0uR9wgELNF5VBqA== X-Google-Smtp-Source: ABdhPJylpKUjFNTj+4ln7S/mA8s9ebnd7qm/7712WoMGQt+HTyZC3PQpWuLcRKlwleHYGksF7zruIw== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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(-) 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;