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 //#define LOG_NDEBUG 0
17 #include "ExynosExternalDisplayModule.h"
18 #include "ExynosPrimaryDisplayModule.h"
19 
20 #ifdef USES_VIRTUAL_DISPLAY
21 #include "ExynosVirtualDisplayModule.h"
22 #endif
23 
24 #include "ExynosHWCDebug.h"
25 #include "ExynosHWCHelper.h"
26 
27 #define SKIP_FRAME_COUNT        3
28 
29 using namespace gs101;
30 
ExynosExternalDisplayModule(uint32_t index,ExynosDevice * device)31 ExynosExternalDisplayModule::ExynosExternalDisplayModule(uint32_t index, ExynosDevice *device)
32     :    ExynosExternalDisplay(index, device)
33 {
34 
35 }
36 
~ExynosExternalDisplayModule()37 ExynosExternalDisplayModule::~ExynosExternalDisplayModule ()
38 {
39 
40 }
41 
validateWinConfigData()42 int32_t ExynosExternalDisplayModule::validateWinConfigData()
43 {
44     bool flagValidConfig = true;
45 
46     if (ExynosDisplay::validateWinConfigData() != NO_ERROR)
47         flagValidConfig = false;
48 
49     for (size_t i = 0; i < mDpuData.configs.size(); i++) {
50         struct exynos_win_config_data &config = mDpuData.configs[i];
51         if (config.state == config.WIN_STATE_BUFFER) {
52             bool configInvalid = false;
53             uint32_t mppType = config.assignedMPP->mPhysicalType;
54             if ((config.src.w != config.dst.w) ||
55                 (config.src.h != config.dst.h)) {
56                 if ((mppType == MPP_DPP_GF) ||
57                     (mppType == MPP_DPP_VG) ||
58                     (mppType == MPP_DPP_VGF)) {
59                     DISPLAY_LOGE("WIN_CONFIG error: invalid assign id : %zu,  s_w : %d, d_w : %d, s_h : %d, d_h : %d, mppType : %d",
60                             i, config.src.w, config.dst.w, config.src.h, config.dst.h, mppType);
61                     configInvalid = true;
62                 }
63             }
64             if (configInvalid) {
65                 config.state = config.WIN_STATE_DISABLED;
66                 flagValidConfig = false;
67             }
68         }
69     }
70     if (flagValidConfig)
71         return NO_ERROR;
72     else
73         return -EINVAL;
74 }
75