composer: Fix handling of SetClientTarget for built-in displays
Set the framebuffer resolution for built-in displays only when
there is a change in either width or height parameters.
Change-Id: Ib3e19e5a1f0f9d759ac42d6ac59e52e4d1d2b011
CRs-Fixed: 2542762
diff --git a/composer/hwc_display_builtin.cpp b/composer/hwc_display_builtin.cpp
index e6f33ba..3d1920f 100644
--- a/composer/hwc_display_builtin.cpp
+++ b/composer/hwc_display_builtin.cpp
@@ -965,8 +965,17 @@
}
Layer *sdm_layer = client_target_->GetSDMLayer();
- SetFrameBufferResolution(sdm_layer->input_buffer.unaligned_width,
- sdm_layer->input_buffer.unaligned_height);
+ uint32_t fb_width = 0, fb_height = 0;
+
+ GetFrameBufferResolution(&fb_width, &fb_height);
+
+ if (fb_width != sdm_layer->input_buffer.unaligned_width ||
+ fb_height != sdm_layer->input_buffer.unaligned_height) {
+ if (SetFrameBufferConfig(sdm_layer->input_buffer.unaligned_width,
+ sdm_layer->input_buffer.unaligned_height)) {
+ return HWC2::Error::BadParameter;
+ }
+ }
return HWC2::Error::None;
}