From patchwork Thu Jul 5 13:03:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141124 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1918748ljj; Thu, 5 Jul 2018 06:05:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcTFgcpDW3D/Lad3DI2S2nCESHUvlMVVP5jHYX6SmtBZg+RMS5t2Pb0RLCPvyFlplw5s/Ze X-Received: by 2002:a17:902:b08a:: with SMTP id p10-v6mr6291878plr.0.1530795932316; Thu, 05 Jul 2018 06:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530795932; cv=none; d=google.com; s=arc-20160816; b=DjaGjlB9h4pQgECdfdaUmdzyeDSdhOLxtfqu5wdxgY/sOcpp2zZ20cGHZSTpWWuls4 IOcHuNIuvmmPuFsQLAIBhhIhf6lI6xEw0rzQLU2ClZY09Yv7hlpjOc0HVSLwDDrUeGCp 4ue4aMRbroYVH/oced5go9+T4Hk+9zngYcaTg3lEyX7hOMuYeeIyoSjf8/i7iF66gu1e mYs8VbdoR4M4c4t+rJY4Q5SX9obVDCvGIGJWy/eu5o2xIMuz7xET4nJU0GtbolGkxSlj FW3yZAaFKU+GifWZ646EElWOOqLijghPNe0bSyTeWl4fblP10D0vtylNFOy4AtvFyGiV ymXA== 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=e5wWhN2jYs/ZNqU0dtOSF3cvtPwdzRHe2yaBwOQivks=; b=fbJw3QZ382R+tFjZm0ZD5XlhB7BZ1XZ+wtyd8kKLrARdBhPNua5zkJjR0jU7QLVu1R nJbH8bBosAQsYKbosaAViha+9aLFcxNzWYn2z6QlPkKjJLSgn5pmg4t2V8NQ/2qif87/ /t5U0myYemVEimId1dLPr3wcx1sIqgpIqPpK8s2KaflQc/251LZ+pGR+QV6T7F0LymR0 idGUbUVXwXzIM/vmZ+eRRSC2RjHqyTp9i60YscZiUyKNutlWA4vFymWPZMhZXjBarQpW P0Wr1QXVVTh6BbtjvGVCbG5RImBu48pRo8E1Wy6NbtDRLHovv1SZIXNBQkraWPWNn4Nc qp6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a5Lk6Xyo; 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 p73-v6si6415628pfl.57.2018.07.05.06.05.32; Thu, 05 Jul 2018 06:05:32 -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=a5Lk6Xyo; 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 S1754466AbeGENFa (ORCPT + 31 others); Thu, 5 Jul 2018 09:05:30 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42500 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754416AbeGENFX (ORCPT ); Thu, 5 Jul 2018 09:05:23 -0400 Received: by mail-wr1-f66.google.com with SMTP id p1-v6so1140251wrs.9 for ; Thu, 05 Jul 2018 06:05:22 -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=e5wWhN2jYs/ZNqU0dtOSF3cvtPwdzRHe2yaBwOQivks=; b=a5Lk6Xyoxppfo7CfNnaBtoSzhiIo6gmq1xYEYzgSXWtGTnAOliaJcK5qU8WhddlDn+ qFlyBi1Zgpf/6d4yOtxJTxNk8uTIl08Z33KeU+f6MjN5AC5DREG9nyz71uOc0QWrqdeK ESaO/R0xhk6vmh/yIf8ys6IGg/zohAKcscJZE= 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=e5wWhN2jYs/ZNqU0dtOSF3cvtPwdzRHe2yaBwOQivks=; b=tMrCrXka2PYVCi/c3uW4aYYU3RIIjdOvpMJaeAL732UG5BgWuecbb0Yd3MrPrd6g57 Vzl83chi6CPENV9iEj/loUAnlRtUY8yZOi8y6NIwimv/WCvUE+szu/yeg0zJXlzhdOR6 eBwi4HafEqZQZ7XfuQ9rVzNdXgMp/Dlu6NQezQxLvYBCE9Qmsh3S9a4hYm/860epZm4E ob0mcmpX/e3Ww9bT8UniWWIE2Pwmh1DrBz4NKMzJCvRGfR07PRRg52qkUuNbx8RA/pXH +d2mfuQlhVO4keYF6S1dPMfvw5z7N5/YbEAmyn+5hx01d28pknj42bGOtMqMYwAZB5YJ szgA== X-Gm-Message-State: APt69E1W8L88cZjqCbFJo2LzGmyQ4/ZDfw4Fw8LG8FAQtP18EFCQSZlP I3KNirDI5gWdagTJI7bx6ZloRREYRl4= X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr4649973wrc.93.1530795922298; Thu, 05 Jul 2018 06:05:22 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:21 -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 , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 14/27] venus: helpers: add a helper function to set dynamic buffer mode Date: Thu, 5 Jul 2018 16:03:48 +0300 Message-Id: <20180705130401.24315-15-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds a new helper function to set dynamic buffer mode if it is supported by current HFI version. The dynamic buffer mode is set unconditionally for both decoder outputs. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 22 ++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 +++------------ 3 files changed, 26 insertions(+), 12 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 27c4a4060c4e..29cc84777125 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -524,6 +524,28 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); +int venus_helper_set_dyn_bufmode(struct venus_inst *inst) +{ + const u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; + struct hfi_buffer_alloc_mode mode; + int ret; + + if (!is_dynamic_bufmode(inst)) + return 0; + + mode.type = HFI_BUFFER_OUTPUT; + mode.mode = HFI_BUFFER_MODE_DYNAMIC; + + ret = hfi_session_set_property(inst, ptype, &mode); + if (ret) + return ret; + + mode.type = HFI_BUFFER_OUTPUT2; + + return hfi_session_set_property(inst, ptype, &mode); +} +EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 0e64aa95624a..52b961ed491e 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -40,6 +40,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); +int venus_helper_set_dyn_bufmode(struct venus_inst *inst); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 95892090e2f3..c37779d82fec 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -557,18 +557,9 @@ static int vdec_set_properties(struct venus_inst *inst) return ret; } - if (core->res->hfi_version == HFI_VERSION_3XX || - inst->cap_bufs_mode_dynamic) { - struct hfi_buffer_alloc_mode mode; - - ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; - mode.type = HFI_BUFFER_OUTPUT; - mode.mode = HFI_BUFFER_MODE_DYNAMIC; - - ret = hfi_session_set_property(inst, ptype, &mode); - if (ret) - return ret; - } + ret = venus_helper_set_dyn_bufmode(inst); + if (ret) + return ret; if (ctr->post_loop_deb_mode) { ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER;