@@ -497,53 +497,7 @@ def runtime_pm_info(card: Path) -> Dict[str, str]:
497497 out [k ] = t
498498 return out
499499
500-
501- # ------------------------- Flow A: nomodeset / fbdev -------------------------
502-
503-
504- def run_flow_nomodeset ():
505- print ("[INFO] Flow: nomodeset (fbdev / firmware framebuffer)" )
506-
507- fb0 = Path ("/dev/fb0" )
508- if fb0 .exists ():
509- print ("[PASS] /dev/fb0 exists (fbdev path available)" )
510- else :
511- raise SystemExit (
512- "[FAIL] /dev/fb0 missing (expected with nomodeset). "
513- "Check efifb/simplefb/vesafb/simpledrm."
514- )
515-
516- # sysfs fb info
517- fb_sys = Path ("/sys/class/graphics/fb0" )
518- if fb_sys .is_dir ():
519- for f in ["name" , "modes" , "virtual_size" , "stride" , "bits_per_pixel" ]:
520- t = read_text (fb_sys / f )
521- if t is not None :
522- print ("[INFO] fb0 {}: {}" .format (f , t ))
523- # driver symlink if present
524- drv = fb_sys / "device" / "driver"
525- if drv .exists ():
526- try :
527- if drv .is_symlink ():
528- drv_name = Path (os .readlink (str (drv ))).name
529- print ("[INFO] fb0 driver: {}" .format (drv_name ))
530- except Exception :
531- pass
532- else :
533- raise SystemExit (
534- "[FAIL] /sys/class/graphics/fb0 not found; "
535- "fbdev sysfs info missing"
536- )
537-
538- return
539-
540-
541- # ------------------------- Flow B: normal DRM/KMS -------------------------
542-
543-
544- def run_flow_kms ():
545- print ("[INFO] Flow: normal DRM/KMS" )
546-
500+ def drm_register ():
547501 # 1) DRM registered (sysfs)
548502 sys_drm = list_sys_class_drm ()
549503 if not sys_drm :
@@ -563,6 +517,9 @@ def run_flow_kms():
563517 )
564518 print ("[PASS] Found DRM cards: " + ", " .join (c .name for c in cards ))
565519
520+ return cards
521+
522+ def driver_bound (cards ):
566523 # 2) Driver bound
567524 any_driver = False
568525 for c in cards :
@@ -599,6 +556,7 @@ def run_flow_kms():
599556 "probe/bind issue"
600557 )
601558
559+ def drm_interface_check ():
602560 # 3) /dev/dri nodes
603561 dri_nodes = list_dev_dri_nodes ()
604562 if not dri_nodes :
@@ -623,6 +581,7 @@ def run_flow_kms():
623581 "Mesa may fall back to llvmpipe or rendering may fail"
624582 )
625583
584+ def modset_parms_check ():
626585 # 4) KMS gating module params
627586 params = []
628587 for mod , param in [
@@ -644,6 +603,7 @@ def run_flow_kms():
644603 "(often black screen on Wayland)"
645604 )
646605
606+ def connection_check (cards ):
647607 # 5) Connection / EDID / modes
648608 any_connected = False
649609 for c in cards :
@@ -692,6 +652,7 @@ def run_flow_kms():
692652 "(if you expect display: cable/hotplug/link training)"
693653 )
694654
655+ def runtime_checking ():
695656 # 6) runtime checkiong
696657 card = pick_primary_card ()
697658 if card is None :
@@ -715,6 +676,58 @@ def run_flow_kms():
715676 else :
716677 raise SystemExit ("[FAIL] PSR/ALPM status is abnormal" )
717678
679+ # ------------------------- Flow A: nomodeset / fbdev -------------------------
680+
681+
682+ def run_flow_nomodeset ():
683+ print ("[INFO] Flow: nomodeset (fbdev / firmware framebuffer)" )
684+
685+ fb0 = Path ("/dev/fb0" )
686+ if fb0 .exists ():
687+ print ("[PASS] /dev/fb0 exists (fbdev path available)" )
688+ else :
689+ raise SystemExit (
690+ "[FAIL] /dev/fb0 missing (expected with nomodeset). "
691+ "Check efifb/simplefb/vesafb/simpledrm."
692+ )
693+
694+ # sysfs fb info
695+ fb_sys = Path ("/sys/class/graphics/fb0" )
696+ if fb_sys .is_dir ():
697+ for f in ["name" , "modes" , "virtual_size" , "stride" , "bits_per_pixel" ]:
698+ t = read_text (fb_sys / f )
699+ if t is not None :
700+ print ("[INFO] fb0 {}: {}" .format (f , t ))
701+ # driver symlink if present
702+ drv = fb_sys / "device" / "driver"
703+ if drv .exists ():
704+ try :
705+ if drv .is_symlink ():
706+ drv_name = Path (os .readlink (str (drv ))).name
707+ print ("[INFO] fb0 driver: {}" .format (drv_name ))
708+ except Exception :
709+ pass
710+ else :
711+ raise SystemExit (
712+ "[FAIL] /sys/class/graphics/fb0 not found; "
713+ "fbdev sysfs info missing"
714+ )
715+
716+ return
717+
718+
719+ # ------------------------- Flow B: normal DRM/KMS -------------------------
720+
721+
722+ def run_flow_kms ():
723+ print ("[INFO] Flow: normal DRM/KMS" )
724+ cards = drm_register ()
725+ driver_bound (cards )
726+ drm_interface_check ()
727+ modeset_parms_check ()
728+ connection_check (cards )
729+ runtime_checking ()
730+
718731 return
719732
720733
0 commit comments