summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPritama Biswas <pritbisw@codeaurora.org>2021-09-17 18:44:57 +0530
committerPritama Biswas <pritbisw@codeaurora.org>2021-09-25 09:22:28 +0530
commitc346a211b1f38ccb3ea492a6a0dd81ca286a1dde (patch)
tree8d35b3bc788ad4669e7252d18d77af9ca321887c
parentae684acc368b27a09b44ceb457981e7415194f88 (diff)
hwc2: Use null display when primary not connected on boot.
Change-Id: I82cec38edde04836057b42bb04b7717d20488033
-rw-r--r--sdm/libs/hwc2/hwc_display_dummy.cpp7
-rw-r--r--sdm/libs/hwc2/hwc_session.cpp26
-rw-r--r--sdm/libs/hwc2/hwc_session.h4
3 files changed, 26 insertions, 11 deletions
diff --git a/sdm/libs/hwc2/hwc_display_dummy.cpp b/sdm/libs/hwc2/hwc_display_dummy.cpp
index 358eefdc..ace26ac6 100644
--- a/sdm/libs/hwc2/hwc_display_dummy.cpp
+++ b/sdm/libs/hwc2/hwc_display_dummy.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
+* Copyright (c) 2018-2019, 2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -75,6 +75,11 @@ HWCDisplayDummy::HWCDisplayDummy(CoreInterface *core_intf, BufferAllocator *buff
display_null_.SetFrameBufferConfig(config);
num_configs_ = 1;
display_intf_ = &display_null_;
+ client_target_ = new HWCLayer(id_, buffer_allocator_);
+ current_refresh_rate_ = max_refresh_rate_ = 60;
+ hwc_config_map_.resize(num_configs_);
+ variable_config_map_[0] = config;
+ hwc_config_map_.at(0) = 0;
}
HWC2::Error HWCDisplayDummy::GetActiveConfig(hwc2_config_t *out_config) {
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 2cd107bf..281a0755 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, 2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -2590,17 +2590,19 @@ int HWCSession::CreatePrimaryDisplay() {
continue;
}
- // todo (user): If primary display is not connected (e.g. hdmi as primary), a NULL display
- // need to be created. SF expects primary display hotplug during callback registration unlike
- // previous implementation where first hotplug could be notified anytime.
+ auto hwc_display = &hwc_display_[HWC_DISPLAY_PRIMARY];
+ hwc2_display_t client_id = map_info_primary_.client_id;
if (!info.is_connected) {
- DLOGE("Primary display is not connected. Not supported at present.");
+ // primary display is not connected, create a dummy display.
+ HWCDisplayDummy::Create(core_intf_, &buffer_allocator_, &callbacks_, this, qservice_,
+ 0, 0, hwc_display);
+ null_display_active_ = true;
+ map_info_primary_.disp_type = info.display_type;
+ map_info_primary_.sdm_id = info.display_id;
+ status = kErrorNone;
break;
}
- 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.display_type == kBuiltIn) {
@@ -2760,6 +2762,14 @@ int HWCSession::HandleConnectedDisplays(HWDisplaysInfo *hw_displays_info, bool d
for (auto &iter : *hw_displays_info) {
auto &info = iter.second;
+ if (info.is_primary && info.is_connected && null_display_active_) {
+ DLOGI("Pluggable display is connected. Exit!");
+ auto hwc_display_dummy = hwc_display_[HWC_DISPLAY_PRIMARY];
+ HWCDisplayDummy::Destroy(hwc_display_dummy);
+ CoreInterface::DestroyCore();
+ _exit(1);
+ }
+
// Do not recreate primary display or if display is not connected.
if (info.is_primary || info.display_type != kPluggable || !info.is_connected) {
continue;
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index f1b054aa..2ad0f037 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, 2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -430,7 +430,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
int bw_mode_release_fd_ = -1;
qService::QService *qservice_ = nullptr;
HWCSocketHandler socket_handler_;
- bool hdmi_is_primary_ = false;
+ bool null_display_active_ = false;
bool is_composer_up_ = false;
Locker callbacks_lock_;
std::mutex mutex_lum_;