template <typename Context, typename GpuMapping>

class CommandBuffer

Defined at line 25 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

CommandBuffer is initialized with resources (buffers), wait semaphores (must be signaled prior

to execution), and signal semaphores (signaled after execution completes). References to GPU

mappings of buffer resources are retained for the lifetime of the CommandBuffer.

Protected Members

const std::weak_ptr<Context> context_
unique_ptr command_buffer_
const uint64_t connection_id_
const uint64_t nonce_
bool prepared_to_execute_
std::vector<ExecResource> exec_resources_
vector wait_semaphores_
vector signal_semaphores_
std::vector<std::shared_ptr<GpuMapping>> exec_resource_mappings_
std::shared_ptr<Context> locked_context_
uint32_t sequence_number_

Public Methods

void CommandBuffer<Context, GpuMapping> (std::weak_ptr<Context> context, uint64_t connection_id, std::unique_ptr<msd::magma_command_buffer> command_buffer)

Defined at line 30 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

bool IsCommandBuffer ()

Defined at line 39 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

std::weak_ptr<Context> GetContext ()

Defined at line 41 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

void SetSequenceNumber (uint32_t sequence_number)

Defined at line 43 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint32_t GetSequenceNumber ()

Defined at line 48 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint64_t GetLength ()

Returns the length of the batch buffer.

Defined at line 67 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint64_t GetBatchBufferId ()

Returns the ID of the batch buffer.

Defined at line 75 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint64_t GetGpuAddress ()

Returns the GPU address of the batch buffer.

Defined at line 90 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

const GpuMappingView * GetBatchMapping ()

Returns a read only view of the batch buffer's GPU mapping.

Defined at line 96 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

std::vector<std::shared_ptr<magma::PlatformSemaphore>> TakeWaitSemaphores ()

Takes ownership of the wait semaphores array

Defined at line 102 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

void GetMappings (std::vector<GpuMappingView *> * mappings_out)

Returns read only views for all GPU mappings.

Defined at line 107 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

void ~CommandBuffer<Context, GpuMapping> ()

Defined at line 215 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

bool InitializeResources (std::vector<ExecResource> resources, std::vector<std::shared_ptr<magma::PlatformSemaphore>> wait_semaphores, std::vector<std::shared_ptr<magma::PlatformSemaphore>> signal_semaphores)

Initializes the command buffer with the given resources and semaphores. The number of

resources and semaphores given here must match the sizes passed in the

magma_command_buffer at construction. Wait semaphores are held but not otherwise used.

Signal semaphores are signaled when the CommandBuffer is destroyed.

Defined at line 148 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

bool PrepareForExecution ()

Prepare the command buffer for execution. This will look in the context's exec address space

for GPU mappings corresponding to each of the exec resources, and retain references to those

mappings until the CommandBuffer is destroyed.

Defined at line 171 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

Protected Methods

uint32_t batch_buffer_index ()

Defined at line 115 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint64_t batch_start_offset ()

Defined at line 117 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint32_t num_resources ()

Defined at line 119 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint32_t wait_semaphore_count ()

Defined at line 121 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

uint32_t signal_semaphore_count ()

Defined at line 123 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

void UnmapResourcesGpu ()

Defined at line 128 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

bool MapResourcesGpu (std::shared_ptr<AddressSpace<GpuMapping>> address_space, std::vector<std::shared_ptr<GpuMapping>> & mappings)

Defined at line 192 of file ../../src/graphics/magma/lib/magma_service/util/command_buffer.h

Records