Merge 0271593fcc6bf3980ebe0654a89ebede3f340737 on remote branch
Change-Id: I0f297b6ce0f5846218cee94fa7434991aa9fd64c
diff --git a/composer/service.cpp b/composer/service.cpp
index de8c0f5..9adede5 100644
--- a/composer/service.cpp
+++ b/composer/service.cpp
@@ -26,6 +26,39 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
@@ -33,6 +66,7 @@
#include "DisplayConfigAIDL.h"
#include "QtiComposer.h"
+#include "hwc_debugger.h"
using aidl::vendor::qti::hardware::display::config::DisplayConfigAIDL;
using android::ProcessState;
@@ -46,11 +80,18 @@
int main(int, char **) {
ALOGI("Creating Display HW Composer HAL");
+ int composer_thread_count = 8;
+ sdm::HWCDebugHandler::Get()->GetProperty(COMPOSER_THREAD_COUNT, &composer_thread_count);
+ if (composer_thread_count < 4 || composer_thread_count > 15) {
+ composer_thread_count = 4;
+ }
+ ALOGI("composer_thread_count: %d", composer_thread_count);
+
// TODO(user): double-check for SCHED_FIFO logic
// the conventional HAL might start binder services
ProcessState::initWithDriver("/dev/vndbinder");
sp<ProcessState> ps(ProcessState::self());
- ps->setThreadPoolMaxThreadCount(4);
+ ps->setThreadPoolMaxThreadCount(composer_thread_count);
ps->startThreadPool();
ALOGI("ProcessState initialization completed");
@@ -73,7 +114,7 @@
}
ALOGI("Configuring RPC threadpool");
- configureRpcThreadpool(4, true /*callerWillJoin*/);
+ configureRpcThreadpool(composer_thread_count, true /*callerWillJoin*/);
ALOGI("Configuring RPC threadpool...done!");
ALOGI("Registering Display HW Composer HAL as a service");
diff --git a/include/display_properties.h b/include/display_properties.h
index 6694a2b..8d33e5a 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -74,6 +74,7 @@
#define EXTERNAL_ACTION_SAFE_HEIGHT_PROP DISPLAY_PROP("external_action_safe_height")
#define FB_WIDTH_PROP DISPLAY_PROP("fb_width")
#define FB_HEIGHT_PROP DISPLAY_PROP("fb_height")
+#define COMPOSER_THREAD_COUNT DISPLAY_PROP("composer_thread_count")
#define DISABLE_METADATA_DYNAMIC_FPS_PROP DISPLAY_PROP("disable_metadata_dynamic_fps")
#define DISABLE_SKIP_VALIDATE_PROP DISPLAY_PROP("disable_skip_validate")
#define DISABLE_DESTINATION_SCALER_PROP DISPLAY_PROP("disable_dest_scaler")
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 1b1c0ae..13abdc7 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1838,7 +1838,11 @@
case kStateOn:
if (display_type_ == kHDMI && first_cycle_) {
- hw_events_intf_->SetEventState(HWEvent::POWER_EVENT, true);
+ error = hw_events_intf_->SetEventState(HWEvent::POWER_EVENT, true);
+ if (error != kErrorNone) {
+ Abort();
+ return error;
+ }
}
cached_qos_data_.clock_hz =
diff --git a/sdm/libs/dal/hw_events_drm.cpp b/sdm/libs/dal/hw_events_drm.cpp
index 765ff13..8813134 100644
--- a/sdm/libs/dal/hw_events_drm.cpp
+++ b/sdm/libs/dal/hw_events_drm.cpp
@@ -403,7 +403,9 @@
}
} break;
case HWEvent::POWER_EVENT: {
- RegisterPowerEvents(enable);
+ if (RegisterPowerEvents(enable) != kErrorNone) {
+ return kErrorResources;
+ }
} break;
case HWEvent::PANEL_DEAD: {
RegisterPanelDead(enable);
@@ -655,8 +657,8 @@
} else {
DLOGE("Failed to %s event. Event_thread_name : %s, Ret=%d", (enable) ? "Register" :
"DeRegister", event_thread_name_.c_str(), ret);
- return kErrorResources;
}
+ return kErrorResources;
}
return kErrorNone;
}