]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add some tracing for the device query/mode verification code.
authorPeter Jones <pjones@redhat.com>
Thu, 12 Jun 2008 17:17:01 +0000 (13:17 -0400)
committerPeter Jones <pjones@vroomfondel.internal.datastacks.com>
Thu, 12 Jun 2008 17:19:30 +0000 (13:19 -0400)
src/libply/ply-frame-buffer.c
src/libply/tests/ply-frame-buffer-test.am
src/libply/tests/ply-image-test.am

index b713534400fcd9109d7f4611518e3a2d85ae8aab..871c536780172a9b6e74a1431bc3ba153132eb67 100644 (file)
@@ -22,6 +22,7 @@
  */
 #include "config.h"
 #include "ply-frame-buffer.h"
+#include "ply-logger.h"
 
 #include <arpa/inet.h>
 #include <assert.h>
@@ -202,6 +203,29 @@ flush_xrgb32 (ply_frame_buffer_t *buffer)
     }
 }
 
+static const char const *p_visual(int visual)
+{
+  static const char const *visuals[] =
+    {
+      [FB_VISUAL_MONO01] = "FB_VISUAL_MONO01",
+      [FB_VISUAL_MONO10] = "FB_VISUAL_MONO10",
+      [FB_VISUAL_TRUECOLOR] = "FB_VISUAL_TRUECOLOR",
+      [FB_VISUAL_PSEUDOCOLOR] = "FB_VISUAL_PSEUDOCOLOR",
+      [FB_VISUAL_DIRECTCOLOR] = "FB_VISUAL_DIRECTCOLOR",
+      [FB_VISUAL_STATIC_PSEUDOCOLOR] = "FB_VISUAL_STATIC_PSEUDOCOLOR",
+      NULL
+    };
+  static char unknown[] = "invalid visual: -4294967295";
+
+  if (visual < FB_VISUAL_MONO01 || visual > FB_VISUAL_STATIC_PSEUDOCOLOR)
+    {
+      sprintf(unknown, "invalid visual: %d", visual);
+      return unknown;
+    }
+
+  return visuals[visual];
+}
+
 static bool
 ply_frame_buffer_query_device (ply_frame_buffer_t *buffer)
 {
@@ -232,6 +256,9 @@ ply_frame_buffer_query_device (ply_frame_buffer_t *buffer)
       int i;
       int depths[] = {32, 24, 16, 0};
 
+      ply_trace("Visual was %s, trying to find usable mode.\n",
+                p_visual(fixed_screen_info.visual));
+
       for (i = 0; depths[i] != 0; i++)
         {
           variable_screen_info.bits_per_pixel = depths[i];
@@ -239,7 +266,12 @@ ply_frame_buffer_query_device (ply_frame_buffer_t *buffer)
 
           rc = ioctl(buffer->device_fd, FBIOPUT_VSCREENINFO, &variable_screen_info);
           if (rc >= 0)
-            break;
+            {
+              if (ioctl(buffer->device_fd, FBIOGET_FSCREENINFO, &fixed_screen_info) < 0)
+                return false;
+              if (fixed_screen_info.visual == FB_VISUAL_TRUECOLOR)
+                break;
+            }
         }
 
       if (ioctl(buffer->device_fd, FBIOGET_VSCREENINFO, &variable_screen_info) < 0)
@@ -251,7 +283,11 @@ ply_frame_buffer_query_device (ply_frame_buffer_t *buffer)
 
   if (fixed_screen_info.visual != FB_VISUAL_TRUECOLOR ||
       variable_screen_info.bits_per_pixel < 16)
-    return false;
+    {
+      ply_trace("Visual is %s; not using graphics\n", 
+                p_visual(fixed_screen_info.visual));
+      return false;
+    }
 
   buffer->area.x = variable_screen_info.xoffset;
   buffer->area.y = variable_screen_info.yoffset;
index 8f827fdf7ca3a20703c76f315948e240c8353302..a402201c74cad2711fc7f83f26cefef16c8623fc 100644 (file)
@@ -5,4 +5,8 @@ ply_frame_buffer_test_LDADD = $(PLYMOUTH_LIBS)
 ply_frame_buffer_test_SOURCES = \
                           $(srcdir)/../ply-utils.h                            \
                           $(srcdir)/../ply-frame-buffer.h                     \
-                          $(srcdir)/../ply-frame-buffer.c
+                          $(srcdir)/../ply-frame-buffer.c                     \
+                         $(srcdir)/../ply-logger.h                           \
+                         $(srcdir)/../ply-logger.c                           \
+                         $(srcdir)/../ply-utils.h                            \
+                         $(srcdir)/../ply-utils.c
index 08d7b27e32e33b29187540a703be4b65cd422e45..00f700168fcc72c2c5fa357f4bfc19b7b2ff4bd5 100644 (file)
@@ -7,4 +7,8 @@ ply_image_test_SOURCES =                                                      \
                           $(srcdir)/../ply-frame-buffer.h                     \
                           $(srcdir)/../ply-frame-buffer.c                     \
                           $(srcdir)/../ply-image.h                            \
-                          $(srcdir)/../ply-image.c 
+                          $(srcdir)/../ply-image.c                            \
+                         $(srcdir)/../ply-logger.h                           \
+                         $(srcdir)/../ply-logger.c                           \
+                         $(srcdir)/../ply-utils.h                            \
+                         $(srcdir)/../ply-utils.c