• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 #include "ExynosDeviceModule.h"
18 
19 #include "ExynosDisplayDrmInterfaceModule.h"
20 #include "ExynosPrimaryDisplayModule.h"
21 
22 extern struct exynos_hwc_control exynosHWCControl;
23 
24 using namespace gs101;
25 
ExynosDeviceModule()26 ExynosDeviceModule::ExynosDeviceModule() : ExynosDevice(), mDisplayColorLoader(DISPLAY_COLOR_LIB) {
27     exynosHWCControl.skipStaticLayers = false;
28 
29     std::vector<displaycolor::DisplayInfo> display_info;
30     for (uint32_t i = 0; i < mDisplays.size(); i++) {
31         ExynosDisplay* display = mDisplays[i];
32         ExynosDisplayDrmInterfaceModule* moduleDisplayInterface =
33                 (ExynosDisplayDrmInterfaceModule*)(display->mDisplayInterface.get());
34 
35         if (display->mType == HWC_DISPLAY_PRIMARY) {
36             moduleDisplayInterface->getDisplayInfo(display_info);
37         }
38     }
39     initDisplayColor(display_info);
40     for (uint32_t i = 0; i < mDisplays.size(); i++) {
41         ExynosDisplay* display = mDisplays[i];
42         if (display->mType == HWC_DISPLAY_PRIMARY) {
43             ExynosPrimaryDisplayModule* modulePrimaryDisplay = (ExynosPrimaryDisplayModule*)display;
44             modulePrimaryDisplay->updateBrightnessTable();
45         }
46     }
47 }
48 
~ExynosDeviceModule()49 ExynosDeviceModule::~ExynosDeviceModule() {
50 }
51 
initDisplayColor(const std::vector<displaycolor::DisplayInfo> & display_info)52 int ExynosDeviceModule::initDisplayColor(
53         const std::vector<displaycolor::DisplayInfo>& display_info) {
54     mDisplayColorInterface = mDisplayColorLoader.GetDisplayColor(display_info);
55     if (mDisplayColorInterface == nullptr) {
56         ALOGW("%s failed to load displaycolor", __func__);
57     }
58 
59     return NO_ERROR;
60 }
61