blob: cf0336000e0f7c4556e210c5abce06b2b4f275ce [file] [log] [blame]
Sean Paul98e73c82015-06-24 14:38:49 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
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
17#ifndef ANDROID_DRM_DISPLAY_COMPOSITION_H_
18#define ANDROID_DRM_DISPLAY_COMPOSITION_H_
19
20#include "drm_hwcomposer.h"
21#include "drmplane.h"
22#include "importer.h"
23
24#include <vector>
25
26#include <hardware/hardware.h>
27#include <hardware/hwcomposer.h>
28
29namespace android {
30
31typedef struct DrmCompositionLayer {
32 DrmCompositionLayer();
33 ~DrmCompositionLayer();
34
35 hwc_layer_1_t layer;
36 hwc_drm_bo_t bo;
37 DrmCrtc *crtc;
38 DrmPlane *plane;
39} DrmCompositionLayer_t;
40typedef std::vector<DrmCompositionLayer_t> DrmCompositionLayerVector_t;
41
42class DrmDisplayComposition {
43 public:
44 DrmDisplayComposition();
45 ~DrmDisplayComposition();
46
47 int Init(DrmResources *drm, Importer *importer);
48
49 int AddLayer(hwc_layer_1_t *layer, hwc_drm_bo_t *bo, DrmCrtc *crtc,
50 DrmPlane *plane);
51
52 int FinishComposition();
53
54 DrmCompositionLayerVector_t *GetCompositionLayers();
55
56 private:
57 DrmDisplayComposition(const DrmDisplayComposition &) = delete;
58
59 DrmResources *drm_;
60 Importer *importer_;
61
62 int timeline_fd_;
63 int timeline_;
64
65 DrmCompositionLayerVector_t layers_;
66};
67}
68
69#endif // ANDROID_DRM_DISPLAY_COMPOSITION_H_