mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 23:10:23 +01:00
nouveau: Add a function to allocate a tiled buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
71420b4c7d
commit
ac8bbb355a
2 changed files with 25 additions and 2 deletions
|
|
@ -7,7 +7,18 @@
|
|||
#include <sys/mman.h>
|
||||
|
||||
struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_new(struct nouveau_ws_device *dev, uint64_t size, uint64_t align, enum nouveau_ws_bo_flags flags)
|
||||
nouveau_ws_bo_new(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
{
|
||||
return nouveau_ws_bo_new_tiled(dev, size, align, 0, 0, flags);
|
||||
}
|
||||
|
||||
struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_new_tiled(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
uint8_t pte_kind, uint16_t tile_mode,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
{
|
||||
struct nouveau_ws_bo *bo = CALLOC_STRUCT(nouveau_ws_bo);
|
||||
struct drm_nouveau_gem_new req = {};
|
||||
|
|
@ -25,6 +36,11 @@ nouveau_ws_bo_new(struct nouveau_ws_device *dev, uint64_t size, uint64_t align,
|
|||
if (flags & NOUVEAU_WS_BO_MAP)
|
||||
req.info.domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
|
||||
|
||||
assert(pte_kind == 0 || !(flags & NOUVEAU_WS_BO_GART));
|
||||
assert(tile_mode == 0 || !(flags & NOUVEAU_WS_BO_GART));
|
||||
req.info.tile_flags = (uint32_t)pte_kind << 8;
|
||||
req.info.tile_mode = tile_mode;
|
||||
|
||||
req.info.size = size;
|
||||
req.align = align;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,14 @@ struct nouveau_ws_bo {
|
|||
_Atomic uint32_t refcnt;
|
||||
};
|
||||
|
||||
struct nouveau_ws_bo *nouveau_ws_bo_new(struct nouveau_ws_device *, uint64_t size, uint64_t align, enum nouveau_ws_bo_flags);
|
||||
struct nouveau_ws_bo *nouveau_ws_bo_new(struct nouveau_ws_device *,
|
||||
uint64_t size, uint64_t align,
|
||||
enum nouveau_ws_bo_flags);
|
||||
struct nouveau_ws_bo *nouveau_ws_bo_new_tiled(struct nouveau_ws_device *,
|
||||
uint64_t size, uint64_t align,
|
||||
uint8_t pte_kind,
|
||||
uint16_t tile_mode,
|
||||
enum nouveau_ws_bo_flags);
|
||||
void nouveau_ws_bo_destroy(struct nouveau_ws_bo *);
|
||||
void *nouveau_ws_bo_map(struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags);
|
||||
bool nouveau_ws_bo_wait(struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags flags);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue