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