Re: [Spice-devel] [PATCH] Enable build on armv6+

2012-09-12 Thread Christophe Fergeau
On Wed, Sep 12, 2012 at 04:52:40AM +0100, Peter Robinson wrote:
> >> From: Peter Robinson 
> 
> Can I have this committed as pbrobin...@redhat.com if its not too late?

Ah sorry, I've already pushed it :-/ I'll try to remember next time...

Christophe


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


Re: [Spice-devel] [spice-protocol PATCH v2 0.12.2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Alon Levy
> On 09/11/12 17:32, Alon Levy wrote:
> >> Hi,
> >>
> >> On 09/11/2012 04:35 PM, Alon Levy wrote:
> >>> So far we have used the agent to notify the guest of a request to
> >>> change
> >>> the monitors configurations (heads) on the qxl device. This patch
> >>> introduces
> >>> a new interrupt and new fields in the qxl rom to notify the guest
> >>> about
> >>> a new request, similarly to how physical hardware notifies the
> >>> driver.
> >>>
> >>> To avoid overwriting the rom while the guest is reading it there
> >>> is
> >>> a
> >>> client_monitors_config_updating field in ROM. The update protocol
> >>> is:
> >>>
> >>> qemu:
> >>>(1) set QXLRom::client_monitors_config_updating
> >>>(2) fill QXLRom::client_monitors_config
> >>>(3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG
> >>>(4) clear QXLRom::client_monitors_config_updating
> >>>
> >>> guest:
> >>>(1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
> >>>status
> >>>(2) wait until QXLRom::client_monitors_config_updating is
> >>>clear
> >>>(3) parse QXLRom::client_monitors_config
> >>>(4) check that QXLRom::client_monitors_Config_updating is
> >>>clear
> >>>(a) when set, goto (1)
> >>>(5) check QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
> >>>status
> >>>(a) when set, goto (1)
> >>>(b) when clear we are done
> >>>
> >>
> >> This seems very complicated how about:
> >>
> >> qemu:
> >> (1) fill QXLRom::client_monitors_config, including a crc32 of
> >> the
> >> data
> >> (2) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG
> >>
> >> guest on interrupt:
> >> (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
> >> status
> >> (2) read QXLRom::client_monitors_config
> >> (3) (verify-crc)? done : goto 2
> >>
> >> That seems more straight-forward to me.
> > 
> > Requires crc computing code in qemu and the guest. I know there is
> > such in the kernel. I guess it's fine. It also has the chance of a
> > mistake, I can let that slide I guess..
> 
> I'm not sure it is actually simpler.  Using
> client_monitors_config_updating is just two lines of code on the qemu
> side (set & clear the bit).  Dunno about crc32, maybe we have such a
> function somewhere in the networking code which we can reuse.

there is crc32 from zlib.h, used elsewhere. There are a few other 
implementation of crc32/16 in qemu. Linux has linux/crc32.h but surprise it and 
zlib don't match (well, it's expected - there is no crc32 spec, it depends on 
the polynomial, if you xor before or after).

I don't really mind which solution we use, I can send patches for the crc32 one 
already.

> 
> On the guest side using client_monitors_config_updating isn't that
> complicated too.  The only thing which might add significant
> complexity
> is (2) as this pretty much requires to not run this from irq context.
> Otherwise it just adds a loop (needed for crc32 too) and two simple
> checks.
> 
> > But more importantly I think I still need to change the protocol. I
> > still need to know if the guest supports the client_monitors_config
> > before issuing it, to take care of the case of a
> > VDAgentMonitorsConfig
> > arriving in multiple chunks, and for that I think one of:
> 
> >  QXLInterface::client_monit-rs_config_supported()
> > 
> > pro: straightforward
> > con: add such for each cap? might as well add the
> > guest_capabilities I introduced before, only this time set this
> > cap from qemu instead of via a guest io (and don't introduce that
> > guest io since we won't need it
> > 
> > alternative, reuse client_monitors_config, but have a NULL
> > parameter just check and return without actually sending a message
> > pro: no extra api
> > con: abuse of a function
> > 
> > What do you think?
> 
> I'd tend to go with QXLInterface::client_monitors_config(NULL).
> 
> But can't you just queue up the packets in spice-server until
> VDAgentMonitorsConfig is complete?  You must do that anyway to
> assemble
> the data for the client_monitors_config call, right?  Then send all
> packets in one go after the client_monitors_config call returns (or
> drop
> them, depending on the return value).
> 

Yes, I queue the packets in order to assemble them for the 
client_monitors_config(not NULL) call, but it's still a bit (tiny bit, 
admitted) simpler not to pass it to the spice-server char device afterwords. 
I'll send the patches with the client_monitors_config(NULL) implementation.

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


Re: [Spice-devel] [spice-protocol PATCH v2 0.12.2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Hans de Goede

Hi,

On 09/12/2012 10:24 AM, Alon Levy wrote:

On 09/11/12 17:32, Alon Levy wrote:

Hi,

On 09/11/2012 04:35 PM, Alon Levy wrote:

So far we have used the agent to notify the guest of a request to
change
the monitors configurations (heads) on the qxl device. This patch
introduces
a new interrupt and new fields in the qxl rom to notify the guest
about
a new request, similarly to how physical hardware notifies the
driver.

To avoid overwriting the rom while the guest is reading it there
is
a
client_monitors_config_updating field in ROM. The update protocol
is:

qemu:
(1) set QXLRom::client_monitors_config_updating
(2) fill QXLRom::client_monitors_config
(3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG
(4) clear QXLRom::client_monitors_config_updating

guest:
(1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
status
(2) wait until QXLRom::client_monitors_config_updating is
clear
(3) parse QXLRom::client_monitors_config
(4) check that QXLRom::client_monitors_Config_updating is
clear
(a) when set, goto (1)
(5) check QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
status
(a) when set, goto (1)
(b) when clear we are done



This seems very complicated how about:

qemu:
 (1) fill QXLRom::client_monitors_config, including a crc32 of
 the
 data
 (2) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG

guest on interrupt:
 (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq
 status
 (2) read QXLRom::client_monitors_config
 (3) (verify-crc)? done : goto 2

That seems more straight-forward to me.


Requires crc computing code in qemu and the guest. I know there is
such in the kernel. I guess it's fine. It also has the chance of a
mistake, I can let that slide I guess..


I'm not sure it is actually simpler.  Using
client_monitors_config_updating is just two lines of code on the qemu
side (set & clear the bit).  Dunno about crc32, maybe we have such a
function somewhere in the networking code which we can reuse.


there is crc32 from zlib.h, used elsewhere. There are a few other 
implementation of crc32/16 in qemu. Linux has linux/crc32.h but surprise it and 
zlib don't match (well, it's expected - there is no crc32 spec, it depends on 
the polynomial, if you xor before or after).

I don't really mind which solution we use, I can send patches for the crc32 one 
already.


If you've already looked into both, I would go with the one which
is simpler from an implementation pov. I've a feeling that the guest
code with the crc32 will be significantly simpler (not counting the
crc32 implementation itself, you can simply copy the kernels crc.h to
qemu), but it is your call.





On the guest side using client_monitors_config_updating isn't that
complicated too.  The only thing which might add significant
complexity
is (2) as this pretty much requires to not run this from irq context.
Otherwise it just adds a loop (needed for crc32 too) and two simple
checks.


But more importantly I think I still need to change the protocol. I
still need to know if the guest supports the client_monitors_config
before issuing it, to take care of the case of a
VDAgentMonitorsConfig
arriving in multiple chunks, and for that I think one of:



  QXLInterface::client_monit-rs_config_supported()

pro: straightforward
con: add such for each cap? might as well add the
guest_capabilities I introduced before, only this time set this
cap from qemu instead of via a guest io (and don't introduce that
guest io since we won't need it

alternative, reuse client_monitors_config, but have a NULL
parameter just check and return without actually sending a message
pro: no extra api
con: abuse of a function

What do you think?


I'd tend to go with QXLInterface::client_monitors_config(NULL).

But can't you just queue up the packets in spice-server until
VDAgentMonitorsConfig is complete?  You must do that anyway to
assemble
the data for the client_monitors_config call, right?  Then send all
packets in one go after the client_monitors_config call returns (or
drop
them, depending on the return value).



Yes, I queue the packets in order to assemble them for the 
client_monitors_config(not NULL) call, but it's still a bit (tiny bit, 
admitted) simpler not to pass it to the spice-server char device afterwords. 
I'll send the patches with the client_monitors_config(NULL) implementation.


Ok.

Regards,

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


Re: [Spice-devel] spice @ arm

2012-09-12 Thread Christophe Fergeau
On Mon, Sep 10, 2012 at 10:58:20AM +0100, Peter Robinson wrote:
> On Mon, Sep 10, 2012 at 9:59 AM, Alon Levy  wrote:
> >> Hi,
> >>
> >> FYI: spice reportly works just fine on arm, see:
> >>
> >> https://bugzilla.redhat.com/show_bug.cgi?id=613529
> >>
> >> Just a little configure patch is required.
> >
> > So this is running the spicec client? we need to get remote-viewer working 
> > then. I've done n900 package a long time ago, so I think this is not new 
> > information. The server would also be interesting to get working for Xspice.
> 
> I tested both spicec and spice-xpi (launching a console from RHEV-M).
> spice-server builds but I've not had time to test it any further than
> that.

For what it's worth, spicec is deprecated these days, and remote-viewer
(part of virt-viewer) is the client we are pushing forward.

Christophe


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


Re: [Spice-devel] [warning reduction 00/11] Eliminating warnings in xf86-video-qxl

2012-09-12 Thread Christophe Fergeau
Hey,

On Wed, Sep 12, 2012 at 05:06:44AM +0200, Søren Sandmann wrote:
> Jeremy White  writes:
> 
> > The following patch series remove nearly all warnings from
> > xf86-video-qxl.
> 
> Some general comments:
> 
> - You have this pattern where you assign a string to a global variable
>   and then you assign that variable to a field instead of the string
>   itself. If this really is necessary, I think the string should just be
>   cast instead. I haven't been able to make gcc generate that warning
>   though. Which option did you use?

When I looked at this, this was caused by -Wcast-qual, and I tried to
address it with
http://lists.freedesktop.org/archives/spice-devel/2012-May/008998.html
Alon ACK'ed it, but I've never pushed it :-/ In light of this patch series,
we can consider this patch as an alternative if it helps.

Christophe


pgpypmIpqeSRq.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 xf86-video-qxl] src/qxl_driver: use the new dixScreenSpecificPrivatesSize

2012-09-12 Thread Alon Levy
> Jeremy White  writes:
> 
> > Hey Alon (and all),
> >
> > Could this patch be done instead with an #ifdef on
> > XORG_VERSION_CURRENT?
> >
> > It'd be nice if the tip of spice could continue to be useful with
> > older
> > Xorgs (said a guy who's focused on RHEL development... :-/).
> >
> > If that would be okay, I can spin up a patch for it.

Yes, please do, bad call.

> 
> Yeah, that would be useful.
> 
> 
> Soren
> ___
> 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 0/3] client monitors config support

2012-09-12 Thread Alon Levy
v3:
 - no addition of guest capabilities, use interrupt mask instead, ignore
   0 or ~0 that are set by current windows driver.
 - use crc to solve possible write while read.
 - limit heads to 64, statically allocated on rom by host.
 - some misc trace fixes.

QEMU:

Alon Levy (3):
  hw/qxl: tracing fixes
  qxl: add trace-event for QXL_IO_LOG
  hw/qxl: support client monitor configuration via device

 configure|  7 +
 hw/qxl.c | 88 +---
 trace-events | 11 ++--
 3 files changed, 101 insertions(+), 5 deletions(-)

spice-protocol:

Alon Levy (2):
  qxl_dev.h: add client monitors configuration notification to guest
  Release 0.12.2

 configure.ac|  2 +-
 spice/qxl_dev.h | 18 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

spice-common:

Alon Levy (1):
  Update spice-protocol module

 spice-protocol | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

spice:

Alon Levy (7):
  server/red_dispatcher: change a printerr to debug
  update spice-common module
  server: add QXLInterface::client_monitors_config
  server/red_dispatcher: client_monitors_config support
  server: Filter VD_AGENT_MONITORS_CONFIG
  server/tests: agent mock, client_monitors_config
  spice-server 0.11.5

 configure.ac   |  6 ++--
 server/agent-msg-filter.c  |  8 +
 server/agent-msg-filter.h  |  1 +
 server/red_dispatcher.c| 51 +-
 server/red_dispatcher.h|  4 +++
 server/reds.c  | 65 --
 server/spice.h | 14 +---
 server/tests/basic_event_loop.c|  2 +-
 server/tests/test_display_base.c   | 46 +++
 server/tests/test_display_base.h   |  1 +
 server/tests/test_display_no_ssl.c |  1 +
 spice-common   |  2 +-
 12 files changed, 189 insertions(+), 12 deletions(-)



-- 
1.7.12

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


[Spice-devel] [PATCH 1/3] hw/qxl: tracing fixes

2012-09-12 Thread Alon Levy
Add two new trace events:
qxl_send_events(int qid, uint32_t events) "%d %d"
qxl_set_guest_bug(int qid) "%d"

Change qxl_io_unexpected_vga_mode parameters to be equivalent to those
of qxl_io_write for easier grouping under a single systemtap probe.

Change d to qxl in one place.

Signed-off-by: Alon Levy 
---
 hw/qxl.c | 8 +---
 trace-events | 6 --
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 80ba401..94eb3c8 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -141,6 +141,7 @@ static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
 
 void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
 {
+trace_qxl_set_guest_bug(qxl->id);
 qxl_send_events(qxl, QXL_INTERRUPT_ERROR);
 qxl->guest_bug = 1;
 if (qxl->guestdebug) {
@@ -1403,7 +1404,7 @@ static void ioport_write(void *opaque, target_phys_addr_t 
addr,
 break;
 }
 trace_qxl_io_unexpected_vga_mode(d->id,
-io_port, io_port_to_string(io_port));
+addr, val, io_port_to_string(io_port));
 /* be nice to buggy guest drivers */
 if (io_port >= QXL_IO_UPDATE_AREA_ASYNC &&
 io_port < QXL_IO_RANGE_SIZE) {
@@ -1595,9 +1596,9 @@ cancel_async:
 static uint64_t ioport_read(void *opaque, target_phys_addr_t addr,
 unsigned size)
 {
-PCIQXLDevice *d = opaque;
+PCIQXLDevice *qxl = opaque;
 
-trace_qxl_io_read_unexpected(d->id);
+trace_qxl_io_read_unexpected(qxl->id);
 return 0xff;
 }
 
@@ -1627,6 +1628,7 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t 
events)
 uint32_t old_pending;
 uint32_t le_events = cpu_to_le32(events);
 
+trace_qxl_send_events(d->id, events);
 assert(qemu_spice_display_is_running(&d->ssd));
 old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
 if ((old_pending & le_events) == le_events) {
diff --git a/trace-events b/trace-events
index 6e31d3c..83b332c 100644
--- a/trace-events
+++ b/trace-events
@@ -925,7 +925,7 @@ qxl_interface_update_area_complete_overflow(int qid, int 
max) "%d max=%d"
 qxl_interface_update_area_complete_schedule_bh(int qid, uint32_t num_dirty) 
"%d #dirty=%d"
 qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s"
 qxl_io_read_unexpected(int qid) "%d"
-qxl_io_unexpected_vga_mode(int qid, uint32_t io_port, const char *desc) "%d 
0x%x (%s)"
+qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char 
*desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)"
 qxl_io_write(int qid, const char *mode, uint64_t addr, uint64_t val, unsigned 
size, int async) "%d %s addr=%"PRIu64 " val=%"PRIu64" size=%u async=%d"
 qxl_memslot_add_guest(int qid, uint32_t slot_id, uint64_t guest_start, 
uint64_t guest_end) "%d %u: guest phys 0x%"PRIx64 " - 0x%" PRIx64
 qxl_post_load(int qid, const char *mode) "%d %s"
@@ -956,7 +956,7 @@ qxl_spice_destroy_surfaces(int qid, int async) "%d async=%d"
 qxl_spice_destroy_surface_wait_complete(int qid, uint32_t id) "%d sid=%d"
 qxl_spice_destroy_surface_wait(int qid, uint32_t id, int async) "%d sid=%d 
async=%d"
 qxl_spice_flush_surfaces_async(int qid, uint32_t surface_count, uint32_t 
num_free_res) "%d s#=%d, res#=%d"
-qxl_spice_monitors_config(int id) "%d"
+qxl_spice_monitors_config(int qid) "%d"
 qxl_spice_loadvm_commands(int qid, void *ext, uint32_t count) "%d ext=%p 
count=%d"
 qxl_spice_oom(int qid) "%d"
 qxl_spice_reset_cursor(int qid) "%d"
@@ -965,6 +965,8 @@ qxl_spice_reset_memslots(int qid) "%d"
 qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t 
right, uint32_t top, uint32_t bottom) "%d sid=%d [%d,%d,%d,%d]"
 qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t 
clear_dirty_region) "%d #d=%d clear=%d"
 qxl_surfaces_dirty(int qid, int surface, int offset, int size) "%d surface=%d 
offset=%d size=%d"
+qxl_send_events(int qid, uint32_t events) "%d %d"
+qxl_set_guest_bug(int qid) "%d"
 
 # hw/qxl-render.c
 qxl_render_blit_guest_primary_initialized(void) ""
-- 
1.7.12

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


[Spice-devel] [PATCH 2/3] qxl: add trace-event for QXL_IO_LOG

2012-09-12 Thread Alon Levy
Signed-off-by: Alon Levy 
---
 hw/qxl.c | 1 +
 trace-events | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/qxl.c b/hw/qxl.c
index 94eb3c8..12dfc79 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1503,6 +1503,7 @@ async_common:
 qxl_set_mode(d, val, 0);
 break;
 case QXL_IO_LOG:
+trace_qxl_io_log(d->id, d->ram->log_buf);
 if (d->guestdebug) {
 fprintf(stderr, "qxl/guest-%d: %" PRId64 ": %s", d->id,
 qemu_get_clock_ns(vm_clock), d->ram->log_buf);
diff --git a/trace-events b/trace-events
index 83b332c..564b773 100644
--- a/trace-events
+++ b/trace-events
@@ -924,6 +924,7 @@ qxl_interface_update_area_complete_rest(int qid, uint32_t 
num_updated_rects) "%d
 qxl_interface_update_area_complete_overflow(int qid, int max) "%d max=%d"
 qxl_interface_update_area_complete_schedule_bh(int qid, uint32_t num_dirty) 
"%d #dirty=%d"
 qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s"
+qxl_io_log(int qid, const uint8_t *str) "%d %s"
 qxl_io_read_unexpected(int qid) "%d"
 qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char 
*desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)"
 qxl_io_write(int qid, const char *mode, uint64_t addr, uint64_t val, unsigned 
size, int async) "%d %s addr=%"PRIu64 " val=%"PRIu64" size=%u async=%d"
-- 
1.7.12

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


[Spice-devel] [PATCH 3/3] hw/qxl: support client monitor configuration via device

2012-09-12 Thread Alon Levy
Until now we used only the agent to change the monitor count and each
monitor resolution. This patch introduces the qemu part of using the
device as the mediator instead of the agent via virtio-serial.

Spice (>=0.11.5) calls the new QXLInterface::client_monitors_config,
which returns wether the interrupt is enabled, and if so and given a non
NULL monitors config will
generate an interrupt QXL_INTERRUPT_CLIENT_MONITORS_CONFIG with crc
checksum for the guest to verify a second call hasn't interfered.

The maximal number of monitors is limited on the QXLRom to 64.

Signed-off-by: Alon Levy 
---
 configure|  7 ++
 hw/qxl.c | 79 
 trace-events |  6 -
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 30be784..35b5f1b 100755
--- a/configure
+++ b/configure
@@ -2709,6 +2709,9 @@ EOF
 if $pkg_config --atleast-version=0.12.0 spice-protocol >/dev/null 2>&1; 
then
 spice_qxl_io_monitors_config_async="yes"
 fi
+if $pkg_config --atleast-version=0.12.2 spice-protocol > /dev/null 2>&1; 
then
+spice_qxl_client_monitors_config="yes"
+fi
   else
 if test "$spice" = "yes" ; then
   feature_not_found "spice"
@@ -3456,6 +3459,10 @@ if test "$spice_qxl_io_monitors_config_async" = "yes" ; 
then
   echo "CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC=y" >> $config_host_mak
 fi
 
+if test "$spice_qxl_client_monitors_config" = "yes" ; then
+  echo "CONFIG_QXL_CLIENT_MONITORS_CONFIG=y" >> $config_host_mak
+fi
+
 if test "$smartcard" = "yes" ; then
   echo "CONFIG_SMARTCARD=y" >> $config_host_mak
 fi
diff --git a/hw/qxl.c b/hw/qxl.c
index 12dfc79..3a0c059 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -18,6 +18,8 @@
  * along with this program; if not, see .
  */
 
+#include 
+
 #include "qemu-common.h"
 #include "qemu-timer.h"
 #include "qemu-queue.h"
@@ -966,6 +968,79 @@ static void interface_set_client_capabilities(QXLInstance 
*sin,
 
 #endif
 
+#if defined(CONFIG_QXL_CLIENT_MONITORS_CONFIG) \
+&& SPICE_SERVER_VERSION >= 0x000b05
+
+static uint32_t qxl_crc32(const uint8_t *p, unsigned len)
+{
+/*
+ * zlib xors the seed with 0x, and xors the result
+ * again with 0x; Both are not done with linux's crc32,
+ * which we want to be compatible with, so undo that.
+ */
+return crc32(0x, p, len) ^ 0x;
+}
+
+/* called from main context only */
+static int interface_client_monitors_config(QXLInstance *sin,
+VDAgentMonitorsConfig *monitors_config)
+{
+PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
+QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar);
+int i;
+
+/*
+ * Older windows drivers set int_mask to 0 when their ISR is called,
+ * then later set it to ~0. So it doesn't relate to the actual interrupts
+ * handled. However, they are old, so clearly they don't support this
+ * interrupt
+ */
+if (qxl->ram->int_mask == 0 || qxl->ram->int_mask == ~0 ||
+!(qxl->ram->int_mask & QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)) {
+trace_qxl_client_monitors_config_unsupported_by_guest(qxl->id,
+qxl->ram->int_mask,
+monitors_config);
+return 0;
+}
+if (!monitors_config) {
+return 1;
+}
+memset(&rom->client_monitors_config, 0,
+   sizeof(rom->client_monitors_config));
+rom->client_monitors_config.count = monitors_config->num_of_monitors;
+/* monitors_config->flags ignored */
+if (rom->client_monitors_config.count >=
+ARRAY_SIZE(rom->client_monitors_config.heads)) {
+trace_qxl_client_monitors_config_capped(qxl->id,
+monitors_config->num_of_monitors,
+ARRAY_SIZE(rom->client_monitors_config.heads));
+rom->client_monitors_config.count =
+ARRAY_SIZE(rom->client_monitors_config.heads);
+}
+for (i = 0 ; i < rom->client_monitors_config.count ; ++i) {
+VDAgentMonConfig *monitor = &monitors_config->monitors[i];
+QXLURect *rect = &rom->client_monitors_config.heads[i];
+/* monitor->depth ignored */
+rect->left = monitor->x;
+rect->top = monitor->y;
+rect->right = monitor->x + monitor->width;
+rect->bottom = monitor->y + monitor->height;
+}
+rom->client_monitors_config_crc = qxl_crc32(
+(const uint8_t *)&rom->client_monitors_config,
+sizeof(rom->client_monitors_config));
+trace_qxl_client_monitors_config_crc(qxl->id,
+sizeof(rom->client_monitors_config),
+rom->client_monitors_config_crc);
+
+trace_qxl_interrupt_client_monitors_config(qxl->id,
+rom->client_monitors_config.count,
+rom->clie

[Spice-devel] [PATCH spice-protocol v2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Alon Levy
So far we have used the agent to notify the guest of a request to change
the monitors configurations (heads) on the qxl device. This patch introduces
a new interrupt and new fields in the qxl rom to notify the guest about
a new request, similarly to how physical hardware notifies the driver.

To avoid overwriting the rom while the guest is reading it there is a
client_monitors_config_updating field in ROM. The update protocol is:

qemu:
  (2) fill QXLRom::client_monitors_config
  (3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG

guest:
  (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
  (2) read QXLRom::client_monitors_config
  (3) (verify-crc)? done : goto 2

If the interrupt mask is ~0 or 0, or does not have
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG set, we also assume it doesn't support
this interrupt.
---
 spice/qxl_dev.h | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 50784dc..48ad403 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -125,6 +125,13 @@ typedef struct SPICE_ATTR_PACKED QXLRect {
 int32_t right;
 } QXLRect;
 
+typedef struct SPICE_ATTR_PACKED QXLURect {
+uint32_t top;
+uint32_t left;
+uint32_t bottom;
+uint32_t right;
+} QXLURect;
+
 /* qxl-1 compat: append only */
 typedef struct SPICE_ATTR_PACKED QXLRom {
 uint32_t magic;
@@ -151,8 +158,16 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
 /* appended for qxl-4 */
 uint8_t client_present;
 uint8_t client_capabilities[58];
+uint32_t client_monitors_config_crc;
+struct {
+uint16_t count;
+uint16_t padding;
+QXLURect heads[64];
+} client_monitors_config;
 } QXLRom;
 
+#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
+
 /* qxl-1 compat: fixed */
 typedef struct SPICE_ATTR_PACKED QXLMode {
 uint32_t id;
@@ -234,6 +249,9 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, 
QXL_RELEASE_RING_SIZE);
 #define QXL_INTERRUPT_IO_CMD (1 << 2)
 #define QXL_INTERRUPT_ERROR  (1 << 3)
 #define QXL_INTERRUPT_CLIENT (1 << 4)
+#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
+
+#define QXL_GUEST_CAP_CLIENT_MONITORS_CONFIG_ISR 0
 
 /* qxl-1 compat: append only */
 typedef struct SPICE_ATTR_PACKED QXLRam {
-- 
1.7.12

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


[Spice-devel] [PATCH spice-protocol v2 2/2] Release 0.12.2

2012-09-12 Thread Alon Levy
New in this release:
 display channel: A8 surface capability
 qxl: client present, client capabilities and client monitors configuration.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index b4a9cca..d80c360 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.57])
 
 m4_define([SPICE_MAJOR], 0)
 m4_define([SPICE_MINOR], 12)
-m4_define([SPICE_MICRO], 1)
+m4_define([SPICE_MICRO], 2)
 
 AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], 
spice-protocol)
 
-- 
1.7.12

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


[Spice-devel] [PATCH spice-common] Update spice-protocol module

2012-09-12 Thread Alon Levy
Add support for client monitors config in qxl device.
---
 spice-protocol | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spice-protocol b/spice-protocol
index 361fd16..9170263 16
--- a/spice-protocol
+++ b/spice-protocol
@@ -1 +1 @@
-Subproject commit 361fd166b26b4450617b1f7175be9aaa7d8f6a7e
+Subproject commit 917026388cda73df696b807f466f1480b3ea9d8b
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 1/7] server/red_dispatcher: change a printerr to debug

2012-09-12 Thread Alon Levy
---
 server/red_dispatcher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 69d4f0a..3a4229e 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -91,7 +91,7 @@ static void red_dispatcher_set_display_peer(RedChannel 
*channel, RedClient *clie
 RedWorkerMessageDisplayConnect payload;
 RedDispatcher *dispatcher;
 
-spice_printerr("");
+spice_debug("%s", "");
 dispatcher = (RedDispatcher *)channel->data;
 payload.client = client;
 payload.stream = stream;
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 2/7] update spice-common module

2012-09-12 Thread Alon Levy
For qxl client_monitors_config support.
---
 spice-common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spice-common b/spice-common
index f67bcd0..31c5fc1 16
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit f67bcd03e92c2d04f987135ad9b467c93fd47908
+Subproject commit 31c5fc1ad79d2b7eb274a56ddee5c3f565592d54
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 3/7] server: add QXLInterface::client_monitors_config

2012-09-12 Thread Alon Levy
Used to implement guest monitor configuration change similarly to real
hardware in conjunction with the new qemu interrupt
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG. client_monitors_config is also
used to probe the support by the interface. If it is not supported we
send the message to the guest agent.
This makes a linux qxl driver similar to existing kms drivers.

The logic is:

For every received VDAgentMonitorsConfig:
 if client_monitors_config(NULL):
  write client configuration to pci rom BAR.
  send interrupt to guest
  guest kernel reads configuration from rom BAR.
  guest kernel issues event to user space
  user space reads (libdrm) and reconfigures (libXRandr)
 else: (current implementation)
  write message to guest agent
  guest agent issues reconfiguration via XRandr / windows Escape ioctl to kernel
---
 server/spice.h | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/spice.h b/server/spice.h
index 2b2ed36..2b94906 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */
 
@@ -96,7 +97,7 @@ struct SpiceCoreInterface {
 
 #define SPICE_INTERFACE_QXL "qxl"
 #define SPICE_INTERFACE_QXL_MAJOR 3
-#define SPICE_INTERFACE_QXL_MINOR 2
+#define SPICE_INTERFACE_QXL_MINOR 3
 typedef struct QXLInterface QXLInterface;
 typedef struct QXLInstance QXLInstance;
 typedef struct QXLState QXLState;
@@ -240,8 +241,13 @@ struct QXLInterface {
  struct QXLRect *updated_rects,
  uint32_t num_updated_rects);
 void (*set_client_capabilities)(QXLInstance *qin,
-   uint8_t client_present,
-   uint8_t caps[58]);
+uint8_t client_present,
+uint8_t caps[58]);
+/* returns 1 if the interface is supported, 0 otherwise.
+ * if monitors_config is NULL nothing is done except reporting the
+ * return code. */
+int (*client_monitors_config)(QXLInstance *qin,
+  VDAgentMonitorsConfig *monitors_config);
 };
 
 struct QXLInstance {
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 4/7] server/red_dispatcher: client_monitors_config support

2012-09-12 Thread Alon Levy
Adds two functions:
 - red_dispatcher_use_client_monitors_config:
   check that QXLInterface supports client_monitors_config and that it's
   functional.
 - red_dispatcher_client_monitors_config:
   send the client monitors configuration to the guest.
---
 server/red_dispatcher.c | 49 +
 server/red_dispatcher.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 3a4229e..39d05ab 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -83,6 +83,22 @@ extern spice_wan_compression_t zlib_glz_state;
 
 static RedDispatcher *dispatchers = NULL;
 
+static int red_dispatcher_version_check(int major, int minor)
+{
+if (num_active_workers > 0) {
+RedDispatcher *now = dispatchers;
+while (now) {
+if (now->base.major_version != major ||
+now->base.minor_version < minor) {
+return FALSE;
+}
+now = now->next;
+}
+return TRUE;
+}
+return FALSE;
+}
+
 static void red_dispatcher_set_display_peer(RedChannel *channel, RedClient 
*client,
 RedsStream *stream, int migration,
 int num_common_caps, uint32_t 
*common_caps, int num_caps,
@@ -295,6 +311,39 @@ static void red_dispatcher_update_area(RedDispatcher 
*dispatcher, uint32_t surfa
 &payload);
 }
 
+int red_dispatcher_use_client_monitors_config(void)
+{
+RedDispatcher *now = dispatchers;
+
+if (num_active_workers == 0) {
+return FALSE;
+}
+
+for (; now ; now = now->next) {
+if (!red_dispatcher_version_check(3, 3) ||
+!now->qxl->st->qif->client_monitors_config ||
+!now->qxl->st->qif->client_monitors_config(now->qxl, NULL)) {
+return FALSE;
+}
+}
+return TRUE;
+}
+
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config)
+{
+RedDispatcher *now = dispatchers;
+
+while (now) {
+if (!now->qxl->st->qif->client_monitors_config ||
+!now->qxl->st->qif->client_monitors_config(now->qxl,
+   monitors_config)) {
+spice_warning("spice bug: QXLInterface::client_monitors_config"
+  " failed/missing unexpectedly\n");
+}
+now = now->next;
+}
+}
+
 static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
  RedWorkerMessage message,
  uint64_t cookie)
diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 7e9ffe6..17eeb29 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -18,6 +18,8 @@
 #ifndef _H_RED_DISPATCHER
 #define _H_RED_DISPATCHER
 
+#include "red_channel.h"
+
 struct RedChannelClient;
 typedef struct AsyncCommand AsyncCommand;
 
@@ -35,6 +37,8 @@ uint32_t red_dispatcher_qxl_ram_size(void);
 int red_dispatcher_qxl_count(void);
 void red_dispatcher_async_complete(struct RedDispatcher *, AsyncCommand *);
 struct Dispatcher *red_dispatcher_get_dispatcher(struct RedDispatcher *);
+int red_dispatcher_use_client_monitors_config(void);
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config);
 
 typedef struct RedWorkerMessageDisplayConnect {
 RedClient * client;
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 5/7] server: Filter VD_AGENT_MONITORS_CONFIG

