Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 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. |
| 13 | * * Neither the name of Code Aurora Forum, Inc. nor the names of its |
| 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 | |
| 30 | #include "overlayState.h" |
| 31 | |
| 32 | namespace overlay { |
| 33 | |
| 34 | /* |
| 35 | * Transition from any state to 2D video on 2D panel |
| 36 | */ |
| 37 | OverlayImplBase* OverlayState::handle_xxx_to_2D_2DPanel( |
| 38 | OverlayImplBase* ov) |
| 39 | { |
| 40 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 41 | ALOGE("%s", __FUNCTION__); |
| 42 | |
| 43 | // Create new ovimpl based on new state |
| 44 | typedef StateTraits<utils::OV_2D_VIDEO_ON_PANEL> NewState; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 45 | OverlayImplBase* newov = new NewState::ovimpl(); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 46 | |
| 47 | //=========================================================== |
| 48 | // For each pipe: |
| 49 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 50 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 51 | //=========================================================== |
| 52 | |
| 53 | // pipe0/rot0 (GenericPipe) |
| 54 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_GENERIC) { |
| 55 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (GenericPipe)", __FUNCTION__); |
| 56 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 57 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 58 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (GenericPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 59 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 60 | RotatorBase* rot0 = new NewState::rot0; |
| 61 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | // pipe1/rot1 (NullPipe) |
| 65 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_NULL) { |
| 66 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (NullPipe)", __FUNCTION__); |
| 67 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 68 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 69 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 70 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 71 | RotatorBase* rot1 = new NewState::rot1; |
| 72 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | // pipe2/rot2 (NullPipe) |
| 76 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 77 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 78 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 79 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 80 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 81 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 82 | RotatorBase* rot2 = new NewState::rot2; |
| 83 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 87 | delete ov; |
| 88 | ov = 0; |
| 89 | |
| 90 | return newov; |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * Transition from any state to 2D video on 2D panel and 2D TV |
| 95 | */ |
| 96 | OverlayImplBase* OverlayState::handle_xxx_to_2D_2DTV( |
| 97 | OverlayImplBase* ov) |
| 98 | { |
| 99 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 100 | ALOGE("%s", __FUNCTION__); |
| 101 | |
| 102 | // Create new ovimpl based on new state |
| 103 | typedef StateTraits<utils::OV_2D_VIDEO_ON_PANEL_TV> NewState; |
| 104 | OverlayImplBase* newov = new NewState::ovimpl; |
| 105 | |
| 106 | //=========================================================== |
| 107 | // For each pipe: |
| 108 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 109 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 110 | //=========================================================== |
| 111 | |
| 112 | // pipe0/rot0 (GenericPipe) |
| 113 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_GENERIC) { |
| 114 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (GenericPipe)", __FUNCTION__); |
| 115 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 116 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 117 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (GenericPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 118 | RotatorBase* rot0 = new NewState::rot0; |
| 119 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 120 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 121 | } |
| 122 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 123 | // pipe1/rot1 (VideoExtPipe) |
| 124 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_VIDEO_EXT) { |
| 125 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (VideoExtPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 126 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 127 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 128 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (VideoExtPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 129 | RotatorBase* rot1 = new NewState::rot1; |
| 130 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 131 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | // pipe2/rot2 (NullPipe) |
| 135 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 136 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 137 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 138 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 139 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 140 | RotatorBase* rot2 = new NewState::rot2; |
| 141 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 142 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 146 | delete ov; |
| 147 | ov = 0; |
| 148 | |
| 149 | return newov; |
| 150 | } |
| 151 | |
| 152 | /* |
| 153 | * Transition from any state to 3D video on 2D panel |
| 154 | */ |
| 155 | OverlayImplBase* OverlayState::handle_xxx_to_3D_2DPanel( |
| 156 | OverlayImplBase* ov) |
| 157 | { |
| 158 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 159 | ALOGE("%s", __FUNCTION__); |
| 160 | |
| 161 | // Create new ovimpl based on new state |
| 162 | typedef StateTraits<utils::OV_3D_VIDEO_ON_2D_PANEL> NewState; |
| 163 | OverlayImplBase* newov = new NewState::ovimpl; |
| 164 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 165 | //================================================================= |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 166 | // For each pipe: |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 167 | // - If pipe matches, copy from previous into new ovimpl. |
| 168 | // (which also makes previous pipe ref 0, so nobody can use) |
| 169 | // - Otherwise init pipe for new ovimpl and delete from previous |
| 170 | //================================================================= |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 171 | |
| 172 | // pipe0/rot0 (M3DPrimaryPipe) |
| 173 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_M3D_PRIMARY) { |
| 174 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (M3DPrimaryPipe)", __FUNCTION__); |
| 175 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 176 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 177 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (M3DPrimaryPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 178 | RotatorBase* rot0 = new NewState::rot0; |
| 179 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 180 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | // pipe1/rot1 (NullPipe) |
| 184 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_NULL) { |
| 185 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (NullPipe)", __FUNCTION__); |
| 186 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 187 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 188 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 189 | RotatorBase* rot1 = new NewState::rot1; |
| 190 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 191 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | // pipe2/rot2 (NullPipe) |
| 195 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 196 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 197 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 198 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 199 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 200 | RotatorBase* rot2 = new NewState::rot2; |
| 201 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 202 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 206 | delete ov; |
| 207 | ov = 0; |
| 208 | |
| 209 | return newov; |
| 210 | } |
| 211 | |
| 212 | /* |
| 213 | * Transition from any state to 3D video on 2D panel and 2D TV |
| 214 | */ |
| 215 | OverlayImplBase* OverlayState::handle_xxx_to_3D_2DTV( |
| 216 | OverlayImplBase* ov) |
| 217 | { |
| 218 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 219 | ALOGE("%s", __FUNCTION__); |
| 220 | |
| 221 | // Create new ovimpl based on new state |
| 222 | typedef StateTraits<utils::OV_3D_VIDEO_ON_2D_PANEL_2D_TV> NewState; |
| 223 | OverlayImplBase* newov = new NewState::ovimpl; |
| 224 | |
| 225 | //=========================================================== |
| 226 | // For each pipe: |
| 227 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 228 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 229 | //=========================================================== |
| 230 | |
| 231 | // pipe0/rot0 (M3DPrimaryPipe) |
| 232 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_M3D_PRIMARY) { |
| 233 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (M3DPrimaryPipe)", __FUNCTION__); |
| 234 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 235 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 236 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (M3DPrimaryPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 237 | RotatorBase* rot0 = new NewState::rot0; |
| 238 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 239 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | // pipe1/rot1 (M3DExtPipe) |
| 243 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_M3D_EXTERNAL) { |
| 244 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (M3DExtPipe)", __FUNCTION__); |
| 245 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 246 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 247 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (M3DExtPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 248 | RotatorBase* rot1 = new NewState::rot1; |
| 249 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 250 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | // pipe2/rot2 (NullPipe) |
| 254 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 255 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 256 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 257 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 258 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 259 | RotatorBase* rot2 = new NewState::rot2; |
| 260 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 261 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 265 | delete ov; |
| 266 | ov = 0; |
| 267 | |
| 268 | return newov; |
| 269 | } |
| 270 | |
| 271 | /* |
| 272 | * Transition from any state to 2D true UI mirroring (2D video + UI) |
| 273 | */ |
| 274 | OverlayImplBase* OverlayState::handle_xxx_to_2D_trueUI_Mirror( |
| 275 | OverlayImplBase* ov) |
| 276 | { |
| 277 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 278 | ALOGE("%s", __FUNCTION__); |
| 279 | |
| 280 | // Create new ovimpl based on new state |
| 281 | typedef StateTraits<utils::OV_2D_TRUE_UI_MIRROR> NewState; |
| 282 | OverlayImplBase* newov = new NewState::ovimpl; |
| 283 | |
| 284 | //=========================================================== |
| 285 | // For each pipe: |
| 286 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 287 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 288 | //=========================================================== |
| 289 | |
| 290 | // pipe0/rot0 (GenericPipe) |
| 291 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_GENERIC) { |
| 292 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (GenericPipe)", __FUNCTION__); |
| 293 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 294 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 295 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (GenericPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 296 | RotatorBase* rot0 = new NewState::rot0; |
| 297 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 298 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 299 | } |
| 300 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 301 | // pipe1/rot1 (VideoExtPipe) |
| 302 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_VIDEO_EXT) { |
| 303 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (VideoExtPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 304 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 305 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 306 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (VideoExtPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 307 | RotatorBase* rot1 = new NewState::rot1; |
| 308 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 309 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | // pipe2/rot2 (UIMirrorPipe) |
| 313 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_UI_MIRROR) { |
| 314 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (UIMirrorPipe)", __FUNCTION__); |
| 315 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 316 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 317 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (UIMirrorPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 318 | RotatorBase* rot2 = new NewState::rot2; |
| 319 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 320 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 324 | delete ov; |
| 325 | ov = 0; |
| 326 | |
| 327 | return newov; |
| 328 | } |
| 329 | |
| 330 | /* |
| 331 | * Transitions from any state to 1 layer composition bypass |
| 332 | */ |
| 333 | OverlayImplBase* OverlayState::handle_xxx_to_bypass1(OverlayImplBase* ov) |
| 334 | { |
| 335 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 336 | ALOGE("%s", __FUNCTION__); |
| 337 | |
| 338 | // Create new ovimpl based on new state |
| 339 | typedef StateTraits<utils::OV_BYPASS_1_LAYER> NewState; |
| 340 | OverlayImplBase* newov = new NewState::ovimpl; |
| 341 | |
| 342 | //=========================================================== |
| 343 | // For each pipe: |
| 344 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 345 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 346 | //=========================================================== |
| 347 | |
| 348 | // pipe0/rot0 (BypassPipe) |
| 349 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_BYPASS) { |
| 350 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (BypassPipe)", __FUNCTION__); |
| 351 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 352 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 353 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 354 | RotatorBase* rot0 = new NewState::rot0; |
| 355 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 356 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | // pipe1/rot1 (NullPipe) |
| 360 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_NULL) { |
| 361 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (NullPipe)", __FUNCTION__); |
| 362 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 363 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 364 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 365 | RotatorBase* rot1 = new NewState::rot1; |
| 366 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 367 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | // pipe2/rot2 (NullPipe) |
| 371 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 372 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 373 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 374 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 375 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 376 | RotatorBase* rot2 = new NewState::rot2; |
| 377 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 378 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 382 | delete ov; |
| 383 | ov = 0; |
| 384 | |
| 385 | return newov; |
| 386 | } |
| 387 | |
| 388 | /* |
| 389 | * Transitions from any state to 2 layers composition bypass |
| 390 | */ |
| 391 | OverlayImplBase* OverlayState::handle_xxx_to_bypass2(OverlayImplBase* ov) |
| 392 | { |
| 393 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 394 | ALOGE("%s", __FUNCTION__); |
| 395 | |
| 396 | // Create new ovimpl based on new state |
| 397 | typedef StateTraits<utils::OV_BYPASS_2_LAYER> NewState; |
| 398 | OverlayImplBase* newov = new NewState::ovimpl; |
| 399 | |
| 400 | //=========================================================== |
| 401 | // For each pipe: |
| 402 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 403 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 404 | //=========================================================== |
| 405 | |
| 406 | // pipe0/rot0 (BypassPipe) |
| 407 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_BYPASS) { |
| 408 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (BypassPipe)", __FUNCTION__); |
| 409 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 410 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 411 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 412 | RotatorBase* rot0 = new NewState::rot0; |
| 413 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 414 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | // pipe1/rot1 (BypassPipe) |
| 418 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_BYPASS) { |
| 419 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (BypassPipe)", __FUNCTION__); |
| 420 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 421 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 422 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 423 | RotatorBase* rot1 = new NewState::rot1; |
| 424 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 425 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | // pipe2/rot2 (NullPipe) |
| 429 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { |
| 430 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); |
| 431 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 432 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 433 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 434 | RotatorBase* rot2 = new NewState::rot2; |
| 435 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 436 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 440 | delete ov; |
| 441 | ov = 0; |
| 442 | |
| 443 | return newov; |
| 444 | } |
| 445 | |
| 446 | /* |
| 447 | * Transitions from any state to 3 layers composition bypass |
| 448 | */ |
| 449 | OverlayImplBase* OverlayState::handle_xxx_to_bypass3(OverlayImplBase* ov) |
| 450 | { |
| 451 | OVASSERT(ov, "%s: ov is null", __FUNCTION__); |
| 452 | ALOGE("%s", __FUNCTION__); |
| 453 | |
| 454 | // Create new ovimpl based on new state |
| 455 | typedef StateTraits<utils::OV_BYPASS_3_LAYER> NewState; |
| 456 | OverlayImplBase* newov = new NewState::ovimpl; |
| 457 | |
| 458 | //=========================================================== |
| 459 | // For each pipe: |
| 460 | // - If pipe matches, copy from previous into new ovimpl |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 461 | // - Otherwise init for new and delete from previous ovimpl |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 462 | //=========================================================== |
| 463 | |
| 464 | // pipe0/rot0 (BypassPipe) |
| 465 | if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_BYPASS) { |
| 466 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (BypassPipe)", __FUNCTION__); |
| 467 | newov->copyOvPipe(ov, utils::OV_PIPE0); |
| 468 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 469 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 470 | RotatorBase* rot0 = new NewState::rot0; |
| 471 | ov->closePipe(utils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 472 | newov->initPipe(rot0, utils::OV_PIPE0); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | // pipe1/rot1 (BypassPipe) |
| 476 | if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_BYPASS) { |
| 477 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (BypassPipe)", __FUNCTION__); |
| 478 | newov->copyOvPipe(ov, utils::OV_PIPE1); |
| 479 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 480 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 481 | RotatorBase* rot1 = new NewState::rot1; |
| 482 | ov->closePipe(utils::OV_PIPE1); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 483 | newov->initPipe(rot1, utils::OV_PIPE1); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | // pipe2/rot2 (BypassPipe) |
| 487 | if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_BYPASS) { |
| 488 | ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (BypassPipe)", __FUNCTION__); |
| 489 | newov->copyOvPipe(ov, utils::OV_PIPE2); |
| 490 | } else { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 491 | ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (BypassPipe)", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 492 | RotatorBase* rot2 = new NewState::rot2; |
| 493 | ov->closePipe(utils::OV_PIPE2); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame^] | 494 | newov->initPipe(rot2, utils::OV_PIPE2); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | // All pipes are copied or deleted so no more need for previous ovimpl |
| 498 | delete ov; |
| 499 | ov = 0; |
| 500 | |
| 501 | return newov; |
| 502 | } |
| 503 | |
| 504 | } // overlay |