[Spice-devel] [PATCH 0/5] Fix bugs found by WHQL

Alexander Larsson alexl at redhat.com
Wed Sep 22 05:40:27 PDT 2010


On Tue, 2010-09-21 at 20:19 +0200, alexl at redhat.com wrote:
> From: Alexander Larsson <alexl at redhat.com>
> 
> I've been playing with an old WHQL display test running various
> rendering tests to see how we stack up. During this testing
> I found a bunch of crashes and leaks, fixed in this series.
> 
> Alexander Larsson (5):
>   Fix crash when resetting pixman image transform
>   server: Don't leak QUIC image chunks
>   server: Use the right image size for self_bitmap
>   server: Handle NULL image in red_update_streamable
>   server: Handle self_image in localize_bitmap
> 
>  common/canvas_base.c   |    3 ++-
>  server/red_parse_qxl.c |    3 +++
>  server/red_worker.c    |   32 ++++++++++++++++++++------------
>  3 files changed, 25 insertions(+), 13 deletions(-)

Found another one:

commit c425ed626c19ac5c2401cb8765033dd3e9d558b8
Author: Alexander Larsson <alexl at redhat.com>
Date:   Wed Sep 22 14:36:40 2010 +0200

    Handle surface images in DrawOpaque

diff --git a/common/canvas_base.c b/common/canvas_base.c
index acf9ae5..c2763bc 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -2414,6 +2414,7 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
     CanvasBase *canvas = (CanvasBase *)spice_canvas;
     pixman_image_t *src_image;
     pixman_region32_t dest_region;
+    SpiceCanvas *surface_canvas;
     SpiceROP rop;
 
     pixman_region32_init_rect(&dest_region,
@@ -2436,30 +2437,52 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
         return;
     }
 
-    src_image = canvas_get_image(canvas, opaque->src_bitmap, FALSE);
-
-    if (rect_is_same_size(bbox, &opaque->src_area)) {
-        spice_canvas->ops->blit_image(spice_canvas, &dest_region,
-                                      src_image,
-                                      bbox->left - opaque->src_area.left,
-                                      bbox->top - opaque->src_area.top);
+    surface_canvas = canvas_get_surface(canvas, opaque->src_bitmap);
+    if (surface_canvas) {
+        if (rect_is_same_size(bbox, &opaque->src_area)) {
+            spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region,
+                                                       surface_canvas,
+                                                       bbox->left - opaque->src_area.left,
+                                                       bbox->top - opaque->src_area.top);
+        } else {
+            spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region,
+                                                        surface_canvas,
+                                                        opaque->src_area.left,
+                                                        opaque->src_area.top,
+                                                        opaque->src_area.right - opaque->src_area.left,
+                                                        opaque->src_area.bottom - opaque->src_area.top,
+                                                        bbox->left,
+                                                        bbox->top,
+                                                        bbox->right - bbox->left,
+                                                        bbox->bottom - bbox->top,
+                                                        opaque->scale_mode);
+        }
     } else {
-        spice_canvas->ops->scale_image(spice_canvas, &dest_region,
-                                       src_image,
-                                       opaque->src_area.left,
-                                       opaque->src_area.top,
-                                       opaque->src_area.right - opaque->src_area.left,
-                                       opaque->src_area.bottom - opaque->src_area.top,
-                                       bbox->left,
-                                       bbox->top,
-                                       bbox->right - bbox->left,
-                                       bbox->bottom - bbox->top,
-                                       opaque->scale_mode);
+        src_image = canvas_get_image(canvas, opaque->src_bitmap, FALSE);
+
+        if (rect_is_same_size(bbox, &opaque->src_area)) {
+            spice_canvas->ops->blit_image(spice_canvas, &dest_region,
+                                          src_image,
+                                          bbox->left - opaque->src_area.left,
+                                          bbox->top - opaque->src_area.top);
+        } else {
+            spice_canvas->ops->scale_image(spice_canvas, &dest_region,
+                                           src_image,
+                                           opaque->src_area.left,
+                                           opaque->src_area.top,
+                                           opaque->src_area.right - opaque->src_area.left,
+                                           opaque->src_area.bottom - opaque->src_area.top,
+                                           bbox->left,
+                                           bbox->top,
+                                           bbox->right - bbox->left,
+                                           bbox->bottom - bbox->top,
+                                           opaque->scale_mode);
+        }
+        pixman_image_unref(src_image);
     }
 
     draw_brush(spice_canvas, &dest_region, &opaque->brush, rop);
 
-    pixman_image_unref(src_image);
     pixman_region32_fini(&dest_region);
 }
 


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a one-legged amnesiac assassin who hides his scarred face behind a mask. 
She's a brilliant renegade pearl diver in the witness protection program. They 
fight crime! 



More information about the Spice-devel mailing list