From nobody Sun Feb 8 14:22:46 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE4D7C001DF for ; Thu, 13 Jul 2023 13:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234575AbjGMNRf (ORCPT ); Thu, 13 Jul 2023 09:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbjGMNRb (ORCPT ); Thu, 13 Jul 2023 09:17:31 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE3BA2708 for ; Thu, 13 Jul 2023 06:17:25 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:6264:77e5:42e2:477d]) by baptiste.telenet-ops.be with bizsmtp id LdHN2A00V3wy6xv01dHPUr; Thu, 13 Jul 2023 15:17:23 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qJwC3-001Gr8-3Z; Thu, 13 Jul 2023 15:17:22 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qJwCA-00GWyp-Pq; Thu, 13 Jul 2023 15:17:22 +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 6/8] drm/fb-helper: Pass buffer format via drm_fb_helper_surface_size Date: Thu, 13 Jul 2023 15:17:14 +0200 Message-Id: <00790d022752b672a28256db7b9393eca0801b99.1689252746.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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_helpe= r.c index 61a5d450cc20ef0a..e870b2ce7a8625e3 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_h= elper *fb_helper, info =3D drm_format_info(surface_format); sizes->surface_bpp =3D drm_format_info_bpp(info, 0); sizes->surface_depth =3D info->depth; + sizes->surface_format =3D surface_format; =20 /* first up get a count of crtcs now in use and new min/maxes width/heigh= ts */ crtc_count =3D 0; diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbde= v_generic.c index 98ae703848a02fa3..953056896c1a5652 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; =20 - drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", + drm_info(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); =20 - format =3D drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_d= epth); buffer =3D 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); =20 diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 4863b0f8299e89b6..430a17b530fa49e6 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 siz= ed @@ -61,6 +62,7 @@ struct drm_fb_helper_surface_size { u32 surface_height; u32 surface_bpp; u32 surface_depth; + u32 surface_format; }; =20 /** --=20 2.34.1