1 
2 /* xf86DDC.h
3  *
4  * This file contains all information to interpret a standard EDIC block
5  * transmitted by a display device via DDC (Display Data Channel). So far
6  * there is no information to deal with optional EDID blocks.
7  * DDC is a Trademark of VESA (Video Electronics Standard Association).
8  *
9  * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
10  */
11 
12 #ifndef XF86_DDC_H
13 #define XF86_DDC_H
14 
15 #include "edid.h"
16 #include "xf86i2c.h"
17 #include "xf86str.h"
18 
19 /* speed up / slow down */
20 typedef enum {
21     DDC_SLOW,
22     DDC_FAST
23 } xf86ddcSpeed;
24 
25 typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed);
26 
27 extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn,
28                                             DDC1SetSpeedProc DDC1SetSpeed,
29                                             unsigned
30                                             int (*DDC1Read) (ScrnInfoPtr)
31     );
32 
33 extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus);
34 
35 extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool);
36 
37 extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr);
38 
39 extern _X_EXPORT xf86MonPtr xf86InterpretEDID(int screenIndex, Uchar * block);
40 
41 extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(int screenIndex, Uchar * block);
42 
43 extern _X_EXPORT void
44  xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
45 
46 extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
47 
48 extern _X_EXPORT Bool
49  xf86MonitorIsHDMI(xf86MonPtr mon);
50 
51 extern _X_EXPORT Bool
52 gtf_supported(xf86MonPtr mon);
53 
54 extern _X_EXPORT DisplayModePtr
55 FindDMTMode(int hsize, int vsize, int refresh, Bool rb);
56 
57 extern _X_EXPORT const DisplayModeRec DMTModes[];
58 
59 /*
60  * Quirks to work around broken EDID data from various monitors.
61  */
62 typedef enum {
63     DDC_QUIRK_NONE = 0,
64     /* First detailed mode is bogus, prefer largest mode at 60hz */
65     DDC_QUIRK_PREFER_LARGE_60 = 1 << 0,
66     /* 135MHz clock is too high, drop a bit */
67     DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1,
68     /* Prefer the largest mode at 75 Hz */
69     DDC_QUIRK_PREFER_LARGE_75 = 1 << 2,
70     /* Convert detailed timing's horizontal from units of cm to mm */
71     DDC_QUIRK_DETAILED_H_IN_CM = 1 << 3,
72     /* Convert detailed timing's vertical from units of cm to mm */
73     DDC_QUIRK_DETAILED_V_IN_CM = 1 << 4,
74     /* Detailed timing descriptors have bogus size values, so just take the
75      * maximum size and use that.
76      */
77     DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
78     /* Monitor forgot to set the first detailed is preferred bit. */
79     DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6,
80     /* use +hsync +vsync for detailed mode */
81     DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7,
82     /* Force single-link DVI bandwidth limit */
83     DDC_QUIRK_DVI_SINGLE_LINK = 1 << 8,
84 } ddc_quirk_t;
85 
86 typedef void (*handle_detailed_fn) (struct detailed_monitor_section *, void *);
87 
88 void xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn, void *data);
89 
90 ddc_quirk_t xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose);
91 
92 void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
93                               ddc_quirk_t quirks, int hsize, int vsize);
94 
95 typedef void (*handle_video_fn) (struct cea_video_block *, void *);
96 
97 void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *);
98 
99 struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon);
100 
101 #endif
102