• 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 "../../interface/DisplayContextProvider.h"
20 #include "../RefreshRateCalculator/VideoFrameRateCalculator.h"
21 #include "DisplayConfigurationOwner.h"
22 
23 namespace android::hardware::graphics::composer {
24 
25 class CommonDisplayContextProvider : public DisplayContextProvider {
26 public:
CommonDisplayContextProvider(DisplayConfigurationsOwner * displayConfigurationOwner,std::shared_ptr<RefreshRateCalculator> videoFrameRateCalculator)27     CommonDisplayContextProvider(DisplayConfigurationsOwner* displayConfigurationOwner,
28                                  std::shared_ptr<RefreshRateCalculator> videoFrameRateCalculator)
29           : mDisplayConfigurationOwner(displayConfigurationOwner),
30             mVideoFrameRateCalculator(std::move(videoFrameRateCalculator)){};
31 
32     // Implement DisplayContextProvider
33     OperationSpeedMode getOperationSpeedMode() const override;
34 
35     virtual BrightnessMode getBrightnessMode() const = 0;
36 
37     virtual int getBrightnessNits() const = 0;
38 
39     virtual const char* getDisplayFileNodePath() const = 0;
40 
41     int getEstimatedVideoFrameRate() const override;
42 
43     virtual int getAmbientLightSensorOutput() const = 0;
44 
45     virtual bool isProximityThrottlingEnabled() const = 0;
46     // End of DisplayContextProvider implementation.
47 
48     virtual const std::map<uint32_t, displayConfigs_t>* getDisplayConfigs() const = 0;
49 
50     virtual const displayConfigs_t* getDisplayConfig(hwc2_config_t id) const = 0;
51 
52     virtual int getMaxFrameRate(hwc2_config_t id) const = 0;
53 
54     virtual int getTeFrequency(hwc2_config_t id) const = 0;
55 
56     virtual int getWidth(hwc2_config_t id) const = 0;
57 
58     virtual int getHeight(hwc2_config_t id) const = 0;
59 
60     virtual bool isHsMode(hwc2_config_t id) const = 0;
61 
62 private:
63     DisplayConfigurationsOwner* mDisplayConfigurationOwner;
64 
65     std::shared_ptr<RefreshRateCalculator> mVideoFrameRateCalculator;
66 };
67 
68 } // namespace android::hardware::graphics::composer
69