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

const fuchsia_sysmem2::SingleBufferSettings & single_buffer_settings ()

Defined at line 376 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 1044 of file ../../src/sysmem/server/logical_buffer_collection.cc

void ~LogicalBufferCollection ()

Defined at line 1050 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 541 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 552 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)

|parent_device| the Device* that the calling allocator is part of. The

tokens_by_koid_ for each Device is separate. If somehow two clients were

to get connected to two separate sysmem device instances hosted in the

same devhost, those clients (intentionally) won't be able to share a

LogicalBufferCollection.

|buffer_collection_token| the client end of the BufferCollectionToken

being turned in by the client to get a BufferCollection in exchange.

|buffer_collection_request| the server end of a BufferCollection channel

to be served by the LogicalBufferCollection associated with

buffer_collection_token.

Defined at line 640 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 677 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 793 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 807 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 915 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 928 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 822 of file ../../src/sysmem/server/logical_buffer_collection.cc

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

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

void SweepLifetimeTracking ()

Defined at line 947 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 965 of file ../../src/sysmem/server/logical_buffer_collection.cc

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

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

void SetDebugTimeoutLogDeadline (int64_t deadline)

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

void SetVerboseLogging ()

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

uint64_t CreateDispensableOrdinal ()

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

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

Defined at line 1202 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 1228 of file ../../src/sysmem/server/logical_buffer_collection.cc

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

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

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

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

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

Defined at line 1268 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 1277 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 1283 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 1289 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 1317 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogBufferFlushAndDisable ()

flush (output) log_buffer_ and stop buffering further log output

Defined at line 1322 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 1331 of file ../../src/sysmem/server/logical_buffer_collection.cc

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

For tests.

Defined at line 4995 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 5009 of file ../../src/sysmem/server/logical_buffer_collection.cc

void UntrackNodeProperties (NodeProperties * node_properties)

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

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

Defined at line 5018 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 563 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 593 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 605 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogSummary (IndentTracker & indent)

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

bool CheckConstraintsAgainstExistingSettings (const fuchsia_sysmem2::BufferCollectionConstraints & constraints)

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

Enumerations

enum class LogSeverity : fuchsia_logging::RawLogSeverity
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