[Spice-commits] 2 commits - server/red_worker.c

Yonit Halperin yhalperi at kemper.freedesktop.org
Thu Nov 29 07:03:39 PST 2012


 server/red_worker.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 7f220304db0b87c9dd92e44a80e9240fc498f60e
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed Nov 28 14:07:38 2012 -0500

    red_worker: no need to align the stride of internal images
    
    Internal images are just read from the surface, compressed, and sent to the client.
    Then, they are destroyed. I can't find any reason for aligning their memory.

diff --git a/server/red_worker.c b/server/red_worker.c
index 9bab003..8f7f45a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -5065,7 +5065,7 @@ static ImageItem *red_add_surface_area_image(DisplayChannelClient *dcc, int surf
     width = area->right - area->left;
     height = area->bottom - area->top;
     bpp = SPICE_SURFACE_FMT_DEPTH(surface->context.format) / 8;
-    stride = SPICE_ALIGN(width * bpp, 4);
+    stride = width * bpp;
 
     item = (ImageItem *)spice_malloc_n_m(height, stride, sizeof(ImageItem));
 
commit 1e6f872066cddf25e397e2cbaad9f4ab1b0c2de3
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed Nov 28 14:04:11 2012 -0500

    red_worker: fix sending internal images with stride > bpp*width to lz compression
    
    rhbz#876685
    
    The current lz implementation does not support such bitmaps.
    The following patch will actually prevent allocating stride > bpp*width
    for internal images.

diff --git a/server/red_worker.c b/server/red_worker.c
index 54cad53..9bab003 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8607,20 +8607,20 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
 
     comp_mode = display_channel->common.worker->image_compression;
 
-    if ((comp_mode == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
-        (comp_mode == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) {
+    if (((comp_mode == SPICE_IMAGE_COMPRESS_AUTO_LZ) ||
+        (comp_mode == SPICE_IMAGE_COMPRESS_AUTO_GLZ)) && !_stride_is_extra(&bitmap)) {
+
         if (BITMAP_FMT_HAS_GRADUALITY(item->image_format)) {
-            if (!_stride_is_extra(&bitmap)) {
-                BitmapGradualType grad_level;
-                grad_level = _get_bitmap_graduality_level(display_channel->common.worker,
-                                                          &bitmap,
-                                                          worker->mem_slots.internal_groupslot_id);
-                if (grad_level == BITMAP_GRADUAL_HIGH) {
-                    // if we use lz for alpha, the stride can't be extra
-                    lossy_comp = display_channel->enable_jpeg && item->can_lossy;
-                } else {
-                    lz_comp = TRUE;
-                }
+            BitmapGradualType grad_level;
+
+            grad_level = _get_bitmap_graduality_level(display_channel->common.worker,
+                                                      &bitmap,
+                                                      worker->mem_slots.internal_groupslot_id);
+            if (grad_level == BITMAP_GRADUAL_HIGH) {
+                // if we use lz for alpha, the stride can't be extra
+                lossy_comp = display_channel->enable_jpeg && item->can_lossy;
+            } else {
+                lz_comp = TRUE;
             }
         } else {
             lz_comp = TRUE;


More information about the Spice-commits mailing list