• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2019 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 
15 #ifndef COMPUTEPIPE_RUNNER_ENGINE_CONFIGBUILDER_H_
16 #define COMPUTEPIPE_RUNNER_ENGINE_CONFIGBUILDER_H_
17 
18 #include "ProfilingType.pb.h"
19 
20 #include "RunnerComponent.h"
21 #include "types/Status.h"
22 
23 namespace android {
24 namespace automotive {
25 namespace computepipe {
26 namespace runner {
27 namespace engine {
28 
29 class ConfigBuilder {
30   public:
31     /**
32      * Set debug display stream in the final client config
33      */
34     void setDebugDisplayStream(int id);
35     /**
36      * Does client explicitly enable display stream
37      */
38     bool clientConfigEnablesDisplayStream();
39     /**
40      * Update current input option
41      */
42     ConfigBuilder& updateInputConfigOption(int id);
43     /**
44      * Update current output options
45      */
46     ConfigBuilder& updateOutputStreamOption(int id, int maxInFlightPackets);
47     /**
48      * Update current termination options
49      */
50     ConfigBuilder& updateTerminationOption(int id);
51     /**
52      * Update current offload options
53      */
54     ConfigBuilder& updateOffloadOption(int id);
55     /**
56      * Update optional Config
57      */
58     ConfigBuilder& updateOptionalConfig(std::string options);
59     /**
60      * Update profiling Config
61      */
62     ConfigBuilder& updateProfilingType(proto::ProfilingType profilingType);
63     /**
64      * Emit Options
65      */
66     ClientConfig emitClientOptions();
67     /**
68      * Clear current options.
69      */
70     ConfigBuilder& reset();
71 
72   private:
73     int mDisplayStream = ClientConfig::kInvalidId;
74     int mInputConfigId = ClientConfig::kInvalidId;
75     int mOffloadId = ClientConfig::kInvalidId;
76     int mTerminationId = ClientConfig::kInvalidId;
77     proto::ProfilingType mProfilingType = proto::ProfilingType::DISABLED;
78     bool mConfigHasDisplayStream = false;
79     std::map<int, int> mOutputConfig;
80     std::string mOptionalConfig;
81 };
82 
83 }  // namespace engine
84 }  // namespace runner
85 }  // namespace computepipe
86 }  // namespace automotive
87 }  // namespace android
88 
89 #endif  // COMPUTEPIPE_RUNNER_ENGINE_CONFIGBUILDER_H_
90