Commit 5349ef31 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Dave Airlie

drm/fb: fix FBIOGET/PUT_VSCREENINFO pixel clock handling

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: default avatarClemens Ladisch <clemens@ladisch.de>
Tested-by: default avatarPaulius Zaleckas <paulius.zaleckas@gmail.com>
Cc: stable@kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 79cc304f
...@@ -599,7 +599,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, ...@@ -599,7 +599,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
struct drm_framebuffer *fb = fb_helper->fb; struct drm_framebuffer *fb = fb_helper->fb;
int depth; int depth;
if (var->pixclock == -1 || !var->pixclock) if (var->pixclock != 0)
return -EINVAL; return -EINVAL;
/* Need to resize the fb object !!! */ /* Need to resize the fb object !!! */
...@@ -691,7 +691,7 @@ int drm_fb_helper_set_par(struct fb_info *info) ...@@ -691,7 +691,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
int ret; int ret;
int i; int i;
if (var->pixclock != -1) { if (var->pixclock != 0) {
DRM_ERROR("PIXEL CLCOK SET\n"); DRM_ERROR("PIXEL CLCOK SET\n");
return -EINVAL; return -EINVAL;
} }
...@@ -904,7 +904,7 @@ int drm_fb_helper_single_fb_probe(struct drm_device *dev, ...@@ -904,7 +904,7 @@ int drm_fb_helper_single_fb_probe(struct drm_device *dev,
fb_helper->fb = fb; fb_helper->fb = fb;
if (new_fb) { if (new_fb) {
info->var.pixclock = -1; info->var.pixclock = 0;
if (register_framebuffer(info) < 0) if (register_framebuffer(info) < 0)
return -EINVAL; return -EINVAL;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment