Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
Sean Paul | 468a754 | 2024-07-16 19:50:58 +0000 | [diff] [blame^] | 17 | #define LOG_TAG "drmhwc" |
Roman Stratiienko | 027987b | 2022-01-30 21:06:35 +0200 | [diff] [blame] | 18 | |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 19 | #include "DrmEncoder.h" |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 20 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 21 | #include <xf86drmMode.h> |
| 22 | |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 23 | #include <cstdint> |
| 24 | |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 25 | #include "DrmDevice.h" |
Roman Stratiienko | 027987b | 2022-01-30 21:06:35 +0200 | [diff] [blame] | 26 | #include "utils/log.h" |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 27 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 28 | namespace android { |
| 29 | |
Roman Stratiienko | 027987b | 2022-01-30 21:06:35 +0200 | [diff] [blame] | 30 | auto DrmEncoder::CreateInstance(DrmDevice &dev, uint32_t encoder_id, |
| 31 | uint32_t index) -> std::unique_ptr<DrmEncoder> { |
Roman Stratiienko | 7689278 | 2023-01-16 17:15:53 +0200 | [diff] [blame] | 32 | auto e = MakeDrmModeEncoderUnique(*dev.GetFd(), encoder_id); |
Roman Stratiienko | 027987b | 2022-01-30 21:06:35 +0200 | [diff] [blame] | 33 | if (!e) { |
| 34 | ALOGE("Failed to get encoder %d", encoder_id); |
| 35 | return {}; |
| 36 | } |
| 37 | |
| 38 | return std::unique_ptr<DrmEncoder>(new DrmEncoder(std::move(e), index)); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 39 | } |
| 40 | |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 41 | } // namespace android |