Re: [Spice-devel] [win32-qxl PATCH v3] Add monitors_config escape to Windows QXL display driver.

2015-06-30 Thread Christophe Fergeau
On Thu, Jun 25, 2015 at 12:56:41PM +0200, Fabiano FidĂȘncio wrote:
 On Wed, Jun 24, 2015 at 8:29 PM, Sandy Stutsman sstut...@redhat.com wrote:
  Provides correct monitor locations when specified via the guest
  Screen Resolution applet.
 
  Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1202419
 
 Looks good!

Pushed now.

Christophe


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


Re: [Spice-devel] [win32-qxl PATCH v3] Add monitors_config escape to Windows QXL display driver.

2015-06-29 Thread Christophe Fergeau
On Wed, Jun 24, 2015 at 02:29:15PM -0400, Sandy Stutsman wrote:
 Provides correct monitor locations when specified via the guest
 Screen Resolution applet.
 
 Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1202419
 ---
 Changes from v1 and v2
   Remove misc typo fixes
   Reuse existing QXLHead structure instead driver specific escape structure
 ---
  xddm/display/driver.c | 34 ++
  xddm/display/qxldd.h  |  4 
  xddm/display/res.c| 14 ++
  xddm/include/qxl_driver.h |  6 +-
  xddm/miniport/qxl.c   |  3 +++
  5 files changed, 60 insertions(+), 1 deletion(-)
 
 diff --git a/xddm/display/driver.c b/xddm/display/driver.c
 index aa4fe42..acc4987 100644
 --- a/xddm/display/driver.c
 +++ b/xddm/display/driver.c
 @@ -253,6 +253,26 @@ BOOL DrvEnableDriver(ULONG engine_version, ULONG 
 enable_data_size, PDRVENABLEDAT
  return TRUE;
  }
  
 +static void SetMonitorConfig(PDev *pdev,QXLHead * esc_config)
 +{
 +QXLMonitorsConfig   *monitorConfig;

This one is unused, I'll drop it before pushing.

Christophe

 +QXLHead *heads;
 +
 +pdev-monitor_config-count = 1;
 +pdev-monitor_config-max_allowed = 1;
 +
 +heads = pdev-monitor_config-heads[0];
 +heads-id = 0;
 +heads-surface_id = 0;
 +heads-x = esc_config-x;
 +heads-y = esc_config-y;
 +heads-width = esc_config-width;
 +heads-height = esc_config-height;
 +DEBUG_PRINT((pdev, 2, %s Monitor %d (%d, %d) (%d x %d)\n,
 +__FUNCTION__, pdev-dev_id, heads-x, heads-y, heads-width, 
 heads-height));
 +async_io(pdev, ASYNCABLE_MONITOR_CONFIG, 0);
 +}
 +
  ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn,
  ULONG cjOut, PVOID pvOut)
  {
 @@ -275,6 +295,16 @@ ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, 
 PVOID pvIn,
  RetVal = 1;
  break;
  }
 +case QXL_ESCAPE_MONITOR_CONFIG: {
 +ULONG length;
 +DEBUG_PRINT((pdev, 2, %s - 0x%p \n, __FUNCTION__, pdev));
 +if (pdev == NULL || cjIn != sizeof(QXLHead))
 +break;
 +
 +SetMonitorConfig(pdev, (QXLHead * )pvIn);
 +RetVal = 1;
 +break;
 +}
  default:
  DEBUG_PRINT((NULL, 1, %s: unhandled escape code %d\n, 
 __FUNCTION__, iEsc));
  RetVal = 0;
 @@ -774,6 +804,9 @@ static BOOL PrepareHardware(PDev *pdev)
  pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][ASYNC] = 
 dev_info.flush_surfaces_async_port;
  pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][SYNC] = NULL;
  
 +pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][ASYNC] = 
 dev_info.monitors_config_port;
 +pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][SYNC] = NULL;
 +
  pdev-display_event = dev_info.display_event;
  pdev-cursor_event = dev_info.cursor_event;
  pdev-sleep_event = dev_info.sleep_event;
 @@ -847,6 +880,7 @@ static BOOL PrepareHardware(PDev *pdev)
  DEBUG_PRINT((pdev, 1, %s: create_non_primary_surfaces = %d\n, 
 __FUNCTION__,
   pdev-create_non_primary_surfaces));
  
 +pdev-monitor_config_pa = dev_info.monitors_config;
  CreateVRamSlot(pdev);
  
  DEBUG_PRINT((NULL, 1, %s: 0x%lx exit: 0x%lx %ul\n, __FUNCTION__, pdev,
 diff --git a/xddm/display/qxldd.h b/xddm/display/qxldd.h
 index a0b2eab..9ce5243 100644
 --- a/xddm/display/qxldd.h
 +++ b/xddm/display/qxldd.h
 @@ -180,6 +180,7 @@ typedef enum {
  ASYNCABLE_DESTROY_SURFACE,
  ASYNCABLE_DESTROY_ALL_SURFACES,
  ASYNCABLE_FLUSH_SURFACES,
 +ASYNCABLE_MONITOR_CONFIG,
  
  ASYNCABLE_COUNT
  } asyncable_t;
 @@ -349,6 +350,9 @@ typedef struct PDev {
  
  UCHAR  pci_revision;
  
 +QXLMonitorsConfig * monitor_config;
 +QXLPHYSICAL * monitor_config_pa;
 +
  #ifdef DBG
  int num_free_pages;
  int num_outputs;
 diff --git a/xddm/display/res.c b/xddm/display/res.c
 index bfb3571..7c65e29 100644
 --- a/xddm/display/res.c
 +++ b/xddm/display/res.c
 @@ -548,12 +548,26 @@ void ClearResources(PDev *pdev)
  }
  }
  
 +/*
 + * Tell the spice server where to look for updates to the monitor 
 configuration.
 + */
 +void InitMonitorConfig(PDev *pdev)
 +{
 +size_t monitor_config_size   = sizeof(QXLMonitorsConfig) + 
 sizeof(QXLHead);
 +
 +pdev-monitor_config  = AllocMem(pdev, MSPACE_TYPE_DEVRAM, 
 monitor_config_size);
 +RtlZeroMemory(pdev-monitor_config, monitor_config_size);
 +
 +*pdev-monitor_config_pa  = PA(pdev, pdev-monitor_config, 
 pdev-main_mem_slot);
 +}
 +
  void InitResources(PDev *pdev)
  {
  DEBUG_PRINT((pdev, 3, %s: entry\n, __FUNCTION__));
  
  InitSurfaces(pdev);
  InitDeviceMemoryResources(pdev);
 +InitMonitorConfig(pdev);
  
  pdev-update_id = *pdev-dev_update_id;
  
 diff --git a/xddm/include/qxl_driver.h b/xddm/include/qxl_driver.h
 index 677ee17..0ed73c4 100644
 --- a/xddm/include/qxl_driver.h
 +++ b/xddm/include/qxl_driver.h
 @@ -32,7 +32,8 @@
  enum {
  FIRST_AVIL_IOCTL_FUNC = 0x800,
  QXL_GET_INFO_FUNC = 

Re: [Spice-devel] [win32-qxl PATCH v3] Add monitors_config escape to Windows QXL display driver.

2015-06-25 Thread Fabiano FidĂȘncio
On Wed, Jun 24, 2015 at 8:29 PM, Sandy Stutsman sstut...@redhat.com wrote:
 Provides correct monitor locations when specified via the guest
 Screen Resolution applet.

 Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1202419
 ---
 Changes from v1 and v2
   Remove misc typo fixes
   Reuse existing QXLHead structure instead driver specific escape structure
 ---
  xddm/display/driver.c | 34 ++
  xddm/display/qxldd.h  |  4 
  xddm/display/res.c| 14 ++
  xddm/include/qxl_driver.h |  6 +-
  xddm/miniport/qxl.c   |  3 +++
  5 files changed, 60 insertions(+), 1 deletion(-)

 diff --git a/xddm/display/driver.c b/xddm/display/driver.c
 index aa4fe42..acc4987 100644
 --- a/xddm/display/driver.c
 +++ b/xddm/display/driver.c
 @@ -253,6 +253,26 @@ BOOL DrvEnableDriver(ULONG engine_version, ULONG 
 enable_data_size, PDRVENABLEDAT
  return TRUE;
  }

 +static void SetMonitorConfig(PDev *pdev,QXLHead * esc_config)
 +{
 +QXLMonitorsConfig   *monitorConfig;
 +QXLHead *heads;
 +
 +pdev-monitor_config-count = 1;
 +pdev-monitor_config-max_allowed = 1;
 +
 +heads = pdev-monitor_config-heads[0];
 +heads-id = 0;
 +heads-surface_id = 0;
 +heads-x = esc_config-x;
 +heads-y = esc_config-y;
 +heads-width = esc_config-width;
 +heads-height = esc_config-height;
 +DEBUG_PRINT((pdev, 2, %s Monitor %d (%d, %d) (%d x %d)\n,
 +__FUNCTION__, pdev-dev_id, heads-x, heads-y, heads-width, 
 heads-height));
 +async_io(pdev, ASYNCABLE_MONITOR_CONFIG, 0);
 +}
 +
  ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn,
  ULONG cjOut, PVOID pvOut)
  {
 @@ -275,6 +295,16 @@ ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, 
 PVOID pvIn,
  RetVal = 1;
  break;
  }
 +case QXL_ESCAPE_MONITOR_CONFIG: {
 +ULONG length;
 +DEBUG_PRINT((pdev, 2, %s - 0x%p \n, __FUNCTION__, pdev));
 +if (pdev == NULL || cjIn != sizeof(QXLHead))
 +break;
 +
 +SetMonitorConfig(pdev, (QXLHead * )pvIn);
 +RetVal = 1;
 +break;
 +}
  default:
  DEBUG_PRINT((NULL, 1, %s: unhandled escape code %d\n, 
 __FUNCTION__, iEsc));
  RetVal = 0;
 @@ -774,6 +804,9 @@ static BOOL PrepareHardware(PDev *pdev)
  pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][ASYNC] = 
 dev_info.flush_surfaces_async_port;
  pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][SYNC] = NULL;

 +pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][ASYNC] = 
 dev_info.monitors_config_port;
 +pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][SYNC] = NULL;
 +
  pdev-display_event = dev_info.display_event;
  pdev-cursor_event = dev_info.cursor_event;
  pdev-sleep_event = dev_info.sleep_event;
 @@ -847,6 +880,7 @@ static BOOL PrepareHardware(PDev *pdev)
  DEBUG_PRINT((pdev, 1, %s: create_non_primary_surfaces = %d\n, 
 __FUNCTION__,
   pdev-create_non_primary_surfaces));

 +pdev-monitor_config_pa = dev_info.monitors_config;
  CreateVRamSlot(pdev);

  DEBUG_PRINT((NULL, 1, %s: 0x%lx exit: 0x%lx %ul\n, __FUNCTION__, pdev,
 diff --git a/xddm/display/qxldd.h b/xddm/display/qxldd.h
 index a0b2eab..9ce5243 100644
 --- a/xddm/display/qxldd.h
 +++ b/xddm/display/qxldd.h
 @@ -180,6 +180,7 @@ typedef enum {
  ASYNCABLE_DESTROY_SURFACE,
  ASYNCABLE_DESTROY_ALL_SURFACES,
  ASYNCABLE_FLUSH_SURFACES,
 +ASYNCABLE_MONITOR_CONFIG,

  ASYNCABLE_COUNT
  } asyncable_t;
 @@ -349,6 +350,9 @@ typedef struct PDev {

  UCHAR  pci_revision;

 +QXLMonitorsConfig * monitor_config;
 +QXLPHYSICAL * monitor_config_pa;
 +
  #ifdef DBG
  int num_free_pages;
  int num_outputs;
 diff --git a/xddm/display/res.c b/xddm/display/res.c
 index bfb3571..7c65e29 100644
 --- a/xddm/display/res.c
 +++ b/xddm/display/res.c
 @@ -548,12 +548,26 @@ void ClearResources(PDev *pdev)
  }
  }

 +/*
 + * Tell the spice server where to look for updates to the monitor 
 configuration.
 + */
 +void InitMonitorConfig(PDev *pdev)
 +{
 +size_t monitor_config_size   = sizeof(QXLMonitorsConfig) + 
 sizeof(QXLHead);
 +
 +pdev-monitor_config  = AllocMem(pdev, MSPACE_TYPE_DEVRAM, 
 monitor_config_size);
 +RtlZeroMemory(pdev-monitor_config, monitor_config_size);
 +
 +*pdev-monitor_config_pa  = PA(pdev, pdev-monitor_config, 
 pdev-main_mem_slot);
 +}
 +
  void InitResources(PDev *pdev)
  {
  DEBUG_PRINT((pdev, 3, %s: entry\n, __FUNCTION__));

  InitSurfaces(pdev);
  InitDeviceMemoryResources(pdev);
 +InitMonitorConfig(pdev);

  pdev-update_id = *pdev-dev_update_id;

 diff --git a/xddm/include/qxl_driver.h b/xddm/include/qxl_driver.h
 index 677ee17..0ed73c4 100644
 --- a/xddm/include/qxl_driver.h
 +++ b/xddm/include/qxl_driver.h
 @@ -32,7 +32,8 @@
  enum {
  FIRST_AVIL_IOCTL_FUNC = 0x800,
  QXL_GET_INFO_FUNC = FIRST_AVIL_IOCTL_FUNC,
 -QXL_SET_CUSTOM_DISPLAY
 +QXL_SET_CUSTOM_DISPLAY,

[Spice-devel] [win32-qxl PATCH v3] Add monitors_config escape to Windows QXL display driver.

2015-06-24 Thread Sandy Stutsman
Provides correct monitor locations when specified via the guest
Screen Resolution applet.

Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1202419
---
Changes from v1 and v2
  Remove misc typo fixes
  Reuse existing QXLHead structure instead driver specific escape structure
---
 xddm/display/driver.c | 34 ++
 xddm/display/qxldd.h  |  4 
 xddm/display/res.c| 14 ++
 xddm/include/qxl_driver.h |  6 +-
 xddm/miniport/qxl.c   |  3 +++
 5 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/xddm/display/driver.c b/xddm/display/driver.c
index aa4fe42..acc4987 100644
--- a/xddm/display/driver.c
+++ b/xddm/display/driver.c
@@ -253,6 +253,26 @@ BOOL DrvEnableDriver(ULONG engine_version, ULONG 
enable_data_size, PDRVENABLEDAT
 return TRUE;
 }
 
+static void SetMonitorConfig(PDev *pdev,QXLHead * esc_config)
+{
+QXLMonitorsConfig   *monitorConfig;
+QXLHead *heads;
+
+pdev-monitor_config-count = 1;
+pdev-monitor_config-max_allowed = 1;
+
+heads = pdev-monitor_config-heads[0];
+heads-id = 0;
+heads-surface_id = 0;
+heads-x = esc_config-x;
+heads-y = esc_config-y;
+heads-width = esc_config-width;
+heads-height = esc_config-height;
+DEBUG_PRINT((pdev, 2, %s Monitor %d (%d, %d) (%d x %d)\n,
+__FUNCTION__, pdev-dev_id, heads-x, heads-y, heads-width, 
heads-height));
+async_io(pdev, ASYNCABLE_MONITOR_CONFIG, 0);
+}
+
 ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn,
 ULONG cjOut, PVOID pvOut)
 {
@@ -275,6 +295,16 @@ ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, 
PVOID pvIn,
 RetVal = 1;
 break;
 }
+case QXL_ESCAPE_MONITOR_CONFIG: {
+ULONG length;
+DEBUG_PRINT((pdev, 2, %s - 0x%p \n, __FUNCTION__, pdev));
+if (pdev == NULL || cjIn != sizeof(QXLHead))
+break;
+
+SetMonitorConfig(pdev, (QXLHead * )pvIn);
+RetVal = 1;
+break;
+}
 default:
 DEBUG_PRINT((NULL, 1, %s: unhandled escape code %d\n, __FUNCTION__, 
iEsc));
 RetVal = 0;
@@ -774,6 +804,9 @@ static BOOL PrepareHardware(PDev *pdev)
 pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][ASYNC] = 
dev_info.flush_surfaces_async_port;
 pdev-asyncable[ASYNCABLE_FLUSH_SURFACES][SYNC] = NULL;
 
+pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][ASYNC] = 
dev_info.monitors_config_port;
+pdev-asyncable[ASYNCABLE_MONITOR_CONFIG][SYNC] = NULL;
+
 pdev-display_event = dev_info.display_event;
 pdev-cursor_event = dev_info.cursor_event;
 pdev-sleep_event = dev_info.sleep_event;
