template <typename GpuMapping>

class AddressSpace

Defined at line 32 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

Public Methods

void AddressSpace<GpuMapping> (AddressSpaceOwner * owner)

Defined at line 38 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

void ~AddressSpace<GpuMapping> ()

Defined at line 40 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

std::unique_ptr<GpuMapping> MapBufferGpu (std::shared_ptr<AddressSpace<GpuMapping>> address_space, std::shared_ptr<Buffer> buffer)

Defined at line 53 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

uint64_t MaxGuardPageCount ()

Returns the maximum number of guard pages that should be inserted after a mapping.

Defined at line 83 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool InsertWithBusMapping ()

By default the AddressSpace will perform a bus mapping first then call Insert(addr,

bus_mapping); however, some address spaces may require an external actor to perform the bus

mapping, so if this returns false then Insert(addr, buffer, page_offset, page_count) will be

called instead.

Defined at line 89 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool Alloc (size_t size, uint8_t align_pow2, uint64_t * addr_out)

Allocates space and returns an address to the start of the allocation.

May return false if the AddressSpace doesn't support allocation.

Defined at line 93 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool Free (uint64_t addr)

Releases the allocation at the given address.

Defined at line 99 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool Insert (uint64_t addr, magma::PlatformBusMapper::BusMapping * bus_mapping, uint32_t guard_page_count)

Inserts the pages for the given buffer into page table entries for the allocation at the

given address.

Defined at line 106 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool Insert (uint64_t addr, magma::PlatformBuffer * buffer, uint64_t page_offset, uint64_t page_count)

Inserts without assuming a bus mapping; used if InsertWithBusMapping() is false.

Defined at line 113 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool Clear (uint64_t addr, magma::PlatformBusMapper::BusMapping * bus_mapping)

Clears the page table entries for the allocation at the given address.

Defined at line 120 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

uint64_t Size ()
bool CheckIfMappingFits (uint64_t gpu_addr, uint64_t length, uint32_t * guard_page_count_out)

Defined at line 223 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

std::unique_ptr<GpuMapping> MapBufferGpu (std::shared_ptr<AddressSpace<GpuMapping>> address_space, std::shared_ptr<Buffer> buffer, uint64_t offset, uint64_t length)

Maps the given |buffer| to a gpu address created from the |address_space| allocator.

The address space must support allocation.

Defined at line 160 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

magma::Status MapBufferGpu (std::shared_ptr<AddressSpace<GpuMapping>> address_space, std::shared_ptr<Buffer> buffer, uint64_t gpu_addr, uint64_t page_offset, uint64_t page_count, std::shared_ptr<GpuMapping> * gpu_mapping_out)

Maps the given |buffer| at the given gpu address.

Defined at line 258 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

magma::Status GrowMapping (GpuMapping * mapping, uint64_t page_count)

Defined at line 381 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

std::shared_ptr<GpuMapping> FindGpuMapping (uint64_t gpu_addr)

Defined at line 323 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

std::shared_ptr<GpuMapping> FindGpuMapping (magma::PlatformBuffer * buffer, uint64_t offset, uint64_t length)

Returns a gpu mapping for the given buffer starting at the given offset if the mapping

length is at least the given length.

Defined at line 305 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool AddMapping (std::shared_ptr<GpuMapping> gpu_mapping)

Defined at line 329 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool ReleaseMapping (magma::PlatformBuffer * buffer, uint64_t gpu_addr, std::shared_ptr<GpuMapping> * mapping_out)

Defined at line 349 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

void ReleaseBuffer (magma::PlatformBuffer * buffer, std::vector<std::shared_ptr<GpuMapping>> * released_mappings_out)

Defined at line 366 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

Protected Methods

bool ClearLocked (uint64_t addr, magma::PlatformBusMapper::BusMapping * bus_mapping)
bool AllocLocked (size_t size, uint8_t align_pow2, uint64_t * addr_out)

Defined at line 126 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool FreeLocked (uint64_t addr)

Defined at line 129 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool InsertLocked (uint64_t addr, magma::PlatformBuffer * buffer, uint64_t page_offset, uint64_t page_count)

Defined at line 137 of file ../../src/graphics/magma/lib/magma_service/util/address_space.h

bool InsertLocked (uint64_t addr, magma::PlatformBusMapper::BusMapping * bus_mapping, uint32_t guard_page_count)