From: Michael Schmitz <schmitzmic@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linmao Li <lilinmao@kylinos.cn>,
deller@gmx.de, linux-fbdev@vger.kernel.org,
miro.kropacek@gmail.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
linux-m68k <linux-m68k@lists.linux-m68k.org>
Subject: Re: [PATCH] fbdev: atafb: Restrict SuperBlitter to supported formats
Date: Tue, 8 Sep 2026 08:18:25 +1200 [thread overview]
Message-ID: <93ffe3ec-bb45-4c10-8d78-0cd23c9bb61e@gmail.com> (raw)
In-Reply-To: <CAMuHMdVOc-_hgWvu84EW7tyQx6WzPtabnBUJ1T0uoxa1QZA94Q@mail.gmail.com>
Hi Geert,
On 7/09/26 20:38, Geert Uytterhoeven wrote:
> Hi Michael,
>
> CC linux-m68k
>
> On Sun, 6 Sept 2026 at 03:49, Michael Schmitz <schmitzmic@gmail.com> wrote:
>> Am 27.08.2026 um 21:39 schrieb Linmao Li:
>>> The SuperBlitter operations derive an integer byte count per pixel. The
>>> accelerated fill path handles only one-, two- and four-byte pixels.
>>> However, the operations are currently installed for every external
>>> framebuffer in SuperVidel RAM, including planar 1/2/4/8-bpp and 24-bpp
>>> truecolor modes accepted by the external video parser.
>>>
>>> For 1/2/4-bpp modes, the byte count becomes zero, so accelerated copies do
>>> nothing and fills fall through to 32-bit stores. Planar 8-bpp uses an
>>> incompatible memory layout. For 24-bpp modes, fills also use 32-bit stores
>>> despite advancing addresses by three bytes per pixel. These cases can
>>> corrupt the framebuffer beyond the requested rectangle.
>> I believe 24 bpp mode can be rescued using something like this (entirely
>> untested):
>>
>> --- a/drivers/video/fbdev/atafb.c
>> +++ b/drivers/video/fbdev/atafb.c
>> @@ -2463,6 +2463,11 @@ static void svblit_fillrect(struct fb_info *info,
>> case 2:
>> memset16((u16 *)line, pix, rect->width);
>> break;
>> + case 3:
>> + memset(line, pix, ((rect->width * bytespp) % 4));
>> + line += ((rect->width * bytespp) % 4);
>> + memset32((u32 *)line, pix, (rect->width * bytespp) / 4);
> This uses unaligned writes for the largest part.
> You can avoid that by doing the memset32() first.
True enough (iff line happens to be aligned, which is only true if
rect->dx is even).
But as Miro pointed out, 24 bpp can't actually be used (and without TOS
setting such a mode before Linux boot, it can't ever happen).
Cheers,
Michael
>
>> + break;
>> default:
>> memset32((u32 *)line, pix, rect->width);
>> break;
>>
>> Can't test this on hardware, and would need Miro to confirm it works as
>> intended.
>>
>>> Enable the SuperBlitter operations only for the layouts they implement:
>>> 8-bpp packed pixels and 16/32-bpp truecolor. Keep the existing software
>>> operations for all other external formats.
>>>
>>> Fixes: d463633d63e6 ("fbdev: atafb: Add support for SuperVidel's SuperBlitter")
>>> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
>>> ---
>>> drivers/video/fbdev/atafb.c | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
>>> index 5bca34c45cef3..c3011b61a94b9 100644
>>> --- a/drivers/video/fbdev/atafb.c
>>> +++ b/drivers/video/fbdev/atafb.c
>>> @@ -3360,7 +3360,11 @@ static int __init atafb_probe(struct platform_device *pdev)
>>> memset (screen_base, 0, external_len);
>>>
>>> /* framebuffer in SV RAM: enable the SuperBlitter */
>>> - if (external_addr >= 0xa0000000) {
>>> + if (external_addr >= 0xa0000000 &&
>>> + ((external_pmode == FB_TYPE_PACKED_PIXELS &&
>>> + external_depth == 8) ||
>>> + (external_pmode == -1 &&
>>> + (external_depth == 16 || external_depth == 32)))) {
>>> svblit_regs = ioremap(SVBLIT_REGS_PHYS, 0x100);
>>> if (svblit_regs) {
>>> svblit_fw = svblit_rd(SVBLIT_VERSION) & 0x1ff;
>>>
>> Otherwise, LGTM.
>>
>> @Geert: can you remember if pixel format or bit depth of an external
>> framebuffer can be changed at runtime using fbset??
> I am no Atari expert, but IIRC all external framebuffers rely on
> being fully set-up before Linux boots?
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2026-09-07 20:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 9:39 [PATCH] fbdev: atafb: Restrict SuperBlitter to supported formats Linmao Li
2026-09-06 1:49 ` Michael Schmitz
2026-09-07 8:38 ` Geert Uytterhoeven
2026-09-07 20:18 ` Michael Schmitz [this message]
2026-09-07 11:14 ` Miro Kropáček
2026-09-07 20:14 ` Michael Schmitz
2026-09-08 7:18 ` 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=93ffe3ec-bb45-4c10-8d78-0cd23c9bb61e@gmail.com \
--to=schmitzmic@gmail.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=miro.kropacek@gmail.com \
/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