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 26 namespace qhwc { 27 namespace ovutils = overlay::utils; 28 29 // Base and abstract class for VDS and V4L2 wfd design. 30 class HWCVirtualBase { 31 public: 32 explicit HWCVirtualBase(){}; 33 virtual ~HWCVirtualBase(){}; 34 // instantiates and returns the pointer to VDS or V4L2 object. 35 static HWCVirtualBase* getObject(); 36 virtual int prepare(hwc_composer_device_1 *dev, 37 hwc_display_contents_1_t* list) = 0; 38 virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0; 39 virtual void init(hwc_context_t *ctx) = 0; 40 virtual void destroy(hwc_context_t *ctx, size_t numDisplays, 41 hwc_display_contents_1_t** displays) = 0; 42 }; 43 44 class HWCVirtualVDS : public HWCVirtualBase { 45 public: 46 explicit HWCVirtualVDS(){}; 47 virtual ~HWCVirtualVDS(){}; 48 // Chooses composition type and configures pipe for each layer in virtual 49 // display list 50 virtual int prepare(hwc_composer_device_1 *dev, 51 hwc_display_contents_1_t* list); 52 // Queues the buffer for each layer in virtual display list and call display 53 // commit. 54 virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list); 55 // instantiates mdpcomp, copybit and fbupdate objects and initialize those 56 // objects for virtual display during virtual display connect. 57 virtual void init(hwc_context_t *ctx); 58 // Destroys mdpcomp, copybit and fbupdate objects and for virtual display 59 // during virtual display disconnect. 60 virtual void destroy(hwc_context_t *ctx, size_t numDisplays, 61 hwc_display_contents_1_t** displays); 62 }; 63 64 class HWCVirtualV4L2 : public HWCVirtualBase { 65 public: 66 explicit HWCVirtualV4L2(){}; 67 virtual ~HWCVirtualV4L2(){}; 68 // Chooses composition type and configures pipe for each layer in virtual 69 // display list 70 virtual int prepare(hwc_composer_device_1 *dev, 71 hwc_display_contents_1_t* list); 72 // Queues the buffer for each layer in virtual display list and call 73 // display commit. 74 virtual int set(hwc_context_t *ctx, hwc_display_contents_1_t *list); 75 // instantiates mdpcomp, copybit and fbupdate objects and initialize those 76 // objects for virtual display during virtual display connect. This function 77 // is no-op for V4L2 design 78 virtual void init(hwc_context_t *) {}; 79 // Destroys mdpcomp, copybit and fbupdate objects and for virtual display 80 // during virtual display disconnect. This function is no-op for V4L2 design 81 virtual void destroy(hwc_context_t *, size_t , 82 hwc_display_contents_1_t** ) {}; 83 }; 84 85 }; //namespace 86 #endif 87