From patchwork Tue Apr 24 12:44:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 10359527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6C7F601D3 for ; Tue, 24 Apr 2018 12:48:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6D7B28DB6 for ; Tue, 24 Apr 2018 12:48:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BC0028DBA; Tue, 24 Apr 2018 12:48:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 253A028DB6 for ; Tue, 24 Apr 2018 12:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933207AbeDXMs5 (ORCPT ); Tue, 24 Apr 2018 08:48:57 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43976 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757860AbeDXMpa (ORCPT ); Tue, 24 Apr 2018 08:45:30 -0400 Received: by mail-wr0-f194.google.com with SMTP id v15-v6so31694094wrm.10 for ; Tue, 24 Apr 2018 05:45:29 -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=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=K5zkByJkIWRBiYoW8GhRAduR5uls9LRt0Bqae9twtcbowjFpXy8XQQ4hu0qi4Lo1F5 rdq+yaYu7YIYifhpcq+8AG8tSpz8aFg1vQ0WthqnKrWZC9GKJQQAl9XWw21og1Nf1Akn k7o8m+GFDnlhBKdFMVkih/7qwr9LpqXOGPfIs= 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=E6MkggzS/K/ebZ56K2ogSp1CwxIKbW/hp68ey+BGUis=; b=fZIsrup0Gr9x/HSLYRqSUAR96GdkMp0RThB1ogpBvPTeyML+cI6pGptnay4zzlK0Gs IfFqyFP+G4zCQfA5khErgKr7s0cWAKDIQKqtQW6wfdRw7YcqVXQy+lwRRrdgRgAkwqju RG2QkCrnnDcON55OvcDa/AvL9/VbfhqqUkXFrH//W7WwnOal7aK6yiqnPwvN+0/aHWJx 8rNklITD21eeIVLzIg950BRqVpK9rD4telGPFRZVicFX1165jEFyUut9yCx7oX/pZEpf K8nMiNND8n450Tos5sg1R/HV8u9KjNZPGj8cLMkMHLkGZSpo5nNAMAD4GVU/oKgHDsje T9mw== X-Gm-Message-State: ALQs6tBmgNxnxeXa1v3BECH2mTyRq+wmz0M/rNPGsE/jaUxo3PkVhFpR MJXJQz6NLvi+epVjTbWOU3QDtA== X-Google-Smtp-Source: AIpwx4/bp+1eSQY8lVCS5j13/JvcX2e01YINHBxntiNNySDBGjGQxYyDbrKDzIUZLel/6uZfC3n6NA== X-Received: by 2002:adf:8bce:: with SMTP id w14-v6mr20301937wra.169.1524573928804; Tue, 24 Apr 2018 05:45:28 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id n49-v6sm22666013wrn.50.2018.04.24.05.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:28 -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 20/28] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Tue, 24 Apr 2018 15:44:28 +0300 Message-Id: <20180424124436.26955-21-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424124436.26955-1-stanimir.varbanov@linaro.org> References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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 b43607dee4fe..ceaf1a338eb3 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);