[Spice-commits] 4 commits - server/red_dispatcher.c server/red_worker.c server/red_worker.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Sep 1 06:19:39 PDT 2015


 server/red_dispatcher.c |    4 ++--
 server/red_worker.c     |   29 ++++++++---------------------
 server/red_worker.h     |    6 +++---
 3 files changed, 13 insertions(+), 26 deletions(-)

New commits:
commit 59f09e69689068b8ce97807cf592faab1c848e92
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Tue Sep 10 20:21:44 2013 +0200

    Remove useless pack attribute
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index c83f13e..e7ee6b6 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -46,6 +46,7 @@
 #include <setjmp.h>
 #include <openssl/ssl.h>
 #include <inttypes.h>
+#include <glib.h>
 
 #include <spice/protocol.h>
 #include <spice/qxl_dev.h>
@@ -5930,35 +5931,24 @@ static inline void red_init_zlib(RedWorker *worker)
     }
 }
 
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED
-#pragma pack(push)
-#pragma pack(1)
-#endif
-
-
-typedef struct ATTR_PACKED rgb32_pixel_t {
+typedef struct {
     uint8_t b;
     uint8_t g;
     uint8_t r;
     uint8_t pad;
 } rgb32_pixel_t;
 
-typedef struct ATTR_PACKED rgb24_pixel_t {
+G_STATIC_ASSERT(sizeof(rgb32_pixel_t) == 4);
+
+typedef struct {
     uint8_t b;
     uint8_t g;
     uint8_t r;
 } rgb24_pixel_t;
 
-typedef uint16_t rgb16_pixel_t;
+G_STATIC_ASSERT(sizeof(rgb24_pixel_t) == 3);
 
-#ifndef __GNUC__
-#pragma pack(pop)
-#endif
-
-#undef ATTR_PACKED
+typedef uint16_t rgb16_pixel_t;
 
 #define RED_BITMAP_UTILS_RGB16
 #include "red_bitmap_utils.h"
commit 82e1592ee10e32c01fbee4e5f4a5c9c32d7a17a7
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Sep 4 01:10:08 2013 +0200

    server: remove srand(time(NULL))
    
    This is clearly not a library responsability.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index 1069055..c83f13e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -12163,8 +12163,6 @@ static void red_init(RedWorker *worker, WorkerInitData *init_data)
     if (!spice_timer_queue_create()) {
         spice_error("failed to create timer queue");
     }
-    srand(time(NULL));
-
     message = RED_WORKER_MESSAGE_READY;
     write_message(worker->channel, &message);
 
commit 30eece3e16830dc9458953ce679514b0e984533c
Author: Alon Levy <alon at pobox.com>
Date:   Wed Aug 21 19:00:43 2013 +0300

    server/red_worker: remove redundant spice_warn_if in validate_surface
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index d25feb0..1069055 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1308,7 +1308,6 @@ static inline int validate_surface(RedWorker *worker, uint32_t surface_id)
         spice_warning("canvas address is %p for %d (and is NULL)\n",
                    &(worker->surfaces[surface_id].context.canvas), surface_id);
         spice_warning("failed on %d", surface_id);
-        spice_warn_if(!worker->surfaces[surface_id].context.canvas);
         return 0;
     }
     return 1;
commit af76aa674507a9e6858ecf1ea3bcf5a12d960cd6
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Sep 2 17:47:23 2013 +0200

    server: remove hardcoded RED_MAX_RENDERERS
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 113848a..6d7756c 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -219,7 +219,7 @@ static RendererInfo renderers_info[] = {
     {RED_RENDERER_INVALID, NULL},
 };
 
-static uint32_t renderers[RED_MAX_RENDERERS];
+static uint32_t renderers[RED_RENDERER_LAST];
 static uint32_t num_renderers = 0;
 
 static RendererInfo *find_renderer(const char *name)
@@ -238,7 +238,7 @@ int red_dispatcher_add_renderer(const char *name)
 {
     RendererInfo *inf;
 
-    if (num_renderers == RED_MAX_RENDERERS || !(inf = find_renderer(name))) {
+    if (num_renderers == RED_RENDERER_LAST || !(inf = find_renderer(name))) {
         return FALSE;
     }
     renderers[num_renderers++] = inf->id;
diff --git a/server/red_worker.c b/server/red_worker.c
index 6f14b70..d25feb0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -944,7 +944,7 @@ typedef struct RedWorker {
     uint32_t repoll_cmd_ring;
     uint32_t repoll_cursor_ring;
     uint32_t num_renderers;
-    uint32_t renderers[RED_MAX_RENDERERS];
+    uint32_t renderers[RED_RENDERER_LAST];
     uint32_t renderer;
 
     RedSurface surfaces[NUM_SURFACES];
diff --git a/server/red_worker.h b/server/red_worker.h
index c34369a..ca8aadb 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -75,13 +75,13 @@ enum {
 
 typedef uint32_t RedWorkerMessage;
 
-#define RED_MAX_RENDERERS 4
-
 enum {
     RED_RENDERER_INVALID,
     RED_RENDERER_SW,
     RED_RENDERER_OGL_PBUF,
     RED_RENDERER_OGL_PIXMAP,
+
+    RED_RENDERER_LAST
 };
 
 typedef struct RedDispatcher RedDispatcher;
@@ -91,7 +91,7 @@ typedef struct WorkerInitData {
     int id;
     uint32_t *pending;
     uint32_t num_renderers;
-    uint32_t renderers[RED_MAX_RENDERERS];
+    uint32_t renderers[RED_RENDERER_LAST];
     SpiceImageCompression image_compression;
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;


More information about the Spice-commits mailing list