Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp417305rdb; Thu, 24 Aug 2023 09:40:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkOzOwKrCt4kG0n9vB8TwovOju9zMI90iNXpH6c56iIp7B2bKC8B8qQbAQdWjO1FAH8yLz X-Received: by 2002:a17:907:2ccc:b0:99d:fd65:dbb2 with SMTP id hg12-20020a1709072ccc00b0099dfd65dbb2mr13459428ejc.33.1692895224638; Thu, 24 Aug 2023 09:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692895224; cv=none; d=google.com; s=arc-20160816; b=KnqrV9DztykuhyghNk7fcBwinwcXyCqtQlGJ+wNhtgE1Ty4jpmCOlv25YRF80ItabQ g4V3Z3AW2vbiljM9H98Ug6b0F69nSgOMbqd3Ny2IIAJmZmVuMkJIXsa4NstGWicoOZOe 8dFaKcKqbFar0HzMShQQZPVegeTsLpDrDN7UM8FQML5UNQgES0ZBlxYmqO7jFrtZQcqA cix3CVM6jEazlbntNX/Of6ncEOrwuZeclZnxex8CdW/dfUFsOJW4LQA/qsV4NL+qrzKS 0hqSWlBJA7lPv+M8rzYp9SMBIc/7cgaSONI8yRBDTrvUu7/8jWutdwHBH/JfpxdXDUSu /4KQ== 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=4kfR2sPs//mpcuNb05Y1PkDXrtC7hVu8yfkmoKeM0To=; fh=wcJXU+GRAJ+lFf7so8itXL2pGJ6fujr2XomH/f1be3s=; b=tby8s+WJT4fmVIyDtuRtf62BOSevthXep+s/RXoJjSYZzgs4W09C942ZEcCOvJrbcV kyJ43VhNTEqCnQ/N+CarD3W4FT8bTo+AKRzvI5shq22P/H8Vx0bvSWFLciOzVLTfyq2a qm6DuOVnkvp1FfBsKxmDsvv773Ieax2gXiWHihmLADV7xTpOblgUnbVaKQRnGRgwRYdR XO4cHph3eKEBdPCxFHlnITJx54UM36BFGvsPmOPO6npBz8fzzxaJxo5tSrnJAamxM4DK 7CfIhpHa7mhoozmBP5EKvMA4YK0Zb+TXI2sgWUMoAMybJKa28sRRtn29G9ubV+C5oh0f ag2w== 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 v7-20020a1709064e8700b009930253bc69si10306651eju.1011.2023.08.24.09.39.59; Thu, 24 Aug 2023 09:40:24 -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 S242150AbjHXPJM (ORCPT + 99 others); Thu, 24 Aug 2023 11:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242148AbjHXPI7 (ORCPT ); Thu, 24 Aug 2023 11:08:59 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0276D1711 for ; Thu, 24 Aug 2023 08:08:56 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:3c6b:f703:5ab5:f36d]) by laurent.telenet-ops.be with bizsmtp id dT8t2A00D01sfPQ01T8th5; Thu, 24 Aug 2023 17:08:53 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qZBwx-001dhP-Ip; Thu, 24 Aug 2023 17:08:53 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qZBx7-000Vz6-83; Thu, 24 Aug 2023 17:08:53 +0200 From: Geert Uytterhoeven To: Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 6/8] drm/fb-helper: Pass buffer format via drm_fb_helper_surface_size Date: Thu, 24 Aug 2023 17:08:44 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 drm_fb_helper_single_fb_probe() first calls drm_fb_helper_find_sizes(), followed by drm_fbdev_generic_helper_fb_probe(): - The former tries to find a suitable buffer format, taking into account limitations of the whole display pipeline, - The latter just calls drm_mode_legacy_fb_format() again. Simplify this by passing the buffer format between these functions via a new buffer format member in the drm_fb_helper_surface_size structure. Signed-off-by: Geert Uytterhoeven Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas --- v2: - Fix accidental debug level increase, - Add Reviewed-by, Tested-by. --- drivers/gpu/drm/drm_fb_helper.c | 1 + drivers/gpu/drm/drm_fbdev_generic.c | 9 ++++----- include/drm/drm_fb_helper.h | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index d612133e2cf7ec99..4dc28fdcc1e0a6a4 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1564,6 +1564,7 @@ static int __drm_fb_helper_find_sizes(struct drm_fb_helper *fb_helper, info = drm_format_info(surface_format); sizes->surface_bpp = drm_format_info_bpp(info, 0); sizes->surface_depth = info->depth; + sizes->surface_format = surface_format; /* first up get a count of crtcs now in use and new min/maxes width/heights */ crtc_count = 0; diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index d647d89764cb9894..3830d25bcc3ad035 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -77,16 +77,15 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper, struct fb_info *info; size_t screen_size; void *screen_buffer; - u32 format; int ret; - drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", + drm_dbg_kms(dev, "surface width(%d), height(%d), bpp(%d) and format(%p4cc)\n", sizes->surface_width, sizes->surface_height, - sizes->surface_bpp); + sizes->surface_bpp, &sizes->surface_format); - format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); buffer = drm_client_framebuffer_create(client, sizes->surface_width, - sizes->surface_height, format); + sizes->surface_height, + sizes->surface_format); if (IS_ERR(buffer)) return PTR_ERR(buffer); diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 375737fd6c36ed19..aa3d62a531d12f37 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -45,6 +45,7 @@ struct drm_fb_helper; * @surface_height: scanout buffer height * @surface_bpp: scanout buffer bpp * @surface_depth: scanout buffer depth + * @surface_format: scanout buffer format (optional) * * Note that the scanout surface width/height may be larger than the fbdev * width/height. In case of multiple displays, the scanout surface is sized @@ -61,6 +62,7 @@ struct drm_fb_helper_surface_size { u32 surface_height; u32 surface_bpp; u32 surface_depth; + u32 surface_format; }; /** -- 2.34.1