Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp265544imm; Tue, 15 May 2018 01:07:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp2LqmOla77Qjx0AQTPfPKvaggyuv7zdWu+clD5YQEgEQJtwKXepebLoRwfk1a6ZSjRIGbb X-Received: by 2002:a65:508d:: with SMTP id r13-v6mr11505680pgp.134.1526371628487; Tue, 15 May 2018 01:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371628; cv=none; d=google.com; s=arc-20160816; b=Lq8REqH2YTrYmmFSO0uxAOIVKF44l6lalrFNFV67+7TLraCxhewSbZDsqJP/HKk3Dm xct95fhvPmIRrZte8nNTR6pAWf1621e23mg4fz1nDJa89fZxrHFWBmJiCmbHQP9I8w1/ /l6pT/ZD3gRbkOFU+hfA8s85UaXwFsgkNnGcWmIlNn+VVQ2FpGvHtll+rbOom3xBEU/a MkIHKhx52iloJ0MoWxl8/9dCx7nOfBdpnAuDkWBhLRMmsqy6Dmf2tP1T2EHVe6RDqAcb /MhCANaIip9wei3xCfbrc72g9qlmNqZfbUwv1q9LhkIaIrgL44oaFuqEdEJY9OKa1GBn 5aqQ== 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 z3-v6si9159332pgr.171.2018.05.15.01.06.54; Tue, 15 May 2018 01:07:08 -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 S1752592AbeEOH7v (ORCPT + 99 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(-) 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) { -- 2.14.1