From patchwork Tue Apr 24 12:44:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 10359549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8CB4601BE for ; Tue, 24 Apr 2018 12:50:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B6EC28DCA for ; Tue, 24 Apr 2018 12:50:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 999E028DDF; Tue, 24 Apr 2018 12:50:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21DFC28DDF for ; Tue, 24 Apr 2018 12:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933261AbeDXMtL (ORCPT ); Tue, 24 Apr 2018 08:49:11 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33460 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932116AbeDXMpX (ORCPT ); Tue, 24 Apr 2018 08:45:23 -0400 Received: by mail-wr0-f194.google.com with SMTP id z73-v6so49826444wrb.0 for ; Tue, 24 Apr 2018 05:45:22 -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=cwtni/rAKivADfZ3eKvS0u8zhAfebgU0BEmfYFpE+vVg7+3m2QIAAorx0mOlM0zzt/ p6wQupxzYhJ3U/ipaUMTwMxa9D2xgpnkBn2rqV3LPVqMFEO2mhUEvpo0OdUxeI9pKSz1 H7UGjR8UfrJ39pD/4OTtAO34dZAPN3pA8mlxk= 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=DdEa7mxBOCB31FmR+0cKaPZIjE2jhG1mmBEREZ7rnbRC9c8jSeY1nQcIGsZWMzAzJo quTFEw3Dt4jgZopo0sKsUICRK4UpyaoX2GRt2XNVQ2C+BFfLUvJ0/+3R/y5x1+kF/aHK Gg6C4crgusLxR1zGIJxmmBkXz02bmC54FBZWZMe/B26t1XKq0UIav/knbhP5kRO1afTX qRlQYSwb5EdLeomfwqFP/XVubWvVFa3pwdZhb+XUL4S3RuncGRdK6niRa3+Qw0pLoRtN n6ALUcSGtgaIZJNJVgjpRxKjWTKN5wKUavRqCIRUC2RN92wyfs3dKHJaYovu/n2WLbhf IWmg== X-Gm-Message-State: ALQs6tBBe9BSzTXXZzpsZGqQr3zaQYbdsUay+UVgLYc3Ie1m++zYX7ld whKpeoquPUFm5A0/8aLQxTyxgw== X-Google-Smtp-Source: AIpwx4/K4WxdyF0O1t0ibJ5QU8Bj8UENdNOz4V/to0rSr3ie1kRagJBm3A6dbiYHrvwRTN2/tBD4+A== X-Received: by 2002:adf:b257:: with SMTP id y23-v6mr20147863wra.95.1524573922193; Tue, 24 Apr 2018 05:45:22 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id n49-v6sm22666013wrn.50.2018.04.24.05.45.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:21 -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 14/28] venus: helpers: rename a helper function and use buffer mode from caps Date: Tue, 24 Apr 2018 15:44:22 +0300 Message-Id: <20180424124436.26955-15-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424124436.26955-1-stanimir.varbanov@linaro.org> References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {