changeset 35052:60e92b725c3d

Remove unused fb_bpp and change fb_pixel_size initialization so it will be easier to make work with yuv framebuffer.
author reimar
date Sun, 02 Sep 2012 22:16:17 +0000
parents fdd4b7d35537
children dda2444f4825
files libvo/vo_fbdev2.c
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_fbdev2.c	Sun Sep 02 22:06:01 2012 +0000
+++ b/libvo/vo_fbdev2.c	Sun Sep 02 22:16:17 2012 +0000
@@ -100,7 +100,6 @@
 static struct fb_cmap fb_oldcmap = { 0, 256, fb_ored, fb_ogreen, fb_oblue };
 static int fb_cmap_changed = 0; //  to restore map
 static int fb_pixel_size;	// 32:  4  24:  3  16:  2  15:  2
-static int fb_bpp;		// 32: 32  24: 24  16: 16  15: 15
 static size_t fb_size; // size of frame_buffer
 static int fb_line_len; // length of one line in bytes
 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
@@ -183,13 +182,6 @@
 	}
 	fb_orig_vinfo = fb_vinfo;
 
-	fb_bpp = fb_vinfo.bits_per_pixel;
-
-	/* 16 and 15 bpp is reported as 16 bpp */
-	if (fb_bpp == 16)
-		fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
-			fb_vinfo.blue.length;
-
 	fb_err = 0;
 	return 0;
 err_out:
@@ -230,6 +222,7 @@
 	}
 
 	draw_alpha_p = vo_get_draw_alpha(format);
+	fb_pixel_size = pixel_stride(format);
 
 	if (vo_config_count == 0) {
 		if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
@@ -296,6 +289,7 @@
 	// open the device, etc.
 	if (fb_preinit(0)) return 0;
 	if (IMGFMT_IS_BGR(format)) {
+		int bpp;
 		int fb_target_bpp = format & 0xff;
 		set_bpp(&fb_vinfo, fb_target_bpp);
 		fb_vinfo.xres_virtual = fb_vinfo.xres;
@@ -307,11 +301,10 @@
 			mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't put VSCREENINFO: %s\n", strerror(errno));
 			return 0;
 		}
-		fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
-		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 == fb_target_bpp)
+		bpp = fb_vinfo.bits_per_pixel;
+		if (bpp == 16)
+			bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
+		if (bpp == fb_target_bpp)
 			return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
 	}
 	return 0;