1/*
2// Copyright (c) 2014 Intel Corporation 
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16#ifndef TNG_DISPLAY_CONTEXT_H
17#define TNG_DISPLAY_CONTEXT_H
18
19#include <IDisplayContext.h>
20#include <hal_public.h>
21
22typedef struct
23{
24	hwc_layer_1_t *psLayer;
25	uint32_t custom;
26}
27IMG_hwc_layer_t;
28
29typedef struct IMG_display_device_public
30{
31	int (*post)(struct IMG_display_device_public *dev,
32				IMG_hwc_layer_t *layers, int num_layers, int *releaseFenceFd);
33}
34IMG_display_device_public_t;
35
36namespace android {
37namespace intel {
38
39class TngDisplayContext : public IDisplayContext {
40public:
41    TngDisplayContext();
42    virtual ~TngDisplayContext();
43public:
44    bool initialize();
45    void deinitialize();
46    bool commitBegin(size_t numDisplays, hwc_display_contents_1_t **displays);
47    bool commitContents(hwc_display_contents_1_t *display, HwcLayerList* layerList);
48    bool commitEnd(size_t numDisplays, hwc_display_contents_1_t **displays);
49    bool compositionComplete();
50    bool setCursorPosition(int disp, int x, int y);
51
52private:
53    enum {
54        MAXIMUM_LAYER_NUMBER = 20,
55    };
56    IMG_display_device_public_t *mIMGDisplayDevice;
57    IMG_hwc_layer_t mImgLayers[MAXIMUM_LAYER_NUMBER];
58    bool mInitialized;
59    size_t mCount;
60};
61
62} // namespace intel
63} // namespace android
64
65#endif /* TNG_DISPLAY_CONTEXT_H */
66