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 "ExynosDisplayInterface.h"
18 #include "ExynosDisplay.h"
19 
~ExynosDisplayInterface()20 ExynosDisplayInterface::~ExynosDisplayInterface()
21 {
22 }
23 
getDisplayConfigs(uint32_t * outNumConfigs,hwc2_config_t * outConfigs)24 int32_t ExynosDisplayInterface::getDisplayConfigs(
25         uint32_t* outNumConfigs,
26         hwc2_config_t* outConfigs)
27 {
28     *outNumConfigs = 1;
29 
30     if (outConfigs != NULL)
31         outConfigs[0] = 0;
32 
33     return HWC2_ERROR_NONE;
34 }
35 
getDisplayVsyncPeriod(hwc2_vsync_period_t * outVsyncPeriod)36 int32_t ExynosDisplayInterface::getDisplayVsyncPeriod(hwc2_vsync_period_t* outVsyncPeriod)
37 {
38     return HWC2_ERROR_UNSUPPORTED;
39 }
40 
getColorModes(uint32_t * outNumModes,int32_t * outModes)41 int32_t ExynosDisplayInterface::getColorModes(
42         uint32_t* outNumModes,
43         int32_t* outModes)
44 {
45     *outNumModes = 1;
46 
47     if (outModes != NULL) {
48         outModes[0] = HAL_COLOR_MODE_NATIVE;
49     }
50     return HWC2_ERROR_NONE;
51 }
52 
updateHdrCapabilities()53 int32_t ExynosDisplayInterface::updateHdrCapabilities()
54 {
55     return 0;
56 }
57 
getReadbackBufferAttributes(int32_t * __unused outFormat,int32_t * __unused outDataspace)58 int32_t ExynosDisplayInterface::getReadbackBufferAttributes(
59         int32_t* __unused outFormat, int32_t* __unused outDataspace)
60 {
61     /* readback is not supported */
62     return HWC2_ERROR_UNSUPPORTED;
63 }
64 
isPrimary()65 bool ExynosDisplayInterface::isPrimary()
66 {
67     return ((mExynosDisplay != nullptr) &&
68             (mExynosDisplay->mType == HWC_DISPLAY_PRIMARY));
69 }
70