2012-09-12 Thread Alon Levy
If the guest supports client monitors config we pass it the
VDAgentMonitorsConfig message via the
QXLInterface::client_monitors_config api instead of via the vdagent.
---
 server/agent-msg-filter.c |  8 ++
 server/agent-msg-filter.h |  1 +
 server/reds.c | 65 +--
 3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index 7584b52..b48dd76 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -24,6 +24,7 @@
 #include 
 #include "red_common.h"
 #include "agent-msg-filter.h"
+#include "red_dispatcher.h"
 
 void agent_msg_filter_init(struct AgentMsgFilter *filter,
 int copy_paste, int discard_all)
@@ -80,6 +81,13 @@ data_to_read:
 filter->result = AGENT_MSG_FILTER_DISCARD;
 }
 break;
+case VD_AGENT_MONITORS_CONFIG:
+if (red_dispatcher_use_client_monitors_config()) {
+filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
+} else {
+filter->result = AGENT_MSG_FILTER_OK;
+}
+break;
 default:
 filter->result = AGENT_MSG_FILTER_OK;
 }
diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index ecccfc7..0132ad7 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -28,6 +28,7 @@ enum {
 AGENT_MSG_FILTER_OK,
 AGENT_MSG_FILTER_DISCARD,
 AGENT_MSG_FILTER_PROTO_ERROR,
+AGENT_MSG_FILTER_MONITORS_CONFIG,
 AGENT_MSG_FILTER_END
 };
 
