From patchwork Wed Jun 27 15:27:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140342 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1026970ljj; Wed, 27 Jun 2018 08:30:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMAFvjCL3jNMYqXMjnBrcBVsV5KYyYBBk9JtDM8dCeZTMcJr4a8ZNfsIme4McrhRmg0CvY X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr6464376plb.279.1530113428454; Wed, 27 Jun 2018 08:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113428; cv=none; d=google.com; s=arc-20160816; b=ZMeMrM+HG4WuONTMAXJN6/rvnHPTW207+QCemllC/jFLNVLeBfgR88TgimqXdCtnYN B3O7UVcIZN6pAoN6CL5S9Xp3UUxKAZYrVfNM+CaRGQ262eKQAr5Cg4fOBo4jVhefmhxS E2vG9EC9ahy9yvy3A1qLrYyYDPSaVNLUPvs5A25hCJQMvmA/CDKx+qpQxqs8xmPCTBMa MViSg7YMwz2aPHlWZjqSnf1PXwvaUOWazLAVEhlHYpOYbDZ2bFslF7uB24nifkXDUpIb ydc6Pa8QCKjD+rd2WvdUWf0t3BnMa/yiI8PIq43BsOA/XlB2ipY/BZ1dod0UrxsrYTDk QQ5g== 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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=bIbQd4ArfjMn9GDniuTDdKnscPxHPExwp+idSejmniKgiX3BWXvLwpbI5DBteWIZnk oWDuOhi+O/loVrnxECcbbSLML3iKC8pcyzej7kBibAiyMKcudeyeYXNW/bN2yL3Mrutm 1kAVsi2FSDMA09e2KFUCU9nD2/Q+tkRhrfj8ehzaRfwV3Xg0Dq5IMc/iq8WnTcGQiZzM +ii+GLv3YEz4JLTbpzj7MaLkHWf9HGXJVbBGtNIh0y0d6Z62Eg8rwoFVPmMxvXYmnEny aoOhsUyd9YXMvt2l3RWQizN5RPt/q2D2TYyF1NKhrumxlsH+9PHKOqmDKbpODzK8gp5V gFdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbNwQtG2; 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 o5-v6si3770487pgs.303.2018.06.27.08.30.28; Wed, 27 Jun 2018 08:30: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=EbNwQtG2; 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 S1754638AbeF0PaZ (ORCPT + 31 others); Wed, 27 Jun 2018 11:30:25 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37121 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964969AbeF0P2Y (ORCPT ); Wed, 27 Jun 2018 11:28:24 -0400 Received: by mail-wr0-f193.google.com with SMTP id k6-v6so2479326wrp.4 for ; Wed, 27 Jun 2018 08:28: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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=EbNwQtG2ppKGxlecIPu3W4ImpNvAsO6Hrzj2CYS7cMP5VdpnQ82snR1s/VKxpoMPD+ 4u60M9G0+8aWf5kV0cULVIqcG6qUN2He97HooG3f/Pk4OPB+cBBTI1FPSGTf/IqU6abF 12bAikshHDQPOR7BMUfbnB7Ep3fkNhhEU0N/k= 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=VRMNPzwCVtxgb0LfMFtJgW6g4iKfhAD4kYYPw52509I=; b=CCj3U02Qho1YgPDr/two0WprCcEl0yI6dzuOuzUqU/tCaxoZImkaiYS0wYvsK16Vjd 4DiEvImYPvM2tAG0k03voNNzy58TghAoNv/QITstm3yRed0Bblh8L8NQlxTesCpar2SX a22xcsMfBVG8L6g+3d9aZBSM0GgOIVv9Sih3qZDdzMt7SGfx8Q5qqFQq9xWVmqguKkGK 01ZDCF0fFINvppTYfMR/NrhMWoOXAbPkDhcWQgoajA2dVeBNHsIA1l4bou/WFSH8cbei 3zMT6+FJNv805gXbaUAiW7CAMdALRJy5+DeujpTdQvHDtLpuUCGN8Mz1lK054XQXQdSc WT0w== X-Gm-Message-State: APt69E2rMp+WrfSw06lHhuLYU7QMJSEtkql+8yJduc62PecEyPp1D71C Lz0w8xE/y1J7yBJQPcWlhfJe9g== X-Received: by 2002:adf:b60d:: with SMTP id f13-v6mr5364050wre.186.1530113303105; Wed, 27 Jun 2018 08:28:23 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id o203-v6sm2916075wmd.30.2018.06.27.08.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28: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 , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v4 21/27] venus: helpers: add a helper to return opb buffer sizes Date: Wed, 27 Jun 2018 18:27:19 +0300 Message-Id: <20180627152725.9783-22-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180627152725.9783-1-stanimir.varbanov@linaro.org> References: <20180627152725.9783-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a helper function to return current output picture buffer size. OPB sizes can vary depending on the selected decoder output(s). Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 6 ++++++ drivers/media/platform/qcom/venus/helpers.c | 15 +++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 3 files changed, 22 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 1d1a59a5d343..f8e4d92ff0e1 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -239,6 +239,9 @@ struct venus_buffer { * @num_output_bufs: holds number of output buffers * @input_buf_size holds input buffer size * @output_buf_size: holds output buffer size + * @output2_buf_size: holds secondary decoder output buffer size + * @opb_buftype: output picture buffer type + * @opb_fmt: output picture buffer raw format * @reconfig: a flag raised by decoder when the stream resolution changed * @reconfig_width: holds the new width * @reconfig_height: holds the new height @@ -288,6 +291,9 @@ struct venus_inst { unsigned int num_output_bufs; unsigned int input_buf_size; unsigned int output_buf_size; + unsigned int output2_buf_size; + u32 opb_buftype; + u32 opb_fmt; bool reconfig; u32 reconfig_width; u32 reconfig_height; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index e332c9682b9c..6b31c91528ed 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -608,6 +608,21 @@ int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) } EXPORT_SYMBOL_GPL(venus_helper_set_bufsize); +unsigned int venus_helper_get_opb_size(struct venus_inst *inst) +{ + /* the encoder has only one output */ + if (inst->session_type == VIDC_SESSION_TYPE_ENC) + return inst->output_buf_size; + + if (inst->opb_buftype == HFI_BUFFER_OUTPUT) + return inst->output_buf_size; + else if (inst->opb_buftype == HFI_BUFFER_OUTPUT2) + return inst->output2_buf_size; + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_get_opb_size); + 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 8ff4bd3ef958..92be45894a69 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -48,6 +48,7 @@ int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); int venus_helper_set_dyn_bufmode(struct venus_inst *inst); int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); +unsigned int venus_helper_get_opb_size(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);