From 1049b32166760bdc00106625e213d31a8fc60bad Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Mar 2013 14:19:25 +0100 Subject: [PATCH] Xfbdev: Handle unset fix.line_length Older frame buffer devices may not fill in fix.line_length, in which case it must be calculated by the application. Signed-off-by: Geert Uytterhoeven --- hw/kdrive/fbdev/fbdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index a8d36c6ac..7b29f42cd 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -206,6 +206,10 @@ fbdevScreenInitialize(KdScreenInfo * screen, FbdevScrPriv * scrpriv) depth = priv->var.bits_per_pixel; gray = priv->var.grayscale; + /* Calculate fix.line_length if it's zero */ + if (!priv->fix.line_length) + priv->fix.line_length = (priv->var.xres_virtual * depth + 7) / 8; + switch (priv->fix.visual) { case FB_VISUAL_PSEUDOCOLOR: if (gray) {