Panel information incorrectly retrived from BIOS (dithering)

Peter Clifton pcjc2 at cam.ac.uk
Sun Aug 10 12:48:15 PDT 2008


Hi,

Having had a poke more at the panel dithering problem, it seems that the
packed bitfield in i830_bios.h is in the wrong order when compiled with
gcc 4.2.3.

This all feels quite dangerous, as a few cursory searches suggest that
the structure packing order could be endian / compiler dependant.

I'm about to give this diff a spin, but there are other packed bit-field
structures which probably ought to be checked. The only reference I have
is the old code, since I'm not sure where (if anywhere) these VBIOS
structures are documented and publicly available.

diff --git a/src/i830_bios.h b/src/i830_bios.h
index a8d9add..2963882 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -151,14 +151,13 @@ struct bdb_general_definitions {
 struct bdb_lvds_options {
     uint8_t panel_type;
     uint8_t rsvd1;
-    /* LVDS capabilities, stored in a dword */
-    uint8_t rsvd2:1;
-    uint8_t lvds_edid:1;
-    uint8_t pixel_dither:1;
-    uint8_t pfit_ratio_auto:1;
-    uint8_t pfit_gfx_mode_enhanced:1;
-    uint8_t pfit_text_mode_enhanced:1;
     uint8_t pfit_mode:2;
+    uint8_t pfit_text_mode_enhanced:1;
+    uint8_t pfit_gfx_mode_enhanced:1;
+    uint8_t pfit_ratio_auto:1;
+    uint8_t pixel_dither:1;
+    uint8_t lvds_edid:1;
+    uint8_t rsvd2:1;
     uint8_t rsvd4;
 } __attribute__((packed));


-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)




More information about the xorg mailing list