drm/fb: fix FBIOGET/PUT_VSCREENINFO pixel clock handling
authorClemens Ladisch <clemens@ladisch.de>
Wed, 2 Dec 2009 07:16:55 +0000 (08:16 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:22:43 +0000 (10:22 -0800)
commit 5349ef3127c77075ff70b2014f17ae0fbcaaf199 upstream

When the framebuffer driver does not publish detailed timing information
for the current video mode, the correct value for the pixclock field is
zero, not -1.

Since pixclock is actually unsigned, the value -1 would be interpreted
as 4294967295 picoseconds (i.e., about 4 milliseconds) by
register_framebuffer() and userspace programs.

This patch allows X.org's fbdev driver to work.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/radeon/radeon_fb.c

index 1d30802e773e383492c03aeabb99e6a3ddd623f2..75a9b83fd7d305fbf1d62559965cb27808af2c90 100644 (file)
@@ -114,7 +114,7 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
        struct drm_framebuffer *fb = &intel_fb->base;
        int depth;
 
-       if (var->pixclock == -1 || !var->pixclock)
+       if (var->pixclock != 0)
                return -EINVAL;
 
        /* Need to resize the fb object !!! */
@@ -205,7 +205,7 @@ static int intelfb_set_par(struct fb_info *info)
 
        DRM_DEBUG("%d %d\n", var->xres, var->pixclock);
 
-       if (var->pixclock != -1) {
+       if (var->pixclock != 0) {
 
                DRM_ERROR("PIXEL CLOCK SET\n");
                return -EINVAL;
@@ -692,7 +692,7 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc *
        par->crtc_count = 1;
 
        if (new_fb) {
-               info->var.pixclock = -1;
+               info->var.pixclock = 0;
                if (register_framebuffer(info) < 0)
                        return -EINVAL;
        } else
@@ -846,7 +846,7 @@ static int intelfb_single_fb_probe(struct drm_device *dev)
        par->crtc_count = crtc_count;
 
        if (new_fb) {
-               info->var.pixclock = -1;
+               info->var.pixclock = 0;
                if (register_framebuffer(info) < 0)
                        return -EINVAL;
        } else
index ec383edf5f38acb3370fb570a5553e792e45604f..f1d6d3d4519febe8e42448cfb62ed69c917dc35f 100644 (file)
@@ -120,7 +120,7 @@ static int radeonfb_check_var(struct fb_var_screeninfo *var,
        struct drm_framebuffer *fb = &rfb->base;
        int depth;
 
-       if (var->pixclock == -1 || !var->pixclock) {
+       if (var->pixclock != 0) {
                return -EINVAL;
        }
        /* Need to resize the fb object !!! */
@@ -234,7 +234,7 @@ static int radeonfb_set_par(struct fb_info *info)
        int ret;
        int i;
 
-       if (var->pixclock != -1) {
+       if (var->pixclock != 0) {
                DRM_ERROR("PIXEL CLCOK SET\n");
                return -EINVAL;
        }
@@ -828,7 +828,7 @@ static int radeonfb_single_fb_probe(struct radeon_device *rdev)
        rfbdev->crtc_count = crtc_count;
 
        if (new_fb) {
-               info->var.pixclock = -1;
+               info->var.pixclock = 0;
                if (register_framebuffer(info) < 0)
                        return -EINVAL;
        } else {