From patchwork Tue May 21 09:54:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 13669117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1C34C25B75 for ; Tue, 21 May 2024 09:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eSwSjlNgRbAgB9WO7JTO9OLGDDA30JpAdJocL9b6DVk=; b=Oz8isXqOOhK1PE Zp5nf24L1NSIJYsmV1UI2kz4dYx2U8hgVN0xWrilgvBMeidZ79lHtXJUqT2W5dJjg5/IlxRS85q4B 7KciYQrwvZoigU9PK+I2p6dvgXf2MFomKYXQZVDdGMDbEYlzgxdjHKlJfBYk6KTFPic3vpkYkLSF+ 15+7doj0PBJNykQnILQnkv1rywyIN26kjM1k2YPivA2jzA01SeVGLrmtfRD0xrjKKYKFLDCZ0LvbV ZNk3ID4bgas/qJT9HCACXhIkoL+4fcuxk58GSUHelwEI0KuBNZVkpwsXD7R249ntef8KsukUA9eyC LL6MAzDz0/djRdS2+DgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9MDr-0000000GyNI-3z74; Tue, 21 May 2024 09:55:55 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9MDn-0000000GyLo-2vm4 for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 09:55:53 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6f0f7ec684cso1990062a34.0 for ; Tue, 21 May 2024 02:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716285349; x=1716890149; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QIL8bJvqQtt10T5yeC3JXxYF7RA/JJU1vyZUZM4XpQE=; b=nUSJFCslwhUIEIlM6I/7fxU4b4HIl6+QULYodnVl+JRmy7h+bsUWETt8xRzvXrF/tS qllI664UlFqFDBcpvA4mXGmSpDbfmeHVk6pBnxDxGGLILa+RL8uNEg1xN+hMGIiRvFgu rsxC+iVqPQMIuJgauJeoQ2+Ynb4P+EszC130U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716285349; x=1716890149; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QIL8bJvqQtt10T5yeC3JXxYF7RA/JJU1vyZUZM4XpQE=; b=FUEQUquxUcfQQ7bdWDdHf85ju+ujSJYavnN8Clrd53FxtXmb4TsZmv9tVXupXYBKAE n+4WYjIJBDHkXPBrqJ7hUloMZom23YI7AEE06OQgeGOrkoIupdOccyTNi8J2nuA6CZsB hB3ZwISxcPegNQOGhKprge1ipVVOJtRGPEEl4XGc5HM1i7XfMobOyR6dwVRAZcGzKlSf aNA3zeGMNVAWNOkwHbY8vNE9AQ/C9ikOQsjOuowDWHb1oFyIOHv79pJviHct0XlZPPDu STpmHx78osQgrBXvNyT+BTLo5k7IZXK7u4yU9HojQ3gWNlncIOK8aGQP3OGe5oiG8M/f Ol7Q== X-Forwarded-Encrypted: i=1; AJvYcCUKaT4iYRoJ4a9S93NQeMiAoUfYveADrJIyZ1G6vgiJxiV9TIc4y5qY50mW6ULeLpRNBEpMLFFnH4VzIcXekv7DE7E5b8Bw63Zx0wvX/h4LgJ9WqcU= X-Gm-Message-State: AOJu0YxvwvbduTMF/rxNFeKzEyneqXStBRcW1Zop0pBtqd6fB3GNO95s o3vlxIKyvJulgWVAFIDwpNfShSoyyN+n6IYjRUb9Db90/I4HIZOrKw6IbatDwQ== X-Google-Smtp-Source: AGHT+IFKIYFqTMarrGIwJW/xjD4E5TP4smgp1LW/1jUBwGpm9C4Gsb/IKEVVDk5X70ezxhmNydvPxw== X-Received: by 2002:a05:6830:3299:b0:6f2:5b44:593c with SMTP id 46e09a7af769-6f25b445a16mr6106649a34.35.1716285349487; Tue, 21 May 2024 02:55:49 -0700 (PDT) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:7412:b980:a8eb:dfa3]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f679902e57sm10016198b3a.110.2024.05.21.02.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 02:55:49 -0700 (PDT) From: Fei Shao To: AngeloGioacchino Del Regno , Hans Verkuil Cc: Fei Shao , Yunfei Dong , Andrew-CT Chen , Dan Carpenter , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , Tiffany Lin , Xiaoyong Lu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH] media: mediatek: vcodec: Reduce msg queue trans buffer size Date: Tue, 21 May 2024 17:54:56 +0800 Message-ID: <20240521095536.3869399-1-fshao@chromium.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_025551_794661_F6E56B30 X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In the MediaTek HW vcodec pipeline, the `trans` buffer is used to transfer the data decoded by the lat decoder to the core decoder. In the beginning, 6MB and 30MB were allocated for the trans buffer to handle FHD and higher-resolution contents respectively, but it turns out that's more than enough in practice and there's room for improvement. The buffer sizes were reduced to 5MB / 8MB respectively and the decoders have been validated to work normally on the MediaTek Android products. It's time to adopt that change in the upstream MediaTek vcodec driver. Reduce the msg queue trans buffer size to 5MB / 8MB respectively to optimize the memory usage per decoder instance and improve the overall system performance. Signed-off-by: Fei Shao CC: Yunfei Dong --- I consulted Yunfei and he confirmed that these are the sizes they are using today. .../media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c index f283c4703dc6..e36741179a97 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c @@ -29,9 +29,9 @@ static int vde_msg_queue_get_trans_size(int width, int height) { if (width > 1920 || height > 1088) - return 30 * SZ_1M; + return 8 * SZ_1M; else - return 6 * SZ_1M; + return 5 * SZ_1M; } void vdec_msg_queue_init_ctx(struct vdec_msg_queue_ctx *ctx, int hardware_index)