1 /* 2 // Copyright(c)2014 IntelCorporation 3 // 4 // LicensedundertheApacheLicense,Version2.0(the"License"); 5 // youmaynotusethisfileexceptincompliancewiththeLicense. 6 // YoumayobtainacopyoftheLicenseat 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unlessrequiredbyapplicablelaworagreedtoinwriting,software 11 // distributedundertheLicenseisdistributedonan"ASIS"BASIS, 12 // WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. 13 // SeetheLicenseforthespecificlanguagegoverningpermissionsand 14 // limitationsundertheLicense. 15 */ 16 17 #include <HwcTrace.h> 18 #include <tangier/TngDisplayContext.h> 19 #include <anniedale/AnnPlaneManager.h> 20 #include <PlatfBufferManager.h> 21 #include <IDisplayDevice.h> 22 #include <PrimaryDevice.h> 23 #include <ExternalDevice.h> 24 #include <VirtualDevice.h> 25 #include <Hwcomposer.h> 26 #include <PlatFactory.h> 27 #include <common/VsyncControl.h> 28 #include <common/HdcpControl.h> 29 #include <common/BlankControl.h> 30 #include <common/PrepareListener.h> 31 #include <common/VideoPayloadManager.h> 32 33 34 35 namespace android { 36 namespace intel { 37 38 PlatFactory::PlatFactory() 39 { 40 CTRACE(); 41 } 42 43 PlatFactory::~PlatFactory() 44 { 45 CTRACE(); 46 } 47 48 DisplayPlaneManager* PlatFactory::createDisplayPlaneManager() 49 { 50 CTRACE(); 51 return (new AnnPlaneManager()); 52 } 53 54 BufferManager* PlatFactory::createBufferManager() 55 { 56 CTRACE(); 57 return (new PlatfBufferManager()); 58 } 59 60 IDisplayDevice* PlatFactory::createDisplayDevice(int disp) 61 { 62 CTRACE(); 63 // when createDisplayDevice is called, Hwcomposer has already finished construction. 64 Hwcomposer &hwc = Hwcomposer::getInstance(); 65 class PlatDeviceControlFactory: public DeviceControlFactory { 66 public: 67 virtual IVsyncControl* createVsyncControl() {return new VsyncControl();} 68 virtual IBlankControl* createBlankControl() {return new BlankControl();} 69 virtual IHdcpControl* createHdcpControl() {return new HdcpControl();} 70 }; 71 72 switch (disp) { 73 case IDisplayDevice::DEVICE_PRIMARY: 74 return new PrimaryDevice(hwc, new PlatDeviceControlFactory()); 75 case IDisplayDevice::DEVICE_EXTERNAL: 76 return new ExternalDevice(hwc, new PlatDeviceControlFactory()); 77 case IDisplayDevice::DEVICE_VIRTUAL: 78 return new VirtualDevice(hwc); 79 default: 80 ETRACE("invalid display device %d", disp); 81 return NULL; 82 } 83 } 84 85 IDisplayContext* PlatFactory::createDisplayContext() 86 { 87 CTRACE(); 88 return new TngDisplayContext(); 89 } 90 91 IVideoPayloadManager * PlatFactory::createVideoPayloadManager() 92 { 93 return new VideoPayloadManager(); 94 } 95 96 Hwcomposer* Hwcomposer::createHwcomposer() 97 { 98 CTRACE(); 99 Hwcomposer *hwc = new Hwcomposer(new PlatFactory()); 100 return hwc; 101 } 102 103 } //namespace intel 104 } //namespace android 105