Changeset 3476


Ignore:
Timestamp:
Dec 6, 2012, 11:11:22 PM (3 years ago)
Author:
wmb
Message:

HDMI/EDID - more complicated way of choosing the resolution, in hopes of doing better with monitors that don't declare a native resolution. Also factored .hdmi so the pieces are easier to incorporate into selftest sequences.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dev/edid.fth

    r3475 r3476  
    255255end-string-array
    256256
     257false value 1080p-support?
    257258false value 1080p-native?
     259false value 720p-native?
    258260: .cea-video  ( offset size -- )
    259    false to 1080p-native?
     261   false to 720p-native?  false to 1080p-native?    false to 1080p-support?
    260262   ." CEA/HDMI Modes: "
    261263   bounds  ?do
     
    263265      dup h# 80 and  if                 ( code )
    264266          ." *" h# 7f and               ( index )
     267          dup d#  4 =  if  true  to  720p-native?  then
    265268          dup d# 16 =  if  true  to 1080p-native?  then
    266269      then                              ( index )
    267       short-names count type space              ( )
     270      dup d# 16 =  if  true to 1080p-support?  then
     271      short-names count type space      ( )
    268272   loop
    269273   cr
     
    343347;
    344348: dump-edid  ( adr len -- )
    345    drop  to the-edid
     349   0=  if  drop exit  then   ( adr )
     350   to the-edid
    346351   the-edid  " "(00ffffffffffff00)" comp  if
    347352      ." Not an EDID" cr
     
    353358   .extensions
    354359;
    355 : .hdmi  ( -- )
     360\ Wait for an HDMI monitor to be connected
     361: wait-hdmi  ( -- )
    356362   " hdmi-present?"  $call-screen 0=  if
    357363      ." Connect an HDMI monitor ..."
     
    359365      cr
    360366   then
     367;
     368: get-hdmi-edid  ( -- adr len )
    361369   " /hdmi-ddc" open-dev  dup  if    ( ih )
    362370      " edid$" 2 pick $call-method   ( ih adr len )
    363371      rot close-dev                  ( adr len )
    364       dump-edid
     372   else
     373      " "
    365374   then
     375;
     376: choose-hdmi-resolution  ( -- )
    366377   ." Turning on monitor at "
    367    1080p-native?  if  ." 1080p" 1080p  else  ." 720p"  720p  then  cr
     378   1080p-native?   if   ." 1080p" 1080p   else   \ First choice
     379   720p-native?    if   ." 720p"   720p   else   \ Second choice
     380   1080p-support?  if   ." 1080p" 1080p   else   \ No native, use 1080p if supported
     381      ." 720p"   720p   ."  (guess)"             \ Fallback
     382   then then then
     383   cr
     384;
     385: .hdmi  ( -- )
     386   wait-hdmi
     387   get-hdmi-edid dump-edid
     388   choose-hdmi-resolution
    368389;
    369390
Note: See TracChangeset for help on using the changeset viewer.