aboutsummaryrefslogtreecommitdiff
path: root/frontend/plugin_lib.c
blob: 5fd80cd782b4e52835a4018419d0c31aca0d4e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * (C) notaz, 2010
 *
 * This work is licensed under the terms of the GNU GPLv2 or later.
 * See the COPYING file in the top-level directory.
 */

#include <stdio.h>
#include <stdlib.h>

#include "linux/fbdev.h"

static struct vout_fbdev *fbdev;
void *pl_fbdev_buf;

int pl_fbdev_init(void)
{
  const char *fbdev_name;
  int w, h;

  fbdev_name = getenv("FBDEV");
  if (fbdev_name == NULL)
    fbdev_name = "/dev/fb0";

  w = 640;
  h = 512; // ??
  fbdev = vout_fbdev_init(fbdev_name, &w, &h, 0);
  if (fbdev == NULL)
    return -1;

  pl_fbdev_buf = vout_fbdev_flip(fbdev);

  return 0;
}

int pl_fbdev_set_mode(int w, int h, int bpp)
{
  printf("set mode %dx%d@%d\n", w, h, bpp);
  return vout_fbdev_resize(fbdev, w, h, 0, 0, 0, 0, 0);
}

void *pl_fbdev_flip(void)
{
  pl_fbdev_buf = vout_fbdev_flip(fbdev);
  return pl_fbdev_buf;
}

void pl_fbdev_finish(void)
{
  if (fbdev != NULL)
    vout_fbdev_finish(fbdev);
  fbdev = NULL;
}