On 07/27/2011 07:17 PM, Alon Levy wrote:
ACK all except for the comment bellow.
You didn't send the patch for asynchronous io port
support(8e64b0f77890). I ACK it as well.
Yonit.
Adds fields to SurfaceInfo to cache data previously only available
via SurfaceArea::draw_area.
Adds two functions to save and restore surfaces from ram:
MoveAllSurfacesToVideoRam
allocates and copies surfaces from vram to ram, and calls EngModifySurface
with an empty hook list to make those surfaces completely managed by gdi and
not
us.
MoveAllSurfacesToRam
recreates surfaces on vram and calls EngModifySurface with QXL_SURFACE_HOOKS,
and
finally sends a QXL_SURFACE_CMD_CREATE with the valid data flag to make the
server
send a surface image message after the surface create message.
Cc: Yonit Halperin<[email protected]>
---
display/driver.c | 4 +-
display/qxldd.h | 6 +-
display/res.c | 10 ++-
display/res.h | 3 +-
display/surface.c | 266 +++++++++++++++++++++++++++++++++++++++++++++--------
display/surface.h | 3 +
6 files changed, 248 insertions(+), 44 deletions(-)
diff --git a/display/driver.c b/display/driver.c
index d5f9d8c..6b12540 100644
--- a/display/driver.c
+++ b/display/driver.c
@@ -1300,7 +1300,9 @@ VOID APIENTRY DrvDeleteDeviceBitmap(DHSURF dhsurf)
ASSERT(pdev, surface_id< pdev->n_surfaces);
- DeleteDeviceBitmap(surface->u.pdev, surface_id,
DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
+ DeleteDeviceBitmap(surface->u.pdev, surface_id,
+ surface->copy ? DEVICE_BITMAP_ALLOCATION_TYPE_RAM
+ : DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
}
#ifdef CALL_TEST
diff --git a/display/qxldd.h b/display/qxldd.h
index 92d1ae8..c9c2300 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -187,7 +187,11 @@ typedef struct DrawArea {
typedef struct SurfaceInfo SurfaceInfo;
struct SurfaceInfo {
- DrawArea draw_area;
+ DrawArea draw_area;
+ HBITMAP hbitmap;
+ SIZEL size;
+ UINT8 *copy;
+ ULONG bitmap_format;
union {
PDev *pdev;
SurfaceInfo *next_free;
diff --git a/display/res.c b/display/res.c
index c21b2f6..11d1b89 100644
--- a/display/res.c
+++ b/display/res.c
@@ -769,8 +769,12 @@ void PushSurfaceCmd(PDev *pdev, QXLSurfaceCmd *surface_cmd)
EngReleaseSemaphore(pdev->Res->cmd_sem);
}
+QXLPHYSICAL SurfaceToPhysical(PDev *pdev, UINT8 *base_mem)
+{
+ return PA(pdev, base_mem, pdev->vram_mem_slot);
+}
-_inline void GetSurfaceMemory(PDev *pdev, UINT32 x, UINT32 y, UINT32 depth,
UINT32 *stride,
+_inline void GetSurfaceMemory(PDev *pdev, UINT32 x, UINT32 y, UINT32 depth,
INT32 *stride,
UINT8 **base_mem, QXLPHYSICAL *phys_mem, UINT8
allocation_type)
{
DEBUG_PRINT((pdev, 12, "%s\n", __FUNCTION__));
@@ -786,7 +790,7 @@ _inline void GetSurfaceMemory(PDev *pdev, UINT32 x, UINT32
y, UINT32 depth, UINT
*stride = x * depth / 8;
*stride = ALIGN(*stride, 4);
*base_mem = AllocMem(pdev, MSPACE_TYPE_DEVRAM, (*stride) * y);
- *phys_mem = PA(pdev, *base_mem, pdev->main_mem_slot);
+ *phys_mem = SurfaceToPhysical(pdev, *base_mem);
SurfaceToPhysical use pdev->vram_mem_slot and not pdev->main_mem_slot
However, DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM is never used for
surfaces, so this code is not reached.
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel