From patchwork Tue May 15 07:58:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135844 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp673031lji; Tue, 15 May 2018 01:04:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqUlwGJhe2ZNB0a5AMRHfTTChTHgYoVd0jYCAP2XzRXLJ/RtbAYkJH4jf3OleObc74sQ5/w X-Received: by 2002:a63:63c5:: with SMTP id x188-v6mr10889095pgb.302.1526371490250; Tue, 15 May 2018 01:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371490; cv=none; d=google.com; s=arc-20160816; b=wT7KQUL6drY0Pa086u537yvb1Q2xuTyT/bddhWuGi4Qv/hxbCLfI3UEIik2yAdYPeb Qukt5fy8izGW40lg0GkT8GVwy2dQw0c2EtSjlfzF38ogMFzI47ffJng2AlNfze9zvao/ p6gQlIeBSm0GaWkss4VQ8KraOS0jF4C2rNBZIBXZa7AYWn+bJfn5YZ4oOmobqPpZyxAi YyWUgm6w4lxMqnIrPNLDN2GlxjVlFvvzyCYZO10lg/lKF9mQe7wms7vsBBV8x+6kptHc UrTCnciSdN2H1YmlWYauq2Xutd3OrjUMAa4Kxrsh/i+L6/t/w9w43cjnKjabxwh9TjNh hW9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=X4LIT4SzgeZT+77lAjwEzFmQU4hDuXEv8Jffo6kHKgFPttkOrtlLG8yPjBhSHIegd2 gLxKboJxXaZGJrFro48drvhw7vpmwS2qO/UxrNEHvFV7GBZKPs5eawptVd0di8nGBcYF xV2EUyY6U9f8IfrSjgtreYjDXEnlTaV7UiPsgJ89IKUXojvdpBRvpRw6p8PPSCDwpLbX 8yx5oaHPLjwJHgAd1iJilZ8o6MYQgegEIfGi5pV3J2GBhR3IgTqGJLg04jQWF25dlTRX QcY8zfoAdAl+S8JAxQMXJG4aCAxh3ST8jHMLLIAuTOG7mduGIk6ldie6IAeRV98NDzz3 OI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9Ib0j7p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si8905180pgs.308.2018.05.15.01.04.49; Tue, 15 May 2018 01:04:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9Ib0j7p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666AbeEOIEn (ORCPT + 29 others); Tue, 15 May 2018 04:04:43 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:44869 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbeEOH7v (ORCPT ); Tue, 15 May 2018 03:59:51 -0400 Received: by mail-wr0-f193.google.com with SMTP id y15-v6so14880718wrg.11 for ; Tue, 15 May 2018 00:59:50 -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=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=P9Ib0j7pr0I3GUJQbRmdPsgCU0dE9O5OjUIU8MnDWdbEjmpTcmTVk/DC6e5hq1SYmO 7nPZ4ZD7OY38V0tX4bVywdxeMNj4beqaAnzXnhxOI50W67uEA9S18LNzTNRg4WZ8w+Xa wfwteJT7YjbDwwVB1unCvdP4HnNZtYzBrouBk= 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=LRKdSFC0W7+6iXp+TLBSpemgpy27cGrdsW/F6vKvVU0=; b=ITB0Y7sA8pDvngNcMnwgAQ2Rw9v4tUyX1e89ppeUmWBGHWKwBe/fsKdmFva+aEeYQ9 BDRqUpv8FESnYMcxf4pt0j2BDIq1pcjLGcrH9cEjv/oP2F06AcJhao8DqE/WGFcibtSs 0yTIDjY/z6+5FKcLIWap5HKb7M4T2sIyuQzjEensuO3JGD8vlvI79EjJILhQskYie5JQ oiDdyn3w/u8IhK/ZTV7hHPVOugl3p+xAL2g4+RwJHTxy3XoHCVEhqGvPDGK3JSRawGu4 REAOuTC1OcNRPzk8JWgLAxf2/qI1HhOcT/7qlZcTAktFCl641kBZ1MIjcXmEWWuiqC48 shLQ== X-Gm-Message-State: ALKqPwfSkYTVhcXX+kT3hImQQUp/70JZivP4G/i383+JwwCnZ6sCkq63 TM7avzX070zlwwiznmCjFrW2Fg== X-Received: by 2002:adf:e549:: with SMTP id z9-v6mr9085642wrm.186.1526371189918; Tue, 15 May 2018 00:59:49 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:49 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 21/29] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Tue, 15 May 2018 10:58:51 +0300 Message-Id: <20180515075859.17217-22-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are new properties applicable to Venus version 4xx. Add the helpers and call them from decoder and encoder drivers. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 28 ++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 ++ drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++ drivers/media/platform/qcom/venus/venc.c | 8 ++++++++ 4 files changed, 46 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 0d55604f7484..adf8701a64bb 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -484,6 +484,34 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, } EXPORT_SYMBOL_GPL(venus_helper_set_output_resolution); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode) +{ + u32 ptype = HFI_PROPERTY_PARAM_WORK_MODE; + struct hfi_video_work_mode wm; + + if (!IS_V4(inst->core)) + return 0; + + wm.video_work_mode = mode; + + return hfi_session_set_property(inst, ptype, &wm); +} +EXPORT_SYMBOL_GPL(venus_helper_set_work_mode); + +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage) +{ + u32 ptype = HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE; + struct hfi_videocores_usage_type cu; + + if (!IS_V4(inst->core)) + return 0; + + cu.video_core_enable_mask = usage; + + return hfi_session_set_property(inst, ptype, &cu); +} +EXPORT_SYMBOL_GPL(venus_helper_set_core_usage); + int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 79af7845efbd..d5e727e1ecab 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -38,6 +38,8 @@ int venus_helper_set_input_resolution(struct venus_inst *inst, int venus_helper_set_output_resolution(struct venus_inst *inst, unsigned int width, unsigned int height, u32 buftype); +int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); +int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index e8e00d0650e9..3c7ffebe4bad 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -550,6 +550,14 @@ static int vdec_set_properties(struct venus_inst *inst) u32 ptype; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_1); + if (ret) + return ret; + if (core->res->hfi_version == HFI_VERSION_1XX) { ptype = HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER; ret = hfi_session_set_property(inst, ptype, &en); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 8970f14b3a82..3b3299bff1cd 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -643,6 +643,14 @@ static int venc_set_properties(struct venus_inst *inst) u32 ptype, rate_control, bitrate, profile = 0, level = 0; int ret; + ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); + if (ret) + return ret; + + ret = venus_helper_set_core_usage(inst, VIDC_CORE_ID_2); + if (ret) + return ret; + ptype = HFI_PROPERTY_CONFIG_FRAME_RATE; frate.buffer_type = HFI_BUFFER_OUTPUT; frate.framerate = inst->fps * (1 << 16);