From patchwork Wed Jun 27 15:27:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140344 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1028020ljj; Wed, 27 Jun 2018 08:31:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLqO3rtlyXJ8AIbLzvJOFHo+nMPdidLOEeTdHDhnQurmMUhaWEuI+sobBpXGw2GNHRuViwD X-Received: by 2002:a17:902:ab95:: with SMTP id f21-v6mr6498588plr.264.1530113472493; Wed, 27 Jun 2018 08:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113472; cv=none; d=google.com; s=arc-20160816; b=RbZbeM+YgrgeAcrpWetIaaYxEJ2fmNrnNMWg41R8ruPoqTsC/KI5aE+zXyzoNZbmRY yHRR192v6cOlEAHAQfHWQjae1GbccMsWffN29wrkMuU0Y330fQ23i00QffUVWNevTBLl 8q469Bwd0x22055IJ1TU2ckVBhIEnvb5TRFKLlmAZixHjMVa2/JWCnCx5NqQ5gkBkg2U rQ/j5wuEujqzd1XZ+W3BcGfhzfGHXCd+X4gdk63szvtK8J6zc/qgciM4ti7NVdYkCWXj jFDQnNodF4En4W/o1n6AnU77XHeLZtWJ9B3WxO0V7gp3mGePutfT1qjlXfNcvkOEB8PH abvw== 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=yeviQB1i4qFlBWv2VeJAWgdTShUubmTp478w7ArrqLI=; b=lqHreBWhWzG57OaNEuIEw6j/JuVzPw7iXaPKU2spGxWWJGngBzQMw4ovIY9BqP8OSq sZKF5lSM1y0mnoXHm/zg9J2E0OWWHHPnOYmuVZdcy6tj0OrPk59wYiN34a5YVopMSln9 8beTAoPVgCZyom42KxOy7akxKqx9Esg5WSn1tqChQDcakUaZ01H3dHlQ3vOgL4nvp5yk VhjXCoSO7phucJhwbDmZirCtttFUNGh384VND23afK3Ez3WUgJRii9/JvsgeKmHntmEN rzdAofNvC6xTZ90VoowgOuSMFmwQZlaCD96AQmWbBWVXY1/Ff/g2cY0FeT8K1lXaYLu/ afAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TJC4ZEbk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 g5-v6si3819352pgp.91.2018.06.27.08.31.12; Wed, 27 Jun 2018 08:31:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TJC4ZEbk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965329AbeF0PbJ (ORCPT + 13 others); Wed, 27 Jun 2018 11:31:09 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46848 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964814AbeF0P2W (ORCPT ); Wed, 27 Jun 2018 11:28:22 -0400 Received: by mail-wr0-f195.google.com with SMTP id t6-v6so2461563wrq.13 for ; Wed, 27 Jun 2018 08:28:21 -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=88FFyjErotOxDmhgzqLVFCd4JC06AOb71V78xZlxmq0=; b=TJC4ZEbkm1sGxQvl2k8EVuCJlD+hatEdz7a7JvMkMdx3Ylmu1MS+l7313Hi6EVTNqL hEH/0LvaWbqslRaqGaCah1WNny35XEe1xY9rxKs49UvhF3rWbWZiRvQY+gg/8ary/j5u YYikiIQSxRNfAEQoHfOhhMXM0WGPEstTJmyKI= 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=88FFyjErotOxDmhgzqLVFCd4JC06AOb71V78xZlxmq0=; b=o9yb3nkA9QYGKMG1s9If6r1F2mKuygK+ushteKNv8vIVVXvUVHsgzgvl8EatKVKE7r FdtVNnlEwtS8ey+3f5bzF47+F9hXGhoVHEjV/dfPX6ieC1jnKVNHt8oKhfRf9zuImlMQ SCKIrj+1ezN0twYDM/PyQ2hB9rKxu/TVF4EknYpT79zy990qo8ovdJYmf/gmmBmP/7X4 4uEp/W4BjmuI6uFYE3mKHoxP52cGx2lwjip/hbbAVL3szDjSKume7DRZxfm2m7vU7kX9 eUg5p1iuiwSxAm1yLJuhukQadAWtrJ5/X2e3AZJ6XBncE9kHtWZXKprdJlujWHYkb9MS LL8g== X-Gm-Message-State: APt69E38xS3YP6ayVAQQU0mYooeRusXhoUwOHfXBSXcdUFqaDf7eMobY rQAXapkoq7Pmnr8+DOvosTf9Eg== X-Received: by 2002:adf:83c5:: with SMTP id 63-v6mr5421072wre.220.1530113300763; Wed, 27 Jun 2018 08:28:20 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id o203-v6sm2916075wmd.30.2018.06.27.08.28.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:20 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v4 19/27] venus: helpers, vdec, venc: add helpers to set work mode and core usage Date: Wed, 27 Jun 2018 18:27:17 +0300 Message-Id: <20180627152725.9783-20-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180627152725.9783-1-stanimir.varbanov@linaro.org> References: <20180627152725.9783-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 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 Reviewed-by: Tomasz Figa --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index a1590d5cc921..2295cca3c22a 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -481,6 +481,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 eae9c651ac91..f1cf4678d013 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 1d7f87e0f5b3..4f0a5daa97e2 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);