mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 17:40:43 +00:00
llvmpipe: page-align memory allocations
Allows memory allocated by llvmpipe_allocate_memory_fd to be mappable to guests in virtualized environments like KVM which requires page-aligned memory. llvmpipe_allocate_memory is updated similarly for consistency. Signed-off-by: Omar Akkila <omar.akkila@collabora.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13793>
This commit is contained in:
parent
23a5f1a5ac
commit
58a0d8d0de
@ -950,7 +950,10 @@ llvmpipe_memory_barrier(struct pipe_context *pipe,
|
||||
|
||||
static struct pipe_memory_allocation *llvmpipe_allocate_memory(struct pipe_screen *screen, uint64_t size)
|
||||
{
|
||||
return os_malloc_aligned(size, 256);
|
||||
uint64_t alignment;
|
||||
if (!os_get_page_size(&alignment))
|
||||
alignment = 256;
|
||||
return os_malloc_aligned(size, alignment);
|
||||
}
|
||||
|
||||
static void llvmpipe_free_memory(struct pipe_screen *screen,
|
||||
@ -965,7 +968,10 @@ static const char *driver_id = "llvmpipe" MESA_GIT_SHA1;
|
||||
|
||||
static struct pipe_memory_allocation *llvmpipe_allocate_memory_fd(struct pipe_screen *screen, uint64_t size, int *fd)
|
||||
{
|
||||
return os_malloc_aligned_fd(size, 256, fd, "llvmpipe memory fd", driver_id);
|
||||
uint64_t alignment;
|
||||
if (!os_get_page_size(&alignment))
|
||||
alignment = 256;
|
||||
return os_malloc_aligned_fd(size, alignment, fd, "llvmpipe memory fd", driver_id);
|
||||
}
|
||||
|
||||
static bool llvmpipe_import_memory_fd(struct pipe_screen *screen, int fd, struct pipe_memory_allocation **ptr, uint64_t *size)
|
||||
|
Loading…
Reference in New Issue
Block a user