diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu-0.12.4/qemu-vmware-vga-depth.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu-0.12.4/qemu-vmware-vga-depth.patch | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-0.12.4/qemu-vmware-vga-depth.patch b/meta/recipes-devtools/qemu/qemu-0.12.4/qemu-vmware-vga-depth.patch new file mode 100644 index 0000000000..43071868f3 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-0.12.4/qemu-vmware-vga-depth.patch | |||
@@ -0,0 +1,115 @@ | |||
1 | # fix VMware VGA driver depth calculation error, which may cause segmentation fault | ||
2 | # | ||
3 | # ktian1, 06/29/2010 | ||
4 | diff --git a/console.h b/console.h | ||
5 | index dfc8ae4..05fbf17 100644 | ||
6 | --- a/console.h | ||
7 | +++ b/console.h | ||
8 | @@ -122,6 +122,12 @@ struct DisplayAllocator { | ||
9 | void (*free_displaysurface)(DisplaySurface *surface); | ||
10 | }; | ||
11 | |||
12 | +struct DisplayPostCallback { | ||
13 | + void (*postcall) (void *); | ||
14 | + void *parm; | ||
15 | + struct DisplayPostCallback *next; | ||
16 | +}; | ||
17 | + | ||
18 | struct DisplayState { | ||
19 | struct DisplaySurface *surface; | ||
20 | void *opaque; | ||
21 | @@ -129,6 +135,7 @@ struct DisplayState { | ||
22 | |||
23 | struct DisplayAllocator* allocator; | ||
24 | struct DisplayChangeListener* listeners; | ||
25 | + struct DisplayPostCallback* postcalls; | ||
26 | |||
27 | void (*mouse_set)(int x, int y, int on); | ||
28 | void (*cursor_define)(int width, int height, int bpp, int hot_x, int hot_y, | ||
29 | @@ -185,6 +192,12 @@ static inline void register_displaychangelistener(DisplayState *ds, DisplayChang | ||
30 | ds->listeners = dcl; | ||
31 | } | ||
32 | |||
33 | +static inline void register_displaypostcallback(DisplayState *ds, DisplayPostCallback *dpc) | ||
34 | +{ | ||
35 | + dpc->next = ds->postcalls; | ||
36 | + ds->postcalls = dpc; | ||
37 | +} | ||
38 | + | ||
39 | static inline void dpy_update(DisplayState *s, int x, int y, int w, int h) | ||
40 | { | ||
41 | struct DisplayChangeListener *dcl = s->listeners; | ||
42 | diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c | ||
43 | index 01bb85b..d73cca6 100644 | ||
44 | --- a/hw/vmware_vga.c | ||
45 | +++ b/hw/vmware_vga.c | ||
46 | @@ -927,8 +927,9 @@ static void vmsvga_update_display(void *opaque) | ||
47 | } | ||
48 | } | ||
49 | |||
50 | -static void vmsvga_reset(struct vmsvga_state_s *s) | ||
51 | +static void vmsvga_reset(void *parm) | ||
52 | { | ||
53 | + struct vmsvga_state_s *s = (struct vmsvga_state_s *)parm; | ||
54 | s->index = 0; | ||
55 | s->enable = 0; | ||
56 | s->config = 0; | ||
57 | @@ -1133,6 +1134,8 @@ static const VMStateDescription vmstate_vmware_vga = { | ||
58 | |||
59 | static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) | ||
60 | { | ||
61 | + DisplayPostCallback *dpc; | ||
62 | + | ||
63 | s->scratch_size = SVGA_SCRATCH_SIZE; | ||
64 | s->scratch = qemu_malloc(s->scratch_size * 4); | ||
65 | |||
66 | @@ -1160,7 +1163,10 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) | ||
67 | |||
68 | rom_add_vga(VGABIOS_FILENAME); | ||
69 | |||
70 | - vmsvga_reset(s); | ||
71 | + dpc = qemu_mallocz(sizeof(DisplayPostCallback)); | ||
72 | + dpc->postcall = vmsvga_reset; | ||
73 | + dpc->parm = s; | ||
74 | + register_displaypostcallback(s->vga.ds, dpc); | ||
75 | } | ||
76 | |||
77 | static void pci_vmsvga_map_ioport(PCIDevice *pci_dev, int region_num, | ||
78 | diff --git a/qemu-common.h b/qemu-common.h | ||
79 | index a23afbc..19f107a 100644 | ||
80 | --- a/qemu-common.h | ||
81 | +++ b/qemu-common.h | ||
82 | @@ -198,6 +198,7 @@ typedef struct DisplayState DisplayState; | ||
83 | typedef struct DisplayChangeListener DisplayChangeListener; | ||
84 | typedef struct DisplaySurface DisplaySurface; | ||
85 | typedef struct DisplayAllocator DisplayAllocator; | ||
86 | +typedef struct DisplayPostCallback DisplayPostCallback; | ||
87 | typedef struct PixelFormat PixelFormat; | ||
88 | typedef struct TextConsole TextConsole; | ||
89 | typedef TextConsole QEMUConsole; | ||
90 | diff --git a/vl.c b/vl.c | ||
91 | index 39182ea..9a3e9fd 100644 | ||
92 | --- a/vl.c | ||
93 | +++ b/vl.c | ||
94 | @@ -4863,6 +4863,7 @@ int main(int argc, char **argv, char **envp) | ||
95 | char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */ | ||
96 | DisplayState *ds; | ||
97 | DisplayChangeListener *dcl; | ||
98 | + DisplayPostCallback *dpc; | ||
99 | int cyls, heads, secs, translation; | ||
100 | QemuOpts *hda_opts = NULL, *opts; | ||
101 | int optind; | ||
102 | @@ -6053,6 +6053,13 @@ int main(int argc, char **argv, char **envp) | ||
103 | } | ||
104 | dpy_resize(ds); | ||
105 | |||
106 | + dpc = ds->postcalls; | ||
107 | + while (dpc != NULL) { | ||
108 | + if (dpc->postcall != NULL) | ||
109 | + dpc->postcall(dpc->parm); | ||
110 | + dpc = dpc->next; | ||
111 | + } | ||
112 | + | ||
113 | dcl = ds->listeners; | ||
114 | while (dcl != NULL) { | ||
115 | if (dcl->dpy_refresh != NULL) { | ||