overlay.cpp revision 5c2c0ce488ebd02bfbd43d12f6a6595e7f0b92a5
1/*
2* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
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
30#include <dlfcn.h>
31#include "overlay.h"
32#include "pipes/overlayGenPipe.h"
33#include "mdp_version.h"
34#include "qdMetaData.h"
35
36#define PIPE_DEBUG 0
37
38namespace overlay {
39using namespace utils;
40using namespace qdutils;
41
42static bool is_delta_panel = false;
43
44Overlay::Overlay() {
45    int numPipes = qdutils::MDPVersion::getInstance().getTotalPipes();
46    PipeBook::NUM_PIPES = (numPipes <= utils::OV_MAX)? numPipes : utils::OV_MAX;
47    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
48        mPipeBook[i].init();
49    }
50
51    mDumpStr[0] = '\0';
52    initScalar();
53    setDMAMultiplexingSupported();
54
55#ifdef DELTA_PANEL
56    char property[PROPERTY_VALUE_MAX];
57    if((property_get("ro.hwc.is_delta_panel", property, NULL) > 0) &&
58            (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
59                    (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
60        is_delta_panel = true;
61    }
62#endif
63}
64
65Overlay::~Overlay() {
66    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
67        mPipeBook[i].destroy();
68    }
69    destroyScalar();
70}
71
72void Overlay::configBegin() {
73    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
74        //Mark as available for this round.
75        PipeBook::resetUse(i);
76        PipeBook::resetAllocation(i);
77    }
78    mDumpStr[0] = '\0';
79}
80
81void Overlay::configDone() {
82    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
83        if((PipeBook::isNotUsed(i) && !sessionInProgress((eDest)i)) ||
84                    isSessionEnded((eDest)i)) {
85            //Forces UNSET on pipes, flushes rotator memory and session, closes
86            //fds
87            if(mPipeBook[i].valid()) {
88                char str[32];
89                snprintf(str, 32, "Unset=%s dpy=%d mix=%d; ",
90                        PipeBook::getDestStr((eDest)i),
91                        mPipeBook[i].mDisplay, mPipeBook[i].mMixer);
92#if PIPE_DEBUG
93                strlcat(mDumpStr, str, sizeof(mDumpStr));
94#endif
95            }
96            mPipeBook[i].destroy();
97        }
98    }
99    dump();
100    PipeBook::save();
101}
102
103int Overlay::getPipeId(utils::eDest dest) {
104    return mPipeBook[(int)dest].mPipe->getPipeId();
105}
106
107eDest Overlay::getDest(int pipeid) {
108    eDest dest = OV_INVALID;
109    // finding the dest corresponding to the given pipe
110    for(int i=0; i < PipeBook::NUM_PIPES; ++i) {
111        if(mPipeBook[i].valid() && mPipeBook[i].mPipe->getPipeId() == pipeid) {
112            return (eDest)i;
113        }
114    }
115    return dest;
116}
117
118eDest Overlay::reservePipe(int pipeid) {
119    eDest dest = getDest(pipeid);
120    PipeBook::setAllocation((int)dest);
121    return dest;
122}
123
124eDest Overlay::nextPipe(eMdpPipeType type, int dpy, int mixer) {
125    eDest dest = OV_INVALID;
126
127    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
128        if( (type == OV_MDP_PIPE_ANY || //Pipe type match
129             type == PipeBook::getPipeType((eDest)i)) &&
130            (mPipeBook[i].mDisplay == DPY_UNUSED || //Free or same display
131             mPipeBook[i].mDisplay == dpy) &&
132            (mPipeBook[i].mMixer == MIXER_UNUSED || //Free or same mixer
133             mPipeBook[i].mMixer == mixer) &&
134            PipeBook::isNotAllocated(i) && //Free pipe
135            ( (sDMAMultiplexingSupported && dpy) ||
136              !(sDMAMode == DMA_BLOCK_MODE && //DMA pipe in Line mode
137               PipeBook::getPipeType((eDest)i) == OV_MDP_PIPE_DMA)) ){
138              //DMA-Multiplexing is only supported for WB on 8x26
139            dest = (eDest)i;
140            PipeBook::setAllocation(i);
141            break;
142        }
143    }
144
145    if(dest != OV_INVALID) {
146        int index = (int)dest;
147        mPipeBook[index].mDisplay = dpy;
148        mPipeBook[index].mMixer = mixer;
149        if(not mPipeBook[index].valid()) {
150            mPipeBook[index].mPipe = new GenericPipe(dpy);
151            mPipeBook[index].mSession = PipeBook::NONE;
152            char str[32];
153            snprintf(str, 32, "Set=%s dpy=%d mix=%d; ",
154                     PipeBook::getDestStr(dest), dpy, mixer);
155#if PIPE_DEBUG
156            strlcat(mDumpStr, str, sizeof(mDumpStr));
157#endif
158        }
159    } else {
160        ALOGD_IF(PIPE_DEBUG, "Pipe unavailable type=%d display=%d mixer=%d",
161                (int)type, dpy, mixer);
162    }
163
164    return dest;
165}
166
167utils::eDest Overlay::getPipe(const PipeSpecs& pipeSpecs) {
168    if(MDPVersion::getInstance().is8x26()) {
169        return getPipe_8x26(pipeSpecs);
170    } else if(MDPVersion::getInstance().is8x16()) {
171        return getPipe_8x16(pipeSpecs);
172    } else if(MDPVersion::getInstance().is8x39()) {
173        return getPipe_8x39(pipeSpecs);
174    }
175
176    eDest dest = OV_INVALID;
177
178    //The default behavior is to assume RGB and VG pipes have scalars
179    if(pipeSpecs.formatClass == FORMAT_YUV) {
180        return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
181    } else if(pipeSpecs.fb == false) { //RGB App layers
182        if(not pipeSpecs.needsScaling) {
183            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
184        }
185        if(dest == OV_INVALID) {
186            dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
187        }
188        if(dest == OV_INVALID) {
189            dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
190        }
191    } else { //FB layer
192        dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
193        if(dest == OV_INVALID) {
194            dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
195        }
196        //Some features can cause FB to have scaling as well.
197        //If we ever come to this block with FB needing scaling,
198        //the screen will be black for a frame, since the FB won't get a pipe
199        //but atleast this will prevent a hang
200        if(dest == OV_INVALID and (not pipeSpecs.needsScaling)) {
201            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
202        }
203    }
204    return dest;
205}
206
207utils::eDest Overlay::getPipe_8x26(const PipeSpecs& pipeSpecs) {
208    //Use this to hide all the 8x26 requirements that cannot be humanly
209    //described in a generic way
210    eDest dest = OV_INVALID;
211    if(pipeSpecs.formatClass == FORMAT_YUV) { //video
212        return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
213    } else if(pipeSpecs.fb == false) { //RGB app layers
214        if((not pipeSpecs.needsScaling) and
215          (not (pipeSpecs.numActiveDisplays > 1 &&
216                pipeSpecs.dpy == DPY_PRIMARY))) {
217            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
218        }
219        if(dest == OV_INVALID) {
220            dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
221        }
222        if(dest == OV_INVALID) {
223            dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
224        }
225    } else { //FB layer
226        //For 8x26 Secondary we use DMA always for FB for inline rotation
227        if(pipeSpecs.dpy == DPY_PRIMARY) {
228            if (is_delta_panel && not pipeSpecs.needsScaling) {
229                /* For wearable targets, secondary display is not applicable
230                   Try for DMA pipe for FB first, if FB does not have scaling*/
231                dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
232            } else {
233                dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
234                if (dest == OV_INVALID) {
235                    // FB needs scaling, and RGB pipe is not available - try VG
236                    dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
237                }
238            }
239        }
240        if(dest == OV_INVALID and (not pipeSpecs.needsScaling) and
241                (not (pipeSpecs.numActiveDisplays > 1 &&
242                      pipeSpecs.dpy == DPY_PRIMARY))) {
243            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
244        }
245    }
246    return dest;
247}
248
249utils::eDest Overlay::getPipe_8x16(const PipeSpecs& pipeSpecs) {
250    //Having such functions help keeping the interface generic but code specific
251    //and rife with assumptions
252    eDest dest = OV_INVALID;
253    if(pipeSpecs.formatClass == FORMAT_YUV or pipeSpecs.needsScaling) {
254        return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
255    } else {
256        //Since this is a specific func, we can assume stuff like RGB pipe not
257        //having scalar blocks
258        dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
259        if(dest == OV_INVALID) {
260            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
261        }
262        if(dest == OV_INVALID) {
263            dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
264        }
265    }
266    return dest;
267}
268
269utils::eDest Overlay::getPipe_8x39(const PipeSpecs& pipeSpecs) {
270    //8x16 & 8x36 has same number of pipes, pipe-types & scaling capabilities.
271    //Rely on 8x16 until we see a need to change.
272    return getPipe_8x16(pipeSpecs);
273}
274
275void Overlay::endAllSessions() {
276    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
277        if(mPipeBook[i].valid() && mPipeBook[i].mSession==PipeBook::START)
278            mPipeBook[i].mSession = PipeBook::END;
279    }
280}
281
282bool Overlay::isPipeTypeAttached(eMdpPipeType type) {
283    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
284        if(type == PipeBook::getPipeType((eDest)i) &&
285                mPipeBook[i].mDisplay != DPY_UNUSED) {
286            return true;
287        }
288    }
289    return false;
290}
291
292int Overlay::comparePipePriority(utils::eDest pipe1Index,
293        utils::eDest pipe2Index) {
294    validate((int)pipe1Index);
295    validate((int)pipe2Index);
296    uint8_t pipe1Prio = mPipeBook[(int)pipe1Index].mPipe->getPriority();
297    uint8_t pipe2Prio = mPipeBook[(int)pipe2Index].mPipe->getPriority();
298    if(pipe1Prio > pipe2Prio)
299        return -1;
300    if(pipe1Prio < pipe2Prio)
301        return 1;
302    return 0;
303}
304
305bool Overlay::commit(utils::eDest dest) {
306    bool ret = false;
307    validate((int)dest);
308
309    if(mPipeBook[dest].mPipe->commit()) {
310        ret = true;
311        PipeBook::setUse((int)dest);
312    } else {
313        int dpy = mPipeBook[dest].mDisplay;
314        for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
315            if (mPipeBook[i].mDisplay == dpy) {
316                PipeBook::resetAllocation(i);
317                PipeBook::resetUse(i);
318            }
319        }
320    }
321    return ret;
322}
323
324bool Overlay::queueBuffer(int fd, uint32_t offset,
325        utils::eDest dest) {
326    bool ret = false;
327    validate((int)dest);
328    //Queue only if commit() has succeeded (and the bit set)
329    if(PipeBook::isUsed((int)dest)) {
330        ret = mPipeBook[dest].mPipe->queueBuffer(fd, offset);
331    }
332    return ret;
333}
334
335void Overlay::setCrop(const utils::Dim& d,
336        utils::eDest dest) {
337    validate((int)dest);
338    mPipeBook[dest].mPipe->setCrop(d);
339}
340
341void Overlay::setColor(const uint32_t color,
342        utils::eDest dest) {
343    validate((int)dest);
344    mPipeBook[dest].mPipe->setColor(color);
345}
346
347void Overlay::setPosition(const utils::Dim& d,
348        utils::eDest dest) {
349    validate((int)dest);
350    mPipeBook[dest].mPipe->setPosition(d);
351}
352
353void Overlay::setTransform(const int orient,
354        utils::eDest dest) {
355    validate((int)dest);
356
357    utils::eTransform transform =
358            static_cast<utils::eTransform>(orient);
359    mPipeBook[dest].mPipe->setTransform(transform);
360
361}
362
363void Overlay::setSource(const utils::PipeArgs args,
364        utils::eDest dest) {
365    validate((int)dest);
366
367    setPipeType(dest, PipeBook::getPipeType(dest));
368    mPipeBook[dest].mPipe->setSource(args);
369}
370
371void Overlay::setVisualParams(const MetaData_t& metadata, utils::eDest dest) {
372    validate((int)dest);
373    mPipeBook[dest].mPipe->setVisualParams(metadata);
374}
375
376void Overlay::setPipeType(utils::eDest pipeIndex,
377        const utils::eMdpPipeType pType) {
378    mPipeBook[pipeIndex].mPipe->setPipeType(pType);
379}
380
381Overlay* Overlay::getInstance() {
382    if(sInstance == NULL) {
383        sInstance = new Overlay();
384    }
385    return sInstance;
386}
387
388// Clears any VG pipes allocated to the fb devices
389// Generates a LUT for pipe types.
390int Overlay::initOverlay() {
391    int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
392    int numPipesXType[OV_MDP_PIPE_ANY] = {0};
393    numPipesXType[OV_MDP_PIPE_RGB] =
394            qdutils::MDPVersion::getInstance().getRGBPipes();
395    numPipesXType[OV_MDP_PIPE_VG] =
396            qdutils::MDPVersion::getInstance().getVGPipes();
397    numPipesXType[OV_MDP_PIPE_DMA] =
398            qdutils::MDPVersion::getInstance().getDMAPipes();
399
400    int index = 0;
401    for(int X = 0; X < (int)OV_MDP_PIPE_ANY; X++) { //iterate over types
402        for(int j = 0; j < numPipesXType[X]; j++) { //iterate over num
403            PipeBook::pipeTypeLUT[index] = (utils::eMdpPipeType)X;
404            index++;
405        }
406    }
407
408    if (mdpVersion < qdutils::MDSS_V5 && mdpVersion != qdutils::MDP_V3_0_4) {
409        msmfb_mixer_info_req  req;
410        mdp_mixer_info *minfo = NULL;
411        char name[64];
412        int fd = -1;
413        for(int i = 0; i < MAX_FB_DEVICES; i++) {
414            snprintf(name, 64, FB_DEVICE_TEMPLATE, i);
415            ALOGD("initoverlay:: opening the device:: %s", name);
416            fd = ::open(name, O_RDWR, 0);
417            if(fd < 0) {
418                ALOGE("cannot open framebuffer(%d)", i);
419                return -1;
420            }
421            //Get the mixer configuration */
422            req.mixer_num = i;
423            if (ioctl(fd, MSMFB_MIXER_INFO, &req) == -1) {
424                ALOGE("ERROR: MSMFB_MIXER_INFO ioctl failed");
425                close(fd);
426                return -1;
427            }
428            minfo = req.info;
429            for (int j = 0; j < req.cnt; j++) {
430                ALOGD("ndx=%d num=%d z_order=%d", minfo->pndx, minfo->pnum,
431                      minfo->z_order);
432                // except the RGB base layer with z_order of -1, clear any
433                // other pipes connected to mixer.
434                if((minfo->z_order) != -1) {
435                    int index = minfo->pndx;
436                    ALOGD("Unset overlay with index: %d at mixer %d", index, i);
437                    if(ioctl(fd, MSMFB_OVERLAY_UNSET, &index) == -1) {
438                        ALOGE("ERROR: MSMFB_OVERLAY_UNSET failed");
439                        close(fd);
440                        return -1;
441                    }
442                }
443                minfo++;
444            }
445            close(fd);
446            fd = -1;
447        }
448    }
449
450    FILE *displayDeviceFP = NULL;
451    const int MAX_FRAME_BUFFER_NAME_SIZE = 128;
452    char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
453    char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE];
454    const char *strDtvPanel = "dtv panel";
455    const char *strWbPanel = "writeback panel";
456
457    for(int num = 1; num < MAX_FB_DEVICES; num++) {
458        snprintf (msmFbTypePath, sizeof(msmFbTypePath),
459                "/sys/class/graphics/fb%d/msm_fb_type", num);
460        displayDeviceFP = fopen(msmFbTypePath, "r");
461
462        if(displayDeviceFP){
463            fread(fbType, sizeof(char), MAX_FRAME_BUFFER_NAME_SIZE,
464                    displayDeviceFP);
465
466            if(strncmp(fbType, strDtvPanel, strlen(strDtvPanel)) == 0) {
467                sDpyFbMap[DPY_EXTERNAL] = num;
468            } else if(strncmp(fbType, strWbPanel, strlen(strWbPanel)) == 0) {
469                sDpyFbMap[DPY_WRITEBACK] = num;
470            }
471
472            fclose(displayDeviceFP);
473        }
474    }
475
476    return 0;
477}
478
479bool Overlay::displayCommit(const int& fd) {
480    utils::Dim lRoi, rRoi;
481    return displayCommit(fd, lRoi, rRoi);
482}
483
484bool Overlay::displayCommit(const int& fd, const utils::Dim& lRoi,
485        const utils::Dim& rRoi) {
486    //Commit
487    struct mdp_display_commit info;
488    memset(&info, 0, sizeof(struct mdp_display_commit));
489    info.flags = MDP_DISPLAY_COMMIT_OVERLAY;
490    info.l_roi.x = lRoi.x;
491    info.l_roi.y = lRoi.y;
492    info.l_roi.w = lRoi.w;
493    info.l_roi.h = lRoi.h;
494    info.r_roi.x = rRoi.x;
495    info.r_roi.y = rRoi.y;
496    info.r_roi.w = rRoi.w;
497    info.r_roi.h = rRoi.h;
498
499    if(!mdp_wrapper::displayCommit(fd, info)) {
500        ALOGE("%s: commit failed", __func__);
501        return false;
502    }
503    return true;
504}
505
506void Overlay::dump() const {
507#if PIPE_DEBUG
508    if(strlen(mDumpStr)) { //dump only on state change
509        ALOGD("%s\n", mDumpStr);
510    }
511#endif
512}
513
514void Overlay::getDump(char *buf, size_t len) {
515    int totalPipes = 0;
516    const char *str = "\nOverlay State\n\n";
517    strlcat(buf, str, len);
518    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
519        if(mPipeBook[i].valid()) {
520            mPipeBook[i].mPipe->getDump(buf, len);
521            char str[64] = {'\0'};
522            snprintf(str, 64, "Display=%d\n\n", mPipeBook[i].mDisplay);
523            strlcat(buf, str, len);
524            totalPipes++;
525        }
526    }
527    char str_pipes[64] = {'\0'};
528    snprintf(str_pipes, 64, "Pipes=%d\n\n", totalPipes);
529    strlcat(buf, str_pipes, len);
530}
531
532void Overlay::clear(int dpy) {
533    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
534        if (mPipeBook[i].mDisplay == dpy) {
535            // Mark as available for this round
536            PipeBook::resetUse(i);
537            PipeBook::resetAllocation(i);
538        }
539    }
540}
541
542bool Overlay::validateAndSet(const int& dpy, const int& fbFd) {
543    GenericPipe* pipeArray[PipeBook::NUM_PIPES];
544    memset(pipeArray, 0, sizeof(GenericPipe*)*(PipeBook::NUM_PIPES));
545
546    int num = 0;
547    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
548        if(PipeBook::isUsed(i) && mPipeBook[i].valid() &&
549                mPipeBook[i].mDisplay == dpy) {
550            pipeArray[num++] = mPipeBook[i].mPipe;
551        }
552    }
553
554    //Protect against misbehaving clients
555    return num ? GenericPipe::validateAndSet(pipeArray, num, fbFd) : true;
556}
557
558void Overlay::initScalar() {
559    if(sLibScaleHandle == NULL) {
560        sLibScaleHandle = dlopen("libscale.so", RTLD_NOW);
561        if(sLibScaleHandle) {
562            *(void **) &sFnProgramScale =
563                    dlsym(sLibScaleHandle, "programScale");
564        }
565    }
566}
567
568void Overlay::destroyScalar() {
569    if(sLibScaleHandle) {
570        dlclose(sLibScaleHandle);
571        sLibScaleHandle = NULL;
572    }
573}
574
575void Overlay::PipeBook::init() {
576    mPipe = NULL;
577    mDisplay = DPY_UNUSED;
578    mMixer = MIXER_UNUSED;
579}
580
581void Overlay::PipeBook::destroy() {
582    if(mPipe) {
583        delete mPipe;
584        mPipe = NULL;
585    }
586    mDisplay = DPY_UNUSED;
587    mMixer = MIXER_UNUSED;
588    mSession = NONE;
589}
590
591Overlay* Overlay::sInstance = 0;
592int Overlay::sDpyFbMap[DPY_MAX] = {0, -1, -1};
593int Overlay::sDMAMode = DMA_LINE_MODE;
594bool Overlay::sDMAMultiplexingSupported = false;
595int Overlay::PipeBook::NUM_PIPES = 0;
596int Overlay::PipeBook::sPipeUsageBitmap = 0;
597int Overlay::PipeBook::sLastUsageBitmap = 0;
598int Overlay::PipeBook::sAllocatedBitmap = 0;
599utils::eMdpPipeType Overlay::PipeBook::pipeTypeLUT[utils::OV_MAX] =
600    {utils::OV_MDP_PIPE_ANY};
601void *Overlay::sLibScaleHandle = NULL;
602int (*Overlay::sFnProgramScale)(struct mdp_overlay_list *) = NULL;
603
604}; // namespace overlay
605