xref: /aosp_15_r20/frameworks/native/services/surfaceflinger/SurfaceFlingerDefaultFactory.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1 /*
2  * Copyright 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 #pragma once
18 
19 #include "SurfaceFlingerFactory.h"
20 
21 namespace android::surfaceflinger {
22 
23 // A default implementation of the factory which creates the standard
24 // implementation types for each interface.
25 class DefaultFactory : public surfaceflinger::Factory {
26 public:
27     virtual ~DefaultFactory();
28 
29     std::unique_ptr<HWComposer> createHWComposer(const std::string& serviceName) override;
30     std::unique_ptr<scheduler::VsyncConfiguration> createVsyncConfiguration(
31             Fps currentRefreshRate) override;
32     sp<DisplayDevice> createDisplayDevice(DisplayDeviceCreationArgs&) override;
33     sp<GraphicBuffer> createGraphicBuffer(uint32_t width, uint32_t height, PixelFormat format,
34                                           uint32_t layerCount, uint64_t usage,
35                                           std::string requestorName) override;
36     void createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
37                            sp<IGraphicBufferConsumer>* outConsumer,
38                            bool consumerIsSurfaceFlinger) override;
39     std::unique_ptr<surfaceflinger::NativeWindowSurface> createNativeWindowSurface(
40             const sp<IGraphicBufferProducer>&) override;
41     std::unique_ptr<compositionengine::CompositionEngine> createCompositionEngine() override;
42     sp<Layer> createBufferStateLayer(const LayerCreationArgs& args) override;
43     sp<Layer> createEffectLayer(const LayerCreationArgs& args) override;
44     sp<LayerFE> createLayerFE(const std::string& layerName, const Layer* owner) override;
45     std::unique_ptr<FrameTracer> createFrameTracer() override;
46     std::unique_ptr<frametimeline::FrameTimeline> createFrameTimeline(
47             std::shared_ptr<TimeStats> timeStats, pid_t surfaceFlingerPid) override;
48 };
49 
50 } // namespace android::surfaceflinger
51