[PATCH/RFC 0/3] Atari DRM driver

Eero Tamminen oak at helsinkinet.fi
Tue May 27 22:47:20 UTC 2025


Hi Geert,

On 25.5.2025 15.05, Geert Uytterhoeven wrote:
> On Thu, 22 May 2025 at 00:56, Eero Tamminen <oak at helsinkinet.fi> wrote:
>> On 21.5.2025 10.06, Geert Uytterhoeven wrote:
>>> I do keep it up-to-date locally, so I could provide these changes,
>>> if you are interested.
>>
>> Yes, please!   (see below)
> 
> Sorry for taking so long:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=atari-drm-wip-rebasing

Thanks!

I did boot testing on Hatari emulator with a minimal kernel config 
having atari_drm enabled, atafb disabled, FB & boot logo enabled.

Under Falcon emulation:
- RGB/VGA => works fine
- Mono monitor => panic
   "Kernel panic - not syncing: can't set default video mode"

Under TT emulation:
- RGB/VGA => boots, but console is black[1] (palette issue?)
- Mono monitor => looks OKish[2], but has constant warnings:
-----------------------------------
WARNING: CPU: 0 PID: 1 at drivers/gpu/drm/drm_atomic_helper.c:1720 
drm_atomic_helper_wait_for_vblanks+0x1a0/0x1ee
[CRTC:35:crtc-0] vblank wait timed out
-----------------------------------

Under 030 ST/STe emulation:
- RGB/VGA => boots, but console is black (palette issue?)
- Mono monitor => looks OK, but has constant slowpath warnings with:
   "[CRTC:35:crtc-0] vblank wait timed out"

=> Any advice on the issues?

[1] Black when booted with (Hatari) LILO, all white when booted with 
"bootstra.prg", meaning from TOS.

[2] Mono colors are black on white instead of vice verse, e.g. boot logo 
colors are obviously inversed.

Note: the functional differences between ST, STE, TT and Falcon are all 
accurately emulated in Hatari.


	- Eero

PS. I also profiled where most of time goes from "atari-drm" probing, 
until boot reaches user space.  On a minimal -Os built kernel, running 
on (emulated) 32Mhz 030 Falcon, in the default 640x480 at 4 resolution:
----------------------------------------------------------------
Time spent in profile = 15.29712s.
...
Used cycles:
   22.37%  22.42%  25.35%   _transp
   19.15%  19.19%  46.82%   atari_drm_fb_blit_rect.isra.0
    8.09%   8.09%  13.80%   sys_copyarea
    3.94%   3.95%   6.23%   sys_imageblit
    3.69%   3.69%   3.69%   fb_copy_offset.isra.0
    2.12%   2.13%   2.41%   atari_scsi_falcon_reg_read
    2.03%   2.03%   2.03%   fb_address_forward
    1.85%   1.85%  17.98%   fbcon_redraw_blit.constprop.0
    1.81%   1.81%   2.04%   atari_keyb_init
    1.78%   1.78%   1.98%   fb_reverse_long
    1.58%   1.58%   1.90%   arch_cpu_idle
    1.05%                   memcpy
    0.95%                   memset
...
----------------------------------------------------------------

=> atari-drm blitting takes half the time during boot.

Building kernel with -O2, changes above rather radically, both 
time-wise, and where that time goes:
----------------------------------------------------------------
Time spent in profile = 6.54049s.
...
Used cycles:
   17.61%  17.61%  17.61%   sys_copyarea
   11.18%  11.18%  13.11%   arch_cpu_idle
    7.53%   7.55%   8.45%   atari_drm_fb_blit_rect.isra.0
    4.26%   4.27%   4.76%   atari_keyb_init
    2.70%   2.70%   2.93%   atari_scsi_falcon_reg_read
    2.45%   2.45%  23.81%   fbcon_redraw_blit.constprop.0
    2.35%   2.35%   2.48%   sys_imageblit
    2.12%   2.12%   5.89%   atari_floppy_init
    1.97%                   memset
    1.31%                   memcpy
