mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 10:20:09 +01:00
turnip: add tu_suballoc.h
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17811>
This commit is contained in:
parent
4d9ac3d0df
commit
2e337f05ab
4 changed files with 62 additions and 42 deletions
|
|
@ -117,5 +117,7 @@ struct tu_device;
|
|||
struct tu_instance;
|
||||
|
||||
struct tu_bo;
|
||||
struct tu_suballoc_bo;
|
||||
struct tu_suballocator;
|
||||
|
||||
#endif /* TU_COMMON_H */
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "tu_descriptor_set.h"
|
||||
#include "tu_drm.h"
|
||||
#include "tu_perfetto.h"
|
||||
#include "tu_suballoc.h"
|
||||
#include "tu_util.h"
|
||||
|
||||
/* Pre-declarations needed for WSI entrypoints */
|
||||
|
|
@ -236,47 +237,6 @@ struct tu_queue
|
|||
int fence;
|
||||
};
|
||||
|
||||
/* externally-synchronized BO suballocator. */
|
||||
struct tu_suballocator
|
||||
{
|
||||
struct tu_device *dev;
|
||||
|
||||
uint32_t default_size;
|
||||
enum tu_bo_alloc_flags flags;
|
||||
|
||||
/** Current BO we're suballocating out of. */
|
||||
struct tu_bo *bo;
|
||||
uint32_t next_offset;
|
||||
|
||||
/** Optional BO cached for recycling as the next suballoc->bo, instead of having to allocate one. */
|
||||
struct tu_bo *cached_bo;
|
||||
};
|
||||
|
||||
struct tu_suballoc_bo
|
||||
{
|
||||
struct tu_bo *bo;
|
||||
uint64_t iova;
|
||||
uint32_t size; /* bytes */
|
||||
};
|
||||
|
||||
void
|
||||
tu_bo_suballocator_init(struct tu_suballocator *suballoc,
|
||||
struct tu_device *dev,
|
||||
uint32_t default_size,
|
||||
uint32_t flags);
|
||||
void
|
||||
tu_bo_suballocator_finish(struct tu_suballocator *suballoc);
|
||||
|
||||
VkResult
|
||||
tu_suballoc_bo_alloc(struct tu_suballoc_bo *suballoc_bo, struct tu_suballocator *suballoc,
|
||||
uint32_t size, uint32_t align);
|
||||
|
||||
void *
|
||||
tu_suballoc_bo_map(struct tu_suballoc_bo *bo);
|
||||
|
||||
void
|
||||
tu_suballoc_bo_free(struct tu_suballocator *suballoc, struct tu_suballoc_bo *bo);
|
||||
|
||||
enum global_shader {
|
||||
GLOBAL_SH_VS_BLIT,
|
||||
GLOBAL_SH_VS_CLEAR,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
* reallocation may happen for workloads where default size < working set size.
|
||||
*/
|
||||
|
||||
#include "tu_private.h"
|
||||
#include "tu_suballoc.h"
|
||||
|
||||
/* Initializes a BO sub-allocator using refcounts on BOs.
|
||||
*/
|
||||
|
|
|
|||
58
src/freedreno/vulkan/tu_suballoc.h
Normal file
58
src/freedreno/vulkan/tu_suballoc.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright © 2016 Red Hat.
|
||||
* Copyright © 2016 Bas Nieuwenhuizen
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* based in part on anv driver which is:
|
||||
* Copyright © 2015 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef TU_SUBALLOC_H
|
||||
#define TU_SUBALLOC_H
|
||||
|
||||
#include "tu_common.h"
|
||||
|
||||
#include "tu_drm.h"
|
||||
|
||||
/* externally-synchronized BO suballocator. */
|
||||
struct tu_suballocator
|
||||
{
|
||||
struct tu_device *dev;
|
||||
|
||||
uint32_t default_size;
|
||||
enum tu_bo_alloc_flags flags;
|
||||
|
||||
/** Current BO we're suballocating out of. */
|
||||
struct tu_bo *bo;
|
||||
uint32_t next_offset;
|
||||
|
||||
/** Optional BO cached for recycling as the next suballoc->bo, instead of having to allocate one. */
|
||||
struct tu_bo *cached_bo;
|
||||
};
|
||||
|
||||
struct tu_suballoc_bo
|
||||
{
|
||||
struct tu_bo *bo;
|
||||
uint64_t iova;
|
||||
uint32_t size; /* bytes */
|
||||
};
|
||||
|
||||
void
|
||||
tu_bo_suballocator_init(struct tu_suballocator *suballoc,
|
||||
struct tu_device *dev,
|
||||
uint32_t default_size,
|
||||
uint32_t flags);
|
||||
void
|
||||
tu_bo_suballocator_finish(struct tu_suballocator *suballoc);
|
||||
|
||||
VkResult
|
||||
tu_suballoc_bo_alloc(struct tu_suballoc_bo *suballoc_bo, struct tu_suballocator *suballoc,
|
||||
uint32_t size, uint32_t align);
|
||||
|
||||
void *
|
||||
tu_suballoc_bo_map(struct tu_suballoc_bo *bo);
|
||||
|
||||
void
|
||||
tu_suballoc_bo_free(struct tu_suballocator *suballoc, struct tu_suballoc_bo *bo);
|
||||
|
||||
#endif /* TU_SUBALLOC_H */
|
||||
Loading…
Add table
Reference in a new issue