sdm: Add support to query Smart Panel attribute
Add support to query Smart Panel attribute of given Display Config,
with the Display Config HIDL API call from SurfaceFlinger to HWC.
SF requires this attribute to populate the list of allowed Refresh
Rate configs to switch Refresh rate among the published Command and
Video mode display configs.
CRs-Fixed: 2535403
Change-Id: I09609ce9aa1987047f9cbe1c3db6392508c59967
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index 458ff18..8341f52 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -204,10 +204,11 @@
float x_dpi = 0.0f; //!< Dots per inch in X-direction.
float y_dpi = 0.0f; //!< Dots per inch in Y-direction.
bool is_yuv = false; //!< If the display output is in YUV format.
+ bool smart_panel = false; //!< If the display config has smart panel.
bool operator==(const DisplayConfigGroupInfo& info) const {
return ((x_pixels == info.x_pixels) && (y_pixels == info.y_pixels) && (x_dpi == info.x_dpi) &&
- (y_dpi == info.y_dpi) && (is_yuv == info.is_yuv));
+ (y_dpi == info.y_dpi) && (is_yuv == info.is_yuv) && (smart_panel == info.smart_panel));
}
};
@@ -218,7 +219,7 @@
bool operator==(const DisplayConfigVariableInfo& info) const {
return ((x_pixels == info.x_pixels) && (y_pixels == info.y_pixels) && (x_dpi == info.x_dpi) &&
(y_dpi == info.y_dpi) && (fps == info.fps) && (vsync_period_ns == info.vsync_period_ns)
- && (is_yuv == info.is_yuv));
+ && (is_yuv == info.is_yuv) && (smart_panel == info.smart_panel));
}
};
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 37250c3..a21f0f6 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -595,6 +595,9 @@
mm_width = connector_info_.mmWidth;
mm_height = connector_info_.mmHeight;
topology = connector_info_.modes[index].topology;
+ if (mode.flags & DRM_MODE_FLAG_CMD_MODE_PANEL) {
+ display_attributes_[index].smart_panel = true;
+ }
}
display_attributes_[index].x_pixels = mode.hdisplay;
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index d89deec..c1d464a 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -200,6 +200,10 @@
return HWC2::Error::Unsupported;
}
+ virtual bool IsSmartPanelConfig(uint32_t config_id) {
+ return false;
+ }
+
// Display Configurations
static uint32_t GetThrottlingRefreshRate() { return HWCDisplay::throttling_refresh_rate_; }
static void SetThrottlingRefreshRate(uint32_t newRefreshRate)
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index aa65ba7..d440893 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -1001,4 +1001,14 @@
return HWC2::Error::None;
}
+
+bool HWCDisplayBuiltIn::IsSmartPanelConfig(uint32_t config_id) {
+ if (config_id < hwc_config_map_.size()) {
+ uint32_t index = hwc_config_map_.at(config_id);
+ return variable_config_map_.at(index).smart_panel;
+ }
+
+ return false;
+}
+
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display_builtin.h b/sdm/libs/hwc2/hwc_display_builtin.h
index 1ec970a..8f812db 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.h
+++ b/sdm/libs/hwc2/hwc_display_builtin.h
@@ -99,6 +99,7 @@
}
virtual HWC2::Error UpdatePowerMode(HWC2::PowerMode mode);
virtual HWC2::Error PostCommitLayerStack(int32_t *out_retire_fence);
+ virtual bool IsSmartPanelConfig(uint32_t config_id);
private:
HWCDisplayBuiltIn(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index af5c3d2..50b79bc 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -351,6 +351,7 @@
bool HasHDRSupport(HWCDisplay *hwc_display);
int32_t getDisplayBrightness(uint32_t display, float *brightness);
int32_t setDisplayBrightness(uint32_t display, float brightness);
+ bool isSmartPanelConfig(uint32_t disp_id, uint32_t config_id);
// service methods
void StartServices();
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index 99cfd45..a46c13b 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -870,6 +870,20 @@
return -1;
}
+bool HWCSession::isSmartPanelConfig(uint32_t disp_id, uint32_t config_id) {
+ if (disp_id != qdutils::DISPLAY_PRIMARY) {
+ return false;
+ }
+
+ SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
+ DLOGE("Display %d is not created yet.", disp_id);
+ return false;
+ }
+
+ return hwc_display_[disp_id]->IsSmartPanelConfig(config_id);
+}
+
int HWCSession::DisplayConfigImpl::SetQsyncMode(uint32_t disp_id, DisplayConfig::QsyncMode mode) {
SEQUENCE_WAIT_SCOPE_LOCK(hwc_session_->locker_[disp_id]);
if (!hwc_session_->hwc_display_[disp_id]) {