diff --git a/server/reds.c b/server/reds.c
index 98b316d..5e5d55d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -234,6 +234,16 @@ typedef struct SpiceCharDeviceStateItem {
 SpiceCharDeviceState *st;
 } SpiceCharDeviceStateItem;
 
+/* Intermediate state for on going monitors config message from a single
+ * client, being passed to the guest */
+typedef struct RedsClientMonitorsConfig {
+MainChannelClient *mcc;
+uint8_t *buffer;
+int buffer_size;
+int buffer_pos;
+int last_part_size;
+} RedsClientMonitorsConfig;
+
 typedef struct RedsState {
 int listen_socket;
 int secure_listen_socket;
@@ -284,6 +294,8 @@ typedef struct RedsState {
 #endif
 int peer_minor_version;
 int allow_multiple_clients;
+
+RedsClientMonitorsConfig client_monitors_config;
 } RedsState;
 
 static RedsState *reds = NULL;
@@ -1184,6 +1196,47 @@ void reds_release_agent_data_buffer(uint8_t *buf)
 dev_state->recv_from_client_buf_pushed = FALSE;
 }
 
+static void reds_client_monitors_config_cleanup(void)
+{
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size = cmc->buffer_pos = 0;
+free(cmc->buffer);
+cmc->buffer = NULL;
+cmc->last_part_size = 0;
+cmc->mcc = NULL;
+}
+
+static void reds_on_main_agent_monitors_config(
+MainChannelClient *mcc, void *message, size_t size)
+{
+VDAgentMessage *msg_header;
+VDAgentMonitorsConfig *monitors_config;
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size += size;
+cmc->buffer = realloc(cmc->buffer, cmc->buffer_size);
+cmc->mcc = mcc;
+memcpy(cmc->buffer + cmc->buffer_pos, message, size);
+if (sizeof(VDAgentMessage) + sizeof(VDAgentMonitorsConfig) > 
cmc->buffer_size) {
+spice_debug("not enough data yet. %d < %ld\n", cmc->buffer_size,
+sizeof(VDAgentMessage) + sizeof(VDAgentMonitorsConfig));
+return;
+}
+msg_header = (VDAgentMessage *)cmc->buffer;
+if (msg_header->size > cmc->buffer_size - sizeof(VDAgentMessage)) {
+spice_debug("not enough data yet. %ld < %d\n",
+cmc->buffer_size - sizeof(VDAgentMessage),
+msg_header->size);
+return;
+}
+monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + 
sizeof(*msg_header));
+spice_debug("%s: %d\n", __func__, monitors_config->num_of_monitors);
+cmc->last_part_size = size;
+red_dispatcher_client_monitors_config(monitors_config);
+reds_client_monitors_config_cleanup();
+}
+
 void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t 
size)
 {
 VDIPortState *dev_state = &reds->agent_state;
@@ -1199,16 +1252,18 @@ void reds_on_main_agent_data(MainChannelClient *mcc, 
void *message, size_t size)
 break;
 case AGENT_MSG_FILTER_DISCARD:
 return;
+case AGENT_MSG_FILTER_MONITORS_CONFIG:
+reds_on_main_agent_monitors_config(mcc, message, size);
+return;
 case AGENT_MSG_FILTER_PROTO_ERROR:
 reds_disconnect();
 return;
 }
-
 // TODO - start tracking agent data per channel
 header =  (VDIChunkHeader *)dev_state->recv_from_client_buf->buf;
 header->port = VDP_CLIENT_PORT;
 header->size = size;
-reds->agent_state.recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) 
+ size;
+dev_state->recv_from_client_buf->

[Spice-devel] [PATCH spice v3 6/7] server/tests: agent mock, client_monitors_config

2012-09-12 Thread Alon Levy
---
 server/tests/basic_event_loop.c|  2 +-
 server/tests/test_display_base.c   | 46 ++
 server/tests/test_display_base.h   |  1 +
 server/tests/test_display_no_ssl.c |  1 +
 4 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index 34bb178..c6f6698 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -115,7 +115,7 @@ static void watch_remove(SpiceWatch *watch)
 
 static void channel_event(int event, SpiceChannelEventInfo *info)
 {
-DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d\n",
+DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d",
 info->connection_id, info->type, info->id, event);
 }
 
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 710e3a8..8c7f512 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 
+#include "spice.h"
 #include 
 
 #include "test_display_base.h"
@@ -700,6 +701,11 @@ static int flush_resources(QXLInstance *qin)
 return TRUE;
 }
 
