From: Jocelyn Falempe <jfalempe@redhat.com>
To: "Noralf Trønnes" <noralf@tronnes.org>,
"Maxime Ripard" <mripard@kernel.org>
Cc: bluescreen_avenger@verizon.net, javierm@redhat.com,
dri-devel@lists.freedesktop.org, gpiccoli@igalia.com,
tzimmermann@suse.de, airlied@redhat.com
Subject: Re: [PATCH v4 2/4] drm/panic: Add a drm panic handler
Date: Mon, 9 Oct 2023 09:47:49 +0200 [thread overview]
Message-ID: <b4aadfb4-9393-d6b6-e876-a420afcf2b36@redhat.com> (raw)
In-Reply-To: <bd880231-f161-0773-63f7-ded6cb3fddc1@tronnes.org>
On 06/10/2023 18:54, Noralf Trønnes wrote:
>
>
> On 10/6/23 16:35, Maxime Ripard wrote:
>> Hi Jocelyn,
>>
>> On Thu, Oct 05, 2023 at 11:16:15AM +0200, Jocelyn Falempe wrote:
>>> On 05/10/2023 10:18, Maxime Ripard wrote:
>>>> Hi,
>>>>
>>>> On Tue, Oct 03, 2023 at 04:22:45PM +0200, Jocelyn Falempe wrote:
>>>>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>>>>> index 89e2706cac56..e538c87116d3 100644
>>>>> --- a/include/drm/drm_drv.h
>>>>> +++ b/include/drm/drm_drv.h
>>>>> @@ -43,6 +43,7 @@ struct dma_buf_attachment;
>>>>> struct drm_display_mode;
>>>>> struct drm_mode_create_dumb;
>>>>> struct drm_printer;
>>>>> +struct drm_scanout_buffer;
>>>>> struct sg_table;
>>>>> /**
>>>>> @@ -408,6 +409,19 @@ struct drm_driver {
>>>>> */
>>>>> void (*show_fdinfo)(struct drm_printer *p, struct drm_file *f);
>>>>> + /**
>>>>> + * @get_scanout_buffer:
>>>>> + *
>>>>> + * Get the current scanout buffer, to display a panic message with drm_panic.
>>>>> + * It is called from a panic callback, and must follow its restrictions.
>>>>> + *
>>>>> + * Returns:
>>>>> + *
>>>>> + * Zero on success, negative errno on failure.
>>>>> + */
>>>>> + int (*get_scanout_buffer)(struct drm_device *dev,
>>>>> + struct drm_scanout_buffer *sb);
>>>>> +
>>>>
>>>> What is the format of that buffer? What is supposed to happen if the
>>>> planes / CRTC are setup in a way that is incompatible with the buffer
>>>> format?
>>>
>>> Currently, it only supports linear format, either in system memory, or
>>> iomem.
>>> But really what is needed is the screen size, and a way to write pixels to
>>> it.
>>> For more complex GPU, I don't know if it's easier to reprogram the GPU to
>>> linear format, or to add a simple "tiled" support to drm_panic.
>>> What would you propose as a panic interface to handle those complex format ?
>>
>> It's not just about tiling, but also about YUV formats. If the display
>> engine is currently playing a video at the moment, it's probably going
>> to output some variation of multi-planar YUV and you won't have an RGB
>> buffer available.
>>
>
> I had support for some YUV formats in my 2019 attempt on a panic
> handler[1] and I made a recording of a test run as well[2] (see 4:30 for
> YUV). There was a discussion about challenges and i915 can disable
> tiling by flipping a bit in a register[3] and AMD has a debug
> interface[4] they can use to write pixels.
I only added support for the format used by simpledrm, because I don't
want to add support for all possible format if no driver are using it.
It should be possible to add YUV format too.
I also prefer to convert only the foreground/background color, and then
write directly into the buffers, instead of converting line by line.
It works for all format where pixel size is a multiple of byte.
>
> Noralf.
>
> [1]
> https://lore.kernel.org/dri-devel/20190311174218.51899-1-noralf@tronnes.org/
> [2] https://youtu.be/lZ80vL4dgpE
> [3]
> https://lore.kernel.org/dri-devel/20190314095004.GP2665@phenom.ffwll.local/
> [4]
> https://lore.kernel.org/dri-devel/d233c376-ed07-2127-6084-8292d313dac7@amd.com/
>
>> Same story if you're using a dma-buf buffer. You might not even be able
>> to access that buffer at all from the CPU or the kernel.
>>
>> I really think we should have some emergency state ready to commit on
>> the side, and possibly a panic_commit function to prevent things like
>> sleeping or waiting that regular atomic_commit can use.
>>
>> That way, you know have all the resources available to you any time.
I think reusing the atomic commit functions might be hard, because there
are locks/allocation/threads hidden in drivers callback. I'm more in
favor of an emergency function, that each driver has to implement, and
use what the hardware can do to display a simple frame quickly.
get_scanout_buffer() is a good start for simple driver, but will need
refactoring for the more complex case, like adding a callback to write
pixels one by one, if there is no memory mapped buffer available.
>>
>>> Sometime it's also just not possible to write pixels to the screen, like if
>>> the panic occurs in the middle of suspend/resume, or during a mode-setting,
>>> and the hardware state is broken. In this case it's ok to return an error,
>>> and nothing will get displayed.
>>
>> And yeah, you won't be able to do it every time, but if it's never for
>> some workload it's going to be a concern.
>>
>> Anyway, we should at the very least document what we expect here.
Yes I should better document the drm panic feature, and the
get_scanout_buffer() interface.
>>
>> Maxime
>
--
Jocelyn
next prev parent reply other threads:[~2023-10-09 7:47 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 14:22 [RFC][PATCH v4 0/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 1/4] drm/format-helper: Export line conversion helper for drm_panic Jocelyn Falempe
2023-10-03 15:56 ` kernel test robot
2023-10-04 1:45 ` nerdopolis
2023-10-05 7:37 ` Jocelyn Falempe
2023-10-16 10:47 ` Thomas Zimmermann
2023-10-16 10:50 ` Thomas Zimmermann
2023-10-16 16:22 ` Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 2/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-05 3:39 ` kernel test robot
2023-10-05 8:18 ` Maxime Ripard
2023-10-05 9:16 ` Jocelyn Falempe
2023-10-06 14:35 ` Maxime Ripard
2023-10-06 16:54 ` Noralf Trønnes
2023-10-09 7:47 ` Jocelyn Falempe [this message]
2023-10-09 8:28 ` Maxime Ripard
2023-10-09 9:48 ` Jocelyn Falempe
2023-10-09 11:33 ` Maxime Ripard
2023-10-09 14:05 ` Jocelyn Falempe
2023-10-09 16:07 ` Maxime Ripard
2023-10-10 7:55 ` Jocelyn Falempe
2023-10-10 8:30 ` Maxime Ripard
2023-10-10 9:04 ` Thomas Zimmermann
2023-10-10 9:33 ` Maxime Ripard
2023-10-10 13:05 ` Thomas Zimmermann
2023-10-10 13:32 ` Jocelyn Falempe
2023-10-10 8:55 ` Thomas Zimmermann
2023-10-10 9:25 ` Maxime Ripard
2023-10-10 11:29 ` Noralf Trønnes
2023-10-10 12:15 ` Maxime Ripard
2023-10-10 12:59 ` Daniel Vetter
2023-10-10 13:24 ` Thomas Zimmermann
2023-10-10 13:24 ` Jocelyn Falempe
2023-10-07 12:38 ` Noralf Trønnes
2023-10-09 8:01 ` Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 3/4] drm/simpledrm: Add drm_panic support Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 4/4] drm/mgag200: " Jocelyn Falempe
2023-10-07 14:30 ` Noralf Trønnes
2023-10-09 10:01 ` Jocelyn Falempe
2023-10-10 9:23 ` 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=b4aadfb4-9393-d6b6-e876-a420afcf2b36@redhat.com \
--to=jfalempe@redhat.com \
--cc=airlied@redhat.com \
--cc=bluescreen_avenger@verizon.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=gpiccoli@igalia.com \
--cc=javierm@redhat.com \
--cc=mripard@kernel.org \
--cc=noralf@tronnes.org \
--cc=tzimmermann@suse.de \
/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