| 1 | /* |
| 2 | * (C) notaz, 2010 |
| 3 | * |
| 4 | * This work is licensed under the terms of the GNU GPLv2 or later. |
| 5 | * See the COPYING file in the top-level directory. |
| 6 | */ |
| 7 | |
| 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> |
| 10 | |
| 11 | #include "linux/fbdev.h" |
| 12 | |
| 13 | static struct vout_fbdev *fbdev; |
| 14 | void *pl_fbdev_buf; |
| 15 | |
| 16 | int pl_fbdev_init(void) |
| 17 | { |
| 18 | const char *fbdev_name; |
| 19 | int w, h; |
| 20 | |
| 21 | fbdev_name = getenv("FBDEV"); |
| 22 | if (fbdev_name == NULL) |
| 23 | fbdev_name = "/dev/fb0"; |
| 24 | |
| 25 | w = 640; |
| 26 | h = 512; // ?? |
| 27 | fbdev = vout_fbdev_init(fbdev_name, &w, &h, 0); |
| 28 | if (fbdev == NULL) |
| 29 | return -1; |
| 30 | |
| 31 | pl_fbdev_buf = vout_fbdev_flip(fbdev); |
| 32 | |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | int pl_fbdev_set_mode(int w, int h, int bpp) |
| 37 | { |
| 38 | printf("set mode %dx%d@%d\n", w, h, bpp); |
| 39 | return vout_fbdev_resize(fbdev, w, h, 0, 0, 0, 0, 0); |
| 40 | } |
| 41 | |
| 42 | void *pl_fbdev_flip(void) |
| 43 | { |
| 44 | pl_fbdev_buf = vout_fbdev_flip(fbdev); |
| 45 | return pl_fbdev_buf; |
| 46 | } |
| 47 | |
| 48 | void pl_fbdev_finish(void) |
| 49 | { |
| 50 | if (fbdev != NULL) |
| 51 | vout_fbdev_finish(fbdev); |
| 52 | fbdev = NULL; |
| 53 | } |
| 54 | |