[Spice-devel] [RFC PATCH qxl-wddm-dod] Use DEVRAM if no more space is available in VRAM

Frediano Ziglio fziglio at redhat.com
Mon Apr 10 15:47:00 UTC 2017


Previous Windows drivers use mainly DEVRAM so in some environments
(like RHEV-M 4.0) VRAM is really limited.
This patch use DEVRAM as a fallback to avoid getting out of memory
conditions too earlier in such environments.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 qxldod/QxlDod.cpp | 2 ++
 1 file changed, 2 insertions(+)

This patch should go on top of "Make easier to change Qxl memory layout"
series.
It implements fallback for allocation requests in VRAM.
Basically if there are no memory in VRAM space DEVRAM is attempted
instead. As memory allocated in VRAM can be in DEVRAM this works
without problems (the opposite is not true as some memory must
reside in DEVRAM).
This patch has the advantage to use more memory as it uses both
Bars and potentially decrease memory fragmentation as small
allocations occurs in a single Bar (Bar0).

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 4191525..58a41ff 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4048,6 +4048,8 @@ void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
         FlushReleaseRing();
 
         ptr = mspace_malloc(m_MSInfo[mspace_type]._mspace, size);
+        if (!ptr && mspace_type == MSPACE_TYPE_VRAM && m_MSInfo[MSPACE_TYPE_DEVRAM]._mspace)
+            ptr = mspace_malloc(m_MSInfo[MSPACE_TYPE_DEVRAM]._mspace, size);
         if (ptr) {
             break;
         }
-- 
2.9.3



More information about the Spice-devel mailing list