1
0
Fork 0
android_external_drm_hwcomp.../drm/DrmEncoder.cpp
Andrew Wolfers 1e0e2ca0a5 Move implementations out of headers
This change moves some non-trivial implementations out of header
files in drm/. This will enable some includes to be converted to
forward declarations in future changes.

Change-Id: I7b1248657e0fa27e3c0c0157abe4f6b918e13a29
2025-11-11 17:01:13 +00:00

49 lines
1.4 KiB
C++

/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "drmhwc"
#include "DrmEncoder.h"
#include <xf86drmMode.h>
#include <cstdint>
#include "DrmDevice.h"
#include "utils/log.h"
namespace android::drm_hwcomposer {
auto DrmEncoder::CreateInstance(DrmDevice &dev, uint32_t encoder_id,
uint32_t index) -> std::unique_ptr<DrmEncoder> {
auto e = MakeDrmModeEncoderUnique(*dev.GetFd(), encoder_id);
if (!e) {
ALOGE("Failed to get encoder %d", encoder_id);
return {};
}
return std::unique_ptr<DrmEncoder>(new DrmEncoder(std::move(e), index));
}
bool DrmEncoder::CanClone(DrmEncoder &encoder) {
return (enc_->possible_clones & (1 << encoder.GetIndexInResArray())) != 0;
}
bool DrmEncoder::SupportsCrtc(DrmCrtc &crtc) {
return (enc_->possible_crtcs & (1 << crtc.GetIndexInResArray())) != 0;
}
} // namespace android::drm_hwcomposer