From patchwork Wed Jun 13 15:07:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138495 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp852012lji; Wed, 13 Jun 2018 08:12:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKzpEFcD5yHTmENHM6WZZJrK2c7cAR6Br85LizqkJzQzi1DBOjSjOdDctDzO01LRj5eMc9I X-Received: by 2002:a63:6dc5:: with SMTP id i188-v6mr4361199pgc.391.1528902749004; Wed, 13 Jun 2018 08:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902748; cv=none; d=google.com; s=arc-20160816; b=gaEWumLsQweBT/avDbc56vOKoSkqWDogqAZg7pkYBtLCcVi5h6SLIFwLsxM9b1LCrZ aF0CirVSK8hZ9USDXDx7e8Bh4wL7s55tp8eluFb0MPS7NNGT1ug9vWxnX/OSv/Buz5bQ CFQ7Jb9CsbGJ8UCVZhWDFfa2zb5W35NzdJCAM8illUT01cZzL4qs99065TU5eJvq2GY0 MJmK6vxuFazzCsgwSE0a29OJchonSqXl8dY2FJCsXQPIM3h1YX+YqV156i6T0mWZkDj3 03cTe83SlA0fC2eCChxZ8UX+DyMRU+1r7ums070gGxih8l3M8kyK9AScZ79gvBUcB7Qd hFpA== 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=gKu3zkT3x/6dlNulvwoelUxMs1GqggQiCwGuP9CeVxZs9t0pgnr7Kon0O/vX21V9ZE kpmE/P4lhfItQ8d2hNuqKwQb9fAxRaHKg3DbrkBQ7Qc14qIXdCYDA3DDrE4ZKnowxqiL lhX8YSkG6e5Bty18I3DqPMr7M6u7ONDlqoSjMQzAFTFWHiiYBgeteFYbvNj3qGhc2n1L +UtTVWcDU9rlSYg5hG0LIrCR/IWWU/bJFBf/aKggxdo+8Pole3nvL9HbzyR5TU+fQgZI HBm3sq9fhauv1XTJeTnCsGwJfDueUwWmUcUmIJHt7pgybhuuX48NNJYFrS+fTbdhSgc7 nX3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Peysxwj/"; 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 m3-v6si3173770pfm.0.2018.06.13.08.12.28; Wed, 13 Jun 2018 08:12:28 -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="Peysxwj/"; 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 S964842AbeFMPJf (ORCPT + 30 others); Wed, 13 Jun 2018 11:09:35 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35901 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964794AbeFMPJ2 (ORCPT ); Wed, 13 Jun 2018 11:09:28 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so6113013wma.1 for ; Wed, 13 Jun 2018 08:09:27 -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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=Peysxwj/SxfKV2HWMBS22WXjOKTcC4lZjBQI9R80bN+ZxC3VZcVtRvL+YNKbzybTRz I6Bzi9UPL4pM2ajXjyAga3Ihmiv3p74n3CZWAeWuXB98WxmaiKZKzBwViRVRKtm5eG+K iQ0g0Ev2epWxrIHAWaUPnY6b87df6s4dfC+k4= 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=tdgb7i3pHOc18juXBnV581NGwky8g4nU20Ecgz01uNo=; b=N1XVaetj6+a77OS5gFo4at7igXwPKuM+AOrzaETka1BXgL9/Ajx9Zofz+DNcoLr0LH epHRZbRkBKn881kZ0wHqP5itrvimjnRoLYBremO9klMchRWmq+Q8e4dcmrGAkm8QQ3Lz IuNyyo8kECxi4DPerw1Bd+CHKGxIEyaVn2hvQErUvfcDUH99mEpXl/aiKc1BU18trh8P LuWXTIPlNoVdvWQalGM985ds2S2cdvQk5tKf/wwBR49Z0bm6LQ9hTxkePdLBo9dsBcpY gGlm1POP1r+vz6q39svvWk47UCi5wk0cs6vW861jJ2aA+hJdtkLzBj+J5QlV6OtNYq1z O7Cg== X-Gm-Message-State: APt69E2rPIvFo8u6UT3ZcV6gDJN4TRyVC7DeTEzI257kHgR4NihZswA3 NbANFanNCeN/9Ax3tk/BOveaKw== X-Received: by 2002:a1c:40d4:: with SMTP id n203-v6mr3687240wma.101.1528902567203; Wed, 13 Jun 2018 08:09:27 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:26 -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 14/27] venus: helpers: add a helper function to set dynamic buffer mode Date: Wed, 13 Jun 2018 18:07:48 +0300 Message-Id: <20180613150801.11702-15-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 Adds a new helper function to set dynamic buffer mode if it is supported by current HFI version. The dynamic buffer mode is set unconditionally for both decoder outputs. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 22 ++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 +++------------ 3 files changed, 26 insertions(+), 12 deletions(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 03121dbb4175..e3dc2772946f 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -519,6 +519,28 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); +int venus_helper_set_dyn_bufmode(struct venus_inst *inst) +{ + u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; + struct hfi_buffer_alloc_mode mode; + int ret; + + if (!is_dynamic_bufmode(inst)) + return 0; + + mode.type = HFI_BUFFER_OUTPUT; + mode.mode = HFI_BUFFER_MODE_DYNAMIC; + + ret = hfi_session_set_property(inst, ptype, &mode); + if (ret) + return ret; + + mode.type = HFI_BUFFER_OUTPUT2; + + return hfi_session_set_property(inst, ptype, &mode); +} +EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 0e64aa95624a..52b961ed491e 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -40,6 +40,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); +int venus_helper_set_dyn_bufmode(struct venus_inst *inst); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 31a240ab142b..92669a358a90 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -557,18 +557,9 @@ static int vdec_set_properties(struct venus_inst *inst) return ret; } - if (core->res->hfi_version == HFI_VERSION_3XX || - inst->cap_bufs_mode_dynamic) { - struct hfi_buffer_alloc_mode mode; - - ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; - mode.type = HFI_BUFFER_OUTPUT; - mode.mode = HFI_BUFFER_MODE_DYNAMIC; - - ret = hfi_session_set_property(inst, ptype, &mode); - if (ret) - return ret; - } + ret = venus_helper_set_dyn_bufmode(inst); + if (ret) + return ret; if (ctr->post_loop_deb_mode) { ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER;