• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2016 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 express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #pragma once
15 
16 #include "RenderLib.h"
17 
18 #include "base/Compiler.h"
19 #include "host-common/vm_operations.h"
20 #include "host-common/misc.h"
21 
22 #include <memory>
23 
24 namespace emugl {
25 
26 class RenderLibImpl final : public RenderLib {
27 public:
28     RenderLibImpl() = default;
29 
30     virtual void setRenderer(SelectedRenderer renderer) override;
31     virtual void setAvdInfo(bool phone, int api) override;
32     virtual void getGlesVersion(int* maj, int* min) override;
33     virtual void setLogger(emugl_logger_struct logger) override;
34     virtual void setGLObjectCounter(
35             android::base::GLObjectCounter* counter) override;
36     virtual void setCrashReporter(emugl_crash_reporter_t reporter) override;
37     virtual void setFeatureController(emugl_feature_is_enabled_t featureController) override;
38     virtual void setSyncDevice(emugl_sync_create_timeline_t,
39                                emugl_sync_create_fence_t,
40                                emugl_sync_timeline_inc_t,
41                                emugl_sync_destroy_timeline_t,
42                                emugl_sync_register_trigger_wait_t,
43                                emugl_sync_device_exists_t) override;
44 
45     virtual void setDmaOps(emugl_dma_ops) override;
46 
47     virtual void setVmOps(const QAndroidVmOperations &vm_operations) override;
48     virtual void setAddressSpaceDeviceControlOps(struct address_space_device_control_ops* ops) override;
49 
50     virtual void setWindowOps(const QAndroidEmulatorWindowAgent &window_operations,
51                               const QAndroidMultiDisplayAgent &multi_display_operations) override;
52 
53     virtual void setUsageTracker(android::base::CpuUsage* cpuUsage,
54                                  android::base::MemoryTracker* memUsage) override;
55 
56     virtual void* getGLESv2Dispatch(void) override;
57 
58     virtual void* getEGLDispatch(void) override;
59 
60     virtual bool getOpt(RenderOpt* opt) override;
61 
62     virtual RendererPtr initRenderer(int width,
63                                      int height,
64                                      bool useSubWindow,
65                                      bool egl2egl) override;
66 
67     OnLastColorBufferRef getOnLastColorBufferRef() override;
68 
69 private:
70     DISALLOW_COPY_ASSIGN_AND_MOVE(RenderLibImpl);
71 
72 private:
73     std::weak_ptr<Renderer> mRenderer;
74 };
75 
76 }  // namespace emugl
77