Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp780085imw; Fri, 8 Jul 2022 11:33:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vL8TqhexIpXKzKS+O0tVhL3oX96T7eBi+IpqT0PoqqOSAYfgGhsgiqZdA4eJMkP3SCBrqb X-Received: by 2002:a17:902:d701:b0:16a:2206:9ba8 with SMTP id w1-20020a170902d70100b0016a22069ba8mr5051396ply.168.1657305179956; Fri, 08 Jul 2022 11:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657305179; cv=none; d=google.com; s=arc-20160816; b=LFN8ROzVYAYAjbFV0WivbEvBnexx/6CsFhAVZxlYLAe+bInf4n06JlaVbtZXzRGAX3 K4ROxaLA86K9vhe+GDcrnRUWuRHY3Er7U1p72PGWaInIFU5ahjYKJ1ruAn4Wn6Fwz9PM WliVvJ2mgW//d3v7rqPWeh5zv+vicqu6n/zzxYW1UH59tgjJ4xf7972llWdo49zUuZ5G pUExDIqdg1WecLOBlzxHxxQn7PKiJts3LJNevzhhJrR/eaJeYfA0HM3ICcipEhNAf7rs NBfx8mFZbOOYD+FgJkjeT0AQeCsNZWQRzqGV5x2KlICPAf56BfcIAeBqZG28wkRFJdLE +LTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rQNxeoaq0/Dptah/bGSvmW9CNnE3d/kBeNKYw+7ev0w=; b=J0WhdTGRf8Z0ioXmHJ8+tsuuhEIwr3TT7Y/IGQ9l8nF07r5f9hSlw6gcxxJf7oEjnK bvLj2r6gKakKOOJPxbAEzOudUorvZyRGkOTyDJMoGy2pre8alaWN3qDHBFsdJCXTv9tO 0X6A6u8x7YsIK5rwEfWiQGDpNZhK1XZ4xno4P9NVYZ/5LFTyotDoncUtqWQvSgBSl0+c bJmcXQDb9UqEphrmNtB67JMlZidtk3slLKH13hcWW/CRRJAJXtwukrPfl1ufGZFws7wj LxkRcd2bNRiQ0XZVQSHJjStPaLvgrKZLkItJnlYQvJa5ndT5kvQsOS+KmOz2psyVqlkT PM3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170902e94600b0016bc5d32e8asi29489521pll.292.2022.07.08.11.32.43; Fri, 08 Jul 2022 11:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239245AbiGHSVk (ORCPT + 99 others); Fri, 8 Jul 2022 14:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239073AbiGHSVQ (ORCPT ); Fri, 8 Jul 2022 14:21:16 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E755823B6 for ; Fri, 8 Jul 2022 11:21:10 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by albert.telenet-ops.be with bizsmtp id siM72700H4C55Sk06iM7W1; Fri, 08 Jul 2022 20:21:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o9sbD-002fGe-0N; Fri, 08 Jul 2022 20:21:07 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1o9sbC-00BtJN-As; Fri, 08 Jul 2022 20:21:06 +0200 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas Subject: [PATCH v3 03/10] drm/client: Use actual bpp when allocating frame buffers Date: Fri, 8 Jul 2022 20:20:48 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When allocating a frame buffer, the number of bits per pixel needed is derived from the deprecated drm_format_info.cpp[] field. While this may work for formats using less than 8 bits per pixel, it does lead to a large overallocation. Reduce memory consumption by using the actual number of bits per pixel instead. Signed-off-by: Geert Uytterhoeven Acked-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- v3: - Add Reviewed-by, v2: - Add Acked-by. --- drivers/gpu/drm/drm_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index af3b7395bf6932f7..2b230b4d69423752 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -264,7 +264,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u dumb_args.width = width; dumb_args.height = height; - dumb_args.bpp = info->cpp[0] * 8; + dumb_args.bpp = drm_format_info_bpp(info, 0); ret = drm_mode_create_dumb(dev, &dumb_args, client->file); if (ret) goto err_delete; @@ -373,7 +373,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer, int ret; info = drm_format_info(format); - fb_req.bpp = info->cpp[0] * 8; + fb_req.bpp = drm_format_info_bpp(info, 0); fb_req.depth = info->depth; fb_req.width = width; fb_req.height = height; -- 2.25.1