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: 134095 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2194507lji; Tue, 24 Apr 2018 05:49:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx482q364ss/eDUWE87BqzzJiq8ElFwCYHMgOBeADfC+nHbvdqZj0TVHkiQ9mnyxJdov3roXw X-Received: by 10.98.93.153 with SMTP id n25mr15139569pfj.143.1524574170467; Tue, 24 Apr 2018 05:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574170; cv=none; d=google.com; s=arc-20160816; b=iyAdNKHYnsUiUdaW6oTsgFSxcQs4C2JQVqpFKKwo2+01Wv5aZh2NO1u9zWtmgH1E2k O/7DHffonrGxr3OHSX8IiT+2TatCwn7eJ7j/RMq0cH6Xiz5FKgCY7MCI+sDdSh4dRGs3 NRxHv6hf2vlvMuGRigTA0sQvIJ/bzQQXTBIFsGsIMB/ZIkPvw0ik3ytMHl1GMbZvKZ00 b9BMG1Zv3xjBbraJ/hj2GxmcC4QHFRe9LLVex/dngfHOS+KP/rKMu6SgwhN6TWI7iVut Wpp8CL1KnRjxEyJD+LA7BTu2XoLjJjW4E5StfGTSMVXUZyUqjh6dKrDTtpqzcnrscwhC eAGA== 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=JDBmmlMYYMLGDsJPIHCYP8hRZBeo7325bsWX+lHxZLWLAjkV8ZpANPUBunwI1qphRs 7SBPKR2o/nTxhTDvCaXoYZlgE94l4H+lV8PztSYsEq1EBfMi5yyTxTwuiVToMFzT/hWA Q8AyDLYeBO13VXsl+ma1VUnl1Hr2xzgBdFNPeWzyVpwkonFf4bd1VUOmrf61URJSxXv7 Zw4lS039SNuHG3Lc5ltrN5Z4OVmLjWOhD/HEWZIi7j1slm0ZsjMQKw6P+rmUHc2NhnHY Blh6yd3FphMnTbAgKUAx96XRsLGWFAJoOaGpxn6XA6eJbpqAA+JIde0UnySltS7vN9OL tZZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cwtni/rA; 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 y14si10769740pgr.218.2018.04.24.05.49.29; Tue, 24 Apr 2018 05:49:30 -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=cwtni/rA; 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 S932991AbeDXMtZ (ORCPT + 29 others); Tue, 24 Apr 2018 08:49:25 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40378 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932861AbeDXMpX (ORCPT ); Tue, 24 Apr 2018 08:45:23 -0400 Received: by mail-wr0-f193.google.com with SMTP id v60-v6so49796586wrc.7 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=EcWwkxHUC3kwXu7kwDtnfyGKg8cpXgacUpSlx/zgeaO61Jz0ybm1S/JHJPiHG98Gcb VDmFeUqeElL1alSjfpwkgEiWn4Z4YEYKAcaNayTeO21Oscz2JWnrHaUzN/cfpX5yP/cI e1kMM+/i5Mzp6hBg4oadW7Wri9IkOohhPf2apEDLPrVedLPkyLNLxbRKgTulj7bqkVeQ 6yfXvI/iepw55XFAmrrinTVl3zGqMAzrAnZkd0IULEXENmBGR9UN7bZvbQOfOkvSxeej uaNtYPavJsQKbM9qSldZo5HDM7cf+7JwUKyATKb+W8lUHqwHP/CnDrYQaCdllOB0Lt4p eoug== X-Gm-Message-State: ALQs6tBSHpyCQDSQyJfXUgw5YGoh6D15OsnL8LELpo3XF9tjRbjFdIrE 6zV4rUWhvMcgCP3gtq9YsXos5Q== 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-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) {