Add and use DisplayHotplugConnectModeDetectedAtomReporter, which logs all valid modes of a hotplugged display. Change-Id: Ie93487ad8e4936195e3d949ce46034c5ec4fda83
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2025 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.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
namespace android::drm_hwcomposer {
|
|
class DisplayHotplugConnectModeDetectedAtomReporter {
|
|
public:
|
|
static std::unique_ptr<DisplayHotplugConnectModeDetectedAtomReporter>
|
|
Create();
|
|
|
|
enum class DisplayType {
|
|
kUnspecified = 0,
|
|
kInternal,
|
|
kExternal,
|
|
};
|
|
|
|
struct Atom {
|
|
int64_t display_handle = 0;
|
|
int32_t resolution_x = 0;
|
|
int32_t resolution_y = 0;
|
|
int32_t refresh_rate = 0;
|
|
int32_t dpi_x = 0;
|
|
int32_t dpi_y = 0;
|
|
DisplayType display_type = DisplayType::kUnspecified;
|
|
bool is_preferred = false;
|
|
|
|
bool operator==(const Atom& other) const {
|
|
return display_handle == other.display_handle &&
|
|
resolution_x == other.resolution_x &&
|
|
resolution_y == other.resolution_y &&
|
|
refresh_rate == other.refresh_rate && dpi_x == other.dpi_x &&
|
|
dpi_y == other.dpi_y && display_type == other.display_type &&
|
|
is_preferred == other.is_preferred;
|
|
};
|
|
};
|
|
|
|
// Pushes a Vendor Atom to IStats::reportVendorAtom.
|
|
virtual void PushAtom(Atom atom) = 0;
|
|
virtual ~DisplayHotplugConnectModeDetectedAtomReporter() = default;
|
|
};
|
|
|
|
} // namespace android::drm_hwcomposer
|