2 // Copyright (c) 2016 Intel Corporation
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 COMMON_COMPOSITOR_COMPOSITOR_H_
18 #define COMMON_COMPOSITOR_COMPOSITOR_H_
20 #include <platformdefines.h>
25 #include "compositionregion.h"
26 #include "displayplanestate.h"
27 #include "renderstate.h"
28 #include "compositorthread.h"
31 namespace hwcomposer {
33 class DisplayPlaneManager;
34 class ResourceManager;
42 void Init(ResourceManager *buffer_manager, uint32_t gpu_fd);
45 Compositor(const Compositor &) = delete;
47 bool BeginFrame(bool disable_explicit_sync);
48 bool Draw(DisplayPlaneStateList &planes, std::vector<OverlayLayer> &layers,
49 const std::vector<HwcRect<int>> &display_frame);
50 bool DrawOffscreen(std::vector<OverlayLayer> &layers,
51 const std::vector<HwcRect<int>> &display_frame,
52 const std::vector<size_t> &source_layers,
53 ResourceManager *resource_manager, uint32_t width,
54 uint32_t height, HWCNativeHandle output_handle,
55 int32_t acquire_fence, int32_t *retire_fence);
58 void SetVideoColor(HWCColorControl color, float value);
59 void GetVideoColor(HWCColorControl color, float *value, float *start,
61 void RestoreVideoDefaultColor(HWCColorControl color);
64 bool CalculateRenderState(std::vector<OverlayLayer> &layers,
65 const std::vector<CompositionRegion> &comp_regions,
66 DrawState &state, bool uses_display_up_scaling,
67 bool use_plane_transform = false);
68 void SeparateLayers(const std::vector<size_t> &dedicated_layers,
69 const std::vector<size_t> &source_layers,
70 const std::vector<HwcRect<int>> &display_frame,
71 const HwcRect<int> &damage_region,
72 std::vector<CompositionRegion> &comp_regions);
74 std::unique_ptr<CompositorThread> thread_;
79 } // namespace hwcomposer
80 #endif // COMMON_COMPOSITOR_COMPOSITOR_H_