1
2
3
4
5
6
7
8
9
10
11
12#ifndef BCM2835_FB_H
13#define BCM2835_FB_H
14
15#include "hw/sysbus.h"
16#include "ui/console.h"
17#include "qom/object.h"
18
19#define TYPE_BCM2835_FB "bcm2835-fb"
20OBJECT_DECLARE_SIMPLE_TYPE(BCM2835FBState, BCM2835_FB)
21
22
23
24
25
26typedef struct {
27 uint32_t xres, yres;
28 uint32_t xres_virtual, yres_virtual;
29 uint32_t xoffset, yoffset;
30 uint32_t bpp;
31 uint32_t base;
32 uint32_t pixo;
33 uint32_t alpha;
34} BCM2835FBConfig;
35
36struct BCM2835FBState {
37
38 SysBusDevice busdev;
39
40
41 uint32_t vcram_base, vcram_size;
42 MemoryRegion *dma_mr;
43 AddressSpace dma_as;
44 MemoryRegion iomem;
45 MemoryRegionSection fbsection;
46 QemuConsole *con;
47 qemu_irq mbox_irq;
48
49 bool lock, invalidate, pending;
50
51 BCM2835FBConfig config;
52 BCM2835FBConfig initial_config;
53};
54
55void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig);
56
57
58
59
60
61
62
63
64
65static inline uint32_t bcm2835_fb_get_pitch(BCM2835FBConfig *config)
66{
67 uint32_t xres = MAX(config->xres, config->xres_virtual);
68 return xres * (config->bpp >> 3);
69}
70
71
72
73
74
75static inline uint32_t bcm2835_fb_get_size(BCM2835FBConfig *config)
76{
77 uint32_t yres = MAX(config->yres, config->yres_virtual);
78 return yres * bcm2835_fb_get_pitch(config);
79}
80
81
82
83
84
85
86
87void bcm2835_fb_validate_config(BCM2835FBConfig *config);
88
89#endif
90