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