hwc2: Add support for optional user preferences
Add support for optional user preferences of output buffer format and
post-processed flag, in the HWC binder command to dump frame output.
CRs-Fixed: 2254012
Change-Id: I33298fab5122c1fa8e687b72dfa429e287261afb
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index f841dbc..c502c0e 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -569,8 +569,9 @@
}
}
-HWC2::Error HWCDisplayBuiltIn::SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type) {
- HWCDisplay::SetFrameDumpConfig(count, bit_mask_layer_type);
+HWC2::Error HWCDisplayBuiltIn::SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type,
+ int32_t format, bool post_processed) {
+ HWCDisplay::SetFrameDumpConfig(count, bit_mask_layer_type, format, post_processed);
dump_output_to_file_ = bit_mask_layer_type & (1 << OUTPUT_LAYER_DUMP);
DLOGI("output_layer_dump_enable %d", dump_output_to_file_);
@@ -580,10 +581,18 @@
// Allocate and map output buffer
output_buffer_info_ = {};
- // Since we dump DSPP output use Panel resolution.
- GetPanelResolution(&output_buffer_info_.buffer_config.width,
- &output_buffer_info_.buffer_config.height);
- output_buffer_info_.buffer_config.format = kFormatRGB888;
+
+ if (post_processed) {
+ // To dump post-processed (DSPP) output, use Panel resolution.
+ GetPanelResolution(&output_buffer_info_.buffer_config.width,
+ &output_buffer_info_.buffer_config.height);
+ } else {
+ // To dump Layer Mixer output, use FrameBuffer resolution.
+ GetFrameBufferResolution(&output_buffer_info_.buffer_config.width,
+ &output_buffer_info_.buffer_config.height);
+ }
+
+ output_buffer_info_.buffer_config.format = HWCLayer::GetSDMFormat(format, 0);
output_buffer_info_.buffer_config.buffer_count = 1;
if (buffer_allocator_->AllocateBuffer(&output_buffer_info_) != 0) {
DLOGE("Buffer allocation failed");
@@ -603,7 +612,7 @@
output_buffer_base_ = buffer;
const native_handle_t *handle = static_cast<native_handle_t *>(output_buffer_info_.private_data);
- SetReadbackBuffer(handle, -1, true);
+ SetReadbackBuffer(handle, -1, post_processed);
return HWC2::Error::None;
}