summaryrefslogtreecommitdiff
path: root/hwc2/platforms/PlatFactory.cpp (plain)
blob: 47a789e7b48ef3de75a6dbc4319973b74cbb6a29
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) {return new GE2DComposer(disp);}
49 };
50
51 switch (disp) {
52 case IDisplayDevice::DEVICE_PRIMARY:
53 return new PrimaryDevice(hwc, new PlatcComposerFactory());
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
64Hwcomposer* Hwcomposer::createHwcomposer()
65{
66 CTRACE();
67 Hwcomposer *hwc = new Hwcomposer(new PlatFactory());
68 return hwc;
69}
70
71} //namespace amlogic
72} //namespace android
73