...
Instruction cache misses:
   27.14%  27.14%  27.14%   sys_copyarea
    3.77%   3.77%   4.05%   atari_scsi_falcon_reg_read
...
Data cache hits:
   63.55%  63.55%  63.67%   atari_keyb_init
    7.61%   7.62%   7.84%   atari_drm_fb_blit_rect.isra.0
    3.86%   3.86%   3.86%   sys_copyarea <= not much hits for copying
...
----------------------------------------------------------------

However, -O2 build has the downside that the resulting kernel Oopses 
once it reaches user-space, if 030 data cache emulation is enabled:
----------------------------------------------------------------
Run /init as init process
...
Instruction fault at 0x0041a256
BAD KERNEL BUSERR
Oops: 00000000
PC: [<0041a256>] __generic_copy_from_user+0x1e/0x46
SR: 2200  SP: (ptrval)  a2: 011fe590
d0: 00000005    d1: 00000000    d2: 00000003    d3: 00000003
d4: 00000008    d5: 00000000    a0: eff70720    a1: 01225f9c
Process init (pid: 32, task=(ptrval))
Frame format=B ssw=5066 isc=5380 isb=66f6 daddr=eff7071c dobuf=00000000
baddr=eff7071c dibuf=eff7071c ver=0
Stack from 01225f78:
         ...
Call Trace: [<000409b0>] sys_rt_sigaction+0x32/0xc8
  [<00005062>] req_need_defer+0x2a/0x3a
  [<0000a4ca>] syscall+0x8/0xc

Code: 7403 c282 206e 000c 226e 0008 4a80 670a <0e98> 2000 22c2 5380 66f6 
0801 0001 6706 0e58 2000 32c2 0801 0000 6706 0e18 2000
Disabling lock debugging due to kernel taint
Instruction fault at 0x00088ada
BAD KERNEL BUSERR
Oops: 00000000
PC: [<00088ada>] exit_robust_list+0x12/0xee
SR: 2200  SP: (ptrval)  a2: 011fe590
d0: 00000000    d1: 00000000    d2: 011fe94e    d3: 000000ff
d4: 00000000    d5: 00000000    a0: 011fe590    a1: 011e2b90
Process init (pid: 32, task=(ptrval))
Frame format=B ssw=5066 isc=660a isb=0eab daddr=801a206c dobuf=011fe94e
baddr=801a206c dibuf=801a206c ver=0
Stack from 01225dc8:
         ....
Call Trace: [<00003730>] _printk+0x0/0x16
  [<000896ce>] futex_exit_release+0x9e/0xb8
  [<00030186>] exit_mm_release+0x12/0x28
  [<00034612>] do_exit+0x178/0x96e
  [<00002200>] show_stack+0xce/0xf4
  [<000691da>] vprintk+0x12/0x16
  [<00034e84>] make_task_dead+0x7c/0x172
  [<00005066>] req_need_defer+0x2e/0x3a
  [<00003730>] _printk+0x0/0x16
  [<0000d514>] die_if_kernel+0x0/0x22
  [<0000d536>] trap_c+0x0/0x24c
  [<0000ddaa>] buserr_c+0x628/0x756
  [<0000a3f0>] buserr+0x20/0x28
  [<00005066>] req_need_defer+0x2e/0x3a
  [<0004097e>] sys_rt_sigaction+0x0/0xc8
  [<00020007>] _FP_CALL_TOP+0x48e5/0xd512
  [<00002000>] _start+0x0/0x6
  [<000409b0>] sys_rt_sigaction+0x32/0xc8
  [<00005062>] req_need_defer+0x2a/0x3a
  [<0000a4ca>] syscall+0x8/0xc
----------------------------------------------------------------

My GCC is 12.2 in Debian bookworm, and "/init" is shell script run with 
static Debian Busybox, to mount virtual file systems:
https://github.com/hatari/hatari/blob/main/tools/linux/init.sh

On an small system image built and used as documented here:
https://github.com/hatari/hatari/blob/main/doc/m68k-linux.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atari-drm-callgraph.png
Type: image/png
Size: 46420 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250528/62065038/attachment-0001.png>


More information about the dri-devel mailing list