raspberrypi / firmware

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
5.18k stars 1.68k forks source link

ioctl(fb, FBIO_WAITFORVSYNC, &dummy) not working at high refresh rates #1517

Open bill-connelly opened 3 years ago

bill-connelly commented 3 years ago

Describe the bug

We are using ioctl(fb, FBIO_WAITFORVSYNC, &dummy) to capture monitor timings for a program that directly writes to framebuffer (we have commented out dtoverlay=vc-fkms-v3d in /boot/config.txt). It works perfectly at various 50Hz and 60 Hz refresh rates. However, when set the refresh rates to 100 or 120 Hz with tvservice, the function hangs approximately 1 second. Instead of returning in 1/100 or 1/120th of a second as would be predicted.

To reproduce A minimal C function to show behaviour is

` #include

include

include

include <linux/fb.h>

include

include <sys/ioctl.h>

include

int main(void) { int fb = open("/dev/fb0", O_RDWR); __u32 dummy = 0;

int i; struct timeval tv; unsigned long time_us; int error_code; for (i = 0; i < 10; i++) { error_code = ioctl(fb, FBIO_WAITFORVSYNC, &dummy); gettimeofday(&tv, NULL); time_us = 1000000 * tv.tv_sec + tv.tv_usec; printf("Time is %lu, error code is %i\n", time_us, error_code); } } `

Expected behaviour Setting the monitor to 50 or 60 hz with a command like tvservice -e "cea 31" or tvservice -e "cea 16" and calling the above C function with ./refreshrate should produce an output like a

Time is 1007133697, error code is 0 Time is 1007150314, error code is 0 Time is 1007166978, error code is 0 Time is 1007183643, error code is 0 Time is 1007200319, error code is 0 Time is 1007216987, error code is 0 Time is 1007233649, error code is 0 Time is 1007250319, error code is 0 Time is 1007266986, error code is 0 Time is 1007283648, error code is 0

Note, there is approximately 17 ms between times, as expected for a 60 Hz update. However, setting the monitor to 100 or 120 Hz with tvservice -e "cea 63" produces the following output

Time is 1106366765, error code is 0 Time is 1107575047, error code is 0 Time is 1108783371, error code is 0 Time is 1109991698, error code is 0 Time is 1111200022, error code is 0 Time is 1112408352, error code is 0 Time is 1113616677, error code is 0 Time is 1114824996, error code is 0 Time is 1116033327, error code is 0 Time is 1117241653, error code is 0

Note, times are separated by 1.1 seconds. Not 1/120 seconds as would be expected.

System

Raspberry Pi 4 Model B Rev 1.1 PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)"

Raspberry Pi reference 2020-02-13 Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 5f884374b6ac6e155330c58caa1fb7249b8badf1, stage5

Linux raspberrypi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux Revision : c03111 Serial : 1000000002df6212 Model : Raspberry Pi 4 Model B Rev 1.1 Throttled flag : throttled=0x0 Camera : supported=0 detected=0

Videocore information

Feb 12 2020 12:36:21 Copyright (c) 2012 Broadcom version c3c8dbdf147686fb0c3f32aece709d0653368810 (clean) (release) (start)

alloc failures: 0 compactions: 0 legacy block fails: 0

Filesystem information

Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 27802848 9852196 16726448 38% / devtmpfs 1966340 0 1966340 0% /dev tmpfs 2000132 0 2000132 0% /dev/shm tmpfs 2000132 8748 1991384 1% /run tmpfs 5120 4 5116 1% /run/lock tmpfs 2000132 0 2000132 0% /sys/fs/cgroup /dev/mmcblk0p6 258094 53466 204629 21% /boot tmpfs 400024 0 400024 0% /run/user/1000

Filename Type Size Used Priority /var/swap file 102396 0 -2

Package version information

raspberrypi-ui-mods: Installed: 1.20200127 raspberrypi-sys-mods: Installed: 20191105 openbox: Installed: 3.6.1-8+rpt3 lxpanel: Installed: 0.10.0-2+rpt7 pcmanfm: Installed: 1.3.1-1+rpt18 rpd-plym-splash: Installed: 0.21

