src/video/x11/edid.h
author Ryan C. Gordon <icculus@icculus.org>
Thu, 09 Apr 2015 22:28:37 -0400
changeset 9541 cf8fab52e33b
parent 6967 adc80d085ddf
child 10701 62f7dd0acd13
permissions -rw-r--r--
Merged Alex Szpakowski's iOS-improvement branch to default.

Fixes Bugzilla #2798.
Fixes Bugzilla #2212.
Fixes Bugzilla #2826.
Fixes Bugzilla #2661.
Fixes Bugzilla #1885.
Fixes Bugzilla #1578.
Fixes Bugzilla #2751.

(whew!)

Notable changes, from Alex's notes:

- The SDL_WINDOW_ALLOW_HIGHDPI flag is now needed (along with SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize) to use Retina / high DPI resolutions, bringing SDL’s Retina-related behavior on iOS in line with Mac OS X. Window dimensions and display modes are now in the “points” (non-high DPI) coordinate system rather than pixels, whereas SDL_GL_GetDrawableSize is in pixels.

- Reworked the custom extended launch screen code:
- It now hides after the first SDL_PumpEvents call rather than SDL_CreateWindow, and it fades out in a similar manner to the system launch screen behavior.
- It now mirrors the system launch screen behavior when deciding which image to display: it falls back to using the Launch Images dictionary in Info.plist if the iOS 8+ launch screen nib isn’t available, and if the Launch Images dictionary doesn’t exist it uses the old standard launch image names.
- The extended launch screen can now be disabled via the SDL_IPHONE_LAUNCHSCREEN define in SDL_config_iphoneos.h.

- Added support for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.

- Added access to a window view's renderbuffer and framebuffer to syswm.

- Added OpenGL ES debug labels for the Renderbuffer and Framebuffer Objects created with SDL_GL_CreateContext.

- Added support for sRGB OpenGL ES contexts on iOS 7+.

- Updated OpenGL ES contexts to support native-resolution rendering (when SDL_WINDOW_ALLOW_HIGHDPI is enabled) on the iPhone 6 Plus, i.e. 1080x1920 rather than 1242x2208.

- Updated SDL_GL_CreateContext, SDL_GL_SwapWindow, SDL_GL_MakeCurrent, and SDL_GL_DeleteContext to be more robust.

- Updated SDL windows to display a UIView at all times, even when an OpenGL context is not active. This allows rotation, touch events, and other windowing-related events to work properly without an active OpenGL context. It also makes it easier to use SDL_GetWindowWMInfo after creating a SDL window.

- Updated the iOS-specific Objective-C code to use cleaner and more modern language features and APIs, including ARC instead of manual reference counting.

- Updated SDL_HINT_ORIENTATIONS to allow disabling custom orientations if the hint is set with no valid orientation names.

- Fixed several rotation and orientation bugs with windows and display modes, especially in iOS 8+.

- Fixed SDL_SetWindowFullscreen failing to update the status bar visibility on iOS 7+.

- Fixed the orientation of the offset applied to the window’s view when the onscreen keyboard is shown in iOS 8+.

- Fixed SDL_IsScreenKeyboardShown (patch by Phil Hassey.)

- Fixed several major memory leaks caused by missing autorelease pool blocks in the iOS-specific Objective-C code.

- Removed several dead code paths.

