xref: /aosp_15_r20/external/drm_hwcomposer/bufferinfo/BufferInfo.h (revision 0a9764fe0a15e71ebbeb85e87e10990c23aab47f)
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 
21 constexpr int kBufferMaxPlanes = 4;
22 
23 enum class BufferColorSpace : int32_t {
24   kUndefined,
25   kItuRec601,
26   kItuRec709,
27   kItuRec2020,
28 };
29 
30 enum class BufferSampleRange : int32_t {
31   kUndefined,
32   kFullRange,
33   kLimitedRange,
34 };
35 
36 enum class BufferBlendMode : int32_t {
37   kUndefined,
38   kNone,
39   kPreMult,
40   kCoverage,
41 };
42 
43 struct BufferInfo {
44   uint32_t width;
45   uint32_t height;
46   uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */
47   uint32_t pitches[kBufferMaxPlanes];
48   uint32_t offsets[kBufferMaxPlanes];
49   /* sizes[] is used only by mapper@4 metadata getter for internal purposes */
50   uint32_t sizes[kBufferMaxPlanes];
51   int prime_fds[kBufferMaxPlanes];
52   uint64_t modifiers[kBufferMaxPlanes];
53 
54   BufferColorSpace color_space;
55   BufferSampleRange sample_range;
56   BufferBlendMode blend_mode;
57 };
58