Networking Information

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet x.x.x.x netmask x.x.x.x broadcast x.x.x.x inet6 y::y.y.y.y prefixlen 64 scopeid 0x20 ether m.m.m.m txqueuelen 1000 (Ethernet) RX packets 2459 bytes 321092 (313.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 833 bytes 126525 (123.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet x.x.x.x netmask x.x.x.x inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether m.m.m.m txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

USB Information

/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M | Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M | Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M | Port 4: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M | Port 4: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

config.txt

arm_freq=1500 audio_pwm_mode=514 config_hdmi_boost=5 core_freq=500 core_freq_min=200 disable_commandline_tags=2 disable_l2cache=1 disable_splash=1 display_hdmi_rotate=-1 display_lcd_rotate=-1 enable_gic=1 force_eeprom_read=1 force_pwm_open=1 framebuffer_ignore_alpha=1 framebuffer_swap=1 gpu_freq=500 gpu_freq_min=250 init_uart_clock=0x2dc6c00 lcd_framerate=60 max_framebuffers=2 over_voltage_avs=-23750 pause_burst_frames=1 program_serial_random=1 second_boot=1 total_mem=4096 hdmi_force_cec_address:0=65535 hdmi_force_cec_address:1=65535 hdmi_pixel_freq_limit:0=0x11e1a300 hdmi_pixel_freq_limit:1=0x11e1a300 device_tree=- overlay_prefix=overlays/ hdmi_cvt:0= hdmi_cvt:1= hdmi_edid_filename:0= hdmi_edid_filename:1= hdmi_timings:0= hdmi_timings:1=

cmdline.txt

coherent_pool=1M 8250.nr_uarts=0 cma=64M bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:26:33:76 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

raspi-gpio settings

BANK0 (GPIO 0 to 27): GPIO 0: level=1 fsel=0 func=INPUT pull=UP GPIO 1: level=1 fsel=0 func=INPUT pull=UP GPIO 2: level=1 fsel=0 func=INPUT pull=UP GPIO 3: level=1 fsel=0 func=INPUT pull=UP GPIO 4: level=1 fsel=0 func=INPUT pull=UP GPIO 5: level=1 fsel=0 func=INPUT pull=UP GPIO 6: level=1 fsel=0 func=INPUT pull=UP GPIO 7: level=1 fsel=0 func=INPUT pull=UP GPIO 8: level=1 fsel=0 func=INPUT pull=UP GPIO 9: level=0 fsel=0 func=INPUT pull=DOWN GPIO 10: level=0 fsel=0 func=INPUT pull=DOWN GPIO 11: level=0 fsel=0 func=INPUT pull=DOWN GPIO 12: level=0 fsel=0 func=INPUT pull=DOWN GPIO 13: level=0 fsel=0 func=INPUT pull=DOWN GPIO 14: level=1 fsel=0 func=INPUT pull=NONE GPIO 15: level=1 fsel=0 func=INPUT pull=UP GPIO 16: level=0 fsel=0 func=INPUT pull=DOWN GPIO 17: level=0 fsel=0 func=INPUT pull=DOWN GPIO 18: level=0 fsel=0 func=INPUT pull=DOWN GPIO 19: level=0 fsel=0 func=INPUT pull=DOWN GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN GPIO 21: level=0 fsel=0 func=INPUT pull=DOWN GPIO 22: level=0 fsel=0 func=INPUT pull=DOWN GPIO 23: level=0 fsel=0 func=INPUT pull=DOWN GPIO 24: level=0 fsel=0 func=INPUT pull=DOWN GPIO 25: level=0 fsel=0 func=INPUT pull=DOWN GPIO 26: level=0 fsel=0 func=INPUT pull=DOWN GPIO 27: level=0 fsel=0 func=INPUT pull=DOWN BANK1 (GPIO 28 to 45): GPIO 28: level=1 fsel=2 alt=5 func=RGMII_MDIO pull=UP GPIO 29: level=0 fsel=2 alt=5 func=RGMII_MDC pull=DOWN GPIO 30: level=0 fsel=7 alt=3 func=CTS0 pull=UP GPIO 31: level=0 fsel=7 alt=3 func=RTS0 pull=NONE GPIO 32: level=1 fsel=7 alt=3 func=TXD0 pull=NONE GPIO 33: level=1 fsel=7 alt=3 func=RXD0 pull=UP GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK pull=NONE GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP GPIO 40: level=0 fsel=4 alt=0 func=PWM1_0 pull=NONE GPIO 41: level=0 fsel=4 alt=0 func=PWM1_1 pull=NONE GPIO 42: level=0 fsel=1 func=OUTPUT pull=UP GPIO 43: level=1 fsel=0 func=INPUT pull=UP GPIO 44: level=1 fsel=0 func=INPUT pull=UP GPIO 45: level=1 fsel=0 func=INPUT pull=UP BANK2 (GPIO 46 to 53): GPIO 46: level=0 fsel=0 func=INPUT pull=DOWN GPIO 47: level=0 fsel=0 func=INPUT pull=DOWN GPIO 48: level=0 fsel=0 func=INPUT pull=DOWN GPIO 49: level=0 fsel=0 func=INPUT pull=DOWN GPIO 50: level=0 fsel=0 func=INPUT pull=DOWN GPIO 51: level=0 fsel=0 func=INPUT pull=DOWN GPIO 52: level=0 fsel=0 func=INPUT pull=DOWN GPIO 53: level=0 fsel=0 func=INPUT pull=DOWN

vcdbg log messages

002604.244: arasan: arasan_emmc_open 002606.418: arasan: arasan_emmc_set_clock C0: 0x00000000 C1: 0x000e7187 emmc: 250000000 actual: 200000 div: 0x00000271 target: 200000 min: 100000 max: 400000 delay: 10 002723.184: arasan: arasan_emmc_set_clock C0: 0x00000000 C1: 0x000e7187 emmc: 250000000 actual: 200000 div: 0x00000271 target: 200000 min: 100000 max: 400000 delay: 10 002730.339: arasan: arasan_emmc_set_clock C0: 0x00000f00 C1: 0x000ec2c7 emmc: 250000000 actual: 129937 div: 0x000003c2 target: 130000 min: 100000 max: 400000 delay: 15 002805.361: arasan: arasan_emmc_set_clock C0: 0x00000f06 C1: 0x000e0307 emmc: 250000000 actual: 41666666 div: 0x00000003 target: 40000000 min: 0 max: 40000000 delay: 1 003082.504: brfs: File read: /mfs/sd/config.txt 003091.137: brfs: File read: 1818 bytes 003145.986: brfs: File read: /mfs/sd/config.txt 003627.035: gpioman: gpioman_get_pin_num: pin DISPLAY_DSI_PORT not defined 003629.528: *** Restart logging 003629.569: brfs: File read: 1818 bytes 003633.375: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead 003669.533: HDMI0: hdmi_pixel_encoding: 300000000

003669.545: HDMI1: hdmi_pixel_encoding: 300000000

003681.579: brfs: File read: /mfs/sd/bcm2711-rpi-4-b.dtb 003681.616: Loading 'bcm2711-rpi-4-b.dtb' to 0x100 size 0xa01c 004116.929: brfs: File read: 40988 bytes 004121.144: brfs: File read: /mfs/sd/config.txt 004122.075: dtparam: audio=on 004226.054: brfs: File read: 1818 bytes 004228.896: brfs: File read: /mfs/sd/cmdline.txt 004229.027: Read command line from file 'cmdline.txt': 004229.111: 'console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles' 006065.587: brfs: File read: 160 bytes 007136.902: brfs: File read: /mfs/sd/kernel7l.img 007136.983: Loading 'kernel7l.img' to 0x8000 size 0x57d910 007137.077: Device tree loaded to 0x2eff5b00 (size 0xa447) 007139.864: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined 009340.743: vchiq_core: vchiq_init_state: slot_zero = 0xf7580000, is_master = 1 009346.889: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead 009354.372: TV service:host side not connected, dropping notification 0x00000002, 0x00000001, 0x00000010 012671.847: brfs: File read: 5757200 bytes 105119.874: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x0000003f 242894.867: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x00000010 264378.638: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x0000003f 692402.645: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x0000001f 878766.183: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x00000010 964048.366: TV service:host side not connected, dropping notification 0x00000008, 0x00000001, 0x0000003f

dmesg log

[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.97-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 SMP Thu Jan 30 13:21:14 GMT 2020 [ 0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1 [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] cma: Reserved 64 MiB at 0x0000000037400000 [ 0.000000] On node 0 totalpages: 1012736 [ 0.000000] DMA zone: 1728 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 196608 pages, LIFO batch:63 [ 0.000000] HighMem zone: 816128 pages, LIFO batch:63 [ 0.000000] random: get_random_bytes called from start_kernel+0xc0/0x4e8 with crng_init=0 [ 0.000000] percpu: Embedded 17 pages/cpu s36928 r8192 d24512 u69632 [ 0.000000] pcpu-alloc: s36928 r8192 d24512 u69632 alloc=17*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1011008 [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=64M bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbswap=1 smsc95xx.macaddr=m.m.m.m vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) [ 0.000000] Memory: 3932684K/4050944K available (8192K kernel code, 687K rwdata, 2408K rodata, 2048K init, 850K bss, 52724K reserved, 65536K cma-reserved, 3198976K highmem) [ 0.000000] Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xf0800000 - 0xff800000 ( 240 MB) lowmem : 0xc0000000 - 0xf0000000 ( 768 MB) pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) modules : 0xbf000000 - 0xbfe00000 ( 14 MB) .text : 0x(ptrval) - 0x(ptrval) (10208 kB) .init : 0x(ptrval) - 0x(ptrval) (2048 kB) .data : 0x(ptrval) - 0x(ptrval) ( 688 kB) .bss : 0x(ptrval) - 0x(ptrval) ( 851 kB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] ftrace: allocating 28692 entries in 85 pages [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 [ 0.000000] GIC: Using split EOI/Deactivate mode [ 0.000000] arch_timer: cp15 timer(s) running at 54.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns [ 0.000006] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns [ 0.000018] Switching to timer-based delay loop, resolution 18ns [ 0.000241] Console: colour dummy device 80x30 [ 0.000265] console [tty1] enabled [ 0.000310] Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=540000) [ 0.000327] pid_max: default: 32768 minimum: 301 [ 0.000598] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.000616] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.001383] CPU: Testing write buffer coherency: ok [ 0.001788] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.002437] Setting up static identity map for 0x200000 - 0x20003c [ 0.002597] rcu: Hierarchical SRCU implementation. [ 0.003459] smp: Bringing up secondary CPUs ... [ 0.004272] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.005206] CPpi@raspberrypi:~ $ U2: thread -1, cpu 2, socket 0, mpidr 80000002 [ 0.006096] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003 [ 0.006233] smp: Brought up 1 node, 4 CPUs [ 0.006246] SMP: Total of 4 processors activated (432.00 BogoMIPS). [ 0.006256] CPU: All CPU(s) started in HYP mode. [ 0.006265] CPU: Virtualization extensions available. [ 0.007050] devtmpfs: initialized [ 0.017422] VFP support v0.3: implementor 41 architecture 3 part 40 variant 8 rev 0 [ 0.017622] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.017643] futex hash table entries: 1024 (order: 4, 65536 bytes) [ 0.019761] pinctrl core: initialized pinctrl subsystem [ 0.020625] NET: Registered protocol family 16 [ 0.023767] DMA: preallocated 1024 KiB pool for atomic coherent allocations [ 0.025227] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [ 0.025237] hw-breakpoint: maximum watchpoint size is 8 bytes. [ 0.025430] Serial: AMBA PL011 UART driver [ 0.028380] bcm2835-mbox fe00b880.mailbox: mailbox enabled [ 0.050035] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-02-12 12:36, variant start [ 0.060051] raspberrypi-firmware soc:firmware: Firmware hash is c3c8dbdf147686fb0c3f32aece709d0653368810 [ 0.103086] bcm2835-dma fe007000.dma: DMA legacy API manager at (ptrval), dmachans=0x1 [ 0.106100] vgaarb: loaded [ 0.106459] SCSI subsystem initialized [ 0.106660] usbcore: registered new interface driver usbfs [ 0.106712] usbcore: registered new interface driver hub [ 0.106808] usbcore: registered new device driver usb [ 0.108103] clocksource: Switched to clocksource arch_sys_counter [ 0.186659] VFS: Disk quotas dquot_6.6.0 [ 0.186739] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 0.186883] FS-Cache: Loaded [ 0.187063] CacheFiles: Loaded [ 0.196530] NET: Registered protocol family 2 [ 0.197190] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes) [ 0.197215] TCP established hash table entries: 8192 (order: 3, 32768 bytes) [ 0.197281] TCP bind hash table entries: 8192 (order: 4, 65536 bytes) [ 0.197352] TCP: Hash tables configured (established 8192 bind 8192) [ 0.197482] UDP hash table entries: 512 (order: 2, 16384 bytes) [ 0.197510] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) [ 0.197722] NET: Registered protocol family 1 [ 0.198292] RPC: Registered named UNIX socket transport module. [ 0.198302] RPC: Registered udp transport module. [ 0.198311] RPC: Registered tcp transport module. [ 0.198320] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.198337] PCI: CLS 0 bytes, default 64 [ 0.201356] Initialise system trusted keyrings [ 0.201518] workingset: timestamp_bits=14 max_order=20 bucket_order=6 [ 0.210439] FS-Cache: Netfs 'nfs' registered for caching [ 0.210935] NFS: Registering the id_resolver key type [ 0.210958] Key type id_resolver registered [ 0.210967] Key type id_legacy registered [ 0.210986] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.213244] Key type asymmetric registered [ 0.213255] Asymmetric key parser 'x509' registered [ 0.213363] bounce: pool size: 64 pages [ 0.213407] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250) [ 0.213570] io scheduler noop registered [ 0.213580] io scheduler deadline registered (default) [ 0.213743] io scheduler cfq registered [ 0.213754] io scheduler mq-deadline registered (default) [ 0.213764] io scheduler kyber registered [ 0.266756] brcm-pcie fd500000.pcie: dmabounce: initialised - 32768 kB, threshold 0x00000000c0000000 [ 0.266776] brcm-pcie fd500000.pcie: could not get clock [ 0.266846] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges: [ 0.266884] brcm-pcie fd500000.pcie: MEM 0x600000000..0x603ffffff -> 0xf8000000 [ 0.318151] brcm-pcie fd500000.pcie: link up, 5.0 Gbps x1 (!SSC) [ 0.318469] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00 [ 0.318485] pci_bus 0000:00: root bus resource [bus 00-01] [ 0.318502] pci_bus 0000:00: root bus resource [mem 0x600000000-0x603ffffff] (bus address [0xf8000000-0xfbffffff]) [ 0.318550] pci 0000:00:00.0: [14e4:2711] type 01 class 0x060400 [ 0.318690] pci 0000:00:00.0: PME# supported from D0 D3hot [ 0.321407] PCI: bus0: Fast back to back transfers disabled [ 0.321424] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring [ 0.321629] pci 0000:01:00.0: [1106:3483] type 00 class 0x0c0330 [ 0.321755] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff 64bit] [ 0.322075] pci 0000:01:00.0: PME# supported from D0 D3cold [ 0.324789] PCI: bus1: Fast back to back transfers disabled [ 0.324805] pci_bus 0000:01: busn_res: [bus 01] end is updated to 01 [ 0.324852] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff] [ 0.324871] pci 0000:01:00.0: BAR 0: assigned [mem 0x600000000-0x600000fff 64bit] [ 0.324941] pci 0000:00:00.0: PCI bridge to [bus 01] [ 0.324958] pci 0000:00:00.0: bridge window [mem 0x600000000-0x6000fffff] [ 0.325184] pcieport 0000:00:00.0: enabling device (0140 -> 0142) [ 0.325360] pcieport 0000:00:00.0: Signaling PME with IRQ 51 [ 0.325515] pcieport 0000:00:00.0: AER enabled with IRQ 51 [ 0.325682] pci 0000:01:00.0: enabling device (0140 -> 0142) [ 0.326239] bcm2708_fb soc:fb: FB found 1 display(s) [ 0.365969] Console: switching to colour frame buffer device 228x61 [ 0.375110] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 1824x984 [ 0.378783] iproc-rng200 fe104000.rng: hwrng registered [ 0.378993] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB) [ 0.379495] vc-sm: Videocore shared memory driver [ 0.379880] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000 [ 0.390431] brd: module loaded [ 0.400462] loop: module loaded [ 0.401235] Loading iSCSI transport class v2.0-870. [ 0.402955] libphy: Fixed MDIO Bus: probed [ 0.403375] bcmgenet fd580000.genet: failed to get enet clock [ 0.403391] bcmgenet fd580000.genet: GENET 5.0 EPHY: 0x0000 [ 0.403408] bcmgenet fd580000.genet: failed to get enet-wol clock [ 0.403424] bcmgenet fd580000.genet: failed to get enet-eee clock [ 0.403447] bcmgenet: Skipping UMAC reset [ 0.403688] unimac-mdio unimac-mdio.-19: DMA mask not set [ 0.418134] libphy: bcmgenet MII bus: probed [ 0.458703] unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus at 0x(ptrval) [ 0.459631] usbcore: registered new interface driver r8152 [ 0.459700] usbcore: registered new interface driver lan78xx [ 0.459756] usbcore: registered new interface driver smsc95xx [ 0.460071] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 0.460105] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1 [ 0.462667] xhci_hcd 0000:01:00.0: hcc params 0x002841eb hci version 0x100 quirks 0x0000001000000890 [ 0.462984] genirq: irq_chip Brcm_MSI did not update eff. affinity mask of irq 52 [ 0.463867] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19 [ 0.463881] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 0.463893] usb usb1: Product: xHCI Host Controller [ 0.463906] usb usb1: Manufacturer: Linux 4.19.97-v7l+ xhci-hcd [ 0.463917] usb usb1: SerialNumber: 0000:01:00.0 [ 0.464455] hub 1-0:1.0: USB hub found [ 0.464536] hub 1-0:1.0: 1 port detected [ 0.465007] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 0.465034] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2 [ 0.465054] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed [ 0.465417] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 4.19 [ 0.465431] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 0.465443] usb usb2: Product: xHCI Host Controller [ 0.465454] usb usb2: Manufacturer: Linux 4.19.97-v7l+ xhci-hcd [ 0.465465] usb usb2: SerialNumber: 0000:01:00.0 [ 0.465973] hub 2-0:1.0: USB hub found [ 0.466027] hub 2-0:1.0: 4 ports detected [ 0.467201] dwc_otg: version 3.00a 10-AUG-2012 (platform bus) [ 0.467381] dwc_otg: FIQ enabled [ 0.467390] dwc_otg: NAK holdoff enabled [ 0.467399] dwc_otg: FIQ split-transaction FSM enabled [ 0.467412] Module dwc_common_port init [ 0.467630] usbcore: registered new interface driver uas [ 0.467724] usbcore: registered new interface driver usb-storage [ 0.467905] mousedev: PS/2 mouse device common for all mice [ 0.469091] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer [ 0.470537] sdhci: Secure Digital Host Controller Interface driver [ 0.470547] sdhci: Copyright(c) Pierre Ossman [ 0.470935] mmc-bcm2835 fe300000.mmcnr: could not get clk, deferring probe [ 0.471302] sdhci-pltfm: SDHCI platform and OF driver helper [ 0.474298] ledtrig-cpu: registered to indicate activity on CPUs [ 0.474449] hidraw: raw HID events driver (C) Jiri Kosina [ 0.474580] usbcore: registered new interface driver usbhid [ 0.474589] usbhid: USB HID core driver [ 0.475598] vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0

