Re: [Spice-devel] [PATCH spice-protocol] Add agent information message

2014-10-24 Thread Pavel Grunt
Hi,

I wanted to show information about the agent in the Guest Details dialog of 
virt-viewer ( http://people.freedesktop.org/~pgrunt/guest_details.png ).
The information about other components (qxl driver, spice server) may also be 
displayed there as well. 
I think this can be useful for a user when posting a bug, because it won't be 
necessary to use other tools to get these version informations.


- Original Message -
 
 Hi
 
 - Original Message -
  Message will be used by client for requesting an information about
  a version of the agent running on the guest side.
 
 Assuming the information is cheap to compute and send, and will be
 (almost) always queried, why not send it at beginning of session,
 when the client has a special cap set?
 
 Regarding the protocol change, I would rather not introduce the
 sub-type field in a message, and instead rely on existing message
 type. This is what I'd propose:
 
 - client: set AGENT_CAP_GUEST_VERSION
 - agent: send a  VDAgentGuestVersion when cap is set (define it as
 utf8 string)
 
 Tbh, I worry about the usefulness of this feature. You may as well be
 interested about the version of other components in the guest. And
 to query that, you have better tools in the guest (and other
 agents/tools/daemons export that information). I am not quite sure
 what the spice client could do with this information but just expose
 it to the user, and then?...
 
 Please clarify and provide a bug with the description of the issue.
 
 thanks!
 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice] chardev: remove write polling

2014-10-24 Thread Marc-André Lureau
In an effort to reduce the wakeups per second, get rid of the
write_to_dev timer when the implementation supports
SPICE_CHAR_DEVICE_NOTIFY_WRITABLE.

When this flag is set, the frontend instance is responsible for calling
spice_char_device_wakeup() when the device is ready to perform IO.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=912763
---
 server/char_device.c | 27 ---
 server/spice.h   |  7 ++-
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/server/char_device.c b/server/char_device.c
index 6d2339e..5bb2a3c 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -438,7 +438,10 @@ static int 
spice_char_device_write_to_device(SpiceCharDeviceState *dev)
 }
 
 spice_char_device_state_ref(dev);
