From patchwork Tue Apr 24 12:44:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134082 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2190740lji; Tue, 24 Apr 2018 05:45:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Eym3IYzCWTQYgBBv/rwvD2leTYdlMpFU/hZ2/hs40LyF8IIwm/nshIb+yT+6T+S5gAxCB X-Received: by 10.99.97.133 with SMTP id v127mr20067922pgb.441.1524573948365; Tue, 24 Apr 2018 05:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524573948; cv=none; d=google.com; s=arc-20160816; b=K4f45cMfCM0Sj+XzUrFfUsyTHAi+MvhzbMhopk3vSVx7q9gRbcASWobMssKHFPncf3 wn3oosjB26Gvd9t+c1AvfVlc+tHpi6l7sQHFRgVDH5F0NrdnzMyjacrQWs7j6Y3X/EkF x47NRrnP+U+Z2zg1Y5IpSnI8Xk1VDtWaDVHim8QXJ7y3OnELNfYkTYjGXtHKDVwuOwXA 1PQszBCZCoKNBGo4cOoXfxhk0X5UlzbqurZauMMF6FYDSPOv36vQKBkYXrGURESGu0jn PZKOA0bRo+s/bI6oiYt3tQSGlNIf9NSzCURloS9KM58MIwoWnRYWeQLiGAXHPNbIFXlK 3/sw== 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=7B6IvLTuye/1rlg6k8AZaH17yDl83HW+r2r6SYhmPsQ=; b=G8f8wUexz+SIT50PEqJYs3c98+fTf82RT/dPZpCteJmQ+EdXRNg2HVI/+mqZ6bpXKY /w9l5mWrp5TTCR39wZWu9J1FT0YeDSYTAjmYd3cBKrkPDo0rM6JSH5Kj9pU7D09IDRms /dwXy60oimaqe77LHaOGPnhvDmHUFY/c8mfD1HU8lZ4cUGhrPX0ujqMs7ozfKVeMxSJz j1ep4E8JXiBd4tLMPlVTrhmLFhWpd0phMRGE8q/j2OlCWkkhAJOMlDHE1dRy2Mr1rB+m HgnUOB5if/S+W+9yp/GzA2ucXro63I8BD3+Hyxyq8HvzeGqfan1yS0eUvujQL549KPys y8xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hYuuBi96; 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 s2si10967882pge.176.2018.04.24.05.45.48; Tue, 24 Apr 2018 05:45:48 -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=hYuuBi96; 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 S933051AbeDXMpn (ORCPT + 29 others); Tue, 24 Apr 2018 08:45:43 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36502 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932864AbeDXMpY (ORCPT ); Tue, 24 Apr 2018 08:45:24 -0400 Received: by mail-wm0-f65.google.com with SMTP id n10so609144wmc.1 for ; Tue, 24 Apr 2018 05:45:23 -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=7B6IvLTuye/1rlg6k8AZaH17yDl83HW+r2r6SYhmPsQ=; b=hYuuBi96zorLIMlfZrTgILdQxI+HBtJRSl1dlt/0ne5TNgkcLH20IxwjcXIgf2VrRi Z4z3ylsptlUTB3TBOICxEC0MKTUHySugho6Q8GEhxwGS7RgxelE7/YhrkWAUHYKuSjWF H6TsjMPEy3kJXNOoD7XHhhPfij0zNhz7SOy0I= 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=7B6IvLTuye/1rlg6k8AZaH17yDl83HW+r2r6SYhmPsQ=; b=G0HvxUbl79uZrBvxjrZxMJlfVN5V0hz3eh540tVTiKIu8yUViEU8MbmUwmXdQo2GQ6 /oad9Awyt3+HabuHEOAqck78sMPwD99GV2KX3qrZ5gFcsDy1MnajbwosD7nkahjDuMeO cBfYXRGlxi5UpoyxWl8u1q0cV4VVky3HdoFeIVGfavyLce8qSLcOVFdpzMGW7Avy3ZYI tfW3eMmazqKDjKbbNV1t7WCYSGP9Dm+eJfg879G4aqfsFEJaA1l0bPmkpC4A+DF8L/Wd 02UkhQAqR65DWtGmRXNTiLuURbFaMADDKvbvxg53ZZOQ5EgffLi1iBhjD3mv8be+GSlY jTlQ== X-Gm-Message-State: ALQs6tDsdhBXvmjn5Sfuc+zVMW1RvNJIq6aUWK/rlLapyIyy/egAtVfV Aoeh5ndKylOwcd/rHPkR4wjk3A== X-Received: by 10.28.230.28 with SMTP id d28mr12586234wmh.92.1524573923238; Tue, 24 Apr 2018 05:45:23 -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.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:22 -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 15/28] venus: add a helper function to set dynamic buffer mode Date: Tue, 24 Apr 2018 15:44:23 +0300 Message-Id: <20180424124436.26955-16-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 Adds a new helper function to set dymaic 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 0ddc2c4df934..1de9cc64cf2f 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;