From patchwork Tue May 15 07:58:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135843 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp672903lji; Tue, 15 May 2018 01:04:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo/KCasOZCSVsKNeIHDPnqBPUSqzTIPFc5X2NbF/1MCwmsGikwfiZeyFJPnW4CFpnaabyLI X-Received: by 2002:a17:902:b908:: with SMTP id bf8-v6mr13169066plb.358.1526371480426; Tue, 15 May 2018 01:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371480; cv=none; d=google.com; s=arc-20160816; b=e62pYqr988ItBdRai6rp2neQBkSV6yCX57XfkG2go2weAhrghFliQqpQXIXTbgy38+ 1SN8oGa1TZU957xpu3vAyfWPe+zd0GA9dJwpcztMfLzOom0zhZWmDL9tpGgnPY2IkBxp cK4c9b5GM8yxEkSSXGsQ0o14hzpL1sWizUPydAn1BJUZ1/QJcCOfXXf/lnMX3m6RMk+7 ReHIdrH4V6QkdbhJ4otFxJwiCVYZPF21RKj77px/LQelvFCcUwmBw6oe0OwTcIPA02Nj 4+B68fT6wA/3ttNfeaVId3pj79vxDk4CWpq53/ROcPbOm0L3hXEo0GesEYWrzvO12Ht3 mYbg== 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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=aLGFXfVqTqXEVcbsAk2iv8fZuaep5QvHuwx0f12/jaY3b3jRNKjFVuoXg+8dN9od9q QyymyKvo6I1/UZCNcomWd+vqibdKOVePl3QHl53Dlf9kCZxVhLh75F90g3ZCvPcY+4Lq GN6U1B3NAdSWr0GAU31UTx0lOnCXSud+zp4FJl5OMRdQlxhwvfKr7aUgKF4HbEb5wksl VAM4bhnUXBZhgqqEeNMtSvGO+fNOP9FQyhMSm1W12VDOygmFYmXiNx5rXu6tpI/bWe6Y ZWgiM8zFshiCHF7R7xgO6GYiiklDzLRDbgkEFJFXpV+UJpiHSXC45NrV5r+2UIXEd2Hk 65Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGpb6Ztv; 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 d11-v6si11242351pfh.131.2018.05.15.01.04.40; Tue, 15 May 2018 01:04:40 -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=PGpb6Ztv; 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 S1752602AbeEOH7v (ORCPT + 29 others); Tue, 15 May 2018 03:59:51 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37181 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeEOH7p (ORCPT ); Tue, 15 May 2018 03:59:45 -0400 Received: by mail-wm0-f66.google.com with SMTP id l1-v6so19722457wmb.2 for ; Tue, 15 May 2018 00:59:44 -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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=PGpb6ZtvU6PITz0RJ/IGWQiVfrKjn2meockZos9e7JzME0DMKgHJaKiS7zJAcSbr+7 FX2a1BaYzkIS8QkpU443wHXG5VDS097GeGIoK56prAmWM4BVU6rbQOBk5yUp4o46JzKF xOFOs9tczfSBdR3JnRFtazp7LXJA4XdPu0zW8= 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=N3frKovU6D+244ryArLGCq4QJaJotXxoCOQlJ6G7Cas=; b=eXMg7MDosZw5v5jrZh9GrLD/wganmCOxoEmBJZbP3rE++jv7StXASZ3rocqGbAyn9M RIjquy48k8AwTPDHHfAvYI0Pi93CuG373MlFL31fJvNHNO7qA/AzAliIWeGajZFDbQgE h3sb/ok2yYbgnqFvxDHSC3zPCnazqb9qlUr0BKKFGX6n82WmWe2zl0PnVI2qjgb3fZpY FBcAgotMcGaMD8KgbEBOiaOOlch1WGYwkudmb49cedLkVZyU0X58UT5UlAU6oNPegK/t oANBfguqahEX2jRPx5xYVbpzCNrPCX6dy2c21qlW7fa+AOaTywHGirx6/G9TFDp7BXT3 1lsw== X-Gm-Message-State: ALKqPwctiQfugvpiqGjxQlX+VLfgkVU8CG1B/d/bbKiaXDSIPJXH4gD1 HVaDgiI2rzI0r/l1TRp9ER88BQ== X-Received: by 2002:a1c:824b:: with SMTP id e72-v6mr6952942wmd.64.1526371183962; Tue, 15 May 2018 00:59:43 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:43 -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 , Stanimir Varbanov Subject: [PATCH v2 15/29] venus: helpers: rename a helper function and use buffer mode from caps Date: Tue, 15 May 2018 10:58:45 +0300 Message-Id: <20180515075859.17217-16-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 2b21f6ed7502..1eda19adbf28 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -354,18 +354,19 @@ 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 inline int 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; + if (caps->cap_bufs_mode_dynamic) + return 1; + + return 0; } static int session_unregister_bufs(struct venus_inst *inst) @@ -374,7 +375,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 +395,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) {