- The iOS 7 SDK (Xcode 5) or newer is now required to build SDL for iOS.
     1 typedef unsigned char uchar;
     2 typedef struct MonitorInfo MonitorInfo;
     3 typedef struct Timing Timing;
     4 typedef struct DetailedTiming DetailedTiming;
     5 
     6 typedef enum
     7 {
     8     UNDEFINED,
     9     DVI,
    10     HDMI_A,
    11     HDMI_B,
    12     MDDI,
    13     DISPLAY_PORT
    14 } Interface;
    15 
    16 typedef enum
    17 {
    18     UNDEFINED_COLOR,
    19     MONOCHROME,
    20     RGB,
    21     OTHER_COLOR
    22 } ColorType;
    23 
    24 typedef enum
    25 {
    26     NO_STEREO,
    27     FIELD_RIGHT,
    28     FIELD_LEFT,
    29     TWO_WAY_RIGHT_ON_EVEN,
    30     TWO_WAY_LEFT_ON_EVEN,
    31     FOUR_WAY_INTERLEAVED,
    32     SIDE_BY_SIDE
    33 } StereoType;
    34 
    35 struct Timing
    36 {
    37     int width;
    38     int height;
    39     int frequency;
    40 };
    41 
    42 struct DetailedTiming
    43 {
    44     int		pixel_clock;
    45     int		h_addr;
    46     int		h_blank;
    47     int		h_sync;
    48     int		h_front_porch;
    49     int		v_addr;
    50     int		v_blank;
    51     int		v_sync;
    52     int		v_front_porch;
    53     int		width_mm;
    54     int		height_mm;
    55     int		right_border;
    56     int		top_border;
    57     int		interlaced;
    58     StereoType	stereo;
    59 
    60     int		digital_sync;
    61     union
    62     {
    63 	struct
    64 	{
    65 	    int bipolar;
    66 	    int serrations;
    67 	    int sync_on_green;
    68 	} analog;
    69 
    70 	struct
    71 	{
    72 	    int composite;
    73 	    int serrations;
    74 	    int negative_vsync;
    75 	    int negative_hsync;
    76 	} digital;
    77     };
    78 };
    79 
    80 struct MonitorInfo
    81 {
    82     int			checksum;
    83     char		manufacturer_code[4];
    84     int			product_code;
    85     unsigned int	serial_number;
    86     
    87     int			production_week;	/* -1 if not specified */
    88     int			production_year;	/* -1 if not specified */
    89     int			model_year;		/* -1 if not specified */
    90 
    91     int			major_version;
    92     int			minor_version;
    93 
    94     int			is_digital;
    95     
    96     union
    97     {
    98 	struct
    99 	{
   100 	    int		bits_per_primary;
   101 	    Interface	interface;
   102 	    int		rgb444;
   103 	    int		ycrcb444;
   104 	    int		ycrcb422;
   105 	} digital;
   106 
   107 	struct
   108 	{
   109 	    double	video_signal_level;
   110 	    double	sync_signal_level;
   111 	    double	total_signal_level;
   112 
   113 	    int		blank_to_black;
   114 
   115 	    int		separate_hv_sync;
   116 	    int		composite_sync_on_h;
   117 	    int		composite_sync_on_green;
   118 	    int		serration_on_vsync;
   119 	    ColorType	color_type;
   120 	} analog;
   121     };
   122 
   123     int			width_mm;		/* -1 if not specified */
   124     int			height_mm;		/* -1 if not specified */
   125     double		aspect_ratio;		/* -1.0 if not specififed */
   126 
   127     double		gamma;			/* -1.0 if not specified */
   128 
   129     int			standby;
   130     int			suspend;
   131     int			active_off;
   132 
   133     int			srgb_is_standard;
   134     int			preferred_timing_includes_native;
   135     int			continuous_frequency;
   136 
   137     double		red_x;
   138     double		red_y;
   139     double		green_x;
   140     double		green_y;
   141     double		blue_x;
   142     double		blue_y;
   143     double		white_x;
   144     double		white_y;
   145 
   146     Timing		established[24];	/* Terminated by 0x0x0 */
   147     Timing		standard[8];
   148     
   149     int			n_detailed_timings;
   150     DetailedTiming	detailed_timings[4];	/* If monitor has a preferred
   151 						 * mode, it is the first one
   152 						 * (whether it has, is
   153 						 * determined by the 
   154 						 * preferred_timing_includes
   155 						 * bit.
   156 						 */
   157 
   158     /* Optional product description */
   159     char		dsc_serial_number[14];
   160     char		dsc_product_name[14];
   161     char		dsc_string[14];		/* Unspecified ASCII data */
   162 };
   163 
   164 MonitorInfo *decode_edid (const uchar *data);
   165 void         dump_monitor_info (MonitorInfo *info);
   166 char *       make_display_name (const char        *output_name,
   167 				const MonitorInfo *info);