radeon_bo: align size of bo to page size.
authorDave Airlie <airlied@redhat.com>
Mon, 2 Feb 2009 23:48:27 +0000 (09:48 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 2 Feb 2009 23:48:27 +0000 (09:48 +1000)
This is really required for the VRAM allocator upload function.

src/mesa/drivers/dri/radeon/radeon_bo_legacy.c

index f782d96900c3c2d1c37c7ce934cd5725297fe94a..07af01fc4028c523fb11374abaca3753d286f113 100644 (file)
@@ -260,6 +260,9 @@ static struct bo_legacy *bo_allocate(struct bo_manager_legacy *boml,
                                      uint32_t flags)
 {
     struct bo_legacy *bo_legacy;
+    uint32_t pgsize = getpagesize() - 1;
+
+    size = (size + pgsize) & ~pgsize;
 
     bo_legacy = (struct bo_legacy*)calloc(1, sizeof(struct bo_legacy));
     if (bo_legacy == NULL) {