summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-01-09 06:12:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-09 06:12:50 +0000
commit8bef3a420db17c013233de38b94785c9246efed6 (patch)
tree07a7dd5e8a7ed622e427e867d22047b9ecbcd578
parent7e2c516f5b78c1f5e2302fc0fa77709d67da6c6b (diff)
parent1a5a729ea4773d21339e739d3ac12c1eab279a75 (diff)
downloaddisplay-8bef3a420db17c013233de38b94785c9246efed6.tar.gz
Merge "revert conflict commits from AU053" into qt-qpr1-dev
-rw-r--r--common.mk82
-rw-r--r--config/display-product.mk1
-rw-r--r--include/display_properties.h6
-rw-r--r--libdrmutils/drm_interface.h11
-rw-r--r--sdm/include/core/display_interface.h20
-rw-r--r--sdm/include/core/layer_stack.h2
-rw-r--r--sdm/include/private/hw_info_types.h28
-rw-r--r--sdm/include/private/resource_interface.h2
-rw-r--r--sdm/include/private/strategy_interface.h3
-rw-r--r--sdm/libs/core/comp_manager.cpp29
-rw-r--r--sdm/libs/core/comp_manager.h6
-rwxr-xr-xsdm/libs/core/display_base.cpp65
-rwxr-xr-x[-rw-r--r--]sdm/libs/core/display_base.h10
-rw-r--r--sdm/libs/core/display_builtin.cpp73
-rw-r--r--sdm/libs/core/display_builtin.h7
-rw-r--r--sdm/libs/core/display_pluggable.cpp6
-rw-r--r--sdm/libs/core/drm/hw_device_drm.cpp107
-rw-r--r--sdm/libs/core/drm/hw_device_drm.h2
-rw-r--r--sdm/libs/core/drm/hw_events_drm.cpp4
-rw-r--r--sdm/libs/core/drm/hw_info_drm.cpp32
-rw-r--r--sdm/libs/core/drm/hw_peripheral_drm.cpp1
-rw-r--r--sdm/libs/core/drm/hw_tv_drm.cpp4
-rw-r--r--sdm/libs/core/drm/hw_virtual_drm.cpp2
-rw-r--r--sdm/libs/core/fb/hw_primary.cpp9
-rw-r--r--sdm/libs/core/strategy.cpp9
-rw-r--r--sdm/libs/core/strategy.h3
-rw-r--r--sdm/libs/hwc2/Android.mk80
-rw-r--r--sdm/libs/hwc2/display_null.h2
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.cpp288
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.h17
-rw-r--r--sdm/libs/hwc2/hwc_callbacks.h6
-rw-r--r--sdm/libs/hwc2/hwc_display.cpp138
-rw-r--r--sdm/libs/hwc2/hwc_display.h23
-rw-r--r--sdm/libs/hwc2/hwc_display_builtin.cpp61
-rw-r--r--sdm/libs/hwc2/hwc_display_builtin.h4
-rw-r--r--sdm/libs/hwc2/hwc_display_dummy.cpp85
-rw-r--r--sdm/libs/hwc2/hwc_display_dummy.h58
-rw-r--r--sdm/libs/hwc2/hwc_display_pluggable.cpp8
-rw-r--r--sdm/libs/hwc2/hwc_display_pluggable.h3
-rw-r--r--sdm/libs/hwc2/hwc_display_virtual.h3
-rw-r--r--sdm/libs/hwc2/hwc_layers.cpp3
-rw-r--r--sdm/libs/hwc2/hwc_session.cpp210
-rw-r--r--sdm/libs/hwc2/hwc_session.h107
-rw-r--r--sdm/libs/hwc2/hwc_session_services.cpp146
44 files changed, 515 insertions, 1251 deletions
diff --git a/common.mk b/common.mk
index 0a372005..1fa8c03d 100644
--- a/common.mk
+++ b/common.mk
@@ -1,6 +1,51 @@
#Common headers
display_top := $(call my-dir)
+#Get the highest display config version available
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.9" ];\
+ then echo DISPLAY_CONFIG_1_9; fi)
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.8" ];\
+ then echo DISPLAY_CONFIG_1_8; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.7" ];\
+ then echo DISPLAY_CONFIG_1_7; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.6" ];\
+ then echo DISPLAY_CONFIG_1_6; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.5" ];\
+ then echo DISPLAY_CONFIG_1_5; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.4" ];\
+ then echo DISPLAY_CONFIG_1_4; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.3" ];\
+ then echo DISPLAY_CONFIG_1_3; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.2" ];\
+ then echo DISPLAY_CONFIG_1_2; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.1" ];\
+ then echo DISPLAY_CONFIG_1_1; fi)
+endif
+
#Common C flags
common_flags := -Wno-missing-field-initializers
common_flags += -Wconversion -Wall -Werror
@@ -10,6 +55,43 @@ ifeq ($(TARGET_IS_HEADLESS), true)
LOCAL_CLANG := false
endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
+ common_flags += -DDISPLAY_CONFIG_1_1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_2)
+ common_flags += -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_3)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_4)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2
+ common_flags += -DDISPLAY_CONFIG_1_3 -DDISPLAY_CONFIG_1_4
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_5)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
+ common_flags += -DDISPLAY_CONFIG_1_4 -DDISPLAY_CONFIG_1_5
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_6)
+ common_flags += -DDISPLAY_CONFIG_1_6 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_4
+ common_flags += -DDISPLAY_CONFIG_1_3 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_7)
+ common_flags += -DDISPLAY_CONFIG_1_7
+ common_flags += -DDISPLAY_CONFIG_1_6 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_4
+ common_flags += -DDISPLAY_CONFIG_1_3 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_8)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
+ common_flags += -DDISPLAY_CONFIG_1_4 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_6
+ common_flags += -DDISPLAY_CONFIG_1_7 -DDISPLAY_CONFIG_1_8
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_9)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
+ common_flags += -DDISPLAY_CONFIG_1_4 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_6
+ common_flags += -DDISPLAY_CONFIG_1_7 -DDISPLAY_CONFIG_1_8 -DDISPLAY_CONFIG_1_9
+endif
+
ifeq ($(TARGET_USES_COLOR_METADATA), true)
common_flags += -DUSE_COLOR_METADATA
endif
diff --git a/config/display-product.mk b/config/display-product.mk
index eda2ed2e..c309e818 100644
--- a/config/display-product.mk
+++ b/config/display-product.mk
@@ -22,7 +22,6 @@ PRODUCT_PACKAGES += \
vendor.display.config@1.7.vendor \
vendor.display.config@1.8.vendor \
vendor.display.config@1.9.vendor \
- vendor.display.config@1.10.vendor \
modetest
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/include/display_properties.h b/include/display_properties.h
index 06ab31db..98e90a06 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -121,14 +121,10 @@
#define VIRTUAL_BASEID_AND_SIZE_PROP DISPLAY_PROP("virtual_baseid_and_size")
#define ENABLE_QDCM_DIAG DISPLAY_PROP("enable_qdcm_diag")
#define QDCM_DISABLE_FACTORY_MODE_PROP DISPLAY_PROP("qdcm.disable_factory_mode")
-#define DISABLE_DEFER_POWER_STATE DISPLAY_PROP("disable_defer_power_state")
#define ZERO_SWAP_INTERVAL "vendor.debug.egl.swapinterval"
-#define ENABLE_OPTIMIZE_REFRESH DISPLAY_PROP("enable_optimize_refresh")
-#define ENABLE_ASYNC_POWERMODE DISPLAY_PROP("enable_async_powermode")
+#define ENABLE_DROP_REFRESH DISPLAY_PROP("enable_drop_refresh")
#define DISABLE_UI_3D_TONEMAP DISPLAY_PROP("disable_ui_3d_tonemap")
-#define DISABLE_PARALLEL_CACHE DISPLAY_PROP("disable_parallel_cache")
-#define ENABLE_FORCE_SPLIT DISPLAY_PROP("enable_force_split")
#define DEFER_FPS_FRAME_COUNT DISPLAY_PROP("defer_fps_frame_count")
#endif // __DISPLAY_PROPERTIES_H__
diff --git a/libdrmutils/drm_interface.h b/libdrmutils/drm_interface.h
index 62db78e0..56201645 100644
--- a/libdrmutils/drm_interface.h
+++ b/libdrmutils/drm_interface.h
@@ -34,7 +34,6 @@
#include <string>
#include <utility>
#include <vector>
-#include <bitset>
#include "xf86drm.h"
#include "xf86drmMode.h"
@@ -510,13 +509,6 @@ struct DRMCrtcInfo {
bool concurrent_writeback = false;
uint32_t num_mnocports;
uint32_t mnoc_bus_width;
- bool use_baselayer_for_stage = false;
- uint32_t vig_limit_index = 0;
- uint32_t dma_limit_index = 0;
- uint32_t scaling_limit_index = 0;
- uint32_t rotation_limit_index = 0;
- uint32_t line_width_constraints_count = 0;
- std::vector< std::pair <uint32_t, uint32_t> > line_width_limits;
};
enum struct DRMPlaneType {
@@ -559,8 +551,6 @@ struct DRMPlaneTypeInfo {
uint32_t dgm_csc_version = 0; // csc used with DMA
std::map<DRMTonemapLutType, uint32_t> tonemap_lut_version_map = {};
bool block_sec_ui = false;
- // Allow all planes to be usable on all displays by default
- std::bitset<32> hw_block_mask = std::bitset<32>().set();
};
// All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority
@@ -786,7 +776,6 @@ enum struct DRMCWbCaptureMode {
enum struct DRMQsyncMode {
NONE = 0,
CONTINUOUS,
- ONESHOT,
};
enum struct DRMTopologyControl {
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index 5a8ccd9a..79572880 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -159,10 +159,9 @@ enum SecureEvent {
/*! @brief This enum represents the QSync modes supported by the hardware. */
enum QSyncMode {
- kQSyncModeNone, // This is set by the client to disable qsync
- kQSyncModeContinuous, // This is set by the client to enable qsync forever
- kQsyncModeOneShot, // This is set by client to enable qsync only for current frame.
- kQsyncModeOneShotContinuous, // This is set by client to enable qsync only for every commit.
+ kQSyncModeNone, // This is set by the client to disable qsync
+ kQSyncModeContinuous, // This is set by the client to enable qsync forever
+ kQsyncModeOneShot, // This is set by client to enable qsync only for current frame.
};
/*! @brief This structure defines configuration for display dpps ad4 region of interest. */
@@ -526,14 +525,6 @@ class DisplayInterface {
*/
virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate) = 0;
- /*! @brief Method to get the refresh rate of a display.
-
- @param[in] refresh_rate refresh rate of the display.
-
- @return \link DisplayError \endlink
- */
- virtual DisplayError GetRefreshRate(uint32_t *refresh_rate) = 0;
-
/*! @brief Method to query whether scanning is support for the HDMI display.
@return \link DisplayError \endlink
@@ -859,11 +850,6 @@ class DisplayInterface {
*/
virtual DisplayError SetPanelLuminanceAttributes(float min_lum, float max_lum) = 0;
- /*! @brief Method to query if there is a need to validate.
-
- @return \link boolean \endlink
- */
- virtual bool CanSkipValidate() = 0;
/*! @brief Method to turn on histogram events. */
virtual DisplayError colorSamplingOn() = 0;
diff --git a/sdm/include/core/layer_stack.h b/sdm/include/core/layer_stack.h
index b49c425c..7c2fad62 100644
--- a/sdm/include/core/layer_stack.h
+++ b/sdm/include/core/layer_stack.h
@@ -275,8 +275,6 @@ struct LayerStackFlags {
uint32_t fast_path : 1; //!< Preference for fast/slow path draw-cycle, set by client.
uint32_t config_changed : 1; //!< This flag indicates Display config must be validated.
-
- uint32_t mask_present : 1; //!< Set if layer stack has mask layers.
};
uint32_t flags = 0; //!< For initialization purpose only.
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 0aa8cd6c..a723ce63 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -35,12 +35,9 @@
#include <string>
#include <bitset>
#include <memory>
-#include <utility>
namespace sdm {
using std::string;
-using std::pair;
-using std::vector;
const int kMaxSDELayers = 16; // Maximum number of layers that can be handled by MDP5 hardware
// in a given layer stack.
@@ -128,7 +125,6 @@ enum HWPipeFlags {
};
enum HWAVRModes {
- kQsyncNone, // Disables Qsync.
kContinuousMode, // Mode to enable AVR feature for every frame.
kOneShotMode, // Mode to enable AVR feature for particular frame.
};
@@ -179,15 +175,6 @@ enum class HWRecoveryEvent : uint32_t {
kDisplayPowerReset, // driver requesting display power cycle
};
-enum SDMVersion {
- kVersionSDM855V1 = SDEVERSION(5, 0, 0),
- kVersionSDM855V2 = SDEVERSION(5, 0, 1),
- kVersionSM6150V1 = SDEVERSION(5, 3, 0),
- kVersionSM8250V1 = SDEVERSION(6, 0, 0),
- kVersionSM7250V1 = SDEVERSION(6, 1, 0),
- kVersionSM6250V1 = SDEVERSION(6, 2, 0),
-};
-
typedef std::map<HWSubBlockType, std::vector<LayerBufferFormat>> FormatsMap;
typedef std::map<LayerBufferFormat, float> CompRatioMap;
@@ -219,8 +206,6 @@ struct HWPipeCaps {
uint32_t dgm_csc_version = 0;
std::map<HWToneMapLut, uint32_t> tm_lut_version_map = {};
bool block_sec_ui = false;
- // Allow all pipelines to be usable on all displays by default
- std::bitset<32> hw_block_mask = std::bitset<32>().set();
};
struct HWRotatorInfo {
@@ -262,11 +247,6 @@ enum InlineRotationVersion {
kInlineRotationV1p1,
};
-const int kPipeVigLimit = (1 << 0);
-const int kPipeDmaLimit = (1 << 1);
-const int kPipeScalingLimit = (1 << 2);
-const int kPipeRotationLimit = (1 << 3);
-
struct HWResourceInfo {
uint32_t hw_version = 0;
uint32_t hw_revision = 0;
@@ -332,10 +312,6 @@ struct HWResourceInfo {
int secure_disp_blend_stage = -1;
uint32_t num_mnocports = 2;
uint32_t mnoc_bus_width = 32;
- bool use_baselayer_for_stage = false;
- uint32_t line_width_constraints_count = 0;
- vector< pair <uint32_t, uint32_t> > line_width_limits;
- vector< pair <uint32_t, uint32_t> > line_width_constraints;
};
struct HWSplitInfo {
@@ -585,7 +561,7 @@ struct HWDestScaleInfo {
typedef std::map<uint32_t, HWDestScaleInfo *> DestScaleInfoMap;
struct HWAVRInfo {
- bool update = false; // Update avr setting.
+ bool enable = false; // Flag to Enable AVR feature
HWAVRModes mode = kContinuousMode; // Specifies the AVR mode
};
@@ -624,7 +600,6 @@ struct HWPipeInfo {
HWPipeCscInfo dgm_csc_info = {};
std::vector<HWPipeTonemapLutInfo> lut_info = {};
HWSrcTonemap tonemap = kSrcTonemapNone;
- LayerTransform transform;
};
struct HWSolidfillStage {
@@ -768,7 +743,6 @@ struct HWMixerAttributes {
uint32_t height = 0; // Layer mixer height
uint32_t split_left = 0;
LayerBufferFormat output_format = kFormatRGB101010; // Layer mixer output format
- uint32_t mixer_index = 0;
bool operator !=(const HWMixerAttributes &mixer_attributes) {
return ((width != mixer_attributes.width) ||
diff --git a/sdm/include/private/resource_interface.h b/sdm/include/private/resource_interface.h
index 338af953..fa4efb64 100644
--- a/sdm/include/private/resource_interface.h
+++ b/sdm/include/private/resource_interface.h
@@ -37,8 +37,6 @@ class ResourceInterface {
kCmdGetDefaultClk,
kCmdDisableRotatorOneFrame,
kCmdSetDisplayState,
- kCmdUpdateSyncHandle,
- kCmdCheckEnforceSplit,
kCmdMax,
};
diff --git a/sdm/include/private/strategy_interface.h b/sdm/include/private/strategy_interface.h
index 31fda2aa..3f1b9abd 100644
--- a/sdm/include/private/strategy_interface.h
+++ b/sdm/include/private/strategy_interface.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -57,7 +57,6 @@ class StrategyInterface {
/* Sets the list of color modes supported on a display */
virtual DisplayError SetColorModesInfo(const std::vector<PrimariesTransfer> &colormodes_cs) = 0;
virtual DisplayError SetBlendSpace(const PrimariesTransfer &blend_space) = 0;
- virtual bool CanSkipValidate() = 0;
virtual ~StrategyInterface() { }
};
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index b11ff18d..3628bcec 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -186,18 +186,6 @@ DisplayError CompManager::UnregisterDisplay(Handle display_ctx) {
return kErrorNone;
}
-DisplayError CompManager::CheckEnforceSplit(Handle comp_handle,
- uint32_t new_refresh_rate) {
- SCOPE_LOCK(locker_);
- DisplayError error = kErrorNone;
- DisplayCompositionContext *display_comp_ctx =
- reinterpret_cast<DisplayCompositionContext *>(comp_handle);
-
- error = resource_intf_->Perform(ResourceInterface::kCmdCheckEnforceSplit,
- display_comp_ctx->display_resource_ctx, new_refresh_rate);
- return error;
-}
-
DisplayError CompManager::ReconfigureDisplay(Handle comp_handle,
const HWDisplayAttributes &display_attributes,
const HWPanelInfo &hw_panel_info,
@@ -223,12 +211,6 @@ DisplayError CompManager::ReconfigureDisplay(Handle comp_handle,
return error;
}
- error = resource_intf_->Perform(ResourceInterface::kCmdCheckEnforceSplit,
- display_comp_ctx->display_resource_ctx, display_attributes.fps);
- if (error != kErrorNone) {
- return error;
- }
-
if (display_comp_ctx->strategy) {
error = display_comp_ctx->strategy->Reconfigure(hw_panel_info, display_attributes,
mixer_attributes, fb_config);
@@ -569,7 +551,7 @@ DisplayError CompManager::ControlDpps(bool enable) {
return kErrorNone;
}
-bool CompManager::SetDisplayState(Handle display_ctx, DisplayState state, int sync_handle) {
+bool CompManager::SetDisplayState(Handle display_ctx, DisplayState state) {
DisplayCompositionContext *display_comp_ctx =
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
@@ -607,8 +589,6 @@ bool CompManager::SetDisplayState(Handle display_ctx, DisplayState state, int sy
bool inactive = (state == kStateOff) || (state == kStateDozeSuspend);
UpdateStrategyConstraints(display_comp_ctx->is_primary_panel, inactive);
- resource_intf_->Perform(ResourceInterface::kCmdUpdateSyncHandle,
- display_comp_ctx->display_resource_ctx, sync_handle);
return true;
}
@@ -666,11 +646,4 @@ void CompManager::UpdateStrategyConstraints(bool is_primary, bool disabled) {
max_sde_builtin_layers_ = (disabled && (powered_on_displays_.size() <= 1)) ? kMaxSDELayers : 2;
}
-bool CompManager::CanSkipValidate(Handle display_ctx) {
- DisplayCompositionContext *display_comp_ctx =
- reinterpret_cast<DisplayCompositionContext *>(display_ctx);
-
- return display_comp_ctx->strategy->CanSkipValidate();
-}
-
} // namespace sdm
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index 86117c54..6cfa2fe6 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -71,7 +71,7 @@ class CompManager {
void ControlPartialUpdate(Handle display_ctx, bool enable);
DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst, bool rotate90);
DisplayError ValidateAndSetCursorPosition(Handle display_ctx, HWLayers *hw_layers, int x, int y);
- bool SetDisplayState(Handle display_ctx, DisplayState state, int sync_handle);
+ bool SetDisplayState(Handle display_ctx, DisplayState state);
DisplayError SetMaxBandwidthMode(HWBwModes mode);
DisplayError GetScaleLutConfig(HWScaleLutInfo *lut_info);
DisplayError SetDetailEnhancerData(Handle display_ctx, const DisplayDetailEnhancerData &de_data);
@@ -85,8 +85,6 @@ class CompManager {
void SetSafeMode(bool enable) { safe_mode_ = enable; }
bool IsSafeMode() { return safe_mode_; }
void GenerateROI(Handle display_ctx, HWLayers *hw_layers);
- bool CanSkipValidate(Handle display_ctx);
- DisplayError CheckEnforceSplit(Handle comp_handle, uint32_t new_refresh_rate);
private:
static const int kMaxThermalLevel = 3;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 6cb1e544..7a0614b4 100755
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -283,14 +283,6 @@ DisplayError DisplayBase::Prepare(LayerStack *layer_stack) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
DisplayError error = kErrorNone;
needs_validate_ = true;
- if (defer_power_state_ && power_state_pending_ != kStateOff) {
- defer_power_state_ = false;
- error = SetDisplayState(power_state_pending_, false, NULL);
- if (error != kErrorNone) {
- return error;
- }
- power_state_pending_ = kStateOff;
- }
DTRACE_SCOPED();
if (!active_) {
@@ -413,7 +405,6 @@ DisplayError DisplayBase::Commit(LayerStack *layer_stack) {
}
PostCommitLayerParams(layer_stack);
- SetLutSwapFlag();
if (partial_update_control_) {
comp_manager_->ControlPartialUpdate(display_comp_ctx_, true /* enable */);
@@ -525,14 +516,6 @@ DisplayError DisplayBase::GetVSyncState(bool *enabled) {
DisplayError DisplayBase::SetDisplayState(DisplayState state, bool teardown,
int *release_fence) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (defer_power_state_) {
- if (state == kStateOff) {
- DLOGE("State cannot be PowerOff on first cycle");
- return kErrorParameters;
- }
- power_state_pending_ = state;
- return kErrorNone;
- }
DisplayError error = kErrorNone;
bool active = false;
@@ -595,15 +578,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state, bool teardown,
if (error == kErrorNone) {
active_ = active;
state_ = state;
- comp_manager_->SetDisplayState(display_comp_ctx_, state, release_fence ? *release_fence : -1);
- }
-
- if (vsync_state_change_pending_ && (state_ != kStateOff || state_ != kStateStandby)) {
- error = SetVSyncState(requested_vsync_state_);
- if (error != kErrorNone) {
- return error;
- }
- vsync_state_change_pending_ = false;
+ comp_manager_->SetDisplayState(display_comp_ctx_, state);
}
return error;
@@ -620,12 +595,6 @@ DisplayError DisplayBase::SetActiveConfig(uint32_t index) {
return kErrorNone;
}
- // Reject active config changes if qsync is in use.
- if (needs_avr_update_ || qsync_mode_ != kQSyncModeNone) {
- DLOGE("Failed: needs_avr_update_: %d, qsync_mode_: %d", needs_avr_update_, qsync_mode_);
- return kErrorNotSupported;
- }
-
error = hw_intf_->SetDisplayAttributes(index);
if (error != kErrorNone) {
return error;
@@ -1121,14 +1090,6 @@ DisplayError DisplayBase::GetRefreshRateRange(uint32_t *min_refresh_rate,
DisplayError DisplayBase::SetVSyncState(bool enable) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (state_ == kStateOff) {
- DLOGW("Can't %s vsync when power state is off for display %d-%d," \
- "Defer it when display is active", enable ? "enable":"disable",
- display_id_, display_type_);
- vsync_state_change_pending_ = true;
- requested_vsync_state_ = enable;
- return kErrorNone;
- }
DisplayError error = kErrorNone;
if (vsync_enable_ != enable) {
error = hw_intf_->SetVSyncState(enable);
@@ -1921,30 +1882,6 @@ bool DisplayBase::IsHdrMode(const AttrVal &attr) {
return false;
}
-bool DisplayBase::CanSkipValidate() {
- return comp_manager_->CanSkipValidate(display_comp_ctx_) && !lut_swap_;
-}
-
-void DisplayBase::SetLutSwapFlag() {
- uint32_t hw_layer_count = UINT32(hw_layers_.info.hw_layers.size());
- for (uint32_t i = 0; i < hw_layer_count; i++) {
- HWPipeInfo *left_pipe = &hw_layers_.config[i].left_pipe;
- HWPipeInfo *right_pipe = &hw_layers_.config[i].right_pipe;
- for (uint32_t count = 0; count < 2; count++) {
- HWPipeInfo *pipe_info = (count == 0) ? left_pipe : right_pipe;
- if (!pipe_info->valid || !pipe_info->scale_data.lut_flag.lut_swap) {
- continue;
- }
- lut_swap_ = true;
- return;
- }
- }
-
- // No pipe needs lut swap.
- lut_swap_ = false;
- return;
-}
-
DisplayError DisplayBase::colorSamplingOn() {
return kErrorNone;
}
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 3b64ac08..bd4ea658 100644..100755
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -149,8 +149,6 @@ class DisplayBase : public DisplayInterface {
virtual bool IsSupportSsppTonemap();
virtual DisplayError GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size,
uint8_t *out_data);
- virtual bool CanSkipValidate();
- virtual DisplayError GetRefreshRate(uint32_t *refresh_rate) { return kErrorNotSupported; }
virtual DisplayError colorSamplingOn();
virtual DisplayError colorSamplingOff();
virtual DisplayError ReconfigureDisplay();
@@ -234,12 +232,6 @@ class DisplayBase : public DisplayInterface {
uint32_t current_refresh_rate_ = 0;
bool drop_skewed_vsync_ = false;
bool custom_mixer_resolution_ = false;
- DisplayState power_state_pending_ = kStateOff;
- bool vsync_state_change_pending_ = false;
- bool requested_vsync_state_ = false;
- bool defer_power_state_ = false;
- QSyncMode qsync_mode_ = kQSyncModeNone;
- bool needs_avr_update_ = false;
static Locker display_power_reset_lock_;
static bool display_power_reset_pending_;
@@ -247,8 +239,6 @@ class DisplayBase : public DisplayInterface {
private:
bool StartDisplayPowerReset();
void EndDisplayPowerReset();
- void SetLutSwapFlag();
- bool lut_swap_ = false;
};
} // namespace sdm
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 38a0e1ee..9cec81fa 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -58,7 +58,6 @@ DisplayBuiltIn::DisplayBuiltIn(int32_t display_id, DisplayEventHandler *event_ha
DisplayError DisplayBuiltIn::Init() {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- int32_t disable_defer_power_state = 0;
DisplayError error = HWInterface::Create(display_id_, kBuiltIn, hw_info_intf_,
buffer_sync_handler_, buffer_allocator_, &hw_intf_);
@@ -122,13 +121,9 @@ DisplayError DisplayBuiltIn::Init() {
current_refresh_rate_ = hw_panel_info_.max_fps;
- Debug::GetProperty(DISABLE_DEFER_POWER_STATE, &disable_defer_power_state);
- defer_power_state_ = !disable_defer_power_state;
setupColorSamplingState();
- DLOGI("defer_power_state %d", defer_power_state_);
-
int value = 0;
Debug::Get()->GetProperty(DEFER_FPS_FRAME_COUNT, &value);
deferred_config_.frame_count = (value > 0) ? UINT32(value) : 0;
@@ -159,8 +154,7 @@ DisplayError DisplayBuiltIn::Prepare(LayerStack *layer_stack) {
}
} else {
if (CanSkipDisplayPrepare(layer_stack)) {
- hw_layers_.hw_avr_info.update = needs_avr_update_;
- hw_layers_.hw_avr_info.mode = GetAvrMode(qsync_mode_);
+ hw_layers_.hw_avr_info.enable = NeedsAVREnable();
return kErrorNone;
}
}
@@ -170,8 +164,7 @@ DisplayError DisplayBuiltIn::Prepare(LayerStack *layer_stack) {
hw_layers_ = HWLayers();
DTRACE_END();
- hw_layers_.hw_avr_info.update = needs_avr_update_;
- hw_layers_.hw_avr_info.mode = GetAvrMode(qsync_mode_);
+ hw_layers_.hw_avr_info.enable = NeedsAVREnable();
left_frame_roi_ = {};
right_frame_roi_ = {};
@@ -189,20 +182,6 @@ DisplayError DisplayBuiltIn::Prepare(LayerStack *layer_stack) {
return error;
}
-HWAVRModes DisplayBuiltIn::GetAvrMode(QSyncMode mode) {
- switch (mode) {
- case kQSyncModeNone:
- return kQsyncNone;
- case kQSyncModeContinuous:
- return kContinuousMode;
- case kQsyncModeOneShot:
- case kQsyncModeOneShotContinuous:
- return kOneShotMode;
- default:
- return kQsyncNone;
- }
-}
-
void DisplayBuiltIn::setupColorSamplingState() {
samplingState = SamplingState::Off;
histogramCtrl.object_type = DRM_MODE_OBJECT_CRTC;
@@ -294,19 +273,6 @@ DisplayError DisplayBuiltIn::Commit(LayerStack *layer_stack) {
dpps_info_.Init(this, hw_panel_info_.panel_name);
- if (qsync_mode_ == kQsyncModeOneShot) {
- // Reset qsync mode.
- SetQSyncMode(kQSyncModeNone);
- } else if (qsync_mode_ == kQsyncModeOneShotContinuous) {
- // No action needed.
- } else if (qsync_mode_ == kQSyncModeContinuous) {
- needs_avr_update_ = false;
- } else if (qsync_mode_ == kQSyncModeNone) {
- needs_avr_update_ = false;
- }
-
- first_cycle_ = false;
-
return error;
}
@@ -414,7 +380,7 @@ DisplayError DisplayBuiltIn::TeardownConcurrentWriteback(void) {
DisplayError DisplayBuiltIn::SetRefreshRate(uint32_t refresh_rate, bool final_rate) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (!active_ || !hw_panel_info_.dynamic_fps || qsync_mode_ != kQSyncModeNone) {
+ if (!active_ || !hw_panel_info_.dynamic_fps) {
return kErrorNotSupported;
}
@@ -435,11 +401,6 @@ DisplayError DisplayBuiltIn::SetRefreshRate(uint32_t refresh_rate, bool final_ra
handle_idle_timeout_ = false;
return error;
}
-
- error = comp_manager_->CheckEnforceSplit(display_comp_ctx_, refresh_rate);
- if (error != kErrorNone) {
- return error;
- }
}
// On success, set current refresh rate to new refresh rate
@@ -545,6 +506,20 @@ DisplayError DisplayBuiltIn::DisablePartialUpdateOneFrame() {
return kErrorNone;
}
+bool DisplayBuiltIn::NeedsAVREnable() {
+ if (avr_prop_disabled_ || qsync_mode_ == kQSyncModeNone) {
+ return false;
+ }
+
+ if (GetDriverType() == DriverType::DRM) {
+ return hw_panel_info_.qsync_support;
+ }
+
+ return (hw_panel_info_.mode == kModeVideo &&
+ ((hw_panel_info_.dynamic_fps && hw_panel_info_.dfps_porch_mode) ||
+ (!hw_panel_info_.dynamic_fps && hw_panel_info_.min_fps != hw_panel_info_.max_fps)));
+}
+
DisplayError DisplayBuiltIn::DppsProcessOps(enum DppsOps op, void *payload, size_t size) {
DisplayError error = kErrorNone;
uint32_t pending;
@@ -678,15 +653,10 @@ DisplayError DisplayBuiltIn::HandleSecureEvent(SecureEvent secure_event, LayerSt
DisplayError DisplayBuiltIn::SetQSyncMode(QSyncMode qsync_mode) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (!hw_panel_info_.qsync_support || qsync_mode_ == qsync_mode || first_cycle_) {
- DLOGE("Failed: qsync_support: %d first_cycle %d mode: %d -> %d", hw_panel_info_.qsync_support,
- first_cycle_, qsync_mode_, qsync_mode);
+ if (GetDriverType() == DriverType::DRM && qsync_mode == kQsyncModeOneShot) {
return kErrorNotSupported;
}
-
qsync_mode_ = qsync_mode;
- needs_avr_update_ = true;
- event_handler_->Refresh();
return kErrorNone;
}
@@ -827,11 +797,6 @@ bool DisplayBuiltIn::CanSkipDisplayPrepare(LayerStack *layer_stack) {
return same_roi;
}
-DisplayError DisplayBuiltIn::GetRefreshRate(uint32_t *refresh_rate) {
- *refresh_rate = current_refresh_rate_;
- return kErrorNone;
-}
-
DisplayError DisplayBuiltIn::SetActiveConfig(uint32_t index) {
deferred_config_.MarkDirty();
return DisplayBase::SetActiveConfig(index);
diff --git a/sdm/libs/core/display_builtin.h b/sdm/libs/core/display_builtin.h
index 51445d10..0204b382 100644
--- a/sdm/libs/core/display_builtin.h
+++ b/sdm/libs/core/display_builtin.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -109,7 +109,6 @@ class DisplayBuiltIn : public DisplayBase, HWEventHandler, DppsPropIntf {
virtual DisplayError SetDisplayMode(uint32_t mode);
virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate);
virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate);
- virtual DisplayError GetRefreshRate(uint32_t *refresh_rate);
virtual DisplayError SetPanelBrightness(int level);
virtual DisplayError GetPanelBrightness(int *level);
virtual DisplayError HandleSecureEvent(SecureEvent secure_event, LayerStack *layer_stack);
@@ -141,9 +140,9 @@ class DisplayBuiltIn : public DisplayBase, HWEventHandler, DppsPropIntf {
virtual DisplayError ReconfigureDisplay();
private:
+ bool NeedsAVREnable();
bool CanCompareFrameROI(LayerStack *layer_stack);
bool CanSkipDisplayPrepare(LayerStack *layer_stack);
- HWAVRModes GetAvrMode(QSyncMode mode);
bool CanDeferFpsConfig(uint32_t fps);
void SetDeferredFpsConfig();
void GetFpsConfig(HWDisplayAttributes *display_attributes, HWPanelInfo *panel_info);
@@ -154,9 +153,9 @@ class DisplayBuiltIn : public DisplayBase, HWEventHandler, DppsPropIntf {
bool handle_idle_timeout_ = false;
bool commit_event_enabled_ = false;
DppsInfo dpps_info_ = {};
+ QSyncMode qsync_mode_ = kQSyncModeNone;
LayerRect left_frame_roi_ = {};
LayerRect right_frame_roi_ = {};
- bool first_cycle_ = true;
enum class SamplingState {
Off,
diff --git a/sdm/libs/core/display_pluggable.cpp b/sdm/libs/core/display_pluggable.cpp
index c82a0e2a..fc6b938b 100644
--- a/sdm/libs/core/display_pluggable.cpp
+++ b/sdm/libs/core/display_pluggable.cpp
@@ -130,12 +130,6 @@ DisplayError DisplayPluggable::Init() {
current_refresh_rate_ = hw_panel_info_.max_fps;
- if (IsPrimaryDisplay()) {
- int32_t disable_defer_power_state = 0;
- Debug::GetProperty(DISABLE_DEFER_POWER_STATE, &disable_defer_power_state);
- defer_power_state_ = !disable_defer_power_state;
- }
-
return error;
}
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 0bf42f84..2d9a8c85 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -100,6 +100,7 @@ using sde_drm::DRMBlendType;
using sde_drm::DRMSrcConfig;
using sde_drm::DRMOps;
using sde_drm::DRMTopology;
+using sde_drm::DRMPowerMode;
using sde_drm::DRMSecureMode;
using sde_drm::DRMSecurityLevel;
using sde_drm::DRMCscType;
@@ -260,9 +261,7 @@ static void GetDRMFormat(LayerBufferFormat format, uint32_t *drm_format,
class FrameBufferObject : public LayerBufferObject {
public:
- explicit FrameBufferObject(uint32_t fb_id, LayerBufferFormat format,
- uint32_t width, uint32_t height)
- :fb_id_(fb_id), format_(format), width_(width), height_(height) {
+ explicit FrameBufferObject(uint32_t fb_id) : fb_id_(fb_id) {
}
~FrameBufferObject() {
@@ -274,15 +273,9 @@ class FrameBufferObject : public LayerBufferObject {
}
}
uint32_t GetFbId() { return fb_id_; }
- bool IsEqual(LayerBufferFormat format, uint32_t width, uint32_t height) {
- return (format == format_ && width == width_ && height == height_);
- }
private:
uint32_t fb_id_;
- LayerBufferFormat format_;
- uint32_t width_;
- uint32_t height_;
};
HWDeviceDRM::Registry::Registry(BufferAllocator *buffer_allocator) :
@@ -358,16 +351,9 @@ void HWDeviceDRM::Registry::MapBufferToFbId(Layer* layer, LayerBuffer* buffer) {
// In legacy path, clear fb_id map in each frame.
layer->buffer_map->buffer_map.clear();
} else {
- auto it = layer->buffer_map->buffer_map.find(handle_id);
- if (it != layer->buffer_map->buffer_map.end()) {
- FrameBufferObject *fb_obj = static_cast<FrameBufferObject*>(it->second.get());
- if (fb_obj->IsEqual(buffer->format, buffer->width, buffer->height)) {
- // Found fb_id for given handle_id key
- return;
- } else {
- // Erase from fb_id map if format or size have been modified
- layer->buffer_map->buffer_map.erase(it);
- }
+ if (layer->buffer_map->buffer_map.find(handle_id) != layer->buffer_map->buffer_map.end()) {
+ // Found fb_id for given handle_id key
+ return;
}
if (layer->buffer_map->buffer_map.size() >= fbid_cache_limit_) {
@@ -379,8 +365,7 @@ void HWDeviceDRM::Registry::MapBufferToFbId(Layer* layer, LayerBuffer* buffer) {
uint32_t fb_id = 0;
if (CreateFbId(buffer, &fb_id) >= 0) {
// Create and cache the fb_id in map
- layer->buffer_map->buffer_map[handle_id] = std::make_shared<FrameBufferObject>(fb_id,
- buffer->format, buffer->width, buffer->height);
+ layer->buffer_map->buffer_map[handle_id] = std::make_shared<FrameBufferObject>(fb_id);
}
}
@@ -394,14 +379,8 @@ void HWDeviceDRM::Registry::MapOutputBufferToFbId(LayerBuffer *output_buffer) {
// In legacy path, clear output buffer map in each frame.
output_buffer_map_.clear();
} else {
- auto it = output_buffer_map_.find(handle_id);
- if (it != output_buffer_map_.end()) {
- FrameBufferObject *fb_obj = static_cast<FrameBufferObject*>(it->second.get());
- if (fb_obj->IsEqual(output_buffer->format, output_buffer->width, output_buffer->height)) {
- return;
- } else {
- output_buffer_map_.erase(it);
- }
+ if (output_buffer_map_.find(handle_id) != output_buffer_map_.end()) {
+ return;
}
if (output_buffer_map_.size() >= UI_FBID_LIMIT) {
@@ -412,8 +391,7 @@ void HWDeviceDRM::Registry::MapOutputBufferToFbId(LayerBuffer *output_buffer) {
uint32_t fb_id = 0;
if (CreateFbId(output_buffer, &fb_id) >= 0) {
- output_buffer_map_[handle_id] = std::make_shared<FrameBufferObject>(fb_id,
- output_buffer->format, output_buffer->width, output_buffer->height);
+ output_buffer_map_[handle_id] = std::make_shared<FrameBufferObject>(fb_id);
}
}
@@ -899,29 +877,18 @@ DisplayError HWDeviceDRM::PowerOn(const HWQosData &qos_data, int *release_fence)
int64_t release_fence_t = -1;
update_mode_ = true;
-
- if (first_cycle_) {
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
- drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_].mode;
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &current_mode);
- }
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
- if (release_fence) {
- drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
- }
+ drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
int ret = NullCommit(true /* synchronous */, true /* retain_planes */);
if (ret) {
DLOGE("Failed with error: %d", ret);
return kErrorHardware;
}
- if (release_fence) {
- *release_fence = static_cast<int>(release_fence_t);
- DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
- }
+ *release_fence = static_cast<int>(release_fence_t);
+ DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
pending_doze_ = false;
- last_power_mode_ = DRMPowerMode::ON;
return kErrorNone;
}
@@ -948,7 +915,6 @@ DisplayError HWDeviceDRM::PowerOff(bool teardown) {
return kErrorHardware;
}
pending_doze_ = false;
- last_power_mode_ = DRMPowerMode::OFF;
return kErrorNone;
}
@@ -956,7 +922,7 @@ DisplayError HWDeviceDRM::PowerOff(bool teardown) {
DisplayError HWDeviceDRM::Doze(const HWQosData &qos_data, int *release_fence) {
DTRACE_SCOPED();
- if (first_cycle_ || last_power_mode_ != DRMPowerMode::OFF) {
+ if (!first_cycle_) {
pending_doze_ = true;
return kErrorNone;
}
@@ -971,22 +937,15 @@ DisplayError HWDeviceDRM::Doze(const HWQosData &qos_data, int *release_fence) {
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::DOZE);
- if (release_fence) {
- drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
- }
+ drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
int ret = NullCommit(true /* synchronous */, true /* retain_planes */);
if (ret) {
DLOGE("Failed with error: %d", ret);
return kErrorHardware;
}
- if (release_fence) {
- *release_fence = static_cast<int>(release_fence_t);
- DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
- }
-
- last_power_mode_ = DRMPowerMode::DOZE;
-
+ *release_fence = static_cast<int>(release_fence_t);
+ DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
return kErrorNone;
}
@@ -1005,22 +964,17 @@ DisplayError HWDeviceDRM::DozeSuspend(const HWQosData &qos_data, int *release_fe
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id,
DRMPowerMode::DOZE_SUSPEND);
- if (release_fence) {
- drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
- }
+ drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_t);
int ret = NullCommit(true /* synchronous */, true /* retain_planes */);
if (ret) {
DLOGE("Failed with error: %d", ret);
return kErrorHardware;
}
- if (release_fence) {
- *release_fence = static_cast<int>(release_fence_t);
- DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
- }
-
+ *release_fence = static_cast<int>(release_fence_t);
+ DLOGD_IF(kTagDriverConfig, "RELEASE fence created: fd:%d", *release_fence);
pending_doze_ = false;
- last_power_mode_ = DRMPowerMode::DOZE_SUSPEND;
+
return kErrorNone;
}
@@ -1206,15 +1160,9 @@ void HWDeviceDRM::SetupAtomic(HWLayers *hw_layers, bool validate) {
SetSolidfillStages();
SetQOSData(qos_data);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_SECURITY_LEVEL, token_.crtc_id, crtc_security_level);
- if (hw_layers->hw_avr_info.update) {
- sde_drm::DRMQsyncMode mode = sde_drm::DRMQsyncMode::NONE;
- if (hw_layers->hw_avr_info.mode == kContinuousMode) {
- mode = sde_drm::DRMQsyncMode::CONTINUOUS;
- } else if (hw_layers->hw_avr_info.mode == kOneShotMode) {
- mode = sde_drm::DRMQsyncMode::ONESHOT;
- }
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_QSYNC_MODE, token_.conn_id, mode);
- }
+ sde_drm::DRMQsyncMode mode = hw_layers->hw_avr_info.enable ? sde_drm::DRMQsyncMode::CONTINUOUS :
+ sde_drm::DRMQsyncMode::NONE;
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_QSYNC_MODE, token_.conn_id, mode);
}
drm_atomic_intf_->Perform(DRMOps::DPPS_COMMIT_FEATURE, 0 /* argument is not used */);
@@ -1267,11 +1215,10 @@ void HWDeviceDRM::SetupAtomic(HWLayers *hw_layers, bool validate) {
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::DOZE);
pending_doze_ = false;
- synchronous_commit_ = true;
}
// Set CRTC mode, only if display config changes
- if (vrefresh_ || update_mode_) {
+ if (vrefresh_ || first_cycle_ || update_mode_) {
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &current_mode);
}
@@ -1485,7 +1432,6 @@ DisplayError HWDeviceDRM::AtomicCommit(HWLayers *hw_layers) {
DisplayError HWDeviceDRM::Flush(HWLayers *hw_layers) {
ClearSolidfillStages();
- SetFullROI();
int ret = NullCommit(secure_display_active_ /* synchronous */, false /* retain_planes*/);
if (ret) {
DLOGE("failed with error %d", ret);
@@ -1801,10 +1747,6 @@ DisplayError HWDeviceDRM::UnsetScaleLutConfig() {
}
DisplayError HWDeviceDRM::SetMixerAttributes(const HWMixerAttributes &mixer_attributes) {
- if (IsResolutionSwitchEnabled()) {
- return kErrorNotSupported;
- }
-
if (!hw_resource_.hw_dest_scalar_info.count) {
return kErrorNotSupported;
}
@@ -1949,7 +1891,6 @@ void HWDeviceDRM::UpdateMixerAttributes() {
mixer_attributes_.split_left = display_attributes_[index].is_device_split
? hw_panel_info_.split_info.left_split
: mixer_attributes_.width;
- mixer_attributes_.mixer_index = token_.crtc_index;
DLOGI("Mixer WxH %dx%d for %s", mixer_attributes_.width, mixer_attributes_.height, device_name_);
update_mode_ = true;
}
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index 747e51e3..a8292ef4 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -50,7 +50,6 @@
#define VIDEO_FBID_LIMIT 16
#define OFFLINE_ROTATOR_FBID_LIMIT 2
-using sde_drm::DRMPowerMode;
namespace sdm {
class HWInfoInterface;
@@ -227,7 +226,6 @@ class HWDeviceDRM : public HWInterface {
uint32_t vrefresh_ = 0;
uint64_t bit_clk_rate_ = 0;
bool update_mode_ = false;
- DRMPowerMode last_power_mode_ = DRMPowerMode::OFF;
private:
std::string interface_str_ = "DSI";
diff --git a/sdm/libs/core/drm/hw_events_drm.cpp b/sdm/libs/core/drm/hw_events_drm.cpp
index d897bd51..1683994f 100644
--- a/sdm/libs/core/drm/hw_events_drm.cpp
+++ b/sdm/libs/core/drm/hw_events_drm.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-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
@@ -235,6 +235,8 @@ DisplayError HWEventsDRM::Init(int display_id, DisplayType display_type,
return kErrorResources;
}
+ RegisterVSync();
+ vsync_registered_ = true;
RegisterPanelDead(true);
RegisterIdleNotify(true);
RegisterIdlePowerCollapse(true);
diff --git a/sdm/libs/core/drm/hw_info_drm.cpp b/sdm/libs/core/drm/hw_info_drm.cpp
index 978d3b6b..eb8b38ec 100644
--- a/sdm/libs/core/drm/hw_info_drm.cpp
+++ b/sdm/libs/core/drm/hw_info_drm.cpp
@@ -340,16 +340,6 @@ void HWInfoDRM::GetSystemInfo(HWResourceInfo *hw_resource) {
// In case driver doesn't report bus width default to 256 bit bus.
hw_resource->num_mnocports = info.num_mnocports ? info.num_mnocports : 2;
hw_resource->mnoc_bus_width = info.mnoc_bus_width ? info.mnoc_bus_width : 32;
- hw_resource->use_baselayer_for_stage = info.use_baselayer_for_stage;
- hw_resource->line_width_constraints_count = info.line_width_constraints_count;
- if (info.line_width_constraints_count) {
- auto &width_constraints = hw_resource->line_width_constraints;
- hw_resource->line_width_limits = std::move(info.line_width_limits);
- width_constraints.push_back(std::make_pair(kPipeVigLimit, info.vig_limit_index));
- width_constraints.push_back(std::make_pair(kPipeDmaLimit, info.dma_limit_index));
- width_constraints.push_back(std::make_pair(kPipeScalingLimit, info.scaling_limit_index));
- width_constraints.push_back(std::make_pair(kPipeRotationLimit, info.rotation_limit_index));
- }
}
void HWInfoDRM::GetHWPlanesInfo(HWResourceInfo *hw_resource) {
@@ -428,10 +418,9 @@ void HWInfoDRM::GetHWPlanesInfo(HWResourceInfo *hw_resource) {
pipe_caps.id = pipe_obj.first;
pipe_caps.master_pipe_id = pipe_obj.second.master_plane_id;
pipe_caps.block_sec_ui = pipe_obj.second.block_sec_ui;
- pipe_caps.hw_block_mask = pipe_obj.second.hw_block_mask;
- DLOGI("Adding %s Pipe : Id %d, master_pipe_id : Id %d block_sec_ui: %d hw_block_mask: 0x%x",
+ DLOGI("Adding %s Pipe : Id %d, master_pipe_id : Id %d block_sec_ui: %d",
name.c_str(), pipe_obj.first, pipe_obj.second.master_plane_id,
- pipe_obj.second.block_sec_ui, pipe_obj.second.hw_block_mask.to_ulong());
+ pipe_obj.second.block_sec_ui);
pipe_caps.inverse_pma = pipe_obj.second.inverse_pma;
pipe_caps.dgm_csc_version = pipe_obj.second.dgm_csc_version;
// disable src tonemap feature if its disabled using property.
@@ -764,25 +753,10 @@ void HWInfoDRM::GetSDMFormat(uint32_t drm_format, uint64_t drm_format_modifier,
}
DisplayError HWInfoDRM::GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_disp_info) {
- HWDisplaysInfo hw_displays_info;
- DisplayError error = kErrorNone;
-
hw_disp_info->type = kBuiltIn;
hw_disp_info->is_connected = true;
- error = GetDisplaysStatus(&hw_displays_info);
- if (error == kErrorNone) {
- for (auto &iter : hw_displays_info) {
- auto &info = iter.second;
- if (info.is_primary) {
- hw_disp_info->type = info.display_type;
- hw_disp_info->is_connected = info.is_connected;
- break;
- }
- }
- }
-
- return error;
+ return kErrorNone;
}
DisplayError HWInfoDRM::GetDisplaysStatus(HWDisplaysInfo *hw_displays_info) {
diff --git a/sdm/libs/core/drm/hw_peripheral_drm.cpp b/sdm/libs/core/drm/hw_peripheral_drm.cpp
index 9c426d85..ec865fe6 100644
--- a/sdm/libs/core/drm/hw_peripheral_drm.cpp
+++ b/sdm/libs/core/drm/hw_peripheral_drm.cpp
@@ -437,7 +437,6 @@ DisplayError HWPeripheralDRM::PowerOn(const HWQosData &qos_data, int *release_fe
}
if (first_cycle_) {
- last_power_mode_ = DRMPowerMode::ON;
return kErrorNone;
}
drm_atomic_intf_->Perform(sde_drm::DRMOps::CRTC_SET_IDLE_PC_STATE, token_.crtc_id,
diff --git a/sdm/libs/core/drm/hw_tv_drm.cpp b/sdm/libs/core/drm/hw_tv_drm.cpp
index 4b2dc897..ad39b867 100644
--- a/sdm/libs/core/drm/hw_tv_drm.cpp
+++ b/sdm/libs/core/drm/hw_tv_drm.cpp
@@ -356,6 +356,10 @@ DisplayError HWTVDRM::PowerOn(const HWQosData &qos_data, int *release_fence) {
return kErrorUndefined;
}
+ if (first_cycle_) {
+ return kErrorNone;
+ }
+
return HWDeviceDRM::PowerOn(qos_data, release_fence);
}
diff --git a/sdm/libs/core/drm/hw_virtual_drm.cpp b/sdm/libs/core/drm/hw_virtual_drm.cpp
index b18e5698..152e28c5 100644
--- a/sdm/libs/core/drm/hw_virtual_drm.cpp
+++ b/sdm/libs/core/drm/hw_virtual_drm.cpp
@@ -233,8 +233,6 @@ DisplayError HWVirtualDRM::PowerOn(const HWQosData &qos_data, int *release_fence
return kErrorUndefined;
}
- // Since fb id is not available until first draw cycle and driver expects fb id to be set on any
- // commit(null or atomic commit). Need to defer power on for the first cycle.
if (first_cycle_) {
return kErrorNone;
}
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index ad375a63..d130d87d 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015 - 2019, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 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
@@ -660,9 +660,12 @@ void HWPrimary::UpdateMixerAttributes() {
}
void HWPrimary::SetAVRFlags(const HWAVRInfo &hw_avr_info, uint32_t *avr_flags) {
- // TODO(user): Add explicit cont. flag.
+ if (hw_avr_info.enable) {
+ *avr_flags |= MDP_COMMIT_AVR_EN;
+ }
+
if (hw_avr_info.mode == kOneShotMode) {
- *avr_flags |= MDP_COMMIT_AVR_ONE_SHOT_MODE | MDP_COMMIT_AVR_EN;
+ *avr_flags |= MDP_COMMIT_AVR_ONE_SHOT_MODE;
}
}
diff --git a/sdm/libs/core/strategy.cpp b/sdm/libs/core/strategy.cpp
index 8b7740dd..42688d93 100644
--- a/sdm/libs/core/strategy.cpp
+++ b/sdm/libs/core/strategy.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -275,11 +275,4 @@ DisplayError Strategy::SetBlendSpace(const PrimariesTransfer &blend_space) {
return kErrorNotSupported;
}
-bool Strategy::CanSkipValidate() {
- if (strategy_intf_) {
- return strategy_intf_->CanSkipValidate();
- }
- return true;
-}
-
} // namespace sdm
diff --git a/sdm/libs/core/strategy.h b/sdm/libs/core/strategy.h
index 292b88cb..a89febda 100644
--- a/sdm/libs/core/strategy.h
+++ b/sdm/libs/core/strategy.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, 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 met:
@@ -56,7 +56,6 @@ class Strategy {
DisplayError SetColorModesInfo(const std::vector<PrimariesTransfer> &colormodes_cs);
DisplayError SetBlendSpace(const PrimariesTransfer &blend_space);
void GenerateROI(HWLayersInfo *hw_layers_info, const PUConstraints &pu_constraints);
- bool CanSkipValidate();
private:
void GenerateROI();
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 8eca84b5..353a51e5 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -22,29 +22,80 @@ LOCAL_SHARED_LIBRARIES := libsdmcore libqservice libbinder libhardware li
libutils libcutils libsync libqdutils libqdMetaData \
libdisplaydebug libsdmutils libc++ liblog libgrallocutils libui \
libgpu_tonemapper libhidlbase libhidltransport \
+ vendor.display.config@1.0 \
android.hardware.graphics.mapper@2.0 \
android.hardware.graphics.mapper@2.1 \
- android.hardware.graphics.mapper@3.0 \
android.hardware.graphics.allocator@2.0 \
- android.hardware.graphics.allocator@3.0 \
android.hardware.graphics.composer@2.2 \
- vendor.display.config@1.0 \
- vendor.display.config@1.1 \
- vendor.display.config@1.2 \
- vendor.display.config@1.3 \
- vendor.display.config@1.4 \
- vendor.display.config@1.5 \
- vendor.display.config@1.6 \
- vendor.display.config@1.7 \
- vendor.display.config@1.8 \
- vendor.display.config@1.9 \
- vendor.display.config@1.10 \
- vendor.display.config@1.11 \
hardware.google.light@1.0 \
libdrm.vendor
LOCAL_STATIC_LIBRARIES := libhistogram
+$(info IDisplayConfig version: $(display_config_version))
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_2)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2 vendor.display.config@1.1
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_3)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_4)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_5)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_6)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.6
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_7)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.6
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.7
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_8)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.6
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.7
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.8
+endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_9)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.6
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.7
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.8
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.9
+endif
+
ifeq ($(TARGET_BOARD_AUTO), true)
LOCAL_CFLAGS += -DCONFIG_BASEID_FROM_PROP
endif
@@ -54,7 +105,6 @@ LOCAL_SRC_FILES := hwc_session.cpp \
hwc_display.cpp \
hwc_display_builtin.cpp \
hwc_display_pluggable.cpp \
- hwc_display_dummy.cpp \
hwc_display_pluggable_test.cpp \
hwc_display_virtual.cpp \
hwc_debugger.cpp \
diff --git a/sdm/libs/hwc2/display_null.h b/sdm/libs/hwc2/display_null.h
index 3212fa83..29efa46e 100644
--- a/sdm/libs/hwc2/display_null.h
+++ b/sdm/libs/hwc2/display_null.h
@@ -62,7 +62,6 @@ class DisplayNull : public DisplayInterface {
uint8_t *out_data);
virtual string Dump() { return ""; }
virtual bool IsSupportSsppTonemap() { return false; }
- virtual bool CanSkipValidate() { return true; }
MAKE_NO_OP(TeardownConcurrentWriteback(void))
MAKE_NO_OP(Commit(LayerStack *))
@@ -92,7 +91,6 @@ class DisplayNull : public DisplayInterface {
MAKE_NO_OP(GetDefaultColorMode(string *))
MAKE_NO_OP(SetCursorPosition(int, int))
MAKE_NO_OP(SetRefreshRate(uint32_t, bool))
- MAKE_NO_OP(GetRefreshRate(uint32_t *))
MAKE_NO_OP(GetPanelBrightness(int *))
MAKE_NO_OP(SetVSyncState(bool))
MAKE_NO_OP(SetMixerResolution(uint32_t, uint32_t))
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.cpp b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
index 70859018..896c5276 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
@@ -1,31 +1,31 @@
/*
- * Copyright (c) 2015-2019, 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
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2015-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
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#include <gralloc_priv.h>
@@ -39,10 +39,9 @@
#define __CLASS__ "HWCBufferAllocator"
-using android::hardware::graphics::mapper::V2_0::Error;
-using MapperV3Error = android::hardware::graphics::mapper::V3_0::Error;
+using android::hardware::graphics::common::V1_0::PixelFormat;
using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
-using MapperV3BufferDescriptor = android::hardware::graphics::mapper::V3_0::BufferDescriptor;
+using android::hardware::graphics::mapper::V2_0::Error;
using android::hardware::hidl_handle;
using android::hardware::hidl_vec;
@@ -50,29 +49,17 @@ namespace sdm {
DisplayError HWCBufferAllocator::GetGrallocInstance() {
// Lazy initialization of gralloc HALs
- if (mapper_V3_ != nullptr || mapper_V2_ != nullptr || allocator_V3_ != nullptr ||
- allocator_V2_ != nullptr) {
+ if (mapper_ != nullptr || allocator_ != nullptr) {
return kErrorNone;
}
- allocator_V3_ = IAllocatorV3::getService();
- if (allocator_V3_ == nullptr) {
- allocator_V2_ = IAllocatorV2::getService();
- if (allocator_V2_ == nullptr) {
- DLOGE("Unable to get allocator");
- return kErrorCriticalResource;
- }
- }
+ allocator_ = IAllocator::getService();
+ mapper_ = IMapper::getService();
- mapper_V3_ = IMapperV3::getService();
- if (mapper_V3_ == nullptr) {
- mapper_V2_ = IMapperV2::getService();
- if (mapper_V2_ == nullptr) {
- DLOGE("Unable to get mapper");
- return kErrorCriticalResource;
- }
+ if (mapper_ == nullptr || allocator_ == nullptr) {
+ DLOGE("Unable to get mapper or allocator");
+ return kErrorCriticalResource;
}
-
return kErrorNone;
}
@@ -109,117 +96,48 @@ DisplayError HWCBufferAllocator::AllocateBuffer(BufferInfo *buffer_info) {
alloc_flags |= BufferUsage::COMPOSER_OVERLAY;
- const native_handle_t *buf = nullptr;
-
- if (mapper_V3_ != nullptr) {
- IMapperV3::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = buffer_config.width;
- descriptor_info.height = buffer_config.height;
- descriptor_info.layerCount = 1;
- descriptor_info.format =
- static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(format);
- descriptor_info.usage = alloc_flags;
-
- auto hidl_err = MapperV3Error::NONE;
-
- auto descriptor = BufferDescriptor();
- mapper_V3_->createDescriptor(descriptor_info, [&](const auto &_error, const auto &_descriptor) {
- hidl_err = _error;
- if (hidl_err != MapperV3Error::NONE) {
- return;
- }
- descriptor = _descriptor;
- });
-
- if (hidl_err != MapperV3Error::NONE) {
- DLOGE("Failed to create descriptor");
- return kErrorMemory;
- }
-
- hidl_handle raw_handle = nullptr;
-
- allocator_V3_->allocate(descriptor, 1,
- [&](const auto &_error, const auto &_stride, const auto &_buffers) {
- hidl_err = _error;
- if (hidl_err != MapperV3Error::NONE) {
- return;
- }
- raw_handle = _buffers[0];
- });
-
- if (hidl_err != MapperV3Error::NONE) {
- DLOGE("Failed to allocate buffer");
- return kErrorMemory;
- }
-
- mapper_V3_->importBuffer(raw_handle, [&](const auto &_error, const auto &_buffer) {
- hidl_err = _error;
- if (hidl_err != MapperV3Error::NONE) {
- return;
- }
- buf = static_cast<const native_handle_t *>(_buffer);
- });
-
- if (hidl_err != MapperV3Error::NONE) {
- DLOGE("Failed to import buffer into HWC");
- return kErrorMemory;
- }
- } else {
- IMapperV2::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = buffer_config.width;
- descriptor_info.height = buffer_config.height;
- descriptor_info.layerCount = 1;
- descriptor_info.format =
- static_cast<android::hardware::graphics::common::V1_0::PixelFormat>(format);
- descriptor_info.usage = alloc_flags;
-
- auto hidl_err = Error::NONE;
-
- auto descriptor = BufferDescriptor();
- mapper_V2_->createDescriptor(descriptor_info, [&](const auto &_error, const auto &_descriptor) {
- hidl_err = _error;
- if (hidl_err != Error::NONE) {
- return;
- }
- descriptor = _descriptor;
- });
-
- if (hidl_err != Error::NONE) {
- DLOGE("Failed to create descriptor");
- return kErrorMemory;
- }
-
- hidl_handle raw_handle = nullptr;
-
- allocator_V2_->allocate(descriptor, 1,
- [&](const auto &_error, const auto &_stride, const auto &_buffers) {
- hidl_err = _error;
- if (hidl_err != Error::NONE) {
- return;
- }
- raw_handle = _buffers[0];
- });
-
- if (hidl_err != Error::NONE) {
- DLOGE("Failed to allocate buffer");
- return kErrorMemory;
- }
-
- mapper_V2_->importBuffer(raw_handle, [&](const auto &_error, const auto &_buffer) {
- hidl_err = _error;
- if (hidl_err != Error::NONE) {
- return;
- }
- buf = static_cast<const native_handle_t *>(_buffer);
- });
-
- if (hidl_err != Error::NONE) {
- DLOGE("Failed to import buffer into HWC");
- return kErrorMemory;
- }
+ IMapper::BufferDescriptorInfo descriptor_info;
+ descriptor_info.width = buffer_config.width;
+ descriptor_info.height = buffer_config.height;
+ descriptor_info.layerCount = 1;
+ descriptor_info.format = static_cast<PixelFormat>(format);
+ descriptor_info.usage = alloc_flags;
+ auto descriptor = BufferDescriptor();
+ auto hidl_err = Error::NONE;
+
+ mapper_->createDescriptor(descriptor_info, [&](const auto &_error, const auto &_descriptor) {
+ hidl_err = _error;
+ descriptor = _descriptor;
+ });
+ if (hidl_err != Error::NONE) {
+ DLOGE("Failed to create descriptor");
+ return kErrorMemory;
}
+ hidl_handle raw_handle = nullptr;
private_handle_t *hnd = nullptr;
+
+ allocator_->allocate(descriptor, 1,
+ [&](const auto &_error, const auto &_stride, const auto &_buffers) {
+ hidl_err = _error;
+ raw_handle = _buffers[0];
+ });
+ if (hidl_err != Error::NONE) {
+ DLOGE("Failed to allocate buffer");
+ return kErrorMemory;
+ }
+
+ const native_handle_t *buf = nullptr;
+ mapper_->importBuffer(raw_handle, [&](const auto &_error, const auto &_buffer) {
+ hidl_err = _error;
+ buf = static_cast<const native_handle_t *>(_buffer);
+ });
+
+ if (hidl_err != Error::NONE) {
+ DLOGE("Failed to import buffer into HWC");
+ return kErrorMemory;
+ }
+
hnd = (private_handle_t *)buf; // NOLINT
alloc_buffer_info->fd = hnd->fd;
alloc_buffer_info->stride = UINT32(hnd->width);
@@ -235,11 +153,7 @@ DisplayError HWCBufferAllocator::AllocateBuffer(BufferInfo *buffer_info) {
DisplayError HWCBufferAllocator::FreeBuffer(BufferInfo *buffer_info) {
DisplayError err = kErrorNone;
auto hnd = reinterpret_cast<void *>(buffer_info->private_data);
- if (mapper_V3_ != nullptr) {
- mapper_V3_->freeBuffer(hnd);
- } else {
- mapper_V2_->freeBuffer(hnd);
- }
+ mapper_->freeBuffer(hnd);
AllocatedBufferInfo &alloc_buffer_info = buffer_info->alloc_buffer_info;
alloc_buffer_info.fd = -1;
@@ -497,6 +411,9 @@ DisplayError HWCBufferAllocator::MapBuffer(const private_handle_t *handle, int a
if (err != kErrorNone) {
return err;
}
+ void *buffer_ptr = NULL;
+ const IMapper::Rect access_region = {.left = 0, .top = 0, .width = 0, .height = 0};
+
NATIVE_HANDLE_DECLARE_STORAGE(acquire_fence_storage, 1, 0);
hidl_handle acquire_fence_handle;
if (acquire_fence >= 0) {
@@ -506,27 +423,13 @@ DisplayError HWCBufferAllocator::MapBuffer(const private_handle_t *handle, int a
}
auto hnd = const_cast<private_handle_t *>(handle);
- void *buffer_ptr = NULL;
- if (mapper_V3_ != nullptr) {
- const IMapperV3::Rect access_region = {.left = 0, .top = 0, .width = 0, .height = 0};
- mapper_V3_->lock(
- reinterpret_cast<void *>(hnd), (uint64_t)BufferUsage::CPU_READ_OFTEN, access_region,
- acquire_fence_handle,
- [&](const auto &_error, const auto &_buffer, const auto &_bpp, const auto &_stride) {
- if (_error == MapperV3Error::NONE) {
- buffer_ptr = _buffer;
- }
- });
- } else {
- const IMapperV2::Rect access_region = {.left = 0, .top = 0, .width = 0, .height = 0};
- mapper_V2_->lock(reinterpret_cast<void *>(hnd), (uint64_t)BufferUsage::CPU_READ_OFTEN,
- access_region, acquire_fence_handle,
- [&](const auto &_error, const auto &_buffer) {
- if (_error == Error::NONE) {
- buffer_ptr = _buffer;
- }
- });
- }
+ mapper_->lock(reinterpret_cast<void *>(hnd), (uint64_t)BufferUsage::CPU_READ_OFTEN,
+ access_region, acquire_fence_handle, [&](const auto &_error, const auto &_buffer) {
+ if (_error == Error::NONE) {
+ buffer_ptr = _buffer;
+ }
+ });
+
if (!buffer_ptr) {
return kErrorUndefined;
}
@@ -537,21 +440,12 @@ DisplayError HWCBufferAllocator::UnmapBuffer(const private_handle_t *handle, int
DisplayError err = kErrorNone;
*release_fence = -1;
auto hnd = const_cast<private_handle_t *>(handle);
- if (mapper_V3_ != nullptr) {
- mapper_V3_->unlock(reinterpret_cast<void *>(hnd),
- [&](const auto &_error, const auto &_release_fence) {
- if (_error != MapperV3Error::NONE) {
- err = kErrorUndefined;
- }
- });
- } else {
- mapper_V2_->unlock(reinterpret_cast<void *>(hnd),
- [&](const auto &_error, const auto &_release_fence) {
- if (_error != Error::NONE) {
- err = kErrorUndefined;
- }
- });
- }
+ mapper_->unlock(reinterpret_cast<void *>(hnd),
+ [&](const auto &_error, const auto &_release_fence) {
+ if (_error != Error::NONE) {
+ err = kErrorUndefined;
+ }
+ });
return err;
}
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.h b/sdm/libs/hwc2/hwc_buffer_allocator.h
index b412542a..cec5614c 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.h
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-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
@@ -33,15 +33,12 @@
#include <sys/mman.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
-#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
#include <android/hardware/graphics/mapper/2.1/IMapper.h>
-#include <android/hardware/graphics/mapper/3.0/IMapper.h>
#include "gralloc_priv.h"
-using IAllocatorV3 = android::hardware::graphics::allocator::V3_0::IAllocator;
-using IAllocatorV2 = android::hardware::graphics::allocator::V2_0::IAllocator;
-using IMapperV3 = android::hardware::graphics::mapper::V3_0::IMapper;
-using IMapperV2 = android::hardware::graphics::mapper::V2_0::IMapper;
+using android::hardware::graphics::allocator::V2_0::IAllocator;
+using android::hardware::graphics::mapper::V2_0::IMapper;
+
namespace sdm {
template <class Type>
@@ -68,10 +65,8 @@ class HWCBufferAllocator : public BufferAllocator {
private:
DisplayError GetGrallocInstance();
- android::sp<IMapperV2> mapper_V2_;
- android::sp<IMapperV3> mapper_V3_;
- android::sp<IAllocatorV2> allocator_V2_;
- android::sp<IAllocatorV3> allocator_V3_;
+ android::sp<IMapper> mapper_;
+ android::sp<IAllocator> allocator_;
};
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_callbacks.h b/sdm/libs/hwc2/hwc_callbacks.h
index 2e4bdba4..c3a760fc 100644
--- a/sdm/libs/hwc2/hwc_callbacks.h
+++ b/sdm/libs/hwc2/hwc_callbacks.h
@@ -44,11 +44,7 @@ class HWCCallbacks {
static const int kNumPluggable = 4;
static const int kNumVirtual = 4;
// Add 1 primary display which can be either a builtin or pluggable.
- // Async powermode update requires dummy hwc displays.
- // Limit dummy displays to builtin/pluggable type for now.
- static const int kNumRealDisplays = 1 + kNumBuiltIn + kNumPluggable + kNumVirtual;
- static const int kNumDisplays = 1 + kNumBuiltIn + kNumPluggable + kNumVirtual +
- 1 + kNumBuiltIn + kNumPluggable;
+ static const int kNumDisplays = 1 + kNumBuiltIn + kNumPluggable + kNumVirtual;
HWC2::Error Hotplug(hwc2_display_t display, HWC2::Connection state);
HWC2::Error Refresh(hwc2_display_t display);
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index e5cdc3ff..2df90fd3 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -158,6 +158,10 @@ HWC2::Error HWCColorMode::CacheColorModeWithRenderIntent(ColorMode mode, RenderI
return error;
}
+ if (current_color_mode_ == mode && current_render_intent_ == intent) {
+ return HWC2::Error::None;
+ }
+
current_color_mode_ = mode;
current_render_intent_ = intent;
apply_mode_ = true;
@@ -462,7 +466,6 @@ int HWCDisplay::Init() {
DisplayError error = kErrorNone;
HWCDebugHandler::Get()->GetProperty(ENABLE_NULL_DISPLAY_PROP, &null_display_mode_);
- HWCDebugHandler::Get()->GetProperty(ENABLE_ASYNC_POWERMODE, &async_power_mode_);
if (null_display_mode_) {
DisplayNull *disp_null = new DisplayNull();
@@ -581,9 +584,6 @@ int HWCDisplay::Deinit() {
delete hwc_layer;
}
- // Close fbt release fence.
- close(fbt_release_fence_);
-
if (color_mode_) {
color_mode_->DeInit();
delete color_mode_;
@@ -712,6 +712,14 @@ void HWCDisplay::BuildLayerStack() {
layer_stack_.flags.single_buffered_layer_present = true;
}
+ if (hwc_layer->GetClientRequestedCompositionType() == HWC2::Composition::Cursor) {
+ // Currently we support only one HWCursor & only at top most z-order
+ if ((*layer_set_.rbegin())->GetId() == hwc_layer->GetId()) {
+ layer->flags.cursor = true;
+ layer_stack_.flags.cursor_present = true;
+ }
+ }
+
bool hdr_layer = layer->input_buffer.color_metadata.colorPrimaries == ColorPrimaries_BT2020 &&
(layer->input_buffer.color_metadata.transfer == Transfer_SMPTE_ST2084 ||
layer->input_buffer.color_metadata.transfer == Transfer_HLG);
@@ -731,15 +739,6 @@ void HWCDisplay::BuildLayerStack() {
layer->flags.skip = true;
}
- if (!layer->flags.skip &&
- (hwc_layer->GetClientRequestedCompositionType() == HWC2::Composition::Cursor)) {
- // Currently we support only one HWCursor & only at top most z-order
- if ((*layer_set_.rbegin())->GetId() == hwc_layer->GetId()) {
- layer->flags.cursor = true;
- layer_stack_.flags.cursor_present = true;
- }
- }
-
if (layer->flags.skip) {
layer_stack_.flags.skip_present = true;
}
@@ -785,8 +784,6 @@ void HWCDisplay::BuildLayerStack() {
layer->update_mask.set(kClientCompRequest);
}
- layer_stack_.flags.mask_present |= layer->input_buffer.flags.mask_layer;
-
layer_stack_.layers.push_back(layer);
}
@@ -889,29 +886,6 @@ HWC2::Error HWCDisplay::SetVsyncEnabled(HWC2::Vsync enabled) {
return HWC2::Error::None;
}
-void HWCDisplay::PostPowerMode() {
- if (release_fence_ < 0) {
- return;
- }
-
- for (auto hwc_layer : layer_set_) {
- auto fence = hwc_layer->PopBackReleaseFence();
- auto merged_fence = -1;
- if (fence >= 0) {
- merged_fence = sync_merge("sync_merge", release_fence_, fence);
- ::close(fence);
- } else {
- merged_fence = ::dup(release_fence_);
- }
- hwc_layer->PushBackReleaseFence(merged_fence);
- }
-
- // Add this release fence onto fbt_release fence.
- CloseFd(&fbt_release_fence_);
- fbt_release_fence_ = release_fence_;
- release_fence_ = -1;
-}
-
HWC2::Error HWCDisplay::SetPowerMode(HWC2::PowerMode mode, bool teardown) {
DLOGV("display = %d, mode = %s", id_, to_string(mode).c_str());
DisplayState state = kStateOff;
@@ -960,14 +934,24 @@ HWC2::Error HWCDisplay::SetPowerMode(HWC2::PowerMode mode, bool teardown) {
return HWC2::Error::BadParameter;
}
- // Update release fence.
- release_fence_ = release_fence;
- current_power_mode_ = mode;
+ if (release_fence >= 0) {
+ for (auto hwc_layer : layer_set_) {
+ auto fence = hwc_layer->PopBackReleaseFence();
+ auto merged_fence = -1;
+ if (fence >= 0) {
+ merged_fence = sync_merge("sync_merge", release_fence, fence);
+ ::close(fence);
+ } else {
+ merged_fence = ::dup(release_fence);
+ }
+ hwc_layer->PushBackReleaseFence(merged_fence);
+ }
- // Close the release fences in synchronous power updates
- if (!async_power_mode_) {
- PostPowerMode();
+ // Add this release fence onto fbt_release fence.
+ CloseFd(&fbt_release_fence_);
+ fbt_release_fence_ = release_fence;
}
+ current_power_mode_ = mode;
return HWC2::Error::None;
}
@@ -1146,12 +1130,7 @@ HWC2::Error HWCDisplay::GetActiveConfig(hwc2_config_t *out_config) {
return HWC2::Error::BadDisplay;
}
- if (pending_config_) {
- *out_config = pending_config_index_;
- } else {
- GetActiveDisplayConfig(out_config);
- }
-
+ GetActiveDisplayConfig(out_config);
if (*out_config < hwc_config_map_.size()) {
*out_config = hwc_config_map_.at(*out_config);
}
@@ -1189,22 +1168,13 @@ HWC2::Error HWCDisplay::SetClientTarget(buffer_handle_t target, int32_t acquire_
HWC2::Error HWCDisplay::SetActiveConfig(hwc2_config_t config) {
DTRACE_SCOPED();
- hwc2_config_t current_config = 0;
- GetActiveConfig(&current_config);
- if (current_config == config) {
- return HWC2::Error::None;
- }
-
- // Store config index to be applied upon refresh.
- pending_config_ = true;
- pending_config_index_ = config;
+ if (SetActiveDisplayConfig(config) != kErrorNone) {
+ return HWC2::Error::BadConfig;
+ }
+ DLOGI("Active configuration changed to: %d", config);
validated_ = false;
geometry_changes_ |= kConfigChanged;
-
- // Trigger refresh. This config gets applied on next commit.
- callbacks_->Refresh(id_);
-
return HWC2::Error::None;
}
@@ -1311,7 +1281,6 @@ HWC2::Error HWCDisplay::PrepareLayerStack(uint32_t *out_num_types, uint32_t *out
}
UpdateRefreshRate();
- UpdateActiveConfig();
DisplayError error = display_intf_->Prepare(&layer_stack_);
if (error != kErrorNone) {
if (error == kErrorShutDown) {
@@ -1325,10 +1294,6 @@ HWC2::Error HWCDisplay::PrepareLayerStack(uint32_t *out_num_types, uint32_t *out
// so that previous buffer and fences are released, and override the error.
flush_ = true;
validated_ = false;
- // Prepare cycle can fail on a newly connected display if insufficient pipes
- // are available at this moment. Trigger refresh so that the other displays
- // can free up pipes and a valid content can be attached to virtual display.
- callbacks_->Refresh(id_);
return HWC2::Error::BadDisplay;
}
}
@@ -1611,11 +1576,10 @@ HWC2::Error HWCDisplay::PostCommitLayerStack(int32_t *out_retire_fence) {
// release fences and discard fences from driver
if (swap_interval_zero_ || layer->flags.single_buffer) {
close(layer_buffer->release_fence_fd);
- } else {
- // It may so happen that layer gets marked to GPU & app layer gets queued
- // to MDP for composition. In those scenarios, release fence of buffer should
- // have mdp and gpu sync points merged.
+ } else if (layer->composition != kCompositionGPU) {
hwc_layer->PushBackReleaseFence(layer_buffer->release_fence_fd);
+ } else {
+ hwc_layer->PushBackReleaseFence(-1);
}
} else {
// In case of flush or display paused, we don't return an error to f/w, so it will
@@ -2312,11 +2276,6 @@ bool HWCDisplay::CanSkipValidate() {
}
}
- if (!layer_set_.empty() && !display_intf_->CanSkipValidate()) {
- DLOGV_IF(kTagClient, "Display needs validation %d", id_);
- return false;
- }
-
return true;
}
@@ -2453,29 +2412,4 @@ void HWCDisplay::WaitOnPreviousFence() {
}
}
-void HWCDisplay::GetLayerStack(HWCLayerStack *stack) {
- stack->client_target = client_target_;
- stack->layer_map = layer_map_;
- stack->layer_set = layer_set_;
-}
-
-void HWCDisplay::SetLayerStack(HWCLayerStack *stack) {
- client_target_ = stack->client_target;
- layer_map_ = stack->layer_map;
- layer_set_ = stack->layer_set;
-}
-void HWCDisplay::UpdateActiveConfig() {
- if (!pending_config_) {
- return;
- }
-
- DisplayError error = display_intf_->SetActiveConfig(pending_config_index_);
- if (error != kErrorNone) {
- DLOGI("Failed to set %d config", INT(pending_config_index_));
- }
-
- // Reset pending config.
- pending_config_ = false;
-}
-
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 52fe2831..ced7db1f 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -85,7 +85,6 @@ class HWCColorMode {
ColorMode GetCurrentColorMode() { return current_color_mode_; }
HWC2::Error ApplyCurrentColorModeWithRenderIntent(bool hdr_present);
HWC2::Error CacheColorModeWithRenderIntent(ColorMode mode, RenderIntent intent);
- RenderIntent GetCurrentRenderIntent() { return current_render_intent_; }
private:
static const uint32_t kColorTransformMatrixCount = 16;
@@ -132,12 +131,6 @@ class HWCDisplay : public DisplayEventHandler {
kSkipValidate,
};
- struct HWCLayerStack {
- HWCLayer *client_target = nullptr; // Also known as framebuffer target
- std::map<hwc2_layer_t, HWCLayer *> layer_map; // Look up by Id - TODO
- std::multiset<HWCLayer *, SortLayersByZ> layer_set; // Maintain a set sorted by Z
- };
-
virtual ~HWCDisplay() {}
virtual int Init();
virtual int Deinit();
@@ -234,9 +227,6 @@ class HWCDisplay : public DisplayEventHandler {
ColorMode GetCurrentColorMode() {
return (color_mode_ ? color_mode_->GetCurrentColorMode() : ColorMode::SRGB);
}
- RenderIntent GetCurrentRenderIntent() {
- return (color_mode_ ? color_mode_->GetCurrentRenderIntent() : RenderIntent::COLORIMETRIC);
- }
bool HasClientComposition() { return has_client_composition_; }
bool HasForceClientComposition() { return has_force_client_composition_; }
bool HWCClientNeedsValidate() {
@@ -307,9 +297,6 @@ class HWCDisplay : public DisplayEventHandler {
virtual HWC2::Error SetCursorPosition(hwc2_layer_t layer, int x, int y);
virtual HWC2::Error SetVsyncEnabled(HWC2::Vsync enabled);
virtual HWC2::Error SetPowerMode(HWC2::PowerMode mode, bool teardown);
- virtual HWC2::Error UpdatePowerMode(HWC2::PowerMode mode) {
- return HWC2::Error::None;
- }
virtual HWC2::Error CreateLayer(hwc2_layer_t *out_layer_id);
virtual HWC2::Error DestroyLayer(hwc2_layer_t layer_id);
virtual HWC2::Error SetLayerZOrder(hwc2_layer_t layer_id, uint32_t z);
@@ -338,10 +325,6 @@ class HWCDisplay : public DisplayEventHandler {
}
virtual HWC2::Error GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size,
uint8_t *out_data);
- virtual void GetLayerStack(HWCLayerStack *stack);
- virtual void SetLayerStack(HWCLayerStack *stack);
- virtual void PostPowerMode();
- virtual void NotifyClientStatus(bool connected) { client_connected_ = connected; }
virtual HWC2::Error SetDisplayedContentSamplingEnabledVndService(bool enabled);
virtual HWC2::Error SetDisplayedContentSamplingEnabled(int32_t enabled, uint8_t component_mask, uint64_t max_frames);
@@ -443,8 +426,6 @@ class HWCDisplay : public DisplayEventHandler {
std::map<uint32_t, DisplayConfigVariableInfo> variable_config_map_;
std::vector<uint32_t> hwc_config_map_;
bool fast_path_composition_ = false;
- bool client_connected_ = true;
- bool pending_config_ = false;
float hdr_largest_layer_px_ = 0.0f;
private:
@@ -452,7 +433,6 @@ class HWCDisplay : public DisplayEventHandler {
bool CanSkipSdmPrepare(uint32_t *num_types, uint32_t *num_requests);
void UpdateRefreshRate();
void WaitOnPreviousFence();
- void UpdateActiveConfig();
qService::QService *qservice_ = NULL;
DisplayClass display_class_;
uint32_t geometry_changes_ = GeometryChanges::kNone;
@@ -464,9 +444,6 @@ class HWCDisplay : public DisplayEventHandler {
bool fast_path_enabled_ = true;
bool first_cycle_ = true; // false if a display commit has succeeded on the device.
int fbt_release_fence_ = -1;
- int release_fence_ = -1;
- hwc2_config_t pending_config_index_ = 0;
- int async_power_mode_ = 0;
};
inline int HWCDisplay::Perform(uint32_t operation, ...) {
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index 13beb6f5..68866437 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -166,10 +166,10 @@ int HWCDisplayBuiltIn::Init() {
HWCDebugHandler::Get()->GetProperty(ENABLE_DEFAULT_COLOR_MODE,
&default_mode_status_);
- int optimize_refresh = 0;
- HWCDebugHandler::Get()->GetProperty(ENABLE_OPTIMIZE_REFRESH, &optimize_refresh);
- enable_optimize_refresh_ = (optimize_refresh == 1);
- if (enable_optimize_refresh_) {
+ int drop_refresh = 0;
+ HWCDebugHandler::Get()->GetProperty(ENABLE_DROP_REFRESH, &drop_refresh);
+ enable_drop_refresh_ = (drop_refresh == 1);
+ if (enable_drop_refresh_) {
DLOGI("Drop redundant drawcycles %d", id_);
}
pmic_intf_ = new PMICInterface();
@@ -234,11 +234,6 @@ HWC2::Error HWCDisplayBuiltIn::Validate(uint32_t *out_num_types, uint32_t *out_n
layer_stack_.flags.post_processed_output = post_processed_output_;
}
}
- // Todo: relook this case
- if (layer_stack_.flags.hdr_present != hdr_present_) {
- error = display_intf_->ControlIdlePowerCollapse(!layer_stack_.flags.hdr_present, true);
- hdr_present_ = layer_stack_.flags.hdr_present;
- }
uint32_t num_updating_layers = GetUpdatingLayersCount();
bool one_updating_layer = (num_updating_layers == 1);
@@ -247,29 +242,16 @@ HWC2::Error HWCDisplayBuiltIn::Validate(uint32_t *out_num_types, uint32_t *out_n
}
uint32_t refresh_rate = GetOptimalRefreshRate(one_updating_layer);
- error = display_intf_->SetRefreshRate(refresh_rate, force_refresh_rate_);
-
- // Get the refresh rate set.
- display_intf_->GetRefreshRate(&refresh_rate);
- bool vsync_source = (callbacks_->GetVsyncSource() == id_);
-
+ bool final_rate = force_refresh_rate_ ? true : false;
+ error = display_intf_->SetRefreshRate(refresh_rate, final_rate);
if (error == kErrorNone) {
- if (vsync_source && (current_refresh_rate_ < refresh_rate)) {
- DTRACE_BEGIN("HWC2::Vsync::Enable");
- // Display is ramping up from idle.
- // Client realizes need for resync upon change in config.
- // Since we know config has changed, triggering vsync proactively
- // can help in reducing pipeline delays to enable events.
- SetVsyncEnabled(HWC2::Vsync::Enable);
- DTRACE_END();
- }
- // On success, set current refresh rate to new refresh rate.
+ // On success, set current refresh rate to new refresh rate
current_refresh_rate_ = refresh_rate;
}
if (layer_set_.empty()) {
// Avoid flush for Command mode panel.
- flush_ = !client_connected_;
+ flush_ = !(IsDisplayCommandMode() && active_secure_sessions_[kSecureDisplay]);
validated_ = true;
return status;
}
@@ -301,7 +283,7 @@ bool HWCDisplayBuiltIn::CanSkipCommit() {
}
bool vsync_source = (callbacks_->GetVsyncSource() == id_);
- bool skip_commit = enable_optimize_refresh_ && !pending_commit_ && !buffers_latched &&
+ bool skip_commit = enable_drop_refresh_ && !pending_commit_ && !buffers_latched &&
!pending_refresh_ && !vsync_source;
pending_refresh_ = false;
@@ -977,13 +959,6 @@ DisplayError HWCDisplayBuiltIn::GetMixerResolution(uint32_t *width, uint32_t *he
}
HWC2::Error HWCDisplayBuiltIn::SetQSyncMode(QSyncMode qsync_mode) {
- // Client needs to ensure that config change and qsync mode change
- // are not triggered in the same drawcycle.
- if (pending_config_) {
- DLOGE("Failed to set qsync mode. Pending active config transition");
- return HWC2::Error::Unsupported;
- }
-
auto err = display_intf_->SetQSyncMode(qsync_mode);
if (err != kErrorNone) {
return HWC2::Error::Unsupported;
@@ -1004,10 +979,13 @@ DisplayError HWCDisplayBuiltIn::ControlIdlePowerCollapse(bool enable, bool synch
}
DisplayError HWCDisplayBuiltIn::SetDynamicDSIClock(uint64_t bitclk) {
- DisplayError error = display_intf_->SetDynamicDSIClock(bitclk);
- if (error != kErrorNone) {
- DLOGE(" failed: Clk: %llu Error: %d", bitclk, error);
- return error;
+ {
+ SEQUENCE_WAIT_SCOPE_LOCK(HWCSession::locker_[type_]);
+ DisplayError error = display_intf_->SetDynamicDSIClock(bitclk);
+ if (error != kErrorNone) {
+ DLOGE(" failed: Clk: %llu Error: %d", bitclk, error);
+ return error;
+ }
}
callbacks_->Refresh(id_);
@@ -1017,6 +995,7 @@ DisplayError HWCDisplayBuiltIn::SetDynamicDSIClock(uint64_t bitclk) {
}
DisplayError HWCDisplayBuiltIn::GetDynamicDSIClock(uint64_t *bitclk) {
+ SEQUENCE_WAIT_SCOPE_LOCK(HWCSession::locker_[type_]);
if (display_intf_) {
return display_intf_->GetDynamicDSIClock(bitclk);
}
@@ -1042,12 +1021,6 @@ HWC2::Error HWCDisplayBuiltIn::SetPendingRefresh() {
return HWC2::Error::None;
}
-HWC2::Error HWCDisplayBuiltIn::UpdatePowerMode(HWC2::PowerMode mode) {
- current_power_mode_ = mode;
- validated_ = false;
- return HWC2::Error::None;
-}
-
HWC2::Error HWCDisplayBuiltIn::PostCommitLayerStack(int32_t *out_retire_fence) {
if (pmic_notification_pending_) {
// Wait for current commit to complete
diff --git a/sdm/libs/hwc2/hwc_display_builtin.h b/sdm/libs/hwc2/hwc_display_builtin.h
index 832b2f04..9b72bf3f 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.h
+++ b/sdm/libs/hwc2/hwc_display_builtin.h
@@ -98,7 +98,6 @@ class HWCDisplayBuiltIn : public HWCDisplay {
virtual void SetFastPathComposition(bool enable) {
fast_path_composition_ = enable && !readback_buffer_queued_;
}
- virtual HWC2::Error UpdatePowerMode(HWC2::PowerMode mode);
virtual HWC2::Error PostCommitLayerStack(int32_t *out_retire_fence);
virtual HWC2::Error SetDisplayedContentSamplingEnabledVndService(bool enabled);
@@ -156,8 +155,7 @@ class HWCDisplayBuiltIn : public HWCDisplay {
void *output_buffer_base_ = nullptr;
int default_mode_status_ = 0;
bool pending_refresh_ = true;
- bool enable_optimize_refresh_ = false;
- bool hdr_present_ = false;
+ bool enable_drop_refresh_ = false;
// Members for 1 frame capture in a client provided buffer
bool frame_capture_buffer_queued_ = false;
diff --git a/sdm/libs/hwc2/hwc_display_dummy.cpp b/sdm/libs/hwc2/hwc_display_dummy.cpp
deleted file mode 100644
index 358eefdc..00000000
--- a/sdm/libs/hwc2/hwc_display_dummy.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2018-2019, 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
-* met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hwc_display_dummy.h"
-#include "utils/debug.h"
-
-#define __CLASS__ "HWCDisplayDummy"
-
-namespace sdm {
-
-int HWCDisplayDummy::Create(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
- HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
- qService::QService *qservice, hwc2_display_t id, int32_t sdm_id,
- HWCDisplay **hwc_display) {
- HWCDisplay *hwc_display_dummy = new HWCDisplayDummy(core_intf, buffer_allocator, callbacks,
- event_handler, qservice, id, sdm_id);
- *hwc_display = hwc_display_dummy;
- return kErrorNone;
-}
-
-void HWCDisplayDummy::Destroy(HWCDisplay *hwc_display) {
- delete hwc_display;
-}
-
-HWC2::Error HWCDisplayDummy::Validate(uint32_t *out_num_types, uint32_t *out_num_requests) {
- return HWC2::Error::None;
-}
-
-HWC2::Error HWCDisplayDummy::Present(int32_t *out_retire_fence) {
- for (auto hwc_layer : layer_set_) {
- hwc_layer->PushBackReleaseFence(-1);
- }
- return HWC2::Error::None;
-}
-
-HWCDisplayDummy::HWCDisplayDummy(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
- HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
- qService::QService *qservice, hwc2_display_t id,
- int32_t sdm_id) :HWCDisplay(core_intf, buffer_allocator,
- callbacks, event_handler, qservice, kBuiltIn, id, sdm_id, true,
- DISPLAY_CLASS_BUILTIN) {
- DisplayConfigVariableInfo config;
- config.x_pixels = 720;
- config.y_pixels = 1280;
- config.x_dpi = 200.0f;
- config.y_dpi = 200.0f;
- config.fps = 60;
- config.vsync_period_ns = 16600000;
- display_null_.SetFrameBufferConfig(config);
- num_configs_ = 1;
- display_intf_ = &display_null_;
-}
-
-HWC2::Error HWCDisplayDummy::GetActiveConfig(hwc2_config_t *out_config) {
- *out_config = 0;
- return HWC2::Error::None;
-}
-
-} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display_dummy.h b/sdm/libs/hwc2/hwc_display_dummy.h
deleted file mode 100644
index 29e04f47..00000000
--- a/sdm/libs/hwc2/hwc_display_dummy.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2018-2019, 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
- * met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __HWC_DISPLAY_DUMMY_H__
-#define __HWC_DISPLAY_DUMMY_H__
-
-#include "hwc_display.h"
-#include "display_null.h"
-
-namespace sdm {
-
-class HWCDisplayDummy : public HWCDisplay {
- public:
- static int Create(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
- HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
- qService::QService *qservice, hwc2_display_t id, int32_t sdm_id,
- HWCDisplay **hwc_display);
- static void Destroy(HWCDisplay *hwc_display);
- virtual HWC2::Error Validate(uint32_t *out_num_types, uint32_t *out_num_requests);
- virtual HWC2::Error Present(int32_t *out_retire_fence);
- virtual HWC2::Error GetActiveConfig(hwc2_config_t *out_config);
-
- private:
- HWCDisplayDummy(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
- HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
- qService::QService *qservice, hwc2_display_t id, int32_t sdm_id);
- DisplayNull display_null_;
-};
-
-} // namespace sdm
-
-#endif // __HWC_DISPLAY_DUMMY_H__
diff --git a/sdm/libs/hwc2/hwc_display_pluggable.cpp b/sdm/libs/hwc2/hwc_display_pluggable.cpp
index 7590d0e7..3a4f0b65 100644
--- a/sdm/libs/hwc2/hwc_display_pluggable.cpp
+++ b/sdm/libs/hwc2/hwc_display_pluggable.cpp
@@ -128,7 +128,7 @@ HWC2::Error HWCDisplayPluggable::Validate(uint32_t *out_num_types, uint32_t *out
BuildLayerStack();
if (layer_set_.empty()) {
- flush_ = !client_connected_;
+ flush_ = true;
validated_ = true;
return status;
}
@@ -328,10 +328,4 @@ HWC2::Error HWCDisplayPluggable::SetColorModeWithRenderIntent(ColorMode mode, Re
return status;
}
-HWC2::Error HWCDisplayPluggable::UpdatePowerMode(HWC2::PowerMode mode) {
- current_power_mode_ = mode;
- validated_ = false;
- return HWC2::Error::None;
-}
-
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display_pluggable.h b/sdm/libs/hwc2/hwc_display_pluggable.h
index 7c24c1d7..1b35b988 100644
--- a/sdm/libs/hwc2/hwc_display_pluggable.h
+++ b/sdm/libs/hwc2/hwc_display_pluggable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2019, 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
@@ -54,7 +54,6 @@ class HWCDisplayPluggable : public HWCDisplay {
RenderIntent *out_intents);
virtual HWC2::Error SetColorMode(ColorMode mode);
virtual HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent);
- virtual HWC2::Error UpdatePowerMode(HWC2::PowerMode mode);
private:
HWCDisplayPluggable(CoreInterface *core_intf, HWCBufferAllocator *buffer_allocator,
diff --git a/sdm/libs/hwc2/hwc_display_virtual.h b/sdm/libs/hwc2/hwc_display_virtual.h
index 4de0d343..c325a7f0 100644
--- a/sdm/libs/hwc2/hwc_display_virtual.h
+++ b/sdm/libs/hwc2/hwc_display_virtual.h
@@ -52,9 +52,6 @@ class HWCDisplayVirtual : public HWCDisplay {
int32_t format, bool post_processed);
virtual HWC2::Error GetDisplayType(int32_t *out_type);
virtual HWC2::Error SetColorMode(ColorMode mode);
- virtual HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent) {
- return HWC2::Error::None;
- }
virtual HWC2::Error SetPanelLuminanceAttributes(float min_lum, float max_lum);
HWC2::Error SetOutputBuffer(buffer_handle_t buf, int32_t release_fence);
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index a4bd77af..6b345b1c 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -417,9 +417,6 @@ HWC2::Error HWCLayer::SetLayerDataspace(int32_t dataspace) {
if (dataspace_ != dataspace) {
geometry_changes_ |= kDataspace;
dataspace_ = dataspace;
- if (layer_->input_buffer.buffer_id) {
- ValidateAndSetCSC(reinterpret_cast<private_handle_t *>(layer_->input_buffer.buffer_id));
- }
}
return HWC2::Error::None;
}
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index bdd18fe2..976e646f 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -72,8 +72,7 @@ namespace sdm {
static HWCUEvent g_hwc_uevent_;
Locker HWCSession::locker_[HWCCallbacks::kNumDisplays];
bool HWCSession::power_on_pending_[HWCCallbacks::kNumDisplays];
-Locker HWCSession::power_state_[HWCCallbacks::kNumDisplays];
-Locker HWCSession::display_config_locker_;
+
static const int kSolidFillDelay = 100 * 1000;
int HWCSession::null_display_mode_ = 0;
@@ -205,6 +204,7 @@ int HWCSession::Init() {
return -EINVAL;
}
+ StartServices();
HWCDebugHandler::Get()->GetProperty(ENABLE_NULL_DISPLAY_PROP, &null_display_mode_);
HWCDebugHandler::Get()->GetProperty(DISABLE_HOTPLUG_BWCHECK, &disable_hotplug_bwcheck_);
HWCDebugHandler::Get()->GetProperty(DISABLE_MASK_LAYER_HINT, &disable_mask_layer_hint_);
@@ -213,11 +213,6 @@ int HWCSession::Init() {
g_hwc_uevent_.Register(this);
}
- int value = 0;
- Debug::Get()->GetProperty(ENABLE_ASYNC_POWERMODE, &value);
- async_powermode_ = (value == 1);
- DLOGI("builtin_powermode_override: %d", async_powermode_);
-
InitSupportedDisplaySlots();
// Create primary display here. Remaining builtin displays will be created after client has set
// display indexes which may happen sometime before callback is registered.
@@ -228,7 +223,6 @@ int HWCSession::Init() {
}
is_composer_up_ = true;
- StartServices();
return 0;
}
@@ -350,19 +344,6 @@ void HWCSession::InitSupportedDisplaySlots() {
// resize HDR supported map to total number of displays.
is_hdr_display_.resize(UINT32(base_id));
-
- if (!async_powermode_) {
- return;
- }
-
- int start_index = HWCCallbacks::kNumRealDisplays;
- std::vector<DisplayMapInfo> map_info = {map_info_primary_};
- std::copy(map_info_builtin_.begin(), map_info_builtin_.end(), std::back_inserter(map_info));
- std::copy(map_info_pluggable_.begin(), map_info_pluggable_.end(), std::back_inserter(map_info));
- for (auto &map : map_info) {
- DLOGI("Display Pairs: map.client_id: %d, start_index: %d", map.client_id, start_index);
- map_hwc_display_.insert(std::make_pair(map.client_id, start_index++));
- }
}
int HWCSession::GetDisplayIndex(int dpy) {
@@ -547,7 +528,7 @@ void HWCSession::Dump(hwc2_device_t *device, uint32_t *out_size, char *out_buffe
*out_size = max_dump_size;
} else {
std::string s {};
- for (int id = 0; id < HWCCallbacks::kNumRealDisplays; id++) {
+ for (int id = 0; id < HWCCallbacks::kNumDisplays; id++) {
SCOPE_LOCK(locker_[id]);
if (hwc_session->hwc_display_[id]) {
s += hwc_session->hwc_display_[id]->Dump();
@@ -785,14 +766,6 @@ int32_t HWCSession::PresentDisplay(hwc2_device_t *device, hwc2_display_t display
hwc_session->HandleSecureSession();
{
- SCOPE_LOCK(power_state_[display]);
- if (hwc_session->power_state_transition_[display]) {
- // Route all interactions with client to dummy display.
- display = hwc_session->map_hwc_display_.find(display)->second;
- }
- }
-
- {
SEQUENCE_EXIT_SCOPE_LOCK(locker_[display]);
if (!hwc_session->hwc_display_[display]) {
DLOGW("Removed Display : display = %" PRIu64, display);
@@ -824,7 +797,6 @@ int32_t HWCSession::PresentDisplay(hwc2_device_t *device, hwc2_display_t display
hwc_session->HandlePowerOnPending(display, *out_retire_fence);
hwc_session->HandleHotplugPending(display, *out_retire_fence);
- hwc_session->display_ready_.set(UINT32(display));
hwc_session->HandlePendingRefresh();
return INT32(status);
@@ -865,23 +837,6 @@ int32_t HWCSession::RegisterCallback(hwc2_device_t *device, int32_t descriptor,
DLOGI("Hotplugging primary...");
hwc_session->callbacks_.Hotplug(HWC_DISPLAY_PRIMARY, HWC2::Connection::Connected);
}
-
- std::vector<hwc2_display_t> pending_hotplugs;
- if (pointer) {
- for (auto &map_info : hwc_session->map_info_builtin_) {
- SCOPE_LOCK(locker_[map_info.client_id]);
- if (hwc_session->hwc_display_[map_info.client_id]) {
- pending_hotplugs.push_back(static_cast<hwc2_display_t>(map_info.client_id));
- }
- }
- for (auto &map_info : hwc_session->map_info_pluggable_) {
- SCOPE_LOCK(locker_[map_info.client_id]);
- if (hwc_session->hwc_display_[map_info.client_id]) {
- pending_hotplugs.push_back(static_cast<hwc2_display_t>(map_info.client_id));
- }
- }
- }
-
// Create displays since they should now have their final display indices set.
DLOGI("Handling built-in displays...");
if (hwc_session->HandleBuiltInDisplays()) {
@@ -894,26 +849,7 @@ int32_t HWCSession::RegisterCallback(hwc2_device_t *device, int32_t descriptor,
strerror(abs(err)), hwc_session->hotplug_pending_event_ == kHotPlugEvent ? "deferred" :
"dropped");
}
-
- // If previously registered, call hotplug for all connected displays to refresh
- if (pointer) {
- std::vector<hwc2_display_t> updated_pending_hotplugs;
- for (auto client_id : pending_hotplugs) {
- SCOPE_LOCK(locker_[client_id]);
- // check if the display is unregistered
- if (hwc_session->hwc_display_[client_id]) {
- updated_pending_hotplugs.push_back(client_id);
- }
- }
- for (auto client_id : updated_pending_hotplugs) {
- DLOGI("Re-hotplug display connected: client id = %d", client_id);
- hwc_session->callbacks_.Hotplug(client_id, HWC2::Connection::Connected);
- }
- }
-
- hwc_session->client_connected_ = !!pointer;
- // Notfify all displays.
- hwc_session->NotifyClientStatus(hwc_session->client_connected_);
+ hwc_session->client_connected_ = true;
}
hwc_session->need_invalidate_ = false;
hwc_session->callbacks_lock_.Broadcast();
@@ -1107,18 +1043,10 @@ int32_t HWCSession::SetPowerMode(hwc2_device_t *device, hwc2_display_t display,
return HWC2_ERROR_UNSUPPORTED;
}
- bool override_mode = hwc_session->async_powermode_ &&
- hwc_session->display_ready_.test(UINT32(display));
- if (!override_mode) {
- auto error = CallDisplayFunction(device, display, &HWCDisplay::SetPowerMode, mode,
+ auto error = CallDisplayFunction(device, display, &HWCDisplay::SetPowerMode, mode,
false /* teardown */);
- if (error != HWC2_ERROR_NONE) {
- return error;
- }
- } else {
- SCOPE_LOCK(locker_[display]);
- // Update hwc state for now. Actual poweron will handled through DisplayConfig.
- hwc_session->hwc_display_[display]->UpdatePowerMode(mode);
+ if (error != HWC2_ERROR_NONE) {
+ return error;
}
// Reset idle pc ref count on suspend, as we enable idle pc during suspend.
if (mode == HWC2::PowerMode::Off) {
@@ -1190,17 +1118,8 @@ int32_t HWCSession::ValidateDisplay(hwc2_device_t *device, hwc2_display_t displa
if (display >= HWCCallbacks::kNumDisplays) {
return HWC2_ERROR_BAD_DISPLAY;
}
-
- HWCSession *hwc_session = static_cast<HWCSession *>(device);
-
- {
- SCOPE_LOCK(power_state_[display]);
- if (hwc_session->power_state_transition_[display]) {
- // Route all interactions with client to dummy display.
- display = hwc_session->map_hwc_display_.find(display)->second;
- }
- }
DTRACE_SCOPED();
+ HWCSession *hwc_session = static_cast<HWCSession *>(device);
// TODO(user): Handle secure session, handle QDCM solid fill
auto status = HWC2::Error::BadDisplay;
hwc_session->HandleSecureSession();
@@ -2004,8 +1923,18 @@ android::status_t HWCSession::SetAd4RoiConfig(const android::Parcel *input_parce
auto f_in = static_cast<uint32_t>(input_parcel->readInt32());
auto f_out = static_cast<uint32_t>(input_parcel->readInt32());
+#ifdef DISPLAY_CONFIG_1_5
return static_cast<android::status_t>(SetDisplayDppsAdROI(display_id, h_s, h_e, v_s,
v_e, f_in, f_out));
+#else
+ auto err = CallDisplayFunction(static_cast<hwc2_device_t *>(this), display_id,
+ &HWCDisplay::SetDisplayDppsAdROI, h_s, h_e, v_s, v_e,
+ f_in, f_out);
+ if (err != HWC2_ERROR_NONE)
+ return -EINVAL;
+
+ return 0;
+#endif
}
android::status_t HWCSession::SetColorModeWithRenderIntentOverride(
@@ -2382,12 +2311,7 @@ const char *GetTokenValue(const char *uevent_data, int length, const char *token
android::status_t HWCSession::SetDsiClk(const android::Parcel *input_parcel) {
int disp_id = input_parcel->readInt32();
uint64_t clk = UINT64(input_parcel->readInt64());
- if (disp_id < 0) {
- return -EINVAL;
- }
-
- SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
+ if (disp_id < 0 || !hwc_display_[disp_id]) {
return -EINVAL;
}
@@ -2397,12 +2321,7 @@ android::status_t HWCSession::SetDsiClk(const android::Parcel *input_parcel) {
android::status_t HWCSession::GetDsiClk(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int disp_id = input_parcel->readInt32();
- if (disp_id < 0) {
- return -EINVAL;
- }
-
- SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
+ if (disp_id < 0 || !hwc_display_[disp_id]) {
return -EINVAL;
}
@@ -2416,12 +2335,7 @@ android::status_t HWCSession::GetDsiClk(const android::Parcel *input_parcel,
android::status_t HWCSession::GetSupportedDsiClk(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int disp_id = input_parcel->readInt32();
- if (disp_id < 0) {
- return -EINVAL;
- }
-
- SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
+ if (disp_id < 0 || !hwc_display_[disp_id]) {
return -EINVAL;
}
@@ -2618,7 +2532,6 @@ int HWCSession::CreatePrimaryDisplay() {
map_info_primary_.disp_type = info.display_type;
map_info_primary_.sdm_id = info.display_id;
- CreateDummyDisplay(HWC_DISPLAY_PRIMARY);
color_mgr_ = HWCColorManager::CreateColorManager(&buffer_allocator_);
if (!color_mgr_) {
DLOGW("Failed to load HWCColorManager.");
@@ -2634,20 +2547,6 @@ int HWCSession::CreatePrimaryDisplay() {
return status;
}
-void HWCSession::CreateDummyDisplay(hwc2_display_t client_id) {
- if (!async_powermode_) {
- return;
- }
-
- hwc2_display_t dummy_disp_id = map_hwc_display_.find(client_id)->second;
- auto hwc_display_dummy = &hwc_display_[dummy_disp_id];
- HWCDisplayDummy::Create(core_intf_, &buffer_allocator_, &callbacks_, this, qservice_,
- 0, 0, hwc_display_dummy);
- if (!*hwc_display_dummy) {
- DLOGE("Dummy display creation failed for %d display\n", client_id);
- }
-}
-
int HWCSession::HandleBuiltInDisplays() {
if (null_display_mode_) {
DLOGW("Skipped BuiltIn display handling in null-display mode");
@@ -2692,7 +2591,6 @@ int HWCSession::HandleBuiltInDisplays() {
DLOGI("Builtin display created: sdm id = %d, client id = %d", info.display_id, client_id);
map_info.disp_type = info.display_type;
map_info.sdm_id = info.display_id;
- CreateDummyDisplay(client_id);
}
DLOGI("Hotplugging builtin display, sdm id = %d, client id = %d", info.display_id, client_id);
@@ -2842,7 +2740,6 @@ int HWCSession::HandleConnectedDisplays(HWDisplaysInfo *hw_displays_info, bool d
is_hdr_display_[UINT32(client_id)] = HasHDRSupport(hwc_display);
DLOGI("Created pluggable display successfully: sdm id = %d, client id = %d",
info.display_id, client_id);
- CreateDummyDisplay(client_id);
}
map_info.disp_type = info.display_type;
@@ -2966,16 +2863,6 @@ void HWCSession::DestroyPluggableDisplay(DisplayMapInfo *map_info) {
HWCDisplayPluggableTest::Destroy(hwc_display);
}
- if (async_powermode_) {
- hwc2_display_t dummy_disp_id = map_hwc_display_.find(client_id)->second;
- auto &hwc_display_dummy = hwc_display_[dummy_disp_id];
- display_ready_.reset(UINT32(dummy_disp_id));
- if (hwc_display_dummy) {
- HWCDisplayDummy::Destroy(hwc_display_dummy);
- hwc_display_dummy = nullptr;
- }
- }
- display_ready_.reset(UINT32(client_id));
hwc_display = nullptr;
map_info->Reset();
}
@@ -3001,17 +2888,7 @@ void HWCSession::DestroyNonPluggableDisplay(DisplayMapInfo *map_info) {
break;
}
- if (async_powermode_ && map_info->disp_type == kBuiltIn) {
- hwc2_display_t dummy_disp_id = map_hwc_display_.find(client_id)->second;
- auto &hwc_display_dummy = hwc_display_[dummy_disp_id];
- display_ready_.reset(UINT32(dummy_disp_id));
- if (hwc_display_dummy) {
- HWCDisplayDummy::Destroy(hwc_display_dummy);
- hwc_display_dummy = nullptr;
- }
- }
hwc_display = nullptr;
- display_ready_.reset(UINT32(client_id));
map_info->Reset();
}
@@ -3091,8 +2968,7 @@ void HWCSession::DisplayPowerReset() {
DLOGE("%d mode for display = %d failed with error = %d", mode, display, status);
}
ColorMode color_mode = hwc_display_[display]->GetCurrentColorMode();
- RenderIntent intent = hwc_display_[display]->GetCurrentRenderIntent();
- status = hwc_display_[display]->SetColorModeWithRenderIntent(color_mode, intent);
+ status = hwc_display_[display]->SetColorMode(color_mode);
if (status != HWC2::Error::None) {
DLOGE("SetColorMode failed for display = %d error = %d", display, status);
}
@@ -3249,9 +3125,6 @@ int32_t HWCSession::GetReadbackBufferAttributes(hwc2_device_t *device, hwc2_disp
HWCDisplay *hwc_display = hwc_session->hwc_display_[display];
if (hwc_display) {
- if (!hwc_display->IsDisplayCommandMode()) {
- return HWC2_ERROR_UNSUPPORTED;
- }
*format = HAL_PIXEL_FORMAT_RGB_888;
*dataspace = GetDataspaceFromColorMode(hwc_display->GetCurrentColorMode());
return HWC2_ERROR_NONE;
@@ -3419,7 +3292,36 @@ android::status_t HWCSession::SetIdlePC(const android::Parcel *input_parcel) {
auto enable = input_parcel->readInt32();
auto synchronous = input_parcel->readInt32();
+#ifdef DISPLAY_CONFIG_1_3
return static_cast<android::status_t>(controlIdlePowerCollapse(enable, synchronous));
+#else
+ {
+ hwc2_display_t active_builtin_disp_id = GetActiveBuiltinDisplay();
+ if (active_builtin_disp_id >= HWCCallbacks::kNumDisplays) {
+ DLOGE("No active displays");
+ return -EINVAL;
+ }
+ SEQUENCE_WAIT_SCOPE_LOCK(locker_[active_builtin_disp_id]);
+ if (hwc_display_[active_builtin_disp_id]) {
+ DLOGE("Primary display is not ready");
+ return -EINVAL;
+ }
+ auto err = hwc_display_[active_builtin_disp_id]->ControlIdlePowerCollapse(enable, synchronous);
+ if (err != kErrorNone) {
+ return (err == kErrorNotSupported) ? 0 : -EINVAL;
+ }
+ if (!enable) {
+ Refresh(active_builtin_disp_id);
+ int32_t error = locker_[active_builtin_disp_id].WaitFinite(kCommitDoneTimeoutMs);
+ if (error == ETIMEDOUT) {
+ DLOGE("Timed out!! Next frame commit done event not received!!");
+ return error;
+ }
+ }
+ DLOGI("Idle PC %s!!", enable ? "enabled" : "disabled");
+ }
+ return 0;
+#endif
}
hwc2_display_t HWCSession::GetActiveBuiltinDisplay() {
@@ -3440,14 +3342,4 @@ hwc2_display_t HWCSession::GetActiveBuiltinDisplay() {
return disp_id;
}
-void HWCSession::NotifyClientStatus(bool connected) {
- for (uint32_t i = 0; i < HWCCallbacks::kNumDisplays; i++) {
- if (!hwc_display_[i]) {
- continue;
- }
- SCOPE_LOCK(locker_[i]);
- hwc_display_[i]->NotifyClientStatus(connected);
- }
-}
-
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index 965e29a5..f893918f 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -20,7 +20,27 @@
#ifndef __HWC_SESSION_H__
#define __HWC_SESSION_H__
-#include <vendor/display/config/1.11/IDisplayConfig.h>
+#ifdef DISPLAY_CONFIG_1_9
+#include <vendor/display/config/1.9/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_8
+#include <vendor/display/config/1.8/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_7
+#include <vendor/display/config/1.7/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_6
+#include <vendor/display/config/1.6/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_5
+#include <vendor/display/config/1.5/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_4
+#include <vendor/display/config/1.4/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_3
+#include <vendor/display/config/1.3/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_2
+#include <vendor/display/config/1.2/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_1
+#include <vendor/display/config/1.1/IDisplayConfig.h>
+#else
+#include <vendor/display/config/1.0/IDisplayConfig.h>
+#endif
#include <core/core_interface.h>
#include <utils/locker.h>
@@ -28,14 +48,12 @@
#include <display_config.h>
#include <vector>
#include <utility>
-#include <map>
#include "hwc_callbacks.h"
#include "hwc_layers.h"
#include "hwc_display.h"
#include "hwc_display_builtin.h"
#include "hwc_display_pluggable.h"
-#include "hwc_display_dummy.h"
#include "hwc_display_virtual.h"
#include "hwc_display_pluggable_test.h"
#include "hwc_color_manager.h"
@@ -45,13 +63,29 @@
namespace sdm {
-using vendor::display::config::V1_11::IDisplayConfig;
-using vendor::display::config::V1_10::IDisplayCWBCallback;
-
+#ifdef DISPLAY_CONFIG_1_9
+using vendor::display::config::V1_9::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_8
+using vendor::display::config::V1_8::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_7
+using vendor::display::config::V1_7::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_6
+using vendor::display::config::V1_6::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_5
+using vendor::display::config::V1_5::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_4
+using vendor::display::config::V1_4::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_3
+using vendor::display::config::V1_3::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_2
+using vendor::display::config::V1_2::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_1
+using vendor::display::config::V1_1::IDisplayConfig;
+#else
+using vendor::display::config::V1_0::IDisplayConfig;
+#endif
using ::android::hardware::Return;
using ::android::hardware::hidl_string;
-using android::hardware::hidl_handle;
-using ::android::hardware::hidl_vec;
int32_t GetDataspaceFromColorMode(ColorMode mode);
@@ -113,16 +147,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
return HWC2_ERROR_BAD_DISPLAY;
}
- HWCSession *hwc_session = static_cast<HWCSession *>(device);
- {
- // Power state transition start.
- SCOPE_LOCK(power_state_[display]);
- if (hwc_session->power_state_transition_[display]) {
- display = hwc_session->map_hwc_display_.find(display)->second;
- }
- }
-
SCOPE_LOCK(locker_[display]);
+ HWCSession *hwc_session = static_cast<HWCSession *>(device);
auto status = HWC2::Error::BadDisplay;
if (hwc_session->hwc_display_[display]) {
auto hwc_display = hwc_session->hwc_display_[display];
@@ -143,16 +169,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
return HWC2_ERROR_BAD_DISPLAY;
}
- HWCSession *hwc_session = static_cast<HWCSession *>(device);
- {
- // Power state transition start.
- SCOPE_LOCK(power_state_[display]);
- if (hwc_session->power_state_transition_[display]) {
- display = hwc_session->map_hwc_display_.find(display)->second;
- }
- }
-
SCOPE_LOCK(locker_[display]);
+ HWCSession *hwc_session = static_cast<HWCSession *>(device);
auto status = HWC2::Error::BadDisplay;
if (hwc_session->hwc_display_[display]) {
status = HWC2::Error::BadLayer;
@@ -218,8 +236,6 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
int32_t *out_support);
static Locker locker_[HWCCallbacks::kNumDisplays];
- static Locker power_state_[HWCCallbacks::kNumDisplays];
- static Locker display_config_locker_;
private:
struct DisplayMapInfo {
@@ -253,7 +269,6 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
void InitSupportedDisplaySlots();
int GetDisplayIndex(int dpy);
int CreatePrimaryDisplay();
- void CreateDummyDisplay(hwc2_display_t client_id);
int HandleBuiltInDisplays();
int HandlePluggableDisplays(bool delay_hotplug);
int HandleConnectedDisplays(HWDisplaysInfo *hw_displays_info, bool delay_hotplug);
@@ -303,16 +318,30 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
getHDRCapabilities_cb _hidl_cb) override;
Return<int32_t> setCameraLaunchStatus(uint32_t on) override;
Return<void> displayBWTransactionPending(displayBWTransactionPending_cb _hidl_cb) override;
+#ifdef DISPLAY_CONFIG_1_1
Return<int32_t> setDisplayAnimating(uint64_t display_id, bool animating) override;
+#endif
+ // Methods from ::android::hardware::display::config::V1_2::IDisplayConfig follow.
+#ifdef DISPLAY_CONFIG_1_2
Return<int32_t> setDisplayIndex(IDisplayConfig::DisplayTypeExt disp_type,
uint32_t base, uint32_t count) override;
+#endif
+#ifdef DISPLAY_CONFIG_1_3
Return<int32_t> controlIdlePowerCollapse(bool enable, bool synchronous) override;
+#endif
+#ifdef DISPLAY_CONFIG_1_4
Return<void> getWriteBackCapabilities(getWriteBackCapabilities_cb _hidl_cb) override;
+#endif
+#ifdef DISPLAY_CONFIG_1_5
Return<int32_t> SetDisplayDppsAdROI(uint32_t dispaly_id, uint32_t h_start, uint32_t h_end,
uint32_t v_start, uint32_t v_end, uint32_t factor_in,
uint32_t factor_out) override;
+#endif
+#ifdef DISPLAY_CONFIG_1_6
Return<int32_t> updateVSyncSourceOnPowerModeOff() override;
Return<int32_t> updateVSyncSourceOnPowerModeDoze() override;
+#endif
+#ifdef DISPLAY_CONFIG_1_7
Return<int32_t> setPowerMode(uint32_t disp_id, PowerMode power_mode) override;
Return<bool> isPowerModeOverrideSupported(uint32_t disp_id) override;
Return<bool> isHDRSupported(uint32_t disp_id) override;
@@ -320,18 +349,17 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
Return<int32_t> setLayerAsMask(uint32_t disp_id, uint64_t layer_id) override;
Return<void> getDebugProperty(const hidl_string &prop_name,
getDebugProperty_cb _hidl_cb) override;
+#endif
+
+#ifdef DISPLAY_CONFIG_1_8
Return<void> getActiveBuiltinDisplayAttributes(getDisplayAttributes_cb _hidl_cb) override;
+#endif
+
+#ifdef DISPLAY_CONFIG_1_9
Return<int32_t> setPanelLuminanceAttributes(uint32_t disp_id, float min_lum,
float max_lum) override;
Return<bool> isBuiltInDisplay(uint32_t disp_id) override;
- Return<void> getSupportedDSIBitClks(uint32_t disp_id,
- getSupportedDSIBitClks_cb _hidl_cb) override;
- Return<uint64_t> getDSIClk(uint32_t disp_id) override;
- Return<int32_t> setDSIClk(uint32_t disp_id, uint64_t bit_clk) override;
- Return<int32_t> setCWBOutputBuffer(const ::android::sp<IDisplayCWBCallback> &callback,
- uint32_t disp_id, const Rect &rect, bool post_processed,
- const hidl_handle& buffer) override;
- Return<int32_t> setQsyncMode(uint32_t disp_id, IDisplayConfig::QsyncMode mode) override;
+#endif
// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
@@ -383,7 +411,6 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
bool IsPluggableDisplayConnected();
hwc2_display_t GetActiveBuiltinDisplay();
void HandlePendingRefresh();
- void NotifyClientStatus(bool connected);
CoreInterface *core_intf_ = nullptr;
HWCDisplay *hwc_display_[HWCCallbacks::kNumDisplays] = {nullptr};
@@ -396,7 +423,6 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
std::vector<DisplayMapInfo> map_info_pluggable_; // Pluggable displays excluding primary
std::vector<DisplayMapInfo> map_info_virtual_; // Virtual displays
std::vector<bool> is_hdr_display_; // info on HDR supported
- std::map <hwc2_display_t, hwc2_display_t> map_hwc_display_; // Real and dummy display pairs.
bool reset_panel_ = false;
bool client_connected_ = false;
bool new_bw_mode_ = false;
@@ -421,9 +447,6 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
float set_max_lum_ = -1.0;
float set_min_lum_ = -1.0;
std::bitset<HWCCallbacks::kNumDisplays> pending_refresh_;
- bool async_powermode_ = false;
- bool power_state_transition_[HWCCallbacks::kNumDisplays] = {}; // +1 to account for primary.
- std::bitset<HWCCallbacks::kNumDisplays> display_ready_;
};
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index d8a3f2c8..60786e77 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -556,16 +556,21 @@ Return<void> HWCSession::displayBWTransactionPending(displayBWTransactionPending
return Void();
}
+#ifdef DISPLAY_CONFIG_1_1
Return<int32_t> HWCSession::setDisplayAnimating(uint64_t display_id, bool animating ) {
return CallDisplayFunction(static_cast<hwc2_device_t *>(this), display_id,
&HWCDisplay::SetDisplayAnimating, animating);
}
+#endif
+#ifdef DISPLAY_CONFIG_1_2
Return<int32_t> HWCSession::setDisplayIndex(IDisplayConfig::DisplayTypeExt disp_type,
uint32_t base, uint32_t count) {
return -1;
}
+#endif // DISPLAY_CONFIG_1_2
+#ifdef DISPLAY_CONFIG_1_3
Return<int32_t> HWCSession::controlIdlePowerCollapse(bool enable, bool synchronous) {
hwc2_display_t active_builtin_disp_id = GetActiveBuiltinDisplay();
if (active_builtin_disp_id >= HWCCallbacks::kNumDisplays) {
@@ -608,6 +613,8 @@ Return<int32_t> HWCSession::controlIdlePowerCollapse(bool enable, bool synchrono
DLOGW("Display = %d is not connected.", active_builtin_disp_id);
return -ENODEV;
}
+#endif // DISPLAY_CONFIG_1_3
+
int32_t HWCSession::IsWbUbwcSupported(int *value) {
HWDisplaysInfo hw_displays_info = {};
@@ -626,6 +633,7 @@ int32_t HWCSession::IsWbUbwcSupported(int *value) {
return error;
}
+#ifdef DISPLAY_CONFIG_1_4
Return<void> HWCSession::getWriteBackCapabilities(getWriteBackCapabilities_cb _hidl_cb) {
int value = 0;
IDisplayConfig::WriteBackCapabilities wb_caps = {};
@@ -635,7 +643,9 @@ Return<void> HWCSession::getWriteBackCapabilities(getWriteBackCapabilities_cb _h
return Void();
}
+#endif // DISPLAY_CONFIG_1_4
+#ifdef DISPLAY_CONFIG_1_5
Return<int32_t> HWCSession::SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start,
uint32_t h_end, uint32_t v_start, uint32_t v_end,
uint32_t factor_in, uint32_t factor_out) {
@@ -643,7 +653,9 @@ Return<int32_t> HWCSession::SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_
&HWCDisplay::SetDisplayDppsAdROI, h_start, h_end, v_start, v_end,
factor_in, factor_out);
}
+#endif // DISPLAY_CONFIG_1_5
+#ifdef DISPLAY_CONFIG_1_6
Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeOff() {
return 0;
}
@@ -651,63 +663,17 @@ Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeOff() {
Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeDoze() {
return 0;
}
+#endif
-Return<bool> HWCSession::isPowerModeOverrideSupported(uint32_t disp_id) {
- if (!async_powermode_ || (disp_id > HWCCallbacks::kNumRealDisplays)) {
- return false;
- }
-
- return true;
-}
-
+#ifdef DISPLAY_CONFIG_1_7
Return<int32_t> HWCSession::setPowerMode(uint32_t disp_id, PowerMode power_mode) {
- SCOPE_LOCK(display_config_locker_);
-
- if (!isPowerModeOverrideSupported(disp_id)) {
- return 0;
- }
-
- DLOGI("disp_id: %d power_mode: %d", disp_id, power_mode);
- HWCDisplay::HWCLayerStack stack = {};
- hwc2_display_t dummy_disp_id = map_hwc_display_.at(disp_id);
-
- {
- // Power state transition start.
- Locker::ScopeLock lock_power(power_state_[disp_id]);
- Locker::ScopeLock lock_primary(locker_[disp_id]);
- Locker::ScopeLock lock_dummy(locker_[dummy_disp_id]);
-
- power_state_transition_[disp_id] = true;
- // Pass on the complete stack to dummy display.
- hwc_display_[disp_id]->GetLayerStack(&stack);
- // Update the same stack onto dummy display.
- hwc_display_[dummy_disp_id]->SetLayerStack(&stack);
- }
-
- {
- SCOPE_LOCK(locker_[disp_id]);
- auto mode = static_cast<HWC2::PowerMode>(power_mode);
- hwc_display_[disp_id]->SetPowerMode(mode, false /* teardown */);
- }
-
- {
- // Power state transition end.
- Locker::ScopeLock lock_power(power_state_[disp_id]);
- Locker::ScopeLock lock_primary(locker_[disp_id]);
- Locker::ScopeLock lock_dummy(locker_[dummy_disp_id]);
- // Pass on the layer stack to real display.
- hwc_display_[dummy_disp_id]->GetLayerStack(&stack);
- // Update the same stack onto real display.
- hwc_display_[disp_id]->SetLayerStack(&stack);
- // Read display has got layerstack. Update the fences.
- hwc_display_[disp_id]->PostPowerMode();
-
- power_state_transition_[disp_id] = false;
- }
-
return 0;
}
+Return<bool> HWCSession::isPowerModeOverrideSupported(uint32_t disp_id) {
+ return false;
+}
+
Return<bool> HWCSession::isHDRSupported(uint32_t disp_id) {
if (disp_id < 0 || disp_id >= HWCCallbacks::kNumDisplays) {
DLOGE("Not valid display");
@@ -752,7 +718,7 @@ Return<void> HWCSession::getDebugProperty(const hidl_string &prop_name,
int32_t error = -EINVAL;
vendor_prop_name += prop_name.c_str();
- if (HWCDebugHandler::Get()->GetProperty(vendor_prop_name.c_str(), value) == kErrorNone) {
+ if (HWCDebugHandler::Get()->GetProperty(vendor_prop_name.c_str(), value) != kErrorNone) {
result = value;
error = 0;
}
@@ -761,7 +727,9 @@ Return<void> HWCSession::getDebugProperty(const hidl_string &prop_name,
return Void();
}
+#endif
+#ifdef DISPLAY_CONFIG_1_8
Return<void> HWCSession::getActiveBuiltinDisplayAttributes(
getDisplayAttributes_cb _hidl_cb) {
int32_t error = -EINVAL;
@@ -796,7 +764,9 @@ err:
return Void();
}
+#endif // DISPLAY_CONFIG_1_8
+#ifdef DISPLAY_CONFIG_1_9
Return<int32_t> HWCSession::setPanelLuminanceAttributes(uint32_t disp_id, float pan_min_lum,
float pan_max_lum) {
// currently doing only for virtual display
@@ -824,74 +794,6 @@ Return<bool> HWCSession::isBuiltInDisplay(uint32_t disp_id) {
return false;
}
-
-Return<void> HWCSession::getSupportedDSIBitClks(uint32_t disp_id,
- getSupportedDSIBitClks_cb _hidl_cb) {
- SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
- return Void();
- }
-
- std::vector<uint64_t> bit_clks;
- hwc_display_[disp_id]->GetSupportedDSIClock(&bit_clks);
-
- hidl_vec<uint64_t> hidl_bit_clks = bit_clks;
- _hidl_cb(hidl_bit_clks);
-
- return Void();
-}
-
-Return<uint64_t> HWCSession::getDSIClk(uint32_t disp_id) {
- SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
- return 0;
- }
-
- uint64_t bit_clk = 0;
- hwc_display_[disp_id]->GetDynamicDSIClock(&bit_clk);
-
- return bit_clk;
-}
-
-Return<int32_t> HWCSession::setDSIClk(uint32_t disp_id, uint64_t bit_clk) {
- SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
- return -1;
- }
-
- return hwc_display_[disp_id]->SetDynamicDSIClock(bit_clk);
-}
-
-Return<int32_t> HWCSession::setCWBOutputBuffer(const ::android::sp<IDisplayCWBCallback> &callback,
- uint32_t disp_id, const Rect &rect,
- bool post_processed, const hidl_handle& buffer) {
- return -1;
-}
-
-Return<int32_t> HWCSession::setQsyncMode(uint32_t disp_id, IDisplayConfig::QsyncMode mode) {
- SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
- if (!hwc_display_[disp_id]) {
- return -1;
- }
-
- QSyncMode qsync_mode = kQSyncModeNone;
- switch (mode) {
- case IDisplayConfig::QsyncMode::NONE:
- qsync_mode = kQSyncModeNone;
- break;
- case IDisplayConfig::QsyncMode::WAIT_FOR_FENCES_ONE_FRAME:
- qsync_mode = kQsyncModeOneShot;
- break;
- case IDisplayConfig::QsyncMode::WAIT_FOR_FENCES_EACH_FRAME:
- qsync_mode = kQsyncModeOneShotContinuous;
- break;
- case IDisplayConfig::QsyncMode::WAIT_FOR_COMMIT_EACH_FRAME:
- qsync_mode = kQSyncModeContinuous;
- break;
- }
-
- hwc_display_[disp_id]->SetQSyncMode(qsync_mode);
- return 0;
-}
+#endif // DISPLAY_CONFIG_1_9
} // namespace sdm