From: Thomas Zimmermann <tzimmermann@suse.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de,
javierm@redhat.com, linux-fbdev@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
Date: Wed, 13 Mar 2024 09:19:15 +0100 [thread overview]
Message-ID: <ebea6554-835a-42d6-a226-f4f3480a8846@suse.de> (raw)
In-Reply-To: <CAMuHMdVqWF=M=6aPRxZ0MBqPVM_wk2x+Oike6za754riHWusSA@mail.gmail.com>
Hi Geert
Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
> Hi Thomas,
>
> On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Add an fbdev emulation for SHMEM-based memory managers. The code is
>> similar to fbdev-generic, but does not require an addition shadow
>> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
>> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
>> on write operations.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Thanks for your patch!
>
>> --- /dev/null
>> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c
>> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
>> + struct drm_fb_helper_surface_size *sizes)
>> +{
>> + struct drm_client_dev *client = &fb_helper->client;
>> + struct drm_device *dev = fb_helper->dev;
>> + struct drm_client_buffer *buffer;
>> + struct drm_gem_shmem_object *shmem;
>> + struct drm_framebuffer *fb;
>> + struct fb_info *info;
>> + u32 format;
>> + struct iosys_map map;
>> + int ret;
>> +
>> + drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
>> + sizes->surface_width, sizes->surface_height,
>> + sizes->surface_bpp);
>> +
>> + format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> Oops, one more caller of the imprecise
> let's-guess-the-format-from-bpp-and-depth machinery to get rid of...
Right, that has been discussed in another thread. I'll change this call
to the drm_driver_() function.
>
>> + buffer = drm_client_framebuffer_create(client, sizes->surface_width,
>> + sizes->surface_height, format);
> [...]
>
>> +}
>> +/**
>> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
>> + * @dev: DRM device
>> + * @preferred_bpp: Preferred bits per pixel for the device.
>> + * 32 is used if this is zero.
>> + *
>> + * This function sets up fbdev emulation for GEM DMA drivers that support
>> + * dumb buffers with a virtual address and that can be mmap'ed.
>> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
>> + * the new DRM device with drm_dev_register().
>> + *
>> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
>> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
>> + * Simple drivers might use drm_mode_config_helper_suspend().
>> + *
>> + * This function is safe to call even when there are no connectors present.
>> + * Setup will be retried on the next hotplug event.
>> + *
>> + * The fbdev is destroyed by drm_dev_unregister().
>> + */
>> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
> As this is a completely new function, can we please get a
> preferred_format parameter instead?
An understandable question. But as it is, the patchset has a trivial
change in each driver. And the preferred_bpp parameter has the same
meaning as the bpp value in the video= parameter. So it's ok-ish for now.
Using a format parameter here is really a much larger update and touches
the internals of the fbdev emulation. I'm not even sure that we should
have a parameter at all. Since in-kernel clients should behave like
userspace clients, we could try to figure out the format from the
driver's primary planes. That's a patchset of its own.
Best regards
Thomas
>
>> +{
>> + struct drm_fb_helper *fb_helper;
>> + int ret;
>> +
>> + drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
>> + drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
>> +
>> + fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
>> + if (!fb_helper)
>> + return;
>> + drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_shmem_helper_funcs);
>> +
>> + ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_shmem_client_funcs);
>> + if (ret) {
>> + drm_err(dev, "Failed to register client: %d\n", ret);
>> + goto err_drm_client_init;
>> + }
>> +
>> + drm_client_register(&fb_helper->client);
>> +
>> + return;
>> +
>> +err_drm_client_init:
>> + drm_fb_helper_unprepare(fb_helper);
>> + kfree(fb_helper);
>> +}
>> +EXPORT_SYMBOL(drm_fbdev_shmem_setup);
>
> Gr{oetje,eeting}s,
>
> Geert
>
--
--
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)
next prev parent reply other threads:[~2024-03-13 8:19 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
2024-03-17 12:43 ` Javier Martinez Canillas
2024-03-18 8:19 ` Thomas Zimmermann
2024-03-18 2:35 ` Zack Rusin
2024-03-18 7:59 ` Thomas Zimmermann
2024-03-18 8:44 ` Maxime Ripard
2024-03-18 9:48 ` Javier Martinez Canillas
2024-03-18 22:22 ` [01/43] " Sui Jingfeng
2024-03-12 15:44 ` [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper Thomas Zimmermann
2024-03-17 12:49 ` Javier Martinez Canillas
2024-03-12 15:44 ` [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose Thomas Zimmermann
2024-03-17 13:19 ` Javier Martinez Canillas
2024-03-12 15:44 ` [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory Thomas Zimmermann
2024-03-17 13:20 ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory Thomas Zimmermann
2024-03-18 17:03 ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages Thomas Zimmermann
2024-03-18 17:04 ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io Thomas Zimmermann
2024-03-18 17:11 ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 08/43] drm/fbdev: Add fbdev-shmem Thomas Zimmermann
2024-03-12 16:14 ` Geert Uytterhoeven
2024-03-13 8:19 ` Thomas Zimmermann [this message]
2024-03-13 9:03 ` Geert Uytterhoeven
2024-03-13 9:24 ` Thomas Zimmermann
2024-03-13 9:56 ` Geert Uytterhoeven
2024-03-12 15:45 ` [PATCH 09/43] drm/ast: Use fbdev-shmem Thomas Zimmermann
2024-03-13 14:03 ` Jocelyn Falempe
2024-03-12 15:45 ` [PATCH 10/43] drm/gud: " Thomas Zimmermann
2024-03-17 19:21 ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 11/43] drm/hyperv: " Thomas Zimmermann
2024-03-12 16:08 ` Deepak Rawat
2024-03-12 15:45 ` [PATCH 12/43] drm/mgag200: " Thomas Zimmermann
2024-03-13 14:03 ` Jocelyn Falempe
2024-03-18 7:56 ` Thomas Zimmermann
2024-03-18 9:23 ` Jocelyn Falempe
2024-03-12 15:45 ` [PATCH 13/43] drm/solomon: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 14/43] drm/tiny/cirrus: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 15/43] drm/tiny/gm12u320: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 16/43] drm/tiny/ofdrm: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 17/43] drm/tiny/simpledrm: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 18/43] drm/udl: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 19/43] drm/virtio: " Thomas Zimmermann
2024-03-28 14:55 ` Dmitry Osipenko
2024-03-12 15:45 ` [PATCH 20/43] drm/vkms: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 21/43] drm/fbdev-dma: Implement damage handling and deferred I/O Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 22/43] drm/arm/komeda: Use fbdev-dma Thomas Zimmermann
2024-03-13 10:53 ` Liviu Dudau
2024-03-12 15:45 ` [PATCH 23/43] drm/hisilicon/kirin: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 24/43] drm/imx/lcdc: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 25/43] drm/ingenic: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 26/43] drm/mediatek: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 27/43] drm/panel/panel-ilitek-9341: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 28/43] drm/renesas/rcar-du: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 29/43] drm/renesas/rz-du: " Thomas Zimmermann
2024-03-12 19:14 ` Biju Das
2024-03-13 8:30 ` Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 30/43] drm/renesas/shmobile: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 31/43] drm/rockchip: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 32/43] drm/tiny/hx8357d: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 33/43] drm/tiny/ili9163: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 34/43] drm/tiny/ili9225: " Thomas Zimmermann
2024-03-12 22:20 ` David Lechner
2024-03-12 15:45 ` [PATCH 35/43] drm/tiny/ili9341: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 36/43] drm/tiny/ili9486: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 37/43] drm/tiny/mi0283qt: " Thomas Zimmermann
2024-03-17 19:21 ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 38/43] drm/tiny/panel-mipi-dbi: " Thomas Zimmermann
2024-03-17 19:22 ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 39/43] drm/tiny/repaper: " Thomas Zimmermann
2024-03-17 19:22 ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 40/43] drm/tiny/st7586: " Thomas Zimmermann
2024-03-12 22:21 ` David Lechner
2024-03-12 15:45 ` [PATCH 41/43] drm/tiny/st7735r: " Thomas Zimmermann
2024-03-12 22:21 ` David Lechner
2024-03-12 15:45 ` [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 43/43] drm/fbdev: Clean up fbdev documentation Thomas Zimmermann
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=ebea6554-835a-42d6-a226-f4f3480a8846@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).