2 * Copyright (C) 2015 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_DRM_DISPLAY_COMPOSITION_H_
18 #define ANDROID_DRM_DISPLAY_COMPOSITION_H_
20 #include "drm_hwcomposer.h"
26 #include <hardware/hardware.h>
27 #include <hardware/hwcomposer.h>
31 enum DrmCompositionType {
32 DRM_COMPOSITION_TYPE_EMPTY,
33 DRM_COMPOSITION_TYPE_FRAME,
36 typedef struct DrmCompositionLayer {
37 DrmCompositionLayer();
38 ~DrmCompositionLayer();
44 } DrmCompositionLayer_t;
45 typedef std::vector<DrmCompositionLayer_t> DrmCompositionLayerVector_t;
47 class DrmDisplayComposition {
49 DrmDisplayComposition();
50 ~DrmDisplayComposition();
52 int Init(DrmResources *drm, Importer *importer);
54 DrmCompositionType type() const;
56 int AddLayer(hwc_layer_1_t *layer, hwc_drm_bo_t *bo, DrmCrtc *crtc,
59 int FinishComposition();
61 DrmCompositionLayerVector_t *GetCompositionLayers();
64 DrmDisplayComposition(const DrmDisplayComposition &) = delete;
66 bool validate_composition_type(DrmCompositionType desired);
71 DrmCompositionType type_;
76 DrmCompositionLayerVector_t layers_;
80 #endif // ANDROID_DRM_DISPLAY_COMPOSITION_H_