Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp618674imm; Thu, 5 Jul 2018 06:13:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsHm2gfImrP/GZxZsFTMdOQHBgQCW67CfVE01dPPRdZOrjeQ+h16eHAnH3i8sucskZVUOp X-Received: by 2002:a63:b349:: with SMTP id x9-v6mr5583934pgt.337.1530796434313; Thu, 05 Jul 2018 06:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796434; cv=none; d=google.com; s=arc-20160816; b=ShLS9LCIM+ltFmjhdyBv3i8iepiaxF5GclF1F+Aisnqv5RLr8kIc++nbW/0EbO21xj WGZuwRcUd4VTPPmVNP5sjaikfazserfLcQKnpucv0nMIOOmox5ZnTEd/2uKA3go3IpIz efmgoK5t3E35OVcNMr2OqnUDyhuiaxZjoRMlFScZH50B35Ah3H3RCSO6K52te4eriuQE OTTnLQr64/L17CXJfYftQPt7GR+guU0+8Ri/nx46JESCu36moYZYnAov8wmPFVTDka5i Dv/tudqkSIf9BBqUhOOxJK+mXrm6nb4IhXdFXrEq/118IamH1mpw3N0PBCk0oK6uSCSK 0Oxw== 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=3i8BckNk5AMxsFObk6sMQ2N4Vr3Tdy+vGDFQyGUXeZU=; b=N1I335YxCedhblD2O3mz3/TocuOveQz7DABVt9KW0rU13GWSBhPR2CPtDrg7L3/B5T HeVHmh1qoj5/PW+BDrSgm5tB3KlJoKWtn+ibJTzlZS75chHozBHPeZFUUoVzEzAT13/w 4QGj8pCQNE/cGegm53vNNV3sd0cgMGQ3OMvVf0OIqRLHE8Aeq5S4sCAQR9NzXGJc+ffw 50n3Xj+akP+JTqqKVfndqSmCeIo9czai3z29VQMEw8QlSEUv8vNRghuDm8JKKIgR/7U5 s0X2LAHTwm3GAyAJVcVydCvQpSbj7rH2Egj8iUP1v+itKEWNthLRj9DCJ6VCgxx3ex2R 2nqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G9VD4fRS; 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 f4-v6si5854742plf.383.2018.07.05.06.13.40; Thu, 05 Jul 2018 06:13:54 -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=G9VD4fRS; 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 S1754564AbeGENMF (ORCPT + 99 others); Thu, 5 Jul 2018 09:12:05 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36652 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754398AbeGENFW (ORCPT ); Thu, 5 Jul 2018 09:05:22 -0400 Received: by mail-wm0-f67.google.com with SMTP id s14-v6so10733518wmc.1 for ; Thu, 05 Jul 2018 06:05:21 -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=3i8BckNk5AMxsFObk6sMQ2N4Vr3Tdy+vGDFQyGUXeZU=; b=G9VD4fRSgCR80eTzzW6fpSDt93wNTPBC3e0s5RsP7jgFooQXq9+g6TfnyaQfGGsh3M ++seMqYU6Piy38xXED9y9k9seeSGyRhcNUshc9B7JR2A5LaHq/oXrfgOtj6ycuVGpz9F IWejZK5y3eyLwFMMFFmClzAQThiLoyo18JZYA= 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=3i8BckNk5AMxsFObk6sMQ2N4Vr3Tdy+vGDFQyGUXeZU=; b=K8mdqxhNcHTdB7ktswFAgaDkExqSF3/6zyjlDlm7uSb3lY9IBvn5qqrz4toW2MJcSK T0oUE0xU0g2jc0poGk+hheF/SxcYimP4TGORTm79x7n7fAIAs4Q847PU5StRYTbcEAB4 L3+UL4SeUBk1OIn47qjOhHLOtd6Z+v6D4MZnmhpYzuHSYk51BuCv0RQtUPSpOQd/jfeP LcKXjzQ3MFedCHqeZcw/kEmzLFvnoG6ghtYrxrhnavtW0tHJj6Ww5GQ2pmf2+BlY0Z+t CGVsPOzKTU865nOL4TCDnZaJ5wOqiIIa28Tv+2Ebw6oFe04/SwUq1pSGlaPVHTZ8FcV+ hNuA== X-Gm-Message-State: APt69E2n2ODWKqlyQvQV5/ecuEPZ1q8cNBGDOm8gXbFXUpXnAS1sHBgb B8wjclEogeVYLSXEi2R+xHvDPA== X-Received: by 2002:adf:a49a:: with SMTP id g26-v6mr4681005wrb.91.1530795921265; Thu, 05 Jul 2018 06:05:21 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:20 -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 , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 13/27] venus: helpers: rename a helper function and use buffer mode from caps Date: Thu, 5 Jul 2018 16:03:47 +0300 Message-Id: <20180705130401.24315-14-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index c8c4a4be78e3..27c4a4060c4e 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -359,18 +359,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) @@ -379,7 +377,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) { @@ -399,7 +397,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