blob: c73eddff380abf02cbe68a39c6989d8fe8ccd164
1 | /* |
2 | // Copyright (c) 2014 Intel Corporation |
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 | // This file is modified by Amlogic, Inc. 2017.01.17. |
17 | */ |
18 | |
19 | #include <HwcTrace.h> |
20 | #include <PrimaryDevice.h> |
21 | //#include <ExternalDevice.h> |
22 | #include <VirtualDevice.h> |
23 | #include <Hwcomposer.h> |
24 | #include <PlatFactory.h> |
25 | #include <GE2DComposer.h> |
26 | |
27 | namespace android { |
28 | namespace amlogic { |
29 | |
30 | PlatFactory::PlatFactory() |
31 | { |
32 | CTRACE(); |
33 | } |
34 | |
35 | PlatFactory::~PlatFactory() |
36 | { |
37 | CTRACE(); |
38 | } |
39 | |
40 | IDisplayDevice* PlatFactory::createDisplayDevice(int disp) |
41 | { |
42 | CTRACE(); |
43 | //when createDisplayDevice is called, Hwcomposer has already finished construction. |
44 | Hwcomposer &hwc = Hwcomposer::getInstance(); |
45 | |
46 | class PlatDeviceControlFactory: public DeviceControlFactory { |
47 | public: |
48 | virtual IComposer* createComposer(IDisplayDevice& disp) {return new GE2DComposer(disp);} |
49 | }; |
50 | |
51 | switch (disp) { |
52 | case IDisplayDevice::DEVICE_PRIMARY: |
53 | return new PrimaryDevice(hwc, new PlatDeviceControlFactory()); |
54 | case IDisplayDevice::DEVICE_VIRTUAL: |
55 | return new VirtualDevice(hwc); |
56 | case IDisplayDevice::DEVICE_EXTERNAL: |
57 | // return new ExternalDevice(hwc, new PlatDeviceControlFactory()); |
58 | default: |
59 | WTRACE("invalid display device %d", disp); |
60 | return NULL; |
61 | } |
62 | } |
63 | |
64 | Hwcomposer* Hwcomposer::createHwcomposer() |
65 | { |
66 | CTRACE(); |
67 | Hwcomposer *hwc = new Hwcomposer(new PlatFactory()); |
68 | return hwc; |
69 | } |
70 | |
71 | } //namespace amlogic |
72 | } //namespace android |
73 |