From 794027fc8347657b484a02013ce8405b4f65ba47 Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Wed, 25 Dec 2019 11:36:16 +0800 Subject: [PATCH 1/2] Need to check if plane is reserved before setting All Cilent for KVM When "Plane Reserve" is not used. No need to set all layer as Client. Change-Id: I1e517c73c73cf64823bfd04040e1f27cdc4f0726 Tests: None Tracked-On: None Signed-off-by: Shaofeng Tang --- os/android/iahwc2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/android/iahwc2.cpp b/os/android/iahwc2.cpp index 56e241be..4aef9853 100644 --- a/os/android/iahwc2.cpp +++ b/os/android/iahwc2.cpp @@ -1024,7 +1024,7 @@ HWC2::Error IAHWC2::HwcDisplay::ValidateDisplay(uint32_t *num_types, if (!avail_planes--) break; #ifdef KVM_HWC_PROPERTY - if (IsKvmPlatform()) + if (IsKvmPlatform() && GpuDevice::getInstance().IsReservedDrmPlane()) break; #endif if (layers_[l.second].sf_type() == HWC2::Composition::SolidColor) { From 7242977ac1b82097fa5191d2b1cea6b28f319a4f Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Wed, 8 Jan 2020 20:19:00 +0800 Subject: [PATCH 2/2] Use Client for Video layer on KVM when display (> 1080P) Disabling VA-VPP composing for KVM when the display is 2K or 4K Change-Id: Ia4ee6f2366df552c53175d59177f01d96766e93e Tests: Work well on both Native and CVTE device Tracked-On: None Signed-off-by: Shaofeng Tang --- os/android/iahwc2.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/os/android/iahwc2.cpp b/os/android/iahwc2.cpp index 4aef9853..08268b74 100644 --- a/os/android/iahwc2.cpp +++ b/os/android/iahwc2.cpp @@ -978,6 +978,25 @@ HWC2::Error IAHWC2::HwcDisplay::ValidateDisplay(uint32_t *num_types, #ifdef FORCE_ALL_DEVICE_TYPE force_all_device_type = true; #endif + +#ifdef KVM_HWC_PROPERTY + /* + * On KVM + 4K display case, almost 30% frames are missed during video + * playback with VA-VPP composing and default CPU frequency setting. + * For optimizing video playback, disabling VA-VPP. and all layers will + * be composed in Cilent layer by SF (Only 1 plane is available on KVM) + */ + if (include_video_layer && IsKvmPlatform()) { + uint32_t kvm_config = 0; + display_->GetActiveConfig(&kvm_config); + int32_t height = 0; + display_->GetDisplayAttribute( + kvm_config, hwcomposer::HWCDisplayAttribute::kHeight, &height); + if (height > 1080) { + include_video_layer = false; + } + } +#endif if (include_video_layer || force_all_device_type) { for (std::pair &l : layers_) { IAHWC2::Hwc2Layer &layer = l.second;