blob: 828f4fc480ed22522fcb5cb7434169767cb771d8 [file] [log] [blame]
Naseer Ahmed29a26812012-06-14 00:56:20 -07001/*
2* Copyright (C) 2008 The Android Open Source Project
Arun Kumar K.R7e5a1f82014-01-22 10:36:16 -08003* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
Naseer Ahmed29a26812012-06-14 00:56:20 -07004*
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
Saurabh Shahbd2d0832013-04-04 14:33:08 -070018#include <math.h>
Raj kamal23f69b22012-11-17 00:20:55 +053019#include <mdp_version.h>
Naseer Ahmed29a26812012-06-14 00:56:20 -070020#include "overlayUtils.h"
21#include "overlayMdp.h"
Saurabh Shah5daeee52013-01-23 16:52:26 +080022#include "mdp_version.h"
Saurabh Shahb8f58e22013-09-26 16:20:07 -070023#include <overlay.h>
Praveena Pachipulusu734118a2014-12-04 14:53:12 +053024#include <dlfcn.h>
Saurabh Shahb8f58e22013-09-26 16:20:07 -070025
Saurabh Shah5daeee52013-01-23 16:52:26 +080026#define HSIC_SETTINGS_DEBUG 0
27
Saurabh Shahbd2d0832013-04-04 14:33:08 -070028using namespace qdutils;
29
Saurabh Shah5daeee52013-01-23 16:52:26 +080030static inline bool isEqual(float f1, float f2) {
31 return ((int)(f1*100) == (int)(f2*100)) ? true : false;
32}
Naseer Ahmed29a26812012-06-14 00:56:20 -070033
Naseer Ahmed29a26812012-06-14 00:56:20 -070034namespace ovutils = overlay::utils;
35namespace overlay {
Saurabh Shahb121e142012-08-20 17:59:13 -070036
Saurabh Shahd18d88a2014-01-06 15:02:49 -080037bool MdpCtrl::init(const int& dpy) {
Saurabh Shahb8f58e22013-09-26 16:20:07 -070038 int fbnum = Overlay::getFbForDpy(dpy);
39 if( fbnum < 0 ) {
40 ALOGE("%s: Invalid FB for the display: %d",__FUNCTION__, dpy);
41 return false;
42 }
43
Naseer Ahmedf48aef62012-07-20 09:05:53 -070044 // FD init
Naseer Ahmed29a26812012-06-14 00:56:20 -070045 if(!utils::openDev(mFd, fbnum,
Naseer Ahmedf48aef62012-07-20 09:05:53 -070046 Res::fbPath, O_RDWR)){
47 ALOGE("Ctrl failed to init fbnum=%d", fbnum);
Naseer Ahmed29a26812012-06-14 00:56:20 -070048 return false;
49 }
Saurabh Shahb8f58e22013-09-26 16:20:07 -070050 mDpy = dpy;
Naseer Ahmed29a26812012-06-14 00:56:20 -070051 return true;
52}
53
54void MdpCtrl::reset() {
55 utils::memset0(mOVInfo);
Naseer Ahmedf48aef62012-07-20 09:05:53 -070056 mOVInfo.id = MSMFB_NEW_REQUEST;
Naseer Ahmedf48aef62012-07-20 09:05:53 -070057 mOrientation = utils::OVERLAY_TRANSFORM_0;
Saurabh Shahb8f58e22013-09-26 16:20:07 -070058 mDpy = 0;
Saurabh Shah5daeee52013-01-23 16:52:26 +080059#ifdef USES_POST_PROCESSING
Saurabh Shah5daeee52013-01-23 16:52:26 +080060 memset(&mParams, 0, sizeof(struct compute_params));
61 mParams.params.conv_params.order = hsic_order_hsc_i;
62 mParams.params.conv_params.interface = interface_rec601;
63 mParams.params.conv_params.cc_matrix[0][0] = 1;
64 mParams.params.conv_params.cc_matrix[1][1] = 1;
65 mParams.params.conv_params.cc_matrix[2][2] = 1;
66#endif
Naseer Ahmed29a26812012-06-14 00:56:20 -070067}
68
69bool MdpCtrl::close() {
Saurabh Shah8e1ae952012-08-15 12:15:14 -070070 bool result = true;
Saurabh Shah8e1ae952012-08-15 12:15:14 -070071 if(MSMFB_NEW_REQUEST != static_cast<int>(mOVInfo.id)) {
72 if(!mdp_wrapper::unsetOverlay(mFd.getFD(), mOVInfo.id)) {
73 ALOGE("MdpCtrl close error in unset");
74 result = false;
75 }
Naseer Ahmed29a26812012-06-14 00:56:20 -070076 }
Saurabh Shah5daeee52013-01-23 16:52:26 +080077#ifdef USES_POST_PROCESSING
78 /* free allocated memory in PP */
79 if (mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data)
80 free(mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data);
81#endif
Naseer Ahmed29a26812012-06-14 00:56:20 -070082 reset();
Saurabh Shahacf10202013-02-26 10:15:15 -080083
Naseer Ahmed29a26812012-06-14 00:56:20 -070084 if(!mFd.close()) {
Saurabh Shah8e1ae952012-08-15 12:15:14 -070085 result = false;
Naseer Ahmed29a26812012-06-14 00:56:20 -070086 }
Saurabh Shah8e1ae952012-08-15 12:15:14 -070087
88 return result;
Naseer Ahmed29a26812012-06-14 00:56:20 -070089}
90
Saurabh Shahacf10202013-02-26 10:15:15 -080091void MdpCtrl::setSource(const utils::PipeArgs& args) {
Naseer Ahmedf48aef62012-07-20 09:05:53 -070092 setSrcWhf(args.whf);
93
94 //TODO These are hardcoded. Can be moved out of setSource.
Naseer Ahmedf48aef62012-07-20 09:05:53 -070095 mOVInfo.transp_mask = 0xffffffff;
96
97 //TODO These calls should ideally be a part of setPipeParams API
98 setFlags(args.mdpFlags);
99 setZ(args.zorder);
Naseer Ahmed522ce662013-03-18 20:14:05 -0400100 setPlaneAlpha(args.planeAlpha);
101 setBlending(args.blending);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700102}
103
Saurabh Shahacf10202013-02-26 10:15:15 -0800104void MdpCtrl::setCrop(const utils::Dim& d) {
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700105 setSrcRectDim(d);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700106}
107
Sushil Chauhan897a9c32013-07-18 11:09:55 -0700108void MdpCtrl::setColor(const uint32_t color) {
109 mOVInfo.bg_color = color;
110}
111
Saurabh Shahacf10202013-02-26 10:15:15 -0800112void MdpCtrl::setPosition(const overlay::utils::Dim& d) {
113 setDstRectDim(d);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700114}
115
Saurabh Shahacf10202013-02-26 10:15:15 -0800116void MdpCtrl::setTransform(const utils::eTransform& orient) {
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700117 int rot = utils::getMdpOrient(orient);
118 setUserData(rot);
Saurabh Shaha73738d2012-08-09 18:15:18 -0700119 mOrientation = static_cast<utils::eTransform>(rot);
Ramkumar Radhakrishnan288f8c72013-01-15 11:37:54 -0800120}
121
radhakrishna8ccb9082014-05-09 16:18:43 +0530122void MdpCtrl::setPipeType(const utils::eMdpPipeType& pType){
123 switch((int) pType){
124 case utils::OV_MDP_PIPE_RGB:
125 mOVInfo.pipe_type = PIPE_TYPE_RGB;
126 break;
127 case utils::OV_MDP_PIPE_VG:
128 mOVInfo.pipe_type = PIPE_TYPE_VIG;
129 break;
130 case utils::OV_MDP_PIPE_DMA:
131 mOVInfo.pipe_type = PIPE_TYPE_DMA;
132 break;
133 default:
134 mOVInfo.pipe_type = PIPE_TYPE_AUTO;
135 break;
136 }
137}
138
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700139void MdpCtrl::doTransform() {
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700140 setRotationFlags();
Saurabh Shahacf10202013-02-26 10:15:15 -0800141 utils::Whf whf = getSrcWhf();
142 utils::Dim dim = getSrcRectDim();
143 utils::preRotateSource(mOrientation, whf, dim);
144 setSrcWhf(whf);
145 setSrcRectDim(dim);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700146}
147
Saurabh Shahacf10202013-02-26 10:15:15 -0800148void MdpCtrl::doDownscale() {
Saurabh Shah958051e2014-06-27 16:15:42 -0700149 if(MDPVersion::getInstance().supportsDecimation()) {
Saurabh Shah1a03d482013-05-29 13:44:20 -0700150 utils::getDecimationFactor(mOVInfo.src_rect.w, mOVInfo.src_rect.h,
Saurabh Shahb6810df2014-06-17 16:00:22 -0700151 mOVInfo.dst_rect.w, mOVInfo.dst_rect.h, mOVInfo.horz_deci,
152 mOVInfo.vert_deci);
Saurabh Shahbd2d0832013-04-04 14:33:08 -0700153 }
Ramkumar Radhakrishnan288f8c72013-01-15 11:37:54 -0800154}
155
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700156bool MdpCtrl::set() {
Saurabh Shahbd2d0832013-04-04 14:33:08 -0700157 int mdpVersion = MDPVersion::getInstance().getMDPVersion();
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700158 //deferred calcs, so APIs could be called in any order.
Saurabh Shahacf10202013-02-26 10:15:15 -0800159 doTransform();
Saurabh Shahb121e142012-08-20 17:59:13 -0700160 utils::Whf whf = getSrcWhf();
161 if(utils::isYuv(whf.format)) {
Sushil Chauhan1cac8152013-05-08 15:53:51 -0700162 utils::normalizeCrop(mOVInfo.src_rect.x, mOVInfo.src_rect.w);
163 utils::normalizeCrop(mOVInfo.src_rect.y, mOVInfo.src_rect.h);
Saurabh Shahbd2d0832013-04-04 14:33:08 -0700164 if(mdpVersion < MDSS_V5) {
Saurabh Shahce416f02013-04-10 13:33:09 -0700165 utils::even_floor(mOVInfo.dst_rect.w);
166 utils::even_floor(mOVInfo.dst_rect.h);
Sushil Chauhan5491c8a2013-05-24 10:15:30 -0700167 } else if (mOVInfo.flags & MDP_DEINTERLACE) {
168 // For interlaced, crop.h should be 4-aligned
169 if (!(mOVInfo.flags & MDP_SOURCE_ROTATED_90) &&
170 (mOVInfo.src_rect.h % 4))
171 mOVInfo.src_rect.h = utils::aligndown(mOVInfo.src_rect.h, 4);
Sravan Kumar D.V.Na34dc852014-03-26 19:13:11 +0530172 // For interlaced, width must be multiple of 4 when rotated 90deg.
173 else if ((mOVInfo.flags & MDP_SOURCE_ROTATED_90) &&
174 (mOVInfo.src_rect.w % 4))
175 mOVInfo.src_rect.w = utils::aligndown(mOVInfo.src_rect.w, 4);
Saurabh Shahce416f02013-04-10 13:33:09 -0700176 }
Sushil Chauhan35fc68b2013-06-19 14:08:56 -0700177 } else {
radhakrishna766b0542015-03-25 10:42:20 +0530178 // On 8974 and 8x26, there is a limitation of 1-pixel down-scaling
Sushil Chauhan35fc68b2013-06-19 14:08:56 -0700179 if (mdpVersion >= MDSS_V5) {
radhakrishna766b0542015-03-25 10:42:20 +0530180 if(qdutils::MDPVersion::getInstance().is8x74v2() ||
181 qdutils::MDPVersion::getInstance().is8x26()) {
182 if (mOVInfo.src_rect.w - mOVInfo.dst_rect.w == 1)
183 mOVInfo.src_rect.w -= 1;
184 if (mOVInfo.src_rect.h - mOVInfo.dst_rect.h == 1)
185 mOVInfo.src_rect.h -= 1;
186 }
Sushil Chauhan35fc68b2013-06-19 14:08:56 -0700187 }
Saurabh Shahb121e142012-08-20 17:59:13 -0700188 }
189
Sushil Chauhan35fc68b2013-06-19 14:08:56 -0700190 doDownscale();
Naseer Ahmed29a26812012-06-14 00:56:20 -0700191 return true;
192}
193
Saurabh Shahacf10202013-02-26 10:15:15 -0800194//Update src format based on rotator's destination format.
195void MdpCtrl::updateSrcFormat(const uint32_t& rotDestFmt) {
Saurabh Shahfc3652f2013-02-15 13:15:45 -0800196 utils::Whf whf = getSrcWhf();
Saurabh Shahacf10202013-02-26 10:15:15 -0800197 whf.format = rotDestFmt;
Saurabh Shahfc3652f2013-02-15 13:15:45 -0800198 setSrcWhf(whf);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700199}
200
201void MdpCtrl::dump() const {
202 ALOGE("== Dump MdpCtrl start ==");
Naseer Ahmed29a26812012-06-14 00:56:20 -0700203 mFd.dump();
204 mdp_wrapper::dump("mOVInfo", mOVInfo);
205 ALOGE("== Dump MdpCtrl end ==");
206}
207
Saurabh Shah0d0a7cb2013-02-12 17:58:19 -0800208void MdpCtrl::getDump(char *buf, size_t len) {
Saurabh Shahae61b2b2013-04-10 16:37:25 -0700209 ovutils::getDump(buf, len, "Ctrl", mOVInfo);
Saurabh Shah0d0a7cb2013-02-12 17:58:19 -0800210}
211
Naseer Ahmed29a26812012-06-14 00:56:20 -0700212void MdpData::dump() const {
213 ALOGE("== Dump MdpData start ==");
214 mFd.dump();
215 mdp_wrapper::dump("mOvData", mOvData);
216 ALOGE("== Dump MdpData end ==");
217}
218
Saurabh Shah0d0a7cb2013-02-12 17:58:19 -0800219void MdpData::getDump(char *buf, size_t len) {
Saurabh Shahae61b2b2013-04-10 16:37:25 -0700220 ovutils::getDump(buf, len, "Data", mOvData);
Saurabh Shah0d0a7cb2013-02-12 17:58:19 -0800221}
222
Saurabh Shah5daeee52013-01-23 16:52:26 +0800223bool MdpCtrl::setVisualParams(const MetaData_t& data) {
Arun Kumar K.R7e5a1f82014-01-22 10:36:16 -0800224 ALOGD_IF(0, "In %s: data.operation = %d", __FUNCTION__, data.operation);
Sushil Chauhan0265c472014-10-01 16:39:02 -0700225
226 // Set Color Space for MDP to configure CSC matrix
227 mOVInfo.color_space = ITU_R_601;
228 if (data.operation & UPDATE_COLOR_SPACE) {
229 mOVInfo.color_space = data.colorSpace;
230 }
231
Saurabh Shah5daeee52013-01-23 16:52:26 +0800232#ifdef USES_POST_PROCESSING
Arun Kumar K.R7e5a1f82014-01-22 10:36:16 -0800233 bool needUpdate = false;
Saurabh Shah5daeee52013-01-23 16:52:26 +0800234 /* calculate the data */
235 if (data.operation & PP_PARAM_HSIC) {
236 if (mParams.params.pa_params.hue != data.hsicData.hue) {
237 ALOGD_IF(HSIC_SETTINGS_DEBUG,
238 "Hue has changed from %d to %d",
239 mParams.params.pa_params.hue,data.hsicData.hue);
240 needUpdate = true;
241 }
242
243 if (!isEqual(mParams.params.pa_params.sat,
244 data.hsicData.saturation)) {
245 ALOGD_IF(HSIC_SETTINGS_DEBUG,
246 "Saturation has changed from %f to %f",
247 mParams.params.pa_params.sat,
248 data.hsicData.saturation);
249 needUpdate = true;
250 }
251
252 if (mParams.params.pa_params.intensity != data.hsicData.intensity) {
253 ALOGD_IF(HSIC_SETTINGS_DEBUG,
254 "Intensity has changed from %d to %d",
255 mParams.params.pa_params.intensity,
256 data.hsicData.intensity);
257 needUpdate = true;
258 }
259
260 if (!isEqual(mParams.params.pa_params.contrast,
261 data.hsicData.contrast)) {
262 ALOGD_IF(HSIC_SETTINGS_DEBUG,
263 "Contrast has changed from %f to %f",
264 mParams.params.pa_params.contrast,
265 data.hsicData.contrast);
266 needUpdate = true;
267 }
268
269 if (needUpdate) {
Praveena Pachipulusu734118a2014-12-04 14:53:12 +0530270 mParams.params.pa_params.hue = (float)data.hsicData.hue;
Saurabh Shah5daeee52013-01-23 16:52:26 +0800271 mParams.params.pa_params.sat = data.hsicData.saturation;
272 mParams.params.pa_params.intensity = data.hsicData.intensity;
273 mParams.params.pa_params.contrast = data.hsicData.contrast;
274 mParams.params.pa_params.ops = MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
275 mParams.operation |= PP_OP_PA;
276 }
277 }
278
279 if (data.operation & PP_PARAM_SHARP2) {
280 if (mParams.params.sharp_params.strength != data.Sharp2Data.strength) {
281 needUpdate = true;
282 }
283 if (mParams.params.sharp_params.edge_thr != data.Sharp2Data.edge_thr) {
284 needUpdate = true;
285 }
286 if (mParams.params.sharp_params.smooth_thr !=
287 data.Sharp2Data.smooth_thr) {
288 needUpdate = true;
289 }
290 if (mParams.params.sharp_params.noise_thr !=
291 data.Sharp2Data.noise_thr) {
292 needUpdate = true;
293 }
294
295 if (needUpdate) {
296 mParams.params.sharp_params.strength = data.Sharp2Data.strength;
297 mParams.params.sharp_params.edge_thr = data.Sharp2Data.edge_thr;
298 mParams.params.sharp_params.smooth_thr =
299 data.Sharp2Data.smooth_thr;
300 mParams.params.sharp_params.noise_thr = data.Sharp2Data.noise_thr;
301 mParams.params.sharp_params.ops =
302 MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
303 mParams.operation |= PP_OP_SHARP;
304 }
305 }
306
307 if (data.operation & PP_PARAM_IGC) {
308 if (mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data == NULL){
309 uint32_t *igcData
310 = (uint32_t *)malloc(2 * MAX_IGC_LUT_ENTRIES * sizeof(uint32_t));
311 if (!igcData) {
312 ALOGE("IGC storage allocated failed");
313 return false;
314 }
315 mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data = igcData;
316 mOVInfo.overlay_pp_cfg.igc_cfg.c2_data
317 = igcData + MAX_IGC_LUT_ENTRIES;
318 }
319
320 memcpy(mParams.params.igc_lut_params.c0,
321 data.igcData.c0, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
322 memcpy(mParams.params.igc_lut_params.c1,
323 data.igcData.c1, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
324 memcpy(mParams.params.igc_lut_params.c2,
325 data.igcData.c2, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
326
327 mParams.params.igc_lut_params.ops
328 = MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
329 mParams.operation |= PP_OP_IGC;
330 needUpdate = true;
331 }
332
333 if (data.operation & PP_PARAM_VID_INTFC) {
334 mParams.params.conv_params.interface =
335 (interface_type) data.video_interface;
336 needUpdate = true;
337 }
338
339 if (needUpdate) {
Praveena Pachipulusu734118a2014-12-04 14:53:12 +0530340 int (*sFnppParams)(const struct compute_params *,
341 struct mdp_overlay_pp_params *) =
342 Overlay::getFnPpParams();
343 if(sFnppParams) {
344 int ret = sFnppParams(&mParams, &mOVInfo.overlay_pp_cfg);
345 if (ret) {
346 ALOGE("%s: Unable to set PP params", __FUNCTION__);
347 }
348 }
Saurabh Shah5daeee52013-01-23 16:52:26 +0800349 }
350#endif
351 return true;
352}
353
Saurabh Shaha36be922013-12-16 18:18:39 -0800354bool MdpCtrl::validateAndSet(MdpCtrl* mdpCtrlArray[], const int& count,
355 const int& fbFd) {
356 mdp_overlay* ovArray[count];
357 memset(&ovArray, 0, sizeof(ovArray));
358
Ramkumar Radhakrishnan942eb932015-02-26 20:31:14 -0800359 uint8_t max_horz_deci = 0, max_vert_deci = 0;
360
361 // Decimation factor for the left and right pipe differs, when there is a
362 // one pixel difference in the dst width of right pipe and the left pipe.
363 // libscalar returns a failure as it expects decimation on both the pipe
364 // to be same. So compare the decimation factor on both the pipes and assign
365 // the maximum of it.
Saurabh Shaha36be922013-12-16 18:18:39 -0800366 for(int i = 0; i < count; i++) {
Ramkumar Radhakrishnan942eb932015-02-26 20:31:14 -0800367 mdp_overlay *ov_current = &mdpCtrlArray[i]->mOVInfo;
368 for(int j = i + 1; j < count; j++) {
369 mdp_overlay *ov_next = &mdpCtrlArray[j]->mOVInfo;
370 if(ov_current->z_order == ov_next->z_order) {
371 max_horz_deci = utils::max(ov_current->horz_deci,
372 ov_next->horz_deci);
373 max_vert_deci = utils::max(ov_current->vert_deci,
374 ov_next->vert_deci);
375
376 ov_current->horz_deci = max_horz_deci;
377 ov_next->horz_deci = max_horz_deci;
378 ov_current->vert_deci = max_vert_deci;
379 ov_next->vert_deci = max_vert_deci;
380 break;
381 }
382 }
383 ovArray[i] = ov_current;
Saurabh Shaha36be922013-12-16 18:18:39 -0800384 }
385
386 struct mdp_overlay_list list;
387 memset(&list, 0, sizeof(struct mdp_overlay_list));
388 list.num_overlays = count;
389 list.overlay_list = ovArray;
390
Saurabh Shaheac146b2014-05-13 11:36:20 -0700391 int (*fnProgramScale)(struct mdp_overlay_list *) =
392 Overlay::getFnProgramScale();
393 if(fnProgramScale) {
394 fnProgramScale(&list);
Saurabh Shaha36be922013-12-16 18:18:39 -0800395 }
Saurabh Shaha36be922013-12-16 18:18:39 -0800396
Praveena Pachipulusubb89fa62014-11-26 12:34:16 +0530397 // Error value is based on file errno-base.h
398 // 0 - indicates no error.
399 int errVal = mdp_wrapper::validateAndSet(fbFd, list);
400 if(errVal) {
Jeykumar Sankaran1d9fc082014-04-01 15:21:55 -0700401 /* No dump for failure due to insufficient resource */
Praveena Pachipulusubb89fa62014-11-26 12:34:16 +0530402 if(errVal != E2BIG) {
Saurabh Shah15455aa2015-01-28 13:54:48 -0800403 //ENODEV is returned when the driver cannot satisfy a pipe request.
404 //This could happen if previous round's UNSET hasn't been commited
405 //yet, either because of a missed vsync or because of difference in
406 //vsyncs of primary and external. This is expected during
407 //transition scenarios, but should be considered fatal if seen
408 //continuously.
409 if(errVal == ENODEV) {
410 ALOGW("%s: Pipe unavailable. Likely previous UNSET pending. "
411 "Fatal if seen continuously.", __FUNCTION__);
412 } else {
413 ALOGE("%s failed, error %d: %s", __FUNCTION__, errVal,
414 strerror(errVal));
415 mdp_wrapper::dump("Bad ov dump: ",
416 *list.overlay_list[list.processed_overlays]);
417 }
Saurabh Shaha36be922013-12-16 18:18:39 -0800418 }
419 return false;
420 }
421
422 return true;
423}
424
Saurabh Shahb8f58e22013-09-26 16:20:07 -0700425
426//// MdpData ////////////
Saurabh Shahd18d88a2014-01-06 15:02:49 -0800427bool MdpData::init(const int& dpy) {
Saurabh Shahb8f58e22013-09-26 16:20:07 -0700428 int fbnum = Overlay::getFbForDpy(dpy);
429 if( fbnum < 0 ) {
430 ALOGE("%s: Invalid FB for the display: %d",__FUNCTION__, dpy);
431 return false;
432 }
433
434 // FD init
435 if(!utils::openDev(mFd, fbnum, Res::fbPath, O_RDWR)){
436 ALOGE("Ctrl failed to init fbnum=%d", fbnum);
437 return false;
438 }
439 return true;
440}
441
Naseer Ahmed29a26812012-06-14 00:56:20 -0700442} // overlay