class LogicalBufferCollection

Defined at line 227 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 337 of file ../../src/sysmem/server/logical_buffer_collection.h

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

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

inspect::Node & inspect_node ()

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

bool is_verbose_logging ()

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

uint64_t buffer_collection_id ()

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

zx::time create_time_monotonic ()

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

const fuchsia_sysmem2::SingleBufferSettings & single_buffer_settings ()

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

void ~LogicalBufferCollection ()

Defined at line 1049 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 540 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 551 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 639 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 676 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 792 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 806 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 914 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 927 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 821 of file ../../src/sysmem/server/logical_buffer_collection.cc

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

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

void SweepLifetimeTracking ()

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

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

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

void SetDebugTimeoutLogDeadline (int64_t deadline)

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

void SetVerboseLogging ()

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

uint64_t CreateDispensableOrdinal ()

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

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

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

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

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

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

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

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

Defined at line 1267 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 1276 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 1282 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 1288 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 1316 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogBufferFlushAndDisable ()

flush (output) log_buffer_ and stop buffering further log output

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

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

For tests.

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

void UntrackNodeProperties (NodeProperties * node_properties)

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

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

Defined at line 5102 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 562 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 592 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 604 of file ../../src/sysmem/server/logical_buffer_collection.cc

void LogSummary (IndentTracker & indent)

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

bool CheckConstraintsAgainstExistingSettings (const fuchsia_sysmem2::BufferCollectionConstraints & constraints)

Defined at line 5756 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 302 of file ../../src/sysmem/server/logical_buffer_collection.h

Records

Friends

class TrackedParentVmo
class NodeProperties
class LogicalBuffer