changes the passed user pointer to mspace from NULL to a proper pdev, so it will be able to print using QXL_IO_LOG. --- display/qxldd.h | 25 +++++++++++++++++++++++++ display/res.c | 14 ++++++++------ display/res.h | 1 + 3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/display/qxldd.h b/display/qxldd.h index 5511bad..99ddfed 100644 --- a/display/qxldd.h +++ b/display/qxldd.h @@ -426,4 +426,29 @@ static _inline void async_io(PDev *pdev, PUCHAR async, PUCHAR sync, UCHAR val) } } +#ifdef DBG +#define DUMP_VRAM_MSPACE(pdev) \ + do { \ + DEBUG_PRINT((pdev, 0, "%s: dumping mspace vram (%p, %p)\n", __FUNCTION__, pdev, global_res ? global_res[pdev->dev_id] : NULL)); \ + if (pdev && global_res && global_res[pdev->dev_id]) { \ + mspace_malloc_stats(global_res[pdev->dev_id]->mspaces[MSPACE_TYPE_VRAM]._mspace); \ + } else { \ + DEBUG_PRINT((pdev, 0, "nothing\n")); \ + }\ + } while (0) + +#define DUMP_DEVRAM_MSPACE(pdev) \ + do { \ + DEBUG_PRINT((pdev, 0, "%s: dumping mspace devram (%p, %p)\n", __FUNCTION__, pdev, global_res ? global_res[pdev->dev_id] : NULL)); \ + if (pdev && global_res && global_res[pdev->dev_id]) { \ + mspace_malloc_stats(global_res[pdev->dev_id]->mspaces[MSPACE_TYPE_DEVRAM]._mspace); \ + } else { \ + DEBUG_PRINT((pdev, 0, "nothing\n")); \ + }\ + } while (0) +#else +#define DUMP_VRAM_MSPACE +#define DUMP_DEVRAM_MSPACE +#endif + #endif diff --git a/display/res.c b/display/res.c index 0e5b310..c649f44 100644 --- a/display/res.c +++ b/display/res.c @@ -428,11 +428,13 @@ void InitGlobalRes() } } -static void InitMspace(DevRes *res, UINT32 mspace_type, UINT8 *io_pages_virt, size_t capacity) +static void InitMspace(PDev *pdev, UINT32 mspace_type, UINT8 *start, size_t capacity) { - res->mspaces[mspace_type]._mspace = create_mspace_with_base(io_pages_virt, capacity, 0, NULL); - res->mspaces[mspace_type].mspace_start = io_pages_virt; - res->mspaces[mspace_type].mspace_end = io_pages_virt + capacity; + DevRes *res = pdev->Res; + + res->mspaces[mspace_type]._mspace = create_mspace_with_base(start, capacity, 0, pdev); + res->mspaces[mspace_type].mspace_start = start; + res->mspaces[mspace_type].mspace_end = start + capacity; } static void InitRes(PDev *pdev) @@ -484,8 +486,8 @@ static void InitRes(PDev *pdev) PANIC(pdev, "Res cache sem creation failed\n"); } - InitMspace(pdev->Res, MSPACE_TYPE_DEVRAM, pdev->io_pages_virt, pdev->num_io_pages * PAGE_SIZE); - InitMspace(pdev->Res, MSPACE_TYPE_VRAM, pdev->fb, pdev->fb_size); + InitMspace(pdev, MSPACE_TYPE_DEVRAM, pdev->io_pages_virt, pdev->num_io_pages * PAGE_SIZE); + InitMspace(pdev, MSPACE_TYPE_VRAM, pdev->fb, pdev->fb_size); pdev->Res->update_id = *pdev->dev_update_id; RtlZeroMemory(pdev->Res->image_key_lookup, diff --git a/display/res.h b/display/res.h index ae4ad14..769c02d 100644 --- a/display/res.h +++ b/display/res.h @@ -70,5 +70,6 @@ void ResDestroyGlobals(); void CheckAndSetSSE2(); #endif void ResetAllDevices(); +extern DevRes **global_res; #endif -- 1.7.5.4 _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel