blob: ac4a2965b3905b94e92f5cfb03b2de48285d6643 [file] [log] [blame]
Naseer Ahmed29a26812012-06-14 00:56:20 -07001/*
2* Copyright (C) 2008 The Android Open Source Project
Saurabh Shah56f610d2012-08-07 15:27:06 -07003* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
Naseer Ahmed29a26812012-06-14 00:56:20 -07004*
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"
Naseer Ahmedf48aef62012-07-20 09:05:53 -070021#include "gralloc_priv.h" //for interlace
Naseer Ahmed29a26812012-06-14 00:56:20 -070022
23namespace overlay{
24
Naseer Ahmedf48aef62012-07-20 09:05:53 -070025bool Ctrl::init(uint32_t fbnum) {
26 // MDP/FD init
27 if(!mMdp.init(fbnum)) {
28 ALOGE("Ctrl failed to init fbnum=%d", fbnum);
Naseer Ahmed29a26812012-06-14 00:56:20 -070029 return false;
30 }
31
32 if(!getScreenInfo(mInfo)) {
33 ALOGE("Ctrl failed to getScreenInfo");
34 return false;
35 }
36
Naseer Ahmed29a26812012-06-14 00:56:20 -070037 return true;
38}
39
Naseer Ahmed29a26812012-06-14 00:56:20 -070040bool Ctrl::setSource(const utils::PipeArgs& args)
41{
Naseer Ahmedf48aef62012-07-20 09:05:53 -070042 return mMdp.setSource(args);
Naseer Ahmed29a26812012-06-14 00:56:20 -070043}
44
45bool 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
Naseer Ahmedf48aef62012-07-20 09:05:53 -070060bool Ctrl::setTransform(const utils::eTransform& orient, const bool& rotUsed)
Naseer Ahmed29a26812012-06-14 00:56:20 -070061{
Naseer Ahmedf48aef62012-07-20 09:05:53 -070062 if(!mMdp.setTransform(orient, rotUsed)) {
63 ALOGE("Ctrl setTransform failed for Mdp");
64 return false;
Naseer Ahmed29a26812012-06-14 00:56:20 -070065 }
66 return true;
67}
68
69bool Ctrl::setCrop(const utils::Dim& d)
70{
Naseer Ahmed29a26812012-06-14 00:56:20 -070071 if(!mMdp.setCrop(d)) {
72 ALOGE("Data setCrop failed in MDP setCrop");
73 return false;
74 }
Naseer Ahmed29a26812012-06-14 00:56:20 -070075 return true;
76}
77
Saurabh Shah56f610d2012-08-07 15:27:06 -070078utils::ActionSafe* utils::ActionSafe::sActionSafe = NULL;
79
Naseer Ahmed29a26812012-06-14 00:56:20 -070080utils::FrameBufferInfo* utils::FrameBufferInfo::sFBInfoInstance = 0;
81
Naseer Ahmed29a26812012-06-14 00:56:20 -070082void Ctrl::dump() const {
83 ALOGE("== Dump Ctrl start ==");
Naseer Ahmed29a26812012-06-14 00:56:20 -070084 mInfo.dump("mInfo");
85 mMdp.dump();
Naseer Ahmed29a26812012-06-14 00:56:20 -070086 ALOGE("== Dump Ctrl end ==");
87}
88
89} // overlay