Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 154

kvm-83-270.el5_11.src.rpm

From f71a117e205fb8fc5f1c0dee0ec0b98d0b22d536 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Fri, 19 Jun 2009 18:39:33 -0300
Subject: [PATCH 1/2] Fix vga_screen_dump_blank() PPM generation (bz#500717)

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=500717

vga_screen_dump_blank() was not generating a valid PPM file: the width of the
image made no sense (why it was multiplied by sizeof(uint32_t)?), and there was
only one sample per pixel, instead of three.

Fixing it will improve the reliability of our internal testing, by
solving a kvm-autotest issue.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Bugzilla: 500717
RH-Upstream-status: applied(qemu/master)
Message-ID: <20090619213933.GA5213@blackpad>
Acked-by: Uri Lublin <uril@redhat.com>
Acked-by: Avi Kivity <avi@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qemu/hw/vga.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/vga.c b/qemu/hw/vga.c
index 17a2ceb..eae4f3e 100644
--- a/qemu/hw/vga.c
+++ b/qemu/hw/vga.c
@@ -2752,8 +2752,9 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename)
 {
     FILE *f;
     unsigned int y, x, w, h;
+    unsigned char blank_sample[3] = { 0, 0, 0 };
 
-    w = s->last_scr_width * sizeof(uint32_t);
+    w = s->last_scr_width;
     h = s->last_scr_height;
 
     f = fopen(filename, "wb");
@@ -2762,7 +2763,7 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename)
     fprintf(f, "P6\n%d %d\n%d\n", w, h, 255);
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
-            fputc(0, f);
+            fwrite(blank_sample, 3, 1, f);
         }
     }
     fclose(f);
-- 
1.6.3.rc4.29.g8146