[Spice-devel,spice-protocol] Add QXL_ESCAPE_SET_CUSTOM_DISPLAY

Submitted by Marc-André Lureau on May 11, 2012, 4:35 p.m.

Details

Message ID 1336754129-10635-1-git-send-email-marcandre.lureau@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marc-André Lureau May 11, 2012, 4:35 p.m.
QXL_ESCAPE_SET_CUSTOM_DISPLAY is Windows specific message
to tell the display & miniport driver to update the mode
table with a custom resolution.

The mode table needs to be forcefully refreshed after
setting a custom display, it can be done by querying an
invalid/unknown mode:

EnumDisplaySettings(dev_name, 0xffffff, &tempDevMode);
---
 spice/Makefile.am   |    1 +
 spice/qxl_windows.h |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 spice/qxl_windows.h

Patch hide | download patch | download mbox

diff --git a/spice/Makefile.am b/spice/Makefile.am
index 167b69c..a54ae89 100644
--- a/spice/Makefile.am
+++ b/spice/Makefile.am
@@ -13,6 +13,7 @@  spice_protocol_include_HEADERS =		\
 	macros.h				\
 	protocol.h				\
 	qxl_dev.h				\
+	qxl_windows.h				\
 	start-packed.h				\
 	stats.h					\
 	types.h					\
diff --git a/spice/qxl_windows.h b/spice/qxl_windows.h
new file mode 100644
index 0000000..d1df684
--- /dev/null
+++ b/spice/qxl_windows.h
@@ -0,0 +1,20 @@ 
+#ifndef _H_QXL_WINDOWS
+#define _H_QXL_WINDOWS
+
+#include <spice/types.h>
+
+#include <spice/start-packed.h>
+
+enum {
+    QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001,
+};
+
+typedef struct SPICE_ATTR_PACKED QXLEscapeSetCustomDisplay {
+    uint32_t xres;
+    uint32_t yres;
+    uint32_t bpp;
+} QXLEscapeSetCustomDisplay;
+
+#include <spice/end-packed.h>
+
+#endif /* _H_QXL_WINDOWS */

Comments

On Fri, May 11, 2012 at 06:35:29PM +0200, Marc-André Lureau wrote:
> QXL_ESCAPE_SET_CUSTOM_DISPLAY is Windows specific message
> to tell the display & miniport driver to update the mode
> table with a custom resolution.
> 
> The mode table needs to be forcefully refreshed after
> setting a custom display, it can be done by querying an
> invalid/unknown mode:
> 
> EnumDisplaySettings(dev_name, 0xffffff, &tempDevMode);
> ---
>  spice/Makefile.am   |    1 +
>  spice/qxl_windows.h |   20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
>  create mode 100644 spice/qxl_windows.h
> 
> diff --git a/spice/Makefile.am b/spice/Makefile.am
> index 167b69c..a54ae89 100644
> --- a/spice/Makefile.am
> +++ b/spice/Makefile.am
> @@ -13,6 +13,7 @@ spice_protocol_include_HEADERS =		\
>  	macros.h				\
>  	protocol.h				\
>  	qxl_dev.h				\
> +	qxl_windows.h				\
>  	start-packed.h				\
>  	stats.h					\
>  	types.h					\
> diff --git a/spice/qxl_windows.h b/spice/qxl_windows.h
> new file mode 100644
> index 0000000..d1df684
> --- /dev/null
> +++ b/spice/qxl_windows.h
> @@ -0,0 +1,20 @@
> +#ifndef _H_QXL_WINDOWS
> +#define _H_QXL_WINDOWS
> +
> +#include <spice/types.h>
> +
> +#include <spice/start-packed.h>
> +
> +enum {
> +    QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001,
> +};
> +
> +typedef struct SPICE_ATTR_PACKED QXLEscapeSetCustomDisplay {
> +    uint32_t xres;
> +    uint32_t yres;
> +    uint32_t bpp;
> +} QXLEscapeSetCustomDisplay;

Do you think we should add fields for later having multiple outputs on a
single device, i.e. VidPN ? ACK if you think this is premature.

> +
> +#include <spice/end-packed.h>
> +
> +#endif /* _H_QXL_WINDOWS */
> -- 
> 1.7.10.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
On Sun, May 13, 2012 at 11:58:33AM +0300, Alon Levy wrote:
> > +enum {
> > +    QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001,
> > +};
> > +
> > +typedef struct SPICE_ATTR_PACKED QXLEscapeSetCustomDisplay {
> > +    uint32_t xres;
> > +    uint32_t yres;
> > +    uint32_t bpp;
> > +} QXLEscapeSetCustomDisplay;
> 
> Do you think we should add fields for later having multiple outputs on a
> single device, i.e. VidPN ? ACK if you think this is premature.

And do we care at all about the size of this structure? uint16_t xres, uint16_t yres
and  uint8_t bpp *should* (famous last words) be enough.

Christophe
----- Mensaje original -----
> On Sun, May 13, 2012 at 11:58:33AM +0300, Alon Levy wrote:
> > > +enum {
> > > +    QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001,
> > > +};
> > > +
> > > +typedef struct SPICE_ATTR_PACKED QXLEscapeSetCustomDisplay {
> > > +    uint32_t xres;
> > > +    uint32_t yres;
> > > +    uint32_t bpp;
> > > +} QXLEscapeSetCustomDisplay;
> > 
> > Do you think we should add fields for later having multiple outputs
> > on a
> > single device, i.e. VidPN ? ACK if you think this is premature.
> 
> And do we care at all about the size of this structure? uint16_t
> xres, uint16_t yres
> and  uint8_t bpp *should* (famous last words) be enough.

- ULONG is what is used in driver API: http://msdn.microsoft.com/en-us/library/windows/hardware/ff570521%28v=vs.85%29.aspx
- we don't rely on Windows types and headers in the protocol
- uint32_t is more explicit and equivalent to ULONG
- (stddef.h doesn't work well with driver code, and it caused a number of errors when included)
On Sun, May 13, 2012 at 10:58 AM, Alon Levy <alevy@redhat.com> wrote:
> Do you think we should add fields for later having multiple outputs on a
> single device, i.e. VidPN ? ACK if you think this is premature.

I think it could easily be added later, either by extending the
structure and checking for the size (patch accepts bigger structure),
or just adding a new code, it's very easy to do, so no need to worry
about hypothetical extensions.