• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expresso or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "Gralloc.h"
18 
19 namespace gfxstream {
20 
21 class GoldfishGralloc : public Gralloc {
22    public:
23     uint32_t createColorBuffer(void* rcEnc, int width, int height,
24                                uint32_t glformat) override;
25 
26     int allocate(uint32_t width,
27                  uint32_t height,
28                  uint32_t format,
29                  uint64_t usage,
30                  AHardwareBuffer** outputAhb) override;
31 
32     void acquire(AHardwareBuffer* ahb) override;
33     void release(AHardwareBuffer* ahb) override;
34 
35     uint32_t getHostHandle(native_handle_t const* handle) override;
36     uint32_t getHostHandle(const AHardwareBuffer* handle) override;
37 
38     int getFormat(const native_handle_t* handle) override;
39     int getFormat(const AHardwareBuffer* handle) override;
40 
41     size_t getAllocatedSize(const native_handle_t* handle) override;
42     size_t getAllocatedSize(const AHardwareBuffer* handle) override;
43 
44     bool treatBlobAsImage() override;
45 };
46 
47 
48 }  // namespace gfxstream
49