[Spice-commits] display/res.c

Yonit Halperin yhalperi at kemper.freedesktop.org
Thu Aug 19 03:04:16 PDT 2010


 display/res.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 12d4cae695e9b6e03f7aea9ebac93e29b8ad229b
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed Aug 18 18:06:38 2010 +0300

    aligning surfaces stride to 4

diff --git a/display/res.c b/display/res.c
index 3fe5fe6..6be006e 100644
--- a/display/res.c
+++ b/display/res.c
@@ -600,15 +600,17 @@ _inline void GetSurfaceMemory(PDev *pdev, UINT32 x, UINT32 y, UINT32 depth, UINT
         *stride = x * depth / 8;
         break;
     case DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM:
-        *base_mem = AllocMem(pdev, MSPACE_TYPE_DEVRAM, x * y * depth / 8);
-        *phys_mem = PA(pdev, *base_mem, pdev->main_mem_slot);
         *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);
         break;
     case DEVICE_BITMAP_ALLOCATION_TYPE_VRAM: { 
-        *base_mem = __AllocMem(pdev, MSPACE_TYPE_VRAM, x * y * depth / 8, FALSE,
+        *stride = x * depth / 8;
+        *stride = ALIGN(*stride, 4);
+        *base_mem = __AllocMem(pdev, MSPACE_TYPE_VRAM, (*stride) * y, FALSE,
                                SURFACE_ALLOC_RELEASE_BUNCH_SIZE);
         *phys_mem = PA(pdev, (PVOID)((UINT64)*base_mem), pdev->vram_mem_slot);
-        *stride = x * depth / 8;
         break;
     }
     default:


More information about the Spice-commits mailing list