Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 3 | * Copyright (C) 2012, The Linux Foundation. All rights reserved. |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 18 | #define VIDEO_DEBUG 0 |
| 19 | #include <overlay.h> |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 20 | #include "hwc_video.h" |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 21 | #include "hwc_utils.h" |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 22 | |
| 23 | namespace qhwc { |
| 24 | |
| 25 | #define FINAL_TRANSFORM_MASK 0x000F |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 26 | |
| 27 | //Static Members |
| 28 | ovutils::eOverlayState VideoOverlay::sState = ovutils::OV_CLOSED; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 29 | bool VideoOverlay::sIsModeOn = false; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 30 | |
| 31 | //Cache stats, figure out the state, config overlay |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 32 | bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list, |
| 33 | int dpy) { |
| 34 | int yuvIndex = ctx->listStats[dpy].yuvIndex; |
| 35 | |
Naseer Ahmed | 96c4c95 | 2012-07-25 18:27:14 -0700 | [diff] [blame] | 36 | if(!ctx->mMDP.hasOverlay) { |
Naseer Ahmed | 31da0b1 | 2012-07-31 18:55:33 -0700 | [diff] [blame] | 37 | ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__); |
| 38 | return false; |
| 39 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 40 | if(yuvIndex == -1) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 41 | return false; |
| 42 | } |
Naseer Ahmed | 4c588a2 | 2012-07-31 19:12:17 -0700 | [diff] [blame] | 43 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 44 | //index guaranteed to be not -1 at this point |
| 45 | hwc_layer_1_t *yuvLayer = &list->hwLayers[yuvIndex]; |
| 46 | chooseState(ctx, dpy, yuvLayer); |
| 47 | if(configure(ctx, dpy, yuvLayer)) { |
| 48 | markFlags(yuvLayer); |
| 49 | sIsModeOn = true; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 52 | return sIsModeOn; |
| 53 | } |
| 54 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 55 | void VideoOverlay::chooseState(hwc_context_t *ctx, int dpy, |
| 56 | hwc_layer_1_t *yuvLayer) { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 57 | ALOGD_IF(VIDEO_DEBUG, "%s: old state = %s", __FUNCTION__, |
| 58 | ovutils::getStateString(sState)); |
| 59 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 60 | private_handle_t *hnd = NULL; |
| 61 | if(yuvLayer) { |
| 62 | hnd = (private_handle_t *)yuvLayer->handle; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 63 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 64 | ovutils::eOverlayState newState = ovutils::OV_CLOSED; |
| 65 | switch(dpy) { |
| 66 | case HWC_DISPLAY_PRIMARY: |
| 67 | if(ctx->listStats[dpy].yuvCount == 1) { |
Saurabh Shah | 86623d7 | 2012-09-25 19:39:17 -0700 | [diff] [blame] | 68 | newState = isExternalActive(ctx) ? |
| 69 | ovutils::OV_2D_VIDEO_ON_PANEL_TV : ovutils::OV_2D_VIDEO_ON_PANEL; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 70 | if(isSkipLayer(yuvLayer) && !isSecureBuffer(hnd)) { |
Saurabh Shah | 86623d7 | 2012-09-25 19:39:17 -0700 | [diff] [blame] | 71 | newState = isExternalActive(ctx) ? |
| 72 | ovutils::OV_2D_VIDEO_ON_TV : ovutils::OV_CLOSED; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 73 | } |
| 74 | } |
| 75 | break; |
| 76 | case HWC_DISPLAY_EXTERNAL: |
| 77 | //TODO needs overlay state change for UI also |
| 78 | newState = sState; //Previously set by HWC_DISPLAY_PRIMARY |
| 79 | /*if(ctx->listStats[dpy].yuvCount == 1 && isExternalActive(ctx)) { |
| 80 | if(!isSkipLayer(yuvLayer) || isSecureBuffer(hnd)) { |
| 81 | switch(sState) { //set by primary chooseState |
| 82 | case ovutils::OV_2D_VIDEO_ON_PANEL: |
| 83 | //upgrade |
| 84 | sState = ovutils::OV_2D_VIDEO_PANEL_TV; |
| 85 | break; |
| 86 | case ovutils::OV_CLOSED: |
| 87 | sState = ovutils::OV_2D_VIDEO_ON_TV; |
| 88 | break; |
| 89 | } |
| 90 | } |
| 91 | }*/ |
| 92 | break; |
| 93 | default: |
| 94 | break; |
| 95 | } |
| 96 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 97 | sState = newState; |
| 98 | ALOGD_IF(VIDEO_DEBUG, "%s: new chosen state = %s", __FUNCTION__, |
| 99 | ovutils::getStateString(sState)); |
| 100 | } |
| 101 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 102 | void VideoOverlay::markFlags(hwc_layer_1_t *yuvLayer) { |
| 103 | if(yuvLayer) { |
| 104 | yuvLayer->compositionType = HWC_OVERLAY; |
| 105 | yuvLayer->hints |= HWC_HINT_CLEAR_FB; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 106 | } |
| 107 | } |
| 108 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 109 | /* Helpers */ |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 110 | bool configPrimVid(hwc_context_t *ctx, hwc_layer_1_t *layer) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 111 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 112 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 113 | ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 114 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 115 | ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 116 | if (isSecureBuffer(hnd)) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 117 | ovutils::setMdpFlags(mdpFlags, |
| 118 | ovutils::OV_MDP_SECURE_OVERLAY_SESSION); |
| 119 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 120 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 121 | ovutils::eIsFg isFgFlag = ovutils::IS_FG_OFF; |
| 122 | if (ctx->numHwLayers == 1) { |
| 123 | isFgFlag = ovutils::IS_FG_SET; |
| 124 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 125 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 126 | ovutils::PipeArgs parg(mdpFlags, |
| 127 | info, |
| 128 | ovutils::ZORDER_0, |
| 129 | isFgFlag, |
| 130 | ovutils::ROT_FLAG_DISABLED); |
| 131 | ovutils::PipeArgs pargs[ovutils::MAX_PIPES] = { parg, parg, parg }; |
| 132 | ov.setSource(pargs, ovutils::OV_PIPE0); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 133 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 134 | hwc_rect_t sourceCrop = layer->sourceCrop; |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 135 | hwc_rect_t displayFrame = layer->displayFrame; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 136 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 137 | //Calculate the rect for primary based on whether the supplied position |
| 138 | //is within or outside bounds. |
| 139 | const int fbWidth = |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 140 | ovutils::FrameBufferInfo::getInstance()->getWidth(); |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 141 | const int fbHeight = |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 142 | ovutils::FrameBufferInfo::getInstance()->getHeight(); |
| 143 | |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 144 | if( displayFrame.left < 0 || |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 145 | displayFrame.top < 0 || |
| 146 | displayFrame.right > fbWidth || |
| 147 | displayFrame.bottom > fbHeight) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 148 | calculate_crop_rects(sourceCrop, displayFrame, fbWidth, fbHeight); |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 149 | } |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 150 | |
Saurabh Shah | 1023ce2 | 2012-09-05 18:45:59 -0700 | [diff] [blame] | 151 | // source crop x,y,w,h |
| 152 | ovutils::Dim dcrop(sourceCrop.left, sourceCrop.top, |
| 153 | sourceCrop.right - sourceCrop.left, |
| 154 | sourceCrop.bottom - sourceCrop.top); |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 155 | //Only for Primary |
| 156 | ov.setCrop(dcrop, ovutils::OV_PIPE0); |
| 157 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 158 | int transform = layer->transform; |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 159 | ovutils::eTransform orient = |
| 160 | static_cast<ovutils::eTransform>(transform); |
| 161 | ov.setTransform(orient, ovutils::OV_PIPE0); |
| 162 | |
Saurabh Shah | 1023ce2 | 2012-09-05 18:45:59 -0700 | [diff] [blame] | 163 | // position x,y,w,h |
| 164 | ovutils::Dim dpos(displayFrame.left, |
| 165 | displayFrame.top, |
| 166 | displayFrame.right - displayFrame.left, |
| 167 | displayFrame.bottom - displayFrame.top); |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 168 | ov.setPosition(dpos, ovutils::OV_PIPE0); |
| 169 | |
| 170 | if (!ov.commit(ovutils::OV_PIPE0)) { |
| 171 | ALOGE("%s: commit fails", __FUNCTION__); |
| 172 | return false; |
| 173 | } |
| 174 | return true; |
| 175 | } |
| 176 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 177 | bool configExtVid(hwc_context_t *ctx, hwc_layer_1_t *layer) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 178 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 179 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 180 | ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size); |
| 181 | |
| 182 | ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 183 | if (isSecureBuffer(hnd)) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 184 | ovutils::setMdpFlags(mdpFlags, |
| 185 | ovutils::OV_MDP_SECURE_OVERLAY_SESSION); |
| 186 | } |
| 187 | |
| 188 | ovutils::eIsFg isFgFlag = ovutils::IS_FG_OFF; |
| 189 | if (ctx->numHwLayers == 1) { |
| 190 | isFgFlag = ovutils::IS_FG_SET; |
| 191 | } |
| 192 | |
| 193 | ovutils::PipeArgs parg(mdpFlags, |
| 194 | info, |
| 195 | ovutils::ZORDER_0, |
| 196 | isFgFlag, |
Saurabh Shah | 8c8bfd2 | 2012-09-26 21:09:40 -0700 | [diff] [blame] | 197 | ovutils::ROT_FLAG_ENABLED); //TODO remove this hack when sync for |
| 198 | //ext is done |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 199 | ovutils::PipeArgs pargs[ovutils::MAX_PIPES] = { parg, parg, parg }; |
| 200 | ov.setSource(pargs, ovutils::OV_PIPE1); |
| 201 | |
| 202 | hwc_rect_t sourceCrop = layer->sourceCrop; |
| 203 | // x,y,w,h |
| 204 | ovutils::Dim dcrop(sourceCrop.left, sourceCrop.top, |
| 205 | sourceCrop.right - sourceCrop.left, |
| 206 | sourceCrop.bottom - sourceCrop.top); |
| 207 | //Only for External |
| 208 | ov.setCrop(dcrop, ovutils::OV_PIPE1); |
| 209 | |
| 210 | // FIXME: Use source orientation for TV when source is portrait |
| 211 | //Only for External |
| 212 | ov.setTransform(0, ovutils::OV_PIPE1); |
| 213 | |
| 214 | ovutils::Dim dpos; |
| 215 | hwc_rect_t displayFrame = layer->displayFrame; |
| 216 | dpos.x = displayFrame.left; |
| 217 | dpos.y = displayFrame.top; |
| 218 | dpos.w = (displayFrame.right - displayFrame.left); |
| 219 | dpos.h = (displayFrame.bottom - displayFrame.top); |
| 220 | |
| 221 | //Only for External |
| 222 | ov.setPosition(dpos, ovutils::OV_PIPE1); |
| 223 | |
| 224 | if (!ov.commit(ovutils::OV_PIPE1)) { |
| 225 | ALOGE("%s: commit fails", __FUNCTION__); |
| 226 | return false; |
| 227 | } |
| 228 | return true; |
| 229 | } |
| 230 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 231 | bool VideoOverlay::configure(hwc_context_t *ctx, int dpy, |
| 232 | hwc_layer_1_t *yuvLayer) { |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 233 | bool ret = true; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 234 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 235 | switch(dpy) { |
| 236 | case HWC_DISPLAY_PRIMARY: |
| 237 | // Set overlay state |
| 238 | ov.setState(sState); |
| 239 | switch(sState) { |
| 240 | case ovutils::OV_2D_VIDEO_ON_PANEL: |
| 241 | ret &= configPrimVid(ctx, yuvLayer); |
| 242 | break; |
Saurabh Shah | 86623d7 | 2012-09-25 19:39:17 -0700 | [diff] [blame] | 243 | case ovutils::OV_2D_VIDEO_ON_PANEL_TV: |
| 244 | ret &= configPrimVid(ctx, yuvLayer); |
| 245 | ret &= configExtVid(ctx, yuvLayer); |
| 246 | break; |
| 247 | case ovutils::OV_2D_VIDEO_ON_TV: |
| 248 | ret &= configExtVid(ctx, yuvLayer); |
| 249 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 250 | default: |
| 251 | return false; |
| 252 | } |
| 253 | break; |
| 254 | case HWC_DISPLAY_EXTERNAL: |
| 255 | ov.setState(sState); |
| 256 | switch(sState) { |
| 257 | case ovutils::OV_2D_VIDEO_ON_PANEL_TV: |
| 258 | case ovutils::OV_2D_VIDEO_ON_TV: |
| 259 | ret = configExtVid(ctx, yuvLayer); |
| 260 | break; |
| 261 | default: |
| 262 | return false; |
| 263 | } |
| 264 | break; |
Naseer Ahmed | 2cc53dd | 2012-07-31 19:11:48 -0700 | [diff] [blame] | 265 | } |
| 266 | return ret; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 269 | bool VideoOverlay::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list, |
| 270 | int dpy) |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 271 | { |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 272 | int yuvIndex = ctx->listStats[dpy].yuvIndex; |
| 273 | if(!sIsModeOn || yuvIndex == -1) { |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 274 | return true; |
| 275 | } |
| 276 | |
Naseer Ahmed | 4c588a2 | 2012-07-31 19:12:17 -0700 | [diff] [blame] | 277 | private_handle_t *hnd = (private_handle_t *) |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 278 | list->hwLayers[yuvIndex].handle; |
Naseer Ahmed | 4c588a2 | 2012-07-31 19:12:17 -0700 | [diff] [blame] | 279 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 280 | bool ret = true; |
| 281 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 282 | ovutils::eOverlayState state = ov.getState(); |
| 283 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 284 | switch(dpy) { |
| 285 | case HWC_DISPLAY_PRIMARY: |
| 286 | switch (state) { |
| 287 | case ovutils::OV_2D_VIDEO_ON_PANEL: |
| 288 | // Play primary |
| 289 | if (!ov.queueBuffer(hnd->fd, hnd->offset, ovutils::OV_PIPE0)) { |
| 290 | ALOGE("%s: queueBuffer failed for primary", __FUNCTION__); |
| 291 | ret = false; |
| 292 | } |
| 293 | break; |
Saurabh Shah | 86623d7 | 2012-09-25 19:39:17 -0700 | [diff] [blame] | 294 | case ovutils::OV_2D_VIDEO_ON_PANEL_TV: |
| 295 | if (!ov.queueBuffer(hnd->fd, hnd->offset, ovutils::OV_PIPE0)) { |
| 296 | ALOGE("%s: queueBuffer failed for primary", __FUNCTION__); |
| 297 | ret = false; |
| 298 | } |
| 299 | // Play external |
| 300 | if (!ov.queueBuffer(hnd->fd, hnd->offset, ovutils::OV_PIPE1)) { |
| 301 | ALOGE("%s: queueBuffer failed for external", __FUNCTION__); |
| 302 | ret = false; |
| 303 | } |
| 304 | break; |
| 305 | case ovutils::OV_2D_VIDEO_ON_TV: |
| 306 | // Play external |
| 307 | if (!ov.queueBuffer(hnd->fd, hnd->offset, ovutils::OV_PIPE1)) { |
| 308 | ALOGE("%s: queueBuffer failed for external", __FUNCTION__); |
| 309 | ret = false; |
| 310 | } |
| 311 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 312 | default: |
| 313 | ret = false; |
| 314 | break; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 315 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 316 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 317 | case HWC_DISPLAY_EXTERNAL: |
| 318 | switch(state) { |
| 319 | case ovutils::OV_2D_VIDEO_ON_PANEL_TV: |
| 320 | case ovutils::OV_2D_VIDEO_ON_TV: |
| 321 | // Play external |
| 322 | if (!ov.queueBuffer(hnd->fd, hnd->offset, ovutils::OV_PIPE1)) { |
| 323 | ALOGE("%s: queueBuffer failed for external", __FUNCTION__); |
| 324 | ret = false; |
| 325 | } |
| 326 | break; |
| 327 | default: |
| 328 | ret = false; |
| 329 | break; |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 330 | } |
| 331 | break; |
| 332 | } |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 333 | return ret; |
| 334 | } |
| 335 | |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 336 | }; //namespace qhwc |