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 <memory> 20 21 #include "../RefreshRateCalculator/VideoFrameRateCalculator.h" 22 #include "../interface/DisplayContextProvider.h" 23 #include "EventQueue.h" 24 #include "common/DisplayConfigurationOwner.h" 25 #include "display/DisplayContextProviderFactory.h" 26 #include "exynos/ExynosDisplayContextProvider.h" 27 28 namespace android::hardware::graphics::composer { 29 30 enum class DisplayContextProviderType { 31 kExynos = 0, 32 // For the subsequent new panel. 33 kTotal, 34 }; 35 36 class DisplayContextProviderFactory { 37 public: DisplayContextProviderFactory(void * display,DisplayConfigurationsOwner * displayConfigurationsOwner,EventQueue * eventQueue)38 DisplayContextProviderFactory(void* display, 39 DisplayConfigurationsOwner* displayConfigurationsOwner, 40 EventQueue* eventQueue) 41 : mDisplay(display), 42 mDisplayConfigurationsOwner(displayConfigurationsOwner), 43 mEventQueue(eventQueue) {} 44 buildDisplayContextProvider(DisplayContextProviderType type,std::shared_ptr<RefreshRateCalculator> videoFrameRateCalculator)45 std::shared_ptr<CommonDisplayContextProvider> buildDisplayContextProvider( 46 DisplayContextProviderType type, 47 std::shared_ptr<RefreshRateCalculator> videoFrameRateCalculator) { 48 RefreshRateCalculatorFactory refreshRateCalculatorFactory; 49 if (type == DisplayContextProviderType::kExynos) { 50 return std::make_shared< 51 ExynosDisplayContextProvider>(mDisplay, mDisplayConfigurationsOwner, 52 std::move(videoFrameRateCalculator)); 53 } else { 54 return nullptr; 55 } 56 } 57 58 // buildDisplayContextProvider for new HWC display context. 59 60 private: 61 void* mDisplay; 62 DisplayConfigurationsOwner* mDisplayConfigurationsOwner; 63 EventQueue* mEventQueue; 64 }; 65 66 } // namespace android::hardware::graphics::composer 67