From patchwork Tue May 15 07:58:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135842 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp671173lji; Tue, 15 May 2018 01:02:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+kclnZ2lHYcNTYgC7sdoDmyKb0l3VcZRjKP11N+qFf4kRhq6fdo2xBpWH3ClNLwlIYzyG X-Received: by 2002:a65:5003:: with SMTP id f3-v6mr7261071pgo.433.1526371361558; Tue, 15 May 2018 01:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371361; cv=none; d=google.com; s=arc-20160816; b=RPLRJI4+6HK8N1XRg/w5atteuFCI3uOH5mgevgkzjEZGVdFVPddbbAMCXUHvlt844Y 5WpUg66Hee5lsXts2eBlUGNEEWURLr65uC/6bvxtxWF8DFrQwelPb4pm+ahbi2N1ofHw 46SBuum1ufFi+f2ZQOmgkn8IwWOGzZDSD/0LQzrxm6L3nvbl4+STz2Jbf/iajZ72hOmg UR4d5nK3/D02JE42x/usjV/FP1Nv6t0WB8VykD2r63MKM3Kxminv71tnJxPimnuN55hK AuUuo9kpqcvOUmI3F6E0USr0Ax4bLz/13rPSOdZH280mfVNMbqW0K0BsRcCuC9K7e0/r R8AA== 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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=Bdn3MfeTIFTVPe0UvVm9mI8Ap2DmBiAeUDWbQwfCM25qtHkxwXvopJwSQ2RsMxZQyq vqidjmzRd8RXDbnk+QfLofkT1PXAafHCj13JPGnGxdDTrCq4WLZGqgyuMAUK2WGbfEvV e4PihrRdGFxh8Wr2xLI48rAGWAc7p8rQA/iQTm5ozfiKLspP4tT1mj+r2/PdO4H93nzI Dv27WqsV1gFNU7xwRZlldH4rKzmLbFsPfDhdtk09VFVUI9ZG7XZIaLjWoQSqPo7Tpwml eA9d89DFQzBu2mQwRYFQQOV+OLD5KR2FLt/meIMYgHLjsKy3cryQRVN0fwkW3QmiUYsn WaQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MgK4hmBD; 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 m79-v6si11224021pfi.236.2018.05.15.01.02.41; Tue, 15 May 2018 01:02:41 -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=MgK4hmBD; 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 S1752687AbeEOICj (ORCPT + 29 others); Tue, 15 May 2018 04:02:39 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37214 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeEOH7x (ORCPT ); Tue, 15 May 2018 03:59:53 -0400 Received: by mail-wr0-f194.google.com with SMTP id h5-v6so14902933wrm.4 for ; Tue, 15 May 2018 00:59:52 -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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=MgK4hmBDadyXeaBvily/j+KQ2LBkGgVfN86lRx/mWoj114KiMMKVxsF+gyq2gYdeKj y53wvg3iWMhfE5Z6uN1Q3KNm2HOpeHeu8l1DguNL8vGiS02SR7xy8rerXONn+5TbTJBw I4Y7tX/9Htv4lhzc7Ddt0p6XBFh0XH87iPxMU= 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=hWZfGvfu/2NalLUr9US+fWfp5Cl3dsxLRK8jVW0R1to=; b=SyTYXdnAUb+dbyIuoWaqZMKR1h66NBwqN421SFpTocKcth9duFAfqfVdvqK+oQjVr9 nOVhX5K9dFzO/pdBOmSRElZgr2NyRLHm6Nra/n0oQK5QyCJltBdstDwiyw4h7VwoEBQO dzM8ebExJrmvHz2TMtugjKn81qebReA2Pcxtzd0rrdJITF22cNdbuTwtbbbPZnxmi6Qe KF4DisaJNA2lmk11lkFxNk5yjTwKY1yuByh0KhfCJpQoKdVQypKceiXFyzyR34qRrSHL 35xIK3eGMdAmVr+TiMWnyIw9TRPRoUWaKPTnLg1Dws225a5nirmIBC3p4bHyAuMH+9w3 FdBA== X-Gm-Message-State: ALKqPwcyl8mY425ooiGnauAax2SRMjORCn7141gSdS+YYno77MOZt98P xcIVsL9lOOLFDHC67kwuiK9JPQ== X-Received: by 2002:adf:9615:: with SMTP id b21-v6mr9417489wra.253.1526371191906; Tue, 15 May 2018 00:59:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:51 -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 23/29] venus: helpers: add a helper to return opb buffer sizes Date: Tue, 15 May 2018 10:58:53 +0300 Message-Id: <20180515075859.17217-24-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 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 | 10 ++++++++++ drivers/media/platform/qcom/venus/helpers.c | 15 +++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 3 files changed, 26 insertions(+) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 255292899204..4d6c05f156c4 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -234,6 +234,11 @@ 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 + * @dpb_buftype: decoded picture buffer type + * @dpb_fmt: decodec picture buffre raw format + * @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 @@ -282,6 +287,11 @@ struct venus_inst { unsigned int num_output_bufs; unsigned int input_buf_size; unsigned int output_buf_size; + unsigned int output2_buf_size; + u32 dpb_buftype; + u32 dpb_fmt; + 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 f04d16953b3a..f0a0fca60c76 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -611,6 +611,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);