drm_hwcomposer: Remove HWC2 SetActiveConfig
Move the function to the HWC2 frontend, and implement the function in terms of HwcDisplay::QueueConfig Change-Id: Ia47503ac7463041c36ed4e6ad5374b3491019c2d Signed-off-by: Drew Davenport <ddavenport@google.com>
This commit is contained in:
parent
44111f0af7
commit
c8ace00f91
3 changed files with 28 additions and 26 deletions
|
|
@ -1017,18 +1017,6 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
return HWC2::Error::None;
|
||||
}
|
||||
|
||||
HWC2::Error HwcDisplay::SetActiveConfig(hwc2_config_t config) {
|
||||
if (configs_.hwc_configs.count(config) == 0) {
|
||||
ALOGE("Could not find active mode for %u", config);
|
||||
return HWC2::Error::BadConfig;
|
||||
}
|
||||
|
||||
staged_mode_change_time_ = ResourceManager::GetTimeMonotonicNs();
|
||||
staged_mode_config_id_ = config;
|
||||
|
||||
return HWC2::Error::None;
|
||||
}
|
||||
|
||||
HWC2::Error HwcDisplay::SetColorMode(int32_t mode) {
|
||||
/* Maps to the Colorspace DRM connector property:
|
||||
* https://elixir.bootlin.com/linux/v6.11/source/include/drm/drm_connector.h#L538
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ class HwcDisplay {
|
|||
float *max_luminance,
|
||||
float *max_average_luminance,
|
||||
float *min_luminance);
|
||||
HWC2::Error SetActiveConfig(hwc2_config_t config);
|
||||
HWC2::Error SetColorMode(int32_t mode);
|
||||
HWC2::Error SetColorTransform(const float *matrix, int32_t hint);
|
||||
HwcLayer *get_layer(ILayerId layer) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
static int32_t ConfigErrorToHWC2(HwcDisplay::ConfigError result) {
|
||||
switch (result) {
|
||||
case HwcDisplay::ConfigError::kBadConfig:
|
||||
return static_cast<int32_t>(HWC2::Error::BadConfig);
|
||||
case HwcDisplay::ConfigError::kSeamlessNotAllowed:
|
||||
return static_cast<int32_t>(HWC2::Error::SeamlessNotAllowed);
|
||||
case HwcDisplay::ConfigError::kSeamlessNotPossible:
|
||||
return static_cast<int32_t>(HWC2::Error::SeamlessNotPossible);
|
||||
case HwcDisplay::ConfigError::kNone:
|
||||
return static_cast<int32_t>(HWC2::Error::None);
|
||||
}
|
||||
}
|
||||
|
||||
/* Converts long __PRETTY_FUNCTION__ result, e.g.:
|
||||
* "int32_t android::LayerHook(hwc2_device_t *, hwc2_display_t, hwc2_layer_t,"
|
||||
* "Args...) [HookType = HWC2::Error (android::HwcLayer::*)(const native_handle"
|
||||
|
|
@ -582,6 +595,19 @@ static int32_t PresentDisplay(hwc2_device_t *device, hwc2_display_t display,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t SetActiveConfig(hwc2_device_t *device, hwc2_display_t display,
|
||||
hwc2_config_t config) {
|
||||
ALOGV("SetActiveConfig");
|
||||
LOCK_COMPOSER(device);
|
||||
GET_DISPLAY(display);
|
||||
|
||||
QueuedConfigTiming out_timing{};
|
||||
auto result = idisplay->QueueConfig(config,
|
||||
ResourceManager::GetTimeMonotonicNs(),
|
||||
false, &out_timing);
|
||||
return ConfigErrorToHWC2(result);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= 28
|
||||
|
||||
static int32_t GetDisplayBrightnessSupport(hwc2_device_t * /*device*/,
|
||||
|
|
@ -714,16 +740,7 @@ static int32_t SetActiveConfigWithConstraints(
|
|||
out_timeline->refreshTimeNanos = out_timing.refresh_time_ns;
|
||||
out_timeline->refreshRequired = 1;
|
||||
|
||||
switch (result) {
|
||||
case HwcDisplay::ConfigError::kBadConfig:
|
||||
return static_cast<int32_t>(HWC2::Error::BadConfig);
|
||||
case HwcDisplay::ConfigError::kSeamlessNotAllowed:
|
||||
return static_cast<int32_t>(HWC2::Error::SeamlessNotAllowed);
|
||||
case HwcDisplay::ConfigError::kSeamlessNotPossible:
|
||||
return static_cast<int32_t>(HWC2::Error::SeamlessNotPossible);
|
||||
case HwcDisplay::ConfigError::kNone:
|
||||
return static_cast<int32_t>(HWC2::Error::None);
|
||||
}
|
||||
return ConfigErrorToHWC2(result);
|
||||
}
|
||||
|
||||
static int32_t SetAutoLowLatencyMode(hwc2_device_t * /*device*/,
|
||||
|
|
@ -1063,9 +1080,7 @@ static hwc2_function_pointer_t HookDevGetFunction(struct hwc2_device * /*dev*/,
|
|||
case HWC2::FunctionDescriptor::PresentDisplay:
|
||||
return (hwc2_function_pointer_t)PresentDisplay;
|
||||
case HWC2::FunctionDescriptor::SetActiveConfig:
|
||||
return ToHook<HWC2_PFN_SET_ACTIVE_CONFIG>(
|
||||
DisplayHook<decltype(&HwcDisplay::SetActiveConfig),
|
||||
&HwcDisplay::SetActiveConfig, hwc2_config_t>);
|
||||
return (hwc2_function_pointer_t)SetActiveConfig;
|
||||
case HWC2::FunctionDescriptor::SetClientTarget:
|
||||
return (hwc2_function_pointer_t)SetClientTarget;
|
||||
case HWC2::FunctionDescriptor::SetColorMode:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue