class LogicalBufferCollection

Defined at line 221 of file ../../src/sysmem/server/logical_buffer_collection.h

TODO(dustingreen): MaybeAllocate() should sweep all related incoming channels for ZX_PEER_CLOSED

and not attempt allocation until all channel close(es) that were pending at the time have been

processed. Ignoring new channel closes is fine/good.

Public Methods

Sysmem * parent_sysmem ()

Defined at line 331 of file ../../src/sysmem/server/logical_buffer_collection.h

std::optional<std::string> name ()

Defined at line 353 of file ../../src/sysmem/server/logical_buffer_collection.h

inspect::Node & inspect_node ()

Defined at line 357 of file ../../src/sysmem/server/logical_buffer_collection.h

bool is_verbose_logging ()

Defined at line 359 of file ../../src/sysmem/server/logical_buffer_collection.h

uint64_t buffer_collection_id ()

Defined at line 361 of file ../../src/sysmem/server/logical_buffer_collection.h

zx::time create_time_monotonic ()

Defined at line 374 of file ../../src/sysmem/server/logical_buffer_collection.h

void Fail ()

This is only called during driver stop. Deletion of the LogicalBufferCollection can be async.

Defined at line 1040 of file ../../src/sysmem/server/logical_buffer_collection.cc

void ~LogicalBufferCollection ()

Defined at line 1046 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateV1 (TokenServerEndV1 buffer_collection_token_request, Sysmem * parent_device, const ClientDebugInfo * client_debug_info)

static

Defined at line 546 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateV2 (TokenServerEndV2 buffer_collection_token_request, Sysmem * parent_device, const ClientDebugInfo * client_debug_info)

static

Defined at line 557 of file ../../src/sysmem/server/logical_buffer_collection.cc

void BindSharedCollection (Sysmem * parent_device, zx::channel buffer_collection_token, CollectionServerEnd buffer_collection_request, const ClientDebugInfo * client_debug_info)

static

The buffer_collection_token is the client end of the BufferCollectionToken

which the client is exchanging for the BufferCollection (which the client is

passing the server end of in buffer_collection_request).

However, before we convert the client's token into a BufferCollection and

start processing the messages the client may have already sent toward the

BufferCollection, we want to process all the messages the client may have

already sent toward the BufferCollectionToken. This comes up because the

BufferCollectionToken and Allocator are separate channels.

We know that fidl_server will process all messages before it processes the

close - it intentionally delays noticing the close until no messages are

available to read.

So this method will close the buffer_collection_token and when it closes via

normal FIDL processing path, the token will remember the

buffer_collection_request to essentially convert itself into.

Defined at line 645 of file ../../src/sysmem/server/logical_buffer_collection.cc

zx_status_t ValidateBufferCollectionToken (Sysmem * parent_device, zx_koid_t token_server_koid)

ZX_OK if the token is known to the server.

ZX_ERR_NOT_FOUND if the token isn't known to the server.

Defined at line 682 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateBufferCollectionTokenV1 (fbl::RefPtr<LogicalBufferCollection> self, NodeProperties * new_node_properties, TokenServerEndV1 token_request)

This is used to create the initial BufferCollectionToken, and also used

by BufferCollectionToken::Duplicate().

The |self| parameter exists only because LogicalBufferCollection can't

hold a std::weak_ptr

<

> to itself because that requires libc++ (the binary

not just the headers) which isn't available in Zircon so far.

Defined at line 798 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateBufferCollectionTokenV2 (fbl::RefPtr<LogicalBufferCollection> self, NodeProperties * new_node_properties, TokenServerEndV2 token_request)

Defined at line 812 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateBufferCollectionTokenGroupV1 (fbl::RefPtr<LogicalBufferCollection> self, NodeProperties * new_node_properties, GroupServerEndV1 group_request)

This is used by BufferCollectionToken to create a BufferCollectionTokenGroup during the

FIDL request of the same name.

Defined at line 920 of file ../../src/sysmem/server/logical_buffer_collection.cc

void CreateBufferCollectionTokenGroupV2 (fbl::RefPtr<LogicalBufferCollection> self, NodeProperties * new_node_properties, GroupServerEndV2 group_request)

Defined at line 933 of file ../../src/sysmem/server/logical_buffer_collection.cc

bool CommonCreateBufferCollectionTokenGroupStage1 (fbl::RefPtr<LogicalBufferCollection> self, NodeProperties * new_node_properties, const GroupServerEnd & group_request, BufferCollectionTokenGroup ** out_group)

Defined at line 827 of file ../../src/sysmem/server/logical_buffer_collection.cc

void AttachLifetimeTracking (zx::eventpair server_end, uint32_t buffers_remaining)

Defined at line 946 of file ../../src/sysmem/server/logical_buffer_collection.cc

void SweepLifetimeTracking ()

Defined at line 952 of file ../../src/sysmem/server/logical_buffer_collection.cc

