Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
Arun Kumar K.R | ba9eed5 | 2013-01-04 00:51:29 -0800 | [diff] [blame] | 3 | * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 4 | * |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 5 | * Not a Contribution, Apache license notifications and license are retained |
| 6 | * for attribution purposes only. |
| 7 | * |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | * you may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
| 19 | */ |
| 20 | |
| 21 | #include <fcntl.h> |
| 22 | #include <errno.h> |
| 23 | |
| 24 | #include <cutils/log.h> |
| 25 | #include <cutils/atomic.h> |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 26 | #include <EGL/egl.h> |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 27 | |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 28 | #include <overlay.h> |
| 29 | #include <fb_priv.h> |
Naseer Ahmed | 96c4c95 | 2012-07-25 18:27:14 -0700 | [diff] [blame] | 30 | #include <mdp_version.h> |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 31 | #include "hwc_utils.h" |
Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 32 | #include "hwc_video.h" |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 33 | #include "hwc_fbupdate.h" |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 34 | #include "hwc_mdpcomp.h" |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 35 | #include "external.h" |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 36 | #include "hwc_copybit.h" |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 37 | |
| 38 | using namespace qhwc; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 39 | #define VSYNC_DEBUG 0 |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 40 | |
| 41 | static int hwc_device_open(const struct hw_module_t* module, |
| 42 | const char* name, |
| 43 | struct hw_device_t** device); |
| 44 | |
| 45 | static struct hw_module_methods_t hwc_module_methods = { |
| 46 | open: hwc_device_open |
| 47 | }; |
| 48 | |
| 49 | hwc_module_t HAL_MODULE_INFO_SYM = { |
| 50 | common: { |
| 51 | tag: HARDWARE_MODULE_TAG, |
| 52 | version_major: 2, |
| 53 | version_minor: 0, |
| 54 | id: HWC_HARDWARE_MODULE_ID, |
| 55 | name: "Qualcomm Hardware Composer Module", |
| 56 | author: "CodeAurora Forum", |
| 57 | methods: &hwc_module_methods, |
| 58 | dso: 0, |
| 59 | reserved: {0}, |
| 60 | } |
| 61 | }; |
| 62 | |
| 63 | /* |
| 64 | * Save callback functions registered to HWC |
| 65 | */ |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 66 | static void hwc_registerProcs(struct hwc_composer_device_1* dev, |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 67 | hwc_procs_t const* procs) |
| 68 | { |
Iliyan Malchev | 0f9c397 | 2012-10-11 15:16:15 -0700 | [diff] [blame] | 69 | ALOGI("%s", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 70 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
| 71 | if(!ctx) { |
| 72 | ALOGE("%s: Invalid context", __FUNCTION__); |
| 73 | return; |
| 74 | } |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 75 | ctx->proc = procs; |
| 76 | |
Naseer Ahmed | ff4f025 | 2012-10-01 13:03:01 -0400 | [diff] [blame] | 77 | // Now that we have the functions needed, kick off |
| 78 | // the uevent & vsync threads |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 79 | init_uevent_thread(ctx); |
Naseer Ahmed | ff4f025 | 2012-10-01 13:03:01 -0400 | [diff] [blame] | 80 | init_vsync_thread(ctx); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Saurabh Shah | 649cda6 | 2012-09-16 16:05:58 -0700 | [diff] [blame] | 83 | //Helper |
Naseer Ahmed | b1c7632 | 2012-10-17 00:32:50 -0400 | [diff] [blame] | 84 | static void reset(hwc_context_t *ctx, int numDisplays, |
| 85 | hwc_display_contents_1_t** displays) { |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 86 | memset(ctx->listStats, 0, sizeof(ctx->listStats)); |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 87 | for(int i = 0; i < MAX_DISPLAYS; i++) { |
Naseer Ahmed | b1c7632 | 2012-10-17 00:32:50 -0400 | [diff] [blame] | 88 | hwc_display_contents_1_t *list = displays[i]; |
| 89 | // XXX:SurfaceFlinger no longer guarantees that this |
| 90 | // value is reset on every prepare. However, for the layer |
| 91 | // cache we need to reset it. |
| 92 | // We can probably rethink that later on |
| 93 | if (LIKELY(list && list->numHwLayers > 1)) { |
| 94 | for(uint32_t j = 0; j < list->numHwLayers; j++) { |
| 95 | if(list->hwLayers[j].compositionType != HWC_FRAMEBUFFER_TARGET) |
| 96 | list->hwLayers[j].compositionType = HWC_FRAMEBUFFER; |
| 97 | } |
| 98 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 99 | |
| 100 | if(ctx->mFBUpdate[i]) |
| 101 | ctx->mFBUpdate[i]->reset(); |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 102 | |
| 103 | if(ctx->mCopyBit[i]) |
| 104 | ctx->mCopyBit[i]->reset(); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 105 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 106 | VideoOverlay::reset(); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 109 | //clear prev layer prop flags and realloc for current frame |
| 110 | static void reset_layer_prop(hwc_context_t* ctx, int dpy) { |
| 111 | int layer_count = ctx->listStats[dpy].numAppLayers; |
| 112 | |
| 113 | if(ctx->layerProp[dpy]) { |
| 114 | delete[] ctx->layerProp[dpy]; |
| 115 | ctx->layerProp[dpy] = NULL; |
| 116 | } |
| 117 | |
| 118 | if(layer_count) { |
| 119 | ctx->layerProp[dpy] = new LayerProp[layer_count]; |
| 120 | } |
| 121 | } |
| 122 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 123 | static int hwc_prepare_primary(hwc_composer_device_1 *dev, |
| 124 | hwc_display_contents_1_t *list) { |
| 125 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 126 | const int dpy = HWC_DISPLAY_PRIMARY; |
Saurabh Shah | 1a8cda0 | 2012-10-12 17:00:39 -0700 | [diff] [blame] | 127 | if (LIKELY(list && list->numHwLayers > 1) && |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 128 | ctx->dpyAttr[dpy].isActive) { |
Saurabh Shah | 1a8cda0 | 2012-10-12 17:00:39 -0700 | [diff] [blame] | 129 | |
Saurabh Shah | 86623d7 | 2012-09-25 19:39:17 -0700 | [diff] [blame] | 130 | uint32_t last = list->numHwLayers - 1; |
Saurabh Shah | 1a8cda0 | 2012-10-12 17:00:39 -0700 | [diff] [blame] | 131 | hwc_layer_1_t *fbLayer = &list->hwLayers[last]; |
| 132 | if(fbLayer->handle) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 133 | setListStats(ctx, list, dpy); |
| 134 | reset_layer_prop(ctx, dpy); |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 135 | int ret = ctx->mMDPComp->prepare(ctx, list); |
| 136 | if(!ret) { |
| 137 | // IF MDPcomp fails use this route |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 138 | VideoOverlay::prepare(ctx, list, dpy); |
| 139 | ctx->mFBUpdate[dpy]->prepare(ctx, fbLayer); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 140 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 141 | ctx->mLayerCache[dpy]->updateLayerCache(list); |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 142 | // Use Copybit, when MDP comp fails |
| 143 | if(!ret && ctx->mCopyBit[dpy]) |
| 144 | ctx->mCopyBit[dpy]->prepare(ctx, list, dpy); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | static int hwc_prepare_external(hwc_composer_device_1 *dev, |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 151 | hwc_display_contents_1_t *list, int dpy) { |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 152 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 153 | |
Saurabh Shah | ae823e7 | 2012-10-05 00:08:11 -0400 | [diff] [blame] | 154 | if (LIKELY(list && list->numHwLayers > 1) && |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 155 | ctx->dpyAttr[dpy].isActive && |
| 156 | ctx->dpyAttr[dpy].connected) { |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 157 | uint32_t last = list->numHwLayers - 1; |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 158 | if(!ctx->dpyAttr[dpy].isPause) { |
| 159 | hwc_layer_1_t *fbLayer = &list->hwLayers[last]; |
| 160 | if(fbLayer->handle) { |
| 161 | setListStats(ctx, list, dpy); |
| 162 | reset_layer_prop(ctx, dpy); |
| 163 | VideoOverlay::prepare(ctx, list, dpy); |
| 164 | ctx->mFBUpdate[dpy]->prepare(ctx, fbLayer); |
| 165 | ctx->mLayerCache[dpy]->updateLayerCache(list); |
| 166 | if(ctx->mCopyBit[dpy]) |
| 167 | ctx->mCopyBit[dpy]->prepare(ctx, list, dpy); |
| 168 | ctx->mExtDispConfiguring = false; |
| 169 | } |
| 170 | } else { |
| 171 | // External Display is in Pause state. |
| 172 | // ToDo: |
| 173 | // Mark all application layers as OVERLAY so that |
| 174 | // GPU will not compose. This is done for power |
| 175 | // optimization |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 176 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 177 | } |
| 178 | return 0; |
Saurabh Shah | 649cda6 | 2012-09-16 16:05:58 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 181 | static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays, |
| 182 | hwc_display_contents_1_t** displays) |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 183 | { |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 184 | int ret = 0; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 185 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 186 | Locker::Autolock _l(ctx->mBlankLock); |
Naseer Ahmed | b1c7632 | 2012-10-17 00:32:50 -0400 | [diff] [blame] | 187 | reset(ctx, numDisplays, displays); |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 188 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 189 | ctx->mOverlay->configBegin(); |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 190 | |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 191 | for (int32_t i = numDisplays; i >= 0; i--) { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 192 | hwc_display_contents_1_t *list = displays[i]; |
| 193 | switch(i) { |
| 194 | case HWC_DISPLAY_PRIMARY: |
| 195 | ret = hwc_prepare_primary(dev, list); |
| 196 | break; |
| 197 | case HWC_DISPLAY_EXTERNAL: |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 198 | case HWC_DISPLAY_VIRTUAL: |
| 199 | ret = hwc_prepare_external(dev, list, i); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 200 | break; |
| 201 | default: |
| 202 | ret = -EINVAL; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 203 | } |
| 204 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 205 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 206 | ctx->mOverlay->configDone(); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 207 | return ret; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 210 | static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy, |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 211 | int event, int enabled) |
| 212 | { |
| 213 | int ret = 0; |
Naseer Ahmed | ff4f025 | 2012-10-01 13:03:01 -0400 | [diff] [blame] | 214 | |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 215 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
| 216 | private_module_t* m = reinterpret_cast<private_module_t*>( |
| 217 | ctx->mFbDev->common.module); |
Iliyan Malchev | eac8965 | 2012-10-04 10:38:28 -0700 | [diff] [blame] | 218 | pthread_mutex_lock(&ctx->vstate.lock); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 219 | switch(event) { |
| 220 | case HWC_EVENT_VSYNC: |
Omprakash Dhyade | 1ef881c | 2012-10-03 02:26:55 -0700 | [diff] [blame] | 221 | if (ctx->vstate.enable == enabled) |
| 222 | break; |
Iliyan Malchev | eac8965 | 2012-10-04 10:38:28 -0700 | [diff] [blame] | 223 | ctx->vstate.enable = !!enabled; |
Naseer Ahmed | c7faa70 | 2012-10-04 15:10:30 -0400 | [diff] [blame] | 224 | pthread_cond_signal(&ctx->vstate.cond); |
Iliyan Malchev | eac8965 | 2012-10-04 10:38:28 -0700 | [diff] [blame] | 225 | ALOGD_IF (VSYNC_DEBUG, "VSYNC state changed to %s", |
| 226 | (enabled)?"ENABLED":"DISABLED"); |
| 227 | break; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 228 | default: |
| 229 | ret = -EINVAL; |
| 230 | } |
Iliyan Malchev | eac8965 | 2012-10-04 10:38:28 -0700 | [diff] [blame] | 231 | pthread_mutex_unlock(&ctx->vstate.lock); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 232 | return ret; |
| 233 | } |
| 234 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 235 | static int hwc_blank(struct hwc_composer_device_1* dev, int dpy, int blank) |
| 236 | { |
Naseer Ahmed | 934790c | 2012-08-16 18:11:09 -0700 | [diff] [blame] | 237 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
| 238 | private_module_t* m = reinterpret_cast<private_module_t*>( |
| 239 | ctx->mFbDev->common.module); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 240 | Locker::Autolock _l(ctx->mBlankLock); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 241 | int ret = 0; |
| 242 | ALOGD("%s: Doing Dpy=%d, blank=%d", __FUNCTION__, dpy, blank); |
| 243 | switch(dpy) { |
| 244 | case HWC_DISPLAY_PRIMARY: |
| 245 | if(blank) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 246 | ctx->mOverlay->configBegin(); |
| 247 | ctx->mOverlay->configDone(); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 248 | ret = ioctl(m->framebuffer->fd, FBIOBLANK, FB_BLANK_POWERDOWN); |
| 249 | } else { |
| 250 | ret = ioctl(m->framebuffer->fd, FBIOBLANK, FB_BLANK_UNBLANK); |
| 251 | } |
| 252 | break; |
| 253 | case HWC_DISPLAY_EXTERNAL: |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 254 | case HWC_DISPLAY_VIRTUAL: |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 255 | if(blank) { |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 256 | // External/Virtual Display post commits the changes to display |
Arun Kumar K.R | ba9eed5 | 2013-01-04 00:51:29 -0800 | [diff] [blame] | 257 | // Call this on blank, so that any pipe unsets gets committed |
| 258 | if (!ctx->mExtDisplay->post()) { |
| 259 | ret = -1; |
| 260 | ALOGE("%s:ctx->mExtDisplay->post fail!! ", __FUNCTION__); |
| 261 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 262 | } else { |
| 263 | } |
| 264 | break; |
| 265 | default: |
| 266 | return -EINVAL; |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 267 | } |
Arun Kumar K.R | f6f49a1 | 2012-11-27 11:46:50 -0800 | [diff] [blame] | 268 | // Enable HPD here, as during bootup unblank is called |
| 269 | // when SF is completely initialized |
| 270 | ctx->mExtDisplay->setHPD(1); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 271 | |
| 272 | if(ret < 0) { |
| 273 | ALOGE("%s: failed. Dpy=%d, blank=%d : %s", |
| 274 | __FUNCTION__, dpy, blank, strerror(errno)); |
| 275 | return ret; |
| 276 | } |
| 277 | ALOGD("%s: Done Dpy=%d, blank=%d", __FUNCTION__, dpy, blank); |
| 278 | ctx->dpyAttr[dpy].isActive = !blank; |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 279 | return 0; |
| 280 | } |
| 281 | |
| 282 | static int hwc_query(struct hwc_composer_device_1* dev, |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 283 | int param, int* value) |
| 284 | { |
| 285 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
| 286 | private_module_t* m = reinterpret_cast<private_module_t*>( |
| 287 | ctx->mFbDev->common.module); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 288 | int supported = HWC_DISPLAY_PRIMARY_BIT; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 289 | |
| 290 | switch (param) { |
| 291 | case HWC_BACKGROUND_LAYER_SUPPORTED: |
| 292 | // Not supported for now |
| 293 | value[0] = 0; |
| 294 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 295 | case HWC_VSYNC_PERIOD: //Not used for hwc > 1.1 |
Saurabh Shah | 2e2798c | 2012-08-30 14:47:10 -0700 | [diff] [blame] | 296 | value[0] = m->fps; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 297 | ALOGI("fps: %d", value[0]); |
| 298 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 299 | case HWC_DISPLAY_TYPES_SUPPORTED: |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 300 | if(ctx->mMDP.hasOverlay) |
| 301 | supported |= HWC_DISPLAY_EXTERNAL_BIT; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 302 | value[0] = supported; |
| 303 | break; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 304 | default: |
| 305 | return -EINVAL; |
| 306 | } |
| 307 | return 0; |
| 308 | |
| 309 | } |
| 310 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 311 | static int hwc_set_primary(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 312 | int ret = 0; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 313 | const int dpy = HWC_DISPLAY_PRIMARY; |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 314 | |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 315 | if (LIKELY(list) && ctx->dpyAttr[dpy].isActive) { |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 316 | uint32_t last = list->numHwLayers - 1; |
| 317 | hwc_layer_1_t *fbLayer = &list->hwLayers[last]; |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 318 | int fd = -1; //FenceFD from the Copybit(valid in async mode) |
| 319 | if(ctx->mCopyBit[dpy]) |
| 320 | ctx->mCopyBit[dpy]->draw(ctx, list, dpy, &fd); |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 321 | if(list->numHwLayers > 1) |
| 322 | hwc_sync(ctx, list, dpy, fd); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 323 | if (!VideoOverlay::draw(ctx, list, dpy)) { |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 324 | ALOGE("%s: VideoOverlay::draw fail!", __FUNCTION__); |
| 325 | ret = -1; |
| 326 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 327 | if (!ctx->mMDPComp->draw(ctx, list)) { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 328 | ALOGE("%s: MDPComp::draw fail!", __FUNCTION__); |
| 329 | ret = -1; |
| 330 | } |
| 331 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 332 | //TODO We dont check for SKIP flag on this layer because we need PAN |
| 333 | //always. Last layer is always FB |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 334 | private_handle_t *hnd = (private_handle_t *)fbLayer->handle; |
| 335 | if(fbLayer->compositionType == HWC_FRAMEBUFFER_TARGET && hnd) { |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 336 | if(!(fbLayer->flags & HWC_SKIP_LAYER) && |
| 337 | (list->numHwLayers > 1)) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 338 | if (!ctx->mFBUpdate[dpy]->draw(ctx, fbLayer)) { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 339 | ALOGE("%s: FBUpdate::draw fail!", __FUNCTION__); |
| 340 | ret = -1; |
| 341 | } |
| 342 | } |
Saurabh Shah | 4333330 | 2013-02-06 13:30:27 -0800 | [diff] [blame] | 343 | } |
| 344 | if (ctx->mFbDev->post(ctx->mFbDev, fbLayer->handle)) { |
| 345 | ALOGE("%s: ctx->mFbDev->post fail!", __FUNCTION__); |
Saurabh Shah | 747af1e | 2013-02-26 10:25:12 -0800 | [diff] [blame^] | 346 | ret = -1; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 347 | } |
| 348 | } |
Saurabh Shah | 747af1e | 2013-02-26 10:25:12 -0800 | [diff] [blame^] | 349 | |
| 350 | closeAcquireFds(list); |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 351 | return ret; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | static int hwc_set_external(hwc_context_t *ctx, |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 355 | hwc_display_contents_1_t* list, int dpy) { |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 356 | int ret = 0; |
Kinjal Bhavsar | f83d448 | 2012-10-10 15:56:21 -0700 | [diff] [blame] | 357 | Locker::Autolock _l(ctx->mExtSetLock); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 358 | |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 359 | if (LIKELY(list) && ctx->dpyAttr[dpy].isActive && |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 360 | !ctx->dpyAttr[dpy].isPause && |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 361 | ctx->dpyAttr[dpy].connected) { |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 362 | uint32_t last = list->numHwLayers - 1; |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 363 | hwc_layer_1_t *fbLayer = &list->hwLayers[last]; |
Arun Kumar K.R | 361da4f | 2012-11-28 10:42:59 -0800 | [diff] [blame] | 364 | int fd = -1; //FenceFD from the Copybit(valid in async mode) |
| 365 | if(ctx->mCopyBit[dpy]) |
| 366 | ctx->mCopyBit[dpy]->draw(ctx, list, dpy, &fd); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 367 | |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 368 | if(list->numHwLayers > 1) |
| 369 | hwc_sync(ctx, list, dpy, fd); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 370 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 371 | if (!VideoOverlay::draw(ctx, list, dpy)) { |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 372 | ALOGE("%s: VideoOverlay::draw fail!", __FUNCTION__); |
| 373 | ret = -1; |
| 374 | } |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 375 | |
| 376 | private_handle_t *hnd = (private_handle_t *)fbLayer->handle; |
Saurabh Shah | 150806a | 2012-10-09 15:38:23 -0700 | [diff] [blame] | 377 | if(fbLayer->compositionType == HWC_FRAMEBUFFER_TARGET && |
Amara Venkata Mastan Manoj Kumar | 57e3c81 | 2013-01-11 13:36:33 -0800 | [diff] [blame] | 378 | !(fbLayer->flags & HWC_SKIP_LAYER) && hnd && |
| 379 | (list->numHwLayers > 1)) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 380 | if (!ctx->mFBUpdate[dpy]->draw(ctx, fbLayer)) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 381 | ALOGE("%s: FBUpdate::draw fail!", __FUNCTION__); |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 382 | ret = -1; |
| 383 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 384 | } |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 385 | if (!ctx->mExtDisplay->post()) { |
| 386 | ALOGE("%s: ctx->mExtDisplay->post fail!", __FUNCTION__); |
Saurabh Shah | 747af1e | 2013-02-26 10:25:12 -0800 | [diff] [blame^] | 387 | ret = -1; |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 388 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 389 | } |
Saurabh Shah | 747af1e | 2013-02-26 10:25:12 -0800 | [diff] [blame^] | 390 | |
| 391 | closeAcquireFds(list); |
Saurabh Shah | eaf6791 | 2012-10-10 17:33:14 -0700 | [diff] [blame] | 392 | return ret; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 395 | static int hwc_set(hwc_composer_device_1 *dev, |
| 396 | size_t numDisplays, |
| 397 | hwc_display_contents_1_t** displays) |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 398 | { |
| 399 | int ret = 0; |
| 400 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Naseer Ahmed | 32ff225 | 2012-09-29 01:41:21 -0400 | [diff] [blame] | 401 | Locker::Autolock _l(ctx->mBlankLock); |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 402 | for (uint32_t i = 0; i <= numDisplays; i++) { |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 403 | hwc_display_contents_1_t* list = displays[i]; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 404 | switch(i) { |
| 405 | case HWC_DISPLAY_PRIMARY: |
| 406 | ret = hwc_set_primary(ctx, list); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 407 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 408 | case HWC_DISPLAY_EXTERNAL: |
Amara Venkata Mastan Manoj Kumar | 11a380d | 2013-01-17 09:30:56 -0800 | [diff] [blame] | 409 | case HWC_DISPLAY_VIRTUAL: |
| 410 | /* ToDo: We are using hwc_set_external path for both External and |
| 411 | Virtual displays on HWC1.1. Eventually, we will have |
| 412 | separate functions when we move to HWC1.2 |
| 413 | */ |
| 414 | ret = hwc_set_external(ctx, list, i); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 415 | break; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 416 | default: |
| 417 | ret = -EINVAL; |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 418 | } |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 419 | } |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 420 | return ret; |
| 421 | } |
| 422 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 423 | int hwc_getDisplayConfigs(struct hwc_composer_device_1* dev, int disp, |
| 424 | uint32_t* configs, size_t* numConfigs) { |
| 425 | int ret = 0; |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 426 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 427 | //in 1.1 there is no way to choose a config, report as config id # 0 |
| 428 | //This config is passed to getDisplayAttributes. Ignore for now. |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 429 | switch(disp) { |
| 430 | case HWC_DISPLAY_PRIMARY: |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 431 | if(*numConfigs > 0) { |
| 432 | configs[0] = 0; |
| 433 | *numConfigs = 1; |
| 434 | } |
| 435 | ret = 0; //NO_ERROR |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 436 | break; |
| 437 | case HWC_DISPLAY_EXTERNAL: |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 438 | ret = -1; //Not connected |
| 439 | if(ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected) { |
| 440 | ret = 0; //NO_ERROR |
| 441 | if(*numConfigs > 0) { |
| 442 | configs[0] = 0; |
| 443 | *numConfigs = 1; |
| 444 | } |
| 445 | } |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 446 | break; |
| 447 | } |
| 448 | return ret; |
| 449 | } |
| 450 | |
| 451 | int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp, |
| 452 | uint32_t config, const uint32_t* attributes, int32_t* values) { |
| 453 | |
| 454 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 455 | //If hotpluggable displays are inactive return error |
| 456 | if(disp == HWC_DISPLAY_EXTERNAL && !ctx->dpyAttr[disp].connected) { |
| 457 | return -1; |
| 458 | } |
| 459 | |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 460 | //From HWComposer |
| 461 | static const uint32_t DISPLAY_ATTRIBUTES[] = { |
| 462 | HWC_DISPLAY_VSYNC_PERIOD, |
| 463 | HWC_DISPLAY_WIDTH, |
| 464 | HWC_DISPLAY_HEIGHT, |
| 465 | HWC_DISPLAY_DPI_X, |
| 466 | HWC_DISPLAY_DPI_Y, |
| 467 | HWC_DISPLAY_NO_ATTRIBUTE, |
| 468 | }; |
| 469 | |
| 470 | const int NUM_DISPLAY_ATTRIBUTES = (sizeof(DISPLAY_ATTRIBUTES) / |
| 471 | sizeof(DISPLAY_ATTRIBUTES)[0]); |
| 472 | |
| 473 | for (size_t i = 0; i < NUM_DISPLAY_ATTRIBUTES - 1; i++) { |
| 474 | switch (attributes[i]) { |
| 475 | case HWC_DISPLAY_VSYNC_PERIOD: |
| 476 | values[i] = ctx->dpyAttr[disp].vsync_period; |
| 477 | break; |
| 478 | case HWC_DISPLAY_WIDTH: |
| 479 | values[i] = ctx->dpyAttr[disp].xres; |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 480 | ALOGD("%s disp = %d, width = %d",__FUNCTION__, disp, |
| 481 | ctx->dpyAttr[disp].xres); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 482 | break; |
| 483 | case HWC_DISPLAY_HEIGHT: |
| 484 | values[i] = ctx->dpyAttr[disp].yres; |
Saurabh Shah | c4d034f | 2012-09-27 15:55:15 -0700 | [diff] [blame] | 485 | ALOGD("%s disp = %d, height = %d",__FUNCTION__, disp, |
| 486 | ctx->dpyAttr[disp].yres); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 487 | break; |
| 488 | case HWC_DISPLAY_DPI_X: |
Naseer Ahmed | 7b80d9c | 2012-09-26 20:14:38 -0400 | [diff] [blame] | 489 | values[i] = (int32_t) (ctx->dpyAttr[disp].xdpi*1000.0); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 490 | break; |
| 491 | case HWC_DISPLAY_DPI_Y: |
Naseer Ahmed | 7b80d9c | 2012-09-26 20:14:38 -0400 | [diff] [blame] | 492 | values[i] = (int32_t) (ctx->dpyAttr[disp].ydpi*1000.0); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 493 | break; |
| 494 | default: |
| 495 | ALOGE("Unknown display attribute %d", |
| 496 | attributes[i]); |
| 497 | return -EINVAL; |
| 498 | } |
| 499 | } |
| 500 | return 0; |
| 501 | } |
| 502 | |
Naseer Ahmed | 1d183f5 | 2012-11-26 12:35:16 -0500 | [diff] [blame] | 503 | void hwc_dump(struct hwc_composer_device_1* dev, char *buff, int buff_len) |
| 504 | { |
| 505 | hwc_context_t* ctx = (hwc_context_t*)(dev); |
Saurabh Shah | 0d0a7cb | 2013-02-12 17:58:19 -0800 | [diff] [blame] | 506 | android::String8 aBuf(""); |
| 507 | dumpsys_log(aBuf, "Qualcomm HWC state:\n"); |
| 508 | dumpsys_log(aBuf, " MDPVersion=%d\n", ctx->mMDP.version); |
| 509 | dumpsys_log(aBuf, " DisplayPanel=%c\n", ctx->mMDP.panel); |
| 510 | ctx->mMDPComp->dump(aBuf); |
| 511 | char ovDump[2048] = {'\0'}; |
| 512 | ctx->mOverlay->getDump(ovDump, 2048); |
| 513 | dumpsys_log(aBuf, ovDump); |
| 514 | strlcpy(buff, aBuf.string(), buff_len); |
Naseer Ahmed | 1d183f5 | 2012-11-26 12:35:16 -0500 | [diff] [blame] | 515 | } |
| 516 | |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 517 | static int hwc_device_close(struct hw_device_t *dev) |
| 518 | { |
| 519 | if(!dev) { |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 520 | ALOGE("%s: NULL device pointer", __FUNCTION__); |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 521 | return -1; |
| 522 | } |
| 523 | closeContext((hwc_context_t*)dev); |
| 524 | free(dev); |
| 525 | |
| 526 | return 0; |
| 527 | } |
| 528 | |
| 529 | static int hwc_device_open(const struct hw_module_t* module, const char* name, |
| 530 | struct hw_device_t** device) |
| 531 | { |
| 532 | int status = -EINVAL; |
| 533 | |
| 534 | if (!strcmp(name, HWC_HARDWARE_COMPOSER)) { |
| 535 | struct hwc_context_t *dev; |
| 536 | dev = (hwc_context_t*)malloc(sizeof(*dev)); |
| 537 | memset(dev, 0, sizeof(*dev)); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 538 | |
| 539 | //Initialize hwc context |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 540 | initContext(dev); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 541 | |
| 542 | //Setup HWC methods |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 543 | dev->device.common.tag = HARDWARE_DEVICE_TAG; |
| 544 | dev->device.common.version = HWC_DEVICE_API_VERSION_1_1; |
| 545 | dev->device.common.module = const_cast<hw_module_t*>(module); |
| 546 | dev->device.common.close = hwc_device_close; |
| 547 | dev->device.prepare = hwc_prepare; |
| 548 | dev->device.set = hwc_set; |
| 549 | dev->device.eventControl = hwc_eventControl; |
| 550 | dev->device.blank = hwc_blank; |
| 551 | dev->device.query = hwc_query; |
| 552 | dev->device.registerProcs = hwc_registerProcs; |
Naseer Ahmed | 1d183f5 | 2012-11-26 12:35:16 -0500 | [diff] [blame] | 553 | dev->device.dump = hwc_dump; |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame] | 554 | dev->device.getDisplayConfigs = hwc_getDisplayConfigs; |
| 555 | dev->device.getDisplayAttributes = hwc_getDisplayAttributes; |
| 556 | *device = &dev->device.common; |
Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 557 | status = 0; |
| 558 | } |
| 559 | return status; |
| 560 | } |