[ 0.489876] [vc_sm_connected_init]: end - returning 0 [ 0.491032] Initializing XFRM netlink socket [ 0.491061] NET: Registered protocol family 17 [ 0.491179] Key type dns_resolver registered [ 0.491526] Registering SWP/SWPB emulation handler [ 0.492172] registered taskstats version 1 [ 0.492192] Loading compiled-in X.509 certificates [ 0.499330] uart-pl011 fe201000.serial: cts_event_workaround enabled [ 0.499407] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 34, base_baud = 0) is a PL011 rev2 [ 0.504494] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver [ 0.505034] brcmstb_thermal fd5d2200.thermal: registered AVS TMON of-sensor driver [ 0.505662] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0 [ 0.505673] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated [ 0.531301] sdhci-iproc fe340000.emmc2: Linked as a consumer to regulator.3 [ 0.531381] sdhci-iproc fe340000.emmc2: Linked as a consumer to regulator.4 [ 0.549750] mmc1: queuing unknown CIS tuple 0x80 (2 bytes) [ 0.551358] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 0.552963] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 0.555837] mmc1: queuing unknown CIS tuple 0x80 (7 bytes) [ 0.557442] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 0.565467] mmc0: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA [ 0.567915] of_cfs_init [ 0.568006] of_cfs_init: OK [ 0.568776] Waiting for root device /dev/mmcblk0p7... [ 0.610775] random: fast init done [ 0.631887] mmc1: new high speed SDIO card at address 0001 [ 0.670083] mmc0: new ultra high speed DDR50 SDHC card at address aaaa [ 0.671320] mmcblk0: mmc0:aaaa SL32G 29.7 GiB [ 0.675472] mmcblk0: p1 p2 < p5 p6 p7 > [ 0.721741] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data mode. Opts: (null) [ 0.721783] VFS: Mounted root (ext4 filesystem) readonly on device 179:7. [ 0.727618] devtmpfs: mounted [ 0.735488] Freeing unused kernel memory: 2048K [ 0.758355] Run /sbin/init as init process [ 0.828158] usb 1-1: new high-speed USB device number 2 using xhci_hcd [ 1.010818] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.21 [ 1.010835] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [ 1.010846] usb 1-1: Product: USB2.0 Hub [ 1.012793] hub 1-1:1.0: USB hub found [ 1.013130] hub 1-1:1.0: 4 ports detected [ 1.163634] systemd[1]: System time before build time, advancing clock. [ 1.247811] NET: Registered protocol family 10 [ 1.249130] Segment Routing with IPv6 [ 1.292196] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid) [ 1.292896] systemd[1]: Detected architecture arm. [ 1.302845] systemd[1]: Set hostname to . [ 1.305036] systemd[1]: Failed to bump fs.file-max, ignoring: Invalid argument [ 1.338165] usb 1-1.3: new high-speed USB device number 3 using xhci_hcd [ 1.468694] usb 1-1.3: New USB device found, idVendor=413c, idProduct=1010, bcdDevice= 1.00 [ 1.468710] usb 1-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [ 1.468723] usb 1-1.3: Product: USB 2.0 Hub [MTT] [ 1.471078] hub 1-1.3:1.0: USB hub found [ 1.471218] hub 1-1.3:1.0: 4 ports detected [ 1.568159] usb 1-1.4: new low-speed USB device number 4 using xhci_hcd [ 1.714816] usb 1-1.4: New USB device found, idVendor=0461, idProduct=4d81, bcdDevice= 2.00 [ 1.714832] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [ 1.714845] usb 1-1.4: Product: USB Optical Mouse [ 1.724925] input: USB Optical Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:0461:4D81.0001/input/input0 [ 1.725257] hid-generic 0003:0461:4D81.0001: input,hidraw0: USB HID v1.11 Mouse [USB Optical Mouse] on usb-0000:01:00.0-1.4/input0 [ 1.808161] usb 1-1.3.4: new low-speed USB device number 5 using xhci_hcd [ 1.947248] random: systemd: uninitialized urandom read (16 bytes read) [ 1.948473] usb 1-1.3.4: New USB device found, idVendor=413c, idProduct=2110, bcdDevice=75.00 [ 1.948487] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 1.948499] usb 1-1.3.4: Product: Dell Wired Multimedia Keyboard [ 1.948510] usb 1-1.3.4: Manufacturer: Dell [ 1.956782] random: systemd: uninitialized urandom read (16 bytes read) [ 1.957431] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point. [ 1.957767] random: systemd: uninitialized urandom read (16 bytes read) [ 1.958323] systemd[1]: Listening on udev Kernel Socket. [ 1.958856] systemd[1]: Listening on fsck to fsckd communication Socket. [ 1.965012] input: Dell Dell Wired Multimedia Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/0003:413C:2110.0002/input/input1 [ 1.965911] systemd[1]: Listening on Syslog Socket. [ 1.971478] systemd[1]: Created slice system-systemd\x2dfsck.slice. [ 1.971873] systemd[1]: Listening on initctl Compatibility Named Pipe. [ 2.028880] hid-generic 0003:413C:2110.0002: input,hidraw1: USB HID v1.10 Keyboard [Dell Dell Wired Multimedia Keyboard] on usb-0000:01:00.0-1.3.4/input0 [ 2.053035] input: Dell Dell Wired Multimedia Keyboard Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.1/0003:413C:2110.0003/input/input2 [ 2.053581] input: Dell Dell Wired Multimedia Keyboard System Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.1/0003:413C:2110.0003/input/input3 [ 2.118594] input: Dell Dell Wired Multimedia Keyboard Consumer Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.1/0003:413C:2110.0003/input/input4 [ 2.119106] hid-generic 0003:413C:2110.0003: input,hiddev96,hidraw2: USB HID v1.10 Mouse [Dell Dell Wired Multimedia Keyboard] on usb-0000:01:00.0-1.3.4/input1 [ 2.134907] i2c /dev entries driver [ 2.524293] EXT4-fs (mmcblk0p7): re-mounted. Opts: (null) [ 2.654127] systemd-journald[109]: Received request to flush runtime journal from PID 1 [ 3.513120] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned. [ 3.526619] bcm2835_audio soc:audio: card created with 8 channels [ 3.545345] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned. [ 3.633597] media: Linux media interface: v0.10 [ 3.633716] bcm2835_vc_sm_cma_probe: Videocore shared memory driver

