drm_hwcomposer: Check for same resolution when clearing buffers

The Client could request setActiveConfig to a config with the same
resolution and different refresh rate, even if the target config is in a
different config group. Clearing the cached buffers in this case may
result in an unnecessary blank screen.

Change-Id: I46bb09490a935c592b9aab4b9fd23ef3c1bc05f5
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index ed89df9..dbcf575 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -1220,11 +1220,14 @@
                                  next_config != nullptr &&
                                  current_config->group_id ==
                                      next_config->group_id;
+  const bool same_resolution = current_config != nullptr &&
+                               next_config != nullptr &&
+                               current_config->mode.SameSize(next_config->mode);
 
   /* Client framebuffer management:
    * https://source.android.com/docs/core/graphics/framebuffer-mgmt
    */
-  if (!same_config_group && !future_config) {
+  if (!same_resolution && !future_config) {
     auto& client_layer = display->GetClientLayer();
     auto hwc3_layer = GetHwc3Layer(client_layer);
     hwc3_layer->ClearSlots();