[Mesa-dev] [PATCH v2] intel/ppgtt: memory address alignment

Sergii Romantsov sergii.romantsov at globallogic.com
Tue Jul 24 12:00:31 UTC 2018


Hello, Kenneth.
Looks like you are expert in memory management for i965.
Could you, please, point me if that idea of patch is correct and what could
i improve?

Seems its better somehow to bind it to I915_GTT_PAGE_SIZE... right?

On Tue, Jul 24, 2018 at 2:50 PM, Sergii Romantsov <
sergii.romantsov at gmail.com> wrote:

> Kernel (for ppgtt) requires memory address to be
> aligned to page size (4096).
> Added such alignment for buffers marked with EXEC_OBJECT_PINNED.
>
> -v2: added marking that also fixes initial commit 01058a552294
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106997
> Fixes: a363bb2cd0e2 (i965: Allocate VMA in userspace for full-PPGTT
> systems.)
> Fixes: 01058a552294 (i965: Add virtual memory allocator infrastructure to
> brw_bufmgr.)
> Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> index 09d45e3..8383735 100644
> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> @@ -643,7 +643,7 @@ retry:
>     bo->kflags = bufmgr->initial_kflags;
>
>     if ((bo->kflags & EXEC_OBJECT_PINNED) && bo->gtt_offset == 0ull) {
> -      bo->gtt_offset = vma_alloc(bufmgr, memzone, bo->size, 1);
> +      bo->gtt_offset = vma_alloc(bufmgr, memzone, bo->size, 4096);
>
>        if (bo->gtt_offset == 0ull)
>           goto err_free;
> @@ -784,7 +784,7 @@ brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr,
>     bo->kflags = bufmgr->initial_kflags;
>
>     if (bo->kflags & EXEC_OBJECT_PINNED)
> -      bo->gtt_offset = vma_alloc(bufmgr, BRW_MEMZONE_OTHER, bo->size, 1);
> +      bo->gtt_offset = vma_alloc(bufmgr, BRW_MEMZONE_OTHER, bo->size,
> 4096);
>
>     _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo);
>     _mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo);
> @@ -1424,7 +1424,7 @@ brw_bo_gem_create_from_prime_internal(struct
> brw_bufmgr *bufmgr, int prime_fd,
>
>     if (bo->kflags & EXEC_OBJECT_PINNED) {
>        assert(bo->size > 0);
> -      bo->gtt_offset = vma_alloc(bufmgr, BRW_MEMZONE_OTHER, bo->size, 1);
> +      bo->gtt_offset = vma_alloc(bufmgr, BRW_MEMZONE_OTHER, bo->size,
> 4096);
>     }
>
>     if (tiling_mode < 0) {
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
Sergii Romantsov
GlobalLogic Inc.
www.globallogic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180724/bb3f0b92/attachment.html>


More information about the mesa-dev mailing list