• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 <string>
20 #include <string_view>
21 #include <utility>
22 
23 namespace android::hardware::graphics::composer {
24 
25 constexpr std::string_view kBoardApiLevePropertyId = "ro.board.api_level";
26 
27 constexpr std::string_view kXrrVersionPropertyIdPrefix = "ro.vendor";
28 constexpr std::string_view kXrrVersionPropertyIdSuffix = "xrr.version";
29 
30 // Mrr default version settings.
31 constexpr int kMrrDefaultVersion = 1;
32 constexpr int kMaxMrrVersion = 2;
33 
34 // Vrr default version settings.
35 constexpr int kVrrDefaultVersion = 1;
36 constexpr int kMaxVrrVersion = 1;
37 
38 enum XrrVersion {
39     kMrr = 1,
40     kVrr = 2,
41     kTotalXrrVersion = kVrr,
42 };
43 
44 typedef struct XrrVersionInfo {
45     int majorVersion = kMrr;
46     int minorVersion = kMrrDefaultVersion;
47 
isVrrXrrVersionInfo48     bool isVrr() const { return (majorVersion == kVrr); }
49 
needVrrParametersXrrVersionInfo50     bool needVrrParameters() const {
51         return (isVrr() || ((majorVersion == kMrr) && (minorVersion > 1)));
52     }
53 
hasVrrControllerXrrVersionInfo54     bool hasVrrController() const { return needVrrParameters(); }
55 } XrrVersionInfo_t;
56 
57 long getBoardApiLevel();
58 
59 std::pair<int, int> getDisplayXrrVersion(const std::string& displayTypeIdentifier);
60 
61 } // namespace android::hardware::graphics::composer
62