+static void client_monitors_config(QXLInstance *qin, VDAgentMonitorsConfig 
*monitors_config)
+{
+printf("%s: %d\n", __func__, monitors_config->num_of_monitors);
+}
+
 QXLInterface display_sif = {
 .base = {
 .type = SPICE_INTERFACE_QXL,
@@ -720,6 +726,7 @@ QXLInterface display_sif = {
 .req_cursor_notification = req_cursor_notification,
 .notify_update = notify_update,
 .flush_resources = flush_resources,
+.client_monitors_config = client_monitors_config,
 };
 
 /* interface for tests */
@@ -728,6 +735,45 @@ void test_add_display_interface(Test* test)
 spice_server_add_interface(test->server, &test->qxl_instance.base);
 }
 
+static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
+{
+printf("%s: %d\n", __func__, len);
+return len;
+}
+
+static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
+{
+printf("%s: %d\n", __func__, len);
+return 0;
+}
+
+static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
+{
+printf("%s: %d\n", __func__, connected);
+}
+
+static SpiceCharDeviceInterface vdagent_sif = {
+.base.type  = SPICE_INTERFACE_CHAR_DEVICE,
+.base.description   = "test 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,
+};
+
+SpiceCharDeviceInstance vdagent_sin = {
+.base = {
+.sif = &vdagent_sif.base,
+},
+.subtype = "vdagent",
+};
+
+void test_add_agent_interface(SpiceServer *server)
+{
+spice_server_add_interface(server, &vdagent_sin.base);
+}
+
 void test_set_simple_command_list(Test *test, int *simple_commands, int 
num_commands)
 {
 int i;
diff --git a/server/tests/test_display_base.h b/server/tests/test_display_base.h
index db97b8c..c3b9fea 100644
--- a/server/tests/test_display_base.h
+++ b/server/tests/test_display_base.h
@@ -105,6 +105,7 @@ struct Test {
 void test_set_simple_command_list(Test *test, int *command, int num_commands);
 void test_set_command_list(Test *test, Command *command, int num_commands);
 void test_add_display_interface(Test *test);
+void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
 Test* test_new(SpiceCoreInterface* core);
 
 uint32_t test_get_width(void);
diff --git a/server/tests/test_display_no_ssl.c 
b/server/tests/test_display_no_ssl.c
index 67325cc..83ab3dc 100644
--- a/server/tests/test_display_no_ssl.c
+++ b/server/tests/test_display_no_ssl.c
@@ -43,6 +43,7 @@ int main(void)
 test = test_new(core);
 //spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESS_OFF);
 test_add_display_interface(test);
+test_add_agent_interface(test->server);
 test_set_simple_command_list(test, simple_commands, 
COUNT(simple_commands));
 
 ping_timer = core->timer_add(pinger, NULL);
-- 
1.7.12

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


[Spice-devel] [PATCH spice v3 7/7] spice-server 0.11.5

2012-09-12 Thread Alon Levy
Added api:
 QXL interface (3.2)
  client_monitors_config
---
 configure.ac   | 6 +++---
 server/spice.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1c57110..0545af6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,10 @@ AC_PREREQ([2.57])
 
 m4_define([SPICE_MAJOR], 0)
 m4_define([SPICE_MINOR], 11)
-m4_define([SPICE_MICRO], 4)
-m4_define([SPICE_CURRENT], [5])
+m4_define([SPICE_MICRO], 5)
+m4_define([SPICE_CURRENT], [6])
 m4_define([SPICE_REVISION], [0])
-m4_define([SPICE_AGE], [4])
+m4_define([SPICE_AGE], [5])
 
 # Note on the library name on linux (SONAME) produced by libtool (for 
reference, gleaned
 # from looking at libtool 2.4.2)
diff --git a/server/spice.h b/server/spice.h
index 2b94906..fc10303 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-#define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */
+#define SPICE_SERVER_VERSION 0x000b05 /* release 0.11.5 */
 
 /* interface base type */
 
-- 
1.7.12

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


Re: [Spice-devel] [PATCH spice-protocol v2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Hans de Goede

Hi,

On 09/12/2012 03:13 PM, Alon Levy wrote:

So far we have used the agent to notify the guest of a request to change
the monitors configurations (heads) on the qxl device. This patch introduces
a new interrupt and new fields in the qxl rom to notify the guest about
a new request, similarly to how physical hardware notifies the driver.

To avoid overwriting the rom while the guest is reading it there is a
client_monitors_config_updating field in ROM. The update protocol is:


Sorry to be a pita, but that part of the commit message no longer applies.



qemu:
   (2) fill QXLRom::client_monitors_config
   (3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG

guest:
   (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
   (2) read QXLRom::client_monitors_config
   (3) (verify-crc)? done : goto 2

If the interrupt mask is ~0 or 0, or does not have
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG set, we also assume it doesn't support
this interrupt.
---
  spice/qxl_dev.h | 18 ++
  1 file changed, 18 insertions(+)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 50784dc..48ad403 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -125,6 +125,13 @@ typedef struct SPICE_ATTR_PACKED QXLRect {
  int32_t right;
  } QXLRect;

+typedef struct SPICE_ATTR_PACKED QXLURect {
+uint32_t top;
+uint32_t left;
+uint32_t bottom;
+uint32_t right;
+} QXLURect;
+
  /* qxl-1 compat: append only */
  typedef struct SPICE_ATTR_PACKED QXLRom {
  uint32_t magic;
@@ -151,8 +158,16 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
  /* appended for qxl-4 */
  uint8_t client_present;
  uint8_t client_capabilities[58];
+uint32_t client_monitors_config_crc;
+struct {
+uint16_t count;
+uint16_t padding;
+QXLURect heads[64];
+} client_monitors_config;
  } QXLRom;

+#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
+
  /* qxl-1 compat: fixed */
  typedef struct SPICE_ATTR_PACKED QXLMode {
  uint32_t id;
@@ -234,6 +249,9 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, 
QXL_RELEASE_RING_SIZE);
  #define QXL_INTERRUPT_IO_CMD (1 << 2)
  #define QXL_INTERRUPT_ERROR  (1 << 3)
  #define QXL_INTERRUPT_CLIENT (1 << 4)
+#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
+
+#define QXL_GUEST_CAP_CLIENT_MONITORS_CONFIG_ISR 0

  /* qxl-1 compat: append only */
  typedef struct SPICE_ATTR_PACKED QXLRam {


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


Re: [Spice-devel] [PATCH spice-protocol v2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Alon Levy
> Hi,
> 
> On 09/12/2012 03:13 PM, Alon Levy wrote:
> > So far we have used the agent to notify the guest of a request to
> > change
> > the monitors configurations (heads) on the qxl device. This patch
> > introduces
> > a new interrupt and new fields in the qxl rom to notify the guest
> > about
> > a new request, similarly to how physical hardware notifies the
> > driver.
> >
> > To avoid overwriting the rom while the guest is reading it there is
> > a
> > client_monitors_config_updating field in ROM. The update protocol
> > is:
> 
> Sorry to be a pita, but that part of the commit message no longer
> applies.

I'll fix before pushing, thanks.

> 
> >
> > qemu:
> >(2) fill QXLRom::client_monitors_config
> >(3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG
> >
> > guest:
> >(1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
> >(2) read QXLRom::client_monitors_config
> >(3) (verify-crc)? done : goto 2
> >
> > If the interrupt mask is ~0 or 0, or does not have
> > QXL_INTERRUPT_CLIENT_MONITORS_CONFIG set, we also assume it doesn't
> > support
> > this interrupt.
> > ---
> >   spice/qxl_dev.h | 18 ++
> >   1 file changed, 18 insertions(+)
> >
> > diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
> > index 50784dc..48ad403 100644
> > --- a/spice/qxl_dev.h
> > +++ b/spice/qxl_dev.h
> > @@ -125,6 +125,13 @@ typedef struct SPICE_ATTR_PACKED QXLRect {
> >   int32_t right;
> >   } QXLRect;
> >
> > +typedef struct SPICE_ATTR_PACKED QXLURect {
> > +uint32_t top;
> > +uint32_t left;
> > +uint32_t bottom;
> > +uint32_t right;
> > +} QXLURect;
> > +
> >   /* qxl-1 compat: append only */
> >   typedef struct SPICE_ATTR_PACKED QXLRom {
> >   uint32_t magic;
> > @@ -151,8 +158,16 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
> >   /* appended for qxl-4 */
> >   uint8_t client_present;
> >   uint8_t client_capabilities[58];
> > +uint32_t client_monitors_config_crc;
> > +struct {
> > +uint16_t count;
> > +uint16_t padding;
> > +QXLURect heads[64];
> > +} client_monitors_config;
> >   } QXLRom;
> >
> > +#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
> > +
> >   /* qxl-1 compat: fixed */
> >   typedef struct SPICE_ATTR_PACKED QXLMode {
> >   uint32_t id;
> > @@ -234,6 +249,9 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t,
> > QXL_RELEASE_RING_SIZE);
> >   #define QXL_INTERRUPT_IO_CMD (1 << 2)
> >   #define QXL_INTERRUPT_ERROR  (1 << 3)
> >   #define QXL_INTERRUPT_CLIENT (1 << 4)
> > +#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
> > +
> > +#define QXL_GUEST_CAP_CLIENT_MONITORS_CONFIG_ISR 0
> >
> >   /* qxl-1 compat: append only */
> >   typedef struct SPICE_ATTR_PACKED QXLRam {
> >
> 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-protocol v2 1/2] qxl_dev.h: add client monitors configuration notification to guest

2012-09-12 Thread Hans de Goede

Hi,

On 09/12/2012 03:13 PM, Alon Levy wrote:

So far we have used the agent to notify the guest of a request to change
the monitors configurations (heads) on the qxl device. This patch introduces
a new interrupt and new fields in the qxl rom to notify the guest about
a new request, similarly to how physical hardware notifies the driver.

To avoid overwriting the rom while the guest is reading it there is a
client_monitors_config_updating field in ROM. The update protocol is:

qemu:
   (2) fill QXLRom::client_monitors_config
   (3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG

guest:
   (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
   (2) read QXLRom::client_monitors_config
   (3) (verify-crc)? done : goto 2

If the interrupt mask is ~0 or 0, or does not have
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG set, we also assume it doesn't support
this interrupt.
---
  spice/qxl_dev.h | 18 ++
  1 file changed, 18 insertions(+)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 50784dc..48ad403 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -125,6 +125,13 @@ typedef struct SPICE_ATTR_PACKED QXLRect {
  int32_t right;
  } QXLRect;

+typedef struct SPICE_ATTR_PACKED QXLURect {
+uint32_t top;
+uint32_t left;
+uint32_t bottom;
+uint32_t right;
+} QXLURect;
+
  /* qxl-1 compat: append only */
  typedef struct SPICE_ATTR_PACKED QXLRom {
  uint32_t magic;
@@ -151,8 +158,16 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
  /* appended for qxl-4 */
  uint8_t client_present;
  uint8_t client_capabilities[58];
+uint32_t client_monitors_config_crc;
+struct {
+uint16_t count;
+uint16_t padding;
+QXLURect heads[64];
+} client_monitors_config;
  } QXLRom;

+#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
+
  /* qxl-1 compat: fixed */
  typedef struct SPICE_ATTR_PACKED QXLMode {
  uint32_t id;
@@ -234,6 +249,9 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, 
QXL_RELEASE_RING_SIZE);
  #define QXL_INTERRUPT_IO_CMD (1 << 2)
  #define QXL_INTERRUPT_ERROR  (1 << 3)
  #define QXL_INTERRUPT_CLIENT (1 << 4)
+#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
+
+#define QXL_GUEST_CAP_CLIENT_MONITORS_CONFIG_ISR 0


Hmm, this one (the CAP) needs to be dropped, with that and the commit msg fixed,
ack-series for spice-protocol patches.

Regards,

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


Re: [Spice-devel] [warning reduction 00/11] Eliminating warnings in xf86-video-qxl

2012-09-12 Thread Jeremy White
> Some general comments:
> 
> - You have this pattern where you assign a string to a global variable
>   and then you assign that variable to a field instead of the string
>   itself. If this really is necessary, I think the string should just be
>   cast instead. I haven't been able to make gcc generate that warning
>   though. Which option did you use?

I spent some time on Google trying to understand the 'correct' way
to fix -Wcast-qual issue (and simple casts did not work, at lest in my 
attempts).

I didn't especially like the result myself, but it does seem to fit
with what is considered standard practice.  On reflection, I can see
an argument that the resulting code is more correct, given the X headers.

On 09/12/2012 04:11 AM, Christophe Fergeau wrote:
> When I looked at this, this was caused by -Wcast-qual, and I tried to
> address it with
> http://lists.freedesktop.org/archives/spice-devel/2012-May/008998.html
[His patch adds a line to configure.ac to turn off -Wcast-qual]

> 
> - I think -Wshadow is a lost cause. We need to be able to use x1, y1,
>   y2, x2, and x_1 etc. is just too ugly.

y1() is a defined Bessel function; it is a legitimate, if rare, and
highly annoying, name space collision issue.

But I certainly see your point.

I see two ways forward:  we are either aggressive in keeping all warnings
on, and suffering with a few patches we don't like as a result.  Or we
make it a deliberate process to disable warnings we don't like.  Right now,
it looks like that list would include -Wcast-qual and -Wshadow.

I have a preference for the first approach.  To me, if you can avoid adding
your first '-Wno-XXX' stanza to your configure.ac, you can strive for
a simplicity and cleanliness that is valuable.  You also avoid a theoretical
future in which a -Wcast-qual helps catch a legitimate issue, but you
missed it because it's disabled.

However, I will cheerfully shift to the second approach if that is preferred
by you guys.  I just want my compiles to stop masking my
legitimate screw ups .

> 
> - Some of your commit headlines are too long. These show up in release
>   notes, so please try to keep them below 72 characters.

Yeah, I always make this mistake, and it bugs me that there
is this undocumented rule in git.

In case it helps anyone else, you must make a deliberate effort
in a git commit log to have a separated 'First Line' (e.g. a line
with a full line of white space after it).  That will then
go as the subject of the patch.  If you do not,
then git-format-patch runs it all together on one line and you
end up looking like an idiot.

> 
> - As Alon said, inlined patches are easier to read. Also, if you can
>   point to a git repository, that makes it much easier to merge the
>   patches. We can probably get you a freedesktop.org account if you want
>   one.

Yeah, my apologizes.  I have too many email clients to beat into shape, and
I didn't beat the one at home prior to sending.  I can easily set up a private
fdo tree if it helps to pull rather than git am.

> 
>> The final one does not remove a warning, but documents the related code
>> with a TODO as the warning appears to be correct.
>>
>> You still get a large number of redudant decl warnings from two xorg include
>> files even with this; adding -Wno-redundant-decls to CFLAGS suppresses
>> those.
> 
> It may be worthwhile doing this.

Yah; this would be the third one on our list if we were to start down that
road.

Cheers,

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


Re: [Spice-devel] [PATCH spice v3 1/7] server/red_dispatcher: change a printerr to debug

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

---
  server/red_dispatcher.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 69d4f0a..3a4229e 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -91,7 +91,7 @@ static void red_dispatcher_set_display_peer(RedChannel 
*channel, RedClient *clie
  RedWorkerMessageDisplayConnect payload;
  RedDispatcher *dispatcher;

-spice_printerr("");
+spice_debug("%s", "");
  dispatcher = (RedDispatcher *)channel->data;
  payload.client = client;
  payload.stream = stream;


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


Re: [Spice-devel] [PATCH spice v3 2/7] update spice-common module

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

For qxl client_monitors_config support.
---
  spice-common | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spice-common b/spice-common
index f67bcd0..31c5fc1 16
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit f67bcd03e92c2d04f987135ad9b467c93fd47908
+Subproject commit 31c5fc1ad79d2b7eb274a56ddee5c3f565592d54


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


Re: [Spice-devel] [PATCH spice v3 3/7] server: add QXLInterface::client_monitors_config

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

Used to implement guest monitor configuration change similarly to real
hardware in conjunction with the new qemu interrupt
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG. client_monitors_config is also
used to probe the support by the interface. If it is not supported we
send the message to the guest agent.
This makes a linux qxl driver similar to existing kms drivers.

The logic is:

For every received VDAgentMonitorsConfig:
  if client_monitors_config(NULL):
   write client configuration to pci rom BAR.
   send interrupt to guest
   guest kernel reads configuration from rom BAR.
   guest kernel issues event to user space
   user space reads (libdrm) and reconfigures (libXRandr)
  else: (current implementation)
   write message to guest agent
   guest agent issues reconfiguration via XRandr / windows Escape ioctl to 
kernel
---
  server/spice.h | 12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/spice.h b/server/spice.h
index 2b2ed36..2b94906 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -21,6 +21,7 @@
  #include 
  #include 
  #include 
+#include 

  #define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */

@@ -96,7 +97,7 @@ struct SpiceCoreInterface {

  #define SPICE_INTERFACE_QXL "qxl"
  #define SPICE_INTERFACE_QXL_MAJOR 3
-#define SPICE_INTERFACE_QXL_MINOR 2
+#define SPICE_INTERFACE_QXL_MINOR 3
  typedef struct QXLInterface QXLInterface;
  typedef struct QXLInstance QXLInstance;
  typedef struct QXLState QXLState;
@@ -240,8 +241,13 @@ struct QXLInterface {
   struct QXLRect *updated_rects,
   uint32_t num_updated_rects);
  void (*set_client_capabilities)(QXLInstance *qin,
-   uint8_t client_present,
-   uint8_t caps[58]);
+uint8_t client_present,
+uint8_t caps[58]);
+/* returns 1 if the interface is supported, 0 otherwise.
+ * if monitors_config is NULL nothing is done except reporting the
+ * return code. */
+int (*client_monitors_config)(QXLInstance *qin,
+  VDAgentMonitorsConfig *monitors_config);
  };

  struct QXLInstance {


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


Re: [Spice-devel] [PATCH spice v3 4/7] server/red_dispatcher: client_monitors_config support

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

Adds two functions:
  - red_dispatcher_use_client_monitors_config:
check that QXLInterface supports client_monitors_config and that it's
functional.
  - red_dispatcher_client_monitors_config:
send the client monitors configuration to the guest.
---
  server/red_dispatcher.c | 49 +
  server/red_dispatcher.h |  4 
  2 files changed, 53 insertions(+)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 3a4229e..39d05ab 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -83,6 +83,22 @@ extern spice_wan_compression_t zlib_glz_state;

  static RedDispatcher *dispatchers = NULL;

+static int red_dispatcher_version_check(int major, int minor)
+{
+if (num_active_workers > 0) {
+RedDispatcher *now = dispatchers;
+while (now) {
+if (now->base.major_version != major ||
+now->base.minor_version < minor) {
+return FALSE;
+}
+now = now->next;
+}
+return TRUE;
+}
+return FALSE;
+}
+
  static void red_dispatcher_set_display_peer(RedChannel *channel, RedClient 
*client,
  RedsStream *stream, int migration,
  int num_common_caps, uint32_t 
*common_caps, int num_caps,
@@ -295,6 +311,39 @@ static void red_dispatcher_update_area(RedDispatcher 
*dispatcher, uint32_t surfa
  &payload);
  }

+int red_dispatcher_use_client_monitors_config(void)
+{
+RedDispatcher *now = dispatchers;
+
+if (num_active_workers == 0) {
+return FALSE;
+}
+
+for (; now ; now = now->next) {
+if (!red_dispatcher_version_check(3, 3) ||
+!now->qxl->st->qif->client_monitors_config ||
+!now->qxl->st->qif->client_monitors_config(now->qxl, NULL)) {
+return FALSE;
+}
+}
+return TRUE;
+}
+
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config)
+{
+RedDispatcher *now = dispatchers;
+
+while (now) {
+if (!now->qxl->st->qif->client_monitors_config ||
+!now->qxl->st->qif->client_monitors_config(now->qxl,
+   monitors_config)) {
+spice_warning("spice bug: QXLInterface::client_monitors_config"
+  " failed/missing unexpectedly\n");
+}
+now = now->next;
+}
+}
+
  static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
   RedWorkerMessage message,
   uint64_t cookie)
diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 7e9ffe6..17eeb29 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -18,6 +18,8 @@
  #ifndef _H_RED_DISPATCHER
  #define _H_RED_DISPATCHER

+#include "red_channel.h"
+
  struct RedChannelClient;
  typedef struct AsyncCommand AsyncCommand;

@@ -35,6 +37,8 @@ uint32_t red_dispatcher_qxl_ram_size(void);
  int red_dispatcher_qxl_count(void);
  void red_dispatcher_async_complete(struct RedDispatcher *, AsyncCommand *);
  struct Dispatcher *red_dispatcher_get_dispatcher(struct RedDispatcher *);
+int red_dispatcher_use_client_monitors_config(void);
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config);

  typedef struct RedWorkerMessageDisplayConnect {
  RedClient * client;


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


Re: [Spice-devel] [PATCH spice v3 5/7] server: Filter VD_AGENT_MONITORS_CONFIG

2012-09-12 Thread Hans de Goede

Hi,

On 09/12/2012 03:13 PM, Alon Levy wrote:

If the guest supports client monitors config we pass it the
VDAgentMonitorsConfig message via the
QXLInterface::client_monitors_config api instead of via the vdagent.
---
  server/agent-msg-filter.c |  8 ++
  server/agent-msg-filter.h |  1 +
  server/reds.c | 65 +--
  3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index 7584b52..b48dd76 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -24,6 +24,7 @@
  #include 
  #include "red_common.h"
  #include "agent-msg-filter.h"
+#include "red_dispatcher.h"

  void agent_msg_filter_init(struct AgentMsgFilter *filter,
  int copy_paste, int discard_all)
@@ -80,6 +81,13 @@ data_to_read:
  filter->result = AGENT_MSG_FILTER_DISCARD;
  }
  break;
+case VD_AGENT_MONITORS_CONFIG:
+if (red_dispatcher_use_client_monitors_config()) {
+filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
+} else {
+filter->result = AGENT_MSG_FILTER_OK;
+}
+break;
  default:
  filter->result = AGENT_MSG_FILTER_OK;
  }
diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index ecccfc7..0132ad7 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -28,6 +28,7 @@ enum {
  AGENT_MSG_FILTER_OK,
  AGENT_MSG_FILTER_DISCARD,
  AGENT_MSG_FILTER_PROTO_ERROR,
+AGENT_MSG_FILTER_MONITORS_CONFIG,
  AGENT_MSG_FILTER_END
  };

diff --git a/server/reds.c b/server/reds.c
index 98b316d..5e5d55d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -234,6 +234,16 @@ typedef struct SpiceCharDeviceStateItem {
  SpiceCharDeviceState *st;
  } SpiceCharDeviceStateItem;

+/* Intermediate state for on going monitors config message from a single
+ * client, being passed to the guest */
+typedef struct RedsClientMonitorsConfig {
+MainChannelClient *mcc;
+uint8_t *buffer;
+int buffer_size;
+int buffer_pos;
+int last_part_size;


last_part_size is not read anywhere, so it can be removed...


+} RedsClientMonitorsConfig;
+
  typedef struct RedsState {
  int listen_socket;
  int secure_listen_socket;
@@ -284,6 +294,8 @@ typedef struct RedsState {
  #endif
  int peer_minor_version;
  int allow_multiple_clients;
+
+RedsClientMonitorsConfig client_monitors_config;
  } RedsState;

  static RedsState *reds = NULL;
@@ -1184,6 +1196,47 @@ void reds_release_agent_data_buffer(uint8_t *buf)
  dev_state->recv_from_client_buf_pushed = FALSE;
  }

+static void reds_client_monitors_config_cleanup(void)
+{
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size = cmc->buffer_pos = 0;
+free(cmc->buffer);
+cmc->buffer = NULL;
+cmc->last_part_size = 0;
+cmc->mcc = NULL;
+}
+
+static void reds_on_main_agent_monitors_config(
+MainChannelClient *mcc, void *message, size_t size)
+{
+VDAgentMessage *msg_header;
+VDAgentMonitorsConfig *monitors_config;
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size += size;
+cmc->buffer = realloc(cmc->buffer, cmc->buffer_size);


You must error check the realloc return here, or use a version which never 
fails.


+cmc->mcc = mcc;
+memcpy(cmc->buffer + cmc->buffer_pos, message, size);


You are forgetting to update buffer_pos here !!!


+if (sizeof(VDAgentMessage) + sizeof(VDAgentMonitorsConfig) > 
cmc->buffer_size) {


Since you're checking msg_header->size below, you nonly need to check for
sizeof(VDAgentMessage) > cmc->buffer_size here. Or better simplify the
2 checks to:

msg_header = (VDAgentMessage *)cmc->buffer;
if (sizeof(VDAgentMessage) > cmc->buffer_size ||
msg_header->size > cmc->buffer_size - sizeof(VDAgentMessage)) {
spice_debug("not enough data yet.\n");
return;
}






+spice_debug("not enough data yet. %d < %ld\n", cmc->buffer_size,
+sizeof(VDAgentMessage) + sizeof(VDAgentMonitorsConfig));
+return;
+}
+msg_header = (VDAgentMessage *)cmc->buffer;
+if (msg_header->size > cmc->buffer_size - sizeof(VDAgentMessage)) {
+spice_debug("not enough data yet. %ld < %d\n",
+cmc->buffer_size - sizeof(VDAgentMessage),
+msg_header->size);
+return;
+}
+monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + 
sizeof(*msg_header));
+spice_debug("%s: %d\n", __func__, monitors_config->num_of_monitors);
+cmc->last_part_size = size;
+red_dispatcher_client_monitors_config(monitors_config);
+reds_client_monitors_config_cleanup();
+}
+
  void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t 
size)
  {
  VDIPortState *dev_state = &reds->agent_state;
@@ -1199,16 

Re: [Spice-devel] [PATCH spice v3 6/7] server/tests: agent mock, client_monitors_config

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

---
  server/tests/basic_event_loop.c|  2 +-
  server/tests/test_display_base.c   | 46 ++
  server/tests/test_display_base.h   |  1 +
  server/tests/test_display_no_ssl.c |  1 +
  4 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index 34bb178..c6f6698 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -115,7 +115,7 @@ static void watch_remove(SpiceWatch *watch)

  static void channel_event(int event, SpiceChannelEventInfo *info)
  {
-DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d\n",
+DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d",
  info->connection_id, info->type, info->id, event);
  }

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 710e3a8..8c7f512 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -10,6 +10,7 @@
  #include 
  #include 

+#include "spice.h"
  #include 

  #include "test_display_base.h"
@@ -700,6 +701,11 @@ static int flush_resources(QXLInstance *qin)
  return TRUE;
  }

+static void client_monitors_config(QXLInstance *qin, VDAgentMonitorsConfig 
*monitors_config)
+{
+printf("%s: %d\n", __func__, monitors_config->num_of_monitors);
+}
+
  QXLInterface display_sif = {
  .base = {
  .type = SPICE_INTERFACE_QXL,
@@ -720,6 +726,7 @@ QXLInterface display_sif = {
  .req_cursor_notification = req_cursor_notification,
  .notify_update = notify_update,
  .flush_resources = flush_resources,
+.client_monitors_config = client_monitors_config,
  };

  /* interface for tests */
@@ -728,6 +735,45 @@ void test_add_display_interface(Test* test)
  spice_server_add_interface(test->server, &test->qxl_instance.base);
  }

+static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
+{
+printf("%s: %d\n", __func__, len);
+return len;
+}
+
+static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
+{
+printf("%s: %d\n", __func__, len);
+return 0;
+}
+
+static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
+{
+printf("%s: %d\n", __func__, connected);
+}
+
+static SpiceCharDeviceInterface vdagent_sif = {
+.base.type  = SPICE_INTERFACE_CHAR_DEVICE,
+.base.description   = "test 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,
+};
+
+SpiceCharDeviceInstance vdagent_sin = {
+.base = {
+.sif = &vdagent_sif.base,
+},
+.subtype = "vdagent",
+};
+
+void test_add_agent_interface(SpiceServer *server)
+{
+spice_server_add_interface(server, &vdagent_sin.base);
+}
+
  void test_set_simple_command_list(Test *test, int *simple_commands, int 
num_commands)
  {
  int i;
diff --git a/server/tests/test_display_base.h b/server/tests/test_display_base.h
index db97b8c..c3b9fea 100644
--- a/server/tests/test_display_base.h
+++ b/server/tests/test_display_base.h
@@ -105,6 +105,7 @@ struct Test {
  void test_set_simple_command_list(Test *test, int *command, int num_commands);
  void test_set_command_list(Test *test, Command *command, int num_commands);
  void test_add_display_interface(Test *test);
+void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
  Test* test_new(SpiceCoreInterface* core);

  uint32_t test_get_width(void);
diff --git a/server/tests/test_display_no_ssl.c 
b/server/tests/test_display_no_ssl.c
index 67325cc..83ab3dc 100644
--- a/server/tests/test_display_no_ssl.c
+++ b/server/tests/test_display_no_ssl.c
@@ -43,6 +43,7 @@ int main(void)
  test = test_new(core);
  //spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESS_OFF);
  test_add_display_interface(test);
+test_add_agent_interface(test->server);
  test_set_simple_command_list(test, simple_commands, 
COUNT(simple_commands));

  ping_timer = core->timer_add(pinger, NULL);


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


Re: [Spice-devel] [PATCH spice v3 7/7] spice-server 0.11.5

2012-09-12 Thread Hans de Goede

ACK.

On 09/12/2012 03:13 PM, Alon Levy wrote:

Added api:
  QXL interface (3.2)
   client_monitors_config
---
  configure.ac   | 6 +++---
  server/spice.h | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1c57110..0545af6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,10 @@ AC_PREREQ([2.57])

  m4_define([SPICE_MAJOR], 0)
  m4_define([SPICE_MINOR], 11)
-m4_define([SPICE_MICRO], 4)
-m4_define([SPICE_CURRENT], [5])
+m4_define([SPICE_MICRO], 5)
+m4_define([SPICE_CURRENT], [6])
  m4_define([SPICE_REVISION], [0])
-m4_define([SPICE_AGE], [4])
+m4_define([SPICE_AGE], [5])

  # Note on the library name on linux (SONAME) produced by libtool (for 
reference, gleaned
  # from looking at libtool 2.4.2)
diff --git a/server/spice.h b/server/spice.h
index 2b94906..fc10303 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -23,7 +23,7 @@
  #include 
  #include 

-#define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */
+#define SPICE_SERVER_VERSION 0x000b05 /* release 0.11.5 */

  /* interface base type */



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


[Spice-devel] [PATCH 1/7] reds: Abort on BN-new failures

2012-09-12 Thread Christophe Fergeau
BN_new returns NULL on allocation failures. Given that we abort
on malloc allocation failures, we should also abort here. The
current code will segfault when BN_new fails as it immediatly tries
to use the NULL pointer.
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 98b316d..993a132 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1811,7 +1811,7 @@ static void openssl_init(RedLinkInfo *link)
 link->tiTicketing.bn = BN_new();
 
 if (!link->tiTicketing.bn) {
-spice_warning("OpenSSL BIGNUMS alloc failed");
+spice_error("OpenSSL BIGNUMS alloc failed");
 }
 
 BN_set_word(link->tiTicketing.bn, f4);
-- 
1.7.11.4

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


[Spice-devel] [PATCH 2/7] reds_init_net: report errors on watch setup failures

2012-09-12 Thread Christophe Fergeau
We used to be aborting in such situations, but this was changed
during the big spice_error/printerr cleanup. We are currently
outputting a warning but not reporting the error with the caller
when reds_init_net fails to register listening watches with the
mainloop. As it's unlikely that things will work as expected in
such cases, better to error out of the function instead of pretending
everything is all right.
---
 server/reds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/server/reds.c b/server/reds.c
index 993a132..202d9c3 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3128,6 +3128,7 @@ static int reds_init_net(void)
  reds_accept, NULL);
 if (reds->listen_watch == NULL) {
 spice_warning("set fd handle failed");
+return -1;
 }
 }
 
@@ -3142,6 +3143,7 @@ static int reds_init_net(void)
 
reds_accept_ssl_connection, NULL);
 if (reds->secure_listen_watch == NULL) {
 spice_warning("set fd handle failed");
+return -1;
 }
 }
 
@@ -3152,6 +3154,7 @@ static int reds_init_net(void)
  reds_accept, NULL);
 if (reds->listen_watch == NULL) {
 spice_warning("set fd handle failed");
+return -1;
 }
 }
 return 0;
-- 
1.7.11.4

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


[Spice-devel] [PATCH 3/7] reds: report SSL initialization errors

2012-09-12 Thread Christophe Fergeau
Errors occurring in reds_init_ssl used to be fatal through the use
of spice_error, but this was downgraded to non-fatal spice_warning
calls recently. This means we no longer error out when invalid SSL
(certificates, ...) parameters are passed by the user.
This commit changes reds_init_ssl return value from void to int so
that errors can be reported to the caller.
---
 server/reds.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 202d9c3..0cd3f40 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3227,7 +3227,7 @@ static void openssl_thread_setup(void)
 CRYPTO_set_locking_callback(pthreads_locking_callback);
 }
 
-static void reds_init_ssl(void)
+static int reds_init_ssl(void)
 {
 #if OPENSSL_VERSION_NUMBER >= 0x1000L
 const SSL_METHOD *ssl_method;
@@ -3246,6 +3246,7 @@ static void reds_init_ssl(void)
 reds->ctx = SSL_CTX_new(ssl_method);
 if (!reds->ctx) {
 spice_warning("Could not allocate new SSL context");
+return -1;
 }
 
 /* Limit connection to TLSv1 only */
@@ -3260,6 +3261,7 @@ static void reds_init_ssl(void)
 spice_info("Loaded certificates from %s", ssl_parameters.certs_file);
 } else {
 spice_warning("Could not load certificates from %s", 
ssl_parameters.certs_file);
+return -1;
 }
 
 SSL_CTX_set_default_passwd_cb(reds->ctx, ssl_password_cb);
@@ -3270,6 +3272,7 @@ static void reds_init_ssl(void)
 spice_info("Using private key from %s", 
ssl_parameters.private_key_file);
 } else {
 spice_warning("Could not use private key file");
+return -1;
 }
 
 /* Load the CAs we trust*/
@@ -3278,6 +3281,7 @@ static void reds_init_ssl(void)
 spice_info("Loaded CA certificates from %s", 
ssl_parameters.ca_certificate_file);
 } else {
 spice_warning("Could not use CA file %s", 
ssl_parameters.ca_certificate_file);
+return -1;
 }
 
 #if (OPENSSL_VERSION_NUMBER < 0x00905100L)
