| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 1 | /* | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 2 | * Copyright (c) 2011, The Linux Foundation. All rights reserved. | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 3 | * | 
 | 4 | * Redistribution and use in source and binary forms, with or without | 
 | 5 | * modification, are permitted provided that the following conditions are | 
 | 6 | * met: | 
 | 7 | *    * Redistributions of source code must retain the above copyright | 
 | 8 | *      notice, this list of conditions and the following disclaimer. | 
 | 9 | *    * Redistributions in binary form must reproduce the above | 
 | 10 | *      copyright notice, this list of conditions and the following | 
 | 11 | *      disclaimer in the documentation and/or other materials provided | 
 | 12 | *      with the distribution. | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 13 | *    * Neither the name of The Linux Foundation nor the names of its | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 14 | *      contributors may be used to endorse or promote products derived | 
 | 15 | *      from this software without specific prior written permission. | 
 | 16 | * | 
 | 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | 
 | 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 
 | 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT | 
 | 20 | * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | 
 | 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 
 | 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 
 | 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | 
 | 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 
 | 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | 
 | 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | 
 | 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
 | 28 | */ | 
 | 29 |  | 
 | 30 | #ifndef MDP_WRAPPER_H | 
 | 31 | #define MDP_WRAPPER_H | 
 | 32 |  | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 33 | #define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL) | 
 | 34 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 35 | /* | 
 | 36 | * In order to make overlay::mdp_wrapper shorter, please do something like: | 
 | 37 | * namespace mdpwrap = overlay::mdp_wrapper; | 
 | 38 | * */ | 
 | 39 |  | 
 | 40 | #include <linux/msm_mdp.h> | 
 | 41 | #include <linux/msm_rotator.h> | 
 | 42 | #include <sys/ioctl.h> | 
 | 43 | #include <utils/Log.h> | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 44 | #include <utils/Trace.h> | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 45 | #include <errno.h> | 
 | 46 | #include "overlayUtils.h" | 
 | 47 |  | 
| Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 48 | #define IOCTL_DEBUG 0 | 
 | 49 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 50 | namespace overlay{ | 
 | 51 |  | 
 | 52 | namespace mdp_wrapper{ | 
 | 53 | /* FBIOGET_FSCREENINFO */ | 
 | 54 | bool getFScreenInfo(int fd, fb_fix_screeninfo& finfo); | 
 | 55 |  | 
 | 56 | /* FBIOGET_VSCREENINFO */ | 
 | 57 | bool getVScreenInfo(int fd, fb_var_screeninfo& vinfo); | 
 | 58 |  | 
 | 59 | /* FBIOPUT_VSCREENINFO */ | 
 | 60 | bool setVScreenInfo(int fd, fb_var_screeninfo& vinfo); | 
 | 61 |  | 
 | 62 | /* MSM_ROTATOR_IOCTL_START */ | 
 | 63 | bool startRotator(int fd, msm_rotator_img_info& rot); | 
 | 64 |  | 
 | 65 | /* MSM_ROTATOR_IOCTL_ROTATE */ | 
 | 66 | bool rotate(int fd, msm_rotator_data_info& rot); | 
 | 67 |  | 
 | 68 | /* MSMFB_OVERLAY_SET */ | 
 | 69 | bool setOverlay(int fd, mdp_overlay& ov); | 
 | 70 |  | 
| Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 71 | /* MSMFB_OVERLAY_PREPARE */ | 
 | 72 | bool validateAndSet(const int& fd, mdp_overlay_list& list); | 
 | 73 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 74 | /* MSM_ROTATOR_IOCTL_FINISH */ | 
 | 75 | bool endRotator(int fd, int sessionId); | 
 | 76 |  | 
 | 77 | /* MSMFB_OVERLAY_UNSET */ | 
 | 78 | bool unsetOverlay(int fd, int ovId); | 
 | 79 |  | 
 | 80 | /* MSMFB_OVERLAY_GET */ | 
 | 81 | bool getOverlay(int fd, mdp_overlay& ov); | 
 | 82 |  | 
 | 83 | /* MSMFB_OVERLAY_PLAY */ | 
 | 84 | bool play(int fd, msmfb_overlay_data& od); | 
 | 85 |  | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 86 | /* MSMFB_DISPLAY_COMMIT */ | 
 | 87 | bool displayCommit(int fd); | 
 | 88 |  | 
 | 89 | /* MSMFB_WRITEBACK_INIT, MSMFB_WRITEBACK_START */ | 
 | 90 | bool wbInitStart(int fbfd); | 
 | 91 |  | 
 | 92 | /* MSMFB_WRITEBACK_STOP, MSMFB_WRITEBACK_TERMINATE */ | 
 | 93 | bool wbStopTerminate(int fbfd); | 
 | 94 |  | 
 | 95 | /* MSMFB_WRITEBACK_QUEUE_BUFFER */ | 
 | 96 | bool wbQueueBuffer(int fbfd, struct msmfb_data& fbData); | 
 | 97 |  | 
 | 98 | /* MSMFB_WRITEBACK_DEQUEUE_BUFFER */ | 
 | 99 | bool wbDequeueBuffer(int fbfd, struct msmfb_data& fbData); | 
 | 100 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 101 | /* the following are helper functions for dumping | 
 | 102 |  * msm_mdp and friends*/ | 
 | 103 | void dump(const char* const s, const msmfb_overlay_data& ov); | 
 | 104 | void dump(const char* const s, const msmfb_data& ov); | 
 | 105 | void dump(const char* const s, const mdp_overlay& ov); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 106 | void dump(const char* const s, const uint32_t u[], uint32_t cnt); | 
 | 107 | void dump(const char* const s, const msmfb_img& ov); | 
 | 108 | void dump(const char* const s, const mdp_rect& ov); | 
 | 109 |  | 
 | 110 | /* and rotator */ | 
 | 111 | void dump(const char* const s, const msm_rotator_img_info& rot); | 
 | 112 | void dump(const char* const s, const msm_rotator_data_info& rot); | 
 | 113 |  | 
 | 114 | /* info */ | 
 | 115 | void dump(const char* const s, const fb_fix_screeninfo& finfo); | 
 | 116 | void dump(const char* const s, const fb_var_screeninfo& vinfo); | 
 | 117 |  | 
 | 118 | //---------------Inlines ------------------------------------- | 
 | 119 |  | 
 | 120 | inline bool getFScreenInfo(int fd, fb_fix_screeninfo& finfo) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 121 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 122 |     if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) { | 
 | 123 |         ALOGE("Failed to call ioctl FBIOGET_FSCREENINFO err=%s", | 
 | 124 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 125 |         return false; | 
 | 126 |     } | 
 | 127 |     return true; | 
 | 128 | } | 
 | 129 |  | 
 | 130 | inline bool getVScreenInfo(int fd, fb_var_screeninfo& vinfo) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 131 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 132 |     if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) { | 
 | 133 |         ALOGE("Failed to call ioctl FBIOGET_VSCREENINFO err=%s", | 
 | 134 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 135 |         return false; | 
 | 136 |     } | 
 | 137 |     return true; | 
 | 138 | } | 
 | 139 |  | 
 | 140 | inline bool setVScreenInfo(int fd, fb_var_screeninfo& vinfo) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 141 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 142 |     if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) < 0) { | 
 | 143 |         ALOGE("Failed to call ioctl FBIOPUT_VSCREENINFO err=%s", | 
 | 144 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 145 |         return false; | 
 | 146 |     } | 
 | 147 |     return true; | 
 | 148 | } | 
 | 149 |  | 
 | 150 | inline bool startRotator(int fd, msm_rotator_img_info& rot) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 151 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 152 |     if (ioctl(fd, MSM_ROTATOR_IOCTL_START, &rot) < 0){ | 
 | 153 |         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_START err=%s", | 
 | 154 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 155 |         return false; | 
 | 156 |     } | 
 | 157 |     return true; | 
 | 158 | } | 
 | 159 |  | 
 | 160 | inline bool rotate(int fd, msm_rotator_data_info& rot) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 161 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 162 |     if (ioctl(fd, MSM_ROTATOR_IOCTL_ROTATE, &rot) < 0) { | 
 | 163 |         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_ROTATE err=%s", | 
 | 164 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 165 |         return false; | 
 | 166 |     } | 
 | 167 |     return true; | 
 | 168 | } | 
 | 169 |  | 
 | 170 | inline bool setOverlay(int fd, mdp_overlay& ov) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 171 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 172 |     if (ioctl(fd, MSMFB_OVERLAY_SET, &ov) < 0) { | 
 | 173 |         ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s", | 
 | 174 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 175 |         return false; | 
 | 176 |     } | 
 | 177 |     return true; | 
 | 178 | } | 
 | 179 |  | 
| Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 180 | inline bool validateAndSet(const int& fd, mdp_overlay_list& list) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 181 |     ATRACE_CALL(); | 
| Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 182 |     if (ioctl(fd, MSMFB_OVERLAY_PREPARE, &list) < 0) { | 
 | 183 |         ALOGD_IF(IOCTL_DEBUG, "Failed to call ioctl MSMFB_OVERLAY_PREPARE " | 
 | 184 |                 "err=%s", strerror(errno)); | 
 | 185 |         return false; | 
 | 186 |     } | 
 | 187 |     return true; | 
 | 188 | } | 
 | 189 |  | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 190 | inline bool endRotator(int fd, uint32_t sessionId) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 191 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 192 |     if (ioctl(fd, MSM_ROTATOR_IOCTL_FINISH, &sessionId) < 0) { | 
 | 193 |         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_FINISH err=%s", | 
 | 194 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 195 |         return false; | 
 | 196 |     } | 
 | 197 |     return true; | 
 | 198 | } | 
 | 199 |  | 
 | 200 | inline bool unsetOverlay(int fd, int ovId) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 201 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 202 |     if (ioctl(fd, MSMFB_OVERLAY_UNSET, &ovId) < 0) { | 
 | 203 |         ALOGE("Failed to call ioctl MSMFB_OVERLAY_UNSET err=%s", | 
 | 204 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 205 |         return false; | 
 | 206 |     } | 
 | 207 |     return true; | 
 | 208 | } | 
 | 209 |  | 
 | 210 | inline bool getOverlay(int fd, mdp_overlay& ov) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 211 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 212 |     if (ioctl(fd, MSMFB_OVERLAY_GET, &ov) < 0) { | 
 | 213 |         ALOGE("Failed to call ioctl MSMFB_OVERLAY_GET err=%s", | 
 | 214 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 215 |         return false; | 
 | 216 |     } | 
 | 217 |     return true; | 
 | 218 | } | 
 | 219 |  | 
 | 220 | inline bool play(int fd, msmfb_overlay_data& od) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 221 |     ATRACE_CALL(); | 
