1 /*
2  * Copyright 2021 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 "DisplayMode.h"
20 
21 #include <cstdint>
22 #include <optional>
23 #include <vector>
24 
25 #include <ui/GraphicTypes.h>
26 #include <ui/HdrCapabilities.h>
27 #include <utils/Flattenable.h>
28 
29 namespace android::ui {
30 
31 // Information about a physical display which may change on hotplug reconnect.
32 struct DynamicDisplayInfo : LightFlattenable<DynamicDisplayInfo> {
33     std::vector<ui::DisplayMode> supportedDisplayModes;
34 
35     // This struct is going to be serialized over binder, so
36     // we can't use size_t because it may have different width
37     // in the client process.
38     int32_t activeDisplayModeId;
39 
40     std::vector<ui::ColorMode> supportedColorModes;
41     ui::ColorMode activeColorMode;
42     HdrCapabilities hdrCapabilities;
43 
44     // True if the display reports support for HDMI 2.1 Auto Low Latency Mode.
45     // For more information, see the HDMI 2.1 specification.
46     bool autoLowLatencyModeSupported;
47 
48     // True if the display reports support for Game Content Type.
49     // For more information, see the HDMI 1.4 specification.
50     bool gameContentTypeSupported;
51 
52     std::optional<ui::DisplayMode> getActiveDisplayMode() const;
53 
isFixedSizeDynamicDisplayInfo54     bool isFixedSize() const { return false; }
55     size_t getFlattenedSize() const;
56     status_t flatten(void* buffer, size_t size) const;
57     status_t unflatten(const void* buffer, size_t size);
58 };
59 
60 } // namespace android::ui
61