Actually fetch all blocks of EEDID if asked to.

This commit is contained in:
Adam Jackson 2008-06-21 16:00:05 -04:00
parent 211e2bdcc6
commit b4fbc31e10
5 changed files with 36 additions and 18 deletions

View File

@ -531,6 +531,9 @@ struct detailed_monitor_section {
} section; /* max: 80 */
};
/* flags */
#define EDID_COMPLETE_RAWDATA 0x1
typedef struct {
int scrnIndex;
struct vendor vendor;
@ -539,7 +542,7 @@ typedef struct {
struct established_timings timings1;
struct std_timings timings2[8];
struct detailed_monitor_section det_mon[4];
void *vdif; /* unused */
unsigned long flags;
int no_sections;
Uchar *rawData;
} xf86Monitor, *xf86MonPtr;

View File

@ -118,6 +118,20 @@ xf86InterpretEDID(int scrnIndex, Uchar *block)
return NULL;
}
xf86MonPtr
xf86InterpretEEDID(int scrnIndex, Uchar *block)
{
xf86MonPtr m;
m = xf86InterpretEDID(scrnIndex, block);
if (!m)
return NULL;
/* extension parse */
return m;
}
static void
get_vendor_section(Uchar *c, struct vendor *r)
{

View File

@ -197,21 +197,17 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
* unset. EDID information blocks are interpreted and the results returned in
* an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return
* the complete EDID data, including all extension blocks.
* the complete EDID data, including all extension blocks, if the 'complete'
* parameter is TRUE;
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with EDID information.
*
* @return pointer to a new xf86MonPtr containing the EDID information.
* @return NULL if no monitor attached or failure to interpret the EDID.
*
* nblocks is an in/out parameter. If non-zero, it defines the number of
* blocks to read from the monitor; zero (or NULL pointer) means read all.
* If non-NULL, on return it will be filled in with the number of blocks
* read.
*/
xf86MonPtr
xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
unsigned char *EDID_block = NULL;
@ -242,15 +238,20 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
return NULL;
if (DDC2Read(dev, 0, EDID_block)) {
tmp = xf86InterpretEDID(scrnIndex, EDID_block);
int i, n = EDID_block[0x7e];
if (complete && n) {
EDID_block = xrealloc(EDID_block, EDID1_LEN * (1+n));
for (i = 0; i < n; i++)
DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i)));
}
tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
}
if (nblocks) {
if (tmp)
*nblocks = tmp->no_sections;
else
*nblocks = 0;
}
if (tmp && complete)
tmp->flags |= EDID_COMPLETE_RAWDATA;
return tmp;
}
@ -269,8 +270,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
xf86MonPtr
xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
{
int nblocks = 1;
return xf86DoEEDID(scrnIndex, pBus, &nblocks);
return xf86DoEEDID(scrnIndex, pBus, FALSE);
}
/*

View File

@ -35,7 +35,7 @@ extern xf86MonPtr xf86DoEDID_DDC2(
I2CBusPtr pBus
);
extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks);
extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool);
extern xf86MonPtr xf86PrintEDID(
xf86MonPtr monPtr

View File

@ -1007,6 +1007,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86DoEDID_DDC2)
SYMFUNC(xf86InterpretEDID)
SYMFUNC(xf86PrintEDID)
SYMFUNC(xf86DoEEDID)
SYMFUNC(xf86DDCMonitorSet)
SYMFUNC(xf86SetDDCproperties)