blob: 2d948fbb998d7b0f00bc4e4bfbc267bd42db74e3 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.sysmem;
// Describes how a client will access the contents of a buffer.
// TODO(ZX-2260): change struct to table
struct BufferUsage {
uint32 none;
uint32 cpu;
uint32 vulkan;
uint32 display;
uint32 video;
// Flag for "none" usage.
// This bit indicates that there is no direct usage from the participant, and
// that the participant hasn't forgotten to set usage.
const uint32 noneUsage = 1;
// Flags for "cpu" usage.
// The "often" variants prefer cacheable memory.
const uint32 cpuUsageRead = 1;
const uint32 cpuUsageReadOften = 2;
const uint32 cpuUsageWrite = 4;
const uint32 cpuUsageWriteOften = 8;
// Flags for "vulkan" usage.
// Based on
const uint32 vulkanUsageTransferSrc = 0x0001;
const uint32 vulkanUsageTransferDst = 0x0002;
const uint32 vulkanUsageSampled = 0x0004;
const uint32 vulkanUsageStorage = 0x0008;
const uint32 vulkanUsageColorAttachment = 0x0010;
const uint32 vulkanUsageStencilAttachment = 0x0020;
const uint32 vulkanUsageTransientAttachment = 0x0040;
const uint32 vulkanUsageInputAttachment = 0x0080;
// Flags for "display" usage.
const uint32 displayUsageLayer = 1;
const uint32 displayUsageCursor = 2;
// Flags for "video" usage.
// TODO(ZX-2259): Add more specific HwDecoder flags if needed.
const uint32 videoUsageHwDecoder = 1;
const uint32 videoUsageHwEncoder = 2;
// TODO(34192): This bit is redundant with secure_required and supported heaps. This bit will
// not be carried forward.
const uint32 videoUsageHwProtected = 4;
const uint32 videoUsageCapture = 8;
// videoUsageDecryptorOutput is for the output of a decryptor; such buffers will contain decrypted
// encoded access units. The decryptor output may be in secure memory (controlled separately via
// secure_required).
// TODO(34192): Overhaul usage so we can add usage categories without breaking client struct init
// code repeatedly. For now, this value is in the "video" category but to some degree isn't really
// video; this usage can be used for the output of any secure decryptor. Also, other usages should
// include input vs. output as those are separate buffer collections and are really separate usages.
// We have this as a separate usage because each participant that needs VMO handles needs to specify
// a usage that isn't nonUsage, and the decryptor output participant shouldn't be specifying
// videoUsageHwDecoder because the decryptor isn't the decoder.
const uint32 videoUsageDecryptorOutput = 16;
// This usage is for a HW video decoder's internal buffers that aren't shared with other
// particpants. These are allocated via sysmem becuase sysmem pre-reserves contiguous SYSTEM_RAM
// as appropriate, and is the only way to allocate secure memory.
const uint32 videoUsageHwDecoderInternal = 32;