Commit 8f3400df authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix decoding of DTD sync polarities. Add support for some missing established timings.

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
parent 020db416
......@@ -6,18 +6,18 @@
*/
#define Module_MajorVersion_CMHG 0.47
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Feb 2015
#define Module_Date_CMHG 24 Feb 2015
#define Module_MajorVersion "0.47"
#define Module_Version 47
#define Module_MinorVersion ""
#define Module_Date "20 Feb 2015"
#define Module_Date "24 Feb 2015"
#define Module_ApplicationDate "20-Feb-15"
#define Module_ApplicationDate "24-Feb-15"
#define Module_ComponentName "ScrModes"
#define Module_ComponentPath "castle/RiscOS/Sources/Video/UserI/ScrModes"
#define Module_FullVersion "0.47"
#define Module_HelpVersion "0.47 (20 Feb 2015)"
#define Module_HelpVersion "0.47 (24 Feb 2015)"
#define Module_LibraryVersionInfo "0:47"
......@@ -2470,7 +2470,7 @@ static void dtd_block_to_modedesc(char* dtd_data, ModeDescriptionRef mode_desc)
mode_desc->definition.vpar[FR_BDR2];
mode_desc->definition.pixel_khz = (dtd_data[0] + (dtd_data[1]<<8)) * 10;
mode_desc->definition.external_clock = -1;
mode_desc->definition.syncpol = (!((dtd_data[17]>>2) & 1) + (!((dtd_data[17]>>1) & 1)<<1));
mode_desc->definition.syncpol = ((!((dtd_data[17]>>2) & 1)<<1) + !((dtd_data[17]>>1) & 1));
/* If we are interlaced, we need to double the number of vertical pixels */
......@@ -2688,25 +2688,6 @@ static _kernel_oserror *parseedid(char *ediddata, const char *file)
#endif
/* Add Established timings I, II and III (priority 6) */
#if DODEBUG
printf("Timings bitfield 0 = %02x\n",edidblockref->established_timings[0]);
printf("Timings bitfield 1 = %02x\n",edidblockref->established_timings[1]);
printf("Timings bitfield 2 = %02x\n",edidblockref->established_timings[2]);
#endif
for (int timings_byte=0; timings_byte<2; timings_byte++)
{
for (int timings_bit=0; timings_bit<8; timings_bit++)
{
if ((edidblockref->established_timings[timings_byte] & (1<<(timings_bit%8))) == (1<<(timings_bit%8)))
{
generate_dmt_mode(established_timings[(timings_byte * 8)+(7 - timings_bit)], new_monitor, 6);
}
}
}
/* Next do each of the 2-byte 'standard timings' (Priority 5). */
/* NB GTF support must be functional for these */
for (int std_timing_code=0; std_timing_code<8;std_timing_code++)
......@@ -2848,6 +2829,72 @@ static _kernel_oserror *parseedid(char *ediddata, const char *file)
}
/* Add Established timings I and II (priority 6) */
#if DODEBUG
printf("Timings bitfield 0 = %02x\n",edidblockref->established_timings[0]);
printf("Timings bitfield 1 = %02x\n",edidblockref->established_timings[1]);
printf("Timings bitfield 2 = %02x\n",edidblockref->established_timings[2]);
#endif
for (int timings_byte=0; timings_byte<2; timings_byte++)
{
for (int timings_bit=0; timings_bit<8; timings_bit++)
{
if ((edidblockref->established_timings[timings_byte] & (1<<(timings_bit%8))) == (1<<(timings_bit%8)))
{
int dmt_mode = (timings_byte * 8)+(7 - timings_bit);
if (dmt_mode > 0) {
generate_dmt_mode(established_timings[dmt_mode], new_monitor, 6);
}
else {
// There are 3 cases who do not have defined DMT codes.
// These are byte 0 bits 7, 6 and 4 which we will calculate
int xres = 0;
int yres = 0;
int freq = 0;
switch (timings_bit)
{
case 7: // 720 X 400 @ 40Hz
xres = 720;
yres = 400;
freq = 70;
break;
case 6: // 720 X 400 @ 88Hz
xres = 720;
yres = 400;
freq = 88;
break;
case 4: // 640 X 480 @ 67Hz
xres = 640;
yres = 480;
freq = 67;
break;
}
if (xres > 0) {
ModeDescriptionRef mp;
mp = (ModeDescriptionRef) malloc (sizeof(ModeDescription));
if (mp == NULL) {
return error (ERR_NOSPACE, 0, 0, 0);
}
if ((timing_support == EDID_USE_GTF) ||
(timing_support == EDID_USE_GTF2)) {
generate_mode_using_gtf(xres, yres, freq, mp, new_monitor);
}
if ((timing_support == EDID_USE_CVT) ||
(timing_support == EDID_USE_CVTRB)) {
generate_mode_using_cvt_rb(xres, yres, freq, mp, new_monitor);
}
}
}
}
}
}
/* Now check extension blocks for modes. Detailed timing modes found here have 3rd priority */
if (edidblockref->extension_block_count > 0)
{
......
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