| // 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.images2; |
| |
| /// The upper 8 bits are a vendor code. The lower 56 bits are vendor-defined. |
| /// |
| /// The defined `PixelFormatModifier` values are specific, complete, and valid |
| /// values (except for `INVALID` and `DO_NOT_CARE` which have their own |
| /// meanings). |
| /// |
| /// Some other valid or potentially-valid `pixel_format_modifier` values are not |
| /// defined as a `PixelFormatModifier` value, typically because the value isn't |
| /// used in practice (or potentially is newly used but not yet defined in |
| /// `PixelFormatModifier`). It is permitted to specify such a value as a |
| /// `PixelFormatModifier` value in a `pixel_format_modifier` field, despite the |
| /// lack of corresponding defined `PixelFormatModifier` value. If such a value |
| /// is used outside test code, please consider adding it as a defined value in |
| /// `PixelFormatModifier`. All such values must conform to the upper 8 bits |
| /// vendor code (don't define/use values outside the/an appropriate vendor |
| /// code). |
| /// |
| /// The separately-defined `FORMAT_MODIFIER_*` uint64 values are vendor-specific |
| /// bit field values, not complete valid values on their own. These uint64 |
| /// values can be used to help create or interpret a `PixelFormatModifier` value |
| /// in terms of vendor-specific bitfields. |
| /// |
| /// When the `pixel_format_modifier` is set to a supported value (excluding |
| /// `DO_NOT_CARE`, `INVALID`, `LINEAR`), the arrangement of pixel data otherwise |
| /// specified by the `pixel_format` field is "modified", typically to allow for |
| /// some combination of tiling, compression (typically lossless, typically for |
| /// memory bandwidth reduction not framebuffer size reduction), transaction |
| /// elimination, dirt tracking, but typically not modifying the bit depth of the |
| /// `pixel_format`. In some cases there's a per-image or per-tile header |
| /// involved, or similar. The `pixel_format` field often still needs to be set |
| /// to a valid supported value that works in combination with the |
| /// `pixel_format_modifier`, and that `pixel_format` value can also contribute |
| /// to the overall meaning of the `ImageFormat`. In other words, the "modifier" |
| /// part of the name is more accurate than "override" would be. |
| type PixelFormatModifier = flexible enum : uint64 { |
| DO_NOT_CARE = 0x00FFFFFFFFFFFFFE; |
| |
| INVALID = 0x00FFFFFFFFFFFFFF; |
| |
| LINEAR = 0x0000000000000000; |
| |
| // |
| // Fill in (compatible) values below as needed. |
| // |
| |
| // Intel format modifier values |
| |
| INTEL_I915_X_TILED = 0x0100000000000001; |
| INTEL_I915_Y_TILED = 0x0100000000000002; |
| INTEL_I915_YF_TILED = 0x0100000000000003; |
| |
| INTEL_I915_Y_TILED_CCS = 0x0100000001000002; |
| INTEL_I915_YF_TILED_CCS = 0x0100000001000003; |
| |
| // AMD format modifier values |
| |
| // NVIDIA format modifier values |
| |
| // SAMSUNG format modifier values |
| |
| // QCOM format modifier values |
| |
| // VIVANTE format modifier values |
| |
| // BROADCOM format modifier values |
| |
| // ARM format modifier values |
| |
| // Not all values are equally useful, so we only have format modifiers for some particularly interesting ones. |
| |
| // To make the variants with bits set more consistent 0x0800000000000000 is reserved for linear. |
| ARM_AFBC_16X16 = 0x0800000000000001; |
| ARM_AFBC_32X8 = 0x0800000000000002; |
| // Variations with transaction elimination support 0x1000 should be set for these formats. |
| ARM_LINEAR_TE = 0x0800000000001000; |
| ARM_AFBC_16X16_TE = 0x0800000000001001; |
| ARM_AFBC_32X8_TE = 0x0800000000001002; |
| |
| ARM_AFBC_16X16_YUV_TILED_HEADER = 0x0800000000002011; |
| |
| ARM_AFBC_16X16_SPLIT_BLOCK_SPARSE_YUV = 0x0800000000000071; |
| ARM_AFBC_16X16_SPLIT_BLOCK_SPARSE_YUV_TE = 0x0800000000001071; |
| |
| ARM_AFBC_16X16_SPLIT_BLOCK_SPARSE_YUV_TILED_HEADER = 0x0800000000002071; |
| ARM_AFBC_16X16_SPLIT_BLOCK_SPARSE_YUV_TE_TILED_HEADER = 0x0800000000003071; |
| |
| GOOGLE_GOLDFISH_OPTIMAL = 0x6700000000000001; |
| }; |
| |
| // |
| // All complete and valid values below here are deprecated (though not all are |
| // marked as such yet, due to requirement that added != deprecated). Only |
| // bitfield values (in contrast to complete values) will remain below here after |
| // deprecation / removal of complete values below here is done. |
| // |
| |
| // Per-vendor upper byte vendor-codes. |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_INTEL uint64 = 0x0100000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_AMD uint64 = 0x0200000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_NVIDIA uint64 = 0x0300000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_SAMSUNG uint64 = 0x0400000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_QCOM uint64 = 0x0500000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_VIVANTE uint64 = 0x0600000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_BROADCOM uint64 = 0x0700000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_ARM uint64 = 0x0800000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_ALLWINNER uint64 = 0x0900000000000000; |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_AMLOGIC uint64 = 0x0a00000000000000; |
| // Avoid unilaterally allocating vendor numbers from 0x0b onwards, to hopefully |
| // avoid collisions with vendor numbers allocated elsewhere and to allow for |
| // "compatible" values (see below), at least for now. |
| |
| // The 0x67 is 'g'. The intent of this vendor number is to avoid collision with |
| // sequentially-allocated vendor numbers allocated elsewhere and listed above, |
| // at least for now. |
| @available(added=19) |
| const FORMAT_MODIFIER_VENDOR_GOOGLE uint64 = 0x6700000000000000; |
| |
| // |
| // Within/under a particular FORMAT_MODIFIER_VENDOR_* byte, the remaining bits |
| // of the format modifier value can include some bitfields that have consistent |
| // meaning within/under that specific vendor byte. |
| // |
| // Fill in (compatible) bitfield/mask values below as needed. These bitfield |
| // values/masks can be used to build or interpret a complete format modifier. |
| // These values aren't complete format modifiers on their own. Complete format |
| // modifiers go in the PixelFormatModifier enum above (but only those which are |
| // actually used / actually useful, not just every possible combination of |
| // semantically valid bitfield values). |
| // |
| // We define bitfield/mask values here to make it easier for code to check the |
| // relevant bitfield(s), easier to mask away a feature bit, and similar. These |
| // are generally defined only within/under the relevant FORMAT_MODIFIER_VENDOR_* |
| // byte, so each should contain the relevant vendor name. |
| // |
| |
| // Intel format modifier bitfield values / masks |
| |
| /// Format has a color control surface after the tile data |
| const FORMAT_MODIFIER_INTEL_CCS_BIT uint64 = 0x1000000; |
| |
| // AMD format modifier bitfield values / masks |
| |
| // NVIDIA format modifier bitfield values / masks |
| |
| // SAMSUNG format modifier bitfield values / masks |
| |
| // QCOM format modifier bitfield values / masks |
| |
| // VIVANTE format modifier bitfield values / masks |
| |
| // BROADCOM format modifier bitfield values / masks |
| |
| // ARM format modifier bitfield values / masks |
| // bit 0x10 is for using the YUV transform. |
| const FORMAT_MODIFIER_ARM_YUV_BIT uint64 = 0x10; |
| // bit 0x20 is for split-block formats. |
| const FORMAT_MODIFIER_ARM_SPLIT_BLOCK_BIT uint64 = 0x20; |
| // bit 0x40 is for sparse formats. |
| const FORMAT_MODIFIER_ARM_SPARSE_BIT uint64 = 0x40; |
| // bit 0x800 is for variants with buffer content hints. |
| const FORMAT_MODIFIER_ARM_BCH_BIT uint64 = 0x800; |
| // bit 0x1000 is for variants with a transaction elimination buffer allocated. |
| const FORMAT_MODIFIER_ARM_TE_BIT uint64 = 0x1000; |
| // bit 0x2000 is for variants with tiled headers. |
| const FORMAT_MODIFIER_ARM_TILED_HEADER_BIT uint64 = 0x2000; |