Module: Mesa Branch: master Commit: 39f51b5db9404b166fa7c1845a348f427c03a8f1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=39f51b5db9404b166fa7c1845a348f427c03a8f1
Author: Nicolai Hähnle <[email protected]> Date: Wed Apr 12 17:05:56 2017 +0200 radeonsi: add missing initialization for userptr buffers Fix the accounting for memory usage of userptr buffers, which has been wrong forever (or at least for a long time). Also initialize flags. Without this initialization, the sparse buffer flag might end up being set, which leads to staging buffers being used unnecessarily (and incorrectly) in transfers to or from userptr buffers. This works around VM faults that occur with the radeon kernel module when running piglit ./bin/amd_pinned_memory decrement-offset map-buffer -auto Fixes: e077c5fe6579 ("gallium/radeon: transfers and invalidation for sparse buffers") Reported-by: Michel Dänzer <[email protected]> Reviewed-by: Marek Olšák <[email protected]> --- src/gallium/drivers/radeon/r600_buffer_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 0e93404c01..b2289e26f7 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -612,6 +612,7 @@ r600_buffer_from_user_memory(struct pipe_screen *screen, struct r600_resource *rbuffer = r600_alloc_buffer_struct(screen, templ); rbuffer->domains = RADEON_DOMAIN_GTT; + rbuffer->flags = 0; util_range_add(&rbuffer->valid_buffer_range, 0, templ->width0); /* Convert a user pointer to a buffer. */ @@ -627,5 +628,8 @@ r600_buffer_from_user_memory(struct pipe_screen *screen, else rbuffer->gpu_address = 0; + rbuffer->vram_usage = 0; + rbuffer->gart_usage = templ->width0; + return &rbuffer->b.b; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
