diff options
author | Alon Levy <alevy@redhat.com> | 2011-05-17 13:42:22 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-05-17 13:42:22 +0300 |
commit | d1f4bf9363fd6e922689286db97401da0de2ac1d (patch) | |
tree | 40832473d76acb00d89260f7551e0663a08aca99 | |
parent | 2ea2ca433a9bdfc7ededb5ae40a55759ceabb43a (diff) |
(temp) current working state, don't remember :(s3.temp
-rw-r--r-- | display/driver.c | 6 | ||||
-rw-r--r-- | display/res.c | 25 | ||||
-rw-r--r-- | display/res.h | 1 | ||||
-rw-r--r-- | display/surface.c | 17 | ||||
-rw-r--r-- | display/surface.h | 4 |
5 files changed, 22 insertions, 31 deletions
diff --git a/display/driver.c b/display/driver.c index 810c19f..4067176 100644 --- a/display/driver.c +++ b/display/driver.c @@ -922,10 +922,10 @@ static void PreD3(PDev *pdev) static BOOL PostD3(PDev *pdev) { ULONG n; - QXLDriverInfo dev_info; + ULONG init_required; - if (EngDeviceIoControl(pdev->driver, IOCTL_QXL_GET_INFO, NULL, - 0, &dev_info, sizeof(QXLDriverInfo), &n) ) { + if (EngDeviceIoControl(pdev->driver, IOCTL_QXL_GET_INIT_REQUIRED, NULL, + 0, &init_required, sizeof(init_required), &n) ) { DEBUG_PRINT((pdev, 0, "%s: get qxl info failed, 0x%lx\n", __FUNCTION__, pdev)); return FALSE; } diff --git a/display/res.c b/display/res.c index ecdab91..1d21d66 100644 --- a/display/res.c +++ b/display/res.c @@ -726,7 +726,13 @@ _inline void GetSurfaceMemory(PDev *pdev, UINT32 x, UINT32 y, UINT32 depth, UINT } } -void ReleaseSurfaceMemory(PDev *pdev, UINT8 *base_mem, UINT8 allocation_type) +void QXLGetSurface(PDev *pdev, QXLPHYSICAL *surface_phys, UINT32 x, UINT32 y, UINT32 depth, + UINT32 *stride, UINT8 **base_mem, UINT8 allocation_type) +{ + GetSurfaceMemory(pdev, x, y, depth, stride, base_mem, surface_phys, allocation_type); +} + +void QXLDelSurface(PDev *pdev, UINT8 *base_mem, UINT8 allocation_type) { switch (allocation_type) { case DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM: @@ -740,21 +746,6 @@ void ReleaseSurfaceMemory(PDev *pdev, UINT8 *base_mem, UINT8 allocation_type) } } -void QXLGetSurface(PDev *pdev, QXLPHYSICAL *surface_phys, UINT32 x, UINT32 y, UINT32 depth, - UINT32 *stride, UINT8 **base_mem, UINT8 allocation_type) -{ - GetSurfaceMemory(pdev, x, y, depth, stride, base_mem, surface_phys, allocation_type); -} - -void QXLDelSurface(PDev *pdev, UINT8 *base_mem, UINT8 allocation_type) -{ - if (allocation_type == DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM) { - FreeMem(pdev, MSPACE_TYPE_DEVRAM, base_mem); - } else if (allocation_type == DEVICE_BITMAP_ALLOCATION_TYPE_VRAM) { // this wasn't there in the original code - FreeMem(pdev, MSPACE_TYPE_VRAM, base_mem); - } -} - typedef struct InternalDelSurface { UINT32 surface_id; UINT8 allocation_type; @@ -767,7 +758,7 @@ static void FreeDelSurface(PDev *pdev, Resource *res) DEBUG_PRINT((pdev, 12, "%s\n", __FUNCTION__)); internal = (InternalDelSurface *)res->res; - ReleaseSurfaceMemory(pdev, GetSurfaceInfo(pdev, internal->surface_id)->draw_area.base_mem, + QXLDelSurface(pdev, GetSurfaceInfo(pdev, internal->surface_id)->draw_area.base_mem, internal->allocation_type); FreeSurfaceInfo(pdev, internal->surface_id); FreeMem(pdev, MSPACE_TYPE_DEVRAM, res); diff --git a/display/res.h b/display/res.h index 8e35ef3..d45e579 100644 --- a/display/res.h +++ b/display/res.h @@ -72,7 +72,6 @@ void CheckAndSetSSE2(); #endif void ResetAllDevices(); void InitDeviceMemoryResources(PDev *pdev); -void ReleaseSurfaceMemory(PDev *pdev, UINT8 *base_mem, UINT8 allocation_type); void EmptyReleaseRing(PDev *pdev); #endif diff --git a/display/surface.c b/display/surface.c index 67e4afe..dc714ad 100644 --- a/display/surface.c +++ b/display/surface.c @@ -40,8 +40,8 @@ #include "res.h" #include "surface.h" -BOOL CreateDrawArea(PDev *pdev, UINT8 *base_mem, ULONG format, UINT32 cx, UINT32 cy, UINT32 stride, - UINT32 surface_id) +static BOOL CreateDrawArea(PDev *pdev, UINT8 *base_mem, ULONG format, UINT32 cx, UINT32 cy, + UINT32 stride, UINT32 surface_id) { SIZEL size; DrawArea *drawarea; @@ -74,7 +74,7 @@ error: return FALSE; } -VOID FreeDrawArea(DrawArea *drawarea) +static VOID FreeDrawArea(DrawArea *drawarea) { if (drawarea->surf_obj) { EngUnlockSurface(drawarea->surf_obj); @@ -188,7 +188,11 @@ VOID BackupSurfaces(PDev *pdev) } surf_obj = surface_info->draw_area.surf_obj; if (!surf_obj) { - surface_info->copy = (UINT8*)1; + DEBUG_PRINT((pdev, 0, "%s: %d: no surfobj, finishing release of surface\n", + __FUNCTION__, surface_id)); + QXLDelSurface(pdev, surface_info->draw_area.base_mem, + DEVICE_BITMAP_ALLOCATION_TYPE_VRAM); + FreeSurfaceInfo(pdev, surface_id); continue; } size = surf_obj->sizlBitmap.cy * abs(surf_obj->lDelta); @@ -245,7 +249,7 @@ VOID ResendSurfaceCreateCommands(PDev *pdev) DEBUG_PRINT((pdev, 0, "%s: stride = %d, phys_mem = %p, base_mem = %p\n", __FUNCTION__, stride, phys_mem, &surface_info->draw_area.base_mem)); if (surface_info->copy != NULL && surface_info->copy != (UINT8*)1) { - DEBUG_PRINT((pdev, 0, "%s: copy %d bytes to %d\n", __FUNCTION__, size, surface_id)); + DEBUG_PRINT((pdev, 0, "%s: copy %d bytes to %d\n", __FUNCTION__, size, surface_id)); RtlCopyMemory(surface_info->draw_area.base_mem, surface_info->copy, size); EngFreeMem(surface_info->copy); } @@ -273,7 +277,8 @@ VOID DeleteDeviceBitmap(PDev *pdev, UINT32 surface_id, UINT8 allocation_type) /* the PDEV is suspended, so don't try to write anything to the device, just * release this (if this doesn't work, go to the "keep a list of freed surfaces" * like uri suggested) */ - ReleaseSurfaceMemory(pdev, GetSurfaceInfo(pdev, surface_id)->draw_area.base_mem, + DEBUG_PRINT((pdev, 1, "%s: (guest only) id %d\n", __FUNCTION__, surface_id)); + QXLDelSurface(pdev, GetSurfaceInfo(pdev, surface_id)->draw_area.base_mem, allocation_type); FreeSurfaceInfo(pdev, surface_id); return; diff --git a/display/surface.h b/display/surface.h index c81b4d7..c96ccf3 100644 --- a/display/surface.h +++ b/display/surface.h @@ -84,10 +84,6 @@ enum { DEVICE_BITMAP_ALLOCATION_TYPE_RAM, }; -BOOL CreateDrawArea(PDev *pdev, UINT8 *base_mem, ULONG format, UINT32 cx, UINT32 cy, UINT32 stride, - UINT32 surface_id); -VOID FreeDrawArea(DrawArea *drawarea); - HBITMAP CreateDeviceBitmap(PDev *pdev, SIZEL size, ULONG format, QXLPHYSICAL *phys_mem, UINT8 **base_mem, UINT32 surface_id, UINT8 allocation_type); VOID DeleteDeviceBitmap(PDev *pdev, UINT32 surface_id, UINT8 allocation_type); |