From f86f7947e45b85f5a281eea217647703244dd066 Mon Sep 17 00:00:00 2001 From: Rajavenu Kyatham Date: Wed, 14 Feb 2018 18:59:26 +0530 Subject: [PATCH] hwc2: Flush while destroying external display. - On external display, outstanding fences are not signaled during destroy. They get signaled only on drm_release and drm_release happen in composer restart. So need to flush external before destroying. CRs-fixed: 2187232 Change-Id: I0a7f029237cb0d8015904565c0755731a7b27212 --- sdm/libs/hwc2/hwc_display.h | 6 +++++- sdm/libs/hwc2/hwc_display_external.cpp | 4 ++++ sdm/libs/hwc2/hwc_display_external.h | 3 ++- sdm/libs/hwc2/hwc_session.cpp | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h index a5e14573..4153600c 100644 --- a/sdm/libs/hwc2/hwc_display.h +++ b/sdm/libs/hwc2/hwc_display.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -150,6 +150,10 @@ class HWCDisplay : public DisplayEventHandler { virtual int SetState(bool connected) { return kErrorNotSupported; } + virtual DisplayError Flush() { + return kErrorNotSupported; + } + int SetPanelBrightness(int level); int GetPanelBrightness(int *level); int ToggleScreenUpdates(bool enable); diff --git a/sdm/libs/hwc2/hwc_display_external.cpp b/sdm/libs/hwc2/hwc_display_external.cpp index 2bc2d189..934ad706 100644 --- a/sdm/libs/hwc2/hwc_display_external.cpp +++ b/sdm/libs/hwc2/hwc_display_external.cpp @@ -278,4 +278,8 @@ void HWCDisplayExternal::GetUnderScanConfig() { } } +DisplayError HWCDisplayExternal::Flush() { + return display_intf_->Flush(); +} + } // namespace sdm diff --git a/sdm/libs/hwc2/hwc_display_external.h b/sdm/libs/hwc2/hwc_display_external.h index fbee6a3d..5eb1704f 100644 --- a/sdm/libs/hwc2/hwc_display_external.h +++ b/sdm/libs/hwc2/hwc_display_external.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2018, 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 @@ -49,6 +49,7 @@ class HWCDisplayExternal : public HWCDisplay { virtual HWC2::Error Present(int32_t *out_retire_fence); virtual void SetSecureDisplay(bool secure_display_active); virtual int SetState(bool connected); + virtual DisplayError Flush(); private: HWCDisplayExternal(CoreInterface *core_intf, HWCBufferAllocator *buffer_allocator, diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 02e2129e..2367ec59 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -959,6 +959,10 @@ int HWCSession::DisconnectDisplay(int disp) { DLOGI("Display = %d", disp); if (disp == HWC_DISPLAY_EXTERNAL) { + DisplayError error = hwc_display_[disp]->Flush(); + if (error != kErrorNone) { + DLOGW("Flush failed. Error = %d", error); + } HWCDisplayExternal::Destroy(hwc_display_[disp]); } else if (disp == HWC_DISPLAY_VIRTUAL) { HWCDisplayVirtual::Destroy(hwc_display_[disp]);