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/1.0/IVrComposerClient.h> 21 #include <ComposerClient.h> 22 #include <IComposerCommandBuffer.h> 23 24 namespace android { 25 namespace dvr { 26 27 class VrHwc; 28 29 using hardware::graphics::common::V1_0::PixelFormat; 30 using hardware::graphics::composer::V2_1::implementation::ComposerClient; 31 32 class VrComposerClient : public ComposerClient { 33 public: 34 VrComposerClient(android::dvr::VrHwc& hal); 35 virtual ~VrComposerClient(); 36 37 private: 38 class VrCommandReader : public ComposerClient::CommandReader { 39 public: 40 VrCommandReader(VrComposerClient& client); 41 ~VrCommandReader() override; 42 43 bool parseCommand(IComposerClient::Command command, 44 uint16_t length) override; 45 46 private: 47 bool parseSetLayerInfo(uint16_t length); 48 bool parseSetClientTargetMetadata(uint16_t length); 49 bool parseSetLayerBufferMetadata(uint16_t length); 50 51 IVrComposerClient::BufferMetadata readBufferMetadata(); 52 53 VrComposerClient& mVrClient; 54 android::dvr::VrHwc& mVrHal; 55 56 VrCommandReader(const VrCommandReader&) = delete; 57 void operator=(const VrCommandReader&) = delete; 58 }; 59 60 std::unique_ptr<CommandReader> createCommandReader() override; 61 62 dvr::VrHwc& mVrHal; 63 64 VrComposerClient(const VrComposerClient&) = delete; 65 void operator=(const VrComposerClient&) = delete; 66 }; 67 68 } // namespace dvr 69 } // namespace android 70 71 #endif // ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H 72