Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Raspberry Pi si.graphics(cb) returns empty displays[] array #893

Open
jwtd opened this issue Mar 2, 2024 · 1 comment
Open

On Raspberry Pi si.graphics(cb) returns empty displays[] array #893

jwtd opened this issue Mar 2, 2024 · 1 comment

Comments

@jwtd
Copy link

jwtd commented Mar 2, 2024

Describe the bug

When using a customized Debian OS image generated by pi-gen running on a Raspberry Pi CM4 with the vc4-kms-v3d display driver, calling si.graphics(cb) returns an empty displays[] array.

The code path is checking whether the OS is a Raspberry Pi using util.isRaspberry() which checks CPU in /proc/cpuinf and util.isRaspbian() which checks for the word "Raspian" in /etc/os-release.

This approach assumes that all Pi's support the tvservice utility, which is a false assumption. tvservice support is controlled by the display driver, not the CPU or OS version.

A few lines lower in the code, there is an alternative path which uses xrandr to get the display data, which does return the needed data. However, that path requires successful use of xdpyinfo and clinfo. If either or both of those utilities are not found, the code returns an empty array.

Recommendations

  • The code route should be checking for the presence and operation of the packages/tools required to collect the data rather than making assumptions based on the presence of strings in the CPU and OS info files.
  • When a tool returns unexpected or no results or isn't found, raise an exception that lets the developer know which call failed, and how to install the tool if possible.

To Reproduce
Steps to reproduce the behavior:

  1. Generate a custom Raspbian image using pi-gen to create a slimmed down version of Raspbian OS that doesn't have the name "Raspbian" in the OS release.
  2. Load the image onto a CM4 mounted on a carrier board (Like the Waveshare I/O board for CM4s)
  3. Attach displays to the HDMI outputs. I also have a screen attached to my DSI port, but that isn't required to verify this bug.
  4. Update /boot/config.txt to use dtoverlay=vc4-kms-v3d
  5. Create a node 20.11.0 app that imports systeminformation and then outputs Systeminformation.GraphicsData to the console or terminal.

Current Output
Current output returns and empty array...
console.log(res.displays) => []

Expected behavior
The array should be populated with the Displays attached to the board.

Environment:

  • systeminformation package version: 5.22.0
  • OS:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
  • Hardware: CM4 on Carrier Board
$ cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Hardware	: BCM2835
Revision	: d03141
Serial		: 10000000486b57b1
Model		: Raspberry Pi Compute Module 4 Rev 1.1

Output of npx systeminformation info command:

$ npx systeminformation info
───────────────
SYSTEMINFORMATION   Version: 5.22.0


Operating System:
───────────────
Platform         : linux
Distro           : Debian GNU/Linux
Release          : 11
Codename         : bullseye
Kernel           : 6.1.21-v8+
Arch             : arm64
Hostname         : eck-cn-qi02-pi
Codepage         : UTF-8
Build            :

System:
───────────────
Manufacturer     : Raspberry Pi Foundation
Model            : Raspberry Pi Compute Module 4 Rev 1.1
Version          : d03141
Virtual          :
Raspberry        : [object Object]

CPU:
───────────────
Manufacturer     : Sony UK
Brand            : BCM2711
Family           : Cortex-A72
Model            : 3
Stepping         : r0p3
Speed            : 1.5
Cores            : 4
PhysicalCores    : 4
PerformanceCores : 4
EfficiencyCores  :
Processors       : 1
Socket           : SOC

Additional context

Here is the output of the various utilities used by the code route....

$ fbset -s

mode "1024x600"
    geometry 1024 600 1920 1200 16
    timings 0 0 0 0 0 0 0
    accel true
    rgba 5/11,6/5,5/0,0/0
endmode

$ vcgencmd get_mem gpu
gpu=76M

$ tvservice -s
tvservice is not supported when using the vc4-kms-v3d driver.
Similar features are available with standard linux tools
such as kmsprint from kms++-utils

$ tvservice -n
tvservice is not supported when using the vc4-kms-v3d driver.
Similar features are available with standard linux tools
such as kmsprint from kms++-utils

$ lspci -vvv
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20) (prog-if 00 [Normal decode])
	Device tree node: /sys/firmware/devicetree/base/scb/pcie@7d500000/pci@0,0
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	I/O behind bridge: 00000000-00000fff [size=4K]
	Memory behind bridge: c0000000-c00fffff [size=1M]
	Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff [disabled]
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- VGA16- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: <access denied>

01:00.0 USB controller: Etron Technology, Inc. EJ188/EJ198 USB 3.0 Host Controller (prog-if 30 [XHCI])
	Subsystem: Etron Technology, Inc. EJ188/EJ198 USB 3.0 Host Controller
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 34
	Region 0: Memory at 600000000 (64-bit, non-prefetchable) [size=32K]
	Capabilities: <access denied>
	Kernel driver in use: xhci_hcd

$ clinfo --raw
-bash: clinfo: command not found

$ xdpyinfo
-bash: xdpyinfo: command not found

