Commits (39)
  • Steve Revill's avatar
    Added prototype EDID support code. · d893357d
    Steve Revill authored
    This should be considered beta-quality work-in-progress code that gives us a
    new *command (ReadEDID) that attempts to read the list of supported display
    mode information from a connected monitory and configure the system for it,
    as if an MDF file had been loaded containing that information.
    
    Admin:
    
    Community testing is required for this feature. Please try replacing the
    LoadModeFile line in your !Boot.Choices.Boot.PreDesk.Configure.Monitor
    file with a line saying "ReadEDID". If you get a sensible looking list
    of modes when the machine boots, then things should be OK. If you see an
    error, please get in touch with ROOL on the "Bounties - ReadEDID" topic.
    You'll clearly need to be running a ROM with this version of ScreenModes
    in it!
    
    Version 0.39. Tagged as 'ScrModes-0_39'
    d893357d
  • John Ballance's avatar
    Extended to optionally generate a saved mdf instead of updating the current loaded mdf. · f2073d25
    John Ballance authored
    Detail:
      For field support it is extremely helpful to determine what a customer's monitor
      reports. Whilst (hopefully) this module will correctly produce modes the monitor
      can handle and the computer generate, when that doesn't happen support types need
      to be able to find out why, ideally using the same exact information that is generated.
      So:
      The ReadEDID command, if called with a full file name, will now save the discovered
      mdf information to that file instead of loading it.
      The resultant mdf can be used directly, or used as the basis for further
      modifications. It exports additional information in the header section
      which may prove helpful to 'mdf tweakers'.
    Admin:
      Tested in imx rom. In 'advertised' use it is the same code as before. It is
      only when the  filename is given to the readedid command that different paths
      are invoked. Further enhancements may be desirable.
    
    Version 0.40. Tagged as 'ScrModes-0_40'
    f2073d25
  • John Ballance's avatar
    Made safer to deploy in current ROMS, and added further stuff to generated mdf · 36800dfd
    John Ballance authored
    Detail:
      Added several things
      1) Readedid routine not called in module initialise.
      2) Flag added to determine whether old loadmodefile usage, or new readedid usage.
         Defaults to loadmodefile mode until a readedid command with no parameters,
         then swirches to edid reading mode. Reverts again if loadmodefile command is used.
      3) Tidied up error message when graphicsv fails to read the edid due to connectivity
         issues.
      4) Added hex dump of edid data blocks read to end of a saved mdf file.
      5) Implemented read of second ans subsequent 128 byte edid blocks, if required.
    
    Admin:
      tested in imx rom
    
    Version 0.41. Tagged as 'ScrModes-0_41'
    36800dfd
  • John Ballance's avatar
    Corrected 'interlaced:' to 'interlaced' · f828611b
    John Ballance authored
    Detail:
    Admin:
    
    
    Version 0.42. Tagged as 'ScrModes-0_42'
    f828611b
  • Jeffrey Lee's avatar
    Numerous tweaks and fixes · d29ddabe
    Jeffrey Lee authored
    Detail:
      c/ScrModes:
      - Double-checked all the DMT timings against the spec and corrected a few mistakes in both the DMT timings list and the established timings list.
      - Tidied up DMT & established timing formatting a bit, made static data arrays const
      - Fixed preferred mode handling so that it'll forget the preferred mode if you load an MDF after reading EDID (preferred_mode->bit0 used as a cheeky flag, in preference over malloc/free). Fixes crash/bad behaviour on startup caused by returning a duff preferred mode from Service_MonitorLeadTranslation on startup.
      - Added sanity checks to avoid null pointer dereferences if preferred_mode or new_preferred_mode are null
      - Fixed preferred mode handling to work correctly with interlaced modes (fixed it to use the frame width & height instead of the field width & height)
      - Tweaked CVT extension block handling - swapped the "- 17" with "- 18" in order to take into account the presence of the checksum byte
      - Tweaked GTF calculation to round pixel_khz to nearest when calculating it. I don't think this is mentioned in the spec, but when comparing some timings against the GTF spreadsheet this fixes ScreenModes being off by 1kHz in a few cases
      - When outputing an MDF, don't output display range parameters if the block wasn't found
      - Fix MDF output of interlaced modes (frame width/height vs. field width/height), use more accurate mHz frame rate value instead of Hz one
      - Make GraphicsV_IICOp calls use the correct GraphicsV driver number; current_graphicsv_driver() function added to replace ad-hoc code in a couple of other places
      - Fix reading of extension blocks. Also tweak logic to avoid re-reading the first block.
      - Initialise 'thefilename' when calling parseedid so that ERR_NOMODES will display something vaguely sensible
    Admin:
      Tested on Raspberry Pi (ROM), Pandaboard (ROM), Iyonix (softload)
      Appears to read EDID correctly from test monitors (BenQ FP737s, BenQ FP241W, ADI TD-523N), but there are some minor discrepancies in MDF output for some modes
    
    
    Version 0.43. Tagged as 'ScrModes-0_43'
    d29ddabe
  • Jeffrey Lee's avatar
    Fix bogus vertical bounds reported in MDF comments · 97cb9b7c
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Make sure compute_modedescription is used to initialise frame_mhz (and line_hz). Fixes bogus vertical bounds in MDF comments, and will fix order of modes as defined by sorting function modes_inorder.
      Also change horizontal bounds comment to use stored line_hz value instead of computing it on the fly
    Admin:
      Tested on Pandaboard
    
    
    Version 0.44. Tagged as 'ScrModes-0_44'
    97cb9b7c
  • John Ballance's avatar
    Added 'CreateModeFile' instead of optional file name on ReadEDID now needs a... · 16d50f7d
    John Ballance authored
    Added 'CreateModeFile' instead of optional file name on ReadEDID now needs a file path for where to save the created mdf. It'll use the name in the EDID for the file name
    
    Admin:
     tested in iMx6
    
    Version 0.45. Tagged as 'ScrModes-0_45'
    16d50f7d
  • Jeffrey Lee's avatar
    Fix bad merge. Improve Get_DTD_ASCII & MDF saving. · 92a69868
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Fix a bad merge causing a compute_modedescription() call to go missing. Fix Get_DTD_ASCII to avoid reading one byte too many, and to ensure the buffer is null terminated. Also strip any control characters. Improve MDF saving to return an error if the file couldn't be created, and to substitute various unsafe characters with underscores
    Admin:
      Tested on Pandaboard
    
    
    Version 0.46. Tagged as 'ScrModes-0_46'
    92a69868
  • Jeffrey Lee's avatar
    Add support for CVT 3 byte codes & VTB-EXT blocks. Other misc fixes. · ca1955a4
    Jeffrey Lee authored
    Detail:
      c/ScrModes, h/modex - Added support for CVT 3 byte codes & VTB-EXT blocks. Add framework for sorting modes by EDID priority. Move CEA extension block handling into its own function & increase error checking.
      Resources/Germany/CmdHelp, Resources/UK/CmdHelp - Fix missing message token & incorrect syntax of syntax message
    Admin:
      Code submission from William Harden
      Tested on Raspberry Pi
    
    
    Version 0.47. Tagged as 'ScrModes-0_47'
    ca1955a4
  • Jeffrey Lee's avatar
    Fix DERIVE_CVT3_FROM_DMT · d4ee2737
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Swap 'return;' for 'return NULL;' in the (currently unused) DERIVE_CVT3_FROM_DMT code to ensure the function has a sensible return value
    Admin:
      Untested
    
    
    Version 0.47. Retagged as 'ScrModes-0_47'
    d4ee2737
  • Jeffrey Lee's avatar
    Avoid potential read of bad address in CEA block processing · 020db416
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Reorder while loop conditions to ensure the DTD offset is checked before we try reading any data; prevents potential data abort if initial offset is too large to be valid.
    Admin:
      Builds, untested
    
    
    Version 0.47. Retagged as 'ScrModes-0_47'
    020db416
  • Jeffrey Lee's avatar
    Fix decoding of DTD sync polarities. Add support for some missing established timings. · 8f3400df
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Fixed decoding of DTD polarties in dtd_block_to_modedesc. Add support for some missing established timings (generated by GTF/CVT as we don't have any known-good values to use as a reference)
    Admin:
      Tested on Pandaboard
      Submission from William Harden
    
    
    Version 0.47. Not tagged
    8f3400df
  • Jeffrey Lee's avatar
    Fix some more sync polarity issues. Don't support DTDs for stereoscopic modes. · 2accbe62
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Replace magic numbers used for sync polarities with HSync_Positive, VSync_Negative, etc. #defines. Fix GTF2 polarity to be correct. Fix CVT/CVT RB polarities to be correct (+ some incorrect code indentation). Make dtd_block_to_modedesc return true/false for success/failure so we can reject stereoscopic 3D modes.
    Admin:
      Tested on Pandaboard
    
    
    Version 0.48. Tagged as 'ScrModes-0_48'
    2accbe62
  • Jeffrey Lee's avatar
    Add support for parsing and reporting the contents of CEA 861-D audio-related EDID blocks · 9a30976a
    Jeffrey Lee authored
    Detail:
      Makefile - Export a C version of hdr/ScrModes
      Resources/Germany/Messages, Resources/UK/Messages, h/errors - Add new error message
      cmhg/ScrModesv, hdr/ScrModes - Declare existence of ScreenModes_EnumerateAudioFormats SWI. Declare ScreenModes_ReadInfo reason codes.
      h/modex - Extend MonitorDefinition struct to allow it to store the speaker mask & audio format information that's extracted from the EDID
      c/ScrModes - Extend support for processing of CEA extension blocks. All block revisions > 0 should now be accepted, and rudimentary parsing of CEA data block collections is implemented (currently, only extracts information from audio related blocks). Add SWI ScreenModes_EnumerateAudioFormats to allow details of the supported formats to be returned in either "raw" or "friendly" forms. Add ScreenModes_ReadInfo reason code 1 to allow reading of the speaker mask (+ validity bits). Also fix *LoadModeFile to allow EDID blocks to be loaded without first having to issue *ReadEDID first (EDIDEnabled flag issue).
    Admin:
      Tested on iMX6 with assorted EDID blocks
      German messages file in need of translation
    
    
    Version 0.49. Tagged as 'ScrModes-0_49'
    9a30976a
  • Jeffrey Lee's avatar
    Fix a few issues with EDID established timings · eeb8be91
    Jeffrey Lee authored
    Detail:
      c/ScrModes:
      - Added established timings for 720x400 @ 70Hz to be used in place of the auto-generated timings. For a BenQ FP737s-D, these match the expected timings listed in the manual, and they actually result in a picture displaying (auto-generated timings did not).
      - Split the guts of generate_dmt_mode out into a separate function so it can easily be used for adding the 720x400 @ 70Hz ModeDefinition
      - Fix established timing handling to only call generate_dmt_mode if the DMT defines timings for a given mode (old logic meant that only 720x400 @ 70Hz was falling through to the auto-generate case)
      - Fix established timing auto-generation to cope with the possibility of timings_byte being non-zero
    Admin:
      Tested on iMx6 on a variety of monitors
      720x400 @ 70Hz now displays correctly on a FP737s-D
      640x480 @ 67Hz now works too (albeit with a warning about being a non-preset mode, this one is listed in the EDID but not in the manual)
    
    
    Version 0.50. Tagged as 'ScrModes-0_50'
    eeb8be91
  • Jeffrey Lee's avatar
    Fix audio format merge logic · 7d5fe81e
    Jeffrey Lee authored
    Detail:
      c/ScrModes - When removing 'candidate' from the list of audio formats, it's the number of formats which we want to decrement, not the pointer to the start of the list.
    Admin:
      Tested on iMx6
      Fixes "RMA allocation failed" and other issues when dealing with monitors with complex audio capabilities
    
    
    Version 0.51. Tagged as 'ScrModes-0_51'
    7d5fe81e
  • Jeffrey Lee's avatar
    Fix *LoadModeFile not reporting errors when parsing EDID files. Fix another... · fc351291
    Jeffrey Lee authored
    Fix *LoadModeFile not reporting errors when parsing EDID files. Fix another "RMA allocation failed" bug with audio format processing.
    
    Detail:
      c/ScrModes - Fix loadedid() not returning errors from parseedid()
      c/ScrModes - Fix bad use of realloc() in add_audio_format() - if audio_format_count hits zero then it's expected for realloc to return NULL.
    Admin:
      Tested on iMx6
    
    
    Version 0.52. Tagged as 'ScrModes-0_52'
    fc351291
  • Jeffrey Lee's avatar
    Add support for parsing CEA Short Video Descriptors (SVDs). Fix loaded EDID... · 55179bbd
    Jeffrey Lee authored
    Add support for parsing CEA Short Video Descriptors (SVDs). Fix loaded EDID files being overwritten with monitor EDID during Service_DisplayChanged.
    
    Detail:
      h/CEAModes - Table of CEA mode timings from CEA 861-D
      s/ScrModes - Implement process_cea_video_data_block() in order to support SVD parsing. Ensure loadedid() sets the EDIDEnabled flag to 0, to prevent the loaded EDID (potentially) being replaced during Service_DisplayChanged.
    Admin:
      Tested on iMx6
    
    
    Version 0.53. Tagged as 'ScrModes-0_53'
    55179bbd
  • ROOL's avatar
    Split out data tables, stylistic refactoring · 8a00983b
    ROOL authored
    Detail:
      Move the 500+ lines of tables into a new source file and remove storage inferred by former CEAModes.h.
      Tame some of the rampant style from various authors, even within 1 function, to something reasonably consistent.
      Uppercase the 'debug' macro to 'IFDEBUG'.
      Relocate ScrModes specific defines out of EDIDModes header, rename to edidmemory.h.
      Add monitor type 6 to monitors.h.
      Fix for unguarded debug printout "Can't allocate space for monitor list" in parseedid.
    Admin:
      Tested briefly, functionality unchanged.
      Submission for the EDID bounty.
      Tagged as ScrModes-0_53-tables
    8a00983b
  • ROOL's avatar
    Split out MDF and EDID support · 9936b759
    ROOL authored
    Detail:
      Main source file split into 3.
    Admin:
      Tested briefly, functionality unchanged.
      Submission for the EDID bounty.
      Tagged as ScrModes-0_53-split
    9936b759
  • ROOL's avatar
    Fix bug in CVT-RB timing calculation, add GTF range check · ea866f88
    ROOL authored
    Detail:
      Rounding the pixel clock to 0.25MHz was not correctly performed due to clock step division being outside the floor() function, so all times came out in steps of 1MHz.
      In GTF timing with interlacing v_lines_rqd specifies ROUND(v_lines/2,0) rather than ROUNDDOWN(v_lines/2,0).
      Abandon GTF calculations early if they result in a -ve duty cycle.
      Update margins to 1.8% from standard.
    Admin:
      Mode with non-multiple-of-1MHz clock tested, now matches VESA CVT spreadsheet.
      GTF change not tested since int_rqd = 0 the code wasn't called.
      Margin% change not tested since margins_rqd = 0 the code wasn't called.
      Submission for the EDID bounty.
    
    Version 0.54. Tagged as 'ScrModes-0_54'
    ea866f88
  • ROOL's avatar
    Non code changes · b2421153
    ROOL authored
    Admin:
      Line up braces missed in earlier tidying.
      Not tagged.
    b2421153
  • ROOL's avatar
    Switch to integer implementation · 862ea508
    ROOL authored
    Detail:
      The dynamic range of the values being computed easily fit within integer types, so use these instead of doubles. This makes ScrModes independent of its position in intialisation with respect to FPEmulator once more, and saves 1k of code space too.
      Functions generate_mode_using_gtf(), generate_mode_using_cvt_rb(), generate_cvt3_timing() affected.
    Admin:
      Test added to brute force compare float and fixed point results.
      Submission for the EDID bounty.
    
    Version 0.55. Tagged as 'ScrModes-0_55'
    862ea508
  • ROOL's avatar
    Fixes to CVT3 calcs · 041d7311
    ROOL authored
    Detail:
      Missing break statements (around line 790) would always have selected 50Hz frame rate regardless.
      Removed duplicate call to add_proposed_mode() which generate_mode_using_cvt_rb() already does, resulting in duplicated modes.
    Admin:
      CVT3 still untested, but less broken than before.
      Submission for the EDID bounty.
      Tagged as ScrModes-0_55-cvt3fix.
    041d7311
  • ROOL's avatar
    Make alloc ownership and mode submission consistent · 11cf5235
    ROOL authored
    Detail:
      In various places the free() on error was the responsibility of the called function, and sometimes the calling function. Rationalise this by returning true/false so the free() is always done at the same level as malloc().
      Likewise, add_proposed_mode() is now done at the level that generates the mode.
      Tidy up debug so that only successfully generated and added modes get debug printed with display_mode_parameters(), not discarded ones.
    Admin:
      Submission for the EDID bounty.
      Tagged as ScrModes-0_55-mallocfree.
    11cf5235
  • ROOL's avatar
    Take advantage of tail of generate functions being common · faff5d05
    ROOL authored
    Detail:
      Now all generation steps end in compute_modedescription()/add_proposed_mode()/display_mode_parameters(), combine these steps into the add_proposed_mode() function.
      Fix for CVT and GTF generation steps never setting the 'priority' member of the descriptor. These are now set to 6 per Table 5.1 of EDID spec 1.4.
    Admin:
      Submission for the EDID bounty.
    
    Version 0.56. Tagged as 'ScrModes-0_56'
    faff5d05
  • ROOL's avatar
    Omit mode name from lookup tables · d0b58c2a
    ROOL authored
    Detail:
      Save 4k of ROM space by not storing the mode name string; always generate it at run time.
      Split the ModeDefinition struct into the timings part (ModeDef) and full definition (ModeDefinition).
    Admin:
      Submission for the EDID bounty.
      Tagged as ScrModes-0_56-smalltables.
    d0b58c2a
  • ROOL's avatar
    Do fill in DPMS support · e1d639d1
    ROOL authored
    Detail:
      Don't ignore the monitor's power saving features for EDID; fill in the DPMS value properly.
    Admin:
      Submission for the EDID bounty.
    
    Version 0.57. Tagged as 'ScrModes-0_57'
    e1d639d1
  • Jeffrey Lee's avatar
    Resolve allocation clash with RISCOS Ltd · 41b0cd05
    Jeffrey Lee authored
    Detail:
      Some cross-checking against the RISC OS Select documentation revealed that ScreenModes_ReadInfo 1 had already been claimed by ROL for the purpose of reading the monitor's supported DMPS state, causing a clash with our recently-introduced usage of reading the monitor speaker mask.
      Implement ScreenModes_ReadInfo 1 as per ROL's spec, and change the "read speaker mask" call to ScreenModes_ReadInfo 2.
      File changes:
      - c/ScrModes, hdr/ScrModes - as above
    Admin:
      Tested on Raspberry Pi
    
    
    Version 0.58. Tagged as 'ScrModes-0_58'
    41b0cd05
  • Jeffrey Lee's avatar
    Fix typo in DMT modes table · c5af75ad
    Jeffrey Lee authored
    Detail:
      c/tables - 540 != 640
    Admin:
      Tested on Raspberry Pi
    
    
    Version 0.59. Tagged as 'ScrModes-0_59'
    c5af75ad
  • ROOL's avatar
    Check for array bounds · 95d1dca9
    ROOL authored
    Detail:
      Define MAXDMTMODENUM to guard against requesting DMT timing not in our table. Assert that the table size matches the define.
      Lowercased some 'X' (edidsupport.c), change to _swix (mdfsupport.c).
    Admin:
      Submission for the EDID bounty.
    
    Version 0.60. Tagged as 'ScrModes-0_60'
    95d1dca9
  • ROOL's avatar
    Offer export of raw EDID blob and complementary MDF export · 961adc98
    ROOL authored
    Detail:
      Export the EDID raw data as a file in ResourceFS. This allows the Screen Setup plugin to scan that directory to pick up the currently connected monitor, and similarly select it from !Boot.Choices.PreDesk. The EDID data can also be drag & drop copied or exported for offline analysis.
      Add SaveModeFile command. This differs in that it works on the current set, to be symmetrical with LoadModeFile which loads the current set. Also fixes issues of losing the original mode names given; NULL pointer dereference when the EDID block contains no modes (eg. VIDCDriver); and no long writes out malformed MDFs which can't be loaded into !MakeModes (this seems to be because the CreateModeFile command was based on a stale copy of EDIDDecode which fixed the same bug circa 2012).
      Query the current GraphicsV driver for the deepest colour depth for the preferred mode, rather than assuming 32bpp is always possible (eg. because of bandwidth or graphics controller constraints).
      If the configured MonitorType is EDID but no EDID could be read, or it was corrupt, substitute a safe VESA monitor to allow the kernel to select something close to MODE 28.
      Add ScreenModes_Features SWI so the Screen Setup plugin knows whether it's safe to offer EDID in its dialogues.
      Retire the ReadEDID command (no longer needed since LoadModeFile can load the exported EDID blob, or one from disc) and CreateModeFile commands (see SaveModeFile).
      Internationalise the default monitor title ("Unidentified") used when EDID doesn't contain one.
    Admin:
      New file - doc/BootStates documents all possible situations, and their recovery, for both the MDF and (non-hotplug) EDID schemes.
      New file - doc/EDIDGoals states the aims of the EDID support from both a user and support perspective.
    
      Submission for the EDID bounty.
    
    Version 0.61. Tagged as 'ScrModes-0_61'
    961adc98
  • John Ballance's avatar
    Reinstall *readedid command as it IS needed in some circumstances · 98ccc086
    John Ballance authored
    Detail:
    Admin:
      tested on iMx6
    
    Version 0.62. Tagged as 'ScrModes-0_62'
    98ccc086
  • John Ballance's avatar
    Reinstall *readedid command as it IS needed in some circumstances · d2e86f90
    John Ballance authored
    Detail:
    Admin:
      tested on iMx6
    
    Version 0.62. Tagged as 'ScrModes-0_62'  
    d2e86f90
  • John Ballance's avatar
    Remove ReadEDID command. Extend Service_DisplayChanged response · f825c04b
    John Ballance authored
    Detail:
    ReadEDID command removed. New subreason code added to reason code 0
    of Service_DisplayChanged to oblige ScrModes to load the EDID based
    modes it discovered. Required because current behaviour would ignore
    any EDID based modes once a LoadModeFile command had been issued.
    Admin:
    Tested on iMx6
    
    Version 0.64. Tagged as 'ScrModes-0_64'
    f825c04b
  • Jeffrey Lee's avatar
    Add support for new GraphicsV_VetMode2 call · 94ffeea7
    Jeffrey Lee authored
    Detail:
      VetMode2 allows the driver to give the OS extra feedback about a proposed mode. In particular, it allows the driver to suggest a value for the ExtraBytes control list item, so by using the VetMode2 call ScreenModes is able to support modes where the video driver requires extra padding to be added to the framebuffer.
      h/modex - Remove local definitions of control list item numbers. Reserve space for one extra control list item in the VIDCList structure.
      c/ScrModes - Use Global/VIDCList.h for control list item numbers. Update mode_valid to make use of VetMode2 where available, and give it the ability to copy the resulting VIDCList into a caller-supplied buffer, allowing service_modeextension to easily use the correct ExtraBytes setting.
    Admin:
      Tested on Raspberry Pi 3
      Requires Kernel-5_82
    
    
    Version 0.65. Tagged as 'ScrModes-0_65'
    94ffeea7
  • Jeffrey Lee's avatar
    Fix EDID use at startup · f695ced1
    Jeffrey Lee authored
    Detail:
      c/ScrModes - Re-introduce the using_edid check in the Service_DsiplayChanged handler, that was removed in ScreenModes 0.64.
      Removing the check completely breaks automatic EDID use (via MonitorType EDID), causing the kernel to panic and treat everything as mode 0 (due to no mode definitions being available).
    Admin:
      Tested on Raspberry Pi 3
      Should fix issue reported on forums (bad screen mode during boot after upgrading from RC15):
      https://www.riscosopen.org/forum/forums/4/topics/9342
    
    
    Version 0.66. Tagged as 'ScrModes-0_66'
    f695ced1
  • Jeffrey Lee's avatar
    Make EDID handling more robust · c3128e9b
    Jeffrey Lee authored
    Detail:
      c/edidsupport:
      - Make readedid() check that the EDID has a valid header. Previously only the checksum was checked, which is wholly insufficient (e.g. an EDID block full of null bytes would be considered valid). loadedid() also updated for consistency, although with the current code the header will have already been detected by loadmodefile().
      - Add some extra checks to readedidblock() to cope with more situations in which the GraphicsV call could fail. Fix confusing comment/code ordering.
      h/errors, Resources/Germany/Messages, Resources/UK/Messages - Add new "Invalid EDID block" error, for use when no valid header is found
    Admin:
      Tested on Raspberry Pi 3
      Booting an EDID-enabled Pi without a monitor (and with the broken BCMVideo 0.47) no longer results in an (unintelligible) error box on entry to the desktop + system stuck in mode 0
      However, note that other issues in the boot sequence mean that booting with EDID enabled and no monitor still isn't 100% working (PreDesk Repeat will terminate early, potentially skipping some directories)
    
    
    Version 0.67. Tagged as 'ScrModes-0_67'
    c3128e9b
  • Robert Sprowson's avatar
    Service call API clean up · 60419cc7
    Robert Sprowson authored
    There's no need to graft in a special sub-sub-reason for Service_DisplayChanged, since ScrModes always reads the EDID at power up the data blob is already there. To force it to be used (in situations where the user had selected a disc based textual MDF) simply load it with *LoadModeFile.
    
    Version 0.68. Tagged as 'ScrModes-0_68'
    60419cc7
......@@ -16,10 +16,11 @@
#
COMPONENT = ScrModes
OBJS = ScrModes
OBJS = ScrModes tables mdfsupport edidsupport
CMHGFILE = ScrModesv
HDRS =
ASMHDRS = ScrModes
ASMCHDRS = ScrModes
CDFLAGS = -DDODEBUG=1
CMHGDEPENDS = ScrModes
RESFSDIR = ${RESDIR}.ScreenMode
......
......@@ -24,3 +24,9 @@ E20:Es wurde keine Bildschirm-Beschreibungsdatei geladen.
E22:Es wurde ein unbekannter ScreenModes_ReadInfo-Aufruf gemacht.
E23:Es wird eine Zahl erwartet.
E24:Es wurde ein zu großer Parameterwert angegeben.
E25:EDID checksum is incorrect (block %0 of %1 failed) - cannot read monitor settings
E26:Unable to read EDID - does this hardware support it?
E27:EDID channel communications error.
E28:Bad ScreenModes_EnumerateAudioFormats flags
E29:Invalid EDID block
NoName:Unidentified
No preview for this file type
......@@ -24,3 +24,9 @@ E20:No monitor description file loaded
E22:Unknown ScreenModes_ReadInfo call
E23:Number expected
E24:Overlarge value for parameter
E25:EDID checksum is incorrect (block %0 of %1 failed) - cannot read monitor settings
E26:Unable to read EDID - does this hardware support it?
E27:EDID channel communications error
E28:Bad ScreenModes_EnumerateAudioFormats flags
E29:Invalid EDID block
NoName:Unidentified
/* (0.38)
/* (0.68)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.38
#define Module_MajorVersion_CMHG 0.68
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 09 Mar 2014
#define Module_Date_CMHG 31 Mar 2018
#define Module_MajorVersion "0.38"
#define Module_Version 38
#define Module_MajorVersion "0.68"
#define Module_Version 68
#define Module_MinorVersion ""
#define Module_Date "09 Mar 2014"
#define Module_Date "31 Mar 2018"
#define Module_ApplicationDate "09-Mar-14"
#define Module_ApplicationDate "31-Mar-18"
#define Module_ComponentName "ScrModes"
#define Module_ComponentPath "castle/RiscOS/Sources/Video/UserI/ScrModes"
#define Module_FullVersion "0.38"
#define Module_HelpVersion "0.38 (09 Mar 2014)"
#define Module_LibraryVersionInfo "0:38"
#define Module_FullVersion "0.68"
#define Module_HelpVersion "0.68 (31 Mar 2018)"
#define Module_LibraryVersionInfo "0:68"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -25,6 +25,8 @@ date-string: Module_Date_CMHG
title-string: ScreenModes
initialisation-code: ScreenModes_initialise
finalisation-code: ScreenModes_final
; service calls - the only ones we answer to are Service_EnumerateScreenModes,
......@@ -32,17 +34,21 @@ finalisation-code: ScreenModes_final
service-call-handler: ScreenModes_servicecall Service_EnumerateScreenModes,
Service_ModeExtension,
Service_ModeTranslation,
Service_DisplayChanged
Service_DisplayChanged,
Service_MonitorLeadTranslation
international-help-file: "Resources:$.Resources.ScreenMode.Messages"
command-keyword-table: ScreenModes_cmdhandler
LoadModeFile(min-args:1, max-args: 1, international:,
invalid-syntax: "SSMDLMF",
help-text: "HSMDLMF")
help-text: "HSMDLMF"),
SaveModeFile(min-args:1, max-args: 1, international:,
invalid-syntax: "SSMDSMF",
help-text: "HSMDSMF")
swi-chunk-base-number: 0x487C0
swi-handler-code: ScreenModes_swihandler
swi-decoding-table: ScreenModes ReadInfo
swi-decoding-table: ScreenModes ReadInfo EnumerateAudioFormats Features
1.MDF based scheme
~~~~~~~~~~~~~~~~~~
OS: Doesn't support EDID, configured with MonitorType Auto
Monitor is? Plugged in? Outcome? Recovery story?
---------- ---------- ------- --------------
Same model Yes Good image (most common situation) -
as earlier No No image -
No but later Good image (LoadModeFile loaded the MDF regardless) -
reconnected
Different model Yes Only a good image if earlier MDF works on new monitor Blind type *WimpMode, then run !Configure to choose new model
than before No No image -
No but later Only a good image if earlier MDF works on new monitor Blind type *WimpMode, then run !Configure to choose new model
reconnected
2.EDID based scheme
~~~~~~~~~~~~~~~~~~~
OS: Does support EDID, has !Boot on read/write medium, EDID monitor was selected in !ScrnSetup
Monitor is? Plugged in? Outcome? Recovery story?
---------- ---------- ------- --------------
Same model Yes Early boot uses CMOS MonitorType until monitor choices -
as earlier obey file reached => good image (most common situation)
No No image -
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
Different model Yes Early boot uses CMOS MonitorType until monitor choices -
than before obey file reached => good image (read from new monitor)
No No image -
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
3.EDID based scheme softloaded on top of MDF only ROM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OS: Initial boot from old OS, as early as OS 3.50, softload does support EDID and was selected in !ScrnSetup
Monitor is? Plugged in? Outcome? Recovery story?
---------- ---------- ------- --------------
Same model Yes Early boot uses Auto until softload starts then good -
as earlier image (most common situation); if softload is not
selected, loads MDF and behaves per scenario 1
No No image
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
Different model Yes Early boot uses Auto until softload starts then good -
than before image (read from new monitor)
No No image -
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
4.EDID based scheme discless boot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OS: Does support EDID, no disc, or failed !Boot, configured MonitorType is EDID
Monitor is? Plugged in? Outcome? Recovery story?
---------- ---------- ------- --------------
Same model Yes Preferred mode chosen (most common situation) -
as earlier No No image -
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
Different model Yes Preferred mode chosen (read from new monitor) -
than before No No image -
No but later Only a good image if OS's default mode (SVGA?) supported Blind type *LoadModeFile
reconnected or reboot
Notes
~~~~~
Monitors are required to return EDID data if connected in, even if not turned on - the EDID memory is powered by
the motherboard. Therefore, the above tables only consider the connected/not connected possibilities since the
monitor being off or on isn't important.
Tables assume hotplug is not supported by the hardware, let alone the software, and that EDID data from the
monitor is truthful. Hotplug support in a later version will remove all requirements to recover a bad mode choice
by blind typing when the monitor is plugged in after booting, presently a reboot is required.
Statement of aims
~~~~~~~~~~~~~~~~~
* Resiliance against corrupt or inaccurate EDID data from the monitor
=> some default display, and ability to override EDID data with 'known good' library copy
in a similar manner to Windows overriding the EDID from an INF file as described here
https://msdn.microsoft.com/en-us/library/windows/hardware/jj133967(v=vs.85).aspx
=> allow loading of disc based EDID on platforms that don't support it (eg. Risc PC)
* Simple user interface
=> user unlikely to care where the monitor settings came from, but they must work at least
as well as the previous MDF system
=> checkbox or menu entry in !Configure plugin
* Fallback to MonitorType=Auto behaviour if EDID unavailable
=> avoids problem when softload sets up to use EDID but underlying ROM OS doesn't support it
=> R-power-on/Delete-power-on/Keypad-dot-power-on revert to Auto as currently
* Advanced diagnostics for support staff
=> "many to 1" problem, so most of the complexity should reside on the support staff's desk,
the remote system where the problem lies can be relatively simple
=> PC tools used to offline analyse EDID dumps (or, enhanced !MakeModes application)
=> means to capture EDID dump (utility, star command, BASIC, or similar)
* Discless boot
=> ability to select EDID without a boot sequence having run
=> ensure that the initial mode (prior to !Boot running) is feasible by vetting modes with the
graphics driver
=> fallback to kernel's numbered modes if EDID is corrupt or inaccurate
* Hotplug and multi head
=> not currently supported, but design should not preclude their introduction in future, for
example by setting the CMHG keyword matcher to let through some extra args but ignore
them today
This diff is collapsed.
/* Copyright 2016 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* edidmemory.h */
typedef struct _EDIDBlock
{
/* 8 bytes of header */
uint8_t header[8];
/* 10 bytes of vendor id */
uint8_t manufacturer_id[2];
uint8_t product_id[2];
uint8_t serial[4];
uint8_t week_made;
uint8_t year_made;
/* 2 bytes of EDID Structure and version */
uint8_t edid_version;
uint8_t edid_revision;
/* 5 bytes of Basic parameters */
uint8_t video_input_definition;
uint8_t horizontal_screen_size; /* Listed in cm. Aspect ratio - landscape */
uint8_t vertical_screen_size; /* Listed in cm. Aspect ratio - portrait */
uint8_t gamma;
uint8_t feature_support;
#define FEATURE_SUPPORT_CONTINUOUS_FREQUENCY (1 << 0)
#define FEATURE_SUPPORT_PTM_INC_PIXELFMT_AND_REFRESH (1 << 1)
#define FEATURE_SUPPORT_SRGB_COLOUR_SPACE (1 << 2)
#define FEATURE_SUPPORT_COLOUR_ENC_MASK (3 << 3)
#define FEATURE_SUPPORT_COLOUR_ENC_RGB444 (0 << 3)
#define FEATURE_SUPPORT_COLOUR_ENC_RGB444_YUV444 (1 << 3)
#define FEATURE_SUPPORT_COLOUR_ENC_RGB444_YUV422 (2 << 3)
#define FEATURE_SUPPORT_COLOUR_ENC_RGB444_YUV444_YUV422 (3 << 3)
#define FEATURE_SUPPORT_COLOUR_TYPE_MASK (3 << 3)
#define FEATURE_SUPPORT_COLOUR_TYPE_MONO (0 << 3)
#define FEATURE_SUPPORT_COLOUR_TYPE_RGB (1 << 3)
#define FEATURE_SUPPORT_COLOUR_TYPE_NON_RGB (2 << 3)
#define FEATURE_SUPPORT_COLOUR_TYPE_UNDEFINED (3 << 3)
#define FEATURE_SUPPORT_DPM_MASK (7 << 5)
#define FEATURE_SUPPORT_DPM_ACTIVE_OFF_SUPPORTED (1 << 5)
#define FEATURE_SUPPORT_DPM_SUSPEND_SUPPORTED (1 << 6)
#define FEATURE_SUPPORT_DPM_STANDBY_SUPPORTED (1 << 7)
/* 10 bytes of colour characteristics */
uint8_t colour_characteristics[10];
/* 3 bytes of established timings */
uint8_t established_timings[3];
/* 16 bytes of standard timings identification 1-8 */
uint8_t standard_timings[16];
/* 72 bytes of 18 byte data blocks; */
uint8_t data_block[4][18];
/* Extension blocks */
uint8_t extension_block_count;
uint8_t checksum;
} EDIDBlock, *EDIDBlockRef;
enum
{
/* 00-0F manufacturer */
DATA_TYPE_MANUFACTURER0 = 0,
DATA_TYPE_MANUFACTURER1,
DATA_TYPE_MANUFACTURER2,
DATA_TYPE_MANUFACTURER3,
DATA_TYPE_MANUFACTURER4,
DATA_TYPE_MANUFACTURER5,
DATA_TYPE_MANUFACTURER6,
DATA_TYPE_MANUFACTURER7,
DATA_TYPE_MANUFACTURER8,
DATA_TYPE_MANUFACTURER9,
DATA_TYPE_MANUFACTURERA,
DATA_TYPE_MANUFACTURERB,
DATA_TYPE_MANUFACTURERC,
DATA_TYPE_MANUFACTURERD,
DATA_TYPE_MANUFACTURERE,
DATA_TYPE_MANUFACTURERF,
/* 10 dummy tag for unused block */
DATA_TYPE_DUMMY,
/* 11-F6 reserved for future use */
/* F7-FF various info */
DATA_TYPE_ESTTIMINGS3 = 0xF7,
DATA_TYPE_CVT3BYTE,
DATA_TYPE_DCM,
DATA_TYPE_STDTIMING,
DATA_TYPE_COLOURPOINT,
DATA_TYPE_MONITORNAME,
DATA_TYPE_RANGELIMITS,
DATA_TYPE_STRING,
DATA_TYPE_MONITORSERIALNUM
};
typedef struct _EDIDExtensionBlock
{
uint8_t tag;
uint8_t revision;
uint8_t data[125];
uint8_t checksum;
} EDIDExtensionBlock, *EDIDExtensionBlockRef;
/* EOF edidmemory.h */
/* Copyright 2016 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* edidsupport.h */
void release_edidblocks(void);
_kernel_oserror *loadedid(const char *file);
_kernel_oserror *readedid(int, bool);
/* EOF edidsupport.h */
......@@ -46,6 +46,11 @@
#define ERR_BADREADINFO 22 /* Unknown ScreenModes_ReadInfo call */
#define ERR_EXPNUM2 23 /* Number expected */
#define ERR_VALUEOVF2 24 /* Overlarge value for parameter */
#define ERR_BADCHECKSUM 25 /* EDID Checksum failed */
#define ERR_CANTREADEDID 26 /* Cannot read EDID */
#define ERR_IICOPFAIL 27 /* IICStatus reported an error reading EDID */
#define ERR_BADENUMAUDIO 28 /* Bad ScreenModes_EnumerateAudioFormats flags */
#define ERR_INVALIDEDID 29 /* Invalid EDID block */
/* EOF errors.h */
/* Copyright 2016 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* mdfsupport.h */
_kernel_oserror *loadtextMDF(const char *file, FILE *);
/* EOF mdfsupport.h */
......@@ -18,6 +18,48 @@
* Internal definitions used by ScreenModes module.
*/
#ifndef DODEBUG
#define DODEBUG 0
#endif
#if DODEBUG
#define IFDEBUG if (!1) {} else
#else
#define IFDEBUG if (1) {} else
#endif
/* When defined, we can derive monitor definitions from the
* DMT set using the 3-byte lookup table.
*/
#define DERIVE_CVT3_FROM_DMT
/* When defined, set the value to force a particular timing
* calculation type from the available set.
*/
#undef FORCE_TIMINGS /* eg. EDID_USE_CVTRB */
/* When defined, force calculated values (ie. don't prefer DMT) */
#undef FORCE_CALCULATED_VALUES
/* HSync & VSync polarities for use by display_monitor_timings */
#define HSync_Positive 0
#define HSync_Negative SyncPol_InvertHSync
#define VSync_Positive 0
#define VSync_Negative SyncPol_InvertVSync
#define PP HSync_Positive+VSync_Positive
#define PN HSync_Positive+VSync_Negative
#define NP HSync_Negative+VSync_Positive
#define NN HSync_Negative+VSync_Negative
/* Defines which is the most advanced timing calculation available
* We use DMT if defined for that mode and calculate using the timing
* If not. If USE_DMT is highest it is DMT or nothing.
*/
#define EDID_USE_DMT (0) /* Display monitor timings */
#define EDID_USE_GTF (1) /* Generalised timing formula */
#define EDID_USE_GTF2 (2)
#define EDID_USE_CVT (3) /* Coordinated video timings from VESA */
#define EDID_USE_CVTRB (4) /* CVT with reduced blanking */
/*
* The 6 field framing parameters for each direction, horizontal and
......@@ -37,29 +79,17 @@
*/
/**Added by WT 13-1-95 for Stork **/
#define LCDMODE_INDEX 01
#define LCDMODE_VALUE 1 /*Enable*/
#define LCDDUAL_INDEX 02
#define LCDDUAL_VALUE 1 /*Enable*/
#define LCDOFF0_INDEX 03
#define LCDOFF0_VALUE 6 /*Defining a 640x480 dual-panel LCD as used in Stork*/
#define LCDOFF1_INDEX 04
#define LCDOFF1_VALUE 129 /*Defining a 640x480 dual-panel LCD as used in Stork*/
#define DACCTRL_INDEX 06
#define DACCTRL_VALUE 1 /*Enable - testing only*/
/**End of additions**/
#define HCLK_INDEX 9
#define DPMS_INDEX 11
#define INTERLACED_INDEX 12
#define OPFORMAT_INDEX 13
#define NCOLOUR_INDEX 15
#define MODEFLAGS_INDEX 16
/* Pixel format representation used by GraphicsV */
typedef struct
{
int32_t ncolour; /* NColour mode variable */
int32_t ncolour; /* NColour mode variable */
uint32_t modeflags; /* relevant ModeFlags */
uint32_t log2bpp; /* Log2BPP mode variable */
} PixelFormat, *PixelFormatRef;
......@@ -90,7 +120,7 @@ typedef struct
uint32_t vpar[FR__COUNT]; /* vertical parameters */
uint32_t pixelrate; /* pixel rate measured in kHz */
uint32_t syncpol; /* sync polarity code, 0..3 */
ModeParam vcparam[12]; /* Holds VCparameters: LCD mode, LCD dual-panel, LCD offsets(2), DAC control, -1
ModeParam vcparam[13]; /* Holds VCparameters: LCD mode, LCD dual-panel, LCD offsets(2), DAC control, ExtraBytes, -1
* with optional NColour, ModeFlags, DPMS, HCLK Interlaced and/or output_format fields
*/
} VIDCList, *VIDCListRef;
......@@ -121,8 +151,11 @@ typedef struct
#define IS_MODE_NUMBER(p) ((uint32_t)(p) < 256)
#define IS_MODE_SEL_PTR(p) (!IS_MODE_NUMBER(p))
#define ALIGN(a) (((a) + 3) & ~3)
#define UNUSED(k) ((k)=(k))
#define MODESEL(p) ((ModeSelectorRef)(p))
#define MAX(a,b) (((a)<(b))?(b):(a))
#define MIN(a,b) (((a)>(b))?(b):(a))
/*
* Monitor & modes description as loaded from ModeInfo file: note,
......@@ -133,20 +166,24 @@ typedef struct
typedef struct
{
char name[MAXMODENAME+1];
uint32_t xres; /* User quoted xres (may differ from hpar[FR_DISP], especially in interlaced modes) */
uint32_t yres; /* User quoted yres (may differ from vpar[FR_DISP], ... */
uint16_t hpar[FR__COUNT]; /* H. framing in vidc pixel times */
uint16_t vpar[FR__COUNT]; /* V. framing in vidc raster times */
uint32_t pixel_khz; /* vidc pixel rate in kHz */
uint16_t hpar[FR__COUNT]; /* H. framing in pixel times */
uint16_t vpar[FR__COUNT]; /* V. framing in raster times */
uint32_t pixel_khz; /* pixel rate in kHz */
uint32_t external_clock; /* rate of external clock in kHz (use it instead of VCO), or -1 */
uint8_t syncpol; /* sync polarity code (0..3 for now) */
uint8_t interlaced; /* whether mode is interlaced using two seperate framebuffers (0 or 1) */
uint8_t spare1, spare2; /* explicit padding so struct is N*4 bytes long */
uint8_t freq, spare2; /* explicit padding so struct is N*4 bytes long */
} ModeDef; /* Abbreviated form, without the name */
typedef struct
{
char name[MAXMODENAME+1];
ModeDef timings;
} ModeDefinition;
/* As stored internally by ScreenModes module */
typedef struct mode_description_
{
struct mode_description_ *next; /* in list built during file parsing */
......@@ -155,8 +192,27 @@ typedef struct mode_description_
uint32_t line_hz; /* line rate in Hz (for diagnostics only) */
uint32_t frame_hz:8; /* frame rate in Hz, for user frame rate selection */
uint32_t frame_mhz:24; /* also in mHz (millihertz), for more precise cmp */
uint8_t priority; /* Bits 0-2 = 'Parameter type' from? (EDID 1.4 Section 5) */
/* 0 = Undefined (MDF or something which overrides all else) */
/* 1 = Preferred Timing Mode from base EDID */
/* 2 = Detailed Timing Mode in the base EDID */
/* 3 = Any detailed timing modes in extension blocks */
/* 4 = Any optional 3-byte CVT codes in the base EDID or extension block */
/* 5 = Standard Timings listed in base EDID or extension blocks */
/* 6 = Additional timing mode information: Established Timings I, II, III, */
/* default GTF, GTF secondary curve and CVT */
/* 7 = Base VIDEO MODE (defined as 640 x 480 x 60Hz). */
} ModeDescription, *ModeDescriptionRef;
/* Audio format information extracted from EDID */
typedef struct
{
uint8_t format_code; /* As per CEA 861-D */
uint8_t max_channels;
uint8_t sample_rates; /* Byte #2 of short audio descriptor */
uint8_t format_specific; /* Byte #3 of short audio descriptor */
} AudioFormat;
/* Description of a monitor & its associated modes */
typedef struct
{
......@@ -166,7 +222,44 @@ typedef struct
uint32_t lcd_support; /* 0=>modefile is CRT, 1=>LCD single-panel, 2=>LCD dual panel [WT13-01-95] */
uint32_t external_clock; /* rate of external clock in kHz (use it instead of VCO) */
uint32_t output_format; /* 0=analogue, 1=digital */
AudioFormat *audio_formats; /* (Optional) list of supported audio formats */
int audio_format_count; /* Length of list */
uint8_t speaker_mask; /* (Optional) speaker mask (as per CEA 861-D) */
bool speaker_mask_provided;
} MonitorDescription, *MonitorDescriptionRef;
/* Maps a 2-byte 'STD code' to a DMT (STD codes defined in EDID spec) */
typedef struct
{
char stdcode[2]; /* TODO: comment required here */
char dmt; /* TODO: comment required here */
} STDTiming;
/* Maps a 3-byte 'CVT code' to a DMT (CVT codes defined in EDID spec) */
typedef struct
{
char cvtcode[3]; /* TODO: comment required here */
char dmt; /* TODO: comment required here */
} CVTTiming;
/* Extern variables and functions */
extern ModeSelectorRef preferred_mode;
extern MonitorDescriptionRef current_monitor;
extern int old_monitortype;
extern int preferred_sync_type;
_kernel_oserror *error(int, const char *, const char *, const char *);
_kernel_oserror *messages_lookup(char *, size_t, const char *, const char *, const char *, const char *);
_kernel_oserror *new_monitordescription(MonitorDescriptionRef *);
void release_currentmonitor(void);
void free_monitordescription(MonitorDescriptionRef);
void compute_modedescription(ModeDescriptionRef);
void sort_modelist(ModeDescriptionRef *);
bool is_old_format(const PixelFormatRef);
bool find_deepest_by_xyhz(PixelFormatRef, ModeDescriptionRef);
_kernel_oserror *set_monitortype(int);
int read_monitortype(void);
_kernel_oserror *restore_monitortype(void);
/* EOF modex.h */
......@@ -16,15 +16,18 @@
/*
* Definitions of standard RISC OS monitor types
*/
#define MONITOR_PALFORMAT 0 /* standard TV-format monitor */
#define MONITOR_MULTISCAN 1 /* multiple-scan-rate monitor */
#define MONITOR_HIRESMONO 2 /* 1152x896 64Hz monochrome */
#define MONITOR_VGA 3 /* standard VGA (640x480) */
#define MONITOR_SVGA 4 /* super VGA (800x600) */
#define MONITOR_LCD 5 /* liquid crystal display on portables */
/* type 6 undefined */
#define MONITOR_FILE 7 /* defined by ScreenModes module, from file */
/* types 8-30 undefined */
#define MONITOR_AUTO 31
#define MONITOR_PALFORMAT 0 /* standard 50Hz TV-format monitor */
#define MONITOR_MULTISCAN 1 /* multiple-scan-rate monitor */
#define MONITOR_HIRESMONO 2 /* 1152x896 64Hz monochrome */
#define MONITOR_VGA 3 /* standard VGA (640x480) */
#define MONITOR_SVGA 4 /* super VGA (800x600) */
#define MONITOR_LCD 5 /* liquid crystal display on portables */
#define MONITOR_3RDPARTY 6 /* reserved for 3rd party use */
#define MONITOR_FILE 7 /* defined by ScreenModes module, from file */
#define MONITOR_NTSCFORMAT 8 /* standard 60Hz TV-format monitor */
/* types 9-15 undefined */
#define MONITOR_EDID 16 /* determined from EDID read by DDC */
/* types 17-30 reserved for future use */
#define MONITOR_AUTO 31 /* determined from VGA pins ID0-3 */
/* EOF monitors.h */