1361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran/*
2361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* Copyright (c) 2013 The Linux Foundation. All rights reserved.
3361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*
4361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* Redistribution and use in source and binary forms, with or without
5361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* modification, are permitted provided that the following conditions are
6361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* met:
7361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*    * Redistributions of source code must retain the above copyright
8361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      notice, this list of conditions and the following disclaimer.
9361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*    * Redistributions in binary form must reproduce the above
10361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      copyright notice, this list of conditions and the following
11361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      disclaimer in the documentation and/or other materials provided
12361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      with the distribution.
13361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*    * Neither the name of The Linux Foundation. nor the names of its
14361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      contributors may be used to endorse or promote products derived
15361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*      from this software without specific prior written permission.
16361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*
17361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran*/
29361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
30361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
31361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran#ifndef HWC_VIRTUAL_DISPLAY_H
32361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran#define HWC_VIRTUAL_DISPLAY_H
33361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
34361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran#include <linux/fb.h>
35361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
36361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaranstruct hwc_context_t;
37361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
38361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankarannamespace qhwc {
39361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
40361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaranclass VirtualDisplay
41361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran{
42361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaranpublic:
43361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    VirtualDisplay(hwc_context_t* ctx);
44361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    ~VirtualDisplay();
45361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    int  configure();
46fea63d61337f1efeb2d1c7a7a4fafe472611704cAmara Venkata Mastan Manoj Kumar    void getAttributes(int& width, int& height);
47361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    int  teardown();
48361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    bool isConnected() {
49361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran        return  mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].connected;
50361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    }
51361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaranprivate:
52361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    bool openFrameBuffer();
53361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    bool closeFrameBuffer();
54361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    void setAttributes();
5545a3f1953232854fb623093e84a047464f6d3b3bTatenda Chipeperekwa    void initResolution(uint32_t &extW, uint32_t &extH);
5645a3f1953232854fb623093e84a047464f6d3b3bTatenda Chipeperekwa    void setToPrimary(uint32_t maxArea, uint32_t priW, uint32_t priH,
5745a3f1953232854fb623093e84a047464f6d3b3bTatenda Chipeperekwa                      uint32_t &extW, uint32_t &extH);
5845a3f1953232854fb623093e84a047464f6d3b3bTatenda Chipeperekwa    void setDownScaleMode(uint32_t maxArea);
59361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran
60361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    int mFd;
61361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    hwc_context_t *mHwcContext;
62361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran    fb_var_screeninfo mVInfo;
63361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran};
64361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran}; //qhwc
65361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran// ---------------------------------------------------------------------------
66361900d9a618d2c4d2276a10ca76919214f6759fJeykumar Sankaran#endif //HWC_VIRTUAL_DISPLAY_H
67