Merge "gralloc: avoid Null pointer dereference."
diff --git a/config/display-product.mk b/config/display-product.mk
index 99930b5..bad2a6d 100644
--- a/config/display-product.mk
+++ b/config/display-product.mk
@@ -52,7 +52,6 @@
debug.egl.hw=0 \
debug.sf.latch_unsignaled=1 \
debug.mdpcomp.logs=0 \
- ro.vendor.display.cabl=2 \
vendor.gralloc.disable_ubwc=0 \
vendor.display.disable_scaler=0 \
vendor.display.disable_inline_rotator=1 \
diff --git a/config/talos.mk b/config/talos.mk
index 48a2237..f2628f7 100644
--- a/config/talos.mk
+++ b/config/talos.mk
@@ -9,10 +9,10 @@
android.hardware.memtrack@1.0-service \
android.hardware.light@2.0-impl \
android.hardware.light@2.0-service \
- gralloc.talos \
- lights.talos \
- hwcomposer.talos \
- memtrack.talos \
+ gralloc.sm6150 \
+ lights.sm6150 \
+ hwcomposer.sm6150 \
+ memtrack.sm6150 \
libqdutils \
libqdMetaData \
libqdMetaData.system \
@@ -58,7 +58,6 @@
debug.egl.hw=0 \
debug.sf.latch_unsignaled=1 \
debug.mdpcomp.logs=0 \
- ro.vendor.display.cabl=2 \
vendor.gralloc.disable_ubwc=0 \
vendor.display.disable_scaler=0 \
vendor.display.disable_inline_rotator=1 \
diff --git a/config/trinket.mk b/config/trinket.mk
index cfcba97..f607b42 100644
--- a/config/trinket.mk
+++ b/config/trinket.mk
@@ -43,7 +43,6 @@
debug.egl.hw=0 \
debug.sf.latch_unsignaled=1 \
debug.mdpcomp.logs=0 \
- ro.vendor.display.cabl=2 \
vendor.gralloc.disable_ubwc=0 \
vendor.display.disable_scaler=0 \
vendor.display.disable_inline_rotator=1 \
diff --git a/gpu_tonemapper/Android.mk b/gpu_tonemapper/Android.mk
index da90754..61b134f 100644
--- a/gpu_tonemapper/Android.mk
+++ b/gpu_tonemapper/Android.mk
@@ -14,7 +14,7 @@
LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_SHARED_LIBRARIES := libEGL libGLESv2 libGLESv3 libui libutils liblog
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_CFLAGS := $(version_flag) -Wno-missing-field-initializers -Wall \
-Wno-unused-parameter -std=c++11 -DLOG_TAG=\"GPU_TONEMAPPER\"
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 9dc043f..0955f56 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -16,7 +16,7 @@
android.hardware.graphics.mapper@2.1
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\" -Wall -Werror
LOCAL_CLANG := true
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := gr_device_impl.cpp
include $(BUILD_SHARED_LIBRARY)
@@ -49,7 +49,7 @@
LOCAL_SHARED_LIBRARIES := $(common_libs) libqdMetaData libdl libgrallocutils libion \
android.hardware.graphics.mapper@2.1
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\" -Wno-sign-conversion
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := gr_allocator.cpp gr_buf_mgr.cpp gr_ion_alloc.cpp
include $(BUILD_SHARED_LIBRARY)
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index eb455ff..656ddec 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -1166,6 +1166,8 @@
} else if (usage & BufferUsage::VIDEO_ENCODER) {
if (usage & GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER) {
gr_format = HAL_PIXEL_FORMAT_NV21_ENCODEABLE; // NV21
+ } else if (usage & GRALLOC_USAGE_PRIVATE_HEIF) {
+ gr_format = HAL_PIXEL_FORMAT_NV12_HEIF;
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS;
} else {
diff --git a/include/display_properties.h b/include/display_properties.h
index 64c4839..d78da9d 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -119,6 +119,7 @@
#define BUILTIN_BASEID_AND_SIZE_PROP DISPLAY_PROP("builtin_baseid_and_size")
#define PLUGGABLE_BASEID_AND_SIZE_PROP DISPLAY_PROP("pluggable_baseid_and_size")
#define VIRTUAL_BASEID_AND_SIZE_PROP DISPLAY_PROP("virtual_baseid_and_size")
+#define ENABLE_QDCM_DIAG DISPLAY_PROP("enable_qdcm_diag")
#define ZERO_SWAP_INTERVAL "vendor.debug.egl.swapinterval"
#define ENABLE_DROP_REFRESH DISPLAY_PROP("enable_drop_refresh")
diff --git a/sdm/include/core/layer_stack.h b/sdm/include/core/layer_stack.h
index 24d4f80..8a50860 100644
--- a/sdm/include/core/layer_stack.h
+++ b/sdm/include/core/layer_stack.h
@@ -38,6 +38,7 @@
#include <utility>
#include <unordered_map>
#include <memory>
+#include <bitset>
#include "layer_buffer.h"
#include "sdm_types.h"
@@ -129,6 +130,16 @@
//!< stack.
};
+enum LayerUpdate {
+ kSecurity,
+ kMetadataUpdate,
+ kSurfaceDamage,
+ kSurfaceInvalidate,
+ kClientCompRequest,
+ kLayerUpdateMax,
+};
+
+
/*! @brief This structure defines rotation and flip values for a display layer.
@sa Layer
@@ -264,6 +275,8 @@
uint32_t hdr_present : 1; //!< Set if stack has HDR content
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 flags = 0; //!< For initialization purpose only.
@@ -392,6 +405,7 @@
//!< needed on this layer.
LayerSolidFill solid_fill_info = {}; //!< solid fill info along with depth.
std::shared_ptr<LayerBufferMap> buffer_map = nullptr; //!< Map of handle_id and fb_id.
+ std::bitset<kLayerUpdateMax> update_mask = 0;
};
/*! @brief This structure defines the color space + transfer of a given layer.
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index 09e76cd..f8a58d1 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -22,7 +22,7 @@
LOCAL_CFLAGS += -DPP_DRM_ENABLE
endif
-LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := core_interface.cpp \
core_impl.cpp \
display_base.cpp \
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 325d7f5..b0322f1 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -274,12 +274,18 @@
}
}
+void CompManager::GenerateROI(Handle display_ctx, HWLayers *hw_layers) {
+ SCOPE_LOCK(locker_);
+ DisplayCompositionContext *disp_comp_ctx =
+ reinterpret_cast<DisplayCompositionContext *>(display_ctx);
+ return disp_comp_ctx->strategy->GenerateROI(&hw_layers->info, disp_comp_ctx->pu_constraints);
+}
+
void CompManager::PrePrepare(Handle display_ctx, HWLayers *hw_layers) {
SCOPE_LOCK(locker_);
DisplayCompositionContext *display_comp_ctx =
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
- display_comp_ctx->strategy->Start(&hw_layers->info, &display_comp_ctx->max_strategies,
- display_comp_ctx->pu_constraints);
+ display_comp_ctx->strategy->Start(&hw_layers->info, &display_comp_ctx->max_strategies);
display_comp_ctx->remaining_strategies = display_comp_ctx->max_strategies;
}
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index 54cde85..6cfa2fe 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -83,6 +83,8 @@
DisplayError SetBlendSpace(Handle display_ctx, const PrimariesTransfer &blend_space);
void HandleSecureEvent(Handle display_ctx, SecureEvent secure_event);
void SetSafeMode(bool enable) { safe_mode_ = enable; }
+ bool IsSafeMode() { return safe_mode_; }
+ void GenerateROI(Handle display_ctx, HWLayers *hw_layers);
private:
static const int kMaxThermalLevel = 3;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index d5879da..f9aa06b 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -204,6 +204,7 @@
DisplayError DisplayBase::BuildLayerStackStats(LayerStack *layer_stack) {
std::vector<Layer *> &layers = layer_stack->layers;
HWLayersInfo &hw_layers_info = hw_layers_.info;
+ hw_layers_info.app_layer_count = 0;
hw_layers_info.stack = layer_stack;
@@ -310,7 +311,9 @@
}
hw_layers_.updates_mask.set(kUpdateResources);
+ comp_manager_->GenerateROI(display_comp_ctx_, &hw_layers_);
comp_manager_->PrePrepare(display_comp_ctx_, &hw_layers_);
+
while (true) {
error = comp_manager_->Prepare(display_comp_ctx_, &hw_layers_);
if (error != kErrorNone) {
@@ -625,9 +628,45 @@
hw_intf_->GetDisplayAttributes(active_index, &attrib);
os << "device type:" << display_type_;
- os << "\nstate: " << state_ << " vsync on: " << vsync_enable_ << " max. mixer stages: "
- << max_mixer_stages_;
+ os << "\nstate: " << state_ << " vsync on: " << vsync_enable_
+ << " max. mixer stages: " << max_mixer_stages_;
os << "\nnum configs: " << num_modes << " active config index: " << active_index;
+ os << "\nDisplay Attributes:";
+ os << "\n Mode:" << (hw_panel_info_.mode == kModeVideo ? "Video" : "Command");
+ os << std::boolalpha;
+ os << " Primary:" << hw_panel_info_.is_primary_panel;
+ os << " DynFPS:" << hw_panel_info_.dynamic_fps;
+ os << "\n HDR Panel:" << hw_panel_info_.hdr_enabled;
+ os << " QSync:" << hw_panel_info_.qsync_support;
+ os << " DynBitclk:" << hw_panel_info_.dyn_bitclk_support;
+ os << "\n Left Split:" << hw_panel_info_.split_info.left_split << " Right Split:"
+ << hw_panel_info_.split_info.right_split;
+ os << "\n PartialUpdate:" << hw_panel_info_.partial_update;
+ if (hw_panel_info_.partial_update) {
+ os << "\n ROI Min w:" << hw_panel_info_.min_roi_width;
+ os << " Min h:" << hw_panel_info_.min_roi_height;
+ os << " NeedsMerge: " << hw_panel_info_.needs_roi_merge;
+ os << " Alignment: l:" << hw_panel_info_.left_align << " w:" << hw_panel_info_.width_align;
+ os << " t:" << hw_panel_info_.top_align << " b:" << hw_panel_info_.height_align;
+ }
+ os << "\n FPS min:" << hw_panel_info_.min_fps << " max:" << hw_panel_info_.max_fps
+ << " cur:" << display_attributes_.fps;
+ os << " TransferTime: " << hw_panel_info_.transfer_time_us <<"us";
+ os << " MaxBrightness:" << hw_panel_info_.panel_max_brightness;
+ os << "\n Display WxH: " << display_attributes_.x_pixels << "x"
+ << display_attributes_.y_pixels;
+ os << " MixerWxH: " << mixer_attributes_.width << "x" << mixer_attributes_.height;
+ os << " DPI: " << display_attributes_.x_dpi << "x" << display_attributes_.y_dpi;
+ os << " LM_Split: " << display_attributes_.is_device_split;
+ os << "\n vsync_period " << display_attributes_.vsync_period_ns;
+ os << " v_back_porch: " << display_attributes_.v_back_porch;
+ os << " v_front_porch: " << display_attributes_.v_front_porch;
+ os << " v_pulse_width: " << display_attributes_.v_pulse_width;
+ os << "\n v_total: " << display_attributes_.v_total;
+ os << " h_total: " << display_attributes_.h_total;
+ os << " clk: " << display_attributes_.clock_khz;
+ os << " Topology: " << display_attributes_.topology;
+ os << std::noboolalpha;
os << "\nCurrent Color Mode: " << current_color_mode_.c_str();
os << "\nAvailable Color Modes:\n";
@@ -640,7 +679,6 @@
}
os << "\n";
}
- DisplayConfigVariableInfo &info = attrib;
uint32_t num_hw_layers = 0;
if (hw_layers_.info.stack) {
@@ -654,15 +692,9 @@
LayerBuffer *out_buffer = hw_layers_.info.stack->output_buffer;
if (out_buffer) {
- os << "\nres: " << out_buffer->width << "x" << out_buffer->height << " format: "
+ os << "\n Output buffer res: " << out_buffer->width << "x" << out_buffer->height << " format: "
<< GetFormatString(out_buffer->format);
- } else {
- os.precision(2);
- os << "\nres: " << info.x_pixels << "x" << info.y_pixels << " dpi: " << std::fixed <<
- info.x_dpi << "x" << std::fixed << info.y_dpi << " fps: " << info.fps <<
- " vsync period: " << info.vsync_period_ns;
}
-
HWLayersInfo &layer_info = hw_layers_.info;
for (uint32_t i = 0; i < layer_info.left_frame_roi.size(); i++) {
LayerRect &l_roi = layer_info.left_frame_roi.at(i);
@@ -1245,14 +1277,26 @@
bool DisplayBase::NeedsMixerReconfiguration(LayerStack *layer_stack, uint32_t *new_mixer_width,
uint32_t *new_mixer_height) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- uint32_t layer_count = UINT32(layer_stack->layers.size());
+ uint32_t mixer_width = mixer_attributes_.width;
+ uint32_t mixer_height = mixer_attributes_.height;
+ if (req_mixer_width_ && req_mixer_height_) {
+ DLOGD_IF(kTagDisplay, "Required mixer width : %d, height : %d",
+ req_mixer_width_, req_mixer_height_);
+ *new_mixer_width = req_mixer_width_;
+ *new_mixer_height = req_mixer_height_;
+ return (req_mixer_width_ != mixer_width || req_mixer_height_ != mixer_height);
+ }
+
+ if (!custom_mixer_resolution_) {
+ return false;
+ }
+
+ uint32_t layer_count = UINT32(layer_stack->layers.size());
uint32_t fb_width = fb_config_.x_pixels;
uint32_t fb_height = fb_config_.y_pixels;
uint32_t fb_area = fb_width * fb_height;
LayerRect fb_rect = (LayerRect) {0.0f, 0.0f, FLOAT(fb_width), FLOAT(fb_height)};
- uint32_t mixer_width = mixer_attributes_.width;
- uint32_t mixer_height = mixer_attributes_.height;
uint32_t display_width = display_attributes_.x_pixels;
uint32_t display_height = display_attributes_.y_pixels;
@@ -1263,14 +1307,6 @@
uint32_t align_x = display_attributes_.is_device_split ? 4 : 2;
uint32_t align_y = 2;
- if (req_mixer_width_ && req_mixer_height_) {
- DLOGD_IF(kTagDisplay, "Required mixer width : %d, height : %d",
- req_mixer_width_, req_mixer_height_);
- *new_mixer_width = req_mixer_width_;
- *new_mixer_height = req_mixer_height_;
- return (req_mixer_width_ != mixer_width || req_mixer_height_ != mixer_height);
- }
-
for (uint32_t i = 0; i < layer_count; i++) {
Layer *layer = layers.at(i);
@@ -1319,7 +1355,7 @@
*new_mixer_width = display_width;
*new_mixer_height = display_height;
}
- return true;
+ return ((*new_mixer_width != mixer_width) || (*new_mixer_height != mixer_height));
}
return false;
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 82a5725..3c9d01f 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -134,13 +134,34 @@
if (error != kErrorNone) {
ReconfigureMixer(display_width, display_height);
}
+ } else {
+ if (CanSkipDisplayPrepare(layer_stack)) {
+ hw_layers_.hw_avr_info.enable = NeedsAVREnable();
+ return kErrorNone;
+ }
}
// Clean hw layers for reuse.
+ DTRACE_BEGIN("PrepareHWLayers");
hw_layers_ = HWLayers();
+ DTRACE_END();
+
hw_layers_.hw_avr_info.enable = NeedsAVREnable();
- return DisplayBase::Prepare(layer_stack);
+ left_frame_roi_ = {};
+ right_frame_roi_ = {};
+
+ error = DisplayBase::Prepare(layer_stack);
+
+ // Cache the Frame ROI.
+ if (error == kErrorNone) {
+ if (hw_layers_.info.left_frame_roi.size() && hw_layers_.info.right_frame_roi.size()) {
+ left_frame_roi_ = hw_layers_.info.left_frame_roi.at(0);
+ right_frame_roi_ = hw_layers_.info.right_frame_roi.at(0);
+ }
+ }
+
+ return error;
}
DisplayError DisplayBuiltIn::Commit(LayerStack *layer_stack) {
@@ -613,4 +634,90 @@
return hw_intf_->GetDynamicDSIClock(bit_clk_rate);
}
+bool DisplayBuiltIn::CanCompareFrameROI(LayerStack *layer_stack) {
+ // Check Display validation and safe-mode states.
+ if (needs_validate_ || comp_manager_->IsSafeMode()) {
+ return false;
+ }
+
+ // Check Panel and Layer Stack attributes.
+ if (!hw_panel_info_.partial_update || (hw_panel_info_.left_roi_count != 1) ||
+ layer_stack->flags.geometry_changed || layer_stack->flags.config_changed ||
+ (layer_stack->layers.size() != (hw_layers_.info.app_layer_count + 1))) {
+ return false;
+ }
+
+ // Check for Partial Update disable requests/scenarios.
+ if (color_mgr_ && color_mgr_->NeedsPartialUpdateDisable()) {
+ DisablePartialUpdateOneFrame();
+ }
+
+ if (!partial_update_control_ || disable_pu_one_frame_ || disable_pu_on_dest_scaler_) {
+ return false;
+ }
+
+ bool surface_damage = false;
+ uint32_t surface_damage_mask_value = (1 << kSurfaceDamage);
+ for (uint32_t i = 0; i < layer_stack->layers.size(); i++) {
+ Layer *layer = layer_stack->layers.at(i);
+ if (layer->update_mask.none()) {
+ continue;
+ }
+ // Only kSurfaceDamage bit should be set in layer's update-mask.
+ if (layer->update_mask.to_ulong() == surface_damage_mask_value) {
+ surface_damage = true;
+ } else {
+ return false;
+ }
+ }
+
+ return surface_damage;
+}
+
+bool DisplayBuiltIn::CanSkipDisplayPrepare(LayerStack *layer_stack) {
+ if (!CanCompareFrameROI(layer_stack)) {
+ return false;
+ }
+
+ DisplayError error = BuildLayerStackStats(layer_stack);
+ if (error != kErrorNone) {
+ return false;
+ }
+
+ hw_layers_.info.left_frame_roi.clear();
+ hw_layers_.info.right_frame_roi.clear();
+ hw_layers_.info.dest_scale_info_map.clear();
+ comp_manager_->GenerateROI(display_comp_ctx_, &hw_layers_);
+
+ if (!hw_layers_.info.left_frame_roi.size() || !hw_layers_.info.right_frame_roi.size()) {
+ return false;
+ }
+
+ // Compare the cached and calculated Frame ROIs.
+ bool same_roi = IsCongruent(left_frame_roi_, hw_layers_.info.left_frame_roi.at(0)) &&
+ IsCongruent(right_frame_roi_, hw_layers_.info.right_frame_roi.at(0));
+
+ if (same_roi) {
+ // Update Surface Damage rectangle(s) in HW layers.
+ uint32_t hw_layer_count = UINT32(hw_layers_.info.hw_layers.size());
+ for (uint32_t j = 0; j < hw_layer_count; j++) {
+ Layer &hw_layer = hw_layers_.info.hw_layers.at(j);
+ Layer *sdm_layer = layer_stack->layers.at(hw_layers_.info.index.at(j));
+ if (hw_layer.dirty_regions.size() != sdm_layer->dirty_regions.size()) {
+ return false;
+ }
+ for (uint32_t k = 0; k < hw_layer.dirty_regions.size(); k++) {
+ hw_layer.dirty_regions.at(k) = sdm_layer->dirty_regions.at(k);
+ }
+ }
+
+ // Set the composition type for SDM layers.
+ for (uint32_t i = 0; i < (layer_stack->layers.size() - 1); i++) {
+ layer_stack->layers.at(i)->composition = kCompositionSDE;
+ }
+ }
+
+ return same_roi;
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/display_builtin.h b/sdm/libs/core/display_builtin.h
index a399a67..371787d 100644
--- a/sdm/libs/core/display_builtin.h
+++ b/sdm/libs/core/display_builtin.h
@@ -95,6 +95,8 @@
private:
bool NeedsAVREnable();
+ bool CanCompareFrameROI(LayerStack *layer_stack);
+ bool CanSkipDisplayPrepare(LayerStack *layer_stack);
std::vector<HWEvent> event_list_;
bool avr_prop_disabled_ = false;
@@ -103,6 +105,8 @@
bool commit_event_enabled_ = false;
DppsInfo dpps_info_ = {};
QSyncMode qsync_mode_ = kQSyncModeNone;
+ LayerRect left_frame_roi_ = {};
+ LayerRect right_frame_roi_ = {};
};
} // namespace sdm
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 2c48259..aa6d28c 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -290,6 +290,7 @@
HWLayersInfo &hw_layer_info = hw_layers->info;
uint32_t hw_layer_count = UINT32(hw_layer_info.hw_layers.size());
+ DTRACE_SCOPED();
for (uint32_t i = 0; i < hw_layer_count; i++) {
Layer &layer = hw_layer_info.hw_layers.at(i);
LayerBuffer *input_buffer = &layer.input_buffer;
@@ -701,21 +702,23 @@
GetHWDisplayPortAndMode();
GetHWPanelMaxBrightness();
- DLOGI("%s, Panel Interface = %s, Panel Mode = %s, Is Primary = %d", device_name_,
+ DLOGI_IF(kTagDisplay, "%s, Panel Interface = %s, Panel Mode = %s, Is Primary = %d", device_name_,
interface_str_.c_str(), hw_panel_info_.mode == kModeVideo ? "Video" : "Command",
hw_panel_info_.is_primary_panel);
- DLOGI("Partial Update = %d, Dynamic FPS = %d, HDR Panel = %d QSync = %d",
+ DLOGI_IF(kTagDisplay, "Partial Update = %d, Dynamic FPS = %d, HDR Panel = %d QSync = %d",
hw_panel_info_.partial_update, hw_panel_info_.dynamic_fps, hw_panel_info_.hdr_enabled,
hw_panel_info_.qsync_support);
- DLOGI("Align: left = %d, width = %d, top = %d, height = %d", hw_panel_info_.left_align,
- hw_panel_info_.width_align, hw_panel_info_.top_align, hw_panel_info_.height_align);
- DLOGI("ROI: min_width = %d, min_height = %d, need_merge = %d", hw_panel_info_.min_roi_width,
- hw_panel_info_.min_roi_height, hw_panel_info_.needs_roi_merge);
- DLOGI("FPS: min = %d, max = %d", hw_panel_info_.min_fps, hw_panel_info_.max_fps);
- DLOGI("Left Split = %d, Right Split = %d", hw_panel_info_.split_info.left_split,
+ DLOGI_IF(kTagDisplay, "Align: left = %d, width = %d, top = %d, height = %d",
+ hw_panel_info_.left_align, hw_panel_info_.width_align, hw_panel_info_.top_align,
+ hw_panel_info_.height_align);
+ DLOGI_IF(kTagDisplay, "ROI: min_width = %d, min_height = %d, need_merge = %d",
+ hw_panel_info_.min_roi_width, hw_panel_info_.min_roi_height,
+ hw_panel_info_.needs_roi_merge);
+ DLOGI_IF(kTagDisplay, "FPS: min = %d, max = %d", hw_panel_info_.min_fps, hw_panel_info_.max_fps);
+ DLOGI_IF(kTagDisplay, "Left Split = %d, Right Split = %d", hw_panel_info_.split_info.left_split,
hw_panel_info_.split_info.right_split);
- DLOGI("Panel Transfer time = %d us", hw_panel_info_.transfer_time_us);
- DLOGI("Dynamic Bit Clk Support = %d", hw_panel_info_.dyn_bitclk_support);
+ DLOGI_IF(kTagDisplay, "Panel Transfer time = %d us", hw_panel_info_.transfer_time_us);
+ DLOGI_IF(kTagDisplay, "Dynamic Bit Clk Support = %d", hw_panel_info_.dyn_bitclk_support);
}
DisplayError HWDeviceDRM::GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size,
@@ -792,7 +795,7 @@
if (Sys::pread_(fd, brightness, sizeof(brightness), 0) > 0) {
hw_panel_info_.panel_max_brightness = atoi(brightness);
- DLOGI("Max brightness level = %d", hw_panel_info_.panel_max_brightness);
+ DLOGI_IF(kTagDisplay, "Max brightness level = %d", hw_panel_info_.panel_max_brightness);
} else {
DLOGW("Failed to read max brightness level. error = %s", strerror(errno));
}
@@ -834,15 +837,17 @@
PopulateHWPanelInfo();
UpdateMixerAttributes();
- DLOGI("Display attributes[%d]: WxH: %dx%d, DPI: %fx%f, FPS: %d, LM_SPLIT: %d, V_BACK_PORCH: %d," \
- " V_FRONT_PORCH: %d, V_PULSE_WIDTH: %d, V_TOTAL: %d, H_TOTAL: %d, CLK: %dKHZ, TOPOLOGY: %d",
- index, display_attributes_[index].x_pixels, display_attributes_[index].y_pixels,
- display_attributes_[index].x_dpi, display_attributes_[index].y_dpi,
- display_attributes_[index].fps, display_attributes_[index].is_device_split,
- display_attributes_[index].v_back_porch, display_attributes_[index].v_front_porch,
- display_attributes_[index].v_pulse_width, display_attributes_[index].v_total,
- display_attributes_[index].h_total, display_attributes_[index].clock_khz,
- display_attributes_[index].topology);
+ DLOGI_IF(
+ kTagDisplay,
+ "Display attributes[%d]: WxH: %dx%d, DPI: %fx%f, FPS: %d, LM_SPLIT: %d, V_BACK_PORCH: %d,"
+ " V_FRONT_PORCH: %d, V_PULSE_WIDTH: %d, V_TOTAL: %d, H_TOTAL: %d, CLK: %dKHZ, TOPOLOGY: %d",
+ index, display_attributes_[index].x_pixels, display_attributes_[index].y_pixels,
+ display_attributes_[index].x_dpi, display_attributes_[index].y_dpi,
+ display_attributes_[index].fps, display_attributes_[index].is_device_split,
+ display_attributes_[index].v_back_porch, display_attributes_[index].v_front_porch,
+ display_attributes_[index].v_pulse_width, display_attributes_[index].v_total,
+ display_attributes_[index].h_total, display_attributes_[index].clock_khz,
+ display_attributes_[index].topology);
return kErrorNone;
}
diff --git a/sdm/libs/core/strategy.cpp b/sdm/libs/core/strategy.cpp
index 5098b01..42688d9 100644
--- a/sdm/libs/core/strategy.cpp
+++ b/sdm/libs/core/strategy.cpp
@@ -80,10 +80,18 @@
return kErrorNone;
}
-DisplayError Strategy::Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts,
- const PUConstraints &pu_constraints) {
- DisplayError error = kErrorNone;
+void Strategy::GenerateROI(HWLayersInfo *hw_layers_info, const PUConstraints &pu_constraints) {
+ hw_layers_info_ = hw_layers_info;
+ if (partial_update_intf_) {
+ partial_update_intf_->Start(pu_constraints);
+ }
+
+ return GenerateROI();
+}
+
+DisplayError Strategy::Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts) {
+ DisplayError error = kErrorNone;
hw_layers_info_ = hw_layers_info;
extn_start_success_ = false;
@@ -92,11 +100,6 @@
return kErrorNotSupported;
}
- if (partial_update_intf_) {
- partial_update_intf_->Start(pu_constraints);
- }
- GenerateROI();
-
if (strategy_intf_) {
error = strategy_intf_->Start(hw_layers_info_, max_attempts);
if (error == kErrorNone) {
@@ -119,6 +122,8 @@
}
DisplayError Strategy::GetNextStrategy(StrategyConstraints *constraints) {
+ DTRACE_SCOPED();
+
if (extn_start_success_) {
return strategy_intf_->GetNextStrategy(constraints);
}
diff --git a/sdm/libs/core/strategy.h b/sdm/libs/core/strategy.h
index db10f11..a89febd 100644
--- a/sdm/libs/core/strategy.h
+++ b/sdm/libs/core/strategy.h
@@ -43,8 +43,7 @@
DisplayError Init();
DisplayError Deinit();
- DisplayError Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts,
- const PUConstraints &pu_constraints);
+ DisplayError Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts);
DisplayError GetNextStrategy(StrategyConstraints *constraints);
DisplayError Stop();
DisplayError Reconfigure(const HWPanelInfo &hw_panel_info,
@@ -56,6 +55,7 @@
DisplayError SetIdleTimeoutMs(uint32_t active_ms);
DisplayError SetColorModesInfo(const std::vector<PrimariesTransfer> &colormodes_cs);
DisplayError SetBlendSpace(const PrimariesTransfer &blend_space);
+ void GenerateROI(HWLayersInfo *hw_layers_info, const PUConstraints &pu_constraints);
private:
void GenerateROI();
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 55feeeb..daca922 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -10,6 +10,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)
LOCAL_C_INCLUDES += $(kernel_includes)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
diff --git a/sdm/libs/hwc2/hwc_callbacks.cpp b/sdm/libs/hwc2/hwc_callbacks.cpp
index b26d633..d1345ee 100644
--- a/sdm/libs/hwc2/hwc_callbacks.cpp
+++ b/sdm/libs/hwc2/hwc_callbacks.cpp
@@ -56,9 +56,6 @@
return HWC2::Error::NoResources;
}
DTRACE_SCOPED();
- if (IsVsyncSwapped() && display == vsync_from_) {
- display = vsync_to_;
- }
vsync_(vsync_data_, display, timestamp);
return HWC2::Error::None;
}
diff --git a/sdm/libs/hwc2/hwc_callbacks.h b/sdm/libs/hwc2/hwc_callbacks.h
index 6b39963..c3a760f 100644
--- a/sdm/libs/hwc2/hwc_callbacks.h
+++ b/sdm/libs/hwc2/hwc_callbacks.h
@@ -51,12 +51,10 @@
HWC2::Error Vsync(hwc2_display_t display, int64_t timestamp);
HWC2::Error Register(HWC2::Callback, hwc2_callback_data_t callback_data,
hwc2_function_pointer_t pointer);
- void SetSwapVsync(hwc2_display_t from, hwc2_display_t to) {
- vsync_from_ = from;
- vsync_to_ = to;
+ void UpdateVsyncSource(hwc2_display_t from) {
+ vsync_source_ = from;
}
- bool IsVsyncSwapped() { return (vsync_from_ != vsync_to_); }
- hwc2_display_t GetVsyncSource() { return vsync_from_; }
+ hwc2_display_t GetVsyncSource() { return vsync_source_; }
bool VsyncCallbackRegistered() { return (vsync_ != nullptr && vsync_data_ != nullptr); }
bool NeedsRefresh(hwc2_display_t display) { return pending_refresh_.test(UINT32(display)); }
@@ -70,8 +68,7 @@
HWC2_PFN_HOTPLUG hotplug_ = nullptr;
HWC2_PFN_REFRESH refresh_ = nullptr;
HWC2_PFN_VSYNC vsync_ = nullptr;
- hwc2_display_t vsync_from_ = HWC_DISPLAY_PRIMARY; // hw vsync is active on this display
- hwc2_display_t vsync_to_ = HWC_DISPLAY_PRIMARY; // vsync will be reported as this display
+ hwc2_display_t vsync_source_ = HWC_DISPLAY_PRIMARY; // hw vsync is active on this display
std::bitset<kNumDisplays> pending_refresh_; // Displays waiting to get refreshed
};
diff --git a/sdm/libs/hwc2/hwc_color_manager.cpp b/sdm/libs/hwc2/hwc_color_manager.cpp
index 4fb047f..561322d 100644
--- a/sdm/libs/hwc2/hwc_color_manager.cpp
+++ b/sdm/libs/hwc2/hwc_color_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015 - 2018, The Linux Foundation. All rights reserved.
+* 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
@@ -115,24 +115,28 @@
}
DLOGI("Successfully loaded %s", DISPLAY_API_INTERFACE_LIBRARY_NAME);
- // Load diagclient library and invokes its entry point to pass in display APIs.
- DynLib &diag_client_lib = color_mgr->diag_client_lib_;
- if (diag_client_lib.Open(QDCM_DIAG_CLIENT_LIBRARY_NAME)) {
- if (!diag_client_lib.Sym(INIT_QDCM_DIAG_CLIENT_NAME,
- reinterpret_cast<void **>(&color_mgr->qdcm_diag_init_)) ||
- !diag_client_lib.Sym(DEINIT_QDCM_DIAG_CLIENT_NAME,
- reinterpret_cast<void **>(&color_mgr->qdcm_diag_deinit_))) {
- DLOGE("Fail to retrieve = %s from %s", INIT_QDCM_DIAG_CLIENT_NAME,
- QDCM_DIAG_CLIENT_LIBRARY_NAME);
+ int enable_qdcm_diag = 0;
+ HWCDebugHandler::Get()->GetProperty(ENABLE_QDCM_DIAG, &enable_qdcm_diag);
+ if (enable_qdcm_diag) {
+ // Load diagclient library and invokes its entry point to pass in display APIs.
+ DynLib &diag_client_lib = color_mgr->diag_client_lib_;
+ if (diag_client_lib.Open(QDCM_DIAG_CLIENT_LIBRARY_NAME)) {
+ if (!diag_client_lib.Sym(INIT_QDCM_DIAG_CLIENT_NAME,
+ reinterpret_cast<void **>(&color_mgr->qdcm_diag_init_)) ||
+ !diag_client_lib.Sym(DEINIT_QDCM_DIAG_CLIENT_NAME,
+ reinterpret_cast<void **>(&color_mgr->qdcm_diag_deinit_))) {
+ DLOGE("Fail to retrieve = %s from %s", INIT_QDCM_DIAG_CLIENT_NAME,
+ QDCM_DIAG_CLIENT_LIBRARY_NAME);
+ } else {
+ // invoke Diag Client entry point to initialize.
+ color_mgr->qdcm_diag_init_(color_mgr->color_apis_);
+ DLOGI("Successfully loaded %s and %s and diag_init'ed",
+ DISPLAY_API_INTERFACE_LIBRARY_NAME, QDCM_DIAG_CLIENT_LIBRARY_NAME);
+ }
} else {
- // invoke Diag Client entry point to initialize.
- color_mgr->qdcm_diag_init_(color_mgr->color_apis_);
- DLOGI("Successfully loaded %s and %s and diag_init'ed", DISPLAY_API_INTERFACE_LIBRARY_NAME,
- QDCM_DIAG_CLIENT_LIBRARY_NAME);
+ DLOGW("Unable to load = %s", QDCM_DIAG_CLIENT_LIBRARY_NAME);
+ // only QDCM Diag client failed to be loaded and system still should function.
}
- } else {
- DLOGW("Unable to load = %s", QDCM_DIAG_CLIENT_LIBRARY_NAME);
- // only QDCM Diag client failed to be loaded and system still should function.
}
} else {
DLOGE("Unable to create HWCColorManager");
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 8a8415b..a118c32 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -796,11 +796,19 @@
layer->flags.updating = IsLayerUpdating(hwc_layer);
}
+ if ((hwc_layer->GetDeviceSelectedCompositionType() != HWC2::Composition::Device) ||
+ (hwc_layer->GetClientRequestedCompositionType() != HWC2::Composition::Device) ||
+ layer->flags.skip) {
+ layer->update_mask.set(kClientCompRequest);
+ }
+
layer_stack_.layers.push_back(layer);
}
// TODO(user): Set correctly when SDM supports geometry_changes as bitmask
layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0);
+ layer_stack_.flags.config_changed = !validated_;
+
// Append client target to the layer stack
Layer *sdm_client_target = client_target_->GetSDMLayer();
sdm_client_target->flags.updating = IsLayerUpdating(client_target_);
@@ -888,8 +896,6 @@
return HWC2::Error::BadDisplay;
}
- last_vsync_mode_ = enabled;
-
return HWC2::Error::None;
}
@@ -1179,7 +1185,7 @@
if (SetActiveDisplayConfig(config) != kErrorNone) {
return HWC2::Error::BadConfig;
}
-
+ DLOGI("Active configuration changed to: %d", config);
validated_ = false;
return HWC2::Error::None;
}
@@ -1207,10 +1213,6 @@
return current_power_mode_;
}
-HWC2::Vsync HWCDisplay::GetLastVsyncMode() {
- return last_vsync_mode_;
-}
-
DisplayError HWCDisplay::VSync(const DisplayEventVSync &vsync) {
callbacks_->Vsync(id_, vsync.timestamp);
return kErrorNone;
@@ -2284,9 +2286,10 @@
uint8_t *out_data) {
DisplayError ret = display_intf_->GetDisplayIdentificationData(out_port, out_data_size, out_data);
if (ret != kErrorNone) {
- DLOGE("GetDisplayIdentificationData failed due to SDM/Driver (err = %d, disp id = %" PRIu64
+ DLOGE("Failed due to SDM/Driver (err = %d, disp id = %" PRIu64
" %d-%d", ret, id_, sdm_id_, type_);
}
+
return HWC2::Error::None;
}
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 3756041..53eccae 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -144,7 +144,6 @@
return kErrorNotSupported;
}
virtual HWC2::PowerMode GetCurrentPowerMode();
- virtual HWC2::Vsync GetLastVsyncMode();
virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels);
virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels);
virtual int SetDisplayStatus(DisplayStatus display_status);
@@ -228,6 +227,7 @@
ColorMode GetCurrentColorMode() {
return (color_mode_ ? color_mode_->GetCurrentColorMode() : ColorMode::SRGB);
}
+ bool HasClientComposition() { return has_client_composition_; }
bool HWCClientNeedsValidate() {
return (has_client_composition_ || layer_stack_.flags.single_buffered_layer_present);
}
@@ -321,7 +321,6 @@
}
virtual HWC2::Error GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size,
uint8_t *out_data);
- virtual void SetVsyncSource(bool enable) { vsync_source_ = enable; }
protected:
static uint32_t throttling_refresh_rate_;
@@ -382,7 +381,6 @@
uint32_t dump_frame_index_ = 0;
bool dump_input_layers_ = false;
HWC2::PowerMode current_power_mode_ = HWC2::PowerMode::Off;
- HWC2::Vsync last_vsync_mode_ = HWC2::Vsync::Invalid;
bool swap_interval_zero_ = false;
bool display_paused_ = false;
uint32_t min_refresh_rate_ = 0;
@@ -408,7 +406,6 @@
bool pending_commit_ = false;
bool is_cmd_mode_ = false;
bool partial_update_enabled_ = false;
- bool vsync_source_ = false;
bool skip_commit_ = false;
std::map<uint32_t, DisplayConfigVariableInfo> variable_config_map_;
std::vector<uint32_t> hwc_config_map_;
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index db60c5e..cacbc7a 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -220,8 +220,9 @@
hwc_layer->ResetBufferFlip();
}
+ bool vsync_source = (callbacks_->GetVsyncSource() == id_);
bool skip_commit = enable_drop_refresh_ && !pending_commit_ && !buffers_latched &&
- !pending_refresh_ && !vsync_source_;
+ !pending_refresh_ && !vsync_source;
pending_refresh_ = false;
return skip_commit;
@@ -231,6 +232,12 @@
auto status = HWC2::Error::None;
DTRACE_SCOPED();
+ ATRACE_INT("PartialUpdate", partial_update_enabled_);
+ ATRACE_INT("FastPath", layer_stack_.flags.fast_path);
+ ATRACE_INT("GeometryChanged", layer_stack_.flags.geometry_changed);
+ ATRACE_INT("NumLayers", static_cast <int32_t> (layer_stack_.layers.size()));
+ ATRACE_INT("HasClientComposition", HasClientComposition());
+
if (display_paused_) {
DisplayError error = display_intf_->Flush(&layer_stack_);
validated_ = false;
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index d2456c4..68f6838 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -283,7 +283,7 @@
if (secure != layer_buffer->flags.secure || secure_camera != layer_buffer->flags.secure_camera ||
secure_display != layer_buffer->flags.secure_display) {
// Secure attribute of layer buffer has changed.
- needs_validate_ = true;
+ layer_->update_mask.set(kSecurity);
}
layer_buffer->flags.secure = secure;
@@ -316,7 +316,7 @@
}
if (!layer_->flags.updating && surface_updated_) {
- needs_validate_ = true;
+ layer_->update_mask.set(kSurfaceInvalidate);
}
if (!partial_update_enabled_) {
@@ -326,13 +326,13 @@
// Check if there is an update in SurfaceDamage rects.
if (layer_->dirty_regions.size() != damage.numRects) {
- needs_validate_ = true;
+ layer_->update_mask.set(kSurfaceInvalidate);
} else {
for (uint32_t j = 0; j < damage.numRects; j++) {
LayerRect damage_rect;
SetRect(damage.rects[j], &damage_rect);
if (damage_rect != layer_->dirty_regions.at(j)) {
- needs_validate_ = true;
+ layer_->update_mask.set(kSurfaceDamage);
break;
}
}
@@ -371,8 +371,8 @@
}
if (layer_->solid_fill_color != GetUint32Color(color)) {
layer_->solid_fill_color = GetUint32Color(color);
+ layer_->update_mask.set(kSurfaceInvalidate);
surface_updated_ = true;
- needs_validate_ = true;
} else {
surface_updated_ = false;
}
@@ -386,7 +386,7 @@
HWC2::Error HWCLayer::SetLayerCompositionType(HWC2::Composition type) {
// Validation is required when the client changes the composition type
if (client_requested_ != type) {
- needs_validate_ = true;
+ layer_->update_mask.set(kClientCompRequest);
}
client_requested_ = type;
switch (type) {
@@ -847,11 +847,11 @@
if ((layer_igc != layer_buffer->igc) || (interlace != layer_buffer->flags.interlace) ||
(frame_rate != layer->frame_rate) || (s3d_format != layer_buffer->s3d_format)) {
// Layer buffer metadata has changed.
- needs_validate_ = true;
layer_buffer->igc = layer_igc;
layer->frame_rate = frame_rate;
layer_buffer->s3d_format = s3d_format;
layer_buffer->flags.interlace = interlace;
+ layer_->update_mask.set(kMetadataUpdate);
}
// Check if metadata is set
@@ -918,7 +918,7 @@
layer_buffer->color_metadata.colorPrimaries != csc.colorPrimaries ||
layer_buffer->color_metadata.range != csc.range) {
// ColorMetadata updated. Needs validate.
- needs_validate_ = true;
+ layer_->update_mask.set(kMetadataUpdate);
// if we are here here, update the sdm layer csc.
layer_buffer->color_metadata.transfer = csc.transfer;
layer_buffer->color_metadata.colorPrimaries = csc.colorPrimaries;
@@ -939,12 +939,12 @@
if ((layer_buffer->color_metadata.colorPrimaries != old_meta_data.colorPrimaries) ||
(layer_buffer->color_metadata.transfer != old_meta_data.transfer) ||
(layer_buffer->color_metadata.range != old_meta_data.range)) {
- needs_validate_ = true;
+ layer_->update_mask.set(kMetadataUpdate);
}
if (layer_buffer->color_metadata.dynamicMetaDataValid &&
!SameConfig(layer_buffer->color_metadata.dynamicMetaDataPayload,
old_meta_data.dynamicMetaDataPayload, HDR_DYNAMIC_META_DATA_SZ)) {
- needs_validate_ = true;
+ layer_->update_mask.set(kMetadataUpdate);
}
} else {
dataspace_supported_ = false;
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index f652d6e..cef4937 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -101,8 +101,8 @@
void PushBackReleaseFence(int32_t fence);
int32_t PopBackReleaseFence(void);
int32_t PopFrontReleaseFence(void);
- void ResetValidation() { needs_validate_ = false; }
- bool NeedsValidation() { return (needs_validate_ || geometry_changes_); }
+ void ResetValidation() { layer_->update_mask.reset(); }
+ bool NeedsValidation() { return (geometry_changes_ || layer_->update_mask.any()); }
bool IsSingleBuffered() { return single_buffer_; }
bool IsScalingPresent();
bool IsRotationPresent();
@@ -127,7 +127,6 @@
int32_t dataspace_ = HAL_DATASPACE_UNKNOWN;
LayerTransform layer_transform_ = {};
LayerRect dst_rect_ = {};
- bool needs_validate_ = true;
bool single_buffer_ = false;
int buffer_fd_ = -1;
bool dataspace_supported_ = false;
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 3e161c8..83afed5 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -167,7 +167,6 @@
return status;
}
- InitDisplaySlots();
#if defined(DISPLAY_CONFIG_1_2) && defined(CONFIG_BASEID_FROM_PROP)
char indices[kPropertyMax];
@@ -209,51 +208,12 @@
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_);
- DisplayError error = kErrorNone;
- HWDisplayInterfaceInfo hw_disp_info = {};
- if (null_display_mode_) {
- hw_disp_info.type = kPrimary;
- hw_disp_info.is_connected = true;
- } else {
- error = CoreInterface::CreateCore(&buffer_allocator_, &buffer_sync_handler_, &socket_handler_,
- &core_intf_);
- if (error != kErrorNone) {
- DLOGE("Failed to create CoreInterface");
- return -EOWNERDEAD;
- }
-
- error = core_intf_->GetFirstDisplayInterfaceType(&hw_disp_info);
- if (error != kErrorNone) {
- CoreInterface::DestroyCore();
- DLOGE("Primary display type not recognized. Error = %d", error);
- return -EINVAL;
- }
-
- error = core_intf_->GetMaxDisplaysSupported(kPluggable, &max_sde_pluggable_displays_);
- if (kErrorNone == error) {
- if (max_sde_pluggable_displays_ && (kPluggable == hw_disp_info.type)) {
- // If primary is a pluggable display, we have already used one pluggable display interface.
- max_sde_pluggable_displays_--;
- }
- } else {
- DLOGE("Could not find maximum pluggable displays supported. Error = %d", error);
- }
-
- error = core_intf_->GetMaxDisplaysSupported(kBuiltIn, &max_sde_builtin_displays_);
- if (kErrorNone == error) {
- if (max_sde_builtin_displays_ && (kBuiltIn == hw_disp_info.type)) {
- // If primary is not a pluggable display, we have already used one built-in display
- // interface.
- max_sde_builtin_displays_--;
- }
- } else {
- DLOGE("Could not find maximum built-in displays supported. Error = %d", error);
- }
-
+ if (!null_display_mode_) {
g_hwc_uevent_.Register(this);
}
+ 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.
status = CreatePrimaryDisplay();
@@ -299,33 +259,87 @@
return 0;
}
-void HWCSession::InitDisplaySlots() {
+void HWCSession::InitSupportedDisplaySlots() {
// Default slots:
- // Primary = 0, External = 1, Virtual = 2 (legacy IDs)
- // Additional builtin displays 3, 4 ... x
- // Additional external displays x+1, x+2 ... y
- // Additional virtual displays y+1, y+2 ... z
- // If client does not support additional displays, hotplug for such displays
- // will be disregarded by the client.
- // If client supports different range of ids for additional displays, those
- // will be set and overridden by an explicit call to set display indexes.
- hwc2_display_t additional_base_id = qdutils::DISPLAY_VIRTUAL + 1;
+ // Primary = 0, External = 1
+ // Additional external displays 2,3,...max_pluggable_count.
+ // Additional builtin displays max_pluggable_count + 1, max_pluggable_count + 2,...
+ // Last slots for virtual displays.
+ // Virtual display id is only for SF <--> HWC communication.
+ // It need not align with hwccomposer_defs
map_info_primary_.client_id = qdutils::DISPLAY_PRIMARY;
- map_info_builtin_.resize(HWCCallbacks::kNumBuiltIn);
- for (size_t i = 0; i < HWCCallbacks::kNumBuiltIn; i++) {
- map_info_builtin_[i].client_id = additional_base_id++;
+ if (null_display_mode_) {
+ // Skip display slot initialization.
+ return;
}
- map_info_pluggable_.resize(HWCCallbacks::kNumPluggable);
- for (size_t i = 0; i < HWCCallbacks::kNumPluggable; i++) {
- map_info_pluggable_[i].client_id = i ? additional_base_id++ : qdutils::DISPLAY_EXTERNAL;
+ DisplayError error = CoreInterface::CreateCore(&buffer_allocator_, &buffer_sync_handler_,
+ &socket_handler_, &core_intf_);
+ if (error != kErrorNone) {
+ DLOGE("Failed to create CoreInterface");
+ return;
}
- map_info_virtual_.resize(HWCCallbacks::kNumVirtual);
- for (size_t i = 0; i < HWCCallbacks::kNumVirtual; i++) {
- map_info_virtual_[i].client_id = i ? additional_base_id++ : qdutils::DISPLAY_VIRTUAL;
+ HWDisplayInterfaceInfo hw_disp_info = {};
+ error = core_intf_->GetFirstDisplayInterfaceType(&hw_disp_info);
+ if (error != kErrorNone) {
+ CoreInterface::DestroyCore();
+ DLOGE("Primary display type not recognized. Error = %d", error);
+ return;
+ }
+
+ int max_builtin = 0;
+ int max_pluggable = 0;
+ int max_virtual = 0;
+
+ error = core_intf_->GetMaxDisplaysSupported(kBuiltIn, &max_builtin);
+ if (error != kErrorNone) {
+ CoreInterface::DestroyCore();
+ DLOGE("Could not find maximum built-in displays supported. Error = %d", error);
+ return;
+ }
+
+ error = core_intf_->GetMaxDisplaysSupported(kPluggable, &max_pluggable);
+ if (error != kErrorNone) {
+ CoreInterface::DestroyCore();
+ DLOGE("Could not find maximum pluggable displays supported. Error = %d", error);
+ return;
+ }
+
+ error = core_intf_->GetMaxDisplaysSupported(kVirtual, &max_virtual);
+ if (error != kErrorNone) {
+ CoreInterface::DestroyCore();
+ DLOGE("Could not find maximum virtual displays supported. Error = %d", error);
+ return;
+ }
+
+ if (kPluggable == hw_disp_info.type) {
+ // If primary is a pluggable display, we have already used one pluggable display interface.
+ max_pluggable--;
+ } else {
+ max_builtin--;
+ }
+
+ // Init slots in accordance to h/w capability.
+ uint32_t disp_count = UINT32(std::min(max_pluggable, HWCCallbacks::kNumPluggable));
+ hwc2_display_t base_id = qdutils::DISPLAY_EXTERNAL;
+ map_info_pluggable_.resize(disp_count);
+ for (auto &map_info : map_info_pluggable_) {
+ map_info.client_id = base_id++;
+ }
+
+ disp_count = UINT32(std::min(max_builtin, HWCCallbacks::kNumBuiltIn));
+ map_info_builtin_.resize(disp_count);
+ for (auto &map_info : map_info_builtin_) {
+ map_info.client_id = base_id++;
+ }
+
+ disp_count = UINT32(std::min(max_virtual, HWCCallbacks::kNumVirtual));
+ map_info_virtual_.resize(disp_count);
+ for (auto &map_info : map_info_virtual_) {
+ map_info.client_id = base_id++;
}
}
@@ -527,7 +541,7 @@
return HWC2_ERROR_BAD_PARAMETER;
}
- return null_display_mode_ ? 0 : 1;
+ return 1;
}
static int32_t GetActiveConfig(hwc2_device_t *device, hwc2_display_t display,
@@ -996,7 +1010,6 @@
hwc_session->idle_pc_ref_cnt_ = 0;
}
- hwc_session->UpdateVsyncSource();
hwc_session->UpdateThrottlingRate();
// Trigger refresh for doze mode to take effect.
@@ -1015,15 +1028,14 @@
if (int_enabled < HWC2_VSYNC_INVALID || int_enabled > HWC2_VSYNC_DISABLE) {
return HWC2_ERROR_BAD_PARAMETER;
}
- // already mapping taken care by HAL and SF. No need to react for other display.
- if (display != HWC_DISPLAY_PRIMARY) {
- return HWC2_ERROR_NONE;
- }
auto enabled = static_cast<HWC2::Vsync>(int_enabled);
HWCSession *hwc_session = static_cast<HWCSession *>(device);
- display = hwc_session->callbacks_.GetVsyncSource();
+
+ if (int_enabled == HWC2_VSYNC_ENABLE) {
+ hwc_session->callbacks_.UpdateVsyncSource(display);
+ }
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::SetVsyncEnabled, enabled);
}
@@ -1035,14 +1047,15 @@
}
HWCSession *hwc_session = static_cast<HWCSession *>(device);
- if (display >= HWCCallbacks::kNumDisplays || (hwc_session->hwc_display_[display] == nullptr)) {
- DLOGE("Invalid Display %d Handle %s ", display, hwc_session->hwc_display_[display] ?
+ HWCDisplay *hwc_display = hwc_session->hwc_display_[display];;
+ if (display >= HWCCallbacks::kNumDisplays || (hwc_display == nullptr)) {
+ DLOGE("Invalid Display %d Handle %s ", display, hwc_display ?
"Valid" : "NULL");
return HWC2_ERROR_BAD_DISPLAY;
}
*out_support = 0;
- if (hwc_session->GetDisplayClass(display) == DISPLAY_CLASS_BUILTIN) {
+ if (hwc_display->GetDisplayClass() == DISPLAY_CLASS_BUILTIN) {
*out_support = 1;
}
@@ -1203,23 +1216,11 @@
HWC2::Error HWCSession::CreateVirtualDisplayObj(uint32_t width, uint32_t height, int32_t *format,
hwc2_display_t *out_display_id) {
- if (null_display_mode_) {
- DLOGW("Virtual display creation attempted. Not supported in null-display mode."
- " display_id is not set, and no real display object was created");
- return HWC2::Error::None;
- }
-
if (!client_connected_) {
DLOGE("Client is not ready yet.");
return HWC2::Error::BadDisplay;
}
- // Use first virtual display only for now.
- if (!map_info_virtual_.size()) {
- DLOGE("Virtual display is not supported");
- return HWC2::Error::NoResources;
- }
-
hwc2_display_t active_builtin_disp_id = GetActiveBuiltinDisplay();
if (active_builtin_disp_id < HWCCallbacks::kNumDisplays) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_[active_builtin_disp_id]);
@@ -1236,6 +1237,13 @@
}
}
+ if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
+ DisplayError error = hwc_display_[HWC_DISPLAY_PRIMARY]->TeardownConcurrentWriteback();
+ if (error) {
+ return HWC2::Error::NoResources;
+ }
+ }
+
HWDisplaysInfo hw_displays_info = {};
DisplayError error = core_intf_->GetDisplaysStatus(&hw_displays_info);
if (error != kErrorNone) {
@@ -1243,47 +1251,37 @@
return HWC2::Error::BadDisplay;
}
- auto &map_info = map_info_virtual_[0];
- hwc2_display_t client_id = map_info.client_id;
-
// Lock confined to this scope
int status = -EINVAL;
- {
- SCOPE_LOCK(locker_[client_id]);
- auto &hwc_display = hwc_display_[client_id];
- if (hwc_display) {
- DLOGE("Virtual display is already created.");
- return HWC2::Error::NoResources;
+ for (auto &iter : hw_displays_info) {
+ auto &info = iter.second;
+ if (info.display_type != kVirtual) {
+ continue;
}
- for (auto &iter : hw_displays_info) {
- auto &info = iter.second;
- if (info.display_type != kVirtual) {
- continue;
- }
+ for (auto &map_info : map_info_virtual_) {
+ hwc2_display_t client_id = map_info.client_id;
+ {
+ SCOPE_LOCK(locker_[client_id]);
+ auto &hwc_display = hwc_display_[client_id];
+ if (hwc_display) {
+ continue;
+ }
- if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
- error = hwc_display_[HWC_DISPLAY_PRIMARY]->TeardownConcurrentWriteback();
- if (error) {
- return HWC2::Error::NoResources;
- }
- }
+ status = HWCDisplayVirtual::Create(core_intf_, &buffer_allocator_, &callbacks_, client_id,
+ info.display_id, width, height, format, &hwc_display);
+ // TODO(user): validate width and height support
+ if (status) {
+ return HWC2::Error::NoResources;
+ }
- status = HWCDisplayVirtual::Create(core_intf_, &buffer_allocator_, &callbacks_, client_id,
- info.display_id, width, height, format, &hwc_display);
- // TODO(user): validate width and height support
- if (!status) {
DLOGI("Created virtual display id:% " PRIu64 " with res: %dx%d", client_id, width, height);
*out_display_id = client_id;
map_info.disp_type = info.display_type;
map_info.sdm_id = info.display_id;
+ break;
}
- break;
- }
-
- if (status) {
- return HWC2::Error::NoResources;
}
}
@@ -1295,18 +1293,6 @@
return HWC2::Error::None;
}
-DisplayClass HWCSession::GetDisplayClass(hwc2_display_t display) {
- if (display >= HWCCallbacks::kNumDisplays) {
- DLOGE("display = %d beyond max supported display slots = %d",
- display, HWCCallbacks::kNumDisplays);
- return DISPLAY_CLASS_NULL;
- } else if (!hwc_display_[display]) {
- DLOGE("display = %d slot empty.", display);
- return DISPLAY_CLASS_NULL;
- }
- return hwc_display_[display]->GetDisplayClass();
-}
-
bool HWCSession::IsPluggableDisplayConnected() {
for (auto &map_info : map_info_pluggable_) {
if (hwc_display_[map_info.client_id]) {
@@ -2441,8 +2427,6 @@
if (!color_mgr_) {
DLOGW("Failed to load HWCColorManager.");
}
- // This display is the source of vsync events.
- (*hwc_display)->SetVsyncSource(true);
} else {
DLOGE("Primary display creation failed.");
}
@@ -2476,41 +2460,33 @@
continue;
}
- if (registered_builtin_displays_ >= max_sde_builtin_displays_) {
- DLOGI("Maximum supported built-in displays (= %d) created.", max_sde_builtin_displays_);
- break;
- }
+ for (auto &map_info : map_info_builtin_) {
+ hwc2_display_t client_id = map_info.client_id;
- if (registered_builtin_displays_ >= INT32(map_info_builtin_.size())) {
- DLOGW("Insufficient builtin display slots. All displays could not be created.");
- return 0;
- }
+ {
+ SCOPE_LOCK(locker_[client_id]);
+ // Lock confined to this scope
+ if (hwc_display_[client_id]) {
+ continue;
+ }
- DisplayMapInfo &map_info = map_info_builtin_[UINT32(registered_builtin_displays_)];
- hwc2_display_t client_id = map_info.client_id;
-
- // Lock confined to this scope
- {
- SCOPE_LOCK(locker_[client_id]);
-
- DLOGI("Create builtin display, sdm id = %d, client id = %d", info.display_id, client_id);
- status = HWCDisplayBuiltIn::Create(core_intf_, &buffer_allocator_, &callbacks_, this,
- qservice_, client_id, info.display_id,
- &hwc_display_[client_id]);
- if (!status) {
+ DLOGI("Create builtin display, sdm id = %d, client id = %d", info.display_id, client_id);
+ status = HWCDisplayBuiltIn::Create(core_intf_, &buffer_allocator_, &callbacks_, this,
+ qservice_, client_id, info.display_id,
+ &hwc_display_[client_id]);
+ if (status) {
+ DLOGE("Builtin display creation failed.");
+ break;
+ }
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;
- registered_builtin_displays_++;
- } else {
- DLOGE("Builtin display creation failed.");
- // Attempt creating remaining builtin displays.
- continue;
}
- }
- DLOGI("Hotplugging builtin display, sdm id = %d, client id = %d", info.display_id, client_id);
- callbacks_.Hotplug(client_id, HWC2::Connection::Connected);
+ DLOGI("Hotplugging builtin display, sdm id = %d, client id = %d", info.display_id, client_id);
+ callbacks_.Hotplug(client_id, HWC2::Connection::Connected);
+ break;
+ }
}
return status;
@@ -2585,13 +2561,11 @@
}
// Count active pluggable display slots and slots with no commits.
- int32_t display_slots_used = 0;
bool first_commit_pending = false;
std::for_each(map_info_pluggable_.begin(), map_info_pluggable_.end(),
[&](auto &p) {
SCOPE_LOCK(locker_[p.client_id]);
if (hwc_display_[p.client_id]) {
- display_slots_used++;
if (!hwc_display_[p.client_id]->IsFirstCommitDone()) {
DLOGI("Display commit pending on display %d-1", p.sdm_id);
first_commit_pending = true;
@@ -2599,11 +2573,6 @@
}
});
- if (display_slots_used >= max_sde_pluggable_displays_) {
- DLOGW("Pluggable display instance limit reached. %d pluggable displays connected.",
- display_slots_used);
- break;
- }
if (!disable_hotplug_bwcheck_ && first_commit_pending) {
// Hotplug bandwidth check is accomplished by creating and hotplugging a new display after
// a display commit has happened on previous hotplugged displays. This allows the driver to
@@ -2699,7 +2668,6 @@
for (auto client_id : pending_hotplugs) {
DLOGI("Notify hotplug display connected: client id = %d", client_id);
callbacks_.Hotplug(client_id, HWC2::Connection::Connected);
- UpdateVsyncSource();
}
return status;
@@ -2770,7 +2738,6 @@
hwc_display = nullptr;
map_info->Reset();
- UpdateVsyncSource();
}
}
@@ -2787,9 +2754,6 @@
switch (map_info->disp_type) {
case kBuiltIn:
HWCDisplayBuiltIn::Destroy(hwc_display);
- if (registered_builtin_displays_) {
- registered_builtin_displays_--;
- }
break;
default:
HWCDisplayVirtual::Destroy(hwc_display);
@@ -2845,10 +2809,6 @@
}
void HWCSession::DisplayPowerReset() {
- hwc2_display_t active_builtin_disp_id = GetActiveBuiltinDisplay();
- if (active_builtin_disp_id >= HWCCallbacks::kNumDisplays) {
- active_builtin_disp_id = HWC_DISPLAY_PRIMARY;
- }
// Acquire lock on all displays.
for (hwc2_display_t display = HWC_DISPLAY_PRIMARY;
display < HWCCallbacks::kNumDisplays; display++) {
@@ -2887,10 +2847,10 @@
}
}
- status = hwc_display_[active_builtin_disp_id]->SetVsyncEnabled(HWC2::Vsync::Enable);
+ hwc2_display_t vsync_source = callbacks_.GetVsyncSource();
+ status = hwc_display_[vsync_source]->SetVsyncEnabled(HWC2::Vsync::Enable);
if (status != HWC2::Error::None) {
- DLOGE("Enabling vsync failed for built-in %" PRIu64 " with error = %d", active_builtin_disp_id,
- status);
+ DLOGE("Enabling vsync failed for disp: %" PRIu64 " with error = %d", vsync_source, status);
}
// Release lock on all displays.
@@ -2898,7 +2858,8 @@
display < HWCCallbacks::kNumDisplays; display++) {
locker_[display].Unlock();
}
- Refresh(active_builtin_disp_id);
+
+ Refresh(vsync_source);
}
void HWCSession::HandleSecureSession() {
@@ -3055,8 +3016,17 @@
}
HWCSession *hwc_session = static_cast<HWCSession *>(device);
- if (hwc_session->hwc_display_[HWC_DISPLAY_EXTERNAL] ||
- hwc_session->hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ hwc2_display_t external_display_index =
+ (hwc2_display_t)hwc_session->GetDisplayIndex(qdutils::DISPLAY_EXTERNAL);
+ hwc2_display_t virtual_display_index =
+ (hwc2_display_t)hwc_session->GetDisplayIndex(qdutils::DISPLAY_VIRTUAL);
+
+ if ((external_display_index == -1) || (virtual_display_index == -1)) {
+ return HWC2_ERROR_UNSUPPORTED;
+ }
+
+ if (hwc_session->hwc_display_[external_display_index] ||
+ hwc_session->hwc_display_[virtual_display_index]) {
return HWC2_ERROR_UNSUPPORTED;
}
@@ -3114,67 +3084,6 @@
return CallDisplayFunction(device, HWC_DISPLAY_PRIMARY, &HWCDisplay::SetQSyncMode, qsync_mode);
}
-void HWCSession::UpdateVsyncSource() {
- hwc2_display_t active_source = callbacks_.GetVsyncSource();
- hwc2_display_t next_vsync_source = GetNextVsyncSource();
- if (active_source == next_vsync_source) {
- return;
- }
-
- callbacks_.SetSwapVsync(next_vsync_source, HWC_DISPLAY_PRIMARY);
- hwc_display_[next_vsync_source]->SetVsyncSource(true);
- if (hwc_display_[active_source]) {
- hwc_display_[active_source]->SetVsyncSource(false);
- }
-
- HWC2::PowerMode power_mode = hwc_display_[next_vsync_source]->GetCurrentPowerMode();
- // Skip enabling vsync if display is Off, happens only for default source ie; primary.
- if (power_mode == HWC2::PowerMode::Off) {
- return;
- }
-
- HWC2::Vsync vsync_mode = hwc_display_[active_source] ?
- hwc_display_[active_source]->GetLastVsyncMode() : HWC2::Vsync::Enable;
- hwc_display_[next_vsync_source]->SetVsyncEnabled(vsync_mode);
- // Disable Vsync on previous display.
- if (hwc_display_[active_source]) {
- hwc_display_[active_source]->SetVsyncEnabled(HWC2::Vsync::Disable);
- }
-
- DLOGI("active_source %d next_vsync_source %d", active_source, next_vsync_source);
-}
-
-hwc2_display_t HWCSession::GetNextVsyncSource() {
- // If primary display is powered off, change vsync source to next builtin display.
- // If primary display is powerd on, change vsync source back to primary display.
- // First check for active builtins. If not found switch to pluggable displays.
-
- 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 &info : map_info) {
- auto &hwc_display = hwc_display_[info.client_id];
- if (!hwc_display) {
- continue;
- }
-
- HWC2::PowerMode current_mode = hwc_display->GetCurrentPowerMode();
- if (update_vsync_on_doze_) {
- if (current_mode == HWC2::PowerMode::On) {
- return info.client_id;
- }
- } else if (update_vsync_on_power_off_) {
- if (current_mode != HWC2::PowerMode::Off) {
- return info.client_id;
- }
- }
- }
-
- // No Vsync source found. Default to main display.
- return HWC_DISPLAY_PRIMARY;
-}
-
void HWCSession::UpdateThrottlingRate() {
uint32_t new_min = 0;
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index 28e4cf1..c82cc12 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -258,7 +258,7 @@
// Uevent handler
virtual void UEventHandler(const char *uevent_data, int length);
void ResetPanel();
- void InitDisplaySlots();
+ void InitSupportedDisplaySlots();
int GetDisplayIndex(int dpy);
int CreatePrimaryDisplay();
int HandleBuiltInDisplays();
@@ -390,9 +390,6 @@
void HandleSecureSession();
void HandlePowerOnPending(hwc2_display_t display, int retire_fence);
void HandleHotplugPending(hwc2_display_t disp_id, int retire_fence);
- void UpdateVsyncSource();
- hwc2_display_t GetNextVsyncSource();
- DisplayClass GetDisplayClass(hwc2_display_t display_id);
bool IsPluggableDisplayConnected();
hwc2_display_t GetActiveBuiltinDisplay();
void HandlePendingRefresh();
@@ -407,8 +404,6 @@
std::vector<DisplayMapInfo> map_info_builtin_; // Builtin displays excluding primary
std::vector<DisplayMapInfo> map_info_pluggable_; // Pluggable displays excluding primary
std::vector<DisplayMapInfo> map_info_virtual_; // Virtual displays
- bool update_vsync_on_power_off_ = false;
- bool update_vsync_on_doze_ = false;
bool reset_panel_ = false;
bool client_connected_ = false;
bool new_bw_mode_ = false;
@@ -427,9 +422,6 @@
Locker pluggable_handler_lock_;
bool destroy_virtual_disp_pending_ = false;
uint32_t idle_pc_ref_cnt_ = 0;
- int32_t max_sde_pluggable_displays_ = 0;
- int32_t max_sde_builtin_displays_ = 0;
- int32_t registered_builtin_displays_ = 0;
int32_t disable_hotplug_bwcheck_ = 0;
int32_t disable_mask_layer_hint_ = 0;
std::bitset<HWCCallbacks::kNumDisplays> pending_refresh_;
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index d61c477..a1eec83 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -564,62 +564,9 @@
#endif
#ifdef DISPLAY_CONFIG_1_2
-static const char * GetDisplayTypeName(IDisplayConfig::DisplayTypeExt disp_type) {
- switch (disp_type) {
- case IDisplayConfig::DisplayTypeExt::DISPLAY_BUILTIN: return "Built-in";
- case IDisplayConfig::DisplayTypeExt::DISPLAY_PLUGGABLE: return "Pluggable";
- case IDisplayConfig::DisplayTypeExt::DISPLAY_VIRTUAL: return "Virtual";
- case IDisplayConfig::DisplayTypeExt::DISPLAY_PRIMARY: return "Primary";
- default: return "Unknown";
- }
-}
-
Return<int32_t> HWCSession::setDisplayIndex(IDisplayConfig::DisplayTypeExt disp_type,
uint32_t base, uint32_t count) {
- if (client_connected_) {
- DLOGW("Not supported after client connection is completed.");
- return -1;
- }
-
- DLOGI("%s display: base = %d, count = %d", GetDisplayTypeName(disp_type), base, count);
-
- // Is display slots capacity smaller than what client can support?
- if ((base + count) > HWCCallbacks::kNumDisplays) {
- DLOGE("Exceeds max supported display slots = %d", HWCCallbacks::kNumDisplays);
- return -1;
- }
-
- std::vector<DisplayMapInfo> *map_info_v = nullptr;
- switch (disp_type) {
- case IDisplayConfig::DisplayTypeExt::DISPLAY_BUILTIN:
- map_info_v = &map_info_builtin_;
- break;
- case IDisplayConfig::DisplayTypeExt::DISPLAY_PLUGGABLE:
- map_info_v = &map_info_pluggable_;
- break;
- case IDisplayConfig::DisplayTypeExt::DISPLAY_VIRTUAL:
- map_info_v = &map_info_virtual_;
- break;
- case IDisplayConfig::DisplayTypeExt::DISPLAY_PRIMARY:
- // nothing to do
- return 0;
- default:
- return -1;
- }
-
- // Reset default client id for each display with a new client id in given range.
- // Remove remaining elements as client as client can not handle these displays.
- DLOGI("Change %s display capacity to %d", GetDisplayTypeName(disp_type), count);
- map_info_v->resize(count);
-
- uint32_t idx = 0;
- for (auto &map_info : *map_info_v) {
- map_info.client_id = base++;
- DLOGI("Override: %s display: Index = %d, Client ID = %d",
- GetDisplayTypeName(disp_type), idx++, map_info.client_id);
- }
-
- return 0;
+ return -1;
}
#endif // DISPLAY_CONFIG_1_2
@@ -710,14 +657,10 @@
#ifdef DISPLAY_CONFIG_1_6
Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeOff() {
- update_vsync_on_power_off_ = true;
-
return 0;
}
Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeDoze() {
- update_vsync_on_doze_ = true;
-
return 0;
}
#endif