1 /*
2 * Copyright (C) 2008 The Android Open Source Project
3 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include <cutils/properties.h>
19 #include "overlayCtrlData.h"
20 #include "fb_priv.h"
21 #include "gralloc_priv.h" //for interlace
22
23 namespace overlay{
24
init(uint32_t fbnum)25 bool Ctrl::init(uint32_t fbnum) {
26 // MDP/FD init
27 if(!mMdp.init(fbnum)) {
28 ALOGE("Ctrl failed to init fbnum=%d", fbnum);
29 return false;
30 }
31
32 if(!getScreenInfo(mInfo)) {
33 ALOGE("Ctrl failed to getScreenInfo");
34 return false;
35 }
36
37 return true;
38 }
39
setSource(const utils::PipeArgs & args)40 bool Ctrl::setSource(const utils::PipeArgs& args)
41 {
42 return mMdp.setSource(args);
43 }
44
setPosition(const utils::Dim & dim)45 bool Ctrl::setPosition(const utils::Dim& dim)
46 {
47 if(!dim.check(mInfo.mFBWidth, mInfo.mFBHeight)) {
48 ALOGE("Ctrl setPosition error in dim");
49 dim.dump();
50 return false;
51 }
52
53 if(!mMdp.setPosition(dim, mInfo.mFBWidth, mInfo.mFBHeight)) {
54 ALOGE("Ctrl failed MDP setPosition");
55 return false;
56 }
57 return true;
58 }
59
setTransform(const utils::eTransform & orient,const bool & rotUsed)60 bool Ctrl::setTransform(const utils::eTransform& orient, const bool& rotUsed)
61 {
62 if(!mMdp.setTransform(orient, rotUsed)) {
63 ALOGE("Ctrl setTransform failed for Mdp");
64 return false;
65 }
66 return true;
67 }
68
setCrop(const utils::Dim & d)69 bool Ctrl::setCrop(const utils::Dim& d)
70 {
71 if(!mMdp.setCrop(d)) {
72 ALOGE("Data setCrop failed in MDP setCrop");
73 return false;
74 }
75 return true;
76 }
77
78 utils::ActionSafe* utils::ActionSafe::sActionSafe = NULL;
79
80 utils::FrameBufferInfo* utils::FrameBufferInfo::sFBInfoInstance = 0;
81
dump() const82 void Ctrl::dump() const {
83 ALOGE("== Dump Ctrl start ==");
84 mInfo.dump("mInfo");
85 mMdp.dump();
86 ALOGE("== Dump Ctrl end ==");
87 }
88
89 } // overlay
90