changeset 30206:c3b1e5e728a4

Fix vo_fbdev to also work with Intel framebuffer.
author reimar
date Sat, 09 Jan 2010 11:26:39 +0000
parents 089c49dd7f9f
children 6d8765b75f37
files libvo/vo_fbdev.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_fbdev.c	Fri Jan 08 21:50:32 2010 +0000
+++ b/libvo/vo_fbdev.c	Sat Jan 09 11:26:39 2010 +0000
@@ -692,8 +692,9 @@
         mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno));
     }
 
-    fb_bpp = fb_vinfo.red.length  + fb_vinfo.green.length +
-             fb_vinfo.blue.length + fb_vinfo.transp.length;
+    fb_bpp = fb_vinfo.bits_per_pixel;
+    if (fb_bpp == 16)
+        fb_bpp = fb_vinfo.red.length  + fb_vinfo.green.length + fb_vinfo.blue.length;
 
     if (fb_bpp == 8 && !vo_dbpp) {
         mp_msg(MSGT_VO, MSGL_ERR, "8 bpp output is not supported.\n");
@@ -811,6 +812,9 @@
         fb_tty_fd = -1;
     }
 
+    if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo))
+        // Intel drivers fail if we request a transparency channel
+        fb_vinfo.transp.length = fb_vinfo.transp.offset = 0;
     if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
         mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno));
         if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) {
@@ -820,8 +824,9 @@
     }
 
     fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
-    fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
-        fb_vinfo.blue.length + fb_vinfo.transp.length;
+    fb_bpp = fb_vinfo.bits_per_pixel;
+    if (fb_bpp == 16)
+        fb_bpp = fb_vinfo.red.length  + fb_vinfo.green.length + fb_vinfo.blue.length;
     if (fb_bpp_we_want != fb_bpp)
         mp_msg(MSGT_VO, MSGL_WARN, "requested %d bpp, got %d bpp!!!\n",
                fb_bpp_we_want, fb_bpp);