diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2021-07-29 01:29:54 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2021-07-29 01:29:54 -0700 |
commit | c141ac7d1224619fa27d24edb20880cbd41f2b3b (patch) | |
tree | 21051a70e06570ace63328e317fbe42c54ff7c26 | |
parent | 28ccb701bbff855d7635240e4a9e0bf5d331559e (diff) | |
parent | 9c9380341cef23664e154c99a05aac9281f99ea0 (diff) |
Merge 9c9380341cef23664e154c99a05aac9281f99ea0 on remote branch
Change-Id: I3b0bc9fade1a763020954476293e270db4184ce7
-rw-r--r-- | composer/QtiComposerClient.cpp | 22 | ||||
-rw-r--r-- | composer/QtiComposerClient.h | 5 | ||||
-rw-r--r-- | composer/QtiComposerCommandBuffer.h | 13 | ||||
-rw-r--r-- | composer/hwc_display.cpp | 47 | ||||
-rw-r--r-- | composer/hwc_display.h | 4 | ||||
-rw-r--r-- | composer/hwc_layers.cpp | 96 | ||||
-rw-r--r-- | composer/hwc_layers.h | 4 | ||||
-rw-r--r-- | composer/hwc_session.cpp | 17 | ||||
-rw-r--r-- | composer/hwc_session.h | 3 | ||||
-rw-r--r-- | config/display-product.mk | 8 | ||||
-rw-r--r-- | include/display_properties.h | 1 | ||||
-rw-r--r-- | sdm/include/core/layer_stack.h | 14 |
12 files changed, 204 insertions, 30 deletions
diff --git a/composer/QtiComposerClient.cpp b/composer/QtiComposerClient.cpp index d829d025..78528b3b 100644 --- a/composer/QtiComposerClient.cpp +++ b/composer/QtiComposerClient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2017 The Android Open Source Project @@ -97,8 +97,9 @@ QtiComposerClient::~QtiComposerClient() { uint32_t displayRequestMask = 0; std::vector<Layer> requestedLayers; std::vector<uint32_t> requestMasks; + IComposerClient::ClientTargetProperty clientTargetProperty; mReader.validateDisplay(dpy.first, changedLayers, compositionTypes, displayRequestMask, - requestedLayers, requestMasks); + requestedLayers, requestMasks, clientTargetProperty); hwc_session_->AcceptDisplayChanges(dpy.first); @@ -1386,7 +1387,8 @@ Error QtiComposerClient::CommandReader::validateDisplay(Display display, std::vector<IComposerClient::Composition>& compositionTypes, uint32_t& displayRequestMask, std::vector<Layer>& requestedLayers, - std::vector<uint32_t>& requestMasks) { + std::vector<uint32_t>& requestMasks, + IComposerClient::ClientTargetProperty& clientTargetProperty) { uint32_t types_count = 0; uint32_t reqs_count = 0; @@ -1438,6 +1440,12 @@ Error QtiComposerClient::CommandReader::validateDisplay(Display display, displayRequestMask = display_reqs; + err = mClient.hwc_session_->GetClientTargetProperty(mDisplay, &clientTargetProperty); + if (err != HWC2_ERROR_NONE) { + // todo: reset to default values + return static_cast<Error>(err); + } + return static_cast<Error>(err); } @@ -1451,13 +1459,15 @@ bool QtiComposerClient::CommandReader::parseValidateDisplay(uint16_t length) { uint32_t displayRequestMask; std::vector<Layer> requestedLayers; std::vector<uint32_t> requestMasks; + IComposerClient::ClientTargetProperty clientTargetProperty; auto err = validateDisplay(mDisplay, changedLayers, compositionTypes, displayRequestMask, - requestedLayers, requestMasks); + requestedLayers, requestMasks, clientTargetProperty); if (static_cast<Error>(err) == Error::NONE) { mWriter.setChangedCompositionTypes(changedLayers, compositionTypes); mWriter.setDisplayRequests(displayRequestMask, requestedLayers, requestMasks); + mWriter.setClientTargetProperty(clientTargetProperty); } else { mWriter.setError(getCommandLoc(), static_cast<Error>(err)); } @@ -1553,14 +1563,16 @@ bool QtiComposerClient::CommandReader::parsePresentOrValidateDisplay(uint16_t le uint32_t displayRequestMask = 0x0; std::vector<Layer> requestedLayers; std::vector<uint32_t> requestMasks; + IComposerClient::ClientTargetProperty clientTargetProperty; auto err = validateDisplay(mDisplay, changedLayers, compositionTypes, displayRequestMask, - requestedLayers, requestMasks); + requestedLayers, requestMasks, clientTargetProperty); // mResources->setDisplayMustValidateState(mDisplay, false); if (err == Error::NONE) { mWriter.setPresentOrValidateResult(0); mWriter.setChangedCompositionTypes(changedLayers, compositionTypes); mWriter.setDisplayRequests(displayRequestMask, requestedLayers, requestMasks); + mWriter.setClientTargetProperty(clientTargetProperty); } else { mWriter.setError(getCommandLoc(), err); } diff --git a/composer/QtiComposerClient.h b/composer/QtiComposerClient.h index 77fb14e1..468f12ac 100644 --- a/composer/QtiComposerClient.h +++ b/composer/QtiComposerClient.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2017 The Android Open Source Project @@ -281,7 +281,8 @@ class QtiComposerClient : public IQtiComposerClient { Error validateDisplay(Display display, std::vector<Layer>& changedLayers, std::vector<IComposerClient::Composition>& compositionTypes, uint32_t& displayRequestMask, std::vector<Layer>& requestedLayers, - std::vector<uint32_t>& requestMasks); + std::vector<uint32_t>& requestMasks, + IComposerClient::ClientTargetProperty& clienttargetproperty); Error presentDisplay(Display display, shared_ptr<Fence>* presentFence, std::vector<Layer>& layers, std::vector<shared_ptr<Fence>>& releaseFences); diff --git a/composer/QtiComposerCommandBuffer.h b/composer/QtiComposerCommandBuffer.h index ab1dce72..e9526833 100644 --- a/composer/QtiComposerCommandBuffer.h +++ b/composer/QtiComposerCommandBuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2017 The Android Open Source Project @@ -504,6 +504,17 @@ class CommandWriter { endCommand(); } + // Commands from ::android::hardware::graphics::composer::V2_4::IComposerClient follow. + static constexpr uint16_t kSetClientTargetPropertyLength = 2; + void setClientTargetProperty( + const IQtiComposerClient::ClientTargetProperty& clientTargetProperty) { + beginCommand(IQtiComposerClient::Command::SET_CLIENT_TARGET_PROPERTY, + kSetClientTargetPropertyLength); + writeSigned(static_cast<int32_t>(clientTargetProperty.pixelFormat)); + writeSigned(static_cast<int32_t>(clientTargetProperty.dataspace)); + endCommand(); + } + protected: // Commands from ::android::hardware::graphics::composer::V2_1::IComposerClient follow. void beginCommand(IQtiComposerClient::Command command, uint16_t length) { diff --git a/composer/hwc_display.cpp b/composer/hwc_display.cpp index a36e7bc0..4df0665d 100644 --- a/composer/hwc_display.cpp +++ b/composer/hwc_display.cpp @@ -828,14 +828,6 @@ void HWCDisplay::BuildLayerStack() { int32_t client_target_dataspace = GetDataspaceFromColorMode(GetCurrentColorMode()); SetClientTargetDataSpace(client_target_dataspace); layer_stack_.layers.push_back(sdm_client_target); - - // fall back frame composition to GPU when client target is 10bit - // TODO(user): clarify the behaviour from Client(SF) and SDM Extn - - // when handling 10bit FBT, as it would affect blending - if (Is10BitFormat(sdm_client_target->input_buffer.format)) { - // Must fall back to client composition - MarkLayersForClientComposition(); - } } void HWCDisplay::BuildSolidFillStack() { @@ -1223,13 +1215,8 @@ HWC2::Error HWCDisplay::SetClientTarget(buffer_handle_t target, shared_ptr<Fence Layer *sdm_layer = client_target_->GetSDMLayer(); sdm_layer->frame_rate = std::min(current_refresh_rate_, HWCDisplay::GetThrottlingRefreshRate()); client_target_->SetLayerSurfaceDamage(damage); - int translated_dataspace = TranslateFromLegacyDataspace(dataspace); - if (client_target_->GetLayerDataspace() != translated_dataspace) { - DLOGW("New Dataspace = %d not matching Dataspace from color mode = %d", - translated_dataspace, client_target_->GetLayerDataspace()); - return HWC2::Error::BadParameter; - } client_target_->SetLayerBuffer(target, acquire_fence); + client_target_->SetLayerDataspace(dataspace); client_target_handle_ = target; client_acquire_fence_ = acquire_fence; client_dataspace_ = dataspace; @@ -2813,4 +2800,34 @@ int HWCDisplay::GetActiveConfigIndex() { return active_config_index_; } -} // namespace sdm +HWC2::Error HWCDisplay::GetClientTargetProperty(ClientTargetProperty *out_client_target_property) { + + Layer *client_target_layer = client_target_->GetSDMLayer(); + if (!client_target_layer->request.flags.update_format) { + return HWC2::Error::None; + } + int32_t format = 0; + uint64_t flags = 0; + auto err = buffer_allocator_->SetBufferInfo(client_target_layer->request.format, &format, + &flags); + if (err) { + DLOGE("Invalid format: %s requested", GetFormatString(client_target_layer->request.format)); + return HWC2::Error::BadParameter; + } + Dataspace dataspace; + DisplayError error = ColorMetadataToDataspace(layer_stack_.gpu_target_color_metadata, + &dataspace); + if (error != kErrorNone) { + DLOGE("Invalid Dataspace requested: Primaries = %d Transfer = %d ds = %d", + layer_stack_.gpu_target_color_metadata.colorPrimaries, + layer_stack_.gpu_target_color_metadata.transfer, dataspace); + return HWC2::Error::BadParameter; + } + out_client_target_property->dataspace = dataspace; + out_client_target_property->pixelFormat = + (android::hardware::graphics::common::V1_2::PixelFormat)format; + + return HWC2::Error::None; +} + +} //namespace sdm diff --git a/composer/hwc_display.h b/composer/hwc_display.h index 10e3f7b5..9f969ecf 100644 --- a/composer/hwc_display.h +++ b/composer/hwc_display.h @@ -44,7 +44,7 @@ #include "hwc_buffer_sync_handler.h" using android::hardware::graphics::common::V1_2::ColorMode; -using android::hardware::graphics::common::V1_1::Dataspace; +using android::hardware::graphics::common::V1_2::Dataspace; using android::hardware::graphics::common::V1_1::RenderIntent; using android::hardware::graphics::common::V1_2::Hdr; namespace composer_V2_4 = ::android::hardware::graphics::composer::V2_4; @@ -52,6 +52,7 @@ using HwcAttribute = composer_V2_4::IComposerClient::Attribute; using VsyncPeriodChangeConstraints = composer_V2_4::IComposerClient::VsyncPeriodChangeConstraints; using VsyncPeriodChangeTimeline = composer_V2_4::VsyncPeriodChangeTimeline; using VsyncPeriodNanos = composer_V2_4::VsyncPeriodNanos; +using ClientTargetProperty = composer_V2_4::IComposerClient::ClientTargetProperty; namespace sdm { @@ -432,6 +433,7 @@ class HWCDisplay : public DisplayEventHandler { HWC2::Error SetDisplayElapseTime(uint64_t time); virtual bool HasReadBackBufferSupport() { return false; } virtual bool IsDisplayIdle() { return false; }; + virtual HWC2::Error GetClientTargetProperty(ClientTargetProperty *out_client_target_property); protected: static uint32_t throttling_refresh_rate_; diff --git a/composer/hwc_layers.cpp b/composer/hwc_layers.cpp index a3c9f11a..a2c42278 100644 --- a/composer/hwc_layers.cpp +++ b/composer/hwc_layers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -205,6 +205,99 @@ bool GetSDMColorSpace(const int32_t &dataspace, ColorMetaData *color_metadata) { return valid; } +DisplayError ColorMetadataToDataspace(ColorMetaData color_metadata, Dataspace *dataspace) { + Dataspace primaries, transfer, range = Dataspace::UNKNOWN; + + switch (color_metadata.colorPrimaries) { + case ColorPrimaries_BT709_5: + primaries = Dataspace::STANDARD_BT709; + break; + case ColorPrimaries_BT470_6M: + primaries = Dataspace::STANDARD_BT470M; + break; + case ColorPrimaries_BT601_6_625: + primaries = Dataspace::STANDARD_BT601_625; + break; + case ColorPrimaries_BT601_6_525: + primaries = Dataspace::STANDARD_BT601_525; + break; + case ColorPrimaries_GenericFilm: + primaries = Dataspace::STANDARD_FILM; + break; + case ColorPrimaries_BT2020: + primaries = Dataspace::STANDARD_BT2020; + break; + case ColorPrimaries_AdobeRGB: + primaries = Dataspace::STANDARD_ADOBE_RGB; + break; + case ColorPrimaries_DCIP3: + primaries = Dataspace::STANDARD_DCI_P3; + break; + default: + return kErrorNotSupported; + /* + ColorPrimaries_SMPTE_240M; + ColorPrimaries_SMPTE_ST428; + ColorPrimaries_EBU3213; + */ + } + + switch (color_metadata.transfer) { + case Transfer_sRGB: + transfer = Dataspace::TRANSFER_SRGB; + break; + case Transfer_Gamma2_2: + transfer = Dataspace::TRANSFER_GAMMA2_2; + break; + case Transfer_Gamma2_8: + transfer = Dataspace::TRANSFER_GAMMA2_8; + break; + case Transfer_SMPTE_170M: + transfer = Dataspace::TRANSFER_SMPTE_170M; + break; + case Transfer_Linear: + transfer = Dataspace::TRANSFER_LINEAR; + break; + case Transfer_SMPTE_ST2084: + transfer = Dataspace::TRANSFER_ST2084; + break; + case Transfer_HLG: + transfer = Dataspace::TRANSFER_HLG; + break; + default: + return kErrorNotSupported; + /* + Transfer_SMPTE_240M + Transfer_Log + Transfer_Log_Sqrt + Transfer_XvYCC + Transfer_BT1361 + Transfer_sYCC + Transfer_BT2020_2_1 + Transfer_BT2020_2_2 + Transfer_SMPTE_ST2084 + Transfer_ST_428 + */ + } + + switch (color_metadata.range) { + case Range_Full: + range = Dataspace::RANGE_FULL; + break; + case Range_Limited: + range = Dataspace::RANGE_LIMITED; + break; + case Range_Extended: + range = Dataspace::RANGE_EXTENDED; + break; + default: + return kErrorNotSupported; + } + + *dataspace = (Dataspace)((uint32_t)primaries | (uint32_t)transfer | (uint32_t)range); + return kErrorNone; +} + // Layer operations HWCLayer::HWCLayer(hwc2_display_t display_id, HWCBufferAllocator *buf_allocator) : id_(next_id_++), display_id_(display_id), buffer_allocator_(buf_allocator) { @@ -761,6 +854,7 @@ LayerBufferFormat HWCLayer::GetSDMFormat(const int32_t &source, const int flags) format = kFormatBGR565; break; case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: + case HAL_PIXEL_FORMAT_NV12_LINEAR_FLEX: case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS: format = kFormatYCbCr420SemiPlanarVenus; break; diff --git a/composer/hwc_layers.h b/composer/hwc_layers.h index 1010842d..852668f1 100644 --- a/composer/hwc_layers.h +++ b/composer/hwc_layers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -46,6 +46,7 @@ using PerFrameMetadataKey = android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadataKey; using vendor::qti::hardware::display::composer::V3_0::IQtiComposerClient; +using android::hardware::graphics::common::V1_2::Dataspace; namespace sdm { @@ -56,6 +57,7 @@ bool GetRange(const int32_t &dataspace, ColorRange *color_range); bool GetSDMColorSpace(const int32_t &dataspace, ColorMetaData *color_metadata); bool IsBT2020(const ColorPrimaries &color_primary); int32_t TranslateFromLegacyDataspace(const int32_t &legacy_ds); +DisplayError ColorMetadataToDataspace(ColorMetaData color_metadata, Dataspace *dataspace); enum GeometryChanges { kNone = 0x000, diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp index b715dc84..4b56fa73 100644 --- a/composer/hwc_session.cpp +++ b/composer/hwc_session.cpp @@ -3117,13 +3117,14 @@ void HWCSession::HandleSecureSession() { display < HWCCallbacks::kNumRealDisplays; display++) { Locker::ScopeLock lock_d(locker_[display]); HWCDisplay *hwc_display = hwc_display_[display]; - if (!hwc_display || hwc_display->GetDisplayClass() != DISPLAY_CLASS_BUILTIN) { + if (!hwc_display) { continue; } bool is_active_secure_display = false; // The first On/Doze/DozeSuspend built-in display is taken as the secure display. if (!found_active_secure_display && + hwc_display->GetDisplayClass() == DISPLAY_CLASS_BUILTIN && hwc_display->GetCurrentPowerMode() != HWC2::PowerMode::Off) { is_active_secure_display = true; found_active_secure_display = true; @@ -3420,6 +3421,20 @@ int32_t HWCSession::GetDisplayConnectionType(hwc2_display_t display, return HWC2_ERROR_NONE; } +int32_t HWCSession::GetClientTargetProperty(hwc2_display_t display, + HwcClientTargetProperty *outClientTargetProperty) { + if (!outClientTargetProperty) { + return HWC2_ERROR_BAD_PARAMETER; + } + + if (display >= HWCCallbacks::kNumDisplays) { + return HWC2_ERROR_BAD_DISPLAY; + } + + return CallDisplayFunction(display, &HWCDisplay::GetClientTargetProperty, + outClientTargetProperty); +} + int32_t HWCSession::GetDisplayBrightnessSupport(hwc2_display_t display, bool *outSupport) { if (!outSupport) { return HWC2_ERROR_BAD_PARAMETER; diff --git a/composer/hwc_session.h b/composer/hwc_session.h index 6205a2be..acd8844d 100644 --- a/composer/hwc_session.h +++ b/composer/hwc_session.h @@ -60,6 +60,7 @@ namespace composer_V2_3 = ::android::hardware::graphics::composer::V2_3; using HwcDisplayCapability = composer_V2_4::IComposerClient::DisplayCapability; using HwcDisplayCapability_2_3 = composer_V2_3::IComposerClient::DisplayCapability; using HwcDisplayConnectionType = composer_V2_4::IComposerClient::DisplayConnectionType; +using HwcClientTargetProperty = composer_V2_4::IComposerClient::ClientTargetProperty; namespace sdm { @@ -242,6 +243,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient, int32_t GetDataspaceSaturationMatrix(int32_t /*Dataspace*/ int_dataspace, float *out_matrix); int32_t SetDisplayBrightnessScale(const android::Parcel *input_parcel); int32_t GetDisplayConnectionType(hwc2_display_t display, HwcDisplayConnectionType *type); + int32_t GetClientTargetProperty(hwc2_display_t display, + HwcClientTargetProperty *outClientTargetProperty); // Layer functions int32_t SetLayerBuffer(hwc2_display_t display, hwc2_layer_t layer, buffer_handle_t buffer, diff --git a/config/display-product.mk b/config/display-product.mk index e6c3fedf..4f32ba1c 100644 --- a/config/display-product.mk +++ b/config/display-product.mk @@ -113,7 +113,6 @@ endif ifeq ($(TARGET_BOARD_PLATFORM),lito) PRODUCT_PROPERTY_OVERRIDES += \ - vendor.display.enable_perf_hint_large_comp_cycle=1 \ debug.sf.high_fps_late_sf_phase_offset_ns=-4000000 \ debug.sf.high_fps_early_phase_offset_ns=-4000000 \ debug.sf.high_fps_early_gl_phase_offset_ns=-4000000 \ @@ -123,6 +122,13 @@ PRODUCT_PROPERTY_OVERRIDES += \ debug.sf.enable_advanced_sf_phase_offset=1 endif +ifeq ($(TARGET_FWK_SUPPORTS_FULL_VALUEADDS), true) + ifeq ($(TARGET_BOARD_PLATFORM),lito) + PRODUCT_PROPERTY_OVERRIDES += \ + vendor.display.enable_perf_hint_large_comp_cycle=1 + endif +endif + #Set WCG properties PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.has_wide_color_display=true PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.has_HDR_display=true diff --git a/include/display_properties.h b/include/display_properties.h index d6b28a0c..1adba755 100644 --- a/include/display_properties.h +++ b/include/display_properties.h @@ -130,6 +130,7 @@ // PERF hint properties #define ENABLE_PERF_HINT_LARGE_COMP_CYCLE DISPLAY_PROP("enable_perf_hint_large_comp_cycle") +#define ENABLE_HDR10_GPU_TARGET DISPLAY_PROP("enable_hdr10_gpu_target") // Add all vendor.display properties above diff --git a/sdm/include/core/layer_stack.h b/sdm/include/core/layer_stack.h index e35ac3be..0c9841f3 100644 --- a/sdm/include/core/layer_stack.h +++ b/sdm/include/core/layer_stack.h @@ -203,6 +203,8 @@ struct LayerRequestFlags { uint32_t src_tone_map: 1; //!< This flag will be set by SDM when the layer needs //!< source tone map. uint32_t rc: 1; //!< This flag will be set by SDM when the layer is drawn by RC HW. + uint32_t update_format: 1; //!< This flag will be set by SDM when layer format is updated + //!< The buffer format is mentioned in the LayerRequest Format }; uint32_t request_flags = 0; //!< For initialization purpose only. //!< Shall not be refered directly. @@ -218,9 +220,12 @@ struct LayerRequestFlags { */ struct LayerRequest { LayerRequestFlags flags; // Flags associated with this request - LayerBufferFormat format = kFormatRGBA8888; // Requested format - uint32_t width = 0; // Requested unaligned width. + LayerBufferFormat format = kFormatRGBA8888; // Requested format - Used with tone_map and + // update_format flags + uint32_t width = 0; // Requested unaligned width. + // Used with tone_map flag uint32_t height = 0; // Requested unalighed height + // Used with tone_map flag }; /*! @brief This structure defines flags associated with a layer stack. The 1-bit flag can be set to @@ -456,6 +461,11 @@ struct LayerStack { PrimariesTransfer blend_cs = {}; //!< o/p - Blending color space of the frame, updated by SDM uint64_t elapse_timestamp = 0; //!< system time until which display commit needs to be held + + ColorMetaData gpu_target_color_metadata = { .colorPrimaries = ColorPrimaries_BT709_5, + .range = Range_Full, + .transfer = Transfer_sRGB }; + //!< o/p - from SDM, applies to the Frame }; } // namespace sdm |