[ 3.634546] rpivid-mem feb00000.hevc-decoder: rpivid-hevcmem initialised: Registers at 0xfeb00000 length 0x0000ffff [ 3.635146] rpivid-mem feb10000.rpivid-local-intc: rpivid-intcmem initialised: Registers at 0xfeb10000 length 0x00000fff [ 3.635722] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 3.635787] rpivid-mem feb20000.h264-decoder: rpivid-h264mem initialised: Registers at 0xfeb20000 length 0x0000ffff [ 3.636351] rpivid-mem feb30000.vp9-decoder: rpivid-vp9mem initialised: Registers at 0xfeb30000 length 0x0000ffff [ 3.645068] [vc_sm_connected_init]: installed successfully [ 3.659165] videodev: Linux video capture interface: v2.00 [ 3.713409] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned. [ 3.759323] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned. [ 3.769416] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 3.789505] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned. [ 3.863216] bcm2835-codec bcm2835-codec: Device registered as /dev/video10 [ 3.863257] bcm2835-codec bcm2835-codec: Loaded V4L2 decode [ 3.890070] bcm2835-codec bcm2835-codec: Device registered as /dev/video11 [ 3.890107] bcm2835-codec bcm2835-codec: Loaded V4L2 encode [ 3.903802] bcm2835-codec bcm2835-codec: Device registered as /dev/video12 [ 3.903835] bcm2835-codec bcm2835-codec: Loaded V4L2 isp [ 3.918681] brcmfmac: F1 signature read @0x18000000=0x15264345 [ 3.929698] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 3.930562] usbcore: registered new interface driver brcmfmac [ 4.165965] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 4.182810] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04 [ 6.474337] uart-pl011 fe201000.serial: no DMA platform data [ 6.494230] random: crng init done [ 6.494245] random: 7 urandom warning(s) missed due to ratelimiting [ 6.618396] 8021q: 802.1Q VLAN Support v1.8 [ 6.898458] Adding 102396k swap on /var/swap. Priority:-2 extents:1 across:102396k SSFS [ 7.149366] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 7.149497] brcmfmac: power management disabled [ 7.501099] bcmgenet: Skipping UMAC reset [ 7.598858] bcmgenet fd580000.genet: configuring instance for external RGMII (no delay) [ 7.599184] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 7.717293] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [ 8.648246] bcmgenet fd580000.genet eth0: Link is Down [ 10.644269] fuse init (API version 7.27) [ 12.808262] bcmgenet fd580000.genet eth0: Link is Up - 1Gbps/Full - flow control off [ 12.808285] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 13.168636] Bluetooth: Core ver 2.22 [ 13.168679] NET: Registered protocol family 31 [ 13.168683] Bluetooth: HCI device and connection manager initialized [ 13.168695] Bluetooth: HCI socket layer initialized [ 13.168701] Bluetooth: L2CAP socket layer initialized [ 13.168721] Bluetooth: SCO socket layer initialized [ 13.178231] Bluetooth: HCI UART driver ver 2.3 [ 13.178238] Bluetooth: HCI UART protocol H4 registered [ 13.178275] Bluetooth: HCI UART protocol Three-wire (H5) registered [ 13.178380] Bluetooth: HCI UART protocol Broadcom registered [ 13.419762] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 13.419769] Bluetooth: BNEP filters: protocol multicast [ 13.419784] Bluetooth: BNEP socket layer initialized [ 13.458557] Bluetooth: RFCOMM TTY layer initialized [ 13.458570] Bluetooth: RFCOMM socket layer initialized [ 13.458583] Bluetooth: RFCOMM ver 1.11

