• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 #ifndef ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
18 #define ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
19 
20 #include <android/frameworks/vr/composer/2.0/IVrComposerClient.h>
21 #include <composer-command-buffer/2.3/ComposerCommandBuffer.h>
22 #include <composer-hal/2.1/ComposerClient.h>
23 #include <composer-hal/2.1/ComposerCommandEngine.h>
24 #include <composer-hal/2.2/ComposerClient.h>
25 #include <composer-hal/2.3/ComposerClient.h>
26 
27 namespace android {
28 namespace dvr {
29 
30 class VrHwc;
31 
32 using hardware::graphics::composer::V2_1::hal::ComposerCommandEngine;
33 using hardware::graphics::composer::V2_3::hal::ComposerHal;
34 using hardware::graphics::composer::V2_3::hal::detail::ComposerClientImpl;
35 
36 using ComposerClient = ComposerClientImpl<IVrComposerClient, ComposerHal>;
37 
38 class VrComposerClient : public ComposerClient {
39  public:
40   explicit VrComposerClient(android::dvr::VrHwc& hal);
41   virtual ~VrComposerClient();
42 
43  private:
44   class VrCommandEngine : public ComposerCommandEngine {
45    public:
46     explicit VrCommandEngine(VrComposerClient& client);
47     ~VrCommandEngine() override;
48 
49     bool executeCommand(
50         hardware::graphics::composer::V2_1::IComposerClient::Command command,
51         uint16_t length) override;
52 
53    private:
54     bool executeSetLayerInfo(uint16_t length);
55     bool executeSetClientTargetMetadata(uint16_t length);
56     bool executeSetLayerBufferMetadata(uint16_t length);
57 
58     IVrComposerClient::BufferMetadata readBufferMetadata();
59 
60     android::dvr::VrHwc& mVrHal;
61 
62     VrCommandEngine(const VrCommandEngine&) = delete;
63     void operator=(const VrCommandEngine&) = delete;
64   };
65 
66   VrComposerClient(const VrComposerClient&) = delete;
67   void operator=(const VrComposerClient&) = delete;
68 
69   std::unique_ptr<ComposerCommandEngine> createCommandEngine() override;
70   dvr::VrHwc& mVrHal;
71 };
72 
73 } // namespace dvr
74 } // namespace android
75 
76 #endif  // ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
77