From 99259fda6e50fd383a1d2aee873f7382ff9fa195 Mon Sep 17 00:00:00 2001 From: "Yuanzhe, Liu" Date: Fri, 21 Jun 2019 19:12:05 +0800 Subject: [PATCH 1/9] Fix klocwork issues in GFX domain Revert an old fix because it dosen't pass kw scan. Fix kw issues in commit bee37461 base on 80 daily build. The rest of issues will be set as ignored later. Test: tested on APL Tracked-On: No Sighed-off-by: Yuanzhe, Liu Change-Id: Ia6aa596b4dc4c83820910a2dd40a53f774c94508 --- common/core/gpudevice.cpp | 2 -- wsi/drm/drmdisplay.cpp | 2 ++ wsi/drm/drmdisplay.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/core/gpudevice.cpp b/common/core/gpudevice.cpp index 0505b090..59c3d25e 100644 --- a/common/core/gpudevice.cpp +++ b/common/core/gpudevice.cpp @@ -400,8 +400,6 @@ void GpuDevice::ParseLogicalDisplaySetting( logical_split_str.find_first_not_of("0123456789") != std::string::npos) return; uint32_t physical_index = atoi(physical_index_str.c_str()); - if (physical_index < 0) - return; uint32_t logical_split_num = atoi(logical_split_str.c_str()); if (logical_split_num <= 1) return; diff --git a/wsi/drm/drmdisplay.cpp b/wsi/drm/drmdisplay.cpp index 23c2b555..0ca10a80 100644 --- a/wsi/drm/drmdisplay.cpp +++ b/wsi/drm/drmdisplay.cpp @@ -169,6 +169,7 @@ void DrmDisplay::GetEDIDDisplayData(const ScopedDrmObjectPropertyPtr &props) { edid = (uint8_t *)blob->data; if (!edid) { + drmModeFreePropertyBlob(blob); return; } std::memset(display_data, 0, sizeof(display_data)); @@ -196,6 +197,7 @@ void DrmDisplay::GetEDIDDisplayData(const ScopedDrmObjectPropertyPtr &props) { } } + drmModeFreePropertyBlob(blob); ITRACE("Got EDID display name \"%s\"\n", display_name_.c_str()); } diff --git a/wsi/drm/drmdisplay.h b/wsi/drm/drmdisplay.h index 415135ff..eec53043 100644 --- a/wsi/drm/drmdisplay.h +++ b/wsi/drm/drmdisplay.h @@ -198,7 +198,7 @@ class DrmDisplay : public PhysicalDisplay { uint32_t flags_ = DRM_MODE_ATOMIC_ALLOW_MODESET; bool planes_updated_ = false; bool first_commit_ = false; - std::string display_name_; + std::string display_name_ = ""; HWCContentProtection current_protection_support_ = HWCContentProtection::kUnSupported; HWCContentProtection desired_protection_support_ = From 66d7c942e16f082038560f03e6f1d86d57001c96 Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Fri, 21 Jun 2019 14:59:54 +0800 Subject: [PATCH 2/9] Revert "[WA]Force refresh layer content on extend display" The surface damage issue is fixed by AOSP patch https://android.intel.com/#/c/672623/1 The WA is not needed any more This reverts commit 95ec73b8710df14915d8bab798c7d9ee04c79c4e. Change-Id: I5d675d20de486d688f43f09a5a292821184bc9ce Tests: Work well with AOSP patch on Android Q Tracked-On: None Signed-off-by: Shaofeng Tang --- common/core/overlaylayer.cpp | 2 +- common/core/overlaylayer.h | 15 ++------------- common/display/displayqueue.cpp | 2 -- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/common/core/overlaylayer.cpp b/common/core/overlaylayer.cpp index 0946b73d..d5061b97 100644 --- a/common/core/overlaylayer.cpp +++ b/common/core/overlaylayer.cpp @@ -571,7 +571,7 @@ void OverlayLayer::ValidatePreviousFrameState(OverlayLayer* rhs, if (!layer->HasVisibleRegionChanged() && !content_changed && surface_damage_.empty() && !layer->HasLayerContentChanged() && - !(state_ & kNeedsReValidation) && !force_content_changed_) { + !(state_ & kNeedsReValidation)) { state_ &= ~kLayerContentChanged; } } diff --git a/common/core/overlaylayer.h b/common/core/overlaylayer.h index 22d4930b..6847ea68 100644 --- a/common/core/overlaylayer.h +++ b/common/core/overlaylayer.h @@ -123,17 +123,11 @@ struct OverlayLayer { } const HwcRect& GetSurfaceDamage() const { - if (force_content_changed_) - return display_frame_; - else - return surface_damage_; + return surface_damage_; } HwcRect& GetSurfaceDamage() { - if (force_content_changed_) - return display_frame_; - else - return surface_damage_; + return surface_damage_; } uint32_t GetSourceCropWidth() const { @@ -258,10 +252,6 @@ struct OverlayLayer { void CloneLayer(const OverlayLayer* layer, const HwcRect& display_frame, ResourceManager* resource_manager, uint32_t z_order); - void SetForceContentChanged() { - force_content_changed_ = true; - } - void Dump(); private: @@ -316,7 +306,6 @@ struct OverlayLayer { uint32_t dataspace_ = 0; uint32_t solid_color_ = 0; - bool force_content_changed_ = false; HwcRect source_crop_; HwcRect display_frame_; diff --git a/common/display/displayqueue.cpp b/common/display/displayqueue.cpp index 322763a4..9bcf475b 100644 --- a/common/display/displayqueue.cpp +++ b/common/display/displayqueue.cpp @@ -545,8 +545,6 @@ void DisplayQueue::InitializeOverlayLayers( layers.emplace_back(); OverlayLayer* overlay_layer = &(layers.back()); - if (refrsh_display_id_ > 0) - overlay_layer->SetForceContentChanged(); OverlayLayer* previous_layer = NULL; if (previous_size > z_order) { previous_layer = &(in_flight_layers_.at(z_order)); From bd3bfeea1937a767f6063ea749294e19b1160efe Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Wed, 3 Jul 2019 13:33:31 +0800 Subject: [PATCH 3/9] Use AB24 format for video layer which left and width are odd Kernel required the width and left of YUV video buffer must be multiple of 2. when the width and left is odd. we should use AB24 format for video. and use VPP path. Change-Id: I7d17533f8d2a1c086850b496659b65387908457e Tests: On Android Q, the protected video can be shown, but not decoded correctly Tracked-On: https://jira.devtools.intel.com/browse/OAM-82976 Signed-off-by: Shaofeng Tang --- common/display/displayplanemanager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/common/display/displayplanemanager.cpp b/common/display/displayplanemanager.cpp index 2d678e10..ad0861b2 100644 --- a/common/display/displayplanemanager.cpp +++ b/common/display/displayplanemanager.cpp @@ -734,8 +734,12 @@ void DisplayPlaneManager::SetDisplayTransform(uint32_t transform) { void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) { NativeSurface *surface = NULL; // We only use media formats when video compostion for 1 layer - bool video_separate = - plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1); + int dest_x = plane.GetDisplayFrame().left; + int dest_w = plane.GetDisplayFrame().right - dest_x; + + bool video_separate = plane.IsVideoPlane() && + (plane.GetSourceLayers().size() == 1) && + !(dest_w % 2 || dest_x % 2); uint32_t preferred_format = 0; uint32_t usage = hwcomposer::kLayerNormal; if (video_separate) { @@ -765,11 +769,13 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) { NativeSurface *new_surface = NULL; if (video_separate) { new_surface = CreateVideoSurface(width_, height_); - usage = hwcomposer::kLayerVideo; } else { new_surface = Create3DSurface(width_, height_); } + if (plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1)) + usage = hwcomposer::kLayerVideo; + bool modifer_succeeded = false; new_surface->Init(resource_manager_, preferred_format, usage, modifier, &modifer_succeeded); From d2a4f57f77b52a3ba770dbe4306c02e220a597ce Mon Sep 17 00:00:00 2001 From: "Yuanzhe, Liu" Date: Tue, 25 Jun 2019 14:51:07 +0800 Subject: [PATCH 4/9] Fix klocwork issues in GFX domain Add a normal initialization statement. Add a if statement to validate the variable. Change-Id: I6eb23808d3e5e120f51c9274e0567c2ecd66f2a3 Test: Boot DUT successful Tracked-On: https://jira.devtools.intel.com/browse/OAM-83372 Sighed-off-by: Yuanzhe, Liu --- common/compositor/gl/glprogram.cpp | 1 + common/core/gpudevice.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/common/compositor/gl/glprogram.cpp b/common/compositor/gl/glprogram.cpp index db30446e..c458b4db 100644 --- a/common/compositor/gl/glprogram.cpp +++ b/common/compositor/gl/glprogram.cpp @@ -301,6 +301,7 @@ GLProgram::GLProgram() alpha_loc_(0), premult_loc_(0), tex_matrix_loc_(0), + solid_color_loc_(0), initialized_(false) { } diff --git a/common/core/gpudevice.cpp b/common/core/gpudevice.cpp index 59c3d25e..e32a1e6e 100644 --- a/common/core/gpudevice.cpp +++ b/common/core/gpudevice.cpp @@ -399,6 +399,8 @@ void GpuDevice::ParseLogicalDisplaySetting( if (logical_split_str.empty() || logical_split_str.find_first_not_of("0123456789") != std::string::npos) return; + if (physical_index_str.length() > 1) + return; uint32_t physical_index = atoi(physical_index_str.c_str()); uint32_t logical_split_num = atoi(logical_split_str.c_str()); if (logical_split_num <= 1) From 66123d2342aa71dcbb3d42847c5bbe0d34c857e9 Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Mon, 8 Jul 2019 22:13:44 +0800 Subject: [PATCH 5/9] Force VPP rendering when has_video and "ForceGpuForAllLayers" Once video is contained, use VPP to compose all layers instead of OpenGL render Change-Id: I4e5bafe34c691d8c4b8ed8526ba0f3d20619b082 Tests: Work on Android Q Tracked-On: None Signed-off-by: Shaofeng Tang --- common/display/displayplanemanager.cpp | 44 +++++++++++++++++++------- common/display/displayplanemanager.h | 2 +- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/common/display/displayplanemanager.cpp b/common/display/displayplanemanager.cpp index ad0861b2..68465180 100644 --- a/common/display/displayplanemanager.cpp +++ b/common/display/displayplanemanager.cpp @@ -112,12 +112,28 @@ bool DisplayPlaneManager::ValidateLayers( OverlayPlane(temp.GetDisplayPlane(), temp.GetOverlayLayer())); } + size_t video_layers = 0; + for (size_t lindex = add_index; lindex < layers.size(); lindex++) { + if (layers[lindex].IsVideoLayer()) + video_layers++; + } + // In case we are forcing GPU composition for all layers and using a single // plane. if (disable_overlay) { - ISURFACETRACE("Forcing GPU For all layers %d %d %d %d \n", disable_overlay, - composition.empty(), add_index <= 0, layers.size()); - ForceGpuForAllLayers(commit_planes, composition, layers, mark_later, false); + if (!video_layers) { + ISURFACETRACE("Forcing GPU For all layers %d %d %d %d \n", + disable_overlay, composition.empty(), add_index <= 0, + layers.size()); + ForceGpuForAllLayers(commit_planes, composition, layers, mark_later, + false); + } else { + ISURFACETRACE("Forcing VPP For all layers %d %d %d %d \n", + disable_overlay, composition.empty(), add_index <= 0, + layers.size()); + ForceVppForAllLayers(commit_planes, composition, layers, add_index, + mark_later, false); + } *re_validation_needed = false; *commit_checked = true; @@ -134,11 +150,6 @@ bool DisplayPlaneManager::ValidateLayers( j->get()->SetInUse(false); } - size_t video_layers = 0; - for (size_t lindex = add_index; lindex < layers.size(); lindex++) { - if (layers[lindex].IsVideoLayer()) - video_layers++; - } size_t avail_planes = overlay_planes_.size() - composition.size(); if (!(overlay_planes_[overlay_planes_.size() - 1]->IsUniversal())) avail_planes--; @@ -393,7 +404,8 @@ bool DisplayPlaneManager::ValidateLayers( } if (validate_final_layers) { - ValidateFinalLayers(commit_planes, composition, layers, mark_later, false); + ValidateFinalLayers(commit_planes, composition, layers, mark_later, false, + add_index); test_commit_done = true; } @@ -797,17 +809,25 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) { void DisplayPlaneManager::ValidateFinalLayers( std::vector &commit_planes, DisplayPlaneStateList &composition, std::vector &layers, - std::vector &mark_later, bool recycle_resources) { + std::vector &mark_later, bool recycle_resources, + size_t add_index) { + bool has_video = false; for (DisplayPlaneState &plane : composition) { if (plane.NeedsOffScreenComposition() && !plane.GetOffScreenTarget()) { EnsureOffScreenTarget(plane); } + if (!has_video && plane.IsVideoPlane()) + has_video = true; } // If this combination fails just fall back to 3D for all layers. if (!plane_handler_->TestCommit(commit_planes)) { - ForceGpuForAllLayers(commit_planes, composition, layers, mark_later, - recycle_resources); + if (!has_video) + ForceGpuForAllLayers(commit_planes, composition, layers, mark_later, + recycle_resources); + else + ForceVppForAllLayers(commit_planes, composition, layers, add_index, + mark_later, false); } } diff --git a/common/display/displayplanemanager.h b/common/display/displayplanemanager.h index a20144b5..9878285e 100644 --- a/common/display/displayplanemanager.h +++ b/common/display/displayplanemanager.h @@ -133,7 +133,7 @@ class DisplayPlaneManager { DisplayPlaneStateList &list, std::vector &layers, std::vector &mark_later, - bool recycle_resources); + bool recycle_resources, size_t add_index); void ResetPlaneTarget(DisplayPlaneState &plane, OverlayPlane &overlay_plane); From 18d87a37818aee70bb20e5c9d5475b3250728780 Mon Sep 17 00:00:00 2001 From: "Fan, Yugang" Date: Mon, 8 Jul 2019 10:47:30 +0800 Subject: [PATCH 6/9] Add power mode set when connecting display even in connected state. This is WA as APL NUC always triggers hotplug when resume from S3, which causes the postpone mode set be ingnored and display can't be resumed from blackscreen. Change-Id: I49e66552b373f1adde7aa6d04a19c508adeab991 Test: Display can be resumed from S3 successfully. Tracked-On: OAM-81142 Sighed-off-by: Yugang, Fan --- wsi/physicaldisplay.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wsi/physicaldisplay.cpp b/wsi/physicaldisplay.cpp index 7fad3e80..679d7caa 100644 --- a/wsi/physicaldisplay.cpp +++ b/wsi/physicaldisplay.cpp @@ -152,6 +152,10 @@ void PhysicalDisplay::Connect() { SPIN_LOCK(modeset_lock_); if (connection_state_ & kConnected) { + IHOTPLUGEVENTTRACE( + "PhysicalDisplay::Connect connected already, return with power mode " + "update."); + UpdatePowerMode(); SPIN_UNLOCK(modeset_lock_); return; } From 4bb32a2243168966903e12f7eb6a2934ce1267b4 Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Sat, 6 Jul 2019 15:36:37 +0800 Subject: [PATCH 7/9] Filter EDIP for prefer and performance config Asked by AOSP, only 2 display config should be return to SF one is the preferred config. and the other is optional better performance config. Change-Id: I966bbdeb819e54b12a5ef37103e593207b95a940 Tests: Work well on Android Q GP Tracked-On: https://jira.devtools.intel.com/browse/OAM-83748 Signed-off-by: Shaofeng Tang --- wsi/drm/drmdisplay.cpp | 74 +++++++++++++++++++++++++++++++++++++++--- wsi/drm/drmdisplay.h | 5 +++ 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/wsi/drm/drmdisplay.cpp b/wsi/drm/drmdisplay.cpp index 0ca10a80..c29a9164 100644 --- a/wsi/drm/drmdisplay.cpp +++ b/wsi/drm/drmdisplay.cpp @@ -409,6 +409,64 @@ bool DrmDisplay::GetDisplayAttribute(uint32_t config /*config*/, return status; } +uint32_t DrmDisplay::FindPreferedDisplayMode(size_t modes_size) { + uint32_t prefer_display_mode = 0; + if (modes_size > 1) { + SPIN_LOCK(display_lock_); + for (size_t i = 0; i < modes_size; i++) { + // There is only one preferred mode per connector. + if (modes_[i].type & DRM_MODE_TYPE_PREFERRED) { + prefer_display_mode = i; + IHOTPLUGEVENTTRACE("Preferred display config is found. index: %d", i); + break; + } + } + SPIN_UNLOCK(display_lock_); + } + if (prefer_display_mode_ != prefer_display_mode) + prefer_display_mode_ = prefer_display_mode; + return prefer_display_mode; +} + +uint32_t DrmDisplay::FindPerformaceDisplayMode(size_t modes_size) { + uint32_t perf_display_mode; + perf_display_mode = prefer_display_mode_; + if (modes_size >= prefer_display_mode_) { + int32_t prefer_width = 0, prefer_height = 0, prefer_interval = 0; + int32_t perf_width = 0, perf_height = 0, perf_interval = 0, + previous_perf_interval = 0; + GetDisplayAttribute(prefer_display_mode_, HWCDisplayAttribute::kWidth, + &prefer_width); + GetDisplayAttribute(prefer_display_mode_, HWCDisplayAttribute::kHeight, + &prefer_height); + GetDisplayAttribute(prefer_display_mode_, HWCDisplayAttribute::kRefreshRate, + &prefer_interval); + previous_perf_interval = prefer_interval; + IHOTPLUGEVENTTRACE("Preferred width:%d, height:%d, interval:%d", + prefer_width, prefer_height, prefer_interval); + for (size_t i = 0; i < modes_size; i++) { + if (i != prefer_display_mode_) { + GetDisplayAttribute(i, HWCDisplayAttribute::kWidth, &perf_width); + GetDisplayAttribute(i, HWCDisplayAttribute::kHeight, &perf_height); + GetDisplayAttribute(i, HWCDisplayAttribute::kRefreshRate, + &perf_interval); + IHOTPLUGEVENTTRACE("EDIP item width:%d, height:%d, rate:%d", perf_width, + perf_height, perf_interval); + if (prefer_width == perf_width && prefer_height == perf_height && + prefer_interval > perf_interval && + previous_perf_interval > perf_interval) { + perf_display_mode = i; + previous_perf_interval = perf_interval; + } + } + } + } + if (perf_display_mode_ != perf_display_mode) + perf_display_mode_ = perf_display_mode; + IHOTPLUGEVENTTRACE("PerformaceDisplayMode: %d", perf_display_mode_); + return perf_display_mode; +} + bool DrmDisplay::GetDisplayConfigs(uint32_t *num_configs, uint32_t *configs) { if (!num_configs) return false; @@ -421,8 +479,16 @@ bool DrmDisplay::GetDisplayConfigs(uint32_t *num_configs, uint32_t *configs) { return PhysicalDisplay::GetDisplayConfigs(num_configs, configs); } + uint32_t prefer_display_mode = prefer_display_mode_; + uint32_t perf_display_mode = perf_display_mode_; + if (!configs) { - *num_configs = modes_size; + prefer_display_mode = FindPreferedDisplayMode(modes_size); + perf_display_mode = FindPerformaceDisplayMode(modes_size); + if (prefer_display_mode == perf_display_mode) + *num_configs = 1; + else + *num_configs = 2; IHOTPLUGEVENTTRACE( "GetDisplayConfigs: Total Configs: %d pipe: %d display: %p", *num_configs, pipe_, this); @@ -433,9 +499,9 @@ bool DrmDisplay::GetDisplayConfigs(uint32_t *num_configs, uint32_t *configs) { "GetDisplayConfigs: Populating Configs: %d pipe: %d display: %p", *num_configs, pipe_, this); - uint32_t size = *num_configs > modes_size ? modes_size : *num_configs; - for (uint32_t i = 0; i < size; i++) - configs[i] = i; + configs[0] = prefer_display_mode; + if (prefer_display_mode != perf_display_mode) + configs[1] = perf_display_mode; return true; } diff --git a/wsi/drm/drmdisplay.h b/wsi/drm/drmdisplay.h index eec53043..50b56440 100644 --- a/wsi/drm/drmdisplay.h +++ b/wsi/drm/drmdisplay.h @@ -171,6 +171,9 @@ class DrmDisplay : public PhysicalDisplay { void TraceFirstCommit(); + uint32_t FindPreferedDisplayMode(size_t modes_size); + uint32_t FindPerformaceDisplayMode(size_t modes_size); + uint32_t crtc_id_ = 0; uint32_t mmWidth_ = 0; uint32_t mmHeight_ = 0; @@ -198,6 +201,8 @@ class DrmDisplay : public PhysicalDisplay { uint32_t flags_ = DRM_MODE_ATOMIC_ALLOW_MODESET; bool planes_updated_ = false; bool first_commit_ = false; + uint32_t prefer_display_mode_ = 0; + uint32_t perf_display_mode_ = 0; std::string display_name_ = ""; HWCContentProtection current_protection_support_ = HWCContentProtection::kUnSupported; From 86a4c7335a55b8620927f29444d986978c52da53 Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Mon, 8 Jul 2019 16:13:25 +0800 Subject: [PATCH 8/9] Revert "Limits some monitors' modes due to hardware limitation." Since only 2 displaymode (same resolution) will be reported to SF. No need to remain the workaround for viewsonic display. This reverts commit bee374610533f2766de31870026a557bb0fc6357. Conflicts: wsi/drm/drmdisplay.cpp wsi/drm/drmdisplay.h Change-Id: If8ca324711c242517574b31c814fb93677690d2d Tests: Work well on Android Q Tracked-On: https://jira.devtools.intel.com/browse/OAM-83748 Signed-off-by: Shaofeng Tang --- wsi/drm/drmdisplay.cpp | 65 +---------------------------------- wsi/drm/drmdisplay.h | 3 -- wsi/drm/drmdisplaymanager.cpp | 18 ++-------- wsi/physicaldisplay.h | 10 ------ 4 files changed, 3 insertions(+), 93 deletions(-) diff --git a/wsi/drm/drmdisplay.cpp b/wsi/drm/drmdisplay.cpp index c29a9164..c542d630 100644 --- a/wsi/drm/drmdisplay.cpp +++ b/wsi/drm/drmdisplay.cpp @@ -155,68 +155,6 @@ void DrmDisplay::DrmConnectorGetDCIP3Support( return; } -void DrmDisplay::GetEDIDDisplayData(const ScopedDrmObjectPropertyPtr &props) { - uint8_t *edid = NULL; - uint64_t edid_blob_id; - struct edid_display_data display_data[4]; - drmModePropertyBlobPtr blob; - - GetDrmObjectPropertyValue("EDID", props, &edid_blob_id); - blob = drmModeGetPropertyBlob(gpu_fd_, edid_blob_id); - if (!blob) { - return; - } - - edid = (uint8_t *)blob->data; - if (!edid) { - drmModeFreePropertyBlob(blob); - return; - } - std::memset(display_data, 0, sizeof(display_data)); - std::memcpy((void *)display_data, (void *)(edid + 54), - sizeof(edid_display_data) * 4); - - for (int i = 0; i < 4; i++) { - if (!(display_data[i].indicate == 0x0000 && - display_data[i].reserved1 == 0x00 && - display_data[i].reserved2 == 0x00)) - continue; - - if (display_data[i].tag_number == 0xfc) { - display_name_.clear(); - size_t display_desc_size = - sizeof(((struct edid_display_data *)0)->desc_data); - size_t display_desc_str_size = - strchrnul((char *)display_data[i].desc_data, '\n') - - (char *)display_data[i].desc_data; - size_t display_desc_copy_size = display_desc_str_size > display_desc_size - ? display_desc_size - : display_desc_str_size; - display_name_.assign((char *)display_data[i].desc_data, - display_desc_copy_size); - } - } - - drmModeFreePropertyBlob(blob); - ITRACE("Got EDID display name \"%s\"\n", display_name_.c_str()); -} - -/* -* Check limited monitors exposing some modes which not -* be supported by monitor hardware actually. Limited monitors -* be defined in HWC_LIMITED_MONITOR_LIST. -*/ -bool DrmDisplay::CheckLimitedMonitor() { - for (unsigned int i = 0; i < HWC_LIMITED_MONITOR_LIST.size(); ++i) { - if (display_name_.compare(HWC_LIMITED_MONITOR_LIST[i]) == 0) { - ITRACE("Got a limited monitor: %s\n", - HWC_LIMITED_MONITOR_LIST[i].c_str()); - return true; - } - } - return false; -} - bool DrmDisplay::ConnectDisplay(const drmModeModeInfo &mode_info, const drmModeConnector *connector, uint32_t config) { @@ -294,8 +232,6 @@ bool DrmDisplay::ConnectDisplay(const drmModeModeInfo &mode_info, ITRACE("DCIP3 support not available"); } - GetEDIDDisplayData(connector_props); - PhysicalDisplay::Connect(); SetHDCPState(desired_protection_support_, content_type_); @@ -773,6 +709,7 @@ void DrmDisplay::SetDrmModeInfo(const std::vector &mode_info) { #endif modes_.emplace_back(mode_info[i]); } + SPIN_UNLOCK(display_lock_); } diff --git a/wsi/drm/drmdisplay.h b/wsi/drm/drmdisplay.h index 50b56440..9e6061ab 100644 --- a/wsi/drm/drmdisplay.h +++ b/wsi/drm/drmdisplay.h @@ -133,8 +133,6 @@ class DrmDisplay : public PhysicalDisplay { first_commit_ = true; } - bool CheckLimitedMonitor(); - private: void ShutDownPipe(); void GetDrmObjectPropertyValue(const char *name, @@ -167,7 +165,6 @@ class DrmDisplay : public PhysicalDisplay { std::vector FindExtendedBlocksForTag(uint8_t *edid, uint8_t block_tag); void DrmConnectorGetDCIP3Support(const ScopedDrmObjectPropertyPtr &props); - void GetEDIDDisplayData(const ScopedDrmObjectPropertyPtr &props); void TraceFirstCommit(); diff --git a/wsi/drm/drmdisplaymanager.cpp b/wsi/drm/drmdisplaymanager.cpp index adef66ef..da6fe4c7 100644 --- a/wsi/drm/drmdisplaymanager.cpp +++ b/wsi/drm/drmdisplaymanager.cpp @@ -306,14 +306,7 @@ bool DrmDisplayManager::UpdateDisplayState() { encoder->crtc_id, display->CrtcId(), display->GetDisplayPipe()); // Set the modes supported for each display - if (display->CheckLimitedMonitor()) { - // only expose the preferred mode for limited monitor - std::vector limited_mode( - 1, connector->modes[preferred_mode]); - display->SetDrmModeInfo(limited_mode); - } else { - display->SetDrmModeInfo(mode); - } + display->SetDrmModeInfo(mode); break; } } @@ -361,14 +354,7 @@ bool DrmDisplayManager::UpdateDisplayState() { IHOTPLUGEVENTTRACE("Connected with crtc: %d pipe:%d \n", display->CrtcId(), display->GetDisplayPipe()); // Set the modes supported for each display - if (display->CheckLimitedMonitor()) { - // only expose the preferred mode for limited monitor - std::vector limited_mode( - 1, connector->modes[preferred_mode]); - display->SetDrmModeInfo(limited_mode); - } else { - display->SetDrmModeInfo(mode); - } + display->SetDrmModeInfo(mode); break; } } diff --git a/wsi/physicaldisplay.h b/wsi/physicaldisplay.h index 4fd91f7e..471f13ca 100644 --- a/wsi/physicaldisplay.h +++ b/wsi/physicaldisplay.h @@ -306,15 +306,5 @@ class PhysicalDisplay : public NativeDisplay, public DisplayPlaneHandler { uint32_t config_ = DEFAULT_CONFIG_ID; }; -struct __attribute__((packed)) edid_display_data { - uint16_t indicate; - uint8_t reserved1; - uint8_t tag_number; - uint8_t reserved2; - uint8_t desc_data[13]; -}; - -const std::vector HWC_LIMITED_MONITOR_LIST{"TD2230 Series"}; - } // namespace hwcomposer #endif // WSI_PHYSICALDISPLAY_H_ From 4f6f6972454617682d520980f1ade71e46dd432e Mon Sep 17 00:00:00 2001 From: Shaofeng Tang Date: Thu, 11 Jul 2019 11:16:55 +0800 Subject: [PATCH 9/9] Set the dest layer as Video when the format is AB24 After create the layer surface with format AB24 for video or protected layer. need to re-set the layer as Video. also do not use RBC once the preferred modifier is 0. Change-Id: Ic01b7069186d847d923af77ea257fb886f5429bb Tests: Work well on Android Q Tracked-On: https://jira.devtools.intel.com/browse/OAM-82976 Signed-off-by: Shaofeng Tang --- common/display/displayplanemanager.cpp | 13 ++++++------- os/android/gralloc1bufferhandler.cpp | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/common/display/displayplanemanager.cpp b/common/display/displayplanemanager.cpp index 68465180..099bc5be 100644 --- a/common/display/displayplanemanager.cpp +++ b/common/display/displayplanemanager.cpp @@ -749,12 +749,11 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) { int dest_x = plane.GetDisplayFrame().left; int dest_w = plane.GetDisplayFrame().right - dest_x; - bool video_separate = plane.IsVideoPlane() && - (plane.GetSourceLayers().size() == 1) && - !(dest_w % 2 || dest_x % 2); + bool video_separate = + plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1); uint32_t preferred_format = 0; uint32_t usage = hwcomposer::kLayerNormal; - if (video_separate) { + if (video_separate && !(dest_w % 2 || dest_x % 2)) { preferred_format = plane.GetDisplayPlane()->GetPreferredVideoFormat(); } else { preferred_format = plane.GetDisplayPlane()->GetPreferredFormat(); @@ -781,16 +780,16 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) { NativeSurface *new_surface = NULL; if (video_separate) { new_surface = CreateVideoSurface(width_, height_); + usage = hwcomposer::kLayerVideo; } else { new_surface = Create3DSurface(width_, height_); } - if (plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1)) - usage = hwcomposer::kLayerVideo; - bool modifer_succeeded = false; new_surface->Init(resource_manager_, preferred_format, usage, modifier, &modifer_succeeded); + if (video_separate) + new_surface->GetLayer()->SetVideoLayer(true); if (modifer_succeeded) { plane.GetDisplayPlane()->PreferredFormatModifierValidated(); diff --git a/os/android/gralloc1bufferhandler.cpp b/os/android/gralloc1bufferhandler.cpp index 61eac39f..fd5ac3e7 100644 --- a/os/android/gralloc1bufferhandler.cpp +++ b/os/android/gralloc1bufferhandler.cpp @@ -149,16 +149,21 @@ bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format, set_format_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, pixel_format); #ifdef ENABLE_RBC - uint64_t modifier = 0; - if (set_modifier_) { - if (preferred_modifier != -1) { - modifier = preferred_modifier; + if (preferred_modifier != 0) { + uint64_t modifier = 0; + if (set_modifier_) { + if (preferred_modifier != -1) { + modifier = preferred_modifier; + } + set_modifier_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, + modifier); } - set_modifier_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, modifier); - } - if (modifier_used && modifier != DRM_FORMAT_MOD_NONE) { - *modifier_used = true; + if (modifier_used && modifier != DRM_FORMAT_MOD_NONE) { + *modifier_used = true; + } + } else { + *modifier_used = false; } #else if (modifier_used) {