| Naseer Ahmed | f48aef6 | 2012-07-20 09:05:53 -0700 | [diff] [blame] | 222 |     if (ioctl(fd, MSMFB_OVERLAY_PLAY, &od) < 0) { | 
 | 223 |         ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s", | 
 | 224 |                 strerror(errno)); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 225 |         return false; | 
 | 226 |     } | 
 | 227 |     return true; | 
 | 228 | } | 
 | 229 |  | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 230 | inline bool displayCommit(int fd, mdp_display_commit& info) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 231 |     ATRACE_CALL(); | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 232 |     if(ioctl(fd, MSMFB_DISPLAY_COMMIT, &info) == -1) { | 
 | 233 |         ALOGE("Failed to call ioctl MSMFB_DISPLAY_COMMIT err=%s", | 
 | 234 |                 strerror(errno)); | 
 | 235 |         return false; | 
 | 236 |     } | 
 | 237 |     return true; | 
 | 238 | } | 
 | 239 |  | 
 | 240 | inline bool wbInitStart(int fbfd) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 241 |     ATRACE_CALL(); | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 242 |     if(ioctl(fbfd, MSMFB_WRITEBACK_INIT, NULL) < 0) { | 
 | 243 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_INIT err=%s", | 
 | 244 |                 strerror(errno)); | 
 | 245 |         return false; | 
 | 246 |     } | 
 | 247 |     if(ioctl(fbfd, MSMFB_WRITEBACK_START, NULL) < 0) { | 
 | 248 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_START err=%s", | 
 | 249 |                 strerror(errno)); | 
 | 250 |         return false; | 
 | 251 |     } | 
 | 252 |     return true; | 
 | 253 | } | 
 | 254 |  | 
 | 255 | inline bool wbStopTerminate(int fbfd) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 256 |     ATRACE_CALL(); | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 257 |     if(ioctl(fbfd, MSMFB_WRITEBACK_STOP, NULL) < 0) { | 
 | 258 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_STOP err=%s", | 
 | 259 |                 strerror(errno)); | 
 | 260 |         return false; | 
 | 261 |     } | 
 | 262 |     if(ioctl(fbfd, MSMFB_WRITEBACK_TERMINATE, NULL) < 0) { | 
 | 263 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_TERMINATE err=%s", | 
 | 264 |                 strerror(errno)); | 
 | 265 |         return false; | 
 | 266 |     } | 
 | 267 |     return true; | 
 | 268 | } | 
 | 269 |  | 
 | 270 | inline bool wbQueueBuffer(int fbfd, struct msmfb_data& fbData) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 271 |     ATRACE_CALL(); | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 272 |     if(ioctl(fbfd, MSMFB_WRITEBACK_QUEUE_BUFFER, &fbData) < 0) { | 
 | 273 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_QUEUE_BUFFER err=%s", | 
 | 274 |                 strerror(errno)); | 
 | 275 |         return false; | 
 | 276 |     } | 
 | 277 |     return true; | 
 | 278 | } | 
 | 279 |  | 
 | 280 | inline bool wbDequeueBuffer(int fbfd, struct msmfb_data& fbData) { | 
| Naseer Ahmed | abd7688 | 2014-06-30 11:10:14 -0400 | [diff] [blame] | 281 |     ATRACE_CALL(); | 
| Saurabh Shah | c8118ac | 2013-06-27 10:03:19 -0700 | [diff] [blame] | 282 |     if(ioctl(fbfd, MSMFB_WRITEBACK_DEQUEUE_BUFFER, &fbData) < 0) { | 
 | 283 |         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_DEQUEUE_BUFFER err=%s", | 
 | 284 |                 strerror(errno)); | 
 | 285 |         return false; | 
 | 286 |     } | 
 | 287 |     return true; | 
 | 288 | } | 
 | 289 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 290 | /* dump funcs */ | 
 | 291 | inline void dump(const char* const s, const msmfb_overlay_data& ov) { | 
 | 292 |     ALOGE("%s msmfb_overlay_data id=%d", | 
 | 293 |             s, ov.id); | 
 | 294 |     dump("data", ov.data); | 
 | 295 | } | 
 | 296 | inline void dump(const char* const s, const msmfb_data& ov) { | 
 | 297 |     ALOGE("%s msmfb_data offset=%d memid=%d id=%d flags=0x%x priv=%d", | 
 | 298 |             s, ov.offset, ov.memory_id, ov.id, ov.flags, ov.priv); | 
 | 299 | } | 
 | 300 | inline void dump(const char* const s, const mdp_overlay& ov) { | 
| Saurabh Shah | 2c8ad05 | 2014-08-15 13:27:46 -0700 | [diff] [blame] | 301 |     ALOGE("%s mdp_overlay z=%d alpha=%d mask=%d flags=0x%x id=%d", | 
 | 302 |             s, ov.z_order, ov.alpha, | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 303 |             ov.transp_mask, ov.flags, ov.id); | 
 | 304 |     dump("src", ov.src); | 
 | 305 |     dump("src_rect", ov.src_rect); | 
 | 306 |     dump("dst_rect", ov.dst_rect); | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 307 |     /* | 
 | 308 |     Commented off to prevent verbose logging, since user_data could have 8 or so | 
 | 309 |     fields which are mostly 0 | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 310 |     dump("user_data", ov.user_data, | 
 | 311 |             sizeof(ov.user_data)/sizeof(ov.user_data[0])); | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 312 |     */ | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 313 | } | 
 | 314 | inline void dump(const char* const s, const msmfb_img& ov) { | 
 | 315 |     ALOGE("%s msmfb_img w=%d h=%d format=%d %s", | 
 | 316 |             s, ov.width, ov.height, ov.format, | 
 | 317 |             overlay::utils::getFormatString(ov.format)); | 
 | 318 | } | 
 | 319 | inline void dump(const char* const s, const mdp_rect& ov) { | 
 | 320 |     ALOGE("%s mdp_rect x=%d y=%d w=%d h=%d", | 
 | 321 |             s, ov.x, ov.y, ov.w, ov.h); | 
 | 322 | } | 
 | 323 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 324 | inline void dump(const char* const s, const uint32_t u[], uint32_t cnt) { | 
 | 325 |     ALOGE("%s user_data cnt=%d", s, cnt); | 
 | 326 |     for(uint32_t i=0; i < cnt; ++i) { | 
 | 327 |         ALOGE("i=%d val=%d", i, u[i]); | 
 | 328 |     } | 
 | 329 | } | 
 | 330 | inline void dump(const char* const s, const msm_rotator_img_info& rot) { | 
| Ramkumar Radhakrishnan | 288f8c7 | 2013-01-15 11:37:54 -0800 | [diff] [blame] | 331 |     ALOGE("%s msm_rotator_img_info sessid=%u dstx=%d dsty=%d rot=%d, ena=%d scale=%d", | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 332 |             s, rot.session_id, rot.dst_x, rot.dst_y, | 
| Ramkumar Radhakrishnan | 288f8c7 | 2013-01-15 11:37:54 -0800 | [diff] [blame] | 333 |             rot.rotations, rot.enable, rot.downscale_ratio); | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 334 |     dump("src", rot.src); | 
 | 335 |     dump("dst", rot.dst); | 
 | 336 |     dump("src_rect", rot.src_rect); | 
 | 337 | } | 
 | 338 | inline void dump(const char* const s, const msm_rotator_data_info& rot) { | 
| Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 339 |     ALOGE("%s msm_rotator_data_info sessid=%u verkey=%d", | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 340 |             s, rot.session_id, rot.version_key); | 
 | 341 |     dump("src", rot.src); | 
 | 342 |     dump("dst", rot.dst); | 
 | 343 |     dump("src_chroma", rot.src_chroma); | 
 | 344 |     dump("dst_chroma", rot.dst_chroma); | 
 | 345 | } | 
 | 346 | inline void dump(const char* const s, const fb_fix_screeninfo& finfo) { | 
 | 347 |     ALOGE("%s fb_fix_screeninfo type=%d", s, finfo.type); | 
 | 348 | } | 
 | 349 | inline void dump(const char* const s, const fb_var_screeninfo& vinfo) { | 
 | 350 |     ALOGE("%s fb_var_screeninfo xres=%d yres=%d", | 
 | 351 |             s, vinfo.xres, vinfo.yres); | 
 | 352 | } | 
 | 353 |  | 
| Naseer Ahmed | 29a2681 | 2012-06-14 00:56:20 -0700 | [diff] [blame] | 354 | } // mdp_wrapper | 
 | 355 |  | 
 | 356 | } // overlay | 
 | 357 |  | 
 | 358 | #endif // MDP_WRAPPER_H |