1#pragma once
2/*
3 * Copyright (C) 2016 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include <vector>
19
20#include <hardware/gralloc.h>
21
22#include "guest/hals/gralloc/legacy/gralloc_vsoc_priv.h"
23
24#include "base_composer.h"
25#include "hwcomposer_common.h"
26
27namespace cvd {
28
29class VSoCComposer : public BaseComposer {
30 public:
31  VSoCComposer(int64_t vsync_base_timestamp, int32_t vsync_period_ns);
32  ~VSoCComposer();
33
34  // override
35  int PrepareLayers(size_t num_layers, vsoc_hwc_layer* layers);
36  // override
37  int SetLayers(size_t num_layers, vsoc_hwc_layer* layers);
38
39 protected:
40  static const int kNumTmpBufferPieces;
41  uint8_t* RotateTmpBuffer(unsigned int order);
42  uint8_t* GetSpecialTmpBuffer(size_t needed_size);
43  void CompositeLayer(vsoc_hwc_layer* src_layer, int32_t fb_offset);
44  std::vector<uint8_t> tmp_buffer_;
45  std::vector<uint8_t> special_tmp_buffer_;
46};
47
48}  // namespace cvd
49