From patchwork Thu Jul 5 13:03:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141131 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1921424ljj; Thu, 5 Jul 2018 06:07:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcHW+E/zOHX+Pt5Lpe9dRDM8awdv1gsSATKJbrJCZoeAcs+0rxusED+QTXFz9UoEwqMpzU+ X-Received: by 2002:a63:743:: with SMTP id 64-v6mr5730968pgh.216.1530796067101; Thu, 05 Jul 2018 06:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796067; cv=none; d=google.com; s=arc-20160816; b=KZVAX+182mIdgVqkGL4cV+QizjKxkgsScyoNNCVpFmiPfj4hhB9G5GVvbmF3CnjlIZ w+5IidTHLhb7tVoa/QFlBGXkrC3y06DYYvKAPtzqzGCFYZd5keTtYamhv+CX5C7P7FtH FsEhC3zoZEzcG5w0LoMX94gb6UG70iAamJZIkDquEmq9Pj1b54l8tugIcicyVF2mOdtX gbviG5VaQcPF1Bzm3xxAgjNRCDb7y1E9yybkUAez77PtqBEllIichFBVnXsshNWpNE7g ZX3LW8et3TcjU12p6TX5ancTYZd8uBgVn8MXORKfDzpr4UeYvd8JHzZbD9DeRP8P7z/N gS1Q== 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=VamVn5fSKrK4jIDm67aUg+jNMsWMI46PpJA4aHsLT5c=; b=SgXa3CSDrPJ57fRWPH1Qcks0RIHbyccmspIuHbvr2W7BDW+kKrx+0gYhTki3aI8KuT /6f1n3JWvs8ctqjegDuTIc7uYy76WMF5JRJzU9yHbbEpoMECu76q00HRH3HgU6ZDH/h4 HKiCKRh3dRiyRdjt700Fq6QvZ9BnPWglTXPP2HICLih93VVjVQMUydD5659hjjCdl+wh yhiDouXRcM3KmIcbmwV8FY/UYGF2OxetmkhDSMIEoW1wPzhxz6XxmfmEzgmwQfCc17OG LvXcgECnVth5jMqNbiI+Y/TLruw6shuRkj+vAaUJlxwBSpTW7F/rsIcpElEvTPVLMSVK bc1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ALkgydW9; 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 h21-v6si4017565pgi.430.2018.07.05.06.07.46; Thu, 05 Jul 2018 06:07:47 -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=ALkgydW9; 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 S1754571AbeGENHq (ORCPT + 31 others); Thu, 5 Jul 2018 09:07:46 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53205 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754450AbeGENFb (ORCPT ); Thu, 5 Jul 2018 09:05:31 -0400 Received: by mail-wm0-f66.google.com with SMTP id w16-v6so10970211wmc.2 for ; Thu, 05 Jul 2018 06:05:30 -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=VamVn5fSKrK4jIDm67aUg+jNMsWMI46PpJA4aHsLT5c=; b=ALkgydW9wsSzJuQFxkwBrZrmo5SRODbIFWkta67CEBZlOeDDHcqkUu2Flg2aoO2tI6 rz9Y3VO8tMo4s1qW/fB8Dvctgu4TbDIBD9hb1FwK/b/3a+OSOL930kz6JgaIg3xzOCP6 8tLN5zZLMzQgoWSERoZSmVIBGe/erThRa5sbM= 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=VamVn5fSKrK4jIDm67aUg+jNMsWMI46PpJA4aHsLT5c=; b=cdUv7M7A5p+Rf+l7UbWeI53ocWWQYbl4+Jh++P605Pp6wRt1rqaKUzWvUU/UMaiS94 +br0b3YpFEzILjK/ZSpf5IUfkoYnrcY8IL8QtF0tAg5oEkPymlsIa8sDUuAnP54x4aX8 HZJeiUlr/Lb8P4wAvs4AIHk+vo0oU0iLtV1DhEC+nntm/p5+tu4abnuntSTkzSjU7z2C z71SSXSN7D+xdUmyohJ21oOch5244aswfc4MXihl6um0FGfSN9ZUphjZ95okpU5jL4AB oTIdDICzAG6nH8b8KFiGS8MjnPlGkgaMulLWmmZgdwiwl5Ez0CcLlroR/GMsPCWE8b2K G9IQ== X-Gm-Message-State: APt69E1iD3qsrNybvZqfCUicjGqcG+9L40aexOJuoLKWtq3Pke8Kmv3o wg0/HqZ29l2zVYXJEGwchio/uQ== X-Received: by 2002:adf:c00b:: with SMTP id z11-v6mr4394798wre.268.1530795930265; Thu, 05 Jul 2018 06:05:30 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:29 -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 , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 21/27] venus: helpers: add a helper to return opb buffer sizes Date: Thu, 5 Jul 2018 16:03:55 +0300 Message-Id: <20180705130401.24315-22-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-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 13f0bc4e5ffa..8d2f4db52e48 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -613,6 +613,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);