Commit eeb8be91 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix a few issues with EDID established timings

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'
parent 9a30976a
/* (0.49)
/* (0.50)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.49
#define Module_MajorVersion_CMHG 0.50
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Nov 2015
#define Module_Date_CMHG 15 Dec 2015
#define Module_MajorVersion "0.49"
#define Module_Version 49
#define Module_MajorVersion "0.50"
#define Module_Version 50
#define Module_MinorVersion ""
#define Module_Date "29 Nov 2015"
#define Module_Date "15 Dec 2015"
#define Module_ApplicationDate "29-Nov-15"
#define Module_ApplicationDate "15-Dec-15"
#define Module_ComponentName "ScrModes"
#define Module_ComponentPath "castle/RiscOS/Sources/Video/UserI/ScrModes"
#define Module_FullVersion "0.49"
#define Module_HelpVersion "0.49 (29 Nov 2015)"
#define Module_LibraryVersionInfo "0:49"
#define Module_FullVersion "0.50"
#define Module_HelpVersion "0.50 (15 Dec 2015)"
#define Module_LibraryVersionInfo "0:50"
......@@ -456,6 +456,23 @@ static const char established_timings3[] = {
/* N.B. 7th byte not checked */
};
/*
* Established timings for 720x400 @ 70Hz
* Derived from:
*
* http://www.javiervalcarce.eu/html/vga-signal-format-timming-specs-en.html
* http://www.epanorama.net/documents/pc/vga_timing.html
*
*/
static const ModeDefinition established_timing_7 =
{
/* 720 x 400 @ 70Hz */
"720 x 400", 720, 400, 108, 54, 0, 720, 0, 18,
2, 34, 0, 400, 0, 13,
28322, -1, NP, 0, 70, 0
};
/* List of standard timings - ie modes who have a defined 2-byte code in the DMT document.
*
* NB The third parameter is DMT NUMBER, not ARRAY NUMBER. This is usually
......@@ -1636,6 +1653,32 @@ static int add_proposed_mode(MonitorDescriptionRef monitor_definition, ModeDescr
}
/* Copy a builtin mode and add it to the monitor description
*/
static _kernel_oserror *add_builtin_mode(MonitorDescriptionRef monitor, const ModeDefinition *mode, uint8_t priority)
{
ModeDescriptionRef mode_desc = (ModeDescriptionRef) malloc (sizeof(ModeDescription));
if (mode_desc == NULL) {
return error (ERR_NOSPACE, 0, 0, 0);
}
mode_desc->definition = *mode;
compute_modedescription(mode_desc);
mode_desc->frame_hz = mode->freq;
mode_desc->priority = priority;
if (add_proposed_mode(monitor, mode_desc) == 0) {
free(mode_desc);
return NULL;
}
#if DODEBUG
display_mode_parameters(mode_desc);
#endif
return NULL;
}
/* generate_dmt_mode creates a mode using standardised timing parameters.
* These come from the Display Monitor Timing Document (VESA).
* They are part of EDID 1.0 to 1.3 and should be used where a DMT
......@@ -1649,24 +1692,12 @@ static _kernel_oserror *generate_dmt_mode(char dmt, MonitorDescriptionRef monito
if (dmt > 0)
{
dmt--; /* Convert DMT back to array number */
ModeDescriptionRef mode_desc = (ModeDescriptionRef) malloc (sizeof(ModeDescription));
if (mode_desc == NULL) {
return error (ERR_NOSPACE, 0, 0, 0);
}
mode_desc->definition = display_monitor_timings[dmt];
compute_modedescription(mode_desc);
mode_desc->frame_hz = display_monitor_timings[dmt].freq;
mode_desc->priority = priority;
if (add_proposed_mode(monitor, mode_desc) == 0) {
free(mode_desc);
}
#if DODEBUG
printf("Established Modes Display Monitor Timing :\n");
display_mode_parameters(mode_desc);
#endif
return add_builtin_mode(monitor, &display_monitor_timings[dmt], priority);
}
#if DODEBUG
else
......@@ -3121,9 +3152,12 @@ static _kernel_oserror *parseedid(char *ediddata, const char *file)
{
if ((edidblockref->established_timings[timings_byte] & (1<<(timings_bit%8))) == (1<<(timings_bit%8)))
{
int dmt_mode = (timings_byte * 8)+(7 - timings_bit);
#if DODEBUG
printf("Timings bitfield byte %d bit %d:\n", timings_byte, timings_bit);
#endif
int dmt_mode = established_timings[(timings_byte * 8)+(7 - timings_bit)];
if (dmt_mode > 0) {
generate_dmt_mode(established_timings[dmt_mode], new_monitor, 6);
generate_dmt_mode(dmt_mode, new_monitor, 6);
}
else {
// There are 3 cases who do not have defined DMT codes.
......@@ -3131,12 +3165,11 @@ static _kernel_oserror *parseedid(char *ediddata, const char *file)
int xres = 0;
int yres = 0;
int freq = 0;
switch (timings_bit)
switch (timings_bit | (timings_byte << 3))
{
case 7: // 720 X 400 @ 40Hz
xres = 720;
yres = 400;
freq = 70;
case 7: // 720 X 400 @ 70Hz
/* Use some fixed timings for better compatibility */
add_builtin_mode(new_monitor, &established_timing_7, 6);
break;
case 6: // 720 X 400 @ 88Hz
xres = 720;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment