From patchwork Wed Jun 27 15:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140347 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1030665ljj; Wed, 27 Jun 2018 08:33:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKUpOLf8JZpzuC/ksKImGwFmbSOalwFCop/QQ7+pw+cXQu/1gg6aZY4fd4MfuMk7YGd1Iu X-Received: by 2002:a65:44c3:: with SMTP id g3-v6mr5587936pgs.231.1530113605045; Wed, 27 Jun 2018 08:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113605; cv=none; d=google.com; s=arc-20160816; b=eSnO4Q0tYqzCH+yvYr3EhYTiY9ryr4WIPYxiNf7PCuYwJVBZ24bZL+nnJVWc4od5er Mkqn2WCh0lltGpsmQaHzEz8XkeJ3G6NXxG/X/F5bjnnJtpNaPwk4fvZm/sTglra3DhKr Wf2GixfMj4kw0ZRb9UUJtZGCRY1HGZ+GhVl6YeHSEYU8L1rH3KEu2D4XUnz5jgzb0tuY WUs3nYOBDBDehAffrneNTmglmLCfggGdOBiiILErVUqk2UJepb0yD75LR2wWVMOxcLbO KgGv/86ZViJp+x3hew4vBWahDvTMDV+W1Y+kX6dat8wRSsqiax5yEid8lg6KL2EMiV5R 5Rcg== 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=yh5Y1r5uz+JrK/BbOAzuU6//JjpR3Eo/scoSz5Qmbxo=; b=avoTbQbDP02LikCSA/JXeeuX3BFV9HYvbhqr2rgHZuX4SWmvJO2gyoKTdU3S5nmzIv 08FFq5l47HgV6swN9GAk/il9jMJdfhoIVDyR9mpGWg2GgTSaR5jScNr7td06wQDjwm8v GqWldscq+jL53onsEkLaYr54qC/UXK7N9rHgPIqEP2GQhdb6MAvUJ6fCpxZ7WVUCc43F K0CxCZAPIbUcNO67pTqVCKXqrIM0180LhWMvJWm3lLUYCnNh0mXuRi7ZrWc7TkJOLyTq Vmxb9nzJzEDyAmk2OV3bWIKoCQxRljYmFdqy+7asoAxZwlunumTvBSzF7ebyFXF2mvcM d7gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MkdE1Qsj; 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 190-v6si1202191pfe.136.2018.06.27.08.33.24; Wed, 27 Jun 2018 08:33:25 -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=MkdE1Qsj; 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 S1753232AbeF0PdW (ORCPT + 13 others); Wed, 27 Jun 2018 11:33:22 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:43059 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934850AbeF0P2O (ORCPT ); Wed, 27 Jun 2018 11:28:14 -0400 Received: by mail-wr0-f193.google.com with SMTP id c5-v6so2463412wrs.10 for ; Wed, 27 Jun 2018 08:28:14 -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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=MkdE1QsjTmOmf+d/s1S21lCHKClpD/AcqM70krJNgJddYgavMPkqFNgHJfKBeEG7o8 faAElo9RcrU6hHjp/6tkNjw3ntrw+S/Um2o1l4fxuSGfWD9SuHl7B5SjRlFnQmbLGJDO WSQcvR8B1tvL+lFFyuZuORzci9Y74y/PYTeYw= 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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=h6z7EqJjL89d/Y7wPQE8kfs8gmlwFPumcw1CH3UzFi8w9qWfpukfk4zkV7CAEgcsvZ FyY7HLBmZqUqSBnheZA+leZ2LoBn/mdrEmdqnCyHkhLGZ9jdAJvIii8oa+Us5jU+W7Y+ TuWWkINsVHjvPcCxzrxM44J5W/g/oifxvgzhKmNOvFxG43+s+ePu3H4YX2lvmU1ooGxo M6GD1HOqC4LqDpj63vDUGqF4yZQ4Tb8VhVMTGa9yFT1foBp6+BZNd+PIidWUOncHVpgP paVgHmuFWrNvMCpeQE033CkplRSs7i7zKHSRXDA0KkSoz0vNhbPhyd18YJ8Shm99MtX1 WKNg== X-Gm-Message-State: APt69E1FL+3LHvTLkt3hB/Y8CzJwQLWkLtThsRSKpLhfpPM8tJPkdi7B VJeancc+l2vK6Av74DO+/bhzyA== X-Received: by 2002:adf:8f2e:: with SMTP id p43-v6mr3463885wrb.193.1530113293515; Wed, 27 Jun 2018 08:28:13 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:12 -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 13/27] venus: helpers: rename a helper function and use buffer mode from caps Date: Wed, 27 Jun 2018 18:27:11 +0300 Message-Id: <20180627152725.9783-14-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 Rename is_reg_unreg_needed() to better name is_dynamic_bufmode() and use buffer mode from enumerated per codec capabilities. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 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 228084e72fb7..03121dbb4175 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -354,18 +354,16 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) return 0; } -static inline int is_reg_unreg_needed(struct venus_inst *inst) +static bool is_dynamic_bufmode(struct venus_inst *inst) { - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->core->res->hfi_version == HFI_VERSION_3XX) - return 0; + struct venus_core *core = inst->core; + struct venus_caps *caps; - if (inst->session_type == VIDC_SESSION_TYPE_DEC && - inst->cap_bufs_mode_dynamic && - inst->core->res->hfi_version == HFI_VERSION_1XX) + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) return 0; - return 1; + return caps->cap_bufs_mode_dynamic; } static int session_unregister_bufs(struct venus_inst *inst) @@ -374,7 +372,7 @@ static int session_unregister_bufs(struct venus_inst *inst) struct hfi_buffer_desc bd; int ret = 0; - if (!is_reg_unreg_needed(inst)) + if (is_dynamic_bufmode(inst)) return 0; list_for_each_entry_safe(buf, n, &inst->registeredbufs, reg_list) { @@ -394,7 +392,7 @@ static int session_register_bufs(struct venus_inst *inst) struct venus_buffer *buf; int ret = 0; - if (!is_reg_unreg_needed(inst)) + if (is_dynamic_bufmode(inst)) return 0; list_for_each_entry(buf, &inst->registeredbufs, reg_list) { 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); From patchwork Wed Jun 27 15:27:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140341 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1026524ljj; Wed, 27 Jun 2018 08:30:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIXdABCPXTozKd7Xg9gB2+kZLJhvRUnPSFnmXdsVkRX9iwRTizYkaf76j0Lv0Ye/LENzm6W X-Received: by 2002:a63:8e41:: with SMTP id k62-v6mr5522477pge.187.1530113407996; Wed, 27 Jun 2018 08:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113407; cv=none; d=google.com; s=arc-20160816; b=PoT4SVs2yYMa949iPnqoO7UG03me6Z3guHcVf+7G2X2LLv5GShVolWAOeYh3oKHgq7 7CNZMhvPb2To7MxZfStjzT/D7uzhPUMLYMBqECLyKmITK3y2wubRVJsCUcmoII0fzscD MoXSDFJG245WkQu7qG1TiXwzJp0GVcUip9jvcRvlJjDeQysxZ0AicvOjWrWOEBxeBEkn 9UmrIQymp7lbhfSxgO8JeRzgNgKmfmnZ/koi5G4wej6BZiWFLrG0Au0kYkJyENV8a+3P paKQZBRz/AVUuuQ3ZF3vb+2P6gwAg9swSXifgw8zVSkQbXR77cxCNUcFerOyxasQdb5G khtg== 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=p0G8Yudy2bn9cBtUbsHsFM3x/BJRUPhrcvGiJndn3GM=; b=yI/c6nITTmfDahf5be1qBHqxInxjn8/cc+sLWldwZL5+He6Y94NuIBXJnn+P8/DZ35 fAQv10vXA8LBlIa3NDPTR/5nSxCs2WdF+QqjPKrtQJMve6B8q/dfduEtTxvWHdrAZTYl JA34Lr2q88BWLG03ceh0+M1xrHH3E5ozWM6nN/TdW4ZkyMhGfD1IxeFKAKJ5/Bre2Ypr 7a+dzKTP2pirVyoqySC+0sRa+Uo52cdyv6MGpI2Zz9KBcw7ZOfeP/C3cI6ctltYVcH02 MhupuuoS1yfwy5T4QFweLDS7gjoDq8x6uxdm0akso06s+5oijX7SyHowZ+mDy1qJg0UH eqow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="D2v2iX/q"; 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 j10-v6si3940956pff.269.2018.06.27.08.30.07; Wed, 27 Jun 2018 08:30:07 -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="D2v2iX/q"; 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 S965209AbeF0PaG (ORCPT + 13 others); Wed, 27 Jun 2018 11:30:06 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45623 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965193AbeF0P2Z (ORCPT ); Wed, 27 Jun 2018 11:28:25 -0400 Received: by mail-wr0-f193.google.com with SMTP id u7-v6so2464321wrn.12 for ; Wed, 27 Jun 2018 08:28:24 -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=KGtopIdccvCWqxzw2Y/ssJlKU0JmcRx1SeA6otkSH9k=; b=D2v2iX/qgTJOgKhlxD0O+emIRCP1LIwORkb3L6rqjSzJaIIe0RsFkPUxyQhVJLQPwi fW9fVut1BZ0XJXlA+Vl+RRIMqrsEEO6shCo2APH2uRncfiPfIGnKaFaN10abdcDC0edV cxjW7rOzZd+p3qvviFntrOVrqsrxIUzIYFgss= 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=KGtopIdccvCWqxzw2Y/ssJlKU0JmcRx1SeA6otkSH9k=; b=Y3cYuhIgbF+9YzygP6yuGrxAOIL+MwMkAYZDyPX8YTmZK4jeLwaRSpRvRmHinPY1pf h4zKAAUQ/PyYFXZrN9gNHyzV+JpUWOIiwAMt+37h5/APcbK/QEJPTELl/ak5jqoRnvln I5mi7NMRRmyl7DZVMupDzj3rSbB86gzxuix4kxnsMZVtase8PtgXlOgnqtFslZFBy5PI ZFLhpoSsTMVdDX3H/+lLa2S4XQR3enP9E9fcE4Y1Gi7LcJPziMc9Lki2O3ZTjgkY7Kmp hCrpaCPvU54xmpZ8QVBdFxhdsIJ6Gq3vexeECHoOiB8P+GsBmuJK39Y6yF8NCj0tSTUA +TjQ== X-Gm-Message-State: APt69E3Ny1R/zFUCS6qif/Ta+zem63OIboMT1rJKWxhwi+VKSgnddnYz IVIsD/O1T4skYWEvepvbceYriQ== X-Received: by 2002:adf:86e9:: with SMTP id 38-v6mr6017182wry.232.1530113304170; Wed, 27 Jun 2018 08:28:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:23 -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 22/27] venus: vdec: get required input buffers as well Date: Wed, 27 Jun 2018 18:27:20 +0300 Message-Id: <20180627152725.9783-23-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 Rework and rename vdec_cap_num_buffers() to get the number of input buffers too. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/vdec.c | 41 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) -- 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/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 5d8bf288bd2a..55213a8d55a3 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -603,19 +603,32 @@ static int vdec_init_session(struct venus_inst *inst) return ret; } -static int vdec_cap_num_buffers(struct venus_inst *inst, unsigned int *num) +static int vdec_num_buffers(struct venus_inst *inst, unsigned int *in_num, + unsigned int *out_num) { + enum hfi_version ver = inst->core->res->hfi_version; struct hfi_buffer_requirements bufreq; int ret; + *in_num = *out_num = 0; + ret = vdec_init_session(inst); if (ret) return ret; + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_INPUT, &bufreq); + if (ret) + goto deinit; + + *in_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq); + if (ret) + goto deinit; - *num = bufreq.count_actual; + *out_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); +deinit: hfi_session_deinit(inst); return ret; @@ -626,7 +639,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct venus_inst *inst = vb2_get_drv_priv(q); - unsigned int p, num; + unsigned int p, in_num, out_num; int ret = 0; if (*num_planes) { @@ -649,35 +662,29 @@ static int vdec_queue_setup(struct vb2_queue *q, return 0; } + ret = vdec_num_buffers(inst, &in_num, &out_num); + if (ret) + return ret; + switch (q->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: *num_planes = inst->fmt_out->num_planes; sizes[0] = get_framesize_compressed(inst->out_width, inst->out_height); inst->input_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, in_num); inst->num_input_bufs = *num_buffers; - - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - inst->num_output_bufs = num; + inst->num_output_bufs = out_num; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - *num_buffers = max(*num_buffers, num); - for (p = 0; p < *num_planes; p++) sizes[p] = get_framesize_uncompressed(p, inst->width, inst->height); - - inst->num_output_bufs = *num_buffers; inst->output_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, out_num); + inst->num_output_bufs = *num_buffers; break; default: ret = -EINVAL; From patchwork Wed Jun 27 15:27:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140339 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1026148ljj; Wed, 27 Jun 2018 08:29:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJzNmt97WG6SrYJ4DNC7Lz0yE7fkq/SQmEa8412eUBB8eYAv19aYPej/VMinuvS6mtmWxOB X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr6752090plu.22.1530113390586; Wed, 27 Jun 2018 08:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113390; cv=none; d=google.com; s=arc-20160816; b=EF6DMQkHs51t/ApMf3mLHURsscUwTyshT0n1y0cJA7BN2Kj80cEjzhlOH3Yg+8AIlV yzzonYV9+MyDcSSe5cDLubJXajjrNzc+g2InGYEn9rCUnncIBl/jBqlO9Yr5/1JtEaZV FFYdFsDvJDwiEaLSgxy0HmfLql5V/x/i+LrJxEsxtMjS42dZoTstCKEpNHtZwB6hjSNq hOq28+MJDMRbKl2l5FyPkn1uwq+qE1j9j8hkDgoCvtzWLUnDgiHNqUMYHANFhP/rp05i /TQYEotGIG4XUjVG7ZmkTs3rTgI/knUTsXu96RRKHpSCfG5dHSlyntd2cGCwwU8CGo5C dYXw== 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=Vnct2M1/1aGBekj/HoFLFUb0IxaxK8+1a+e6mJr08tc=; b=mKu6wlUT/JYjTPji1y6dWH3/FBJ6aw18G7EOcRB0C1SWlm3XgwtJuRLIht/NWBdMXA C2eCuMlKIahh1wwKkpzSAD9DiGyOrX5DCVmMH3lQEy5xg3JxvLIs8TJotCNpD9vSJ40g fjOvEIkD9Sil1YYwIOVTgkxCln4cdbkbHwOaB/Sloe8J6kGE46jr2ZLw8NYBldlR8Z0h KsWSctHux23yGVuL6TPT1TcpNuTCiauns26Si1KoTPNSSj+GUcfhGeKXDfzFM31r2dgs ldSsb7KfEKePS2dnWgC+kNg4qxJYh5+14hyQeLtnW+RyaSanUABAhpQwLwnbinjFmMVX 8iXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UpWC2btW; 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 b8-v6si4191721plm.202.2018.06.27.08.29.50; Wed, 27 Jun 2018 08:29:50 -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=UpWC2btW; 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 S934130AbeF0P3s (ORCPT + 13 others); Wed, 27 Jun 2018 11:29:48 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35261 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965269AbeF0P20 (ORCPT ); Wed, 27 Jun 2018 11:28:26 -0400 Received: by mail-wm0-f66.google.com with SMTP id z137-v6so5987497wmc.0 for ; Wed, 27 Jun 2018 08:28:25 -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=0nhKxdCOw37kKVgSprpQsFMGs84elFtpX09ZZT6Wn24=; b=UpWC2btWqm7fyWLNH2uGCWcqGVwikWwwYbWpIBKU4T2UpHHCrEk0EqBvmZo8WhBzJX qnxB+4J8UeQ+LQHXMlxokOz+n8mZ31rDOd7L1A8HvBHhecafE6keHvqOFu6lz8mWNi/c 4wbBUZ5pIZ5AlZYfMy1KlJ3csdmsFlFpqPObM= 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=0nhKxdCOw37kKVgSprpQsFMGs84elFtpX09ZZT6Wn24=; b=kLoJWM0MtvQYyYrKVlBNj9/Yfa2ocn6ro3OpzbRYYONz6fnHjyL8U4HeIqzcLRYmzx IpBSSMFhZzuEZKMDh2Mu1ln7ikr25KrQ27V5cLdi+/2PBMSYtVcyidZ/yfaHy6wl9NWH PvAtk0MiPmB6/DGIX3R1a3MxLhjlcgZSBBV7zO5N0+KZThZFg87W/cgjr5aDtJS8TtCs XJFpUwzJmra/2+dCBiUle4bS02qOwCUYa8cLaCxbpOA/OM5IUaVBZGcURIvuPcZOvplK g64wVj0RddS5baUw1xi17mezi2x5xM9mx56v0Lh+RXaBZ7tUZM9z+1Ctmy2COilMwg5B 4cgQ== X-Gm-Message-State: APt69E0f0bHFhIi60B2QcA0R4PMaY6STeHA92oZ40ZMHs5X7bL3y4k9D fpM3btbABISCOPuVK5iXK3Cqtw== X-Received: by 2002:a1c:aa12:: with SMTP id t18-v6mr5219819wme.54.1530113305305; Wed, 27 Jun 2018 08:28:25 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:24 -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 23/27] venus: vdec: a new function for output configuration Date: Wed, 27 Jun 2018 18:27:21 +0300 Message-Id: <20180627152725.9783-24-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 Make a new function vdec_output_conf() for decoder output configuration. vdec_output_conf() will set properties via HFI interface related to the output configuration, and keep vdec_set_properties() which will set properties related to decoding parameters. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 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/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 55213a8d55a3..4d3f1cd7ed1d 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -545,6 +545,22 @@ static const struct v4l2_ioctl_ops vdec_ioctl_ops = { static int vdec_set_properties(struct venus_inst *inst) { struct vdec_controls *ctr = &inst->controls.dec; + struct hfi_enable en = { .enable = 1 }; + u32 ptype; + int ret; + + if (ctr->post_loop_deb_mode) { + ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER; + ret = hfi_session_set_property(inst, ptype, &en); + if (ret) + return ret; + } + + return 0; +} + +static int vdec_output_conf(struct venus_inst *inst) +{ struct venus_core *core = inst->core; struct hfi_enable en = { .enable = 1 }; u32 ptype; @@ -569,14 +585,6 @@ static int vdec_set_properties(struct venus_inst *inst) if (ret) return ret; - if (ctr->post_loop_deb_mode) { - ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER; - en.enable = 1; - ret = hfi_session_set_property(inst, ptype, &en); - if (ret) - return ret; - } - return 0; } @@ -724,7 +732,6 @@ static int vdec_verify_conf(struct venus_inst *inst) static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) { struct venus_inst *inst = vb2_get_drv_priv(q); - struct venus_core *core = inst->core; int ret; mutex_lock(&inst->lock); @@ -753,12 +760,9 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) if (ret) goto deinit_sess; - if (core->res->hfi_version == HFI_VERSION_3XX) { - ret = venus_helper_set_bufsize(inst, inst->output_buf_size, - HFI_BUFFER_OUTPUT); - if (ret) - goto deinit_sess; - } + ret = vdec_output_conf(inst); + if (ret) + goto deinit_sess; ret = vdec_verify_conf(inst); if (ret)