@@ -3299,6 +3303,8 @@ static void reds_init_ssl(void)
 STACK *cmp_stack = SSL_COMP_get_compression_methods();
 sk_zero(cmp_stack);
 #endif
+
+return 0;
 }
 
 static void reds_exit(void)
-- 
1.7.11.4

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


[Spice-devel] [PATCH 4/7] reds: Check reds_init_ssl errors

2012-09-12 Thread Christophe Fergeau
Now that this function can fail, propagate any error up to the
caller. This allows qemu to fail when an SSL initialization error
occurred.
---
 server/reds.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 0cd3f40..983ca0f 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3973,7 +3973,9 @@ static int do_spice_init(SpiceCoreInterface 
*core_interface)
 goto err;
 }
 if (reds->secure_listen_socket != -1) {
-reds_init_ssl();
+if (reds_init_ssl() < 0) {
+goto err;
+}
 }
 #if HAVE_SASL
 int saslerr;
-- 
1.7.11.4

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


[Spice-devel] [PATCH 6/7] reds: Check errors returned from SSL_CTX_set_cipher_list

2012-09-12 Thread Christophe Fergeau
---
 server/reds.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 2d312e9..3ed8c67 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3301,7 +3301,9 @@ static int reds_init_ssl(void)
 
 SSL_CTX_set_session_id_context(reds->ctx, (const unsigned char *)"SPICE", 
5);
 if (strlen(ssl_parameters.ciphersuite) > 0) {
-SSL_CTX_set_cipher_list(reds->ctx, ssl_parameters.ciphersuite);
+if (!SSL_CTX_set_cipher_list(reds->ctx, ssl_parameters.ciphersuite)) {
+return -1;
+}
 }
 
 openssl_thread_setup();
