summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2008-06-12 13:17:01 -0400
committerPeter Jones <pjones@vroomfondel.internal.datastacks.com>2008-06-12 13:19:30 -0400
commit21d5757e08618bf9f1451930d007155d55d2e59b (patch)
tree1d829018e7648bfce8c92d52c92fce91127f3f33
parentf7ac6f80da9c6ca26d749bc9332ba14add7d714d (diff)
downloadplymouth-21d5757e08618bf9f1451930d007155d55d2e59b.tar.gz
plymouth-21d5757e08618bf9f1451930d007155d55d2e59b.tar.xz
plymouth-21d5757e08618bf9f1451930d007155d55d2e59b.zip
Add some tracing for the device query/mode verification code.
-rw-r--r--src/libply/ply-frame-buffer.c40
-rw-r--r--src/libply/tests/ply-frame-buffer-test.am6
-rw-r--r--src/libply/tests/ply-image-test.am6
3 files changed, 48 insertions, 4 deletions
diff --git a/src/libply/ply-frame-buffer.c b/src/libply/ply-frame-buffer.c
index b713534..871c536 100644
--- a/src/libply/ply-frame-buffer.c
+++ b/src/libply/ply-frame-buffer.c
@@ -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;
diff --git a/src/libply/tests/ply-frame-buffer-test.am b/src/libply/tests/ply-frame-buffer-test.am
index 8f827fd..a402201 100644
--- a/src/libply/tests/ply-frame-buffer-test.am
+++ b/src/libply/tests/ply-frame-buffer-test.am
@@ -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
diff --git a/src/libply/tests/ply-image-test.am b/src/libply/tests/ply-image-test.am
index 08d7b27..00f7001 100644
--- a/src/libply/tests/ply-image-test.am
+++ b/src/libply/tests/ply-image-test.am
@@ -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