From: Thomas Zimmermann <tzimmermann@suse.de>
To: Maxime Ripard <mripard@kernel.org>
Cc: jfalempe@redhat.com, javierm@redhat.com,
dri-devel@lists.freedesktop.org, mairacanal@riseup.net,
noralf@tronnes.org, jose.exposito89@gmail.com,
arthurgrillo@riseup.net
Subject: Re: [PATCH v4 0/7] drm: Reuse temporary memory for format conversion
Date: Mon, 9 Oct 2023 10:23:02 +0200 [thread overview]
Message-ID: <e90dceff-5f8a-4d2c-b1a9-8afec856ba20@suse.de> (raw)
In-Reply-To: <ozoizmezbyhwtnsyxahdoibpkwm2gvxnclw5gyt5j257demgpd@3efr2ioqhgg2>
[-- Attachment #1.1: Type: text/plain, Size: 3652 bytes --]
Hi Maxime
Am 06.10.23 um 16:49 schrieb Maxime Ripard:
> Hi,
>
> On Thu, Oct 05, 2023 at 11:04:20AM +0200, Thomas Zimmermann wrote:
>> DRM's format-conversion helpers require temporary memory. Pass the
>> buffer from the caller and keep it allocated over several calls. Allow
>> the caller to preallocate the buffer memory.
>
> I'm sorry... but why? Why do you need to keep it allocated over several
> calls and preallocate the buffer? It's not clear to me at all.
>
>> The motivation for this patchset is the recent work on a DRM panic
>> handler. [1] The panic handler requires format conversion to display an
>> error to the screen. But allocating memory during kernel panics is
>> fragile.
>
> We agree that we shouldn't allocate memory during the panic. I still
> have concerns about how the panic handler will handle the driver
> currently set up for a plane that isn't using an RGB format, or a buffer
> not accessible by the kernel or CPU.
>
> You can't expect to get away with just a copy to the current active
> buffer.
In our current design, the panic handler calls get_scanout_buffer from
struct drm_driver to retrieve a scanout buffer. What happens within that
callback depends on the driver and hardware. Here are some of the
expected scenarios:
* simpledrm or ofdrm can return the firmware-provided scanout buffer.
No further action is required.
* Devices on a PCI-like bus:
* With a working mode in RGB colors, drivers can return the
current scanout buffer as well.
* Without a working mode, drivers likely attempt to program a
common display mode with RGB colors.
* Drivers for devices behind other busses, such as USB, will probably
not be able to reprogram during a panic or provide a useful scanout
buffer at all.
* The scanout buffer has to be mapped into kernel address space. This
operation might be fragile during a panic. So drivers could set aside a
slice of graphics memory and pre-map it; then use it during panic
(requires some mode programming).
I expect that we will eventually have helpers for the various scenarios.
Drivers will be able to implement their get_scanout_buffer with these
helpers.
The font glyphs are 1-bit bitmaps. So we have to convert them to the
scanout buffer's format in any case. We want to use the existing
format-conversion helpers were possible.
>
> If that's the assumption that underlines that patch series, then I don't
> know why we need it at all, because that assumption is wrong to begin
> with, and way too restrictive.
>
>> The changes in this patchset enable the DRM panic handler to
>> preallocate buffer storage before the panic occurs.
>>
>> As an additonal benefit, drivers can now keep the temporary storage
>> across multiple updates. Avoiding memory allocation slightly reduces
>> the CPU overhead of the format helpers.
>
> I'm sorry to go over that again, but you can't write a performance
> improvement mechanism without some kind of benchmark. kmalloc has
> built-in caching, why do we absolutely need our own cache on top of it?
>
> If you never measured it, for all we know, we simply don't need it and
> kmalloc is good enough.
I'll remove that paragraph if you find it so annoying. Let me just say
again that overhead is not the primary motivation behind these patches.
Best regards
Thomas
>
> Maxime
--
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 --]
next prev parent reply other threads:[~2023-10-09 8:23 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 9:04 [PATCH v4 0/7] drm: Reuse temporary memory for format conversion Thomas Zimmermann
2023-10-05 9:04 ` [PATCH v4 1/7] drm/format-helper: Cache buffers with struct drm_format_conv_state Thomas Zimmermann
2023-10-05 11:01 ` Noralf Trønnes
2023-10-05 13:18 ` Javier Martinez Canillas
2023-10-05 14:55 ` Thomas Zimmermann
2023-10-05 15:26 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 2/7] drm/atomic-helper: Add format-conversion state to shadow-plane state Thomas Zimmermann
2023-10-05 11:02 ` Noralf Trønnes
2023-10-05 13:26 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 3/7] drm/format-helper: Pass format-conversion state to helpers Thomas Zimmermann
2023-10-05 11:06 ` kernel test robot
2023-10-05 11:06 ` kernel test robot
2023-10-05 11:10 ` Noralf Trønnes
2023-10-05 11:15 ` Thomas Zimmermann
2023-10-05 13:28 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 4/7] drm/ofdrm: Preallocate format-conversion buffer in atomic_check Thomas Zimmermann
2023-10-05 13:35 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 5/7] drm/simpledrm: " Thomas Zimmermann
2023-10-05 13:38 ` Javier Martinez Canillas
2023-10-09 8:42 ` Thomas Zimmermann
2023-10-09 8:58 ` Javier Martinez Canillas
2023-10-09 9:16 ` Thomas Zimmermann
2023-10-09 9:24 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 6/7] drm/ssd130x: Fix atomic_check for disabled planes Thomas Zimmermann
2023-10-05 9:15 ` Geert Uytterhoeven
2023-10-05 11:37 ` Javier Martinez Canillas
2023-10-05 11:54 ` Thomas Zimmermann
2023-10-05 12:54 ` Javier Martinez Canillas
2023-10-05 12:58 ` Javier Martinez Canillas
2023-10-05 9:04 ` [PATCH v4 7/7] drm/ssd130x: Preallocate format-conversion buffer in atomic_check Thomas Zimmermann
2023-10-05 11:43 ` Javier Martinez Canillas
2023-10-06 14:49 ` [PATCH v4 0/7] drm: Reuse temporary memory for format conversion Maxime Ripard
2023-10-09 8:23 ` Thomas Zimmermann [this message]
2023-10-10 9:55 ` Maxime Ripard
2023-10-07 12:01 ` Noralf Trønnes
2023-10-09 7:53 ` 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=e90dceff-5f8a-4d2c-b1a9-8afec856ba20@suse.de \
--to=tzimmermann@suse.de \
--cc=arthurgrillo@riseup.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jfalempe@redhat.com \
--cc=jose.exposito89@gmail.com \
--cc=mairacanal@riseup.net \
--cc=mripard@kernel.org \
--cc=noralf@tronnes.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.