-- 
1.7.11.4

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


[Spice-devel] [PATCH 5/7] reds: Report errors from load_dh_params

2012-09-12 Thread Christophe Fergeau
---
 server/reds.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 983ca0f..2d312e9 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3160,25 +3160,30 @@ static int reds_init_net(void)
 return 0;
 }
 
-static void load_dh_params(SSL_CTX *ctx, char *file)
+static int load_dh_params(SSL_CTX *ctx, char *file)
 {
 DH *ret = 0;
 BIO *bio;
 
 if ((bio = BIO_new_file(file, "r")) == NULL) {
 spice_warning("Could not open DH file");
+return -1;
 }
 
 ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
+BIO_free(bio);
 if (ret == 0) {
 spice_warning("Could not read DH params");
+return -1;
 }
 
-BIO_free(bio);
 
 if (SSL_CTX_set_tmp_dh(ctx, ret) < 0) {
 spice_warning("Could not set DH params");
+return -1;
 }
+
+return 0;
 }
 
 /*The password code is not thread safe*/
@@ -3289,7 +3294,9 @@ static int reds_init_ssl(void)
 #endif
 
 if (strlen(ssl_parameters.dh_key_file) > 0) {
-load_dh_params(reds->ctx, ssl_parameters.dh_key_file);
+if (load_dh_params(reds->ctx, ssl_parameters.dh_key_file) < 0) {
+return -1;
+}
 }
 
 SSL_CTX_set_session_id_context(reds->ctx, (const unsigned char *)"SPICE", 
5);
-- 
1.7.11.4

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


[Spice-devel] [PATCH 7/7] reds: Report an error when reds_char_device_add_state fails

