summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-12 12:15:09 -0700
committerKeith Packard <keithp@keithp.com>2008-05-12 12:15:09 -0700
commit10f1d835b8ac7bf3153ac39d295ad2a72c4aa076 (patch)
tree945602b599119e48234400c8e0c363f7b6da9b5c /src/i830_memory.c
parent417f86d80525d2f5038628afba8f70f8c0fecca3 (diff)
Record alignment requirements in mem structure for use by GEM.
GEM needs memory alignment requirements sent at pin time, which is a bit after the allocation itself. Store the required alignment in the memory object for later use by pin.
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 550b4d85..6f3c06b9 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -171,19 +171,10 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
int ret;
pin.handle = mem->gem_handle;
- pin.alignment = 0;
- if (mem->tiling) {
- if (IS_I965G(pI830))
- pin.alignment = 0;
- else {
- if (IS_I9XX (pI830))
- pin.alignment = 1024 * 1024;
- else
- pin.alignment = 512 * 1024;
- if (pin.alignment < mem->size)
- pin.alignment = mem->size;
- }
- }
+ pin.alignment = mem->alignment;
+ xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
+ "alignment %d size %d\n", mem->alignment, mem->size);
+
ret = ioctl(pI830->drmSubFD, DRM_IOCTL_I915_GEM_PIN, &pin);
if (ret != 0)
return FALSE;
@@ -638,6 +629,7 @@ i830_allocate_aperture(ScrnInfoPtr pScrn, const char *name,
size = ALIGN(size, GTT_PAGE_SIZE);
mem->size = size;
mem->allocated_size = size;
+ mem->alignment = alignment;
if (alignment < GTT_PAGE_SIZE)
alignment = GTT_PAGE_SIZE;
@@ -771,6 +763,7 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
mem->end = -1;
mem->size = size;
mem->allocated_size = size;
+ mem->alignment = align;
if (flags & NEED_LIFETIME_FIXED)
mem->lifetime_fixed_offset = TRUE;