mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
freedreno: Add bo usage hints
These hints aren't used for allocation, but will be used to differentiate the purpose of an allocation in the next commit. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28058>
This commit is contained in:
parent
db49237267
commit
a3fb2b07aa
3 changed files with 14 additions and 2 deletions
|
|
@ -141,9 +141,10 @@ bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
|
|||
struct fd_bo *bo = NULL;
|
||||
|
||||
if (size < FD_BO_HEAP_BLOCK_SIZE) {
|
||||
if ((flags == 0) && dev->default_heap)
|
||||
uint32_t alloc_flags = flags & ~_FD_BO_HINTS;
|
||||
if ((alloc_flags == 0) && dev->default_heap)
|
||||
bo = fd_bo_heap_alloc(dev->default_heap, size);
|
||||
else if ((flags == RING_FLAGS) && dev->ring_heap)
|
||||
else if ((alloc_flags == RING_FLAGS) && dev->ring_heap)
|
||||
bo = fd_bo_heap_alloc(dev->ring_heap, size);
|
||||
if (bo)
|
||||
return bo;
|
||||
|
|
|
|||
|
|
@ -147,6 +147,16 @@ int fd_fence_wait(struct fd_fence *f);
|
|||
/* internal bo flags: */
|
||||
#define _FD_BO_NOSYNC BITSET_BIT(7) /* Avoid userspace fencing on control buffers */
|
||||
|
||||
/* Additional flags hinting usage, only used for tracing. Buffers without
|
||||
* one of these flags set will be presumed to be driver internal.
|
||||
*/
|
||||
#define FD_BO_HINT_BUFFER BITSET_BIT(8)
|
||||
#define FD_BO_HINT_IMAGE BITSET_BIT(9)
|
||||
#define _FD_BO_HINTS ( \
|
||||
FD_BO_HINT_BUFFER | \
|
||||
FD_BO_HINT_IMAGE | \
|
||||
0)
|
||||
|
||||
/*
|
||||
* bo access flags: (keep aligned to MSM_PREP_x)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ realloc_bo(struct fd_resource *rsc, uint32_t size)
|
|||
struct pipe_resource *prsc = &rsc->b.b;
|
||||
struct fd_screen *screen = fd_screen(rsc->b.b.screen);
|
||||
uint32_t flags =
|
||||
(prsc->target == PIPE_BUFFER) ? FD_BO_HINT_BUFFER : FD_BO_HINT_IMAGE |
|
||||
COND(rsc->layout.tile_mode, FD_BO_NOMAP) |
|
||||
COND((prsc->usage & PIPE_USAGE_STAGING) &&
|
||||
(prsc->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue