• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "gralloc_priv.h" //for interlace
21 
22 namespace overlay{
23 
init(uint32_t fbnum)24 bool Ctrl::init(uint32_t fbnum) {
25     // MDP/FD init
26     if(!mMdp.init(fbnum)) {
27         ALOGE("Ctrl failed to init fbnum=%d", fbnum);
28         return false;
29     }
30 
31     if(!getScreenInfo(mInfo)) {
32         ALOGE("Ctrl failed to getScreenInfo");
33         return false;
34     }
35 
36     return true;
37 }
38 
setSource(const utils::PipeArgs & args)39 bool Ctrl::setSource(const utils::PipeArgs& args)
40 {
41     return mMdp.setSource(args);
42 }
43 
setPosition(const utils::Dim & dim)44 bool Ctrl::setPosition(const utils::Dim& dim)
45 {
46     if(!dim.check(mInfo.mFBWidth, mInfo.mFBHeight)) {
47         ALOGE("Ctrl setPosition error in dim");
48         dim.dump();
49         return false;
50     }
51 
52     if(!mMdp.setPosition(dim, mInfo.mFBWidth, mInfo.mFBHeight)) {
53         ALOGE("Ctrl failed MDP setPosition");
54         return false;
55     }
56     return true;
57 }
58 
setTransform(const utils::eTransform & orient)59 bool Ctrl::setTransform(const utils::eTransform& orient)
60 {
61     if(!mMdp.setTransform(orient)) {
62         ALOGE("Ctrl setTransform failed for Mdp");
63         return false;
64     }
65     return true;
66 }
67 
setRotatorUsed(const bool & rotUsed)68 void Ctrl::setRotatorUsed(const bool& rotUsed) {
69     mMdp.setRotatorUsed(rotUsed);
70 }
71 
setCrop(const utils::Dim & d)72 bool Ctrl::setCrop(const utils::Dim& d)
73 {
74     if(!mMdp.setCrop(d)) {
75         ALOGE("Data setCrop failed in MDP setCrop");
76         return false;
77     }
78     return true;
79 }
80 
81 utils::FrameBufferInfo* utils::FrameBufferInfo::sFBInfoInstance = 0;
82 
dump() const83 void Ctrl::dump() const {
84     ALOGE("== Dump Ctrl start ==");
85     mInfo.dump("mInfo");
86     mMdp.dump();
87     ALOGE("== Dump Ctrl end ==");
88 }
89 
90 } // overlay
91