summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2021-11-25 20:59:37 -0800
committerLinux Build Service Account <lnxbuild@localhost>2021-11-25 20:59:37 -0800
commit52b0de453b251aff905a1be8d1104d1ecc756661 (patch)
tree375bbaa9aa674dbbce0d22bc398768a5af5ec0d1
parent805601e0c79044ab6a6de43d2a3faba4e625c168 (diff)
parentb1b65185bef87e29540deb3bbfa2812f798215e4 (diff)
Merge b1b65185bef87e29540deb3bbfa2812f798215e4 on remote branch
Change-Id: Iafd726cf65f030b3ca1e6f9bf9ad5a95da71cb02
-rw-r--r--liblight/lights.c6
-rw-r--r--sdm/include/core/display_interface.h2
-rw-r--r--sdm/libs/hwc2/hwc_display.cpp15
-rw-r--r--sdm/libs/hwc2/hwc_display.h2
-rw-r--r--sdm/libs/hwc2/hwc_display_builtin.cpp24
-rw-r--r--sdm/libs/hwc2/hwc_display_builtin.h1
-rw-r--r--sdm/libs/hwc2/hwc_session.cpp65
-rw-r--r--sdm/libs/hwc2/hwc_session.h8
8 files changed, 85 insertions, 38 deletions
diff --git a/liblight/lights.c b/liblight/lights.c
index f74fb542..f21af594 100644
--- a/liblight/lights.c
+++ b/liblight/lights.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014, 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (C) 2014, 2017-2018, 2021 The Linux Foundation. All rights reserved.
* Not a contribution
* Copyright (C) 2008 The Android Open Source Project
*
@@ -164,8 +164,10 @@ set_light_backlight(struct light_device_t* dev,
if (!err) {
if (!access(LCD_FILE, F_OK)) {
err = write_int(LCD_FILE, brightness);
- } else {
+ } else if (!access(LCD_FILE2, F_OK)) {
err = write_int(LCD_FILE2, brightness);
+ } else {
+ ALOGE("No LCD file found!");
}
}
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index 8341f528..4ef6fe98 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -219,7 +219,7 @@ struct DisplayConfigVariableInfo : public DisplayConfigGroupInfo {
bool operator==(const DisplayConfigVariableInfo& info) const {
return ((x_pixels == info.x_pixels) && (y_pixels == info.y_pixels) && (x_dpi == info.x_dpi) &&
(y_dpi == info.y_dpi) && (fps == info.fps) && (vsync_period_ns == info.vsync_period_ns)
- && (is_yuv == info.is_yuv) && (smart_panel == info.smart_panel));
+ && (is_yuv == info.is_yuv));
}
};
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 937c0a78..2b67f8fd 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -550,11 +550,18 @@ void HWCDisplay::UpdateConfigs() {
DisplayConfigVariableInfo info = {};
GetDisplayAttributesForConfig(INT(i), &info);
bool config_exists = false;
+
+ if (!smart_panel_config_ && info.smart_panel) {
+ smart_panel_config_ = true;
+ }
+
for (auto &config : variable_config_map_) {
if (config.second == info) {
- config_exists = true;
- hwc_config_map_.at(i) = config.first;
- break;
+ if (enable_poms_during_doze_ || (config.second.smart_panel == info.smart_panel)) {
+ config_exists = true;
+ hwc_config_map_.at(i) = config.first;
+ break;
+ }
}
}
@@ -566,7 +573,7 @@ void HWCDisplay::UpdateConfigs() {
// Update num config count.
num_configs_ = UINT32(variable_config_map_.size());
- DLOGI("num_configs = %d", num_configs_);
+ DLOGI("num_configs = %d smart_panel_config_ = %d", num_configs_, smart_panel_config_);
}
int HWCDisplay::Deinit() {
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 056ab6ec..01dd66c5 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -469,6 +469,8 @@ class HWCDisplay : public DisplayEventHandler {
bool fast_path_composition_ = false;
bool client_connected_ = true;
bool pending_config_ = false;
+ bool smart_panel_config_ = false;
+ bool enable_poms_during_doze_ = false;
uint32_t vsyncs_to_apply_rate_change_ = 1;
hwc2_config_t pending_refresh_rate_config_ = UINT_MAX;
int64_t pending_refresh_rate_refresh_time_ = INT64_MAX;
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index bbec3f75..235cab95 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -157,6 +157,13 @@ int HWCDisplayBuiltIn::Init() {
use_metadata_refresh_rate_ = false;
}
+ int value = 0;
+ HWCDebugHandler::Get()->GetProperty(ENABLE_POMS_DURING_DOZE, &value);
+ enable_poms_during_doze_ = (value == 1);
+ if (enable_poms_during_doze_) {
+ DLOGI("Enable POMS during Doze mode %" PRIu64 , id_);
+ }
+
int status = HWCDisplay::Init();
if (status) {
return status;
@@ -166,20 +173,13 @@ int HWCDisplayBuiltIn::Init() {
HWCDebugHandler::Get()->GetProperty(ENABLE_DEFAULT_COLOR_MODE,
&default_mode_status_);
- int value = 0;
+ value = 0;
HWCDebugHandler::Get()->GetProperty(ENABLE_OPTIMIZE_REFRESH, &value);
enable_optimize_refresh_ = (value == 1);
if (enable_optimize_refresh_) {
DLOGI("Drop redundant drawcycles %d", id_);
}
- value = 0;
- HWCDebugHandler::Get()->GetProperty(ENABLE_POMS_DURING_DOZE, &value);
- enable_poms_during_doze_ = (value == 1);
- if (enable_poms_during_doze_) {
- DLOGI("Enable POMS during Doze mode %" PRIu64 , id_);
- }
-
int vsyncs = 0;
HWCDebugHandler::Get()->GetProperty(DEFER_FPS_FRAME_COUNT, &vsyncs);
if (vsyncs > 0) {
@@ -1064,13 +1064,7 @@ bool HWCDisplayBuiltIn::HasSmartPanelConfig(void) {
return IsSmartPanelConfig(config);
}
- for (auto &config : variable_config_map_) {
- if (config.second.smart_panel) {
- return true;
- }
- }
-
- return false;
+ return smart_panel_config_;
}
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display_builtin.h b/sdm/libs/hwc2/hwc_display_builtin.h
index 232c31a1..d3b0661d 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.h
+++ b/sdm/libs/hwc2/hwc_display_builtin.h
@@ -151,7 +151,6 @@ class HWCDisplayBuiltIn : public HWCDisplay {
bool pending_refresh_ = true;
bool enable_optimize_refresh_ = false;
bool hdr_present_ = false;
- bool enable_poms_during_doze_ = false;
// Members for 1 frame capture in a client provided buffer
bool frame_capture_buffer_queued_ = false;
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 794ebc33..21be352f 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2020, 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -277,7 +277,7 @@ void HWCSession::InitSupportedDisplaySlots() {
map_info_primary_.client_id = qdutils::DISPLAY_PRIMARY;
if (null_display_mode_) {
- // Skip display slot initialization.
+ InitSupportedNullDisplaySlots();
return;
}
@@ -365,6 +365,26 @@ void HWCSession::InitSupportedDisplaySlots() {
}
}
+void HWCSession::InitSupportedNullDisplaySlots() {
+ if (!null_display_mode_) {
+ DLOGI("Should only be invoked during null display");
+ return;
+ }
+
+ map_info_primary_.client_id = 0;
+ // Resize HDR supported map to total number of displays
+ is_hdr_display_.resize(1);
+
+ if (!async_powermode_) {
+ return;
+ }
+
+ DLOGI("Display Pairs: map.client_id: %d, start_index: %d", INT32(map_info_primary_.client_id),
+ HWCCallbacks::kNumRealDisplays);
+ map_hwc_display_.insert(std::make_pair(map_info_primary_.client_id,
+ HWCCallbacks::kNumRealDisplays));
+}
+
int HWCSession::GetDisplayIndex(int dpy) {
DisplayMapInfo *map_info = nullptr;
switch (dpy) {
@@ -490,6 +510,10 @@ int32_t HWCSession::CreateVirtualDisplay(hwc2_device_t *device, uint32_t width,
return HWC2_ERROR_BAD_PARAMETER;
}
+ if (null_display_mode_) {
+ return 0;
+ }
+
HWCSession *hwc_session = static_cast<HWCSession *>(device);
auto status = hwc_session->CreateVirtualDisplayObj(width, height, format, out_display_id);
if (status == HWC2::Error::None) {
@@ -858,12 +882,14 @@ int32_t HWCSession::RegisterCallback(hwc2_device_t *device, int32_t descriptor,
if (hwc_session->HandleBuiltInDisplays()) {
DLOGW("Failed handling built-in displays.");
}
- DLOGI("Handling pluggable displays...");
- int32_t err = hwc_session->HandlePluggableDisplays(false);
- if (err) {
- DLOGW("All displays could not be created. Error %d '%s'. Hotplug handling %s.", err,
- strerror(abs(err)), hwc_session->hotplug_pending_event_ == kHotPlugEvent ? "deferred" :
- "dropped");
+ if(!hwc_session->pluggable_is_primary_) {
+ DLOGI("Handling pluggable displays...");
+ int32_t err = hwc_session->HandlePluggableDisplays(false);
+ if (err) {
+ DLOGW("All displays could not be created. Error %d '%s'. Hotplug handling %s.", err,
+ strerror(abs(err)), hwc_session->hotplug_pending_event_ == kHotPlugEvent ?
+ "deferred" : "dropped");
+ }
}
// If previously registered, call hotplug for all connected displays to refresh
@@ -2593,8 +2619,6 @@ int HWCSession::CreatePrimaryDisplay() {
auto hwc_display = &hwc_display_[HWC_DISPLAY_PRIMARY];
hwc2_display_t client_id = map_info_primary_.client_id;
- DLOGI("Create primary display type = %d, sdm id = %d, client id = %d", info.display_type,
- info.display_id, client_id);
if (!info.is_connected && info.display_type == kPluggable) {
pluggable_is_primary_ = true;
null_display_active_ = true;
@@ -2616,8 +2640,9 @@ int HWCSession::CreatePrimaryDisplay() {
}
if (!status) {
+ DLOGI("Create primary display type = %d, sdm id = %d, client id = %d", info.display_type,
+ info.display_id, client_id);
is_hdr_display_[UINT32(client_id)] = HasHDRSupport(*hwc_display);
- DLOGI("Primary display created.");
map_info_primary_.disp_type = info.display_type;
map_info_primary_.sdm_id = info.display_id;
@@ -2627,7 +2652,7 @@ int HWCSession::CreatePrimaryDisplay() {
DLOGW("Failed to load HWCColorManager.");
}
} else {
- DLOGE("Primary display creation failed.");
+ DLOGE("Primary display creation has failed! status = %d", status);
}
// Primary display is found, no need to parse more.
@@ -2940,6 +2965,22 @@ bool HWCSession::HasHDRSupport(HWCDisplay *hwc_display) {
}
int HWCSession::HandleDisconnectedDisplays(HWDisplaysInfo *hw_displays_info) {
+ if (pluggable_is_primary_) {
+ bool disconnect = true;
+ DisplayMapInfo map_info = map_info_primary_;
+ for (auto &iter : *hw_displays_info) {
+ auto &info = iter.second;
+ if (info.display_id != map_info.sdm_id) {
+ continue;
+ }
+ if (info.is_connected) {
+ disconnect = false;
+ }
+ }
+ if (disconnect) {
+ DestroyDisplay(&map_info);
+ }
+ }
// Destroy pluggable displays which were connected earlier but got disconnected now.
for (auto &map_info : map_info_pluggable_) {
bool disconnect = true; // disconnect in case display id is not found in list.
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index fed39c98..5931a5d9 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2020, 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -322,10 +322,9 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
int32_t *outCapabilities);
static hwc2_function_pointer_t GetFunction(struct hwc2_device *device, int32_t descriptor);
- // Uevent handler
- virtual void UEventHandler(const char *uevent_data, int length);
void ResetPanel();
void InitSupportedDisplaySlots();
+ void InitSupportedNullDisplaySlots();
int GetDisplayIndex(int dpy);
int CreatePrimaryDisplay();
void CreateDummyDisplay(hwc2_display_t client_id);
@@ -358,6 +357,9 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
int32_t setDisplayBrightness(uint32_t display, float brightness);
bool isSmartPanelConfig(uint32_t disp_id, uint32_t config_id);
+ // Uevent handler
+ virtual void UEventHandler(const char *uevent_data, int length);
+
// service methods
void StartServices();