blob: 87004c3fae8fab6e42f377b924918ce3c954fbeb [file] [log] [blame]
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -08001/*
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 Chipeperekwa8f1b9d72014-02-11 16:20:50 -080025#include <virtual.h>
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080026
27namespace qhwc {
28namespace ovutils = overlay::utils;
29
30// Base and abstract class for VDS and V4L2 wfd design.
31class HWCVirtualBase {
32public:
33 explicit HWCVirtualBase(){};
34 virtual ~HWCVirtualBase(){};
35 // instantiates and returns the pointer to VDS or V4L2 object.
Raj kamal59fea562014-04-01 16:52:19 +053036 static HWCVirtualBase* getObject(bool isVDSEnabled);
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080037 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 Chipeperekwa8f1b9d72014-02-11 16:20:50 -080043 virtual void pause(hwc_context_t* ctx, int dpy) = 0;
44 virtual void resume(hwc_context_t* ctx, int dpy) = 0;
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080045};
46
47class HWCVirtualVDS : public HWCVirtualBase {
48public:
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 Chipeperekwa8f1b9d72014-02-11 16:20:50 -080065 virtual void pause(hwc_context_t* ctx, int dpy);
66 virtual void resume(hwc_context_t* ctx, int dpy);
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080067};
68
69class HWCVirtualV4L2 : public HWCVirtualBase {
70public:
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.R2aa44c62014-01-21 23:08:28 -080083 virtual void init(hwc_context_t *) {};
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080084 // 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.R2aa44c62014-01-21 23:08:28 -080086 virtual void destroy(hwc_context_t *, size_t ,
87 hwc_display_contents_1_t** ) {};
Tatenda Chipeperekwa8f1b9d72014-02-11 16:20:50 -080088 virtual void pause(hwc_context_t* ctx, int dpy);
89 virtual void resume(hwc_context_t* ctx, int dpy);
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080090};
91
92}; //namespace
93#endif