Recently I tried building the Ubuntu SPICE packages on powerpc and found
that the spicec package fails on some x86 assembly code in
common/gl_utils.h.  This motivated me to create an optimized C version
of the find_msb() function, which I've attached.

This patch allows people to build the spice-client on any 32bit/64bit
architecture, but it doesn't solve the endianess problems in the SPICE
protocol itself.  Has anyone looked into the network byte-ordering
issues?

I can see thin-clients based on ARM processors being pretty popular in
future.  In fact, I bet someone could build one today for under $200
with a plugcomputer and a displaylink usb video card:

Guruplug ($99)
http://www.globalscaletechnologies.com/p-31-guruplug-server-standard.aspx

HP USB Graphics Adapter NL571AT ($59)
http://h10010.www1.hp.com/wwpc/us/en/sm/WF06c/A10-51210-332469-332462-332469-3913299-3913300-3913303.html


I haven't tried this combination, but I see xorg packages for the
displaylink card in Ubuntu, however, they don't seem to be built for ARM
yet:

http://packages.ubuntu.com/lucid/xserver-xorg-video-displaylink


Thanks,
Bryan
diff --git a/common/gl_utils.h b/common/gl_utils.h
index eeb9f02..eecff26 100644
--- a/common/gl_utils.h
+++ b/common/gl_utils.h
@@ -60,7 +60,7 @@ found:
     return r + 1;
 }
 
-#else
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
 static inline int find_msb(unsigned int val)
 {
     int ret;
@@ -73,6 +73,25 @@ static inline int find_msb(unsigned int val)
     return ret + 1;
 }
 
+#else
+static inline int find_msb(unsigned int val)
+{
+    signed char index = 31;
+
+    if(val == 0) {
+        return 0;
+    }
+
+    do {
+        if(val & 0x80000000) {
+            break;
+        }
+        val <<= 1;
+    } while(--index >= 0);
+
+    return index+1;
+}
+
 #endif
 
 static inline int gl_get_to_power_two(unsigned int val)
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to