Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6598476imm; Wed, 27 Jun 2018 10:04:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpflm7MMXXVfcGhg7SGX880+Elbo3sr5mUPBxj692mvjmiPrt6cptb+umuVxOr74avGe+9gf X-Received: by 2002:a62:4556:: with SMTP id s83-v6mr6755347pfa.73.1530119050637; Wed, 27 Jun 2018 10:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530119050; cv=none; d=google.com; s=arc-20160816; b=aqz5xvy/uYFpAJu2q1edDM+6+Ts/YSsHOJeTIm69lho4NiRHIq0DgDmBlo/pqU6qXu vpCU/yvKwJ9pSP4UdmQyNWS58SN0o0NUld0Y9TxTXf5vhypSn+n2HWy3Ubpeu3NuQK8p oSgjBJt+g+i3KWwAu7SnF4V+oyzaNRAKQAA6RWwugCnmkpt/NYmFQpKwIDN+6PtzmX2h MQoWLPfHGUj0B85MdQqoRaYlWSJeMMUdXIk7BT8RKuxU90QMwkSnUBseAqEQw1wKsDJe L29oGuZQsF1x+1SL0W3CZEd+Mpcte3aJ+dKE2pjaRh/oEI/McPHBuC9s9SC1JIwUPYn3 ZdGQ== 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=AB6wglEcqTLSbMHgNbNW7jZVPYjf7S+cW9KlHdq7wf5/Y8Mfd/Op5rzA6f/fXvW6Q8 eT0oEgbFA5CKo7qkDjR2ZBkJrkGS3+9PygTWhCukuHm2Ax+lPPCe6fttFW3r9deBikTL tC1EPqOfHIm0c4v7BjCrXYSub20DLyC7fugPWqYfjNh9cB69Vm16FYI50/gNnSbQo0qJ 33ZkPnyd3jho3srUw4Zzq1w6kwb0V7CbkU4TrV7GdK3fsG3f1mY3R3MhAUbukv5+jn7/ gzk0pmVATLwD0T7zl3LF9oiyx4kuBE+8gGwBSgPtA82KqqQRIVP2SRDRXa6koI5rCGEo T1tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UUd+yvxr; 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 a6-v6si3683019pgq.18.2018.06.27.10.03.56; Wed, 27 Jun 2018 10:04:10 -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=UUd+yvxr; 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 S934948AbeF0P21 (ORCPT + 99 others); Wed, 27 Jun 2018 11:28:27 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45605 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934910AbeF0P2Q (ORCPT ); Wed, 27 Jun 2018 11:28:16 -0400 Received: by mail-wr0-f196.google.com with SMTP id u7-v6so2463809wrn.12 for ; Wed, 27 Jun 2018 08:28:15 -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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=UUd+yvxrHZiApNI8YeMHvQQ41nVuNqkHvB0A4Y6e1V+tQyvkhJIqVVsyAljazzNfB3 knxl7Oe1VPRhS7YENKeDyYABWggiBOqOa8n7bKQ7fv996cDQmB+62vEmM1gFK2c/Aweg upHmp3DwZvgCCFC3I7ns+j6ZgnmEPT1nM2apE= 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=qPnlfeQqBqxWG/iSd5Of+450Hk2LVM7KOO03Ycb7qp8FQkk8Zf5vDc+niDjttPTd0g 6NCCqA3xozNXlpY67ehrTMg5fsjrebuHmc6KbhfAikjdlvaPOH7uA2luKPMsqyfr6CpG lm10mP1n/8QB8wE2KpmLEJ+/95rR0SAdHBki/fau7h4BWtot0g5jMKr2vP415AlDlNjZ H8/sqD7wQFd0nD1jcCfWzp+SQGM+jm3W1CxTu7Z85ArgEt5EpjTL4DVXROCF32w1SXMV g8VZxmDmFP2AsDcyJehLbdnv5Hu4crJIbhGzwBQfbJz9JFuKZNK0FlifCY0tGlF3OMJW hsiA== X-Gm-Message-State: APt69E38Dkwep67HGmdjzQfKTbAXYFSlsB0HV2TRj/O01RPzbKeZ6wQ9 o9pmGjYZUJq4OEn5FX4GW+0LFQ== X-Received: by 2002:adf:9226:: with SMTP id 35-v6mr2359316wrj.44.1530113295028; Wed, 27 Jun 2018 08:28:15 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:14 -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 14/27] venus: helpers: add a helper function to set dynamic buffer mode Date: Wed, 27 Jun 2018 18:27:12 +0300 Message-Id: <20180627152725.9783-15-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-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(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 03121dbb4175..e3dc2772946f 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -519,6 +519,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) +{ + 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 31a240ab142b..92669a358a90 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; -- 2.14.1