Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 1 | /* |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 13 | * * Neither the name of The Linux Foundation nor the names of its |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 30 | #include <dlfcn.h> |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 31 | #include "overlay.h" |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 32 | #include "pipes/overlayGenPipe.h" |
| 33 | #include "mdp_version.h" |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 34 | #include "qdMetaData.h" |
Tatenda Chipeperekwa | ce8d5c4 | 2014-08-13 10:53:49 -0700 | [diff] [blame^] | 35 | #include "qd_utils.h" |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 36 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 37 | #define PIPE_DEBUG 0 |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 38 | |
| 39 | namespace overlay { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 40 | using namespace utils; |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 41 | using namespace qdutils; |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 42 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 43 | Overlay::Overlay() { |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 44 | int numPipes = qdutils::MDPVersion::getInstance().getTotalPipes(); |
| 45 | PipeBook::NUM_PIPES = (numPipes <= utils::OV_MAX)? numPipes : utils::OV_MAX; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 46 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 47 | mPipeBook[i].init(); |
Naseer Ahmed | 1ddf366 | 2012-07-31 19:14:18 -0700 | [diff] [blame] | 48 | } |
Naseer Ahmed | 1ddf366 | 2012-07-31 19:14:18 -0700 | [diff] [blame] | 49 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 50 | mDumpStr[0] = '\0'; |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 51 | initScalar(); |
Raj Kamal | a8c065f | 2013-10-22 14:52:45 +0530 | [diff] [blame] | 52 | setDMAMultiplexingSupported(); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | Overlay::~Overlay() { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 56 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 57 | mPipeBook[i].destroy(); |
| 58 | } |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 59 | destroyScalar(); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 62 | void Overlay::configBegin() { |
| 63 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 64 | //Mark as available for this round. |
| 65 | PipeBook::resetUse(i); |
| 66 | PipeBook::resetAllocation(i); |
| 67 | } |
| 68 | mDumpStr[0] = '\0'; |
| 69 | } |
| 70 | |
| 71 | void Overlay::configDone() { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 72 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
Zohaib Alam | 4b0a924 | 2013-11-20 23:54:12 -0500 | [diff] [blame] | 73 | if((PipeBook::isNotUsed(i) && !sessionInProgress((eDest)i)) || |
| 74 | isSessionEnded((eDest)i)) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 75 | //Forces UNSET on pipes, flushes rotator memory and session, closes |
| 76 | //fds |
| 77 | if(mPipeBook[i].valid()) { |
| 78 | char str[32]; |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 79 | snprintf(str, 32, "Unset=%s dpy=%d mix=%d; ", |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 80 | PipeBook::getDestStr((eDest)i), |
| 81 | mPipeBook[i].mDisplay, mPipeBook[i].mMixer); |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 82 | #if PIPE_DEBUG |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 83 | strlcat(mDumpStr, str, sizeof(mDumpStr)); |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 84 | #endif |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 85 | } |
| 86 | mPipeBook[i].destroy(); |
Naseer Ahmed | 1ddf366 | 2012-07-31 19:14:18 -0700 | [diff] [blame] | 87 | } |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 88 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 89 | dump(); |
| 90 | PipeBook::save(); |
| 91 | } |
| 92 | |
Zohaib Alam | 4b0a924 | 2013-11-20 23:54:12 -0500 | [diff] [blame] | 93 | int Overlay::getPipeId(utils::eDest dest) { |
| 94 | return mPipeBook[(int)dest].mPipe->getPipeId(); |
| 95 | } |
| 96 | |
| 97 | eDest Overlay::getDest(int pipeid) { |
| 98 | eDest dest = OV_INVALID; |
| 99 | // finding the dest corresponding to the given pipe |
| 100 | for(int i=0; i < PipeBook::NUM_PIPES; ++i) { |
| 101 | if(mPipeBook[i].valid() && mPipeBook[i].mPipe->getPipeId() == pipeid) { |
| 102 | return (eDest)i; |
| 103 | } |
| 104 | } |
| 105 | return dest; |
| 106 | } |
| 107 | |
| 108 | eDest Overlay::reservePipe(int pipeid) { |
| 109 | eDest dest = getDest(pipeid); |
| 110 | PipeBook::setAllocation((int)dest); |
| 111 | return dest; |
| 112 | } |
| 113 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 114 | eDest Overlay::nextPipe(eMdpPipeType type, int dpy, int mixer) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 115 | eDest dest = OV_INVALID; |
| 116 | |
| 117 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 118 | if( (type == OV_MDP_PIPE_ANY || //Pipe type match |
| 119 | type == PipeBook::getPipeType((eDest)i)) && |
| 120 | (mPipeBook[i].mDisplay == DPY_UNUSED || //Free or same display |
| 121 | mPipeBook[i].mDisplay == dpy) && |
| 122 | (mPipeBook[i].mMixer == MIXER_UNUSED || //Free or same mixer |
| 123 | mPipeBook[i].mMixer == mixer) && |
| 124 | PipeBook::isNotAllocated(i) && //Free pipe |
Raj Kamal | a8c065f | 2013-10-22 14:52:45 +0530 | [diff] [blame] | 125 | ( (sDMAMultiplexingSupported && dpy) || |
| 126 | !(sDMAMode == DMA_BLOCK_MODE && //DMA pipe in Line mode |
| 127 | PipeBook::getPipeType((eDest)i) == OV_MDP_PIPE_DMA)) ){ |
| 128 | //DMA-Multiplexing is only supported for WB on 8x26 |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 129 | dest = (eDest)i; |
| 130 | PipeBook::setAllocation(i); |
| 131 | break; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 132 | } |
| 133 | } |
| 134 | |
| 135 | if(dest != OV_INVALID) { |
| 136 | int index = (int)dest; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 137 | mPipeBook[index].mDisplay = dpy; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 138 | mPipeBook[index].mMixer = mixer; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 139 | if(not mPipeBook[index].valid()) { |
| 140 | mPipeBook[index].mPipe = new GenericPipe(dpy); |
Zohaib Alam | 4b0a924 | 2013-11-20 23:54:12 -0500 | [diff] [blame] | 141 | mPipeBook[index].mSession = PipeBook::NONE; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 142 | char str[32]; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 143 | snprintf(str, 32, "Set=%s dpy=%d mix=%d; ", |
| 144 | PipeBook::getDestStr(dest), dpy, mixer); |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 145 | #if PIPE_DEBUG |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 146 | strlcat(mDumpStr, str, sizeof(mDumpStr)); |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 147 | #endif |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 148 | } |
| 149 | } else { |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 150 | ALOGD_IF(PIPE_DEBUG, "Pipe unavailable type=%d display=%d mixer=%d", |
| 151 | (int)type, dpy, mixer); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | return dest; |
| 155 | } |
| 156 | |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 157 | utils::eDest Overlay::getPipe(const PipeSpecs& pipeSpecs) { |
| 158 | if(MDPVersion::getInstance().is8x26()) { |
| 159 | return getPipe_8x26(pipeSpecs); |
| 160 | } else if(MDPVersion::getInstance().is8x16()) { |
| 161 | return getPipe_8x16(pipeSpecs); |
Prabhanjan Kandula | 958ffa9 | 2014-05-12 14:56:56 +0530 | [diff] [blame] | 162 | } else if(MDPVersion::getInstance().is8x39()) { |
| 163 | return getPipe_8x39(pipeSpecs); |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | eDest dest = OV_INVALID; |
| 167 | |
| 168 | //The default behavior is to assume RGB and VG pipes have scalars |
| 169 | if(pipeSpecs.formatClass == FORMAT_YUV) { |
| 170 | return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 171 | } else if(pipeSpecs.fb == false) { //RGB App layers |
| 172 | if(not pipeSpecs.needsScaling) { |
| 173 | dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer); |
| 174 | } |
| 175 | if(dest == OV_INVALID) { |
| 176 | dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer); |
| 177 | } |
| 178 | if(dest == OV_INVALID) { |
| 179 | dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 180 | } |
| 181 | } else { //FB layer |
| 182 | dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer); |
| 183 | if(dest == OV_INVALID) { |
| 184 | dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 185 | } |
| 186 | //Some features can cause FB to have scaling as well. |
| 187 | //If we ever come to this block with FB needing scaling, |
| 188 | //the screen will be black for a frame, since the FB won't get a pipe |
| 189 | //but atleast this will prevent a hang |
| 190 | if(dest == OV_INVALID and (not pipeSpecs.needsScaling)) { |
| 191 | dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer); |
| 192 | } |
| 193 | } |
| 194 | return dest; |
| 195 | } |
| 196 | |
| 197 | utils::eDest Overlay::getPipe_8x26(const PipeSpecs& pipeSpecs) { |
| 198 | //Use this to hide all the 8x26 requirements that cannot be humanly |
| 199 | //described in a generic way |
| 200 | eDest dest = OV_INVALID; |
| 201 | if(pipeSpecs.formatClass == FORMAT_YUV) { //video |
| 202 | return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 203 | } else if(pipeSpecs.fb == false) { //RGB app layers |
Xu Yang | 1e686f6 | 2014-04-08 13:56:47 +0800 | [diff] [blame] | 204 | if((not pipeSpecs.needsScaling) and |
| 205 | (not (pipeSpecs.numActiveDisplays > 1 && |
| 206 | pipeSpecs.dpy == DPY_PRIMARY))) { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 207 | dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer); |
| 208 | } |
| 209 | if(dest == OV_INVALID) { |
| 210 | dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer); |
| 211 | } |
| 212 | if(dest == OV_INVALID) { |
| 213 | dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 214 | } |
| 215 | } else { //FB layer |
| 216 | //For 8x26 Secondary we use DMA always for FB for inline rotation |
| 217 | if(pipeSpecs.dpy == DPY_PRIMARY) { |
| 218 | dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer); |
| 219 | if(dest == OV_INVALID) { |
| 220 | dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
| 221 | } |
| 222 | } |
Xu Yang | 1e686f6 | 2014-04-08 13:56:47 +0800 | [diff] [blame] | 223 | if(dest == OV_INVALID and (not pipeSpecs.needsScaling) and |
| 224 | (not (pipeSpecs.numActiveDisplays > 1 && |
| 225 | pipeSpecs.dpy == DPY_PRIMARY))) { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 226 | dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer); |
| 227 | } |
| 228 | } |
| 229 | return dest; |
| 230 | } |
| 231 | |
| 232 | utils::eDest Overlay::getPipe_8x16(const PipeSpecs& pipeSpecs) { |
| 233 | //Having such functions help keeping the interface generic but code specific |
| 234 | //and rife with assumptions |
| 235 | eDest dest = OV_INVALID; |
| 236 | if(pipeSpecs.formatClass == FORMAT_YUV or pipeSpecs.needsScaling) { |
| 237 | return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
radhakrishna | 8929846 | 2014-04-22 19:10:36 +0530 | [diff] [blame] | 238 | } else { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 239 | //Since this is a specific func, we can assume stuff like RGB pipe not |
| 240 | //having scalar blocks |
| 241 | dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer); |
| 242 | if(dest == OV_INVALID) { |
| 243 | dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer); |
| 244 | } |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 245 | if(dest == OV_INVALID) { |
radhakrishna | 8929846 | 2014-04-22 19:10:36 +0530 | [diff] [blame] | 246 | dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer); |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | return dest; |
| 250 | } |
| 251 | |
Prabhanjan Kandula | 958ffa9 | 2014-05-12 14:56:56 +0530 | [diff] [blame] | 252 | utils::eDest Overlay::getPipe_8x39(const PipeSpecs& pipeSpecs) { |
| 253 | //8x16 & 8x36 has same number of pipes, pipe-types & scaling capabilities. |
| 254 | //Rely on 8x16 until we see a need to change. |
| 255 | return getPipe_8x16(pipeSpecs); |
| 256 | } |
| 257 | |
Zohaib Alam | 4b0a924 | 2013-11-20 23:54:12 -0500 | [diff] [blame] | 258 | void Overlay::endAllSessions() { |
| 259 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 260 | if(mPipeBook[i].valid() && mPipeBook[i].mSession==PipeBook::START) |
| 261 | mPipeBook[i].mSession = PipeBook::END; |
| 262 | } |
| 263 | } |
| 264 | |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 265 | bool Overlay::isPipeTypeAttached(eMdpPipeType type) { |
| 266 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 267 | if(type == PipeBook::getPipeType((eDest)i) && |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 268 | mPipeBook[i].mDisplay != DPY_UNUSED) { |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 269 | return true; |
| 270 | } |
| 271 | } |
| 272 | return false; |
| 273 | } |
| 274 | |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 275 | int Overlay::comparePipePriority(utils::eDest pipe1Index, |
| 276 | utils::eDest pipe2Index) { |
| 277 | validate((int)pipe1Index); |
| 278 | validate((int)pipe2Index); |
| 279 | uint8_t pipe1Prio = mPipeBook[(int)pipe1Index].mPipe->getPriority(); |
| 280 | uint8_t pipe2Prio = mPipeBook[(int)pipe2Index].mPipe->getPriority(); |
| 281 | if(pipe1Prio > pipe2Prio) |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 282 | return -1; |
Tatenda Chipeperekwa | 657afa2 | 2014-04-15 12:02:39 -0700 | [diff] [blame] | 283 | if(pipe1Prio < pipe2Prio) |
| 284 | return 1; |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 285 | return 0; |
| 286 | } |
| 287 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 288 | bool Overlay::commit(utils::eDest dest) { |
| 289 | bool ret = false; |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 290 | validate((int)dest); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 291 | |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 292 | if(mPipeBook[dest].mPipe->commit()) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 293 | ret = true; |
| 294 | PipeBook::setUse((int)dest); |
| 295 | } else { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 296 | int dpy = mPipeBook[dest].mDisplay; |
Saurabh Shah | 7445d4b | 2013-12-05 17:24:45 -0800 | [diff] [blame] | 297 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
Saurabh Shah | df0be75 | 2013-05-23 14:40:00 -0700 | [diff] [blame] | 298 | if (mPipeBook[i].mDisplay == dpy) { |
Sushil Chauhan | e0dff93 | 2013-03-01 14:33:18 -0800 | [diff] [blame] | 299 | PipeBook::resetAllocation(i); |
Saurabh Shah | df0be75 | 2013-05-23 14:40:00 -0700 | [diff] [blame] | 300 | PipeBook::resetUse(i); |
Saurabh Shah | df0be75 | 2013-05-23 14:40:00 -0700 | [diff] [blame] | 301 | } |
Saurabh Shah | 7445d4b | 2013-12-05 17:24:45 -0800 | [diff] [blame] | 302 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 303 | } |
| 304 | return ret; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 305 | } |
| 306 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 307 | bool Overlay::queueBuffer(int fd, uint32_t offset, |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 308 | utils::eDest dest) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 309 | bool ret = false; |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 310 | validate((int)dest); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 311 | //Queue only if commit() has succeeded (and the bit set) |
| 312 | if(PipeBook::isUsed((int)dest)) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 313 | ret = mPipeBook[dest].mPipe->queueBuffer(fd, offset); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 314 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 315 | return ret; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 316 | } |
| 317 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 318 | void Overlay::setCrop(const utils::Dim& d, |
| 319 | utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 320 | validate((int)dest); |
| 321 | mPipeBook[dest].mPipe->setCrop(d); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 322 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 323 | |
Sushil Chauhan | 897a9c3 | 2013-07-18 11:09:55 -0700 | [diff] [blame] | 324 | void Overlay::setColor(const uint32_t color, |
| 325 | utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 326 | validate((int)dest); |
| 327 | mPipeBook[dest].mPipe->setColor(color); |
Sushil Chauhan | 897a9c3 | 2013-07-18 11:09:55 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 330 | void Overlay::setPosition(const utils::Dim& d, |
| 331 | utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 332 | validate((int)dest); |
| 333 | mPipeBook[dest].mPipe->setPosition(d); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | void Overlay::setTransform(const int orient, |
| 337 | utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 338 | validate((int)dest); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 339 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 340 | utils::eTransform transform = |
| 341 | static_cast<utils::eTransform>(orient); |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 342 | mPipeBook[dest].mPipe->setTransform(transform); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 343 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | void Overlay::setSource(const utils::PipeArgs args, |
| 347 | utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 348 | validate((int)dest); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 349 | |
radhakrishna | 8ccb908 | 2014-05-09 16:18:43 +0530 | [diff] [blame] | 350 | setPipeType(dest, PipeBook::getPipeType(dest)); |
| 351 | mPipeBook[dest].mPipe->setSource(args); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 352 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 353 | |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 354 | void Overlay::setVisualParams(const MetaData_t& metadata, utils::eDest dest) { |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 355 | validate((int)dest); |
| 356 | mPipeBook[dest].mPipe->setVisualParams(metadata); |
Saurabh Shah | 5daeee5 | 2013-01-23 16:52:26 +0800 | [diff] [blame] | 357 | } |
| 358 | |
radhakrishna | 8ccb908 | 2014-05-09 16:18:43 +0530 | [diff] [blame] | 359 | void Overlay::setPipeType(utils::eDest pipeIndex, |
| 360 | const utils::eMdpPipeType pType) { |
| 361 | mPipeBook[pipeIndex].mPipe->setPipeType(pType); |
| 362 | } |
| 363 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 364 | Overlay* Overlay::getInstance() { |
| 365 | if(sInstance == NULL) { |
| 366 | sInstance = new Overlay(); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 367 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 368 | return sInstance; |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 371 | // Clears any VG pipes allocated to the fb devices |
| 372 | // Generates a LUT for pipe types. |
| 373 | int Overlay::initOverlay() { |
| 374 | int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion(); |
| 375 | int numPipesXType[OV_MDP_PIPE_ANY] = {0}; |
| 376 | numPipesXType[OV_MDP_PIPE_RGB] = |
| 377 | qdutils::MDPVersion::getInstance().getRGBPipes(); |
| 378 | numPipesXType[OV_MDP_PIPE_VG] = |
| 379 | qdutils::MDPVersion::getInstance().getVGPipes(); |
| 380 | numPipesXType[OV_MDP_PIPE_DMA] = |
| 381 | qdutils::MDPVersion::getInstance().getDMAPipes(); |
| 382 | |
| 383 | int index = 0; |
| 384 | for(int X = 0; X < (int)OV_MDP_PIPE_ANY; X++) { //iterate over types |
| 385 | for(int j = 0; j < numPipesXType[X]; j++) { //iterate over num |
| 386 | PipeBook::pipeTypeLUT[index] = (utils::eMdpPipeType)X; |
| 387 | index++; |
| 388 | } |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 389 | } |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 390 | |
Xiaoming Zhou | 5eff8b6 | 2013-05-01 20:56:09 -0400 | [diff] [blame] | 391 | if (mdpVersion < qdutils::MDSS_V5 && mdpVersion != qdutils::MDP_V3_0_4) { |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 392 | msmfb_mixer_info_req req; |
| 393 | mdp_mixer_info *minfo = NULL; |
| 394 | char name[64]; |
| 395 | int fd = -1; |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 396 | for(int i = 0; i < MAX_FB_DEVICES; i++) { |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 397 | snprintf(name, 64, FB_DEVICE_TEMPLATE, i); |
| 398 | ALOGD("initoverlay:: opening the device:: %s", name); |
| 399 | fd = ::open(name, O_RDWR, 0); |
| 400 | if(fd < 0) { |
| 401 | ALOGE("cannot open framebuffer(%d)", i); |
| 402 | return -1; |
| 403 | } |
| 404 | //Get the mixer configuration */ |
| 405 | req.mixer_num = i; |
| 406 | if (ioctl(fd, MSMFB_MIXER_INFO, &req) == -1) { |
| 407 | ALOGE("ERROR: MSMFB_MIXER_INFO ioctl failed"); |
| 408 | close(fd); |
| 409 | return -1; |
| 410 | } |
| 411 | minfo = req.info; |
| 412 | for (int j = 0; j < req.cnt; j++) { |
| 413 | ALOGD("ndx=%d num=%d z_order=%d", minfo->pndx, minfo->pnum, |
| 414 | minfo->z_order); |
| 415 | // except the RGB base layer with z_order of -1, clear any |
| 416 | // other pipes connected to mixer. |
| 417 | if((minfo->z_order) != -1) { |
| 418 | int index = minfo->pndx; |
| 419 | ALOGD("Unset overlay with index: %d at mixer %d", index, i); |
| 420 | if(ioctl(fd, MSMFB_OVERLAY_UNSET, &index) == -1) { |
| 421 | ALOGE("ERROR: MSMFB_OVERLAY_UNSET failed"); |
| 422 | close(fd); |
| 423 | return -1; |
| 424 | } |
| 425 | } |
| 426 | minfo++; |
| 427 | } |
| 428 | close(fd); |
| 429 | fd = -1; |
| 430 | } |
| 431 | } |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 432 | |
| 433 | FILE *displayDeviceFP = NULL; |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 434 | char fbType[MAX_FRAME_BUFFER_NAME_SIZE]; |
| 435 | char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE]; |
| 436 | const char *strDtvPanel = "dtv panel"; |
| 437 | const char *strWbPanel = "writeback panel"; |
| 438 | |
| 439 | for(int num = 1; num < MAX_FB_DEVICES; num++) { |
| 440 | snprintf (msmFbTypePath, sizeof(msmFbTypePath), |
| 441 | "/sys/class/graphics/fb%d/msm_fb_type", num); |
| 442 | displayDeviceFP = fopen(msmFbTypePath, "r"); |
| 443 | |
| 444 | if(displayDeviceFP){ |
| 445 | fread(fbType, sizeof(char), MAX_FRAME_BUFFER_NAME_SIZE, |
| 446 | displayDeviceFP); |
| 447 | |
| 448 | if(strncmp(fbType, strDtvPanel, strlen(strDtvPanel)) == 0) { |
| 449 | sDpyFbMap[DPY_EXTERNAL] = num; |
| 450 | } else if(strncmp(fbType, strWbPanel, strlen(strWbPanel)) == 0) { |
| 451 | sDpyFbMap[DPY_WRITEBACK] = num; |
| 452 | } |
| 453 | |
| 454 | fclose(displayDeviceFP); |
| 455 | } |
| 456 | } |
| 457 | |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 458 | return 0; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 459 | } |
| 460 | |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 461 | bool Overlay::displayCommit(const int& fd) { |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 462 | utils::Dim lRoi, rRoi; |
| 463 | return displayCommit(fd, lRoi, rRoi); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 466 | bool Overlay::displayCommit(const int& fd, const utils::Dim& lRoi, |
| 467 | const utils::Dim& rRoi) { |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 468 | //Commit |
| 469 | struct mdp_display_commit info; |
| 470 | memset(&info, 0, sizeof(struct mdp_display_commit)); |
| 471 | info.flags = MDP_DISPLAY_COMMIT_OVERLAY; |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 472 | info.l_roi.x = lRoi.x; |
| 473 | info.l_roi.y = lRoi.y; |
| 474 | info.l_roi.w = lRoi.w; |
| 475 | info.l_roi.h = lRoi.h; |
| 476 | info.r_roi.x = rRoi.x; |
| 477 | info.r_roi.y = rRoi.y; |
| 478 | info.r_roi.w = rRoi.w; |
| 479 | info.r_roi.h = rRoi.h; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 480 | |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 481 | if(!mdp_wrapper::displayCommit(fd, info)) { |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 482 | ALOGE("%s: commit failed", __func__); |
| 483 | return false; |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 484 | } |
| 485 | return true; |
| 486 | } |
| 487 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 488 | void Overlay::dump() const { |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 489 | #if PIPE_DEBUG |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 490 | if(strlen(mDumpStr)) { //dump only on state change |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 491 | ALOGD("%s\n", mDumpStr); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 492 | } |
Saurabh Shah | 9dc88fc | 2013-07-15 16:02:30 -0700 | [diff] [blame] | 493 | #endif |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 494 | } |
| 495 | |
Saurabh Shah | 0d0a7cb | 2013-02-12 17:58:19 -0800 | [diff] [blame] | 496 | void Overlay::getDump(char *buf, size_t len) { |
| 497 | int totalPipes = 0; |
Saurabh Shah | ae61b2b | 2013-04-10 16:37:25 -0700 | [diff] [blame] | 498 | const char *str = "\nOverlay State\n\n"; |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 499 | strlcat(buf, str, len); |
Saurabh Shah | 0d0a7cb | 2013-02-12 17:58:19 -0800 | [diff] [blame] | 500 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 501 | if(mPipeBook[i].valid()) { |
| 502 | mPipeBook[i].mPipe->getDump(buf, len); |
| 503 | char str[64] = {'\0'}; |
Saurabh Shah | ae61b2b | 2013-04-10 16:37:25 -0700 | [diff] [blame] | 504 | snprintf(str, 64, "Display=%d\n\n", mPipeBook[i].mDisplay); |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 505 | strlcat(buf, str, len); |
Saurabh Shah | 0d0a7cb | 2013-02-12 17:58:19 -0800 | [diff] [blame] | 506 | totalPipes++; |
| 507 | } |
| 508 | } |
| 509 | char str_pipes[64] = {'\0'}; |
Saurabh Shah | ae61b2b | 2013-04-10 16:37:25 -0700 | [diff] [blame] | 510 | snprintf(str_pipes, 64, "Pipes=%d\n\n", totalPipes); |
Ramkumar Radhakrishnan | 36bd527 | 2014-01-31 20:03:01 -0800 | [diff] [blame] | 511 | strlcat(buf, str_pipes, len); |
Saurabh Shah | 0d0a7cb | 2013-02-12 17:58:19 -0800 | [diff] [blame] | 512 | } |
| 513 | |
Sushil Chauhan | bd3ea92 | 2013-05-15 12:25:26 -0700 | [diff] [blame] | 514 | void Overlay::clear(int dpy) { |
| 515 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 516 | if (mPipeBook[i].mDisplay == dpy) { |
| 517 | // Mark as available for this round |
| 518 | PipeBook::resetUse(i); |
| 519 | PipeBook::resetAllocation(i); |
| 520 | } |
| 521 | } |
| 522 | } |
| 523 | |
Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 524 | bool Overlay::validateAndSet(const int& dpy, const int& fbFd) { |
| 525 | GenericPipe* pipeArray[PipeBook::NUM_PIPES]; |
Praveena Pachipulusu | 2005e8f | 2014-05-07 20:01:54 +0530 | [diff] [blame] | 526 | memset(pipeArray, 0, sizeof(GenericPipe*)*(PipeBook::NUM_PIPES)); |
Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 527 | |
| 528 | int num = 0; |
| 529 | for(int i = 0; i < PipeBook::NUM_PIPES; i++) { |
| 530 | if(PipeBook::isUsed(i) && mPipeBook[i].valid() && |
| 531 | mPipeBook[i].mDisplay == dpy) { |
| 532 | pipeArray[num++] = mPipeBook[i].mPipe; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | //Protect against misbehaving clients |
| 537 | return num ? GenericPipe::validateAndSet(pipeArray, num, fbFd) : true; |
| 538 | } |
| 539 | |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 540 | void Overlay::initScalar() { |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 541 | if(sLibScaleHandle == NULL) { |
| 542 | sLibScaleHandle = dlopen("libscale.so", RTLD_NOW); |
Saurabh Shah | eac146b | 2014-05-13 11:36:20 -0700 | [diff] [blame] | 543 | if(sLibScaleHandle) { |
| 544 | *(void **) &sFnProgramScale = |
| 545 | dlsym(sLibScaleHandle, "programScale"); |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 546 | } |
| 547 | } |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 548 | } |
| 549 | |
| 550 | void Overlay::destroyScalar() { |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 551 | if(sLibScaleHandle) { |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 552 | dlclose(sLibScaleHandle); |
| 553 | sLibScaleHandle = NULL; |
| 554 | } |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 555 | } |
| 556 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 557 | void Overlay::PipeBook::init() { |
| 558 | mPipe = NULL; |
| 559 | mDisplay = DPY_UNUSED; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 560 | mMixer = MIXER_UNUSED; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | void Overlay::PipeBook::destroy() { |
| 564 | if(mPipe) { |
| 565 | delete mPipe; |
| 566 | mPipe = NULL; |
| 567 | } |
| 568 | mDisplay = DPY_UNUSED; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 569 | mMixer = MIXER_UNUSED; |
Zohaib Alam | 4b0a924 | 2013-11-20 23:54:12 -0500 | [diff] [blame] | 570 | mSession = NONE; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | Overlay* Overlay::sInstance = 0; |
Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 574 | int Overlay::sDpyFbMap[DPY_MAX] = {0, -1, -1}; |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 575 | int Overlay::sDMAMode = DMA_LINE_MODE; |
Raj Kamal | a8c065f | 2013-10-22 14:52:45 +0530 | [diff] [blame] | 576 | bool Overlay::sDMAMultiplexingSupported = false; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 577 | int Overlay::PipeBook::NUM_PIPES = 0; |
| 578 | int Overlay::PipeBook::sPipeUsageBitmap = 0; |
| 579 | int Overlay::PipeBook::sLastUsageBitmap = 0; |
| 580 | int Overlay::PipeBook::sAllocatedBitmap = 0; |
Sushil Chauhan | 07a2c76 | 2013-03-06 15:36:49 -0800 | [diff] [blame] | 581 | utils::eMdpPipeType Overlay::PipeBook::pipeTypeLUT[utils::OV_MAX] = |
| 582 | {utils::OV_MDP_PIPE_ANY}; |
Saurabh Shah | b8f58e2 | 2013-09-26 16:20:07 -0700 | [diff] [blame] | 583 | void *Overlay::sLibScaleHandle = NULL; |
Saurabh Shah | eac146b | 2014-05-13 11:36:20 -0700 | [diff] [blame] | 584 | int (*Overlay::sFnProgramScale)(struct mdp_overlay_list *) = NULL; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 585 | |
| 586 | }; // namespace overlay |