alanbork commented 3 years ago

why not run with fkms (or kms)?

bill-connelly commented 3 years ago

@alanbork Because I want to write directly to the frame buffer.

alanbork commented 3 years ago

out of curiosity only, why? do you get better performance doing that? I've been able to do 120hz @1080p under kms. it's possible it's dropping frames once in a while though.

bill-connelly commented 3 years ago

@alanbork If you can point me in the direction of documentation that shows me how to display a bitmap/pixelmap and (and this is absolutely critical) get the timings of vsync, under KMS, I would be very grateful. The whole point of the software I have written is to have the user know when frames are being displayed.

alanbork commented 3 years ago

are you trying to build a lag tester, like

https://alantechreview.blogspot.com/2020/08/pilagtester-pro-order-page.html

? kms has a vsync callback, look up the source to modetest. I haven't tried to use it, I just infer timings from the return from swapbuffers() or equivalent. Note that the timings you get from this are pretty tight, see

https://github.com/alanbork/kmsmodeline

for an example. The average is exactly the refresh rate, even if there's a tiny bit of noise per frame.

On Wed, Jul 7, 2021 at 3:35 PM bill-connelly @.***> wrote:

@alanbork https://github.com/alanbork If you can point me in the direction of documentation that shows me how to display a bitmap/pixelmap and (and this is absolutely critical) get the timings of vsync, under KMS, I would be very grateful. The whole point of the software I have written is to have the user know when frames are being displayed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raspberrypi/firmware/issues/1517#issuecomment-875979150, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPGZ5IAWNIPXKW6KLYWSCTTWTJDDANCNFSM4VGLFJPQ .

