From patchwork Wed Jun 27 15:27:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140333 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1024688ljj; Wed, 27 Jun 2018 08:28:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJIinxIVWU/S2QU5HLgnv5Dvgesx4VpbZ7WcCFTYBuaJXpyYM2+tfK4t5IUV4WATYp9Utza X-Received: by 2002:a65:6688:: with SMTP id b8-v6mr5741504pgw.24.1530113310337; Wed, 27 Jun 2018 08:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113310; cv=none; d=google.com; s=arc-20160816; b=twVBCbhhztbqDE+W6ZcKatOJN4syOgpQyMJ304yx8a4NXzjDxl1AubRjj0y/4U4ha7 gpZaJhRjLZ9nJ5L2dkLTSQbAe9k2LZuKbTTPp4ThJMFWz5/Z8QALQOJ5LfpbzdrD655i UtMN7ZjCJyJ7vyyCoZPiz32gEpKsHNQxI2lySNNb1cqLisRyDtZQTcSiQFiky8jK6z/1 oPbPzlUXg4z6AJst5udcy2g21/ylwlYy7rsI9/nB6Wh7hrorqZGwsUgnOrf4i+Qhz+lb 6G7yQ0VRaz5Zy/Sd5VsH2nJYG1Qy4/6BzC9slncTIHPc44E0QakIAzUNprWH53Y1GEUd k0mA== 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 h128-v6si4141015pfc.211.2018.06.27.08.28.30; Wed, 27 Jun 2018 08:28:30 -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 S934953AbeF0P22 (ORCPT + 31 others); Wed, 27 Jun 2018 11:28:28 -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(-) -- 2.14.1 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;