[patch] Add some asserts
Rafael Espíndola
rafael.espindola at gmail.com
Wed Dec 23 15:22:43 PST 2009
2009/12/22 Rafael Espíndola <rafael.espindola at gmail.com>:
> I am debugging a crash at startup in a 27 inch imac (Mobility Radeon
> HD 4850). The attached patch doesn't fix it, but it makes it a lot
> more obvious what is going wrong (currently the driver just
> segfaults).
Looks like there is a missing entry in object_connector_convert. With
the attached patch things get a lot better. I get the attached log
which includes:
Mode 2560x1440 - 2720 1481 0
Which is the correct resolution :-)
Unfortunately, the screen is black.
Cheers,
Rafael
-------------- next part --------------
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index c272c9a..4f27cd0 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1432,7 +1432,7 @@ rhdAtomFirmwareInfoQuery(atomBiosHandlePtr handle,
return ATOM_SUCCESS;
}
-const int object_connector_convert[] =
+static const int object_connector_convert[] =
{ CONNECTOR_NONE,
CONNECTOR_DVI_I,
CONNECTOR_DVI_I,
@@ -1453,6 +1453,7 @@ const int object_connector_convert[] =
CONNECTOR_NONE,
CONNECTOR_NONE,
CONNECTOR_DISPLAY_PORT,
+ CONNECTOR_DVI_D, /* IMAC 27 */
};
xf86MonPtr radeon_atom_get_edid(xf86OutputPtr output)
@@ -1847,6 +1848,8 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
uint8_t con_obj_id, con_obj_num, con_obj_type;
con_obj_id = (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+ assert(con_obj_id < sizeof(object_connector_convert)/sizeof(int));
+
con_obj_num = (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
con_obj_type = (le16_to_cpu(path->usConnObjectId) & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
@@ -1879,6 +1882,7 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
slot_config = igp_obj->ulDDISlot2Config;
ct = (slot_config >> 16) & 0xff;
+ assert(ct < sizeof(object_connector_convert)/sizeof(int));
info->BiosConnector[i].ConnectorType = object_connector_convert[ct];
info->BiosConnector[i].connector_object_id = ct;
info->BiosConnector[i].igp_lane_info = slot_config & 0xffff;
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 107955d..330a0b3 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2946,6 +2946,7 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
} else if (conntype == CONNECTOR_DISPLAY_PORT) {
output = RADEONOutputCreate(pScrn, "DisplayPort-%d", --num_dp);
} else {
+ assert(conntype < sizeof(ConnectorTypeName)/sizeof(char *));
output = RADEONOutputCreate(pScrn,
ConnectorTypeName[conntype], 0);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log
Type: application/octet-stream
Size: 4549 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-driver-ati/attachments/20091223/4e96677f/attachment.obj
More information about the xorg-driver-ati
mailing list