bill-connelly commented 3 years ago

It's for this:

https://github.com/bill-connelly/rpg https://www.biorxiv.org/content/10.1101/2020.03.05.979724v1

Scientists want to display stimuli to subjects, but not knowing when they actually turn up on the screen is a pain. 16 milliseconds is a big deal.

Anyway, there seems to be lots of stuff on your github, and on https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset-vsync.c That I'll try to get into some time.

Still, the bug report is real.

alanbork commented 3 years ago

have you considered using/raiding the C code base of the psychtoolbox like psychopy does? Mario Kleiner has tested on the pi and is pretty meticulous about timing. At the very least his code should be useful for determining how to accurately get timestamps, including workarounds for buggy drivers, though I don't think any of it is pi specific like your project. Your comparison to the psychtoolbox is probably contaminated by running it on windows, which mario likes to stress is not good for real time graphics. A fairer comparison would be running PTB on a pi.

My own pi work suggests that sometimes the pi goes off to lunch and has miserable latency, but usually it's quite good, like your data.

But if you really care down to 16ms, you'll need to also characterize your monitor's lag and response time, plus there's the ulgy fact that previous frames change how fast the pixels change intensity.

On Wed, Jul 7, 2021 at 5:56 PM bill-connelly @.***> wrote:

It's for this:

