[PATCH 07/18] Xfbdev: Handle unset var.bits_per_pixel

Geert Uytterhoeven geert at linux-m68k.org
Wed Mar 27 06:20:40 PDT 2013


Older frame buffer devices may not fill in var.bits_per_pixel, in which
case it must be calculated by the application.

Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
---
 hw/kdrive/fbdev/fbdev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index a8d36c6..7b29f42 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) {
-- 
1.7.0.4



More information about the xorg-devel mailing list