Received: by 10.192.165.148 with SMTP id m20csp4616400imm; Tue, 24 Apr 2018 05:52:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/AzRMrGoU0U5upynKMxrseEpnMHxS9FFNfVSw7GGsRWOMKn22y1cre76pAPNiphUiKWLM3 X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr24281756plp.136.1524574346335; Tue, 24 Apr 2018 05:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574346; cv=none; d=google.com; s=arc-20160816; b=YYNJtvDRcq+Q1vbR6l/FrDGu6TrQJGUYowfYIPzUkv1mpYMpGPActlH+q5tTRY7OIx i5HEyTHwMnqdou5CrjQqvlhTW4k3ncl7sLYWEAo3ZdDi7+3U/R0cCdb0o11bbiWU7pxp CNEO+Bc5Mu3t+JX2O//TeGbmMCaikDE2NZH5iDTh2Lpk0KMO9NjJY/WeV5sphol4vwrr kDcexdXjMaoWOCryMMT8zSu2tIY/PzIjcZxKQMUCRNGIYbXHyb1PcpuV6sBRExUXlY7X 4vZDCYa5VR34VTBhLaEE2pY8mgs/o5BqaHUawz/YbP/2kraBsCfJDMCpHnxWlNN7N1l/ 1stA== 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 l27si8460106pgu.353.2018.04.24.05.52.11; Tue, 24 Apr 2018 05:52:26 -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 S1757767AbeDXMtZ (ORCPT + 99 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(-) 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