$ xrandr --verbose
Screen 0: minimum 320 x 200, current 4224 x 1080, maximum 7680 x 7680
HDMI-1 connected 1280x720+1920+0 (0x50) normal (normal left inverted right x axis y axis) 527mm x 296mm
	Identifier: 0x45
	Timestamp:  12435
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:
	CRTC:       4
	CRTCs:      4
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter:
	EDID:
		00ffffffffffff004cee201900122019
		0121010380160e78eaee95a3544c9926
		0f505421080095008180a940d1c00101
		010101010101f03c80a070b032403020
		3a040f282100001e0000000000000000
		00000000000000000000000000fc0053
		474e2d444953504c41590a20000000fd
		003b3c1e5311000a20202020202001af
		020319f14290042309070565030c0010
		0083010000e3050000f03c80a070b032
		4030203a040f282100001e011d007251
		d01e206e2855000f282100001e000000
		00000000000000000000000000000000
		00000000000000000000000000000000
		00000000000000000000000000000000
		000000000000000000000000000000c1
	Output format: Automatic
		supported: Automatic, RGB, YCbCr 4:2:2, YCbCr 4:4:4
	Broadcast RGB: Automatic
		supported: Automatic, Full, Limited 16:235
	max bpc: 8
		range: (8, 12)
	bottom margin: 0
		range: (0, 100)
	top margin: 0
		range: (0, 100)
	right margin: 0
		range: (0, 100)
	left margin: 0
		range: (0, 100)
	Colorspace: Default
		supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
	link-status: Good
		supported: Good, Bad
	CONNECTOR_ID: 32
		supported: 32
	non-desktop: 0
		range: (0, 1)
  1920x1200 (0x49) 156.000MHz +HSync +VSync +preferred
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  75.00KHz
        v: height 1200 start 1219 end 1229 total 1250           clock  60.00Hz
  1920x1080 (0x4a) 148.500MHz -HSync -VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x4b) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x4c) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1600x1200 (0x4d) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1280x1024 (0x4e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x4f) 88.750MHz +HSync -VSync
        h: width  1440 start 1488 end 1520 total 1600 skew    0 clock  55.47KHz
        v: height  900 start  903 end  909 total  926           clock  59.90Hz
  1280x720 (0x50) 74.250MHz +HSync +VSync *current
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x51) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x52) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x53) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  640x480 (0x54) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x55) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
HDMI-2 connected primary 1920x1080+0+0 (0x56) normal (normal left inverted right x axis y axis) 530mm x 290mm
	Identifier: 0x46
	Timestamp:  12435
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:
	CRTC:       0
	CRTCs:      0
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter:
	EDID:
		00ffffffffffff004e14ab0901000000
		2a1f0103b4351d7828ee91a3544c9926
		0f505421090031404540614081c08180
		9500b300454f023a801871382d40582c
		450012222100001e000000fd00304b1e
		5514000a202020202020000000ff0030
		303030303030303030303031000000fc
		0053636570747265204632340a2001c1
		020325f147901f041303010523090707
		8301000067030c0010001828681a0000
		0101304be6504480a070382940302035
		0000000000001e7f2156aa51001e3046
		8f330000000000001ed12640a0608429
		303020350000000000001e100e20e030
		5819201848120000000000001e781320
		18315829203020350000000000001e3b
	Output format: Automatic
		supported: Automatic, RGB, YCbCr 4:2:2, YCbCr 4:4:4
	Broadcast RGB: Automatic
		supported: Automatic, Full, Limited 16:235
	max bpc: 8
		range: (8, 12)
	bottom margin: 0
		range: (0, 100)
	top margin: 0
		range: (0, 100)
	right margin: 0
		range: (0, 100)
	left margin: 0
		range: (0, 100)
	Colorspace: Default
		supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
	link-status: Good
		supported: Good, Bad
	CONNECTOR_ID: 42
		supported: 42
	non-desktop: 0
		range: (0, 1)
  1920x1080 (0x56) 174.880MHz +HSync +VSync *current
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  84.08KHz
        v: height 1080 start 1083 end 1088 total 1121           clock  75.00Hz
  1920x1080 (0x4b) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x57) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x4c) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1920x1080i (0x58) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.75KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  60.00Hz
  1920x1080i (0x59) 74.176MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.72KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  59.94Hz
  1680x1050 (0x5a) 119.000MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
        v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
  1600x900 (0x5b) 99.370MHz +HSync +VSync
        h: width  1600 start 1648 end 1680 total 1760 skew    0 clock  56.46KHz
        v: height  900 start  903 end  908 total  941           clock  60.00Hz
  1280x1024 (0x5c) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x4e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x4f) 88.750MHz +HSync -VSync
        h: width  1440 start 1488 end 1520 total 1600 skew    0 clock  55.47KHz
        v: height  900 start  903 end  909 total  926           clock  59.90Hz
  1280x720 (0x50) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x5d) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x51) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x52) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x5e) 49.840MHz +HSync +VSync
        h: width   800 start  848 end  880 total 1080 skew    0 clock  46.15KHz
        v: height  600 start  603 end  608 total  641           clock  71.99Hz
  800x600 (0x5f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x53) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x60) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  720x480 (0x61) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x62) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x54) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x55) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
DSI-1 connected 1024x600+3200+0 (0x63) normal (normal left inverted right x axis y axis) 0mm x 0mm
	Identifier: 0x47
	Timestamp:  12435
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:
	CRTC:       3
	CRTCs:      3
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter:
	link-status: Good
		supported: Good, Bad
	CONNECTOR_ID: 48
		supported: 48
	non-desktop: 0
		range: (0, 1)
  1024x600 (0x63) 50.000MHz *current
        h: width  1024 start 1124 end 1224 total 1324 skew    0 clock  37.76KHz
        v: height  600 start  610 end  620 total  630           clock  59.94Hz
@ShonP40
Copy link

ShonP40 commented Mar 24, 2024

Having the same issue on Ubuntu 22.04 on the RPi 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants