[Spice-devel] [PATCH qxl-wddm-dod 5/8] Compute dynamically slot_id in PA and VA functions
Frediano Ziglio
fziglio at redhat.com
Mon Apr 10 15:31:00 UTC 2017
This make easier to change allocation of memory using different
memory Bars.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
qxldod/QxlDod.cpp | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 2fa925d..28bc35c 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -3580,23 +3580,25 @@ void QxlDevice::DestroyPrimarySurface(void)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
}
-_inline QXLPHYSICAL QxlDevice::PA(PVOID virt, UINT8 slot_id)
+_inline QXLPHYSICAL QxlDevice::PA(PVOID virt, UINT8)
{
PAGED_CODE();
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--> %s\n", __FUNCTION__));
- MemSlot *pSlot = &m_MemSlots[slot_id];
+
+ const MemSlot *pSlot = m_MemSlots;
+ if (virt < pSlot->start_virt_addr || virt > pSlot->last_virt_addr)
+ ++pSlot;
return pSlot->high_bits | ((UINT8*)virt - pSlot->start_virt_addr);
}
-_inline UINT8 *QxlDevice::VA(QXLPHYSICAL paddr, UINT8 slot_id)
+_inline UINT8 *QxlDevice::VA(QXLPHYSICAL paddr, UINT8)
{
PAGED_CODE();
- UINT64 virt;
- MemSlot *pSlot = &m_MemSlots[slot_id];
-
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
- virt = paddr & m_VaSlotMask;
- return pSlot->start_virt_addr + virt;
+
+ UINT8 slot_id = UINT8(paddr >> (64 - m_SlotIdBits)) - m_RomHdr->slots_start;
+ const MemSlot *pSlot = &m_MemSlots[slot_id & 1];
+ return pSlot->start_virt_addr + (paddr & m_VaSlotMask);
}
void QxlDevice::SetupHWSlot(UINT8 Idx, MemSlot *pSlot)
--
2.9.3
More information about the Spice-devel
mailing list