| // Copyright 2020 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.sysmem2; |
| |
| /// Describes how a client will access the contents of a buffer. |
| @available(added=19) |
| type BufferUsage = table { |
| /// If the client sets this field, the client should not set any other |
| /// fields in the same table instance. The only valid bit in this field is |
| /// `NONE_USAGE` which must be set if this field is set. The point of this |
| /// field and the one bit set in this field is to essentially prove that the |
| /// client really means they aren't going to use the buffers, so don't need |
| /// any VMOs (didn't just fail to fill out the table). |
| 1: none uint32; |
| /// If set, holds CPU usage bits. See `CPU_USAGE_*` flags in usages.fidl. |
| 2: cpu uint32; |
| /// If set, holds vulkan usage bits. See `VULKAN_IMAGE_*` and |
| /// `VULKAN_BUFFER_*` bits in usages.fidl. The `VULKAN_USAGE_*` bit |
| /// definitions/names are deprecated. |
| 3: vulkan uint32; |
| /// If set, holds display usage bits. See `DISPLAY_USAGE_*` bits in |
| /// usages.fidl. |
| 4: display uint32; |
| /// If set, holds video usage bits. See `VIDEO_USAGE_*` bits in usages.fidl. |
| 5: video uint32; |
| }; |
| |
| // 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. |
| @available(added=19) |
| const NONE_USAGE uint32 = 1; |
| |
| // Flags for "cpu" usage. |
| // The "often" variants prefer cacheable memory. |
| @available(added=19) |
| const CPU_USAGE_READ uint32 = 1; |
| @available(added=19) |
| const CPU_USAGE_READ_OFTEN uint32 = 2; |
| @available(added=19) |
| const CPU_USAGE_WRITE uint32 = 4; |
| @available(added=19) |
| const CPU_USAGE_WRITE_OFTEN uint32 = 8; |
| |
| // Flags for "vulkan" usage. |
| // Based on https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkImageUsageFlagBits.html |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_TRANSFER_SRC uint32 = 0X0001; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_TRANSFER_DST uint32 = 0X0002; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_SAMPLED uint32 = 0X0004; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_STORAGE uint32 = 0X0008; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_COLOR_ATTACHMENT uint32 = 0X0010; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_STENCIL_ATTACHMENT uint32 = 0X0020; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_TRANSIENT_ATTACHMENT uint32 = 0X0040; |
| @available(added=19) |
| const VULKAN_IMAGE_USAGE_INPUT_ATTACHMENT uint32 = 0X0080; |
| |
| // Vulkan buffer usage flags. |
| // Based on https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkBufferUsageFlagBits.html |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_TRANSFER_SRC uint32 = 0X00010000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_TRANSFER_DST uint32 = 0X00020000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER uint32 = 0X00040000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_STORAGE_TEXEL_BUFFER uint32 = 0X00080000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_UNIFORM_BUFFER uint32 = 0X00100000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_STORAGE_BUFFER uint32 = 0X00200000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_INDEX_BUFFER uint32 = 0X00400000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_VERTEX_BUFFER uint32 = 0X00800000; |
| @available(added=19) |
| const VULKAN_BUFFER_USAGE_INDIRECT_BUFFER uint32 = 0X01000000; |
| |
| // Flags for "display" usage. |
| @available(added=19) |
| const DISPLAY_USAGE_LAYER uint32 = 1; |
| @available(added=19) |
| const DISPLAY_USAGE_CURSOR uint32 = 2; |
| |
| // Flags for "video" usage. |
| // TODO(https://fxbug.dev/42107168): Add more specific HwDecoder flags if needed. |
| @available(added=19) |
| const VIDEO_USAGE_HW_DECODER uint32 = 1; |
| @available(added=19) |
| const VIDEO_USAGE_HW_ENCODER uint32 = 2; |
| @available(added=19) |
| const VIDEO_USAGE_CAPTURE uint32 = 8; |
| // VIDEO_USAGE_DECRYPTOR_OUTPUT is for the output of a decryptor; such buffers |
| // will contain decrypted compressed media data. The decryptor output may be in |
| // secure memory (controlled separately via secure_required). This bit can be |
| // used for any decryptor output, not just a video decryptor output. |
| @available(added=19) |
| const VIDEO_USAGE_DECRYPTOR_OUTPUT uint32 = 16; |
| // This usage is for a HW video decoder's internal buffers that aren't shared |
| // with other participants. |
| @available(added=19) |
| const VIDEO_USAGE_HW_DECODER_INTERNAL uint32 = 32; |