1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
4 *
5 * Not a Contribution, Apache license notifications and license are retained
6 * for attribution purposes only.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef HWC_VIRTUAL
22#define HWC_VIRTUAL
23
24#include <hwc_utils.h>
25
26namespace qhwc {
27
28class HWCVirtualVDS {
29public:
30    HWCVirtualVDS(){};
31    ~HWCVirtualVDS(){};
32    // Chooses composition type and configures pipe for each layer in virtual
33    // display list
34    int prepare(hwc_composer_device_1 *dev,
35                          hwc_display_contents_1_t* list);
36    // Queues the buffer for each layer in virtual display list and call display
37    // commit.
38    int set(hwc_context_t *ctx, hwc_display_contents_1_t *list);
39    // instantiates mdpcomp, copybit and fbupdate objects and initialize those
40    // objects for virtual display during virtual display connect.
41    void init(hwc_context_t *ctx);
42    // Destroys mdpcomp, copybit and fbupdate objects and for virtual display
43    // during virtual display disconnect.
44    void destroy(hwc_context_t *ctx, size_t numDisplays,
45                       hwc_display_contents_1_t** displays);
46    int getScalingHeight() const { return mScalingHeight; };
47    int getScalingWidth() const { return mScalingWidth; };
48    // We can dump the frame buffer and WB
49    // output buffer by dynamically enabling
50    // dumping via a binder call:
51    // adb shell service call display.qservice 15 i32 3 i32 1
52    static bool sVDDumpEnabled;
53    static void dynamicDebug(bool enable) {sVDDumpEnabled = enable;};
54
55private:
56    // These variables store the resolution that WB is being configured to
57    // in the current draw cycle.
58    int mScalingWidth, mScalingHeight;
59    void setMDPScalingMode(hwc_context_t* ctx,
60            private_handle_t* ohnd, int dpy);
61};
62
63}; //namespace
64#endif
65