Set of patches for further support of VSync

Submitted by Yuri Benditovich on March 12, 2017, 8:44 a.m.

Details

Reviewer None
Submitted March 12, 2017, 8:44 a.m.
Last Updated April 8, 2017, 10:47 a.m.
Revision 3

Cover Letter(s)

Revision 1
      The main goal is to reduce time in GDI callback (PresentDisplayOnly) and avoid
situation when the processing takes more than 2 seconds causing class driver
watchdog.

1. We offload sending of drawable commands to separate thread (waiting for room in command ring
   may take unpredictable time)
2. In case the usage of device memory is high, allocation of bitmap for rectangle to draw
   also may take unpredictable time (note that single full screen redraw requires >3 MB of space)
   So, we make drawable objects allocation from GDI callaback fast and non-forced and in case they
   fail we provide alternate allocation from OS heap
3. The thread before send drawable command shall take care on these objects that was allocated from
   OS heap and allocate them from device memory (now we are not limited by time)
4. We still do not enable VSync automatically, but this can be done for evaluation/testing purpose via
   setting in the driver's registry

Yuri Benditovich (12):
  qxl-wddm-dod: Prepare system thread for rendering
  qxl-wddm-dod: Use rendering offload thread
  qxl-wddm-dod: Introduce TimeMeasurement class for timing debugging
  qxl-wddm-dod: Debug warning on long wait on event
  qxl-wddm-dod: Reduce amount of unnecessary printouts
  qxl-wddm-dod: Registry-based control over VSync
  qxl-wddm-dod: Set VSync indication period to 200ms
  qxl-wddm-dod: Prepare for failure to allocate memory
  qxl-wddm-dod: PutBytesAlign supports non-forced allocation
  qxl-wddm-dod: Optimize allocation of memory chunks
  qxl-wddm-dod: Implement non-forced bitmap allocation
  qxl-wddm-dod: Non-forced memory allocations with VSync

 qxldod/QxlDod.cpp | 581 +++++++++++++++++++++++++++++++++++++++++++++---------
 qxldod/QxlDod.h   |  87 +++++++-
 qxldod/driver.cpp |  35 ++++
 3 files changed, 606 insertions(+), 97 deletions(-)
    
Revision 2
      The main goal is to reduce time in GDI callback (PresentDisplayOnly) and avoid
situation when the processing takes more than 2 seconds causing class driver
watchdog.

1. We offload sending of drawable commands to separate thread (waiting for room in command ring
   may take unpredictable time)
2. In case the usage of device memory is high, allocation of bitmap for rectangle to draw
   also may take unpredictable time (note that single full screen redraw requires >3 MB of space)
   We make drawable objects allocation from GDI callback fast and non-forced and in case they
   fail we provide alternate allocation from OS heap
3. The thread before it sends drawable command down takes care on objects that were allocated from
   OS heap and allocates them from device memory (forced, as now we are not limited by time)
4. We still do not enable VSync automatically, but this can be done for evaluation/testing purpose via
   setting in the driver's registry

Changes from V1:
Changed allocations style and coding style
Removed additional synchronization on deallocation upon allocation failure
Removed waiting for thread start on driver startup
Other cosmetic changes

yuri.benditovich@daynix.com (12):
  qxl-wddm-dod: Prepare system thread for rendering
  qxl-wddm-dod: Use rendering offload thread
  qxl-wddm-dod: Introduce TimeMeasurement class for timing debugging
  qxl-wddm-dod: Debug warning on long wait on event
  qxl-wddm-dod: Reduce amount of unnecessary printouts
  qxl-wddm-dod: Registry-based control over VSync
  qxl-wddm-dod: Set VSync indication period to 200ms
  qxl-wddm-dod: Prepare for failure to allocate memory
  qxl-wddm-dod: PutBytesAlign supports non-forced allocation
  qxl-wddm-dod: Optimize allocation of memory chunks
  qxl-wddm-dod: Implement non-forced bitmap allocation
  qxl-wddm-dod: Non-forced memory allocations with VSync

 qxldod/QxlDod.cpp | 554 ++++++++++++++++++++++++++++++++++++++++++------------
 qxldod/QxlDod.h   |  86 ++++++++-
 qxldod/driver.cpp |  35 ++++
 3 files changed, 554 insertions(+), 121 deletions(-)
    
Revision 3
      The main goal is to reduce time in GDI callback (PresentDisplayOnly) and avoid
situation when the processing takes more than 2 seconds causing class driver
watchdog.

1. We offload sending of drawable commands to separate thread (waiting for room in command ring
   may take unpredictable time)
2. In case the usage of device memory is high, allocation of bitmap for rectangle to draw
   also may take unpredictable time (note that single full screen redraw requires >3 MB of space)
   We make drawable objects allocation from GDI callback fast and non-forced and in case they
   fail we provide alternate allocation from OS heap
3. The thread before it sends drawable command down takes care on objects that were allocated from
   OS heap and allocates them from device memory (forced, as now we are not limited by time)
4. We still do not enable VSync automatically, but this can be done for evaluation/testing purpose via
   setting in the driver's registry

Changes from V2:
Fixed coding style
Added checks for allocation result (patch 1)
Removed duplicated code (patch 2)
Splitted commit of non-forced bitmap allocation (patches 4-5)
Added reduced processing in thread after PnP stop received (patch 6)
Extended commit comment (patch 6)
Other cosmetic changes

Changes from V1:
Changed allocations style and coding style
Removed additional synchronization on deallocation upon allocation failure
Removed waiting for thread start on driver startup
Other cosmetic changes

yuri.benditovich@daynix.com (3):
  qxl-wddm-dod: Prepare for failure to allocate memory
  qxl-wddm-dod: PutBytesAlign supports non-forced allocation
  qxl-wddm-dod: Optimize allocation of memory chunks
  qxl-wddm-dod: Dedicated procedure for bitmap creation
  qxl-wddm-dod: Implement non-forced bitmap allocation
  qxl-wddm-dod: Non-forced memory allocations with VSync

 qxldod/QxlDod.cpp | 390 ++++++++++++++++++++++++++++++++++++++++++------------
 qxldod/QxlDod.h   |  18 ++-
 2 files changed, 324 insertions(+), 84 deletions(-)
    

Revisions