2012-09-12 Thread Christophe Fergeau
This used to abort with spice_error. The caller currently does
not check spice_server_char_device_add_interface return value, but
it's still cleaner to report an error in this case.
---
 server/reds.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server/reds.c b/server/reds.c
index 3ed8c67..d071a6d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3728,6 +3728,7 @@ static int 
spice_server_char_device_add_interface(SpiceServer *s,
 reds_char_device_add_state(char_device->st);
 } else {
 spice_warning("failed to create device state for %s", 
char_device->subtype);
+return -1;
 }
 return 0;
 }
-- 
1.7.11.4

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


[Spice-devel] SPICE screen resolution support (is 2048x2048 possible ?)

2012-09-12 Thread Guillaume Sabouraud
Hi,

I have a quick question regarding SPICE resolution support.

On many documents I can read that the max is 2560x1600 = 4,096,000 pixels.
At the same time, I saw several pieces of code with highres modes such as
QXL_MODE_EX(2560, 2048).

Is it possible to drive a 2048x2048 square monitor under Linux RedHat ?

Thanks,



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


Re: [Spice-devel] SPICE screen resolution support (is 2048x2048 possible ?)

2012-09-12 Thread David Jaša
Guillaume Sabouraud píše v St 12. 09. 2012 v 11:46 +0200:
> Hi,
> 
> I have a quick question regarding SPICE resolution support.
> 
> On many documents I can read that the max is 2560x1600 = 4,096,000
> pixels. At the same time, I saw several pieces of code with highres
> modes such as QXL_MODE_EX(2560, 2048).
> 
> Is it possible to drive a 2048x2048 square monitor under Linux
> RedHat ?

Hi, there should be 2000x2000 resolution available but it is not - I
filed https://bugzilla.redhat.com/show_bug.cgi?id=856690 to track it and
IMHO (IOW: no guarantees) it should get fixed in 6.4.

David

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

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key: 22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24



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


Re: [Spice-devel] SPICE screen resolution support (is 2048x2048 possible ?)

2012-09-12 Thread David Jaša
David Jaša píše v St 12. 09. 2012 v 17:17 +0200:
> Guillaume Sabouraud píše v St 12. 09. 2012 v 11:46 +0200:
> > Hi,
> > 
> > I have a quick question regarding SPICE resolution support.
> > 
> > On many documents I can read that the max is 2560x1600 = 4,096,000
> > pixels. At the same time, I saw several pieces of code with highres
> > modes such as QXL_MODE_EX(2560, 2048).
> > 
> > Is it possible to drive a 2048x2048 square monitor under Linux
> > RedHat ?
> 
> Hi, there should be 2000x2000 resolution available but it is not - I
> filed https://bugzilla.redhat.com/show_bug.cgi?id=856690 to track it and
> IMHO (IOW: no guarantees) it should get fixed in 6.4.

You need to tweak your xorg.conf(.d):
https://bugzilla.redhat.com/show_bug.cgi?id=856690#c1

David

> 
> David
> 
> > 
> > Thanks,
> > 
> >  
> > 
> > GS
> > 
> >  
> > 
> >  
> > 
> > ___
> > Spice-devel mailing list
> > Spice-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key: 22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24



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


[Spice-devel] [PATCH] Only use dixScreenSpecificPrivatesSize if we have a new enough Xorg.

2012-09-12 Thread Jeremy White
This lets us continue to support older Xorg releases.
This reverts 4f37cd85 and partially reverts 4a43bd4.
---
 configure.ac |2 +-
 src/qxl_driver.c |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index b8a4b35..11ef73c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto)
 
 # Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.12.99.901] xproto fontsproto 
$REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto fontsproto 
$REQUIRED_MODULES)
 
 save_CFLAGS="$CFLAGS"
 CFLAGS="$XORG_CFLAGS"
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index c7b8486..d31eafc 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1786,10 +1786,14 @@ qxl_screen_init (SCREEN_INIT_ARGS_DECL)
 DamageSetup (pScreen);
 
 /* We need to set totalPixmapSize after setup_uxa and Damage,
- * as the privatssize is not computed correctly until then
+   as the privates size is not computed correctly until then
  */
+#if (XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 12, 99, 901, 0))
+pScreen->totalPixmapSize = BitmapBytePad ((sizeof (PixmapRec) + 
dixPrivatesSize (PRIVATE_PIXMAP) ) * 8);
+#else
 pScreen->totalPixmapSize = BitmapBytePad((sizeof(PixmapRec) +
dixScreenSpecificPrivatesSize(pScreen, 
PRIVATE_PIXMAP) ) * 8);
+#endif
 
 miDCInitialize (pScreen, xf86GetPointerScreenFuncs());
 if (!miCreateDefColormap (pScreen))
-- 
1.7.10.4


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


[Spice-devel] [PATCH spice v4 1/2] server/reds: reuse already defined local

2012-09-12 Thread Alon Levy
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 98b316d..57ce88b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1208,7 +1208,7 @@ void reds_on_main_agent_data(MainChannelClient *mcc, void 
*message, size_t size)
 header =  (VDIChunkHeader *)dev_state->recv_from_client_buf->buf;
 header->port = VDP_CLIENT_PORT;
 header->size = size;
-reds->agent_state.recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) 
+ size;
+dev_state->recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) + size;
 
 dev_state->recv_from_client_buf_pushed = TRUE;
 spice_char_device_write_buffer_add(reds->agent_state.base, 
dev_state->recv_from_client_buf);
-- 
1.7.12

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


[Spice-devel] [PATCH spice v4 2/2] server: Filter VD_AGENT_MONITORS_CONFIG

2012-09-12 Thread Alon Levy
If the guest supports client monitors config we pass it the
VDAgentMonitorsConfig message via the
QXLInterface::client_monitors_config api instead of via the vdagent.
---
 server/agent-msg-filter.c |  8 +++
 server/agent-msg-filter.h |  1 +
 server/reds.c | 55 +--
 3 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index 7584b52..b48dd76 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -24,6 +24,7 @@
 #include 
 #include "red_common.h"
 #include "agent-msg-filter.h"
+#include "red_dispatcher.h"
 
 void agent_msg_filter_init(struct AgentMsgFilter *filter,
 int copy_paste, int discard_all)
@@ -80,6 +81,13 @@ data_to_read:
 filter->result = AGENT_MSG_FILTER_DISCARD;
 }
 break;
+case VD_AGENT_MONITORS_CONFIG:
+if (red_dispatcher_use_client_monitors_config()) {
+filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
+} else {
+filter->result = AGENT_MSG_FILTER_OK;
+}
+break;
 default:
 filter->result = AGENT_MSG_FILTER_OK;
 }
diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index ecccfc7..0132ad7 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -28,6 +28,7 @@ enum {
 AGENT_MSG_FILTER_OK,
 AGENT_MSG_FILTER_DISCARD,
 AGENT_MSG_FILTER_PROTO_ERROR,
+AGENT_MSG_FILTER_MONITORS_CONFIG,
 AGENT_MSG_FILTER_END
 };
 
diff --git a/server/reds.c b/server/reds.c
index 57ce88b..1240049 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -234,6 +234,15 @@ typedef struct SpiceCharDeviceStateItem {
 SpiceCharDeviceState *st;
 } SpiceCharDeviceStateItem;
 
+/* Intermediate state for on going monitors config message from a single
+ * client, being passed to the guest */
+typedef struct RedsClientMonitorsConfig {
+MainChannelClient *mcc;
+uint8_t *buffer;
+int buffer_size;
+int buffer_pos;
+} RedsClientMonitorsConfig;
+
 typedef struct RedsState {
 int listen_socket;
 int secure_listen_socket;
@@ -284,6 +293,8 @@ typedef struct RedsState {
 #endif
 int peer_minor_version;
 int allow_multiple_clients;
+
+RedsClientMonitorsConfig client_monitors_config;
 } RedsState;
 
 static RedsState *reds = NULL;
@@ -1184,6 +1195,41 @@ void reds_release_agent_data_buffer(uint8_t *buf)
 dev_state->recv_from_client_buf_pushed = FALSE;
 }
 
+static void reds_client_monitors_config_cleanup(void)
+{
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size = cmc->buffer_pos = 0;
+free(cmc->buffer);
+cmc->buffer = NULL;
+cmc->mcc = NULL;
+}
+
+static void reds_on_main_agent_monitors_config(
+MainChannelClient *mcc, void *message, size_t size)
+{
+VDAgentMessage *msg_header;
+VDAgentMonitorsConfig *monitors_config;
+RedsClientMonitorsConfig *cmc = &reds->client_monitors_config;
+
+cmc->buffer_size += size;
+cmc->buffer = realloc(cmc->buffer, cmc->buffer_size);
+spice_assert(cmc->buffer);
+cmc->mcc = mcc;
+memcpy(cmc->buffer + cmc->buffer_pos, message, size);
+cmc->buffer_pos += size;
+msg_header = (VDAgentMessage *)cmc->buffer;
+if (sizeof(VDAgentMessage) > cmc->buffer_size ||
+msg_header->size > cmc->buffer_size - sizeof(VDAgentMessage)) {
+spice_debug("not enough data yet. %d\n", cmc->buffer_size);
+return;
+}
+monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + 
sizeof(*msg_header));
+spice_debug("%s: %d\n", __func__, monitors_config->num_of_monitors);
+red_dispatcher_client_monitors_config(monitors_config);
+reds_client_monitors_config_cleanup();
+}
+
 void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t 
size)
 {
 VDIPortState *dev_state = &reds->agent_state;
@@ -1199,16 +1245,18 @@ void reds_on_main_agent_data(MainChannelClient *mcc, 
void *message, size_t size)
 break;
 case AGENT_MSG_FILTER_DISCARD:
 return;
+case AGENT_MSG_FILTER_MONITORS_CONFIG:
+reds_on_main_agent_monitors_config(mcc, message, size);
+return;
 case AGENT_MSG_FILTER_PROTO_ERROR:
 reds_disconnect();
 return;
 }
-
 // TODO - start tracking agent data per channel
 header =  (VDIChunkHeader *)dev_state->recv_from_client_buf->buf;
 header->port = VDP_CLIENT_PORT;
 header->size = size;
-dev_state->recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) + size;
+reds->agent_state.recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) 
+ size;
 
 dev_state->recv_from_client_buf_pushed = TRUE;
 spice_char_device_write_buffer_add(reds->agent_state.base, 
dev_state->recv_from_client_buf);
@@ -3980,6 +4028,9 @@ static int do_spice_init(SpiceCoreInterface 
*core_interface)
 inputs_init();
 
 reds->mouse_mod

Re: [Spice-devel] multiple concurrent spice consoles (was [Users] Ovirt + Spice + VDI)

2012-09-12 Thread Itamar Heim

On 09/12/2012 07:32 PM, Mohsen Saeedi wrote:

Hi
I want to know, we are force to install one windows per user? does spice
can provide a multi remote connection to a single windows XP machine?
I want to install one windows XP as virtual desktop and then share it
with more than one users.is it possible in now or in the futures?
Thanks


___
Users mailing list
us...@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users



adding spice-devel

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