• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <HwcTrace.h>
17 #include <Drm.h>
18 #include <Hwcomposer.h>
19 #include <DrmConfig.h>
20 #include <PrimaryDevice.h>
21 
22 namespace android {
23 namespace intel {
24 
PrimaryDevice(Hwcomposer & hwc,DeviceControlFactory * controlFactory)25 PrimaryDevice::PrimaryDevice(Hwcomposer& hwc, DeviceControlFactory* controlFactory)
26     : PhysicalDevice(DEVICE_PRIMARY, hwc, controlFactory)
27 {
28     CTRACE();
29 }
30 
~PrimaryDevice()31 PrimaryDevice::~PrimaryDevice()
32 {
33     CTRACE();
34 }
35 
initialize()36 bool PrimaryDevice::initialize()
37 {
38     if (!PhysicalDevice::initialize()) {
39         DEINIT_AND_RETURN_FALSE("failed to initialize physical device");
40     }
41 
42     UeventObserver *observer = Hwcomposer::getInstance().getUeventObserver();
43     if (observer) {
44         observer->registerListener(
45             DrmConfig::getRepeatedFrameString(),
46             repeatedFrameEventListener,
47             this);
48     } else {
49         ETRACE("Uevent observer is NULL");
50     }
51 
52     return true;
53 }
54 
deinitialize()55 void PrimaryDevice::deinitialize()
56 {
57     PhysicalDevice::deinitialize();
58 }
59 
60 
repeatedFrameEventListener(void * data)61 void PrimaryDevice::repeatedFrameEventListener(void *data)
62 {
63     PrimaryDevice *pThis = (PrimaryDevice*)data;
64     if (pThis) {
65         pThis->repeatedFrameListener();
66     }
67 }
68 
repeatedFrameListener()69 void PrimaryDevice::repeatedFrameListener()
70 {
71     Hwcomposer::getInstance().getDisplayAnalyzer()->postIdleEntryEvent();
72     Hwcomposer::getInstance().invalidate();
73 }
74 
blank(bool blank)75 bool PrimaryDevice::blank(bool blank)
76 {
77     if (!mConnected)
78         return true;
79 
80     return PhysicalDevice::blank(blank);
81 }
82 
83 } // namespace intel
84 } // namespace android
85