-core-timer_cancel(dev-write_to_dev_timer);
+
+if (dev-write_to_dev_timer) {
+core-timer_cancel(dev-write_to_dev_timer);
+}
 
 sif = SPICE_CONTAINEROF(dev-sin-base.sif, SpiceCharDeviceInterface, 
base);
 while (dev-running) {
@@ -473,8 +476,10 @@ static int 
spice_char_device_write_to_device(SpiceCharDeviceState *dev)
 /* retry writing as long as the write queue is not empty */
 if (dev-running) {
 if (dev-cur_write_buf) {
-core-timer_start(dev-write_to_dev_timer,
-  CHAR_DEVICE_WRITE_TO_TIMEOUT);
+if (dev-write_to_dev_timer) {
+core-timer_start(dev-write_to_dev_timer,
+  CHAR_DEVICE_WRITE_TO_TIMEOUT);
+}
 } else {
 spice_assert(ring_is_empty(dev-write_queue));
 }
@@ -635,6 +640,7 @@ SpiceCharDeviceState 
*spice_char_device_state_create(SpiceCharDeviceInstance *si
  void *opaque)
 {
 SpiceCharDeviceState *char_dev;
+SpiceCharDeviceInterface *sif;
 
 spice_assert(sin);
 spice_assert(cbs-read_one_msg_from_device  cbs-ref_msg_to_client 
@@ -652,10 +658,14 @@ SpiceCharDeviceState 
*spice_char_device_state_create(SpiceCharDeviceInstance *si
 ring_init(char_dev-write_bufs_pool);
 ring_init(char_dev-clients);
 
-char_dev-write_to_dev_timer = core-timer_add(spice_char_dev_write_retry, 
char_dev);
-if (!char_dev-write_to_dev_timer) {
-spice_error(failed creating char dev write timer);
+sif = SPICE_CONTAINEROF(char_dev-sin-base.sif, SpiceCharDeviceInterface, 
base);
+if (!(sif-flags  SPICE_CHAR_DEVICE_NOTIFY_WRITABLE)) {
+char_dev-write_to_dev_timer = 
core-timer_add(spice_char_dev_write_retry, char_dev);
+if (!char_dev-write_to_dev_timer) {
+spice_error(failed creating char dev write timer);
+}
 }
+
 char_dev-refs = 1;
 sin-st = char_dev;
 spice_debug(sin %p dev_state %p, sin, char_dev);
@@ -697,7 +707,9 @@ static void 
spice_char_device_state_unref(SpiceCharDeviceState *char_dev)
 void spice_char_device_state_destroy(SpiceCharDeviceState *char_dev)
 {
 reds_on_char_device_state_destroy(char_dev);
-core-timer_remove(char_dev-write_to_dev_timer);
+if (char_dev-write_to_dev_timer) {
+core-timer_remove(char_dev-write_to_dev_timer);
+}
 write_buffers_queue_free(char_dev-write_queue);
 write_buffers_queue_free(char_dev-write_bufs_pool);
 if (char_dev-cur_write_buf) {
@@ -842,6 +854,7 @@ void spice_char_device_reset(SpiceCharDeviceState *dev)
 
 void spice_char_device_wakeup(SpiceCharDeviceState *dev)
 {
+spice_char_device_write_to_device(dev);
 spice_char_device_read_from_device(dev);
 }
 
diff --git a/server/spice.h b/server/spice.h
index 58700d1..6449f42 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -24,7 +24,7 @@
 #include spice/vd_agent.h
 #include spice/macros.h
 
-#define SPICE_SERVER_VERSION 0x000c05 /* release 0.12.5 */
+#define SPICE_SERVER_VERSION 0x000c06 /* release 0.12.6 */
 
 #ifdef SPICE_SERVER_INTERNAL
 #undef SPICE_GNUC_DEPRECATED
@@ -407,6 +407,10 @@ typedef struct SpiceCharDeviceInterface 
SpiceCharDeviceInterface;
 typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
 typedef struct SpiceCharDeviceState SpiceCharDeviceState;
 
+typedef enum {
+SPICE_CHAR_DEVICE_NOTIFY_WRITABLE = 1  0,
+} spice_char_device_flags;
+
 struct SpiceCharDeviceInterface {
 SpiceBaseInterface base;
 
@@ -414,6 +418,7 @@ struct SpiceCharDeviceInterface {
 int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
 int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
 void (*event)(SpiceCharDeviceInstance *sin, uint8_t event);
+spice_char_device_flags flags;
 };
 
 struct SpiceCharDeviceInstance {
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice] chardev: remove write polling

2014-10-24 Thread Christophe Fergeau
On Fri, Oct 24, 2014 at 10:54:24AM +0200, Marc-André Lureau wrote:
 @@ -407,6 +407,10 @@ typedef struct SpiceCharDeviceInterface 
 SpiceCharDeviceInterface;
  typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
  typedef struct SpiceCharDeviceState SpiceCharDeviceState;
  
 +typedef enum {
 +SPICE_CHAR_DEVICE_NOTIFY_WRITABLE = 1  0,
 +} spice_char_device_flags;
 +
  struct SpiceCharDeviceInterface {
  SpiceBaseInterface base;
  
 @@ -414,6 +418,7 @@ struct SpiceCharDeviceInterface {
  int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
  int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
  void (*event)(SpiceCharDeviceInstance *sin, uint8_t event);
 +spice_char_device_flags flags;
  };

QEMU uses a static SpiceCharDeviceInterface:

static SpiceCharDeviceInterface vmc_interface = {
.base.type  = SPICE_INTERFACE_CHAR_DEVICE,
.base.description   = spice virtual channel char device,
.base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
.base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
.state  = vmc_state,
.write  = vmc_write,
.read   = vmc_read,
#if SPICE_SERVER_VERSION = 0x000c02
.event  = vmc_event,
#endif
};

If we are using a QEMU version compiled against an older spice-server, and then
upgrade spice-server but not QEMU, I don't think accessing that new 'flags'
filed is going to work (in other words, this change seems to be an ABI break).

Christophe


pgprssEkmTd2R.pgp
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice] chardev: remove write polling

2014-10-24 Thread Marc-André Lureau


- Original Message -
 On Fri, Oct 24, 2014 at 10:54:24AM +0200, Marc-André Lureau wrote:
  @@ -407,6 +407,10 @@ typedef struct SpiceCharDeviceInterface
  SpiceCharDeviceInterface;
   typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
   typedef struct SpiceCharDeviceState SpiceCharDeviceState;
   
  +typedef enum {
  +SPICE_CHAR_DEVICE_NOTIFY_WRITABLE = 1  0,
  +} spice_char_device_flags;
  +
   struct SpiceCharDeviceInterface {
   SpiceBaseInterface base;
   
  @@ -414,6 +418,7 @@ struct SpiceCharDeviceInterface {
   int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int
   len);
   int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
   void (*event)(SpiceCharDeviceInstance *sin, uint8_t event);
  +spice_char_device_flags flags;
   };
 
 QEMU uses a static SpiceCharDeviceInterface:
 
 static SpiceCharDeviceInterface vmc_interface = {
 .base.type  = SPICE_INTERFACE_CHAR_DEVICE,
 .base.description   = spice virtual channel char device,
 .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
 .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
 .state  = vmc_state,
 .write  = vmc_write,
 .read   = vmc_read,
 #if SPICE_SERVER_VERSION = 0x000c02
 .event  = vmc_event,
 #endif
 };
 
 If we are using a QEMU version compiled against an older spice-server, and
 then
 upgrade spice-server but not QEMU, I don't think accessing that new 'flags'
 filed is going to work (in other words, this change seems to be an ABI
 break).
 

right, I had already made a change locally to use the interface version 
(although
I think we shouldn't be using that, but instead use regular library versioning)
Sending now.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice] chardev: remove write polling

2014-10-24 Thread Marc-André Lureau
In an effort to reduce the wakeups per second, get rid of the
write_to_dev timer when the implementation supports
SPICE_CHAR_DEVICE_NOTIFY_WRITABLE.

When this flag is set, the frontend instance is responsible for calling
spice_char_device_wakeup() when the device is ready to perform IO.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=912763
---

in v2:
- Check char device version before accessing the flags field.

 server/char_device.c | 28 +---
 server/spice.h   |  9 +++--
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/server/char_device.c b/server/char_device.c
index 6d2339e..487a5c5 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -438,7 +438,10 @@ static int 
spice_char_device_write_to_device(SpiceCharDeviceState *dev)
 }
 
 spice_char_device_state_ref(dev);
-core-timer_cancel(dev-write_to_dev_timer);
+
+if (dev-write_to_dev_timer) {
+core-timer_cancel(dev-write_to_dev_timer);
+}
 
 sif = SPICE_CONTAINEROF(dev-sin-base.sif, SpiceCharDeviceInterface, 
base);
 while (dev-running) {
@@ -473,8 +476,10 @@ static int 
spice_char_device_write_to_device(SpiceCharDeviceState *dev)
 /* retry writing as long as the write queue is not empty */
 if (dev-running) {
 if (dev-cur_write_buf) {
-core-timer_start(dev-write_to_dev_timer,
-  CHAR_DEVICE_WRITE_TO_TIMEOUT);
+if (dev-write_to_dev_timer) {
+core-timer_start(dev-write_to_dev_timer,
+  CHAR_DEVICE_WRITE_TO_TIMEOUT);
+}
 } else {
 spice_assert(ring_is_empty(dev-write_queue));
 }
@@ -635,6 +640,7 @@ SpiceCharDeviceState 
*spice_char_device_state_create(SpiceCharDeviceInstance *si
  void *opaque)
 {
 SpiceCharDeviceState *char_dev;
+SpiceCharDeviceInterface *sif;
 
 spice_assert(sin);
 spice_assert(cbs-read_one_msg_from_device  cbs-ref_msg_to_client 
@@ -652,10 +658,15 @@ SpiceCharDeviceState 
*spice_char_device_state_create(SpiceCharDeviceInstance *si
 ring_init(char_dev-write_bufs_pool);
 ring_init(char_dev-clients);
 
-char_dev-write_to_dev_timer = core-timer_add(spice_char_dev_write_retry, 
char_dev);
-if (!char_dev-write_to_dev_timer) {
-spice_error(failed creating char dev write timer);
+sif = SPICE_CONTAINEROF(char_dev-sin-base.sif, SpiceCharDeviceInterface, 
base);
+if (sif-base.minor_version = 1  sif-base.minor_version = 3
+ !(sif-flags  SPICE_CHAR_DEVICE_NOTIFY_WRITABLE)) {
+char_dev-write_to_dev_timer = 
core-timer_add(spice_char_dev_write_retry, char_dev);
+if (!char_dev-write_to_dev_timer) {
+spice_error(failed creating char dev write timer);
+}
 }
+
 char_dev-refs = 1;
 sin-st = char_dev;
 spice_debug(sin %p dev_state %p, sin, char_dev);
@@ -697,7 +708,9 @@ static void 
spice_char_device_state_unref(SpiceCharDeviceState *char_dev)
 void spice_char_device_state_destroy(SpiceCharDeviceState *char_dev)
 {
 reds_on_char_device_state_destroy(char_dev);
-core-timer_remove(char_dev-write_to_dev_timer);
+if (char_dev-write_to_dev_timer) {
+core-timer_remove(char_dev-write_to_dev_timer);
+}
 write_buffers_queue_free(char_dev-write_queue);
 write_buffers_queue_free(char_dev-write_bufs_pool);
 if (char_dev-cur_write_buf) {
@@ -842,6 +855,7 @@ void spice_char_device_reset(SpiceCharDeviceState *dev)
 
 void spice_char_device_wakeup(SpiceCharDeviceState *dev)
 {
+spice_char_device_write_to_device(dev);
 spice_char_device_read_from_device(dev);
 }
 
diff --git a/server/spice.h b/server/spice.h
index 58700d1..bd5bba8 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -24,7 +24,7 @@
 #include spice/vd_agent.h
 #include spice/macros.h
 
-#define SPICE_SERVER_VERSION 0x000c05 /* release 0.12.5 */
+#define SPICE_SERVER_VERSION 0x000c06 /* release 0.12.6 */
 
 #ifdef SPICE_SERVER_INTERNAL
 #undef SPICE_GNUC_DEPRECATED
@@ -402,11 +402,15 @@ void spice_server_set_record_rate(SpiceRecordInstance 
*sin, uint32_t frequen
 
 #define SPICE_INTERFACE_CHAR_DEVICE char_device
 #define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1
-#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 2
+#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 3
 typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface;
 typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
 typedef struct SpiceCharDeviceState SpiceCharDeviceState;
 
+typedef enum {
+SPICE_CHAR_DEVICE_NOTIFY_WRITABLE = 1  0,
+} spice_char_device_flags;
+
 struct SpiceCharDeviceInterface {
 SpiceBaseInterface base;
 
@@ -414,6 +418,7 @@ struct SpiceCharDeviceInterface {
 int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
 int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
 void (*event)(SpiceCharDeviceInstance *sin, uint8_t 

[Spice-devel] [PATCH spice] Validate RedDrawable bbox before allocating drawable

2014-10-24 Thread Marc-André Lureau
Avoid unnecessary allocation (and possibly leaking) if the RedDrawable
doesn't validate_drawable_bbox()

Related to: rhbz#1135372
---
 server/red_worker.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index e177b68..d56db35 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4068,6 +4068,11 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t 
effect, RedDrawable *re
 struct timespec time;
 int x;
 
+if (!validate_drawable_bbox(worker, red_drawable)) {
+rendering_incorrect(__func__);
+return NULL;
+}
+
 while (!(drawable = alloc_drawable(worker))) {
 free_one_drawable(worker, FALSE);
 }
@@ -4100,10 +4105,6 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t 
effect, RedDrawable *re
 VALIDATE_SURFACE_RETVAL(worker, drawable-surfaces_dest[x], NULL)
 }
 }
-if (!validate_drawable_bbox(worker, red_drawable)) {
-rendering_incorrect(__func__);
-return NULL;
-}
 ring_init(drawable-pipes);
 ring_init(drawable-glz_ring);
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice] Validate RedDrawable bbox before allocating drawable

2014-10-24 Thread Christophe Fergeau
Hey,

On Fri, Oct 24, 2014 at 03:10:29PM +0200, Marc-André Lureau wrote:
 Avoid unnecessary allocation (and possibly leaking) if the RedDrawable
 doesn't validate_drawable_bbox()
 
 Related to: rhbz#1135372
 ---
  server/red_worker.c | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/server/red_worker.c b/server/red_worker.c
 index e177b68..d56db35 100644
 --- a/server/red_worker.c
 +++ b/server/red_worker.c
 @@ -4068,6 +4068,11 @@ static Drawable *get_drawable(RedWorker *worker, 
 uint8_t effect, RedDrawable *re
  struct timespec time;
  int x;
  

You'll need to move the
VALIDATE_SURFACE_RETVAL(worker, drawable-surface_id, NULL);
check before calling  validate_drawable_bbox() (or into that call).

 +if (!validate_drawable_bbox(worker, red_drawable)) {
 +rendering_incorrect(__func__);
 +return NULL;
 +}
 +


Christophe


pgpqzfb4JJAzL.pgp
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCHv2 spice] Validate RedDrawable before allocating drawable

2014-10-24 Thread Marc-André Lureau
Avoid unnecessary allocation (and possibly leaking) if the RedDrawable
is not valid.

Related to: rhbz#1135372
---
 server/red_worker.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index e177b68..9f18495 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4068,6 +4068,17 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t 
effect, RedDrawable *re
 struct timespec time;
 int x;
 
+VALIDATE_SURFACE_RETVAL(worker, red_drawable-surface_id, NULL)
+if (!validate_drawable_bbox(worker, red_drawable)) {
+rendering_incorrect(__func__);
+return NULL;
+}
+for (x = 0; x  3; ++x) {
+if (red_drawable-surfaces_dest[x] != -1) {
+VALIDATE_SURFACE_RETVAL(worker, red_drawable-surfaces_dest[x], 
NULL)
+}
+}
+
 while (!(drawable = alloc_drawable(worker))) {
 free_one_drawable(worker, FALSE);
 }
@@ -4093,17 +4104,7 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t 
effect, RedDrawable *re
 drawable-group_id = group_id;
 
 drawable-surface_id = red_drawable-surface_id;
-VALIDATE_SURFACE_RETVAL(worker, drawable-surface_id, NULL)
-for (x = 0; x  3; ++x) {
-drawable-surfaces_dest[x] = red_drawable-surfaces_dest[x];
-if (drawable-surfaces_dest[x] != -1) {
-VALIDATE_SURFACE_RETVAL(worker, drawable-surfaces_dest[x], NULL)
-}
-}
-if (!validate_drawable_bbox(worker, red_drawable)) {
-rendering_incorrect(__func__);
-return NULL;
-}
+memcpy(drawable-surfaces_dest, red_drawable-surfaces_dest, 
sizeof(drawable-surfaces_dest));
 ring_init(drawable-pipes);
 ring_init(drawable-glz_ring);
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-protocol v2] Add agent information message

2014-10-24 Thread Pavel Grunt
Message will be used by client for requesting an information about
a version of the agent running on the guest side.
---
v2:
 - removed 'type' field from VDAgentInformation
 - VD_AGENT_INFORMATION changed to VD_AGENT_GUEST_VERSION
   VDAgentInformation changed to VDAgentGuestVersion
 - added VD_AGENT_CAP_GUEST_VERSION
---
 spice/vd_agent.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/spice/vd_agent.h b/spice/vd_agent.h
index 7464661..31356a8 100644
--- a/spice/vd_agent.h
+++ b/spice/vd_agent.h
@@ -77,6 +77,7 @@ enum {
 VD_AGENT_FILE_XFER_DATA,
 VD_AGENT_CLIENT_DISCONNECTED,
 VD_AGENT_MAX_CLIPBOARD,
+VD_AGENT_GUEST_VERSION,
 VD_AGENT_END_MESSAGE,
 };
 
@@ -218,6 +219,7 @@ enum {
 VD_AGENT_CAP_GUEST_LINEEND_LF,
 VD_AGENT_CAP_GUEST_LINEEND_CRLF,
 VD_AGENT_CAP_MAX_CLIPBOARD,
+VD_AGENT_CAP_GUEST_VERSION,
 VD_AGENT_END_CAP,
 };
 
@@ -245,6 +247,10 @@ typedef struct SPICE_ATTR_PACKED 
VDAgentAnnounceCapabilities {
 #define VD_AGENT_SET_CAPABILITY(caps, index) \
 { (caps)[(index) / 32] |= (1  ((index) % 32)); }
 
+typedef struct SPICE_ATTR_PACKED VDAgentGuestVersion {
+uint8_t data[0];
+} VDAgentGuestVersion;
+
 #include spice/end-packed.h
 
 #endif /* _H_VD_AGENT */
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH win32/vd_agent] Support for the VD_AGENT_GUEST_VERSION message

2014-10-24 Thread Pavel Grunt
The agent will send an information about its version to the client
when VD_AGENT_CAP_GUEST_VERSION is set.
---
depends on 
http://lists.freedesktop.org/archives/spice-devel/2014-October/017669.html
---
 vdagent/vdagent.cpp | 41 -
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index aa44383..2e14f17 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -14,7 +14,9 @@
You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.
 */
-
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
 #include vdcommon.h
 #include desktop_layout.h
 #include display_setting.h
@@ -122,6 +124,7 @@ private:
 void set_display_depth(uint32_t depth);
 void load_display_setting();
 bool send_announce_capabilities(bool request);
+void send_version();
 void cleanup_in_msg();
 void cleanup();
 
@@ -835,12 +838,48 @@ bool 
VDAgent::handle_announce_capabilities(VDAgentAnnounceCapabilities* announce
 _client_caps_size = caps_size;
 }
 memcpy(_client_caps, announce_capabilities-caps, sizeof(_client_caps[0]) 
* caps_size);
+send_version();
 if (announce_capabilities-request) {
 return send_announce_capabilities(false);
 }
 return true;
 }
 
+void VDAgent::send_version()
+{
+wchar_t *tmp;
+char *version_utf8;
+int wlen, len;
+
+if (VD_AGENT_HAS_CAPABILITY(_client_caps, _client_caps_size, 
VD_AGENT_CAP_GUEST_VERSION)) {
+/* conversion from locale to utf8 */
+if (!(wlen = MultiByteToWideChar(CP_ACP, 0, VERSION, strlen(VERSION), 
NULL, 0)))
+return;
+tmp = new wchar_t[wlen+1];
+tmp[wlen] = 0;
+if (!(wlen = MultiByteToWideChar(CP_ACP, 0, VERSION, strlen(VERSION), 
tmp, wlen))) {
+delete [] tmp;
+return;
+}
+if (!(len = WideCharToMultiByte(CP_UTF8, 0, tmp, wlen, NULL, 0, NULL, 
NULL))) {
+delete [] tmp;
+return;
+}
+version_utf8 = new char[len+1];
+version_utf8[len] = 0;
+if (!(len = WideCharToMultiByte(CP_UTF8, 0, tmp, wlen, version_utf8, 
len, NULL, NULL))) {
+delete [] tmp;
+delete [] version_utf8;
+return;
+}
+delete [] tmp;
+
+vd_printf(Sending agent version);
+write_message(VD_AGENT_GUEST_VERSION, len + 1, version_utf8);
+delete[] version_utf8;
+}
+}
+
 bool VDAgent::handle_display_config(VDAgentDisplayConfig* display_config, 
uint32_t port)
 {
 DisplaySettingOptions disp_setting_opts;
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH linux/vd_agent] Support for the VD_AGENT_GUEST_VERSION message

2014-10-24 Thread Pavel Grunt
The agent will send an information about its version to the client
when VD_AGENT_CAP_GUEST_VERSION is set.
---
depends on 
http://lists.freedesktop.org/archives/spice-devel/2014-October/017669.html
---
 src/vdagentd.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/vdagentd.c b/src/vdagentd.c
index b5c7d14..a6800c9 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -108,6 +108,21 @@ static void send_capabilities(struct vdagent_virtio_port 
*vport,
 free(caps);
 }
 
+static void send_version(struct vdagent_virtio_port *vport)
+{
+gchar *version_utf8;
+gsize size;
+if (VD_AGENT_HAS_CAPABILITY(capabilities, capabilities_size, 
VD_AGENT_CAP_GUEST_VERSION)) {
+version_utf8 = g_locale_to_utf8(VERSION, strlen(VERSION), NULL, size, 
NULL);
+if (version_utf8 != NULL) {
+vdagent_virtio_port_write(vport, VDP_CLIENT_PORT,
+  VD_AGENT_GUEST_VERSION, 0,
+  (uint8_t *) version_utf8, size + 1);
+g_free(version_utf8);
+}
+}
+}
+
 static void do_client_disconnect(void)
 {
 if (client_connected) {
@@ -180,6 +195,7 @@ static void do_client_capabilities(struct 
vdagent_virtio_port *vport,
 syslog(LOG_DEBUG, New client connected);
 client_connected = 1;
 send_capabilities(vport, 0);
+send_version(vport);
 }
 }
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-protocol v2] Add agent information message

2014-10-24 Thread Marc-André Lureau


- Original Message -
 Message will be used by client for requesting an information about
 a version of the agent running on the guest side.
 ---
 v2:
  - removed 'type' field from VDAgentInformation
  - VD_AGENT_INFORMATION changed to VD_AGENT_GUEST_VERSION
VDAgentInformation changed to VDAgentGuestVersion
  - added VD_AGENT_CAP_GUEST_VERSION

looks good; but I still worry about use fulness of this message.
Having only the agent version is really a small part of what is
the guest actually running, and it might be misleading (missing
configure options, patches, dependencies etc)

 ---
  spice/vd_agent.h | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/spice/vd_agent.h b/spice/vd_agent.h
 index 7464661..31356a8 100644
 --- a/spice/vd_agent.h
 +++ b/spice/vd_agent.h
 @@ -77,6 +77,7 @@ enum {
  VD_AGENT_FILE_XFER_DATA,
  VD_AGENT_CLIENT_DISCONNECTED,
  VD_AGENT_MAX_CLIPBOARD,
 +VD_AGENT_GUEST_VERSION,
  VD_AGENT_END_MESSAGE,
  };
  
 @@ -218,6 +219,7 @@ enum {
  VD_AGENT_CAP_GUEST_LINEEND_LF,
  VD_AGENT_CAP_GUEST_LINEEND_CRLF,
  VD_AGENT_CAP_MAX_CLIPBOARD,
 +VD_AGENT_CAP_GUEST_VERSION,
  VD_AGENT_END_CAP,
  };
  
 @@ -245,6 +247,10 @@ typedef struct SPICE_ATTR_PACKED
 VDAgentAnnounceCapabilities {
  #define VD_AGENT_SET_CAPABILITY(caps, index) \
  { (caps)[(index) / 32] |= (1  ((index) % 32)); }
  
 +typedef struct SPICE_ATTR_PACKED VDAgentGuestVersion {
 +uint8_t data[0];
 +} VDAgentGuestVersion;
 +
  #include spice/end-packed.h
  
  #endif /* _H_VD_AGENT */
 --
 1.9.3
 
 ___
 Spice-devel mailing list
 Spice-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/spice-devel
 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 1/4] Split spice.h

2014-10-24 Thread Marc-André Lureau
Make it easier to read the Spice server API.
---
 server/Makefile.am   |  23 +-
 server/spice-audio.h |  96 
 server/spice-char.h  |  61 +
 server/spice-core.h  | 106 +
 server/spice-input.h |  91 +++
 server/spice-migration.h |  64 +
 server/spice-qxl.h   | 191 +++
 server/spice-server.h| 124 ++
 server/spice-version.h   |  27 +++
 server/spice.h   | 602 +++
 10 files changed, 808 insertions(+), 577 deletions(-)
 create mode 100644 server/spice-audio.h
 create mode 100644 server/spice-char.h
 create mode 100644 server/spice-core.h
 create mode 100644 server/spice-input.h
 create mode 100644 server/spice-migration.h
 create mode 100644 server/spice-qxl.h
 create mode 100644 server/spice-server.h
 create mode 100644 server/spice-version.h

diff --git a/server/Makefile.am b/server/Makefile.am
index 34219c8..f162a18 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -44,7 +44,22 @@ libspice_server_la_LIBADD =  
\
$(SPICE_NONPKGCONFIG_LIBS)  \
$(NULL)
 
+libspice_serverincludedir = $(includedir)/spice-server
+libspice_serverinclude_HEADERS =   \
+   spice-audio.h   \
+   spice-char.h\
+   spice-core.h\
+   spice-experimental.h\
+   spice-input.h   \
+   spice-migration.h   \
+   spice-qxl.h \
+   spice-server.h  \
+   spice-version.h \
+   spice.h \
+   $(NULL)
+
 libspice_server_la_SOURCES =   \
+   $(libspice_serverinclude_HEADERS)   \
agent-msg-filter.c  \
agent-msg-filter.h  \
char_device.c   \
@@ -93,8 +108,6 @@ libspice_server_la_SOURCES = \
reds_sw_canvas.h\
snd_worker.c\
snd_worker.h\
-   spice-experimental.h\
-   spice.h \
stat.h  \
spicevmc.c  \
spice_timer_queue.c \
@@ -122,12 +135,6 @@ libspice_server_la_SOURCES +=  \
$(NULL)
 endif
 
-libspice_serverincludedir = $(includedir)/spice-server
-libspice_serverinclude_HEADERS =   \
-   spice.h \
-   spice-experimental.h\
-   $(NULL)
-
 EXTRA_DIST =   \
glz_encode_match_tmpl.c \
glz_encode_tmpl.c   \
diff --git a/server/spice-audio.h b/server/spice-audio.h
new file mode 100644
index 000..3de4a8d
--- /dev/null
+++ b/server/spice-audio.h
@@ -0,0 +1,96 @@
+/*
+ *  Copyright (C) 2009-2014 Red Hat, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, see 
http://www.gnu.org/licenses/.
+ */
+
+#ifndef SPICE_AUDIO_H_
+#define SPICE_AUDIO_H_
+
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#error Only spice.h can be included directly.
+#endif
+
+#include spice-core.h
+
+/* sound interfaces */
+
+#define SPICE_INTERFACE_PLAYBACK playback
+#define SPICE_INTERFACE_PLAYBACK_MAJOR 1
+#define SPICE_INTERFACE_PLAYBACK_MINOR 3
+typedef struct SpicePlaybackInterface SpicePlaybackInterface;
+typedef struct SpicePlaybackInstance SpicePlaybackInstance;
+typedef struct SpicePlaybackState SpicePlaybackState;
+
+enum {
+SPICE_INTERFACE_AUDIO_FMT_S16 = 1,
+};
+
+#define SPICE_INTERFACE_PLAYBACK_FREQ  44100
+#define SPICE_INTERFACE_PLAYBACK_CHAN  2
+#define SPICE_INTERFACE_PLAYBACK_FMT   SPICE_INTERFACE_AUDIO_FMT_S16
+
+struct SpicePlaybackInterface {
+SpiceBaseInterface base;
+};
+
+struct SpicePlaybackInstance {
+SpiceBaseInstance  base;
+SpicePlaybackState *st;
+};
+
+void spice_server_playback_start(SpicePlaybackInstance *sin);
+void spice_server_playback_stop(SpicePlaybackInstance *sin);
+void spice_server_playback_get_buffer(SpicePlaybackInstance *sin,
+ 

[Spice-devel] [PATCH spice 2/4] s/SPICE_SERVER_INTERNAL/SPICE_COMPILATION

2014-10-24 Thread Marc-André Lureau
Use a more descriptive name for when the files
are used during our compilation.
---
 server/Makefile.am   | 2 +-
 server/spice-audio.h | 2 +-
 server/spice-char.h  | 2 +-
 server/spice-core.h  | 4 ++--
 server/spice-input.h | 2 +-
 server/spice-migration.h | 2 +-
 server/spice-server.h| 2 +-
 server/spice-version.h   | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/server/Makefile.am b/server/Makefile.am
index f162a18..e906636 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -2,7 +2,7 @@ NULL =
 SUBDIRS = . tests
 
 AM_CPPFLAGS =  \
-   -DSPICE_SERVER_INTERNAL \
+   -DSPICE_COMPILATION \
-DRED_STATISTICS\
$(COMMON_CFLAGS)\
$(GLIB2_CFLAGS) \
diff --git a/server/spice-audio.h b/server/spice-audio.h
index 3de4a8d..800f98d 100644
--- a/server/spice-audio.h
+++ b/server/spice-audio.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_AUDIO_H_
 #define SPICE_AUDIO_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
diff --git a/server/spice-char.h b/server/spice-char.h
index efd685d..f160254 100644
--- a/server/spice-char.h
+++ b/server/spice-char.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_CHAR_H_
 #define SPICE_CHAR_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
diff --git a/server/spice-core.h b/server/spice-core.h
index 4d8f2ed..5fbd9af 100644
--- a/server/spice-core.h
+++ b/server/spice-core.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_CORE_H_
 #define SPICE_CORE_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
@@ -28,7 +28,7 @@
 #include spice/vd_agent.h
 #include spice/macros.h
 
-#ifdef SPICE_SERVER_INTERNAL
+#ifdef SPICE_COMPILATION
 #undef SPICE_GNUC_DEPRECATED
 #define SPICE_GNUC_DEPRECATED
 #endif
diff --git a/server/spice-input.h b/server/spice-input.h
index dc07c4f..cd1ced4 100644
--- a/server/spice-input.h
+++ b/server/spice-input.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_INPUT_H_
 #define SPICE_INPUT_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
diff --git a/server/spice-migration.h b/server/spice-migration.h
index e2fc92e..03bb79c 100644
--- a/server/spice-migration.h
+++ b/server/spice-migration.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_MIGRATION_H_
 #define SPICE_MIGRATION_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
diff --git a/server/spice-server.h b/server/spice-server.h
index ac63a94..300996a 100644
--- a/server/spice-server.h
+++ b/server/spice-server.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_SERVER_H_
 #define SPICE_SERVER_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
diff --git a/server/spice-version.h b/server/spice-version.h
index b5c8eb0..340c365 100644
--- a/server/spice-version.h
+++ b/server/spice-version.h
@@ -18,7 +18,7 @@
 #ifndef SPICE_VERSION_H_
 #define SPICE_VERSION_H_
 
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_SERVER_INTERNAL)
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
 #error Only spice.h can be included directly.
 #endif
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 3/4] Remove spice-experimental

2014-10-24 Thread Marc-André Lureau
Remove unneded symbols that nobody should be using anyway.

The ABI is broken, so we may bump library version or ignore functions
removed (just like when tunneling support was removed)
---
 server/Makefile.am  |  1 -
 server/reds.c   | 18 --
 server/smartcard.h  |  2 --
 server/spice-experimental.h | 40 
 4 files changed, 61 deletions(-)
 delete mode 100644 server/spice-experimental.h

diff --git a/server/Makefile.am b/server/Makefile.am
index e906636..89e590d 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -49,7 +49,6 @@ libspice_serverinclude_HEADERS =  \
spice-audio.h   \
spice-char.h\
spice-core.h\
-   spice-experimental.h\
spice-input.h   \
spice-migration.h   \
spice-qxl.h \
diff --git a/server/reds.c b/server/reds.c
index ef7ff62..505bacd 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -53,7 +53,6 @@
 #include common/ring.h
 
 #include spice.h
-#include spice-experimental.h
 #include reds.h
 #include agent-msg-filter.h
 #include inputs_channel.h
@@ -3120,9 +3119,6 @@ SPICE_GNUC_VISIBLE int 
spice_server_add_interface(SpiceServer *s,
 }
 spice_server_char_device_add_interface(s, sin);
 
-} else if (strcmp(interface-type, SPICE_INTERFACE_NET_WIRE) == 0) {
-spice_warning(unsupported net wire interface);
-return -1;
 } else if (strcmp(interface-type, SPICE_INTERFACE_MIGRATION) == 0) {
 spice_info(SPICE_INTERFACE_MIGRATION);
 if (migration_interface) {
@@ -3736,20 +3732,6 @@ SPICE_GNUC_VISIBLE int 
spice_server_migrate_start(SpiceServer *s)
 return 0;
 }
 
-SPICE_GNUC_VISIBLE int spice_server_migrate_client_state(SpiceServer *s)
-{
-spice_assert(reds == s);
-
-if (!reds_main_channel_connected()) {
-return SPICE_MIGRATE_CLIENT_NONE;
-} else if (reds-mig_wait_connect) {
-return SPICE_MIGRATE_CLIENT_WAITING;
-} else {
-return SPICE_MIGRATE_CLIENT_READY;
-}
-return 0;
-}
-
 SPICE_GNUC_VISIBLE int spice_server_migrate_end(SpiceServer *s, int completed)
 {
 SpiceMigrateInterface *sif;
diff --git a/server/smartcard.h b/server/smartcard.h
index 221c777..f9cbbfc 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -18,8 +18,6 @@
 #ifndef __SMART_CARD_H__
 #define __SMART_CARD_H__
 
-#include spice-experimental.h
-
 // Maximal length of APDU
 #define APDUBufSize 270
 
diff --git a/server/spice-experimental.h b/server/spice-experimental.h
deleted file mode 100644
index f16d555..000
--- a/server/spice-experimental.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef __SPICE_EXPERIMENTAL_H__
-#define __SPICE_EXPERIMENTAL_H__
-
-#include spice.h
-
-/* tunnel interface */
-
-#define SPICE_INTERFACE_NET_WIRE net_wire
-#define SPICE_INTERFACE_NET_WIRE_MAJOR 1
-#define SPICE_INTERFACE_NET_WIRE_MINOR 1
-typedef struct SpiceNetWireInterface SpiceNetWireInterface;
-typedef struct SpiceNetWireInstance SpiceNetWireInstance;
-typedef struct SpiceNetWireState SpiceNetWireState;
-
-struct SpiceNetWireInterface {
-SpiceBaseInterface base;
-
-struct in_addr (*get_ip)(SpiceNetWireInstance *sin);
-int (*can_send_packet)(SpiceNetWireInstance *sin);
-void (*send_packet)(SpiceNetWireInstance *sin, const uint8_t *pkt, int 
len);
-};
-
-struct SpiceNetWireInstance {
-SpiceBaseInstance base;
-SpiceNetWireState *st;
-};
-
-void spice_server_net_wire_recv_packet(SpiceNetWireInstance *sin,
-   const uint8_t *pkt, int len);
-
-/* spice seamless client migration (broken) */
-enum {
-SPICE_MIGRATE_CLIENT_NONE = 1,
-SPICE_MIGRATE_CLIENT_WAITING,
-SPICE_MIGRATE_CLIENT_READY,
-};
-
-int spice_server_migrate_client_state(SpiceServer *s);
-
-#endif // __SPICE_EXPERIMENTAL_H__
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 0/4] Various public headers cleanups

2014-10-24 Thread Marc-André Lureau
Hi,

A small series to cleanup the server public headers and
hopefully improve readability that way.

Marc-André Lureau (4):
  Split spice.h
  s/SPICE_SERVER_INTERNAL/SPICE_COMPILATION
  Remove spice-experimental
  build-sys: generate spice-version.h

 configure.ac|  11 +
 server/Makefile.am  |  24 +-
 server/reds.c   |  18 --
 server/smartcard.h  |   2 -
 server/spice-audio.h|  96 +++
 server/spice-char.h |  61 +
 server/spice-core.h | 106 
 server/spice-experimental.h |  40 ---
 server/spice-input.h|  91 +++
 server/spice-migration.h|  64 +
 server/spice-qxl.h  | 191 ++
 server/spice-server.h   | 124 +
 server/spice-version.h.in   |  27 ++
 server/spice.h  | 602 +++-
 14 files changed, 819 insertions(+), 638 deletions(-)
 create mode 100644 server/spice-audio.h
 create mode 100644 server/spice-char.h
 create mode 100644 server/spice-core.h
 delete mode 100644 server/spice-experimental.h
 create mode 100644 server/spice-input.h
 create mode 100644 server/spice-migration.h
 create mode 100644 server/spice-qxl.h
 create mode 100644 server/spice-server.h
 create mode 100644 server/spice-version.h.in

-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 4/4] build-sys: generate spice-version.h

2014-10-24 Thread Marc-André Lureau
Editing the hexadecimal value of spice-version and keeping it in sync
with actual release is a bit tedious. Let's generate it
automatically (although handling of bumps will need temporarily static
versions, when 0.12 - 1.0 for example)
---
 configure.ac  | 11 +++
 server/spice-version.h| 27 ---
 server/spice-version.h.in | 27 +++
 3 files changed, 38 insertions(+), 27 deletions(-)
 delete mode 100644 server/spice-version.h
 create mode 100644 server/spice-version.h.in

diff --git a/configure.ac b/configure.ac
index cedeb40..615b31c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,16 @@ m4_define([SPICE_AGE], [9])
 AC_INIT(spice, [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
 [spice-devel@lists.freedesktop.org], spice)
 
+major=`echo $PACKAGE_VERSION | cut -d. -f1`
+minor=`echo $PACKAGE_VERSION | cut -d. -f2`
+micro=`echo $PACKAGE_VERSION | cut -d. -f3`
+git=`echo $PACKAGE_VERSION | cut -d. -f4`
+if test $git != x ; then
+micro=$(($micro+1))
+fi
+SPICE_SERVER_VERSION=`printf 0x%02x%02x%02x $major $minor $micro`
+AC_SUBST(SPICE_SERVER_VERSION)
+
 AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR(.)
@@ -506,6 +516,7 @@ AC_OUTPUT([
 Makefile
 spice-server.pc
 server/Makefile
+server/spice-version.h
 server/tests/Makefile
 client/Makefile
 docs/Makefile
diff --git a/server/spice-version.h b/server/spice-version.h
deleted file mode 100644
index 340c365..000
--- a/server/spice-version.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Copyright (C) 2009-2014 Red Hat, Inc.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, see 
http://www.gnu.org/licenses/.
- */
-
-#ifndef SPICE_VERSION_H_
-#define SPICE_VERSION_H_
-
-#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
-#error Only spice.h can be included directly.
-#endif
-
-#define SPICE_SERVER_VERSION 0x000c06 /* release 0.12.6 */
-
-#endif /* SPICE_VERSION_H_ */
diff --git a/server/spice-version.h.in b/server/spice-version.h.in
new file mode 100644
index 000..fcd0fa1
--- /dev/null
+++ b/server/spice-version.h.in
@@ -0,0 +1,27 @@
+/*
+ *  Copyright (C) 2009-2014 Red Hat, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, see 
http://www.gnu.org/licenses/.
+ */
+
+#ifndef SPICE_VERSION_H_
+#define SPICE_VERSION_H_
+
+#if !defined(SPICE_H_INSIDE)  !defined(SPICE_COMPILATION)
+#error Only spice.h can be included directly.
+#endif
+
+#define SPICE_SERVER_VERSION @SPICE_SERVER_VERSION@
+
+#endif /* SPICE_VERSION_H_ */
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 2/2] gtk: hide cursor when ungrabbed

2014-10-24 Thread Marc-André Lureau
Let's avoid confusion of multiple pointers visible on the client
desktop: hide the guest pointer if the spice client doesn't have the
grab, display it grain when the grab is taken back.
---
 gtk/spice-widget-cairo.c | 2 +-
 gtk/spice-widget.c   | 7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index 1c7b358..05d708f 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -118,7 +118,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
 
 if (d-mouse_mode == SPICE_MOUSE_MODE_SERVER 
 d-mouse_guest_x != -1  d-mouse_guest_y != -1 
-!d-show_cursor) {
+!d-show_cursor  d-mouse_grab_active) {
 GdkPixbuf *image = d-mouse_pixbuf;
 if (image != NULL) {
 gdk_cairo_set_source_pixbuf(cr, image,
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 85757cb..1978d7b 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -896,10 +896,9 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
 } else {
 d-mouse_grab_active = true;
 g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, true);
-}
-
-if (status == GDK_GRAB_SUCCESS)
 set_mouse_accel(display, FALSE);
+gtk_widget_queue_draw(GTK_WIDGET(display));
+}
 
 end:
 gdk_cursor_unref(blank);
@@ -1018,6 +1017,8 @@ static void try_mouse_ungrab(SpiceDisplay *display)
 gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
  screen, x, y);
 
+gtk_widget_queue_draw(GTK_WIDGET(display));
+
 g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
 }
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 1/2] gtk: keep cursor in the same place on ungrab

2014-10-24 Thread Marc-André Lureau
On ungrab, the transition from remote (server-side) cursor to host
cursor makes it jump somewhere else rather than staying at the same
place. Restore cursor position on ungrab to match with guest position.

https://bugs.freedesktop.org/show_bug.cgi?id=85117
---
 gtk/spice-widget.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 1220030..85757cb 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -992,6 +992,8 @@ static void mouse_wrap(SpiceDisplay *display, 
GdkEventMotion *motion)
 static void try_mouse_ungrab(SpiceDisplay *display)
 {
 SpiceDisplayPrivate *d = display-priv;
+double s;
+int x, y;
 
 if (!d-mouse_grab_active)
 return;
@@ -1005,6 +1007,17 @@ static void try_mouse_ungrab(SpiceDisplay *display)
 
 d-mouse_grab_active = false;
 
+spice_display_get_scaling(display, s, x, y, NULL, NULL);
+
+gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(display)),
+   x + d-mouse_guest_x * s,
+   y + d-mouse_guest_y * s,
+   x, y);
+
+GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(display));
+gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
+ screen, x, y);
+
 g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
 }
 
-- 
1.9.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] server: multiple clients works ok if we limit the pipe to the slowest client

2014-10-24 Thread Fabiano Fidêncio
From: Alon Levy a...@pobox.com

---
 server/red_worker.c | 5 +++--
 server/reds.c   | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index e177b68..8fed870 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4961,7 +4961,7 @@ static int red_process_cursor(RedWorker *worker, uint32_t 
max_pipe_size, int *ri
 
 *ring_is_empty = FALSE;
 while (!cursor_is_connected(worker) ||
-   red_channel_min_pipe_size(worker-cursor_channel-common.base) = 
max_pipe_size) {
+   red_channel_max_pipe_size(worker-cursor_channel-common.base) = 
max_pipe_size) {
 if (!worker-qxl-st-qif-get_cursor_command(worker-qxl, ext_cmd)) {
 *ring_is_empty = TRUE;
 if (worker-repoll_cursor_ring  CMD_RING_POLL_RETRIES) {
@@ -5020,7 +5020,8 @@ static int red_process_commands(RedWorker *worker, 
uint32_t max_pipe_size, int *
 worker-process_commands_generation++;
 *ring_is_empty = FALSE;
 while (!display_is_connected(worker) ||
-   // TODO: change to average pipe size?
+   /* this is safe but slow, in the future client groups will rule the 
world, and
+* dial up will live with T1 pipes in harmony */
red_channel_min_pipe_size(worker-display_channel-common.base) = 
max_pipe_size) {
 if (!worker-qxl-st-qif-get_command(worker-qxl, ext_cmd)) {
 *ring_is_empty = TRUE;;
diff --git a/server/reds.c b/server/reds.c
index 6864d36..0d2ad88 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3256,7 +3256,7 @@ static int do_spice_init(SpiceCoreInterface 
*core_interface)
 
 reds-allow_multiple_clients = getenv(SPICE_DEBUG_ALLOW_MC_ENV) != NULL;
 if (reds-allow_multiple_clients) {
-spice_warning(spice: allowing multiple client connections (crashy));
+spice_warning(spice: allowing multiple client connections);
 }
 atexit(reds_exit);
 return 0;
-- 
2.1.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Spice and containers

2014-10-24 Thread ven...@gmail.com
Hi, because docker is coming in, I ask me if it recommendable to run
spice/xspice in containers like docker instead of qemu/kvm? Or are
containers not usefull for desktop virtualization?
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [vdagent-linux v2] randr: handle XRRScreenChangeNotifyEvent

2014-10-24 Thread Alon Levy
On 10/08/2014 01:10 PM, Marc-André Lureau wrote:
 ping

I didn't test this, looks good, just one single line if, do with it as
you will. And unrelated, but you use TRUE/FALSE constants for handled,
maybe nice to use them too (at least be consistent that is) in
vdagent_x11_handle_event.

 
 On Mon, Sep 8, 2014 at 11:34 AM, Marc-André Lureau
 marcandre.lur...@gmail.com mailto:marcandre.lur...@gmail.com wrote:
 
 ping
 
 
 On Wed, Aug 27, 2014 at 8:51 PM, Marc-André Lureau
 marcandre.lur...@redhat.com mailto:marcandre.lur...@redhat.com
 wrote:
 
 From: Marc-Andre Lureau marcandre.lur...@redhat.com
 mailto:marcandre.lur...@redhat.com
 
 Make sure vdagent follows the current monitor configuration.  This
 solves a number of issue where the pointer input is off, because the
 uinput tablet isn't reconfigured.
 
 https://bugzilla.redhat.com/show_bug.cgi?id=1086657
 ---
  src/vdagent-x11-priv.h  |  4 +++-
  src/vdagent-x11-randr.c | 34 +-
  src/vdagent-x11.c   |  4 +++-
  3 files changed, 39 insertions(+), 3 deletions(-)
 
 diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
 index 38f852e..d60cc07 100644
 --- a/src/vdagent-x11-priv.h
 +++ b/src/vdagent-x11-priv.h
 @@ -95,6 +95,7 @@ struct vdagent_x11 {
  int height[MAX_SCREENS];
  int has_xfixes;
  int xfixes_event_base;
 +int xrandr_event_base;
  int max_prop_size;
  int expected_targets_notifies[256];
  int clipboard_owner[256];
 @@ -145,7 +146,8 @@ void
 vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11,
  int update);
  void vdagent_x11_randr_handle_root_size_change(struct
 vdagent_x11 *x11,
  int screen, int
 width, int height);
 -
 +int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
 +XEvent event);
  void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
  int (*handler)(Display *, XErrorEvent *));
  int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
 diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
 index 5faaee6..c6f790e 100644
 --- a/src/vdagent-x11-randr.c
 +++ b/src/vdagent-x11-randr.c
 @@ -132,12 +132,15 @@ void vdagent_x11_randr_init(struct
 vdagent_x11 *x11)
  return;
  }
 
 -if (XRRQueryExtension(x11-display, i, i)) {
 +if (XRRQueryExtension(x11-display,
 x11-xrandr_event_base, i)) {
  XRRQueryVersion(x11-display, x11-xrandr_major,
 x11-xrandr_minor);
  if (x11-xrandr_major == 1  x11-xrandr_minor = 3)
  x11-has_xrandr = 1;
  }
 
 +XRRSelectInput(x11-display, x11-root_window[0],
 +RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask);
 +
  if (x11-has_xrandr) {
  update_randr_res(x11, 0);
  } else {
 @@ -466,6 +469,8 @@ static int set_screen_to_best_size(struct
 vdagent_x11 *x11, int width, int heigh
  void vdagent_x11_randr_handle_root_size_change(struct
 vdagent_x11 *x11,
  int screen, int width, int height)
  {
 +update_randr_res(x11, 0);
 +
  if (width == x11-width[screen]  height ==
 x11-height[screen]) {
  return;
  }
 @@ -481,6 +486,33 @@ void
 vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
  }
  }
 
 +int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
 +XEvent event)
 +{
 +int handled = TRUE;
 +
 +switch (event.type - x11-xrandr_event_base) {
 +case RRScreenChangeNotify: {
 +XRRScreenChangeNotifyEvent *sce =
 +(XRRScreenChangeNotifyEvent *) event;
 +vdagent_x11_randr_handle_root_size_change(x11, 0,
 +sce-width, sce-height);
 +break;
 +}
 +case RRNotify: {
 +update_randr_res(x11, 0);
 +if (!x11-dont_send_guest_xorg_res)
 +vdagent_x11_send_daemon_guest_xorg_res(x11, 1);
 +break;
 +}
 +default:
 +handled = FALSE;
 +break;
 +}
 +
 +return handled;
 +}
 +
  static int min_int(int x, int y)
  {
  return x  y ? y : x;
 diff --git a/src/vdagent-x11.c 

Re: [Spice-devel] [vdagent-linux 1/2] randr: remove monitors.xml on auto-configuration

2014-10-24 Thread Christophe Fergeau
On Wed, Oct 08, 2014 at 12:28:53PM +0200, Marc-André Lureau wrote:
 Hi
 
 On Thu, Oct 2, 2014 at 2:10 PM, Christophe Fergeau cferg...@redhat.com
 wrote:
 
  Hey,
 
  On Wed, Aug 27, 2014 at 07:22:07PM +0200, Marc-André Lureau wrote:
   From: Marc-Andre Lureau marcandre.lur...@redhat.com
  
   GNOME will restore monitors.xml configuration whenever the timestamp
   config  change. The change timestamp is the last user applied
   configuration, whereas the config timestamp is updated when
   the screen is updated or ouput/crtc modes are added/removed.
  
   These condition are triggered by vdagent during monitor config. Since we
   can't control the timestamps (playing with delay will be inherently
   event more racy), the only sane way I can think of is to disable gsd
   behaviour. This can be achieved by deleting the ~/.config/monitors.xml,
   which is the intended configuration to restore, so vdagent will override
   whatever configuration was saved previously.
  
   Somehow, if vdagent would be better integrated with gnome2, it would use
   the gnome-rr and/or org.gnome.SettingsDaemon.XRANDR dbus
   API. Thanksfully, in gnome3, the monitor auto-configuration has been
   merged in.
 
  Actually a bit curious how this relates to
  https://bugzilla.gnome.org/show_bug.cgi?id=706735 which seems to have
  added a hack to avoid similar situations ?
 
 
 There is a similar timestamp check in gsd. However, when enabling monitors
 with vdagent, the timestamps are very close and there is a race between
 vdagent  gsd: you get random results. With the proposed patch, spice
 client = vdagent wins over gsd when it wants to set some config.

You make it sound like it's only an issue when running GNOME2. If you
tested with gnome-settings-daemon in RHEL6, the relevant (if I looked in
the right place!) code seems different from upstream because of a
downstream patch.
I also assume it will not be an issue either when
monitor configuration is not done through the agent but through
qxl/client monitor config?

If all of that is correct, and given that we don't own monitors.xml, I'd
prefer not to have this patch upstream.

Christophe


pgppG7BZsh_SU.pgp
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] win 7 terminal recognize usb as libusbx devicewhen exiting usb redirect

2014-10-24 Thread ????
On 10/22/2014 04:40 AM,  wrote:
 hi, all:
 environment:
 terminal: win 7
 guest: win 7
 usb redirect: usb clerk (provided by Cody Chan)
 usb device: kinston data traveller 8G
 teclast 16G (use correctly)
 usb harddisk (use correctly)

 following is my steps to use kinston usb storage:
  1.connect usb to terminal, recognize as: mass storage device
  2.use virt-viewer to connect to guest, usb device is successfully 
 redirected
  3.disconnect from guest
  4.back to terminal, usb device recognize as universal serial bus 
 device whose driver is libusbx, and oemxx.inf generated in 
 windows/system32/inf
 (something happened in this step make win 7 to choose libusbx as its 
 driver)

Hi,

Seems like a usbclerk problem == not removing the WinUSB driver upon 
client distconnect
- What are the versions of usbclerk, virt-viewer ?
--
virt-viewer 0.5.7,  the version of usbclerk  not clear (cody provides)
--
- Anything interesting in usbclerk's log (try at 
c:\windows\temp\usbclerk.log) ?
--
3608::INFO::2014-10-23 10:31:32,719::USBClerk::dispatch_message::Installing 
winusb driver for 0930:6544
3608::INFO::2014-10-23 10:31:32,735::USBClerk::install_winusb_driver::Looking 
for device vid:pid 0930:6544
3608::INFO::2014-10-23 10:31:32,735::USBClerk::install_winusb_driver::Device 
0930:6544 found
3608::INFO::2014-10-23 
10:31:32,735::USBClerk::install_winusb_driver::Installing driver for USB 
device: DataTraveler 2.0 (0930:6544) inf: usb_device_0930_6544.inf
3608::INFO::2014-10-23 10:31:37,802::USBClerk::dispatch_message::Completed 
successfully
3608::INFO::2014-10-23 10:31:48,793::USBClerk::remove_winusb_driver::WinUSB 
driver is not installed
correct log is:
960::INFO::2014-10-23 10:36:11,585::USBClerk::dispatch_message::Installing 
winusb driver for 1f75:0916
960::INFO::2014-10-23 10:36:11,601::USBClerk::install_winusb_driver::Looking 
for device vid:pid 1f75:0916
960::INFO::2014-10-23 10:36:11,601::USBClerk::install_winusb_driver::Device 
1f75:0916 found
960::INFO::2014-10-23 10:36:11,601::USBClerk::install_winusb_driver::Installing 
driver for USB device:  (1f75:0916) inf: usb_device_1f75_0916.inf
960::INFO::2014-10-23 10:36:16,069::USBClerk::dispatch_message::Completed 
successfully
960::INFO::2014-10-23 10:36:36,389::USBClerk::remove_winusb_driver::Removing 
1f75:0916
960::INFO::2014-10-23 10:36:36,436::USBClerk::uninstall_inf::Uninstalling inf: 
C:\Windows\INF\oem22.inf


(**1. teclast usb device recognize as an unknown universal serial bus 
device, but kinston is correctly recognize as itself
2.oem22.inf is similar to inf i've posted except the section 
strings)
--
- Older versions of usbclerk did not remove the driver upon client 
disconnect, can
   you try un-redirect the usb device (from the remote-viewer menu) 
before disconnecting the client ?
--
already tried, all turn out to the same result
--
Uri___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Spice and containers

2014-10-24 Thread Scott Dowdle
Greetings,

- Original Message -
 Hi, because docker is coming in, I ask me if it recommendable to run
 spice/xspice in containers like docker instead of qemu/kvm? Or are
 containers not usefull for desktop virtualization?

A Docker container is for a single application.  Doing more than that usually 
means you have to use supervisord or something like that.  Now OpenVZ can run a 
complete distro with lots of processes... but in any event... for containers 
I'd recommend you check out x2go.  x2go is awesome.

TYL,
-- 
Scott Dowdle
704 Church Street
Belgrade, MT 59714
(406)388-0827 [home]
(406)994-3931 [work]
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel