mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 6/8] drm/fb-helper: Pass buffer format via drm_fb_helper_surface_size
Date: Thu, 31 Aug 2023 10:24:19 +0200	[thread overview]
Message-ID: <e08780cb-9121-e917-2619-80e2c767c451@suse.de> (raw)
In-Reply-To: <df91abce8e86bdf71b9062718b7643c3c143788b.1692888745.git.geert@linux-m68k.org>


[-- Attachment #1.1: Type: text/plain, Size: 4169 bytes --]

Hi

Am 24.08.23 um 17:08 schrieb Geert Uytterhoeven:
> 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.

That is a bit premature and I'd like to not merge this patch.

A number of drivers implement fbdev emulation with their own workarounds 
for surface_bpp and surface_depth. My plan has been to push 
_find_sizes() into the drivers' fb_probe helpers and let them handle 
everything. Once everything has been cleaned up, surface_bpp and 
surface_depth can hopefully be removed entirely.

Best regards
Thomas

> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> Tested-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> 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;
>   };
>   
>   /**

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-08-31  8:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 15:08 [PATCH v2 0/8] drm: fb-helper/ssd130x: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 1/8] drm/dumb-buffers: Fix drm_mode_create_dumb() for bpp < 8 Geert Uytterhoeven
2023-08-31  7:40   ` Thomas Zimmermann
2023-08-31  7:56     ` Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 2/8] drm/ssd130x: Fix screen clearing Geert Uytterhoeven
2023-08-29  8:40   ` Javier Martinez Canillas
2023-08-29 21:12     ` Javier Martinez Canillas
2023-08-24 15:08 ` [PATCH v2 3/8] drm/ssd130x: Use bool for ssd130x_deviceinfo flags Geert Uytterhoeven
2023-08-29  8:44   ` Javier Martinez Canillas
2023-08-29 21:16     ` Javier Martinez Canillas
2023-08-24 15:08 ` [PATCH v2 4/8] drm/ssd130x: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-29  9:01   ` Javier Martinez Canillas
2023-08-29 21:12     ` Javier Martinez Canillas
2023-08-31  8:01   ` Thomas Zimmermann
2023-08-31  8:22     ` Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 5/8] drm/client: Convert drm_client_buffer_addfb() to drm_mode_addfb2() Geert Uytterhoeven
2023-08-24 15:11   ` Daniel Stone
2023-08-24 15:22     ` Geert Uytterhoeven
2023-08-29  9:19       ` Javier Martinez Canillas
2023-08-31  8:15       ` Thomas Zimmermann
2023-08-24 15:08 ` [PATCH v2 6/8] drm/fb-helper: Pass buffer format via drm_fb_helper_surface_size Geert Uytterhoeven
2023-08-31  8:24   ` Thomas Zimmermann [this message]
2023-08-24 15:08 ` [PATCH v2 7/8] drm/fb-helper: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-31  8:57   ` Thomas Zimmermann
2023-08-24 15:08 ` [PATCH v2 8/8] drm/ssd130x: Switch preferred_bpp/depth to 1 Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e08780cb-9121-e917-2619-80e2c767c451@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®