File: buffer_types.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (107 lines) | stat: -rw-r--r-- 2,951 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Copyright 2015 The Chromium Authors
// 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>

namespace gfx {

// The format needs to be taken into account when mapping a buffer into the
// client's address space.
enum class BufferFormat : uint8_t {
  // Used as an enum for metrics. DO NOT reorder or delete values. Rather,
  // add them at the end and increment kMaxValue.
  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,
  YUVA_420_TRIPLANAR,
  P010,

  LAST = P010,
  kMaxValue = LAST
};

// 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,
  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 usage == other.usage && format == 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, YUVA_420_TRIPLANAR, 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, YUVA_420_TRIPLANAR, and P010.
  Y,
  // The UV plane for YUV_420_BIPLANAR, YUVA_420_TRIPLANAR and P010.
  UV,
  // The U plane for YUV_420.
  U,
  // The V plane for YUV_420.
  V,
  // The A plane for YUVA_420_TRIPLANAR.
  A,

  LAST = A
};

}  // namespace gfx

#endif  // UI_GFX_BUFFER_TYPES_H_