]>
Commit | Line | Data |
---|---|---|
94692dcd GH |
1 | #include "qemu/osdep.h" |
2 | #include "qapi/error.h" | |
0b8fa32f | 3 | #include "qemu/module.h" |
94692dcd | 4 | #include "hw/loader.h" |
a27bd6c7 | 5 | #include "hw/qdev-properties.h" |
94692dcd GH |
6 | #include "hw/display/ramfb.h" |
7 | #include "ui/console.h" | |
db1015e9 | 8 | #include "qom/object.h" |
94692dcd | 9 | |
db1015e9 | 10 | typedef struct RAMFBStandaloneState RAMFBStandaloneState; |
8110fa1d EH |
11 | DECLARE_INSTANCE_CHECKER(RAMFBStandaloneState, RAMFB, |
12 | TYPE_RAMFB_DEVICE) | |
94692dcd | 13 | |
db1015e9 | 14 | struct RAMFBStandaloneState { |
94692dcd GH |
15 | SysBusDevice parent_obj; |
16 | QemuConsole *con; | |
17 | RAMFBState *state; | |
db1015e9 | 18 | }; |
94692dcd GH |
19 | |
20 | static void display_update_wrapper(void *dev) | |
21 | { | |
22 | RAMFBStandaloneState *ramfb = RAMFB(dev); | |
23 | ||
24 | if (0 /* native driver active */) { | |
25 | /* non-standalone device would run native display update here */; | |
26 | } else { | |
27 | ramfb_display_update(ramfb->con, ramfb->state); | |
28 | } | |
29 | } | |
30 | ||
31 | static const GraphicHwOps wrapper_ops = { | |
32 | .gfx_update = display_update_wrapper, | |
33 | }; | |
34 | ||
35 | static void ramfb_realizefn(DeviceState *dev, Error **errp) | |
36 | { | |
37 | RAMFBStandaloneState *ramfb = RAMFB(dev); | |
38 | ||
39 | ramfb->con = graphic_console_init(dev, 0, &wrapper_ops, dev); | |
2fc979cb | 40 | ramfb->state = ramfb_setup(errp); |
94692dcd GH |
41 | } |
42 | ||
43 | static void ramfb_class_initfn(ObjectClass *klass, void *data) | |
44 | { | |
45 | DeviceClass *dc = DEVICE_CLASS(klass); | |
46 | ||
47 | set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); | |
48 | dc->realize = ramfb_realizefn; | |
49 | dc->desc = "ram framebuffer standalone device"; | |
50 | dc->user_creatable = true; | |
51 | } | |
52 | ||
53 | static const TypeInfo ramfb_info = { | |
54 | .name = TYPE_RAMFB_DEVICE, | |
55 | .parent = TYPE_SYS_BUS_DEVICE, | |
56 | .instance_size = sizeof(RAMFBStandaloneState), | |
57 | .class_init = ramfb_class_initfn, | |
58 | }; | |
59 | ||
60 | static void ramfb_register_types(void) | |
61 | { | |
62 | type_register_static(&ramfb_info); | |
63 | } | |
64 | ||
65 | type_init(ramfb_register_types) |