diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2009-10-13 21:11:25 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-10-15 18:49:27 -0400 |
commit | f059d2ad69b056aeabad4460f706a3df2f77ce50 (patch) | |
tree | 93d804337d7bee1f6196dd51811488d6d2d37098 | |
parent | a77f171843d466d4af0d527bcb2d314fafa8afd7 (diff) |
drm: Add the basic check for the detailed timing in EDID
Sometimes we will get the incorrect display modeline when parsing the detailed
timing in EDID. For example:
>hsync/vsync width is zero
>sync is beyond the blank.
So add the basic check for the detailed timing in EDID to avoid the incorrect
display modeline.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3c0d2b3aed76..cea665d86dd3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -626,6 +626,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
626 | return NULL; | 626 | return NULL; |
627 | } | 627 | } |
628 | 628 | ||
629 | /* it is incorrect if hsync/vsync width is zero */ | ||
630 | if (!hsync_pulse_width || !vsync_pulse_width) { | ||
631 | DRM_DEBUG_KMS("Incorrect Detailed timing. " | ||
632 | "Wrong Hsync/Vsync pulse width\n"); | ||
633 | return NULL; | ||
634 | } | ||
629 | mode = drm_mode_create(dev); | 635 | mode = drm_mode_create(dev); |
630 | if (!mode) | 636 | if (!mode) |
631 | return NULL; | 637 | return NULL; |
@@ -647,6 +653,15 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
647 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; | 653 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; |
648 | mode->vtotal = mode->vdisplay + vblank; | 654 | mode->vtotal = mode->vdisplay + vblank; |
649 | 655 | ||
656 | /* perform the basic check for the detailed timing */ | ||
657 | if (mode->hsync_end > mode->htotal || | ||
658 | mode->vsync_end > mode->vtotal) { | ||
659 | drm_mode_destroy(dev, mode); | ||
660 | DRM_DEBUG_KMS("Incorrect detailed timing. " | ||
661 | "Sync is beyond the blank.\n"); | ||
662 | return NULL; | ||
663 | } | ||
664 | |||
650 | drm_mode_set_name(mode); | 665 | drm_mode_set_name(mode); |
651 | 666 | ||
652 | if (pt->misc & DRM_EDID_PT_INTERLACED) | 667 | if (pt->misc & DRM_EDID_PT_INTERLACED) |