use trace events and fix garbled output
cover use trace events and fix garbled output
This patchset supersedes the earlier submission and incorporates feedback from Laurent Vivier and Gerd Hoffmann.
There are two patches addressing the following in the vmware vga display code
- use of fprintf to log debug output to STDERR
This has been replaced with trace events.
- garbled display due to lost display updates
This prevents an issue that can cause garbled display output when a high number of screen updates are being requested.
The queue is now flushed when it reaches capacity.
The code traversing the queue when updates are being applied to the display has also been simplified, since we always start the traversal at the beginning of the queue to ensure that all updates are applied.
Carwyn Ellis (2):
hw/display/vmware_vga: replace fprintf calls with trace events hw/display/vmware_vga: do not discard screen updates
hw/display/trace-events | 4 +++ hw/display/vmware_vga.c | 63 +++++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 30 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 hw/display/vmware_vga: replace fprintf calls with trace events
Debug output was always being sent to STDERR.
This has been replaced with trace events.
--- hw/display/trace-events | 3 +++ hw/display/vmware_vga.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-)
hw/display/trace-events +3 -0
@@ -21,6 +21,9 @@ vmware_palette_write(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_scratch_read(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_scratch_write(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp" +vmware_verify_rect_less_than_zero(const char *name, const char *param, int x) "%s: %s was < 0 (%d)" +vmware_verify_rect_greater_than_bound(const char *name, const char *param, int bound, int x) "%s: %s was > %d (%d)" +vmware_verify_rect_surface_bound_exceeded(const char *name, const char *component, int bound, const char *param1, int value1, const char *param2, int value2) "%s: %s > %d (%s: %d, %s, %d)" # virtio-gpu-base.c virtio_gpu_features(bool virgl) "virgl %d"
hw/display/vmware_vga.c +10 -12
@@ -297,46 +297,44 @@ static inline bool vmsvga_verify_rect(DisplaySurface *surface, int x, int y, int w, int h) { if (x < 0) { - fprintf(stderr, "%s: x was < 0 (%d)\n", name, x); + trace_vmware_verify_rect_less_than_zero(name, "x", x);return false; }if (x >SVGA_MAX_WIDTH ) { -fprintf (stderr,"%s: x was > %d (%d)\n" , name,SVGA_MAX_WIDTH , x); +trace_vmware_verify_rect_greater_than_bound (name,"x" ,SVGA_MAX_WIDTH , x);return false; }if (w <0 ) { -fprintf (stderr,"%s: w was < 0 (%d)\n" , name, w); +trace_vmware_verify_rect_less_than_zero (name,"w" , w);return false; }if (w >SVGA_MAX_WIDTH ) { -fprintf (stderr,"%s: w was > %d (%d)\n" , name,SVGA_MAX_WIDTH , w); +trace_vmware_verify_rect_greater_than_bound (name,"w" ,SVGA_MAX_WIDTH , w);return false; }if (x + w >surface_width (surface)) { -fprintf (stderr,"%s: width was > %d (x: %d, w: %d)\n" , - name,surface_width (surface), x, w); +trace_vmware_verify_rect_surface_bound_exceeded (name,"width" ,surface_width (surface),"x" , x,"w" , w);return false; }if (y <0 ) { -fprintf (stderr,"%s: y was < 0 (%d)\n" , name, y); +trace_vmware_verify_rect_less_than_zero (name,"y" , y);return false; }if (y >SVGA_MAX_HEIGHT ) { -fprintf (stderr,"%s: y was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , y); +trace_vmware_verify_rect_greater_than_bound (name,"y" ,SVGA_MAX_HEIGHT , y);return false; }if (h <0 ) { -fprintf (stderr,"%s: h was < 0 (%d)\n" , name, h); +trace_vmware_verify_rect_less_than_zero (name,"h" , h);return false; }if (h >SVGA_MAX_HEIGHT ) { -fprintf (stderr,"%s: h was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , h); +trace_vmware_verify_rect_greater_than_bound (name,"y" ,SVGA_MAX_HEIGHT , y);return false; }if (y + h >surface_height (surface)) { -fprintf (stderr,"%s: update height > %d (y: %d, h: %d)\n" , - name,surface_height (surface), y, h); +trace_vmware_verify_rect_surface_bound_exceeded (name,"height" ,surface_height (surface),"y" , y,"h" , h);return false; }
Signature · 1 line
2.34.1
Re: [PATCH 1/2] hw/display/vmware_vga: replace fprintf calls with trace events
Quoted 15 lines · Carwyn Ellis
Debug output was always being sent to STDERR.
This has been replaced with trace events.
Signed-off-by Carwyn Ellis <[email protected]>--- hw/display/trace-events | 3 +++ hw/display/vmware_vga.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-)hw/display/trace-events +0
-0
hw/display/trace-events vmware_palette_write(uint32_t index, uint32_t value) "index %d, value 0x%x" · line 26
Quoted 6 lines
hw/display/trace-events +3
-0@@ -21,6 +21,9 @@ vmware_palette_write(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_scratch_read(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_scratch_write(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp" +vmware_verify_rect_less_than_zero(const char *name, const char *param, int x) "%s: %s was < 0 (%d)" +vmware_verify_rect_greater_than_bound(const char *name, const char *param, int bound, int x) "%s: %s was > %d (%d)" +vmware_verify_rect_surface_bound_exceeded(const char *name, const char *component, int bound, const char *param1, int value1, const char *param2, int value2) "%s: %s > %d (%s: %d, %s, %d)"
"%s: %s > %d (%s: %d, %s: %d)", otherwise:
PATCH 2/2 hw/display/vmware_vga: do not discard screen updates
In reply to Carwyn EllisIn certain circumstances, typically when there is lots changing on the screen, updates will be discarded resulting in garbled output.
This change simplifies the traversal of the display update FIFO queue when applying updates. We just track the queue length and iterate up to the end of the queue.
Additionanlly when adding updates to the queue, if the buffer reaches capacity we force a flush before accepting further events.
--- hw/display/trace-events | 1 + hw/display/vmware_vga.c | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-)
hw/display/trace-events +1 -0
@@ -24,6 +24,7 @@ vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp" vmware_verify_rect_less_than_zero(const char *name, const char *param, int x) "%s: %s was < 0 (%d)" vmware_verify_rect_greater_than_bound(const char *name, const char *param, int bound, int x) "%s: %s was > %d (%d)" vmware_verify_rect_surface_bound_exceeded(const char *name, const char *component, int bound, const char *param1, int value1, const char *param2, int value2) "%s: %s > %d (%s: %d, %s, %d)" +vmware_update_rect_delayed_flush(void) "display update FIFO full - forcing flush" # virtio-gpu-base.c virtio_gpu_features(bool virgl) "virgl %d"
hw/display/vmware_vga.c +23 -18
70 lines not on this page · raw message
Signature · 1 line
2.34.1