https://github.com/bill-connelly/rpg https://www.biorxiv.org/content/10.1101/2020.03.05.979724v1

Scientists want to display stimuli to subjects, but not knowing when they actually turn up on the screen is a pain. 16 milliseconds is a big deal.

Anyway, there seems to be lots of stuff on your github, and on https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset-vsync.c That I'll try to get into some time.

Still, the bug report is real.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raspberrypi/firmware/issues/1517#issuecomment-876034250, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPGZ5ILQWI5KUUN5H6E54DTWTZU5ANCNFSM4VGLFJPQ .

bill-connelly commented 3 years ago

@alanbork I thought Psycopy was pure python? It rests on pygame doesn't it. And I hadn't thought of looking at what psychtoolbox does because it doesn't/didn't work on Pi. I started working on this project when the Raspberry Pi 3 was new. I just wanted to write to the frame buffer. KISS. Obviously, what has happened with the RPI4 has changed things, so I'm open to going in other directions.

alanbork commented 3 years ago

Psycopy is't pure python but you might be right that the visual routines are; I know mario was collaborating with them at some point but don't recall on what.

Psychtoolbox runs even on the pi3, and mario has tested both pi3 and pi4 performance with good results tested against a photodiode (again, that's from memory, which might be wrong). Mario was even involved in the coding of the pi3 gpu driver (according to him). He posted an update on the toolbox forum in the last year or so if you want to look it up.

from my personal experience the pi3 might be a better choice still as pi4 drivers are still buggy with respect to timing.

On Wed, Jul 7, 2021 at 6:51 PM bill-connelly @.***> wrote:

@alanbork https://github.com/alanbork I thought Psycopy was pure python? It rests on pygame doesn't it. And I hadn't thought of looking at what psychtoolbox does because it doesn't/didn't work on Pi. I started working on this project when the Raspberry Pi 3 was new. I just wanted to write to the frame buffer. KISS. Obviously, what has happened with the RPI4 has changed things, so I'm open to going in other directions.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raspberrypi/firmware/issues/1517#issuecomment-876055866, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPGZ5OYPOE7LZXY5OUO7BLTWUACBANCNFSM4VGLFJPQ .

PeterPablo commented 3 years ago

Once I did timing-sensitive research that was sensitive in the sub-us range. May I suggest that while a standalone SW solution is not available to you, that you consider introducing a trigger mechanism that is able to generate more accurate timing information? While I did not look at that publication, "turn up on the screen" suggests that you might have a useable brightness trigger from the display that can be rather easily captured by an external photodiode and timestamped from a GPIO.

alanbork commented 3 years ago

yes, a photodiode in the corner detecting a pixel that swaps from black to white on each successive frame. Never a bad idea. Not really solving his problem though since he's looking for a reliable measure of when the pi sent the frame so he can start uploading the next one to the framebuffer.

bill-connelly commented 3 years ago

@PeterPablo The whole point of the solution was to avoid those approaches. I just want to supply scientists with a robust turn key solution to displaying visual stimuli. Which I think I have, but only up to 60 Hz.