Merge "hwc2: Copy UBWC Compression stats from Metadata to layer_buffer"
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 87eb56b..a135be2 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -181,7 +181,7 @@
}
int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (!module || !name || !device) {
DLOGE("Invalid parameters.");
@@ -207,7 +207,7 @@
}
int HWCSession::Close(hw_device_t *device) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (!device) {
return -EINVAL;
@@ -294,7 +294,7 @@
}
void HWCSession::Dump(hwc2_device_t *device, uint32_t *out_size, char *out_buffer) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (!device) {
return;
@@ -412,7 +412,6 @@
int32_t *out_retire_fence) {
HWCSession *hwc_session = static_cast<HWCSession *>(device);
DTRACE_SCOPED();
- SEQUENCE_EXIT_SCOPE_LOCK(locker_);
if (!device) {
return HWC2_ERROR_BAD_DISPLAY;
}
@@ -464,14 +463,14 @@
int32_t HWCSession::SetColorMode(hwc2_device_t *device, hwc2_display_t display,
int32_t /*android_color_mode_t*/ int_mode) {
auto mode = static_cast<android_color_mode_t>(int_mode);
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::SetColorMode, mode);
}
int32_t HWCSession::SetColorTransform(hwc2_device_t *device, hwc2_display_t display,
const float *matrix,
int32_t /*android_color_transform_t*/ hint) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
android_color_transform_t transform_hint = static_cast<android_color_transform_t>(hint);
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::SetColorTransform, matrix,
transform_hint);
@@ -579,7 +578,7 @@
int32_t HWCSession::SetPowerMode(hwc2_device_t *device, hwc2_display_t display, int32_t int_mode) {
auto mode = static_cast<HWC2::PowerMode>(int_mode);
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
return CallDisplayFunction(device, display, &HWCDisplay::SetPowerMode, mode);
}
@@ -591,6 +590,7 @@
int32_t HWCSession::ValidateDisplay(hwc2_device_t *device, hwc2_display_t display,
uint32_t *out_num_types, uint32_t *out_num_requests) {
DTRACE_SCOPED();
+ SCOPE_LOCK(locker_);
HWCSession *hwc_session = static_cast<HWCSession *>(device);
if (!device) {
return HWC2_ERROR_BAD_DISPLAY;
@@ -600,7 +600,6 @@
// Handle external_pending_connect_ in CreateVirtualDisplay
auto status = HWC2::Error::BadDisplay;
if (hwc_session->hwc_display_[display]) {
- SEQUENCE_ENTRY_SCOPE_LOCK(locker_);
if (display == HWC_DISPLAY_PRIMARY) {
// TODO(user): This can be moved to HWCDisplayPrimary
if (hwc_session->reset_panel_) {
@@ -619,11 +618,6 @@
status = hwc_session->hwc_display_[display]->Validate(out_num_types, out_num_requests);
}
- // If validate fails, cancel the sequence lock so that other operations
- // (such as Dump or SetPowerMode) may succeed without blocking on the condition
- if (status == HWC2::Error::BadDisplay) {
- SEQUENCE_CANCEL_SCOPE_LOCK(locker_);
- }
return INT32(status);
}
@@ -937,7 +931,7 @@
android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android::Parcel
*input_parcel,
android::Parcel *output_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int config = input_parcel->readInt32();
int dpy = input_parcel->readInt32();
@@ -964,7 +958,7 @@
}
android::status_t HWCSession::ConfigureRefreshRate(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
uint32_t operation = UINT32(input_parcel->readInt32());
HWCDisplay *hwc_display = hwc_display_[HWC_DISPLAY_PRIMARY];
@@ -990,14 +984,14 @@
}
android::status_t HWCSession::SetDisplayMode(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
uint32_t mode = UINT32(input_parcel->readInt32());
return hwc_display_[HWC_DISPLAY_PRIMARY]->Perform(HWCDisplayPrimary::SET_DISPLAY_MODE, mode);
}
android::status_t HWCSession::SetMaxMixerStages(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
DisplayError error = kErrorNone;
std::bitset<32> bit_mask_display_type = UINT32(input_parcel->readInt32());
@@ -1034,7 +1028,7 @@
}
void HWCSession::SetFrameDumpConfig(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
uint32_t frame_dump_count = UINT32(input_parcel->readInt32());
std::bitset<32> bit_mask_display_type = UINT32(input_parcel->readInt32());
@@ -1060,7 +1054,7 @@
}
android::status_t HWCSession::SetMixerResolution(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
DisplayError error = kErrorNone;
uint32_t dpy = UINT32(input_parcel->readInt32());
@@ -1087,7 +1081,7 @@
}
android::status_t HWCSession::SetColorModeOverride(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
auto display = static_cast<hwc2_display_t >(input_parcel->readInt32());
auto mode = static_cast<android_color_mode_t>(input_parcel->readInt32());
@@ -1109,7 +1103,7 @@
}
void HWCSession::DynamicDebug(const android::Parcel *input_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int type = input_parcel->readInt32();
bool enable = (input_parcel->readInt32() > 0);
@@ -1155,7 +1149,7 @@
android::status_t HWCSession::QdcmCMDHandler(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int ret = 0;
int32_t *brightness_value = NULL;
@@ -1363,7 +1357,7 @@
// To prevent sending events to client while a lock is held, acquire scope locks only within
// below scope so that those get automatically unlocked after the scope ends.
do {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
// If HDMI is primary but not created yet (first time), create it and notify surfaceflinger.
// if it is already created, but got disconnected/connected again,
@@ -1450,7 +1444,7 @@
android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int dpy = input_parcel->readInt32();
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index b904933..5cb9cf7 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -92,7 +92,7 @@
// Methods from ::vendor::hardware::display::config::V1_0::IDisplayConfig follow.
Return<void> HWCSession::isDisplayConnected(IDisplayConfig::DisplayType dpy,
isDisplayConnected_cb _hidl_cb) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
bool connected = false;
@@ -109,7 +109,7 @@
}
int32_t HWCSession::SetSecondaryDisplayStatus(int disp_id, HWCDisplay::DisplayStatus status) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (disp_id < 0) {
return -EINVAL;
@@ -135,7 +135,7 @@
Return<int32_t> HWCSession::configureDynRefeshRate(IDisplayConfig::DisplayDynRefreshRateOp op,
uint32_t refreshRate) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
HWCDisplay *hwc_display = hwc_display_[HWC_DISPLAY_PRIMARY];
@@ -158,7 +158,7 @@
}
int32_t HWCSession::GetConfigCount(int disp_id, uint32_t *count) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (disp_id >= 0 && hwc_display_[disp_id]) {
return hwc_display_[disp_id]->GetDisplayConfigCount(count);
@@ -178,7 +178,7 @@
}
int32_t HWCSession::GetActiveConfigIndex(int disp_id, uint32_t *config) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (disp_id >= 0 && hwc_display_[disp_id]) {
return hwc_display_[disp_id]->GetActiveDisplayConfig(config);
@@ -198,7 +198,7 @@
}
int32_t HWCSession::SetActiveConfigIndex(int disp_id, uint32_t config) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (disp_id < 0) {
return -EINVAL;
@@ -222,7 +222,7 @@
Return<void> HWCSession::getDisplayAttributes(uint32_t configIndex,
IDisplayConfig::DisplayType dpy,
getDisplayAttributes_cb _hidl_cb) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
IDisplayConfig::DisplayAttributes display_attributes = {};
@@ -247,7 +247,7 @@
}
Return<int32_t> HWCSession::setPanelBrightness(uint32_t level) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
@@ -261,7 +261,7 @@
}
int32_t HWCSession::GetPanelBrightness(int *level) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
@@ -285,7 +285,7 @@
}
int32_t HWCSession::MinHdcpEncryptionLevelChanged(int disp_id, uint32_t min_enc_level) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
DLOGI("Display %d", disp_id);
@@ -310,7 +310,7 @@
}
Return<int32_t> HWCSession::refreshScreen() {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
callbacks_.Refresh(HWC_DISPLAY_PRIMARY);
@@ -318,7 +318,7 @@
}
int32_t HWCSession::ControlPartialUpdate(int disp_id, bool enable) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (disp_id < 0) {
return -EINVAL;
@@ -362,7 +362,7 @@
}
Return<int32_t> HWCSession::toggleScreenUpdate(bool on) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
@@ -376,7 +376,7 @@
}
Return<int32_t> HWCSession::setIdleTimeout(uint32_t value) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
hwc_display_[HWC_DISPLAY_PRIMARY]->SetIdleTimeoutMs(value);
@@ -388,7 +388,7 @@
Return<void> HWCSession::getHDRCapabilities(IDisplayConfig::DisplayType dpy,
getHDRCapabilities_cb _hidl_cb) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
int32_t error = -EINVAL;
IDisplayConfig::DisplayHDRCapabilities hdr_caps = {};
@@ -438,7 +438,7 @@
}
Return<int32_t> HWCSession::setCameraLaunchStatus(uint32_t on) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
HWBwModes mode = on > 0 ? kBwCamera : kBwDefault;
@@ -456,7 +456,7 @@
}
int32_t HWCSession::DisplayBWTransactionPending(bool *status) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+ SCOPE_LOCK(locker_);
if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
if (sync_wait(bw_mode_release_fd_, 0) < 0) {