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: 10359553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70A14601BE for ; Tue, 24 Apr 2018 12:51:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 634BE28DDA for ; Tue, 24 Apr 2018 12:51:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6124D28DE0; Tue, 24 Apr 2018 12:51:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D186928DDD for ; Tue, 24 Apr 2018 12:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933245AbeDXMtI (ORCPT ); Tue, 24 Apr 2018 08:49:08 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35601 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932866AbeDXMpY (ORCPT ); Tue, 24 Apr 2018 08:45:24 -0400 Received: by mail-wm0-f68.google.com with SMTP id o78so611837wmg.0 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=Te6VXSNLO7mUpPPRaNYTZqmkng+7lGqflvtvO4OG8NxtozMOH9OE+XOtEjPsTRma3E sZH0Q/MNN+RpFX2r5np2aynIkR7NYt1Xbb3cfye4jV7SL5lwJQsWDbQeCunX1uv1ktmw t0c1cfmsMjnsM3wvX6HgBVU/Lk0SIj2tbAxSVs8sVyC6cBLXWZ788r8FXJhntt7kNuwV btCaHiF25iSwN+/8zzVzGViCCM8Wo4UIZAknC6bs+5kSZqUDGvzf0/PQaq0DNP0oNzlY Yw/aEQ78OGdeOX0KT7eiyj7vYjlEMbYuZHNaY47i3cYrQcXBCNZ2GVJaV9Ve5WgfLi5J f+ow== X-Gm-Message-State: ALQs6tCaMd5djhKP63fyALLkSjs43cDgC4yo6cf/AR/Fhm1ongn5nMmQ 3MnU2IJEoCV0ZUg6MhI8J6kGCQ== X-Google-Smtp-Source: AB8JxZqIa/169YJuXPb1ZRfpnXwRe/8hx/EWKpVECQr90cOqfy9VgJ+7dYDWVCtHS/oW500vi58jpw== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;