add support for 24bpp mode
[pcsx_rearmed.git] / frontend / plugin_lib.c
CommitLineData
b60f2812 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
13static struct vout_fbdev *fbdev;
14void *pl_fbdev_buf;
15
16int 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; // ??
1972732a 27 fbdev = vout_fbdev_init(fbdev_name, &w, &h, 16, 3);
b60f2812 28 if (fbdev == NULL)
29 return -1;
30
31 pl_fbdev_buf = vout_fbdev_flip(fbdev);
32
33 return 0;
34}
35
36int pl_fbdev_set_mode(int w, int h, int bpp)
37{
38 printf("set mode %dx%d@%d\n", w, h, bpp);
1972732a 39 return vout_fbdev_resize(fbdev, w, h, bpp, 0, 0, 0, 0, 3);
b60f2812 40}
41
42void *pl_fbdev_flip(void)
43{
44 pl_fbdev_buf = vout_fbdev_flip(fbdev);
45 return pl_fbdev_buf;
46}
47
48void pl_fbdev_finish(void)
49{
50 if (fbdev != NULL)
51 vout_fbdev_finish(fbdev);
52 fbdev = NULL;
53}
54