diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-12 15:39:47 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-15 08:03:34 -0700 |
commit | 2f783ede027edc87041c35ac39f66ebca1b2875a (patch) | |
tree | 338fe36d187afbb5a822f16792411cdcbff37557 /src/gallium | |
parent | c9c8c2f7d7d83443928717a00c3be8f1f690e6c3 (diff) |
panfrost/drm: Don't mmap INVISIBLE buffers
On the new kernel, mmaping doesn't *hurt* per se, but it's still
wasteful for buffers explicitly marked as not needing an mmap.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_drm.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c index 68de1b178a3..dbf95a25232 100644 --- a/src/gallium/drivers/panfrost/pan_drm.c +++ b/src/gallium/drivers/panfrost/pan_drm.c @@ -88,9 +88,13 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size, /* Kernel will fail (confusingly) with EPERM otherwise */ assert(size > 0); + unsigned translated_flags = 0; + + /* TODO: translate flags to kernel flags, if the kernel supports */ + struct drm_panfrost_create_bo create_bo = { .size = size, - .flags = flags, + .flags = translated_flags, }; int ret; @@ -104,8 +108,12 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size, bo->gpu = create_bo.offset; bo->gem_handle = create_bo.handle; - // TODO map and unmap on demand? - panfrost_drm_mmap_bo(screen, bo); + /* Only mmap now if we know we need to. For CPU-invisible buffers, we + * never map since we don't care about their contents; they're purely + * for GPU-internal use. */ + + if (!(flags & PAN_ALLOCATE_INVISIBLE)) + panfrost_drm_mmap_bo(screen, bo); pipe_reference_init(&bo->reference, 1); return bo; @@ -143,7 +151,7 @@ panfrost_drm_allocate_slab(struct panfrost_screen *screen, // TODO cache allocations // TODO properly handle errors // TODO take into account extra_flags - mem->bo = panfrost_drm_create_bo(screen, pages * 4096, 0); + mem->bo = panfrost_drm_create_bo(screen, pages * 4096, extra_flags); mem->stack_bottom = 0; } |