Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 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> |
Tatenda Chipeperekwa | 8f1b9d7 | 2014-02-11 16:20:50 -0800 | [diff] [blame] | 25 | #include <virtual.h> |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 26 | |
| 27 | namespace qhwc { |
| 28 | namespace ovutils = overlay::utils; |
| 29 | |
| 30 | // Base and abstract class for VDS and V4L2 wfd design. |
| 31 | class HWCVirtualBase { |
| 32 | public: |
| 33 | explicit HWCVirtualBase(){}; |
| 34 | virtual ~HWCVirtualBase(){}; |
| 35 | // instantiates and returns the pointer to VDS or V4L2 object. |
Raj kamal | 59fea56 | 2014-04-01 16:52:19 +0530 | [diff] [blame] | 36 | static HWCVirtualBase* getObject(bool isVDSEnabled); |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 37 | virtual int prepare(hwc_composer_device_1 *dev, |
| 38 | hwc_display_contents_1_t* list) = 0; |
| 39 | virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0; |
| 40 | virtual void init(hwc_context_t *ctx) = 0; |
| 41 | virtual void destroy(hwc_context_t *ctx, size_t numDisplays, |
| 42 | hwc_display_contents_1_t** displays) = 0; |
Tatenda Chipeperekwa | 8f1b9d7 | 2014-02-11 16:20:50 -0800 | [diff] [blame] | 43 | virtual void pause(hwc_context_t* ctx, int dpy) = 0; |
| 44 | virtual void resume(hwc_context_t* ctx, int dpy) = 0; |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | class HWCVirtualVDS : public HWCVirtualBase { |
| 48 | public: |
| 49 | explicit HWCVirtualVDS(){}; |
| 50 | virtual ~HWCVirtualVDS(){}; |
| 51 | // Chooses composition type and configures pipe for each layer in virtual |
| 52 | // display list |
| 53 | virtual int prepare(hwc_composer_device_1 *dev, |
| 54 | hwc_display_contents_1_t* list); |
| 55 | // Queues the buffer for each layer in virtual display list and call display |
| 56 | // commit. |
| 57 | virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
| 58 | // instantiates mdpcomp, copybit and fbupdate objects and initialize those |
| 59 | // objects for virtual display during virtual display connect. |
| 60 | virtual void init(hwc_context_t *ctx); |
| 61 | // Destroys mdpcomp, copybit and fbupdate objects and for virtual display |
| 62 | // during virtual display disconnect. |
| 63 | virtual void destroy(hwc_context_t *ctx, size_t numDisplays, |
| 64 | hwc_display_contents_1_t** displays); |
Tatenda Chipeperekwa | 8f1b9d7 | 2014-02-11 16:20:50 -0800 | [diff] [blame] | 65 | virtual void pause(hwc_context_t* ctx, int dpy); |
| 66 | virtual void resume(hwc_context_t* ctx, int dpy); |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | class HWCVirtualV4L2 : public HWCVirtualBase { |
| 70 | public: |
| 71 | explicit HWCVirtualV4L2(){}; |
| 72 | virtual ~HWCVirtualV4L2(){}; |
| 73 | // Chooses composition type and configures pipe for each layer in virtual |
| 74 | // display list |
| 75 | virtual int prepare(hwc_composer_device_1 *dev, |
| 76 | hwc_display_contents_1_t* list); |
| 77 | // Queues the buffer for each layer in virtual display list and call |
| 78 | // display commit. |
| 79 | virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
| 80 | // instantiates mdpcomp, copybit and fbupdate objects and initialize those |
| 81 | // objects for virtual display during virtual display connect. This function |
| 82 | // is no-op for V4L2 design |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 83 | virtual void init(hwc_context_t *) {}; |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 84 | // Destroys mdpcomp, copybit and fbupdate objects and for virtual display |
| 85 | // during virtual display disconnect. This function is no-op for V4L2 design |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 86 | virtual void destroy(hwc_context_t *, size_t , |
| 87 | hwc_display_contents_1_t** ) {}; |
Tatenda Chipeperekwa | 8f1b9d7 | 2014-02-11 16:20:50 -0800 | [diff] [blame] | 88 | virtual void pause(hwc_context_t* ctx, int dpy); |
| 89 | virtual void resume(hwc_context_t* ctx, int dpy); |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | }; //namespace |
| 93 | #endif |