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 #ifndef EXYNOS_EXTERNAL_DISPLAY_MODULE_H
17 #define EXYNOS_EXTERNAL_DISPLAY_MODULE_H
18 
19 #include "ColorManager.h"
20 #include "ExynosDisplay.h"
21 #include "ExynosExternalDisplay.h"
22 #include "ExynosLayer.h"
23 
24 namespace gs101 {
25 
26 class ColorManager;
27 
28 class ExynosExternalDisplayModule : public ExynosExternalDisplay {
29     using GsInterfaceType = gs::ColorDrmBlobFactory::GsInterfaceType;
30 
31 public:
32     ExynosExternalDisplayModule(uint32_t index, ExynosDevice* device,
33                                 const std::string& displayName);
34     ~ExynosExternalDisplayModule();
35     virtual int32_t validateWinConfigData();
36 
getColorManager()37     ColorManager* getColorManager() { return mColorManager.get(); }
38 
39     int32_t getColorModes(uint32_t* outNumModes, int32_t* outModes) override;
40     int32_t setColorMode(int32_t mode) override;
41     int32_t getRenderIntents(int32_t mode, uint32_t* outNumIntents, int32_t* outIntents) override;
42     int32_t setColorModeWithRenderIntent(int32_t mode, int32_t intent) override;
43     int32_t setColorTransform(const float* matrix, int32_t hint) override;
44 
45     int32_t updateColorConversionInfo() override;
46     int32_t resetColorMappingInfo(ExynosMPPSource* mppSrc) override;
47 
48     bool mForceColorUpdate = false;
isForceColorUpdate()49     bool isForceColorUpdate() const { return mForceColorUpdate; }
setForceColorUpdate(bool force)50     void setForceColorUpdate(bool force) { mForceColorUpdate = force; }
51     int deliverWinConfigData() override;
52 
53     void invalidate() override;
54 
55 private:
56     std::unique_ptr<ColorManager> mColorManager;
57 
getDisplayColorInterface()58     GsInterfaceType* getDisplayColorInterface() {
59         return mColorManager->getDisplayColorInterface();
60     }
61 
getDisplaySceneInfo()62     DisplaySceneInfo& getDisplaySceneInfo() { return mColorManager->getDisplaySceneInfo(); }
63 };
64 
65 }  // namespace gs101
66 
67 #endif
68