From patchwork Tue May 15 07:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135833 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp668332lji; Tue, 15 May 2018 00:59:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp+fhvjAkmgg3K30HG3slRy2WCKMCIhKlC/jf4htFhKLd7VNxtjGWdNnjZ4eIqC24liW8qf X-Received: by 2002:a62:3f4e:: with SMTP id m75-v6mr13841066pfa.176.1526371198676; Tue, 15 May 2018 00:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371198; cv=none; d=google.com; s=arc-20160816; b=YjX89qYH42syH32XnooylEXNy5PkMMLiMuVBf17MpLdU0o/jRJewgcIpgiaMVNYSbY 9sAwNIyaZZAKCyCEIuV59yqJZMuCMyZxh6pajGg9lKF2aTX+bkTDt0hZPbDY9PaqEsNI MQGWWwuRoSr6Am+V0ZbV71EvvFpvjXl2oPgtS7pvvqcysRJ5bZv4sSQud3UcGRbzSXLj 9ckDvuocjEFNz3Uv+u+b3CjOFJQUW4DahgrLCatYYIw/5QOPuBIWpr8kJION92XAUwQ9 KykJVVsf2002UWbSaUtD1R0dUba6cUfUyfPB6jvamz3shb2ZPcwV0F3MuIiMLhAbTz2d blyA== 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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=Ybkdo/PqKmf2NR0MuNkys2mm6aVhhYwz01BVoL5MgIA/uTV9jKT6OUPCvBDAF+PqIi tS9SQmjCJ10YcfGyXdnML1rRQBAJCwWcKaPZKBhs0Ahtsf5D0OV/ESNvemNg88X0G/+s 4rkGo1gMQWxp+vPk84FP8BxslcpywHoXUGGwCUi7j9VI4A7XnR3ddV0KTVx0dMdfHK6I wNhEIybNtNensSSEk/JbixOcI3+HZZx3m9+dUl2Fu/0KG/Kbr15eyzAfJKQSzVCZu9dW 8NSznP0kJY2gnx6TUF1X+zNfBs8tQO09iyLEiM33OdSQgFH6us4xK3JdWZ2D2O6QmGeZ OYeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewneyThd; 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 r10-v6si8803116pgs.647.2018.05.15.00.59.58; Tue, 15 May 2018 00:59:58 -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=ewneyThd; 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 S1752631AbeEOH7z (ORCPT + 29 others); Tue, 15 May 2018 03:59:55 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53280 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbeEOH7q (ORCPT ); Tue, 15 May 2018 03:59:46 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67-v6so17596225wmf.3 for ; Tue, 15 May 2018 00:59:45 -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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=ewneyThdcAqzj4RqNgCUyAhUSfTCPVBdqcepApBNK95kril48klFM501kfC7OXEgY/ JQq2yUDUjO0RYs8lIxnWrkPww19HnIz787hUwOBqwJluTgU5gr3cC+dVrX7J5iCTJTSs i7tM0o98fmP5cAdmYErSinPzuHHMPTzdRd8XI= 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=3Xf+55afhjoDcaeKubJqAzHOIUCCK3ZQ+JCHq5q9y4E=; b=UydqNOe8bjARVgA5ftfVhY9xyazQ/afHdOZ8iDggzJabFqVwk7vMUKHZoxCIDoE7s3 cplXH0G1lIGy1RUzBlorJbcYcTC4cbon4KkUYqu/VC3DbG3VLx1I9COqqVs+DQma8IU9 nJl9mitdTheOezxLyHbhk6uU2dd1yY8rKcU6KVFwltEvtTYL8la/Yf8FFA9Y9iQHgJrZ 2xLKkNQrlIHqTt2H7PLykZoLpJqwwOKjNbY6Hhx7aL991mSAxm4sxIvCu3JljQ2ctYOB GXrAgQoWSAl5mlINEPmlOhAXpHPcp1KgFmNEZf9kbGkEFac1gCt7ORnYtuwhyRCo9Ha7 9OTg== X-Gm-Message-State: ALKqPwfLJYUVR/5g3ZNXDGJok3ZL/2knqWIHXfZOpVrOcvTcbW7SSu3r JSeCHjei0thr6SElVUZNaqh6Ug== X-Received: by 2002:a1c:be0f:: with SMTP id o15-v6mr7463328wmf.104.1526371184956; Tue, 15 May 2018 00:59:44 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:44 -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 v2 16/29] venus: add a helper function to set dynamic buffer mode Date: Tue, 15 May 2018 10:58:46 +0300 Message-Id: <20180515075859.17217-17-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-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. 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 1eda19adbf28..824ad4d2d064 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -522,6 +522,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 2bd81de6328a..271192273953 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;