Google is committed to advancing racial equity for Black communities. See how.

fuchsia.gpu.magma

PROTOCOLS

Device

Defined in fuchsia.gpu.magma/magma.fidl

Connect

Get the magma ipc channels.

Request

NameType
client_id uint64

Response

NameType
primary_channel handle<channel>
notification_channel handle<channel>

DumpState

Dumps driver and hardware state.

Request

NameType
dump_type uint32

GetUnitTestStatus

For testing only - on non-test drivers this will close the channel.

Request

NameType

Response

NameType
status zx/status

Query

Get a parameter.

Request

NameType
query_id uint64

Response

NameType
result uint64

QueryReturnsBuffer

Get a parameter and store it in a new vmo.

Request

NameType
query_id uint64

Response

NameType
result handle<vmo>

TestRestart

For testing only.

Request

NameType

PerformanceCounterAccess

Defined in fuchsia.gpu.magma/magma.fidl

This protocol is implemented by ZX_PROTOCOL_GPU_PERFORMANCE_COUNTERS devices.

GetPerformanceCountToken

This access token is not used as an event, but is instead passed to Primary.EnablePerformanceCounterAccess.

Request

NameType

Response

NameType
access_token handle<event>

Primary

Defined in fuchsia.gpu.magma/magma.fidl

AccessPerformanceCounters

Tries to enable performance counter FIDL messages. To be successful, |access_token| must have been returned by PerformanceCounterAccess.GetPerformanceCountToken() from the matching device.

Request

NameType
access_token handle<event>

CommitBuffer

Ensures that page_count pages starting at page_offset from the beginning of the buffer are backed by physical memory.

Request

NameType
buffer_id zx/koid
page_offset uint64
page_count uint64

CreateContext

Creates context context_id.

Request

NameType
context_id uint32

DestroyContext

Destroys context context_id.

Request

NameType
context_id uint32

EnableFlowControl

Enables the events OnNotifyMessagesConsumed and OnNotifyMemoryImported.

Request

NameType

ExecuteCommandBufferWithResources

Submits a command buffer for execution on the GPU, with associated resources.

Request

NameType
context_id uint32
command_buffer CommandBuffer
resources vector<Resource>
wait_semaphores vector<uint64>
signal_semaphores vector<uint64>

ExecuteImmediateCommands

Submits a series of commands for execution on the GPU without using a command buffer.

Request

NameType
context_id uint32
command_data vector<uint8>[2048]
semaphores vector<uint64>

GetError

Retrieve the current magma error status.

Request

NameType

Response

NameType
magma_status int32

ImportBuffer

Imports a buffer for use in the system driver.

Request

NameType
buffer handle<vmo>

ImportObject

Imports an object for use in the system driver.

Request

NameType
object handle<handle>
object_type uint32

IsPerformanceCounterAccessEnabled

Returns true if any AccessPerformanceCounters message has succeeded.

Request

NameType

Response

NameType
enabled bool

MapBufferGpu

Maps page_count pages of buffer from page_offset onto the GPU in the connection's address space at gpu_va. flags is a set of flags from MAGMA_GPU_MAP_FLAGS that specify how the GPU can access the buffer.

Request

NameType
buffer_id zx/koid
gpu_va uint64
page_offset uint64
page_count uint64
flags uint64

OnNotifyMemoryImported

Indicates the given number of buffer memory bytes were imported by the server. The caller should limit the amount of memory from inflight ImportBuffer messages: (bytes sent - server imported) <= Max (see QueryId::MAXIMUM_INFLIGHT_PARAMS). This is a soft limit designed to prevent excessive memory consumption, but for large messages the client may exceed the limit. Memory is imported by the server as quickly as possible, however this event is sent only when the consumed byte count reaches half the maximum; therefore, if the client's count of inflight bytes is less than max/2, the client should send the ImportBuffer message regardless of its size.

Response

NameType
bytes uint64

OnNotifyMessagesConsumed

Indicates the given number of messages were consumed by the server. The caller should limit the number of inflight messages: (messages sent - server consumed) <= Max (see QueryId::MAXIMUM_INFLIGHT_PARAMS). Messages are actually consumed by the server as quickly as possible, however this event is sent by the server only when the consumed count reaches half the maximum.

Response

NameType
count uint64

ReleaseBuffer

Destroys the buffer with buffer_id within this connection.

Request

NameType
buffer_id zx/koid

ReleaseObject

Destroys the object with object_id within this connection.

Request

NameType
object_id zx/koid
object_type uint32

UnmapBufferGpu

Releases the mapping at gpu_va from the GPU. Buffers will also be implicitly unmapped when released.

Request

NameType
buffer_id zx/koid
gpu_va uint64

STRUCTS

CommandBuffer

Defined in fuchsia.gpu.magma/magma.fidl

NameTypeDescriptionDefault
batch_buffer_resource_index uint32 No default
batch_start_offset uint32 No default

Resource

Defined in fuchsia.gpu.magma/magma.fidl

NameTypeDescriptionDefault
buffer zx/koid No default
offset uint64 No default
length uint64 No default

ENUMS

QueryId

Type: uint32

Defined in fuchsia.gpu.magma/magma.fidl

NameValueDescription
VENDOR_ID 0
DEVICE_ID 1
IS_TEST_RESTART_SUPPORTED 2
IS_TOTAL_TIME_SUPPORTED 3
MINIMUM_MAPPABLE_ADDRESS 4
MAXIMUM_INFLIGHT_PARAMS 5

Upper 32bits: max inflight messages, lower 32bits: max inflight memory (MB)

CONSTANTS

NameValueTypeDescription
kReceiveBufferSize 2048 uint32

Primary declarations.