@@ -847,6 +880,7 @@ static BOOL PrepareHardware(PDev *pdev)
 DEBUG_PRINT((pdev, 1, %s: create_non_primary_surfaces = %d\n, 
__FUNCTION__,
  pdev-create_non_primary_surfaces));
 
+pdev-monitor_config_pa = dev_info.monitors_config;
 CreateVRamSlot(pdev);
 
 DEBUG_PRINT((NULL, 1, %s: 0x%lx exit: 0x%lx %ul\n, __FUNCTION__, pdev,
diff --git a/xddm/display/qxldd.h b/xddm/display/qxldd.h
index a0b2eab..9ce5243 100644
--- a/xddm/display/qxldd.h
+++ b/xddm/display/qxldd.h
@@ -180,6 +180,7 @@ typedef enum {
 ASYNCABLE_DESTROY_SURFACE,
 ASYNCABLE_DESTROY_ALL_SURFACES,
 ASYNCABLE_FLUSH_SURFACES,
+ASYNCABLE_MONITOR_CONFIG,
 
 ASYNCABLE_COUNT
 } asyncable_t;
@@ -349,6 +350,9 @@ typedef struct PDev {
 
 UCHAR  pci_revision;
 
+QXLMonitorsConfig * monitor_config;
+QXLPHYSICAL * monitor_config_pa;
+
 #ifdef DBG
 int num_free_pages;
 int num_outputs;
diff --git a/xddm/display/res.c b/xddm/display/res.c
index bfb3571..7c65e29 100644
--- a/xddm/display/res.c
+++ b/xddm/display/res.c
@@ -548,12 +548,26 @@ void ClearResources(PDev *pdev)
 }
 }
 
+/*
+ * Tell the spice server where to look for updates to the monitor 
configuration.
+ */
+void InitMonitorConfig(PDev *pdev)
+{
+size_t monitor_config_size   = sizeof(QXLMonitorsConfig) + sizeof(QXLHead);
+
+pdev-monitor_config  = AllocMem(pdev, MSPACE_TYPE_DEVRAM, 
monitor_config_size);
+RtlZeroMemory(pdev-monitor_config, monitor_config_size);
+
+*pdev-monitor_config_pa  = PA(pdev, pdev-monitor_config, 
pdev-main_mem_slot);
+}
+
 void InitResources(PDev *pdev)
 {
 DEBUG_PRINT((pdev, 3, %s: entry\n, __FUNCTION__));
 
 InitSurfaces(pdev);
 InitDeviceMemoryResources(pdev);
+InitMonitorConfig(pdev);
 
 pdev-update_id = *pdev-dev_update_id;
 
diff --git a/xddm/include/qxl_driver.h b/xddm/include/qxl_driver.h
index 677ee17..0ed73c4 100644
--- a/xddm/include/qxl_driver.h
+++ b/xddm/include/qxl_driver.h
@@ -32,7 +32,8 @@
 enum {
 FIRST_AVIL_IOCTL_FUNC = 0x800,
 QXL_GET_INFO_FUNC = FIRST_AVIL_IOCTL_FUNC,
-QXL_SET_CUSTOM_DISPLAY
+QXL_SET_CUSTOM_DISPLAY,
+QXL_SET_MONITOR_CONFIG
 };
 
 #define IOCTL_QXL_GET_INFO \
@@ -109,6 +110,7 @@ typedef struct QXLDriverInfo {
 PUCHAR memslot_add_port;
 PUCHAR memslot_del_port;
 PUCHAR