Mesa (main): gallium/pb: change alignment to 32 bits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 16 22:18:28 UTC 2021


Module: Mesa
Branch: main
Commit: 45cbb08848e6c1f0219a225e0bd637c330b8d38d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=45cbb08848e6c1f0219a225e0bd637c330b8d38d

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue May 25 16:28:47 2021 -0400

gallium/pb: change alignment to 32 bits

This partially reverts 4a3f0444. The warning is fixed differently.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10993>

---

 src/gallium/auxiliary/pipebuffer/pb_buffer.h       | 2 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 2 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 2 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c    | 4 ++--
 src/gallium/auxiliary/pipebuffer/pb_cache.c        | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 89cd0b25678..f7389795299 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -288,7 +288,7 @@ pb_reference_with_winsys(void *winsys,
  * the requested or not.
  */
 static inline boolean
-pb_check_alignment(pb_size requested, pb_size provided)
+pb_check_alignment(uint32_t requested, uint32_t provided)
 {
    if (!requested)
       return TRUE;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 4595e1a4021..d48f79c23b1 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -232,7 +232,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
    }
    
    assert(pipe_is_referenced(&buf->buffer->reference));
-   assert(pb_check_alignment(desc->alignment, 1ull << buf->buffer->alignment_log2));
+   assert(pb_check_alignment(desc->alignment, 1u << buf->buffer->alignment_log2));
    assert(buf->buffer->size >= size);
    
    pipe_reference_init(&buf->base.reference, 1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index d965182b84f..6ab0726a94f 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -399,7 +399,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
    }
    
    assert(pipe_is_referenced(&buf->buffer->reference));
-   assert(pb_check_alignment(real_desc.alignment, 1ull << buf->buffer->alignment_log2));
+   assert(pb_check_alignment(real_desc.alignment, 1u << buf->buffer->alignment_log2));
    assert(pb_check_usage(real_desc.usage, buf->buffer->usage));
    assert(buf->buffer->size >= real_size);
    
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index 0ab1c876086..5cc63b93df2 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -180,8 +180,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
    struct mm_buffer *mm_buf;
 
    /* We don't handle alignments larger then the one initially setup */
-   assert(pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2));
-   if(!pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2))
+   assert(pb_check_alignment(desc->alignment, 1u << mm->align2));
+   if(!pb_check_alignment(desc->alignment, 1u << mm->align2))
       return NULL;
    
    mtx_lock(&mm->mutex);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.c b/src/gallium/auxiliary/pipebuffer/pb_cache.c
index a92cd2d5e25..18c856f875b 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_cache.c
@@ -133,7 +133,7 @@ pb_cache_is_buffer_compat(struct pb_cache_entry *entry,
    if (usage & mgr->bypass_usage)
       return 0;
 
-   if (!pb_check_alignment(alignment, 1ull << buf->alignment_log2))
+   if (!pb_check_alignment(alignment, 1u << buf->alignment_log2))
       return 0;
 
    return mgr->can_reclaim(mgr->winsys, buf) ? 1 : -1;



More information about the mesa-commit mailing list