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 #include <virtual.h> 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: HWCVirtualBase()33 explicit HWCVirtualBase(){}; ~HWCVirtualBase()34 virtual ~HWCVirtualBase(){}; 35 // instantiates and returns the pointer to VDS or V4L2 object. 36 static HWCVirtualBase* getObject(bool isVDSEnabled); 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; 43 virtual void pause(hwc_context_t* ctx, int dpy) = 0; 44 virtual void resume(hwc_context_t* ctx, int dpy) = 0; 45 }; 46 47 class HWCVirtualVDS : public HWCVirtualBase { 48 public: HWCVirtualVDS()49 explicit HWCVirtualVDS(){}; ~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); 65 virtual void pause(hwc_context_t* ctx, int dpy); 66 virtual void resume(hwc_context_t* ctx, int dpy); 67 }; 68 69 class HWCVirtualV4L2 : public HWCVirtualBase { 70 public: HWCVirtualV4L2()71 explicit HWCVirtualV4L2(){}; ~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 init(hwc_context_t *)83 virtual void init(hwc_context_t *) {}; 84 // Destroys mdpcomp, copybit and fbupdate objects and for virtual display 85 // during virtual display disconnect. This function is no-op for V4L2 design destroy(hwc_context_t *,size_t,hwc_display_contents_1_t **)86 virtual void destroy(hwc_context_t *, size_t , 87 hwc_display_contents_1_t** ) {}; 88 virtual void pause(hwc_context_t* ctx, int dpy); 89 virtual void resume(hwc_context_t* ctx, int dpy); 90 }; 91 92 }; //namespace 93 #endif 94