aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Dänzer <michel@daenzer.net>2009-06-23 06:36:32 -0400
committerDave Airlie <airlied@linux.ie>2009-06-24 02:11:04 -0400
commite14cbee401cd00779a5267128371506b22c77bc9 (patch)
tree33707db9beab3a928cfc9b182efcb46c73db863a
parentb1e3a6d1c4d0ac75ad8289bcfd69efcc9b1bc6e5 (diff)
drm: Fix shifts which were miscalculated when converting from bitfields.
Looks like I managed to mess up most shifts when converting from bitfields. :( The patch below works on my Thinkpad T500 (as well as on my PowerBook, where the previous change worked as well, maybe out of luck...). I'd appreciate more testing and eyes looking over it though. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Tested-by: Michael Pyne <mpyne@kde.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--drivers/gpu/drm/drm_edid.c12
-rw-r--r--include/drm/drm_edid.h38
2 files changed, 25 insertions, 25 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7d0835226f6e..80cc6d06d61b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -294,10 +294,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
294 unsigned vactive = (pt->vactive_vblank_hi & 0xf0) << 4 | pt->vactive_lo; 294 unsigned vactive = (pt->vactive_vblank_hi & 0xf0) << 4 | pt->vactive_lo;
295 unsigned hblank = (pt->hactive_hblank_hi & 0xf) << 8 | pt->hblank_lo; 295 unsigned hblank = (pt->hactive_hblank_hi & 0xf) << 8 | pt->hblank_lo;
296 unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; 296 unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo;
297 unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 8 | pt->hsync_offset_lo; 297 unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo;
298 unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 6 | pt->hsync_pulse_width_lo; 298 unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo;
299 unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) | (pt->vsync_offset_pulse_width_lo & 0xf); 299 unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4;
300 unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; 300 unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf);
301 301
302 /* ignore tiny modes */ 302 /* ignore tiny modes */
303 if (hactive < 64 || vactive < 64) 303 if (hactive < 64 || vactive < 64)
@@ -347,8 +347,8 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
347 mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ? 347 mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
348 DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC; 348 DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
349 349
350 mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf) << 8; 350 mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4;
351 mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4; 351 mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8;
352 352
353 if (quirks & EDID_QUIRK_DETAILED_IN_CM) { 353 if (quirks & EDID_QUIRK_DETAILED_IN_CM) {
354 mode->width_mm *= 10; 354 mode->width_mm *= 10;
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index c263e4d71754..7d6c9a2dfcbb 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -35,11 +35,11 @@ struct est_timings {
35} __attribute__((packed)); 35} __attribute__((packed));
36 36
37/* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */ 37/* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
38#define EDID_TIMING_ASPECT_SHIFT 0 38#define EDID_TIMING_ASPECT_SHIFT 6
39#define EDID_TIMING_ASPECT_MASK (0x3 << EDID_TIMING_ASPECT_SHIFT) 39#define EDID_TIMING_ASPECT_MASK (0x3 << EDID_TIMING_ASPECT_SHIFT)
40 40
41/* need to add 60 */ 41/* need to add 60 */
42#define EDID_TIMING_VFREQ_SHIFT 2 42#define EDID_TIMING_VFREQ_SHIFT 0
43#define EDID_TIMING_VFREQ_MASK (0x3f << EDID_TIMING_VFREQ_SHIFT) 43#define EDID_TIMING_VFREQ_MASK (0x3f << EDID_TIMING_VFREQ_SHIFT)
44 44
45struct std_timing { 45struct std_timing {
@@ -47,11 +47,11 @@ struct std_timing {
47 u8 vfreq_aspect; 47 u8 vfreq_aspect;
48} __attribute__((packed)); 48} __attribute__((packed));
49 49
50#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 6) 50#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
51#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 5) 51#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
52#define DRM_EDID_PT_SEPARATE_SYNC (3 << 3) 52#define DRM_EDID_PT_SEPARATE_SYNC (3 << 3)
53#define DRM_EDID_PT_STEREO (1 << 2) 53#define DRM_EDID_PT_STEREO (1 << 5)
54#define DRM_EDID_PT_INTERLACED (1 << 1) 54#define DRM_EDID_PT_INTERLACED (1 << 7)
55 55
56/* If detailed data is pixel timing */ 56/* If detailed data is pixel timing */
57struct detailed_pixel_timing { 57struct detailed_pixel_timing {
@@ -93,7 +93,7 @@ struct detailed_data_monitor_range {
93} __attribute__((packed)); 93} __attribute__((packed));
94 94
95struct detailed_data_wpindex { 95struct detailed_data_wpindex {
96 u8 white_xy_lo; /* Upper 2 bits each */ 96 u8 white_yx_lo; /* Lower 2 bits each */
97 u8 white_x_hi; 97 u8 white_x_hi;
98 u8 white_y_hi; 98 u8 white_y_hi;
99 u8 gamma; /* need to divide by 100 then add 1 */ 99 u8 gamma; /* need to divide by 100 then add 1 */
@@ -135,21 +135,21 @@ struct detailed_timing {
135 } data; 135 } data;
136} __attribute__((packed)); 136} __attribute__((packed));
137 137
138#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 7) 138#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
139#define DRM_EDID_INPUT_SYNC_ON_GREEN (1 << 5) 139#define DRM_EDID_INPUT_SYNC_ON_GREEN (1 << 1)
140#define DRM_EDID_INPUT_COMPOSITE_SYNC (1 << 4) 140#define DRM_EDID_INPUT_COMPOSITE_SYNC (1 << 2)
141#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3) 141#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3)
142#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 2) 142#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4)
143#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 1) 143#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5)
144#define DRM_EDID_INPUT_DIGITAL (1 << 0) /* bits above must be zero if set */ 144#define DRM_EDID_INPUT_DIGITAL (1 << 7) /* bits below must be zero if set */
145 145
146#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 7) 146#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0)
147#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 6) 147#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1)
148#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 5) 148#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2)
149#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */ 149#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
150#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 2) 150#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 5)
151#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 1) 151#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6)
152#define DRM_EDID_FEATURE_PM_STANDBY (1 << 0) 152#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7)
153 153
154struct edid { 154struct edid {
155 u8 header[8]; 155 u8 header[8];