123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // Copyright 2015 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #ifndef UI_GFX_BUFFER_TYPES_H_
- #define UI_GFX_BUFFER_TYPES_H_
- #include <stdint.h>
- #include <tuple>
- namespace gfx {
- // The format needs to be taken into account when mapping a buffer into the
- // client's address space.
- enum class BufferFormat {
- R_8,
- R_16,
- RG_88,
- RG_1616,
- BGR_565,
- RGBA_4444,
- RGBX_8888,
- RGBA_8888,
- BGRX_8888,
- BGRA_1010102,
- RGBA_1010102,
- BGRA_8888,
- RGBA_F16,
- YVU_420,
- YUV_420_BIPLANAR,
- P010,
- LAST = P010
- };
- // The usage mode affects how a buffer can be used. Only buffers created with
- // *_CPU_READ_WRITE_* can be mapped into the client's address space and accessed
- // by the CPU.
- // *_VDA_WRITE is for cases where a video decode accelerator writes into the
- // buffers.
- // PROTECTED_* are for HW protected buffers that cannot be read by the CPU and
- // can only be read in protected GPU contexts or scanned out to overlays.
- // At present, SCANOUT implies GPU_READ_WRITE. This doesn't apply to other
- // SCANOUT_* values.
- // TODO(reveman): Add GPU_READ_WRITE for use-cases where SCANOUT is not
- // required.
- enum class BufferUsage {
- GPU_READ,
- SCANOUT,
- // SCANOUT_CAMERA_READ_WRITE implies CPU_READ_WRITE.
- SCANOUT_CAMERA_READ_WRITE,
- CAMERA_AND_CPU_READ_WRITE,
- SCANOUT_CPU_READ_WRITE,
- SCANOUT_VDA_WRITE,
- PROTECTED_SCANOUT_VDA_WRITE,
- GPU_READ_CPU_READ_WRITE,
- SCANOUT_VEA_CPU_READ,
- SCANOUT_FRONT_RENDERING,
- VEA_READ_CAMERA_AND_CPU_READ_WRITE,
- LAST = VEA_READ_CAMERA_AND_CPU_READ_WRITE
- };
- struct BufferUsageAndFormat {
- BufferUsageAndFormat()
- : usage(BufferUsage::GPU_READ), format(BufferFormat::RGBA_8888) {}
- BufferUsageAndFormat(BufferUsage usage, BufferFormat format)
- : usage(usage), format(format) {}
- bool operator==(const BufferUsageAndFormat& other) const {
- return std::tie(usage, format) == std::tie(other.usage, other.format);
- }
- BufferUsage usage;
- BufferFormat format;
- };
- // Used to identify the plane of a GpuMemoryBuffer to use when creating a
- // SharedImage.
- enum class BufferPlane {
- // For single-plane GpuMemoryBuffer, this refers to that single plane. For
- // YUV_420, YUV_420_BIPLANAR, and P010 GpuMemoryBuffers, this refers to an
- // RGB representation of the planes (either bound directly as a texture or
- // created through an extra copy).
- DEFAULT,
- // The Y plane for YUV_420, YUV_420_BIPLANAR, and P010.
- Y,
- // The UV plane for YUV_420_BIPLANAR and P010.
- UV,
- // The U plane for YUV_420.
- U,
- // The V plane for YUV_420.
- V,
- LAST = V
- };
- // This enum is used for histogram states and should only have new values added
- // to the end before kMaxValue. tools/metrics/histograms/enums.xml should be
- // updated together.
- // These values are persisted to logs. Entries should not be renumbered and
- // numeric values should never be reused.
- enum class OddSize {
- kEvenWidthAndHeight = 0,
- kOddWidthOnly = 1,
- kOddHeightOnly = 2,
- kOddWidthAndHeight = 3,
- kMaxValue = kOddWidthAndHeight,
- };
- // These values are persisted to logs. Entries should not be renumbered and
- // numeric values should never be reused.
- enum class OddOffset {
- kEvenXAndY = 0,
- kOddXOnly = 1,
- kOddYOnly = 2,
- kOddXAndY = 3,
- kMaxValue = kOddXAndY,
- };
- } // namespace gfx
- #endif // UI_GFX_BUFFER_TYPES_H_
|