Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 1 | /* |
Tharaga Balachandran | 4e07cfc | 2020-01-20 13:48:40 -0500 | [diff] [blame^] | 2 | * Copyright (c) 2013-2014, 2016, 2018-2020, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [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. |
| 13 | * * Neither the name of The Linux Foundation. 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 | |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 30 | #include <fcntl.h> |
| 31 | #include <stdio.h> |
| 32 | #include <sys/types.h> |
| 33 | #include <sys/stat.h> |
| 34 | #include <unistd.h> |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 35 | #include <display_config.h> |
| 36 | #include <QServiceUtils.h> |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 37 | #include <qd_utils.h> |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 38 | |
| 39 | using namespace android; |
| 40 | using namespace qService; |
| 41 | |
| 42 | namespace qdutils { |
| 43 | |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 44 | //============================================================================= |
| 45 | // The functions below run in the client process and wherever necessary |
| 46 | // do a binder call to HWC to get/set data. |
| 47 | |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 48 | int isExternalConnected(void) { |
| 49 | int ret; |
Arun Kumar K.R | f15adc0 | 2014-01-21 21:26:25 -0800 | [diff] [blame] | 50 | status_t err = (status_t) FAILED_TRANSACTION; |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 51 | sp<IQService> binder = getBinder(); |
| 52 | Parcel inParcel, outParcel; |
| 53 | if(binder != NULL) { |
| 54 | err = binder->dispatch(IQService::CHECK_EXTERNAL_STATUS, |
| 55 | &inParcel , &outParcel); |
| 56 | } |
| 57 | if(err) { |
| 58 | ALOGE("%s: Failed to get external status err=%d", __FUNCTION__, err); |
| 59 | ret = err; |
| 60 | } else { |
| 61 | ret = outParcel.readInt32(); |
| 62 | } |
| 63 | return ret; |
| 64 | } |
| 65 | |
| 66 | int getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr) { |
Arun Kumar K.R | f15adc0 | 2014-01-21 21:26:25 -0800 | [diff] [blame] | 67 | status_t err = (status_t) FAILED_TRANSACTION; |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 68 | sp<IQService> binder = getBinder(); |
| 69 | Parcel inParcel, outParcel; |
| 70 | inParcel.writeInt32(dpy); |
| 71 | if(binder != NULL) { |
| 72 | err = binder->dispatch(IQService::GET_DISPLAY_ATTRIBUTES, |
| 73 | &inParcel, &outParcel); |
| 74 | } |
| 75 | if(!err) { |
| 76 | dpyattr.vsync_period = outParcel.readInt32(); |
| 77 | dpyattr.xres = outParcel.readInt32(); |
| 78 | dpyattr.yres = outParcel.readInt32(); |
| 79 | dpyattr.xdpi = outParcel.readFloat(); |
| 80 | dpyattr.ydpi = outParcel.readFloat(); |
Ramkumar Radhakrishnan | 9d68cdf | 2016-06-02 19:14:57 -0700 | [diff] [blame] | 81 | dpyattr.panel_type = outParcel.readInt32(); |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 82 | } else { |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 83 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 84 | } |
| 85 | return err; |
| 86 | } |
| 87 | |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 88 | int getDisplayVisibleRegion(int dpy, hwc_rect_t &rect) { |
Arun Kumar K.R | f15adc0 | 2014-01-21 21:26:25 -0800 | [diff] [blame] | 89 | status_t err = (status_t) FAILED_TRANSACTION; |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 90 | sp<IQService> binder = getBinder(); |
| 91 | Parcel inParcel, outParcel; |
| 92 | inParcel.writeInt32(dpy); |
| 93 | if(binder != NULL) { |
| 94 | err = binder->dispatch(IQService::GET_DISPLAY_VISIBLE_REGION, |
| 95 | &inParcel, &outParcel); |
| 96 | } |
| 97 | if(!err) { |
| 98 | rect.left = outParcel.readInt32(); |
| 99 | rect.top = outParcel.readInt32(); |
| 100 | rect.right = outParcel.readInt32(); |
| 101 | rect.bottom = outParcel.readInt32(); |
| 102 | } else { |
| 103 | ALOGE("%s: Failed to getVisibleRegion for dpy =%d: err = %d", |
| 104 | __FUNCTION__, dpy, err); |
| 105 | } |
| 106 | return err; |
| 107 | } |
| 108 | |
Ramkumar Radhakrishnan | 0a021a8 | 2014-05-19 19:53:56 -0700 | [diff] [blame] | 109 | int setViewFrame(int dpy, int l, int t, int r, int b) { |
| 110 | status_t err = (status_t) FAILED_TRANSACTION; |
| 111 | sp<IQService> binder = getBinder(); |
| 112 | Parcel inParcel, outParcel; |
| 113 | inParcel.writeInt32(dpy); |
| 114 | inParcel.writeInt32(l); |
| 115 | inParcel.writeInt32(t); |
| 116 | inParcel.writeInt32(r); |
| 117 | inParcel.writeInt32(b); |
| 118 | |
| 119 | if(binder != NULL) { |
| 120 | err = binder->dispatch(IQService::SET_VIEW_FRAME, |
| 121 | &inParcel, &outParcel); |
| 122 | } |
| 123 | if(err) |
| 124 | ALOGE("%s: Failed to set view frame for dpy %d err=%d", |
| 125 | __FUNCTION__, dpy, err); |
| 126 | |
| 127 | return err; |
| 128 | } |
| 129 | |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 130 | int setSecondaryDisplayStatus(int dpy, uint32_t status) { |
| 131 | status_t err = (status_t) FAILED_TRANSACTION; |
| 132 | sp<IQService> binder = getBinder(); |
| 133 | Parcel inParcel, outParcel; |
| 134 | inParcel.writeInt32(dpy); |
| 135 | inParcel.writeInt32(status); |
| 136 | |
| 137 | if(binder != NULL) { |
| 138 | err = binder->dispatch(IQService::SET_SECONDARY_DISPLAY_STATUS, |
| 139 | &inParcel, &outParcel); |
| 140 | } |
| 141 | if(err) |
| 142 | ALOGE("%s: Failed for dpy %d status = %d err=%d", __FUNCTION__, dpy, |
| 143 | status, err); |
| 144 | |
| 145 | return err; |
| 146 | } |
| 147 | |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 148 | int configureDynRefreshRate(uint32_t op, uint32_t refreshRate) { |
| 149 | status_t err = (status_t) FAILED_TRANSACTION; |
| 150 | sp<IQService> binder = getBinder(); |
| 151 | Parcel inParcel, outParcel; |
| 152 | inParcel.writeInt32(op); |
| 153 | inParcel.writeInt32(refreshRate); |
| 154 | |
| 155 | if(binder != NULL) { |
| 156 | err = binder->dispatch(IQService::CONFIGURE_DYN_REFRESH_RATE, |
| 157 | &inParcel, &outParcel); |
| 158 | } |
| 159 | |
| 160 | if(err) |
| 161 | ALOGE("%s: Failed setting op %d err=%d", __FUNCTION__, op, err); |
| 162 | |
| 163 | return err; |
| 164 | } |
| 165 | |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 166 | int getConfigCount(int /*dpy*/) { |
| 167 | int numConfigs = -1; |
| 168 | sp<IQService> binder = getBinder(); |
| 169 | if(binder != NULL) { |
| 170 | Parcel inParcel, outParcel; |
| 171 | inParcel.writeInt32(DISPLAY_PRIMARY); |
| 172 | status_t err = binder->dispatch(IQService::GET_CONFIG_COUNT, |
| 173 | &inParcel, &outParcel); |
| 174 | if(!err) { |
| 175 | numConfigs = outParcel.readInt32(); |
| 176 | ALOGI("%s() Received num configs %d", __FUNCTION__, numConfigs); |
| 177 | } else { |
| 178 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 179 | } |
| 180 | } |
| 181 | return numConfigs; |
| 182 | } |
| 183 | |
Namit Solanki | 03d5679 | 2016-11-02 15:53:43 +0530 | [diff] [blame] | 184 | int getActiveConfig(int dpy) { |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 185 | int configIndex = -1; |
| 186 | sp<IQService> binder = getBinder(); |
| 187 | if(binder != NULL) { |
| 188 | Parcel inParcel, outParcel; |
Namit Solanki | 03d5679 | 2016-11-02 15:53:43 +0530 | [diff] [blame] | 189 | inParcel.writeInt32(dpy); |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 190 | status_t err = binder->dispatch(IQService::GET_ACTIVE_CONFIG, |
| 191 | &inParcel, &outParcel); |
| 192 | if(!err) { |
| 193 | configIndex = outParcel.readInt32(); |
| 194 | ALOGI("%s() Received active config index %d", __FUNCTION__, |
| 195 | configIndex); |
| 196 | } else { |
| 197 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 198 | } |
| 199 | } |
| 200 | return configIndex; |
| 201 | } |
| 202 | |
| 203 | int setActiveConfig(int configIndex, int /*dpy*/) { |
| 204 | status_t err = (status_t) FAILED_TRANSACTION; |
| 205 | sp<IQService> binder = getBinder(); |
| 206 | if(binder != NULL) { |
| 207 | Parcel inParcel, outParcel; |
| 208 | inParcel.writeInt32(configIndex); |
| 209 | inParcel.writeInt32(DISPLAY_PRIMARY); |
| 210 | err = binder->dispatch(IQService::SET_ACTIVE_CONFIG, |
| 211 | &inParcel, &outParcel); |
| 212 | if(!err) { |
| 213 | ALOGI("%s() Successfully set active config index %d", __FUNCTION__, |
| 214 | configIndex); |
| 215 | } else { |
| 216 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 217 | } |
| 218 | } |
| 219 | return err; |
| 220 | } |
| 221 | |
Namit Solanki | 03d5679 | 2016-11-02 15:53:43 +0530 | [diff] [blame] | 222 | DisplayAttributes getDisplayAttributes(int configIndex, int dpy) { |
Ramkumar Radhakrishnan | 9d68cdf | 2016-06-02 19:14:57 -0700 | [diff] [blame] | 223 | DisplayAttributes dpyattr = {}; |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 224 | sp<IQService> binder = getBinder(); |
| 225 | if(binder != NULL) { |
| 226 | Parcel inParcel, outParcel; |
| 227 | inParcel.writeInt32(configIndex); |
Namit Solanki | 03d5679 | 2016-11-02 15:53:43 +0530 | [diff] [blame] | 228 | inParcel.writeInt32(dpy); |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 229 | status_t err = binder->dispatch( |
| 230 | IQService::GET_DISPLAY_ATTRIBUTES_FOR_CONFIG, &inParcel, |
| 231 | &outParcel); |
| 232 | if(!err) { |
| 233 | dpyattr.vsync_period = outParcel.readInt32(); |
| 234 | dpyattr.xres = outParcel.readInt32(); |
| 235 | dpyattr.yres = outParcel.readInt32(); |
| 236 | dpyattr.xdpi = outParcel.readFloat(); |
| 237 | dpyattr.ydpi = outParcel.readFloat(); |
Ramkumar Radhakrishnan | 9d68cdf | 2016-06-02 19:14:57 -0700 | [diff] [blame] | 238 | dpyattr.panel_type = outParcel.readInt32(); |
Tatenda Chipeperekwa | 6f9612b | 2016-04-18 16:22:05 -0700 | [diff] [blame] | 239 | dpyattr.is_yuv = outParcel.readInt32(); |
Saurabh Shah | 90c55cf | 2015-02-10 15:37:39 -0800 | [diff] [blame] | 240 | ALOGI("%s() Received attrs for index %d: xres %d, yres %d", |
| 241 | __FUNCTION__, configIndex, dpyattr.xres, dpyattr.yres); |
| 242 | } else { |
| 243 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 244 | } |
| 245 | } |
| 246 | return dpyattr; |
| 247 | } |
| 248 | |
Tatenda Chipeperekwa | 4207288 | 2015-03-24 11:50:27 -0700 | [diff] [blame] | 249 | int setPanelMode(int mode) { |
| 250 | status_t err = (status_t) FAILED_TRANSACTION; |
| 251 | sp<IQService> binder = getBinder(); |
| 252 | if(binder != NULL) { |
| 253 | Parcel inParcel, outParcel; |
| 254 | inParcel.writeInt32(mode); |
| 255 | err = binder->dispatch(IQService::SET_DISPLAY_MODE, |
| 256 | &inParcel, &outParcel); |
| 257 | if(!err) { |
| 258 | ALOGI("%s() Successfully set the display mode to %d", __FUNCTION__, |
| 259 | mode); |
| 260 | } else { |
| 261 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 262 | } |
| 263 | } |
| 264 | return err; |
| 265 | } |
| 266 | |
Tatenda Chipeperekwa | f51c599 | 2015-08-24 15:10:56 -0700 | [diff] [blame] | 267 | int setPanelBrightness(int level) { |
| 268 | status_t err = (status_t) FAILED_TRANSACTION; |
| 269 | sp<IQService> binder = getBinder(); |
| 270 | Parcel inParcel, outParcel; |
| 271 | |
| 272 | if(binder != NULL) { |
| 273 | inParcel.writeInt32(level); |
| 274 | status_t err = binder->dispatch(IQService::SET_PANEL_BRIGHTNESS, |
| 275 | &inParcel, &outParcel); |
| 276 | if(err) { |
| 277 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 278 | } |
| 279 | } |
| 280 | return err; |
| 281 | } |
| 282 | |
| 283 | int getPanelBrightness() { |
| 284 | int panel_brightness = -1; |
| 285 | sp<IQService> binder = getBinder(); |
| 286 | Parcel inParcel, outParcel; |
| 287 | |
| 288 | if(binder != NULL) { |
| 289 | status_t err = binder->dispatch(IQService::GET_PANEL_BRIGHTNESS, |
| 290 | &inParcel, &outParcel); |
| 291 | if(!err) { |
| 292 | panel_brightness = outParcel.readInt32(); |
| 293 | ALOGI("%s() Current panel brightness value %d", __FUNCTION__, |
| 294 | panel_brightness); |
| 295 | } else { |
| 296 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 297 | } |
| 298 | } |
| 299 | return panel_brightness; |
| 300 | } |
| 301 | |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 302 | int setDsiClk(int dpy, uint64_t bitClk) { |
| 303 | status_t err = (status_t) FAILED_TRANSACTION; |
| 304 | sp<IQService> binder = getBinder(); |
| 305 | Parcel inParcel, outParcel; |
| 306 | |
| 307 | if(binder != NULL) { |
| 308 | inParcel.writeInt32(dpy); |
| 309 | inParcel.writeUint64(bitClk); |
| 310 | status_t err = binder->dispatch(IQService::SET_DSI_CLK, &inParcel, &outParcel); |
| 311 | if(err) { |
| 312 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 313 | } |
| 314 | } |
| 315 | return err; |
| 316 | } |
| 317 | |
| 318 | uint64_t getDsiClk(int dpy) { |
| 319 | uint64_t dsi_clk = 0; |
| 320 | sp<IQService> binder = getBinder(); |
| 321 | Parcel inParcel, outParcel; |
| 322 | |
| 323 | if(binder != NULL) { |
| 324 | inParcel.writeInt32(dpy); |
| 325 | status_t err = binder->dispatch(IQService::GET_DSI_CLK, &inParcel, &outParcel); |
| 326 | if(!err) { |
| 327 | dsi_clk = outParcel.readUint64(); |
| 328 | } else { |
| 329 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 330 | } |
| 331 | } |
| 332 | return dsi_clk; |
| 333 | } |
| 334 | |
| 335 | int getSupportedBitClk(int dpy, std::vector<uint64_t>& bit_rates) { |
| 336 | sp<IQService> binder = getBinder(); |
| 337 | Parcel inParcel, outParcel; |
| 338 | |
| 339 | if(binder != NULL) { |
| 340 | inParcel.writeInt32(dpy); |
| 341 | status_t err = binder->dispatch(IQService::GET_SUPPORTED_DSI_CLK, &inParcel, &outParcel); |
| 342 | if(err) { |
| 343 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 344 | return err; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | int32_t clk_levels = outParcel.readInt32(); |
| 349 | while (clk_levels > 0) { |
| 350 | bit_rates.push_back(outParcel.readUint64()); |
| 351 | clk_levels--; |
| 352 | } |
| 353 | return 0; |
| 354 | } |
| 355 | |
Archit Srivastava | 3404224 | 2019-05-20 10:54:22 +0530 | [diff] [blame] | 356 | int setPanelLuminanceAttributes(int dpy, float min_lum, float max_lum) { |
| 357 | status_t err = (status_t) FAILED_TRANSACTION; |
| 358 | sp<IQService> binder = getBinder(); |
| 359 | Parcel inParcel, outParcel; |
| 360 | |
| 361 | if(binder != NULL) { |
| 362 | inParcel.writeInt32(dpy); |
| 363 | inParcel.writeFloat(min_lum); |
| 364 | inParcel.writeFloat(max_lum); |
| 365 | status_t err = binder->dispatch(IQService::SET_PANEL_LUMINANCE, &inParcel, &outParcel); |
| 366 | if(err) { |
| 367 | ALOGE("%s() failed with err %d", __FUNCTION__, err); |
| 368 | } |
| 369 | } |
| 370 | return err; |
| 371 | } |
| 372 | |
Arun Kumar K.R | a7335a2 | 2015-07-02 11:13:00 -0700 | [diff] [blame] | 373 | }// namespace |
| 374 | |
Manoj Kumar AVM | 7337d1e | 2015-06-26 11:31:41 -0700 | [diff] [blame] | 375 | // ---------------------------------------------------------------------------- |
Dileep Marchya | 87ec8c3 | 2015-10-01 23:39:23 -0700 | [diff] [blame] | 376 | // Functions for linking dynamically to libqdutils |
Manoj Kumar AVM | 7337d1e | 2015-06-26 11:31:41 -0700 | [diff] [blame] | 377 | // ---------------------------------------------------------------------------- |
Dileep Marchya | a5b764f | 2015-10-12 13:06:51 -0700 | [diff] [blame] | 378 | extern "C" int minHdcpEncryptionLevelChanged(int dpy, int min_enc_level) { |
Dileep Marchya | 87ec8c3 | 2015-10-01 23:39:23 -0700 | [diff] [blame] | 379 | status_t err = (status_t) FAILED_TRANSACTION; |
| 380 | sp<IQService> binder = getBinder(); |
| 381 | Parcel inParcel, outParcel; |
| 382 | inParcel.writeInt32(dpy); |
Dileep Marchya | a5b764f | 2015-10-12 13:06:51 -0700 | [diff] [blame] | 383 | inParcel.writeInt32(min_enc_level); |
Dileep Marchya | 87ec8c3 | 2015-10-01 23:39:23 -0700 | [diff] [blame] | 384 | |
| 385 | if(binder != NULL) { |
| 386 | err = binder->dispatch(IQService::MIN_HDCP_ENCRYPTION_LEVEL_CHANGED, |
| 387 | &inParcel, &outParcel); |
| 388 | } |
| 389 | |
| 390 | if(err) { |
| 391 | ALOGE("%s: Failed for dpy %d err=%d", __FUNCTION__, dpy, err); |
| 392 | } else { |
| 393 | err = outParcel.readInt32(); |
| 394 | } |
| 395 | |
| 396 | return err; |
| 397 | } |
| 398 | |
Dileep Marchya | 35e2753 | 2018-06-29 10:50:16 +0530 | [diff] [blame] | 399 | extern "C" int refreshScreen(int dpy) { |
Manoj Kumar AVM | 2d019a4 | 2015-06-22 18:02:46 -0700 | [diff] [blame] | 400 | int ret = 0; |
Dileep Marchya | 35e2753 | 2018-06-29 10:50:16 +0530 | [diff] [blame] | 401 | ret = screenRefresh(dpy); |
Manoj Kumar AVM | 2d019a4 | 2015-06-22 18:02:46 -0700 | [diff] [blame] | 402 | return ret; |
Manoj Kumar AVM | 7337d1e | 2015-06-26 11:31:41 -0700 | [diff] [blame] | 403 | } |
Manoj Kumar AVM | 2d019a4 | 2015-06-22 18:02:46 -0700 | [diff] [blame] | 404 | |
| 405 | extern "C" int controlPartialUpdate(int dpy, int mode) { |
| 406 | status_t err = (status_t) FAILED_TRANSACTION; |
| 407 | sp<IQService> binder = getBinder(); |
| 408 | if(binder != NULL) { |
| 409 | Parcel inParcel, outParcel; |
| 410 | inParcel.writeInt32(dpy); |
| 411 | inParcel.writeInt32(mode); |
| 412 | err = binder->dispatch(IQService::CONTROL_PARTIAL_UPDATE, &inParcel, &outParcel); |
| 413 | if(err != 0) { |
Prabhanjan Kandula | 1afec3d | 2016-11-09 18:39:41 -0800 | [diff] [blame] | 414 | ALOGE_IF(getBinder(), "%s() failed with err %d", __FUNCTION__, err); |
Manoj Kumar AVM | 2d019a4 | 2015-06-22 18:02:46 -0700 | [diff] [blame] | 415 | } else { |
| 416 | return outParcel.readInt32(); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | return err; |
| 421 | } |
| 422 | |
Prabhanjan Kandula | 63a613f | 2017-09-14 19:29:46 -0700 | [diff] [blame] | 423 | // returns 0 if composer is up |
| 424 | extern "C" int waitForComposerInit() { |
| 425 | int status = false; |
| 426 | sp<IQService> binder = getBinder(); |
| 427 | if (binder == NULL) { |
| 428 | sleep(2); |
| 429 | binder = getBinder(); |
| 430 | } |
| 431 | |
| 432 | if (binder != NULL) { |
| 433 | Parcel inParcel, outParcel; |
| 434 | binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel); |
| 435 | status = !!outParcel.readInt32(); |
| 436 | if (!status) { |
| 437 | sleep(2); |
| 438 | binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel); |
| 439 | status = !!outParcel.readInt32(); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | return !status; |
| 444 | } |