class PlatformBuffer
Defined at line 24 of file ../../src/graphics/magma/lib/magma/platform/platform_buffer.h
In general only the const functions in this class must be implemented in a threadsafe way
Public Methods
std::unique_ptr<PlatformBuffer> Create (uint64_t size, const char * name)
Defined at line 419 of file ../../src/graphics/magma/lib/magma/platform/zircon/zircon_platform_buffer.cc
std::unique_ptr<PlatformBuffer> Import (uint32_t handle)
Import takes ownership of the handle.
Defined at line 443 of file ../../src/graphics/magma/lib/magma/platform/zircon/zircon_platform_buffer.cc
std::unique_ptr<PlatformBuffer> Import (zx::vmo handle)
Defined at line 447 of file ../../src/graphics/magma/lib/magma/platform/zircon/zircon_platform_buffer.cc
uint64_t size ()
Returns the size of the buffer.
bool IsMapped ()
bool CreateChild (uint32_t * handle_out)
Creates a duplicate handle whose lifetime can be tracked with HasChildren.
bool HasChildren ()
Returns true if one or more child buffers exist.
Note: when last child is released, transition from true to false may have some delay.
bool CommitPages (uint64_t start_page_index, uint64_t page_count)
Ensures the specified pages are backed by real memory.
note: the implementation of this function is required to be threadsafe.
magma::Status DecommitPages (uint64_t start_page_index, uint64_t page_count)
Tries to ensure the pages are not backed by memory, and resets their contents to 0. May fail if
the VMO is pinned.
bool GetBufferInfo (magma_buffer_info_t * buffer_info_out)
bool MapCpu (void ** addr_out, uintptr_t alignment)
If |alignment| isn't 0, it must be a power of 2 and page-aligned. It's
invalid to map the same buffer twice with different alignments.
bool UnmapCpu ()
bool MapAtCpuAddr (uint64_t addr, uint64_t offset, uint64_t length)
bool MapCpuWithFlags (uint64_t offset, uint64_t length, uint64_t flags, std::unique_ptr<Mapping> * mapping_out)
|flags| is a set of elements of Flags, above.
bool CleanCache (uint64_t offset, uint64_t size, bool invalidate)
bool SetCachePolicy (magma_cache_policy_t cache_policy)
magma_status_t GetCachePolicy (magma_cache_policy_t * cache_policy_out)
magma_status_t GetIsMappable (magma_bool_t * is_mappable_out)
Returns true if MapCpu should be able to return true. The buffer must be
readable and writable.
magma::Status SetMappingAddressRange (std::unique_ptr<MappingAddressRange> address_range)
bool Read (void * buffer, uint64_t offset, uint64_t length)
Read from an offset in the VMO into a buffer.
bool Write (const void * buffer, uint64_t offset, uint64_t length)
Write from a buffer into an offset in the VMO.
bool SetName (const char * name)
std::string GetName ()
bool IdFromHandle (uint32_t handle, uint64_t * id_out)
void ~PlatformBuffer ()
Defined at line 63 of file ../../src/graphics/magma/lib/magma/platform/platform_buffer.h
uint64_t MinimumMappableAddress ()
Deprecated
Defined at line 411 of file ../../src/graphics/magma/lib/magma/platform/zircon/zircon_platform_buffer.cc
uint64_t MappableAddressRegionLength ()
Deprecated; returns the length of the region where memory can be mapped.
Defined at line 415 of file ../../src/graphics/magma/lib/magma/platform/zircon/zircon_platform_buffer.cc
Enumerations
enum Flags
| Name | Value |
|---|---|
| kMapRead | 1 |
| kMapWrite | 2 |
Defined at line 49 of file ../../src/graphics/magma/lib/magma/platform/platform_buffer.h