Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 1 | /* |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. |
| 4 | * Not a Contribution, Apache license notifications and license are retained |
| 5 | * for attribution purposes only. |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include "overlayRotator.h" |
| 21 | #include "overlayUtils.h" |
Saurabh Shah | e012f7a | 2012-08-18 15:11:57 -0700 | [diff] [blame] | 22 | #include "mdp_version.h" |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 23 | |
| 24 | namespace ovutils = overlay::utils; |
| 25 | |
| 26 | namespace overlay { |
| 27 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 28 | Rotator::~Rotator() {} |
| 29 | |
| 30 | Rotator* Rotator::getRotator() { |
| 31 | int type = getRotatorHwType(); |
| 32 | if(type == TYPE_MDP) { |
| 33 | return new MdpRot(); //will do reset |
| 34 | } else if(type == TYPE_MDSS) { |
| 35 | return new MdssRot(); |
| 36 | } else { |
| 37 | ALOGE("%s Unknown h/w type %d", __FUNCTION__, type); |
| 38 | return NULL; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | int Rotator::getRotatorHwType() { |
Saurabh Shah | e012f7a | 2012-08-18 15:11:57 -0700 | [diff] [blame] | 43 | int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion(); |
| 44 | if (mdpVersion == qdutils::MDSS_V5) |
| 45 | return TYPE_MDSS; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 46 | return TYPE_MDP; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 49 | bool RotMem::close() { |
| 50 | bool ret = true; |
| 51 | for(uint32_t i=0; i < RotMem::MAX_ROT_MEM; ++i) { |
| 52 | // skip current, and if valid, close |
| 53 | if(m[i].valid()) { |
| 54 | if(m[i].close() == false) { |
| 55 | ALOGE("%s error in closing rot mem %d", __FUNCTION__, i); |
| 56 | ret = false; |
| 57 | } |
| 58 | } |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 59 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 60 | return ret; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 63 | } |