summaryrefslogtreecommitdiff
path: root/hwc2/platforms/PlatFactory.cpp (plain)
blob: 5d263abcfa011ed8700f841d2cc83676f4cd7297
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
27namespace android {
28namespace amlogic {
29
30PlatFactory::PlatFactory()
31{
32 CTRACE();
33}
34
35PlatFactory::~PlatFactory()
36{
37 CTRACE();
38}
39
40IDisplayDevice* 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 PlatcComposerFactory: public IComposeDeviceFactory {
47 public:
48 virtual IComposeDevice* createComposer(IDisplayDevice& disp) {
49 #ifdef ENABLE_AML_GE2D_COMPOSER
50 return new GE2DComposer(disp);
51 #else
52 return NULL;
53 #endif
54 }
55 };
56
57 switch (disp) {
58 case IDisplayDevice::DEVICE_PRIMARY:
59 return new PrimaryDevice(hwc, new PlatcComposerFactory());
60 case IDisplayDevice::DEVICE_VIRTUAL:
61 return new VirtualDevice(hwc);
62 case IDisplayDevice::DEVICE_EXTERNAL:
63 // return new ExternalDevice(hwc, new PlatDeviceControlFactory());
64 default:
65 WTRACE("invalid display device %d", disp);
66 return NULL;
67 }
68}
69
70Hwcomposer* Hwcomposer::createHwcomposer()
71{
72 CTRACE();
73 Hwcomposer *hwc = new Hwcomposer(new PlatFactory());
74 return hwc;
75}
76
77} //namespace amlogic
78} //namespace android
79