Commit 55179bbd authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add support for parsing CEA Short Video Descriptors (SVDs). Fix loaded EDID...

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'
parent fc351291
/* (0.52)
/* (0.53)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.52
#define Module_MajorVersion_CMHG 0.53
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Jan 2016
#define Module_Date_CMHG 10 Jan 2016
#define Module_MajorVersion "0.52"
#define Module_Version 52
#define Module_MajorVersion "0.53"
#define Module_Version 53
#define Module_MinorVersion ""
#define Module_Date "08 Jan 2016"
#define Module_Date "10 Jan 2016"
#define Module_ApplicationDate "08-Jan-16"
#define Module_ApplicationDate "10-Jan-16"
#define Module_ComponentName "ScrModes"
#define Module_ComponentPath "castle/RiscOS/Sources/Video/UserI/ScrModes"
#define Module_FullVersion "0.52"
#define Module_HelpVersion "0.52 (08 Jan 2016)"
#define Module_LibraryVersionInfo "0:52"
#define Module_FullVersion "0.53"
#define Module_HelpVersion "0.53 (10 Jan 2016)"
#define Module_LibraryVersionInfo "0:53"
......@@ -524,6 +524,9 @@ static const CVTTiming cvt_timings[] = {
};
#endif
/* CEA 861-D mode timings */
#include "CEAModes.h"
/*
* Must keep this consistent with keywordset above: order has to match
* exactly.
......@@ -2711,7 +2714,30 @@ static _kernel_oserror *process_cea_audio_data_block(EDIDExtensionBlockRef ext_b
/* Process a video data block from a CEA extension block */
static _kernel_oserror *process_cea_video_data_block(EDIDExtensionBlockRef ext_block, int length, const uint8_t *block, MonitorDescriptionRef new_monitor)
{
/* TODO: Parse SVDs and add to mode list */
/* Parse SVDs and add to mode list */
while (length--)
{
uint8_t num = block[0] & 0x7f;
#if DODEBUG
printf("CEA SVD %02x -> CEA mode %d%s\n",block[0],num,(block[0]&128)?" (native)":"");
#endif
block++;
if ((num == 0) || (num > (sizeof(cea_modes)/sizeof(cea_modes[0]))))
{
continue;
}
/* Ignore modes that require pixel repetition (currently we have no way of indicating that requirement to the driver) */
const ModeDefinition *mode = &cea_modes[num-1];
if ((mode->xres != mode->hpar[FR_DISP]) || (mode->xres == 2880))
{
continue;
}
_kernel_oserror *err = add_builtin_mode(new_monitor, mode, 3); /* SVDs should be considered the same priority as DTDs */
if (err)
{
return err;
}
}
return NULL;
}
......@@ -3415,7 +3441,9 @@ static _kernel_oserror *loadedid (const char *file)
{
_kernel_oserror *res;
/* Load the EDID data into a data block. */
/* NB at present we aren't loading extension blocks */
/* Disable automatic EDID reading when an EDID file is in use */
EDIDEnabled = 0;
int file_length, file_found;
......
/* CEA 861-D mode timings
Horizontal & vertical parameters are listed as shown in the spec (reading
the timing diagrams from left to right), so the CEA_MODE macro needs to
manipulate them a bit in order to convert them to the form RISC OS uses.
For the vertical timings this means taking the value to the left of the
transition point.
However the macro assumes that the V1 number (at the start of the VSync
period) is the total line count; so for modes where this isn't the case
(e.g. 2) the macro parameters are manually fudged by subtracting the
actual VSync start value from V0 and V2-V4.
Currently, there are some parameters included in the macro which aren't used,
such as the image aspect ratio, and the alternate clock rate. Also where
multiple vsync width values are permissible, only the first set of timings
has been used, and the macro doesn't record the permissible pixel repetition
values for the modes where pixel repetition is expected.
*/
#define CEA_MODE(NUMBER,WIDTH,HEIGHT,INT,HZ,ASPECT,CLOCK59,CLOCK60,SYNCS,H0,H1,H2,H3,V0,V1,V2,V3,V4) \
{\
#WIDTH " x " #HEIGHT, \
WIDTH, \
HEIGHT, \
{ H1, H2, 0, H3, 0, H0 }, \
{ V2, (V3)-(V2), 0, V4, 0, (V1)-(V0) }, \
CLOCK60, \
-1, \
SYNCS, \
INT, \
HZ \
}
static const ModeDefinition cea_modes[] = {
/* NUM WIDTH HEIGHT INT HZ ASPECT CLOCK59 CLOCK60 SYNCS H0 H1 H2 H3 V0 V1 V2 V3 V4 */
CEA_MODE(1, 640, 480, 0, 60, A43, 25175, 25200, NN, 16, 96, 48, 640, 515, 525, 2, 35, 480),
CEA_MODE(2, 720, 480, 0, 60, A43, 27000, 27027, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(3, 720, 480, 0, 60, A169, 27000, 27027, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(4, 1280, 720, 0, 60, A169, 74176, 74250, PP, 110, 40, 220, 1280, 745, 750, 5, 25, 720),
CEA_MODE(5, 1920, 1080, 1, 60, A169, 74176, 74250, PP, 88, 44, 148, 1920, 1123, 1125, 5, 20, 540),
CEA_MODE(6, 720, 480, 1, 60, A43, 27000, 27027, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(7, 720, 480, 1, 60, A169, 27000, 27027, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(8, 720, 240, 0, 60, A43, 27000, 27027, NN, 38, 124, 114, 1440, 261-3, 262, 6-3, 21-3, 240),
CEA_MODE(9, 720, 240, 0, 60, A169, 27000, 27027, NN, 38, 124, 114, 1440, 261-3, 262, 6-3, 21-3, 240),
CEA_MODE(10, 2880, 480, 1, 60, A43, 54000, 54054, NN, 76, 248, 228, 2880, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(11, 2880, 480, 1, 60, A169, 54000, 54054, NN, 76, 248, 228, 2880, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(12, 2880, 240, 0, 60, A43, 54000, 54054, NN, 76, 248, 228, 2880, 261-3, 262, 6-3, 21-3, 240),
CEA_MODE(13, 2880, 240, 0, 60, A169, 54000, 54054, NN, 76, 248, 228, 2880, 261-3, 262, 6-3, 21-3, 240),
CEA_MODE(14, 1440, 480, 0, 60, A43, 54000, 54054, NN, 32, 124, 120, 1440, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(15, 1440, 480, 0, 60, A169, 54000, 54054, NN, 32, 124, 120, 1440, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(16, 1920, 1080, 0, 60, A169, 148352, 148500, PP, 88, 44, 148, 1920, 1121, 1125, 5, 41, 1080),
CEA_MODE(17, 720, 576, 0, 50, A43, 27000, 27000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(18, 720, 576, 0, 50, A169, 27000, 27000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(19, 1280, 720, 0, 50, A169, 74250, 74250, PP, 440, 40, 220, 1280, 745, 750, 5, 25, 720),
CEA_MODE(20, 1920, 1080, 1, 50, A169, 74250, 74250, PP, 528, 44, 148, 1920, 1123, 1125, 5, 20, 540),
CEA_MODE(21, 720, 576, 1, 50, A43, 27000, 27000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(22, 720, 576, 1, 50, A169, 27000, 27000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(23, 720, 288, 0, 50, A43, 27000, 27000, NN, 24, 126, 138, 1440, 310, 312, 3, 21, 288),
CEA_MODE(24, 720, 288, 0, 50, A169, 27000, 27000, NN, 24, 126, 138, 1440, 310, 312, 3, 21, 288),
CEA_MODE(25, 2880, 576, 1, 50, A43, 54000, 54000, NN, 48, 252, 276, 2880, 623, 625, 3, 22, 288),
CEA_MODE(26, 2880, 576, 1, 50, A169, 54000, 54000, NN, 48, 252, 276, 2880, 623, 625, 3, 22, 288),
CEA_MODE(27, 2880, 288, 0, 50, A43, 54000, 54000, NN, 48, 252, 276, 2880, 310, 312, 3, 22, 288),
CEA_MODE(28, 2880, 288, 0, 50, A169, 54000, 54000, NN, 48, 252, 276, 2880, 310, 312, 3, 22, 288),
CEA_MODE(29, 1440, 576, 0, 50, A43, 54000, 54000, NN, 24, 128, 136, 1440, 620, 625, 5, 44, 576),
CEA_MODE(30, 1440, 576, 0, 50, A169, 54000, 54000, NN, 24, 128, 136, 1440, 620, 625, 5, 44, 576),
CEA_MODE(31, 1920, 1080, 0, 50, A169, 148500, 148500, PP, 528, 44, 148, 1920, 1121, 1125, 5, 41, 1080),
CEA_MODE(32, 1920, 1080, 0, 24, A169, 74176, 74250, PP, 638, 44, 148, 1920, 1121, 1125, 5, 41, 1080),
CEA_MODE(33, 1920, 1080, 0, 25, A169, 74250, 74250, PP, 528, 44, 148, 1920, 1121, 1125, 5, 41, 1080),
CEA_MODE(34, 1920, 1080, 0, 30, A169, 74176, 74250, PP, 88, 44, 148, 1920, 1121, 1125, 5, 41, 1080),
CEA_MODE(35, 2880, 480, 0, 60, A43, 108000, 108108, NN, 64, 248, 240, 2880, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(36, 2880, 480, 0, 60, A169, 108000, 108108, NN, 64, 248, 240, 2880, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(37, 2880, 576, 0, 50, A43, 108000, 108000, NN, 48, 256, 272, 2880, 620, 625, 5, 44, 576),
CEA_MODE(38, 2880, 576, 0, 50, A169, 108000, 108000, NN, 48, 256, 272, 2880, 620, 625, 5, 44, 576),
CEA_MODE(39, 1920, 1080, 1, 50, A169, 72000, 72000, PN, 32, 168, 184, 1920, 1227, 1250, 5, 62, 540),
CEA_MODE(40, 1920, 1080, 1, 100, A169, 148500, 148500, PP, 528, 44, 148, 1920, 1123, 1125, 5, 20, 540),
CEA_MODE(41, 1280, 720, 0, 100, A169, 148500, 148500, PP, 440, 40, 220, 1280, 745, 750, 5, 25, 720),
CEA_MODE(42, 720, 576, 0, 100, A43, 54000, 54000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(43, 720, 576, 0, 100, A169, 54000, 54000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(44, 720, 576, 1, 100, A43, 54000, 54000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(45, 720, 576, 1, 100, A169, 54000, 54000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(46, 1920, 1080, 1, 120, A169, 148352, 148500, PP, 88, 44, 148, 1920, 1123, 1125, 5, 20, 540),
CEA_MODE(47, 1280, 720, 0, 120, A169, 148352, 148500, PP, 110, 40, 220, 1280, 745, 750, 5, 25, 720),
CEA_MODE(48, 720, 480, 0, 120, A43, 54000, 54054, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(49, 720, 480, 0, 120, A169, 54000, 54054, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(50, 720, 480, 1, 120, A43, 54000, 54054, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(51, 720, 480, 1, 120, A169, 54000, 54054, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(52, 720, 576, 0, 200, A43, 108000, 108000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(53, 720, 576, 0, 200, A169, 108000, 108000, NN, 12, 64, 68, 720, 620, 625, 5, 44, 576),
CEA_MODE(54, 720, 576, 1, 200, A43, 108000, 108000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(55, 720, 576, 1, 200, A169, 108000, 108000, NN, 24, 126, 138, 1440, 623, 625, 3, 22, 288),
CEA_MODE(56, 720, 480, 0, 240, A43, 108000, 108000, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(57, 720, 480, 0, 240, A169, 108000, 108000, NN, 16, 62, 60, 720, 522-6, 525, 12-6, 42-6, 480),
CEA_MODE(58, 720, 480, 1, 240, A43, 108000, 108000, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
CEA_MODE(59, 720, 480, 1, 240, A169, 108000, 108000, NN, 38, 124, 114, 1440, 524-3, 525, 6-3, 21-3, 240),
};
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