Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 1 | /* |
| 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_COMPOSITION_H_ |
| 18 | #define ANDROID_DRM_COMPOSITION_H_ |
| 19 | |
| 20 | #include "compositor.h" |
| 21 | #include "drm_hwcomposer.h" |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 22 | #include "drmdisplaycomposition.h" |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 23 | #include "drmplane.h" |
| 24 | #include "importer.h" |
| 25 | |
| 26 | #include <deque> |
| 27 | #include <map> |
| 28 | #include <vector> |
| 29 | |
| 30 | #include <hardware/hardware.h> |
| 31 | #include <hardware/hwcomposer.h> |
| 32 | |
| 33 | namespace android { |
| 34 | |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 35 | class DrmComposition : public Composition { |
| 36 | public: |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 37 | DrmComposition(DrmResources *drm, Importer *importer); |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 38 | ~DrmComposition(); |
| 39 | |
| 40 | virtual int Init(); |
| 41 | |
| 42 | virtual unsigned GetRemainingLayers(int display, unsigned num_needed) const; |
| 43 | virtual int AddLayer(int display, hwc_layer_1_t *layer, hwc_drm_bo_t *bo); |
Sean Paul | db7a17d | 2015-06-24 18:46:05 -0700 | [diff] [blame] | 44 | int AddDpmsMode(int display, uint32_t dpms_mode); |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 45 | |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 46 | std::unique_ptr<DrmDisplayComposition> TakeDisplayComposition(int display); |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 47 | |
| 48 | private: |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 49 | DrmComposition(const DrmComposition &) = delete; |
| 50 | |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 51 | DrmResources *drm_; |
| 52 | Importer *importer_; |
| 53 | |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 54 | std::vector<DrmPlane *> primary_planes_; |
Sean Paul | 9099aa5 | 2015-07-09 17:51:50 -0400 | [diff] [blame^] | 55 | std::vector<DrmPlane *> overlay_planes_; |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 56 | |
| 57 | /* |
| 58 | * This _must_ be read-only after it's passed to QueueComposition. Otherwise |
| 59 | * locking is required to maintain consistency across the compositor threads. |
| 60 | */ |
| 61 | std::map<int, std::unique_ptr<DrmDisplayComposition>> composition_map_; |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 62 | }; |
Sean Paul | 98e73c8 | 2015-06-24 14:38:49 -0700 | [diff] [blame] | 63 | |
Sean Paul | b386f1b | 2015-05-13 06:33:23 -0700 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | #endif // ANDROID_DRM_COMPOSITION_H_ |