From patchwork Wed Jun 13 15:07:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138501 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp854896lji; Wed, 13 Jun 2018 08:14:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLlpWBbfJuZy7slTFgh88t2LuUfiYFwHEq5B5KO+vjPLIy0UHgG4ZVR1T8W3j8jJKnm4mbt X-Received: by 2002:a65:6591:: with SMTP id u17-v6mr4294608pgv.401.1528902889314; Wed, 13 Jun 2018 08:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902889; cv=none; d=google.com; s=arc-20160816; b=C/I6VGboubHGeRKcrxAP7Oyhnp27+pguRi4sspw+9SRKb7Pq0XOiQpLlMaTkmFKpHm qSJ/i8zgNGVG8NyeZWHwFEntLbs0eamw6dj0vsLnnrzwkiQhEzJR6CLFOXGZZkEzUKbP e45rFAzssrZlUffVD0mTFiDws1Xa7/7kjqCu2/Loyu2yDbiAcK47aU5c6l+c5cTtqwDi /V1aAMLsUHVxryTFltT923VCvF3BhcyV8r0dN7nI6pPmYjWGzIRuREUVw8JIyUPNrjhc 26MNft65DyZbjaDL8tFbTtsfB1ufpvbpnE64NFn+hZlRKzf8qqNhTaxBXbtp+ukQuiIp ZSjQ== 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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=vFMutV6f92sysBOdOtreGRcRsAKPygjEowo4QT39ZIJ419P/q3VvhpbbTgSKEJlgre 7l3QOVdD48IQrHaFv0SLwkfN1/sP1MIUcnY53+4jnlL76JTODysutRLdEAHvxBujOMyY DsBd2io/YkjRZ0Czg0Jgl8Ht/2NeeZDRJEQDCoOVsgJlpFmmfxsbAX6/zU/Q2R0L/luI yVAVKdKMI57UoNsSuzi/1LaKrvZJRxL+vF1m1dTdCTt+fwmobroLL3cv3ZRo6ZblZ8ul wJjh4T46wA9XeZvOBLm4hpEnYRC9gUx5oXqvuFKDSItlvYjLOYnY+ADexT2YSkYSjnjp bmLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JEVvuOBU; 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 i15-v6si2575681pgf.412.2018.06.13.08.14.49; Wed, 13 Jun 2018 08:14:49 -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=JEVvuOBU; 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 S936078AbeFMPO3 (ORCPT + 30 others); Wed, 13 Jun 2018 11:14:29 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35537 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936033AbeFMPJ0 (ORCPT ); Wed, 13 Jun 2018 11:09:26 -0400 Received: by mail-wr0-f193.google.com with SMTP id l10-v6so3164339wrn.2 for ; Wed, 13 Jun 2018 08:09:26 -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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=JEVvuOBUkZR9I2+mI1l9O8R3pWwYyfNE7mSdJu+Qt91VTiaSrBCuUBUzicavGUSCaA NPf5Wlz4Sf11zw2wJhrgqwhpcmUYyMxwpKY4eIPIVyffB7+WEGCowY7KOK75KIfMX3hx g40eJ4kY++PTpv5Q1P2M3nAsyKI1k6SdOUDSY= 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=tpg/OEO6kmuXcfyGgT7M54n6/6j/1UYfIVpGWyjDnSc=; b=Z/av8INt8La/03i0oEoZ66PJAML+7WmDZVTR4YUba6L8vYpbAZRS6L9WuRwn5uVhfp ZwV8n824O0Ut/BeeWr6lF69Gm1Bsese8fTocKskUy6mK7v28o+tu/rJYS6yevr8xuJgH uXx9ohX6pt66L24ThcUsUai7cFZP5DUr/fzFSJ/ilLQbCa0ptcadDspfNi15VH91p1GQ t2lJZOV2PCZeKqoq7QRhZtJf6VkcYLaanbBdGxj7J+2+wLscC5IqfwsFBpYttmKSW5CL ut7PfrcNcrgjLT5WLMTyVCyqofolsSymplbeSaHCgRnxq9B3bWuSAZkg+quNWGuGA9a2 qq5Q== X-Gm-Message-State: APt69E3FklapicE9kshlVQqGzYU0Mu8DR2233Rg/XPJ2dIp9w/ER4QEn vYT8eUk9yh8pe5WMjq2B4rEnnw== X-Received: by 2002:adf:91e5:: with SMTP id 92-v6mr4548396wri.124.1528902565457; Wed, 13 Jun 2018 08:09:25 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:24 -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 v3 13/27] venus: helpers: rename a helper function and use buffer mode from caps Date: Wed, 13 Jun 2018 18:07:47 +0300 Message-Id: <20180613150801.11702-14-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-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 | 18 ++++++++---------- 1 file changed, 8 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 228084e72fb7..03121dbb4175 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -354,18 +354,16 @@ 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 bool 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; + return caps->cap_bufs_mode_dynamic; } static int session_unregister_bufs(struct venus_inst *inst) @@ -374,7 +372,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 +392,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) {