1 // Copyright (C) 2023 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License") override; 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 #pragma once 16 17 #include <memory> 18 #include <optional> 19 20 #include "aemu/base/Compiler.h" 21 22 namespace gfxstream { 23 namespace magma { 24 25 class Connection; 26 27 class DrmContext { 28 public: 29 ~DrmContext(); 30 DISALLOW_COPY_AND_ASSIGN(DrmContext); 31 DrmContext(DrmContext&&) noexcept; 32 DrmContext& operator=(DrmContext&&) = delete; 33 34 static std::unique_ptr<DrmContext> create(Connection& connection); 35 uint32_t getId(); 36 37 private: 38 DrmContext(Connection& device); 39 40 Connection& mConnection; 41 std::optional<uint32_t> mId; 42 }; 43 44 } // namespace magma 45 } // namespace gfxstream 46