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#ifndef EXTERNAL_DEVICE_H 17#define EXTERNAL_DEVICE_H 18 19#include <PhysicalDevice.h> 20#include <IHdcpControl.h> 21#include <common/base/SimpleThread.h> 22 23namespace android { 24namespace intel { 25 26 27class ExternalDevice : public PhysicalDevice { 28 29public: 30 ExternalDevice(Hwcomposer& hwc, DisplayPlaneManager& dpm); 31 virtual ~ExternalDevice(); 32public: 33 virtual bool initialize(); 34 virtual void deinitialize(); 35 virtual bool blank(bool blank); 36 virtual bool setDrmMode(drmModeModeInfo& value); 37 virtual void setRefreshRate(int hz); 38 virtual bool getDisplaySize(int *width, int *height); 39 virtual bool getDisplayConfigs(uint32_t *configs, 40 size_t *numConfigs); 41 virtual bool getDisplayAttributes(uint32_t config, 42 const uint32_t *attributes, 43 int32_t *values); 44 virtual int getActiveConfig(); 45 virtual bool setActiveConfig(int index); 46 47private: 48 static void HdcpLinkStatusListener(bool success, void *userData); 49 void HdcpLinkStatusListener(bool success); 50 void setDrmMode(); 51 52protected: 53 virtual IHdcpControl* createHdcpControl() = 0; 54 55protected: 56 IHdcpControl *mHdcpControl; 57 58private: 59 static void hotplugEventListener(void *data); 60 void hotplugListener(); 61 62private: 63 Condition mAbortModeSettingCond; 64 drmModeModeInfo mPendingDrmMode; 65 bool mHotplugEventPending; 66 int mExpectedRefreshRate; 67 68private: 69 DECLARE_THREAD(ModeSettingThread, ExternalDevice); 70}; 71 72} 73} 74 75#endif /* EXTERNAL_DEVICE_H */ 76