void OnDependencyReady ()

Calling this extra times (including after allocation complete) isn't harmful from a correctness

point of view.

Defined at line 970 of file ../../src/sysmem/server/logical_buffer_collection.cc

void SetName (uint32_t priority, std::string name)

Defined at line 977 of file ../../src/sysmem/server/logical_buffer_collection.cc

void SetDebugTimeoutLogDeadline (int64_t deadline)

Defined at line 984 of file ../../src/sysmem/server/logical_buffer_collection.cc

void SetVerboseLogging ()

Defined at line 991 of file ../../src/sysmem/server/logical_buffer_collection.cc

uint64_t CreateDispensableOrdinal ()

Defined at line 996 of file ../../src/sysmem/server/logical_buffer_collection.cc

fuchsia_logging::LogSeverity LogSeverityToFuchsiaLogSeverity (LogicalBufferCollection::LogSeverity log_severity)

Defined at line 1197 of file ../../src/sysmem/server/logical_buffer_collection.cc

void VLogClient (LogSeverity log_severity, Location location, const NodeProperties * node_properties, const char * format, va_list args)

Defined at line 1223 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogClientInfo (Location location, const NodeProperties * node_properties, const char * format)

Defined at line 1245 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogClientWarn (Location location, const NodeProperties * node_properties, const char * format)

Defined at line 1254 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogClientError (Location location, const NodeProperties * node_properties, const char * format)

Defined at line 1263 of file ../../src/sysmem/server/logical_buffer_collection.cc

void VLogClientInfo (Location location, const NodeProperties * node_properties, const char * format, va_list args)

Defined at line 1272 of file ../../src/sysmem/server/logical_buffer_collection.cc

void VLogClientWarn (Location location, const NodeProperties * node_properties, const char * format, va_list args)

Defined at line 1278 of file ../../src/sysmem/server/logical_buffer_collection.cc

void VLogClientError (Location location, const NodeProperties * node_properties, const char * format, va_list args)

Defined at line 1284 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogBufferEnable ()

start buffering log output into log_buffer_ instead of logging immediately

Defined at line 1312 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogBufferFlushAndDisable ()

flush (output) log_buffer_ and stop buffering further log output

Defined at line 1317 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogBufferDiscardAndDisable ()

discard (drop) log_buffer_ and stop buffering further log output

when is_verbose_logging() true, we attenuate the log_buffer_ to INFO but still output it

Defined at line 1326 of file ../../src/sysmem/server/logical_buffer_collection.cc

std::vector<const BufferCollection *> collection_views ()

For tests.

Defined at line 4808 of file ../../src/sysmem/server/logical_buffer_collection.cc

void TrackNodeProperties (NodeProperties * node_properties)

Track/untrack the node by the koid of the client end of its FIDL channel.

While tracked, a node can be found with FindNodeByClientChannelKoid().

Only is_currently_connected() true Node(s) are tracked.

Aside from this tracking, LogicalBufferCollection only cares about NodeProperties, not Nodes,

but since we need to track by client_koid which is a Node-specific thing, this tracking allows

for that.

This tracking exists for the benefit of IsAlternateFor(), which is essentially called on one

node and refers to another node by client endpoint koid, which must be owned by the same

process as the calling node.

Defined at line 4822 of file ../../src/sysmem/server/logical_buffer_collection.cc

void UntrackNodeProperties (NodeProperties * node_properties)

Defined at line 4827 of file ../../src/sysmem/server/logical_buffer_collection.cc

std::optional<NodeProperties *> FindNodePropertiesByNodeRefKoid (zx_koid_t node_ref_keep_koid)

Defined at line 4831 of file ../../src/sysmem/server/logical_buffer_collection.cc

fit::result<zx_status_t, BufferCollectionToken *> CommonConvertToken (Sysmem * parent_device, zx::channel buffer_collection_token, const ClientDebugInfo * client_debug_info, const char * fidl_message_name)

static

Defined at line 568 of file ../../src/sysmem/server/logical_buffer_collection.cc

fit::result<zx_status_t, std::optional<zx::vmo>> CreateWeakVmo (uint32_t buffer_index, const ClientDebugInfo & client_debug_info)

Defined at line 598 of file ../../src/sysmem/server/logical_buffer_collection.cc

fit::result<zx_status_t, std::optional<zx::eventpair>> DupCloseWeakAsapClientEnd (uint32_t buffer_index)

Defined at line 610 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogSummary (IndentTracker & indent)

Defined at line 5328 of file ../../src/sysmem/server/logical_buffer_collection.cc

Enumerations

enum LogSeverity
Name Value
Trace 0x10
Debug 0x20
InfoOrDebug 0x28
Info 0x30
Warn 0x40
Error 0x50
Fatal 0x60

Defined at line 296 of file ../../src/sysmem/server/logical_buffer_collection.h

Records

Friends

class TrackedParentVmo
class NodeProperties
class LogicalBuffer