mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
xfree86: ddc: replace several internal macros that aren't really needed
Just replace them by their actual definition right where they're called. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
a6d1bdcd3e
commit
1cb42729a4
@@ -100,75 +100,36 @@
|
||||
|
||||
/* extract information from vendor section */
|
||||
#define _PROD_ID(x) x[0] + (x[1] << 8);
|
||||
#define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
|
||||
#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
|
||||
#define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
|
||||
#define _YEAR(x) (x & 0xFF) + 1990
|
||||
#define YEAR _YEAR(GET(V_YEAR))
|
||||
#define WEEK GET(V_WEEK) & 0xFF
|
||||
#define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
|
||||
#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
|
||||
#define _L3(x) (x[1] & 0x1F) + '@';
|
||||
#define L1 _L1(GET_ARRAY(V_MANUFACTURER))
|
||||
#define L2 _L2(GET_ARRAY(V_MANUFACTURER))
|
||||
#define L3 _L3(GET_ARRAY(V_MANUFACTURER))
|
||||
|
||||
/* extract information from version section */
|
||||
#define VERSION GET(V_VERSION)
|
||||
#define REVISION GET(V_REVISION)
|
||||
|
||||
/* extract information from display section */
|
||||
#define _INPUT_TYPE(x) ((x & 0x80) >> 7)
|
||||
#define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
|
||||
#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
|
||||
#define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
|
||||
#define _SETUP(x) ((x & 0x10) >> 4)
|
||||
#define SETUP _SETUP(GET(D_INPUT))
|
||||
#define _SYNC(x) (x & 0x0F)
|
||||
#define SYNC _SYNC(GET(D_INPUT))
|
||||
#define _DFP(x) (x & 0x01)
|
||||
#define DFP _DFP(GET(D_INPUT))
|
||||
#define _BPC(x) ((x & 0x70) >> 4)
|
||||
#define BPC _BPC(GET(D_INPUT))
|
||||
#define _DIGITAL_INTERFACE(x) (x & 0x0F)
|
||||
#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
|
||||
#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0))
|
||||
#define GAMMA _GAMMA(GET(D_GAMMA))
|
||||
#define HSIZE_MAX GET(D_HSIZE)
|
||||
#define VSIZE_MAX GET(D_VSIZE)
|
||||
#define _DPMS(x) ((x & 0xE0) >> 5)
|
||||
#define DPMS _DPMS(GET(FEAT_S))
|
||||
#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
|
||||
#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
|
||||
#define _MSC(x) (x & 0x7)
|
||||
#define MSC _MSC(GET(FEAT_S))
|
||||
|
||||
/* color characteristics */
|
||||
#define CC_L(x,y) ((x & (0x03 << y)) >> y)
|
||||
#define CC_H(x) (x << 2)
|
||||
#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
|
||||
#define F_CC(x) ((x)/1024.0)
|
||||
#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
|
||||
#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
|
||||
#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
|
||||
#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
|
||||
#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
|
||||
#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
|
||||
#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
|
||||
#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
|
||||
|
||||
/* extract information from standard timing section */
|
||||
#define T1 GET(E_T1)
|
||||
#define T2 GET(E_T2)
|
||||
#define T_MANU GET(E_TMANU)
|
||||
|
||||
/* extract information from established timing section */
|
||||
#define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \
|
||||
|| ((x[0] == 0x00) && (x[1] == 0x00)) \
|
||||
|| ((x[0] == 0x20) && (x[1] == 0x20)) )
|
||||
#define VALID_TIMING _VALID_TIMING(c)
|
||||
#define _HSIZE1(x) ((x[0] + 31) * 8)
|
||||
#define HSIZE1 _HSIZE1(c)
|
||||
#define RATIO(x) ((x[1] & 0xC0) >> 6)
|
||||
#define RATIO1_1 0
|
||||
/* EDID Ver. 1.3 redefined this */
|
||||
@@ -183,16 +144,13 @@
|
||||
case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
|
||||
case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
|
||||
}
|
||||
#define VSIZE1(x) _VSIZE1(c,x,v)
|
||||
#define _REFRESH_R(x) (x[1] & 0x3F) + 60
|
||||
#define REFRESH_R _REFRESH_R(c)
|
||||
#define _ID_LOW(x) x[0]
|
||||
#define ID_LOW _ID_LOW(c)
|
||||
#define _ID_HIGH(x) (x[1] << 8)
|
||||
#define ID_HIGH _ID_HIGH(c)
|
||||
#define STD_TIMING_ID (ID_LOW | ID_HIGH)
|
||||
#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
|
||||
#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
|
||||
|
||||
/* EDID Ver. >= 1.2 */
|
||||
/**
|
||||
@@ -203,7 +161,6 @@
|
||||
* broken empty ASCII strings. Only the first two bytes are reliable.
|
||||
*/
|
||||
#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0)
|
||||
#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
|
||||
#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
|
||||
#define PIXEL_CLOCK _PIXEL_CLOCK(c)
|
||||
#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
|
||||
@@ -242,7 +199,6 @@
|
||||
#define MISC _MISC(c)
|
||||
|
||||
#define _MONITOR_DESC_TYPE(x) x[3]
|
||||
#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
|
||||
#define SERIAL_NUMBER 0xFF
|
||||
#define ASCII_STR 0xFE
|
||||
#define MONITOR_RANGES 0xFD
|
||||
|
||||
@@ -442,62 +442,62 @@ xf86InterpretEEDID(int scrnIndex, uint8_t * block)
|
||||
static void
|
||||
get_vendor_section(uint8_t * c, struct vendor *r)
|
||||
{
|
||||
r->name[0] = L1;
|
||||
r->name[1] = L2;
|
||||
r->name[2] = L3;
|
||||
r->name[0] = _L1(GET_ARRAY(V_MANUFACTURER));
|
||||
r->name[1] = _L2(GET_ARRAY(V_MANUFACTURER));
|
||||
r->name[2] = _L3(GET_ARRAY(V_MANUFACTURER));
|
||||
r->name[3] = '\0';
|
||||
|
||||
r->prod_id = PROD_ID;
|
||||
r->serial = SERIAL_NO;
|
||||
r->week = WEEK;
|
||||
r->year = YEAR;
|
||||
r->prod_id = _PROD_ID(GET_ARRAY(V_PROD_ID));
|
||||
r->serial = _SERIAL_NO(GET_ARRAY(V_SERIAL));
|
||||
r->week = _YEAR(GET(V_YEAR));
|
||||
r->year = GET(V_WEEK) & 0xFF;
|
||||
}
|
||||
|
||||
static void
|
||||
get_version_section(uint8_t * c, struct edid_version *r)
|
||||
{
|
||||
r->version = VERSION;
|
||||
r->revision = REVISION;
|
||||
r->version = GET(V_VERSION);
|
||||
r->revision = GET(V_REVISION);
|
||||
}
|
||||
|
||||
static void
|
||||
get_display_section(uint8_t * c, struct disp_features *r, struct edid_version *v)
|
||||
{
|
||||
r->input_type = INPUT_TYPE;
|
||||
r->input_type = _INPUT_TYPE(GET(D_INPUT));
|
||||
if (!DIGITAL(r->input_type)) {
|
||||
r->input_voltage = INPUT_VOLTAGE;
|
||||
r->input_setup = SETUP;
|
||||
r->input_sync = SYNC;
|
||||
r->input_voltage = _INPUT_VOLTAGE(GET(D_INPUT));
|
||||
r->input_setup = _SETUP(GET(D_INPUT));
|
||||
r->input_sync = _SYNC(GET(D_INPUT));
|
||||
}
|
||||
else if (v->revision == 2 || v->revision == 3) {
|
||||
r->input_dfp = DFP;
|
||||
r->input_dfp = _DFP(GET(D_INPUT));
|
||||
}
|
||||
else if (v->revision >= 4) {
|
||||
r->input_bpc = BPC;
|
||||
r->input_interface = DIGITAL_INTERFACE;
|
||||
r->input_bpc = _BPC(GET(D_INPUT));
|
||||
r->input_interface = _DIGITAL_INTERFACE(GET(D_INPUT));
|
||||
}
|
||||
r->hsize = HSIZE_MAX;
|
||||
r->vsize = VSIZE_MAX;
|
||||
r->gamma = GAMMA;
|
||||
r->dpms = DPMS;
|
||||
r->display_type = DISPLAY_TYPE;
|
||||
r->msc = MSC;
|
||||
r->redx = REDX;
|
||||
r->redy = REDY;
|
||||
r->greenx = GREENX;
|
||||
r->greeny = GREENY;
|
||||
r->bluex = BLUEX;
|
||||
r->bluey = BLUEY;
|
||||
r->whitex = WHITEX;
|
||||
r->whitey = WHITEY;
|
||||
r->hsize = GET(D_HSIZE);
|
||||
r->vsize = GET(D_VSIZE);
|
||||
r->gamma = _GAMMA(GET(D_GAMMA));
|
||||
r->dpms = _DPMS(GET(FEAT_S));
|
||||
r->display_type = _DISPLAY_TYPE(GET(FEAT_S));
|
||||
r->msc = _MSC(GET(FEAT_S));
|
||||
r->redx = F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6));
|
||||
r->redy = F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4));
|
||||
r->greenx = F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2));
|
||||
r->greeny = F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0));
|
||||
r->bluex = F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6));
|
||||
r->bluey = F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4));
|
||||
r->whitex = F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2));
|
||||
r->whitey = F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0));
|
||||
}
|
||||
|
||||
static void
|
||||
get_established_timing_section(uint8_t * c, struct established_timings *r)
|
||||
{
|
||||
r->t1 = T1;
|
||||
r->t2 = T2;
|
||||
r->t_manu = T_MANU;
|
||||
r->t1 = GET(E_T1);
|
||||
r->t2 = GET(E_T2);
|
||||
r->t_manu = GET(E_TMANU);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -551,16 +551,16 @@ get_std_timing_section(uint8_t * c, struct std_timings *r, struct edid_version *
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STD_TIMINGS; i++) {
|
||||
if (VALID_TIMING) {
|
||||
r[i].hsize = HSIZE1;
|
||||
VSIZE1(r[i].vsize);
|
||||
r[i].refresh = REFRESH_R;
|
||||
if (_VALID_TIMING(c)) {
|
||||
r[i].hsize = _HSIZE1(c);
|
||||
_VSIZE1(c,r[i].vsize,v);
|
||||
r[i].refresh = _REFRESH_R(c);
|
||||
r[i].id = STD_TIMING_ID;
|
||||
}
|
||||
else {
|
||||
r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0;
|
||||
}
|
||||
NEXT_STD_TIMING;
|
||||
_NEXT_STD_TIMING(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,8 +570,8 @@ static void
|
||||
fetch_detailed_block(uint8_t * c, struct edid_version *ver,
|
||||
struct detailed_monitor_section *det_mon)
|
||||
{
|
||||
if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) {
|
||||
switch (MONITOR_DESC_TYPE) {
|
||||
if (ver->version == 1 && ver->revision >= 1 && _IS_MONITOR_DESC(c)) {
|
||||
switch (_MONITOR_DESC_TYPE(c)) {
|
||||
case SERIAL_NUMBER:
|
||||
det_mon->type = DS_SERIAL;
|
||||
copy_string(c, det_mon->section.serial);
|
||||
@@ -656,11 +656,11 @@ get_dst_timing_section(uint8_t * c, struct std_timings *t, struct edid_version *
|
||||
|
||||
c = c + 5;
|
||||
for (j = 0; j < 5; j++) {
|
||||
t[j].hsize = HSIZE1;
|
||||
VSIZE1(t[j].vsize);
|
||||
t[j].refresh = REFRESH_R;
|
||||
t[j].hsize = _HSIZE1(c);
|
||||
_VSIZE1(c,t[j].vsize,v);
|
||||
t[j].refresh = _REFRESH_R(c);
|
||||
t[j].id = STD_TIMING_ID;
|
||||
NEXT_STD_TIMING;
|
||||
_NEXT_STD_TIMING(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user