Commit f707cfba9a5ee2d4ea6edc3d0588163141f285ad
1 parent
1eb5207b
Allow VMware-SVGA operation enable before command FIFO is configured. Implement…
… "screendump" for 32 bit colour depth. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2808 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
31 additions
and
23 deletions
hw/vga.c
| @@ -2036,8 +2036,8 @@ static void vga_save_dpy_refresh(DisplayState *s) | @@ -2036,8 +2036,8 @@ static void vga_save_dpy_refresh(DisplayState *s) | ||
| 2036 | { | 2036 | { |
| 2037 | } | 2037 | } |
| 2038 | 2038 | ||
| 2039 | -static int ppm_save(const char *filename, uint8_t *data, | ||
| 2040 | - int w, int h, int linesize) | 2039 | +int ppm_save(const char *filename, uint8_t *data, |
| 2040 | + int w, int h, int linesize) | ||
| 2041 | { | 2041 | { |
| 2042 | FILE *f; | 2042 | FILE *f; |
| 2043 | uint8_t *d, *d1; | 2043 | uint8_t *d, *d1; |
hw/vga_int.h
| @@ -166,6 +166,8 @@ void vga_init(VGAState *s); | @@ -166,6 +166,8 @@ void vga_init(VGAState *s); | ||
| 166 | uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr); | 166 | uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr); |
| 167 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val); | 167 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val); |
| 168 | void vga_invalidate_scanlines(VGAState *s, int y1, int y2); | 168 | void vga_invalidate_scanlines(VGAState *s, int y1, int y2); |
| 169 | +int ppm_save(const char *filename, uint8_t *data, | ||
| 170 | + int w, int h, int linesize); | ||
| 169 | 171 | ||
| 170 | void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1, | 172 | void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1, |
| 171 | int poffset, int w, | 173 | int poffset, int w, |
hw/vmware_vga.c
| @@ -226,18 +226,19 @@ enum { | @@ -226,18 +226,19 @@ enum { | ||
| 226 | #ifdef VERBOSE | 226 | #ifdef VERBOSE |
| 227 | # define GUEST_OS_BASE 0x5001 | 227 | # define GUEST_OS_BASE 0x5001 |
| 228 | static const char *vmsvga_guest_id[] = { | 228 | static const char *vmsvga_guest_id[] = { |
| 229 | - [0x0] = "Dos", | ||
| 230 | - [0x1] = "Windows 3.1", | ||
| 231 | - [0x2] = "Windows 95", | ||
| 232 | - [0x3] = "Windows 98", | ||
| 233 | - [0x4] = "Windows ME", | ||
| 234 | - [0x5] = "Windows NT", | ||
| 235 | - [0x6] = "Windows 2000", | ||
| 236 | - [0x7] = "Linux", | ||
| 237 | - [0x8] = "OS/2", | ||
| 238 | - [0x9] = "Unknown", | ||
| 239 | - [0xa] = "BSD", | ||
| 240 | - [0xb] = "Whistler", | 229 | + [0x00 ... 0x15] = "an unknown OS", |
| 230 | + [0x00] = "Dos", | ||
| 231 | + [0x01] = "Windows 3.1", | ||
| 232 | + [0x02] = "Windows 95", | ||
| 233 | + [0x03] = "Windows 98", | ||
| 234 | + [0x04] = "Windows ME", | ||
| 235 | + [0x05] = "Windows NT", | ||
| 236 | + [0x06] = "Windows 2000", | ||
| 237 | + [0x07] = "Linux", | ||
| 238 | + [0x08] = "OS/2", | ||
| 239 | + [0x0a] = "BSD", | ||
| 240 | + [0x0b] = "Whistler", | ||
| 241 | + [0x15] = "Windows 2003", | ||
| 241 | }; | 242 | }; |
| 242 | #endif | 243 | #endif |
| 243 | 244 | ||
| @@ -459,7 +460,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, | @@ -459,7 +460,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, | ||
| 459 | static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) | 460 | static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) |
| 460 | { | 461 | { |
| 461 | if (!s->config || !s->enable) | 462 | if (!s->config || !s->enable) |
| 462 | - return 0; | 463 | + return 1; |
| 463 | return (s->cmd->next_cmd == s->cmd->stop); | 464 | return (s->cmd->next_cmd == s->cmd->stop); |
| 464 | } | 465 | } |
| 465 | 466 | ||
| @@ -619,7 +620,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) | @@ -619,7 +620,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) | ||
| 619 | return SVGA_MAX_WIDTH; | 620 | return SVGA_MAX_WIDTH; |
| 620 | 621 | ||
| 621 | case SVGA_REG_MAX_HEIGHT: | 622 | case SVGA_REG_MAX_HEIGHT: |
| 622 | - return SVGA_MAX_WIDTH; | 623 | + return SVGA_MAX_HEIGHT; |
| 623 | 624 | ||
| 624 | case SVGA_REG_DEPTH: | 625 | case SVGA_REG_DEPTH: |
| 625 | return s->depth; | 626 | return s->depth; |
| @@ -727,7 +728,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) | @@ -727,7 +728,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) | ||
| 727 | break; | 728 | break; |
| 728 | 729 | ||
| 729 | case SVGA_REG_ENABLE: | 730 | case SVGA_REG_ENABLE: |
| 730 | - s->enable = s->config = value & s->config; | 731 | + s->enable = value; |
| 732 | + s->config &= !!value; | ||
| 731 | s->width = -1; | 733 | s->width = -1; |
| 732 | s->height = -1; | 734 | s->height = -1; |
| 733 | s->invalidated = 1; | 735 | s->invalidated = 1; |
| @@ -770,7 +772,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) | @@ -770,7 +772,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) | ||
| 770 | if (s->cmd->max < s->cmd->min + 10 * 1024) | 772 | if (s->cmd->max < s->cmd->min + 10 * 1024) |
| 771 | break; | 773 | break; |
| 772 | } | 774 | } |
| 773 | - s->config = value; | 775 | + s->config = !!value; |
| 774 | break; | 776 | break; |
| 775 | 777 | ||
| 776 | case SVGA_REG_SYNC: | 778 | case SVGA_REG_SYNC: |
| @@ -902,14 +904,14 @@ static void vmsvga_reset(struct vmsvga_state_s *s) | @@ -902,14 +904,14 @@ static void vmsvga_reset(struct vmsvga_state_s *s) | ||
| 902 | s->wblue = 0x0000f800; | 904 | s->wblue = 0x0000f800; |
| 903 | break; | 905 | break; |
| 904 | case 24: | 906 | case 24: |
| 905 | - s->wred = 0x000000ff; | 907 | + s->wred = 0x00ff0000; |
| 906 | s->wgreen = 0x0000ff00; | 908 | s->wgreen = 0x0000ff00; |
| 907 | - s->wblue = 0x00ff0000; | 909 | + s->wblue = 0x000000ff; |
| 908 | break; | 910 | break; |
| 909 | case 32: | 911 | case 32: |
| 910 | - s->wred = 0x000000ff; | 912 | + s->wred = 0x00ff0000; |
| 911 | s->wgreen = 0x0000ff00; | 913 | s->wgreen = 0x0000ff00; |
| 912 | - s->wblue = 0x00ff0000; | 914 | + s->wblue = 0x000000ff; |
| 913 | break; | 915 | break; |
| 914 | } | 916 | } |
| 915 | s->syncing = 0; | 917 | s->syncing = 0; |
| @@ -928,6 +930,8 @@ static void vmsvga_invalidate_display(void *opaque) | @@ -928,6 +930,8 @@ static void vmsvga_invalidate_display(void *opaque) | ||
| 928 | s->invalidated = 1; | 930 | s->invalidated = 1; |
| 929 | } | 931 | } |
| 930 | 932 | ||
| 933 | +/* save the vga display in a PPM image even if no display is | ||
| 934 | + available */ | ||
| 931 | static void vmsvga_screen_dump(void *opaque, const char *filename) | 935 | static void vmsvga_screen_dump(void *opaque, const char *filename) |
| 932 | { | 936 | { |
| 933 | struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque; | 937 | struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque; |
| @@ -938,7 +942,9 @@ static void vmsvga_screen_dump(void *opaque, const char *filename) | @@ -938,7 +942,9 @@ static void vmsvga_screen_dump(void *opaque, const char *filename) | ||
| 938 | return; | 942 | return; |
| 939 | } | 943 | } |
| 940 | 944 | ||
| 941 | - /* TODO */ | 945 | + if (s->depth == 32) { |
| 946 | + ppm_save(filename, s->vram, s->width, s->height, s->ds->linesize); | ||
| 947 | + } | ||
| 942 | } | 948 | } |
| 943 | 949 | ||
| 944 | #ifdef DIRECT_VRAM | 950 | #ifdef DIRECT_VRAM |