Re: [Qemu-devel] [RFC 2/2] hmp/qxl: info spice: add qxl0_mode qxl0_guest_bug

2012-05-21 Thread Gerd Hoffmann
  Hi,

 +if (info-qxl0_guest_bug != -1  info-qxl0_mode != -1) {
 +monitor_printf(mon,  qxl0\n);
 +monitor_printf(mon,guest_bug: %PRIu64d\n, 
 info-qxl0_guest_bug);
 +monitor_printf(mon, mode: %s\n,
 +SpiceQueryQXLMode_lookup[info-qxl0_mode]);
 +}

Anything else we might want export while being at it?  For example
whenever guest drivers use sync or async io commands?

What about secondary displays?

 +/* helpers for spice_info. only show first device */
 +int qxl0_guest_bug(void)
 +{
 +if (!qxl0) {
 +return -1;
 +}
 +return qxl0-guest_bug;
 +}
 +
 +int qxl0_mode(void)
 +{
 +if (!qxl0) {
 +return -1;
 +}
 +return qxl0-mode;
 +}

Hmm, that is a bit hackish.  qxl0 exists only for the reason that
displaychangelisteners don't support passing through a opaque pointer
(or other way to get the state).  I'd prefer to get rid of it, not add
more uses, although I can see that it is convenient ...


cheers,
  Gerd



Re: [Qemu-devel] [RFC 2/2] hmp/qxl: info spice: add qxl0_mode qxl0_guest_bug

2012-05-21 Thread Alon Levy
On Mon, May 21, 2012 at 11:22:16AM +0200, Gerd Hoffmann wrote:
   Hi,
 
  +if (info-qxl0_guest_bug != -1  info-qxl0_mode != -1) {
  +monitor_printf(mon,  qxl0\n);
  +monitor_printf(mon,guest_bug: %PRIu64d\n, 
  info-qxl0_guest_bug);
  +monitor_printf(mon, mode: %s\n,
  +SpiceQueryQXLMode_lookup[info-qxl0_mode]);
  +}
 
 Anything else we might want export while being at it?  For example
 whenever guest drivers use sync or async io commands?
 
 What about secondary displays?

OK, so I can fix this and remove the qxl0 hack at the same stroke. I was
looking at using the system_bus, but that seems like another hack. The
alternative is to keep a linked list of qxl devices private to qxl.c and
use that, and the below functions become

int qxl_guest_bug(int index)
int qxl_mode(int index)
int qxl_device_count(void)

How does that sound?

 
  +/* helpers for spice_info. only show first device */
  +int qxl0_guest_bug(void)
  +{
  +if (!qxl0) {
  +return -1;
  +}
  +return qxl0-guest_bug;
  +}
  +
  +int qxl0_mode(void)
  +{
  +if (!qxl0) {
  +return -1;
  +}
  +return qxl0-mode;
  +}
 
 Hmm, that is a bit hackish.  qxl0 exists only for the reason that
 displaychangelisteners don't support passing through a opaque pointer
 (or other way to get the state).  I'd prefer to get rid of it, not add
 more uses, although I can see that it is convenient ...
 
 
 cheers,
   Gerd



Re: [Qemu-devel] [RFC 2/2] hmp/qxl: info spice: add qxl0_mode qxl0_guest_bug

2012-05-21 Thread Gerd Hoffmann
  Hi,

 OK, so I can fix this and remove the qxl0 hack at the same stroke. I was
 looking at using the system_bus, but that seems like another hack.

Didn't check what qom provides these days, searching for objects of a
certain type (for example a qxl device) should be possible IMO.  Dunno
whenever it actually is.

 The
 alternative is to keep a linked list of qxl devices private to qxl.c and
 use that, and the below functions become

Second best option if the QOM way doesn't fly.

 int qxl_guest_bug(int index)
 int qxl_mode(int index)
 int qxl_device_count(void)
 
 How does that sound?

qxl_guest_bug(Object *dev) ?

cheers,
  Gerd