sna: Align pwrite to transfer whole cachelines
Daniel claims that this is will be faster, or will be once he has completed rewriting pwrite! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
ecd6cca617
commit
95f4da647a
|
|
@ -164,9 +164,16 @@ static int gem_write(int fd, uint32_t handle,
|
|||
|
||||
VG_CLEAR(pwrite);
|
||||
pwrite.handle = handle;
|
||||
pwrite.offset = offset;
|
||||
pwrite.size = length;
|
||||
pwrite.data_ptr = (uintptr_t)src;
|
||||
/* align the transfer to cachelines; fortuitously this is safe! */
|
||||
if ((offset | length) & 63) {
|
||||
pwrite.offset = offset & ~63;
|
||||
pwrite.size = ALIGN(offset+length, 64) - pwrite.offset;
|
||||
pwrite.data_ptr = (uintptr_t)src + pwrite.offset - offset;
|
||||
} else {
|
||||
pwrite.offset = offset;
|
||||
pwrite.size = length;
|
||||
pwrite.data_ptr = (uintptr_t)src;
|
||||
}
|
||||
return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue