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