Merge 0271593fcc6bf3980ebe0654a89ebede3f340737 on remote branch

Change-Id: I0f297b6ce0f5846218cee94fa7434991aa9fd64c
diff --git a/composer/hwc_display.cpp b/composer/hwc_display.cpp
index b992a04..226df67 100755
--- a/composer/hwc_display.cpp
+++ b/composer/hwc_display.cpp
@@ -1610,8 +1610,8 @@
   layer_stack_.client_incompatible = false;
 
   validate_done_ = true;
-
-  return ((*out_num_types > 0) ? HWC2::Error::HasChanges : HWC2::Error::None);
+  return (((*out_num_types > 0) || (has_client_composition_ && *out_num_requests > 0))
+          ? HWC2::Error::HasChanges : HWC2::Error::None);
 }
 
 HWC2::Error HWCDisplay::AcceptDisplayChanges() {
@@ -3090,7 +3090,7 @@
       }
       break;
     case kTUITransitionStart:
-      if (secure_event_ != kSecureEventMax) {
+      if (secure_event_ != kTUITransitionPrepare) {
         DLOGE("Invalid TUI transition from %d to %d", secure_event_, secure_event);
         return kErrorParameters;
       }
@@ -3108,11 +3108,17 @@
   return kErrorNone;
 }
 
-DisplayError HWCDisplay::HandleSecureEvent(SecureEvent secure_event, bool *needs_refresh) {
+DisplayError HWCDisplay::HandleSecureEvent(SecureEvent secure_event, bool *needs_refresh,
+                                           bool update_event_only) {
   if (secure_event == secure_event_) {
     return kErrorNone;
   }
 
+  if (update_event_only) {
+    secure_event_ = secure_event;
+    return kErrorNone;
+  }
+
   DisplayError err = ValidateTUITransition(secure_event);
   if (err != kErrorNone) {
     return err;
@@ -3151,6 +3157,9 @@
 DisplayError HWCDisplay::PostHandleSecureEvent(SecureEvent secure_event) {
   DisplayError err = display_intf_->PostHandleSecureEvent(secure_event);
   if (err == kErrorNone) {
+    if (secure_event == kTUITransitionEnd || secure_event == kTUITransitionUnPrepare) {
+      return kErrorNone;
+    }
     secure_event_ = secure_event;
   }
   return err;
@@ -3181,6 +3190,9 @@
   pending_cwb_request = !!cwb_buffer_map_.size();
   }
 
+  *needs_refresh = true;
+  display_intf_->HandleCwbTeardown();
+
   if (!pending_cwb_request) {
     dump_frame_count_ = 0;
     dump_frame_index_ = 0;
@@ -3198,13 +3210,8 @@
     output_buffer_base_ = nullptr;
     frame_capture_buffer_queued_ = false;
     frame_capture_status_ = 0;
-    *needs_refresh = false;
-    return kErrorNone;
-  } else {
-    *needs_refresh = true;
-    display_intf_->HandleCwbTeardown();
-    return kErrorNone;
   }
+  return kErrorNone;
 }
 
 void HWCDisplay::MMRMEvent(bool restricted) {
@@ -3276,7 +3283,7 @@
   }
 
   if (secure_event_ != kSecureEventMax) {
-    DLOGE("CWB is not supported as TUI transition is in progress");
+    DLOGW("CWB is not supported as TUI transition is in progress");
     return HWC2::Error::Unsupported;
   }
 
@@ -3357,6 +3364,24 @@
   LayerRect &full_rect = config.cwb_full_rect;
   CwbTapPoint &tap_point = config.tap_point;
 
+  LayerRect full_rect_with_window_rect = full_rect;
+  LayerRect cwb_roi_with_window_rect = roi;
+
+  full_rect_with_window_rect.left += window_rect_.left;
+  full_rect_with_window_rect.top += window_rect_.top;
+  full_rect_with_window_rect.right -= window_rect_.right;
+  full_rect_with_window_rect.bottom -= window_rect_.bottom;
+
+  cwb_roi_with_window_rect.left += window_rect_.left;
+  cwb_roi_with_window_rect.top += window_rect_.top;
+  cwb_roi_with_window_rect.right += window_rect_.left;
+  cwb_roi_with_window_rect.bottom += window_rect_.top;
+
+  if (windowed_display_ && (!(Contains(full_rect_with_window_rect, cwb_roi_with_window_rect)))) {
+    DLOGW("Requested CWB ROI is out of bounds");
+    return HWC2::Error::Unsupported;
+  }
+
   DisplayError error = kErrorNone;
   error = display_intf_->CaptureCwb(output_buffer, config);
   if (error) {
diff --git a/composer/hwc_display.h b/composer/hwc_display.h
index 017c41e..ae98ccb 100644
--- a/composer/hwc_display.h
+++ b/composer/hwc_display.h
@@ -247,7 +247,8 @@
   virtual int Perform(uint32_t operation, ...);
   virtual int HandleSecureSession(const std::bitset<kSecureMax> &secure_sessions,
                                   bool *power_on_pending, bool is_active_secure_display);
-  virtual DisplayError HandleSecureEvent(SecureEvent secure_event, bool *needs_refresh);
+  virtual DisplayError HandleSecureEvent(SecureEvent secure_event, bool *needs_refresh,
+                                         bool update_event_only);
   virtual DisplayError PostHandleSecureEvent(SecureEvent secure_event);
   virtual int GetActiveSecureSession(std::bitset<kSecureMax> *secure_sessions) { return 0; };
   virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
diff --git a/composer/hwc_layers.cpp b/composer/hwc_layers.cpp
index c18930d..842269f 100644
--- a/composer/hwc_layers.cpp
+++ b/composer/hwc_layers.cpp
@@ -620,8 +620,16 @@
     return HWC2::Error::BadParameter;
   }
 
+  uint8_t kMaxPlaneAlpha = 255;
   //  Conversion of float alpha in range 0.0 to 1.0 similar to the HWC Adapter
-  uint8_t plane_alpha = static_cast<uint8_t>(std::round(255.0f * alpha));
+  uint8_t plane_alpha = static_cast<uint8_t>(std::round(float(kMaxPlaneAlpha) * alpha));
+
+  //  if alpha lies in the range (0.998, 1), plane_alpha becomes 255 when rounded off,
+  //  while alpha < 1. HWC knows layer as opaque and marks punch hole for that layer in fbt,
+  //  while SF knows it as non-opaque and doesn't create punch hole.
+  if ((plane_alpha == kMaxPlaneAlpha) && (alpha < 1.0f)) {
+    plane_alpha = (kMaxPlaneAlpha - 1);
+  }
 
   if (layer_->plane_alpha != plane_alpha) {
     geometry_changes_ |= kPlaneAlpha;
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index 7aa5ddc..4d3908e 100644
--- a/composer/hwc_session.cpp
+++ b/composer/hwc_session.cpp
@@ -2798,10 +2798,13 @@
 }
 
 android::status_t HWCSession::SetDsiClk(const android::Parcel *input_parcel) {
-  int disp_id = input_parcel->readInt32();
+  uint32_t disp_id = UINT32(input_parcel->readInt32());
   uint64_t clk = UINT64(input_parcel->readInt64());
   if (disp_id != HWC_DISPLAY_PRIMARY) {
-    return -EINVAL;
+    if (!std::any_of(map_info_builtin_.begin(), map_info_builtin_.end(),
+                    [&disp_id](auto &i) {return disp_id == i.client_id;})) {
+                      return -EINVAL;
+                   }
   }
 
   SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
@@ -4274,7 +4277,6 @@
   {
     SEQUENCE_WAIT_SCOPE_LOCK(locker_[display]);
     DLOGI("Acquired lock for client %d display %" PRIu64, client_id, display);
-    callbacks_.Refresh(display);
     clients_waiting_for_commit_[display].set(client_id);
     locker_[display].Wait();
     if (commit_error_[display] != 0) {
@@ -4370,11 +4372,9 @@
   for (auto &info : map_info) {
     SEQUENCE_WAIT_SCOPE_LOCK(locker_[info.client_id]);
     if (hwc_display_[info.client_id]) {
-      if (info.client_id == target_display) {
-        continue;
-      }
-      if (hwc_display_[info.client_id]->HandleSecureEvent(kTUITransitionPrepare,
-                                                          &needs_refresh) != kErrorNone) {
+      if (hwc_display_[info.client_id]->HandleSecureEvent(kTUITransitionPrepare, &needs_refresh,
+                                                          info.client_id == target_display) !=
+                                                          kErrorNone) {
         return -EINVAL;
       }
     }
@@ -4418,8 +4418,8 @@
   {
     SEQUENCE_WAIT_SCOPE_LOCK(locker_[target_display]);
     if (hwc_display_[target_display]) {
-      if (hwc_display_[target_display]->HandleSecureEvent(kTUITransitionStart,
-                                                          &needs_refresh) != kErrorNone) {
+      if (hwc_display_[target_display]->HandleSecureEvent(kTUITransitionStart, &needs_refresh,
+                                                          false) != kErrorNone) {
         return -EINVAL;
       }
       uint32_t config = 0;
@@ -4479,8 +4479,8 @@
     hwc_display_[target_display]->SetIdleTimeoutMs(idle_time_active_ms_, idle_time_inactive_ms_);
     hwc_display_[target_display]->SetQSyncMode(hwc_display_qsync_[target_display]);
     if (hwc_display_[target_display]) {
-      if (hwc_display_[target_display]->HandleSecureEvent(kTUITransitionEnd,
-                                                          &needs_refresh) != kErrorNone) {
+      if (hwc_display_[target_display]->HandleSecureEvent(kTUITransitionEnd, &needs_refresh,
+                                                          false) != kErrorNone) {
         return -EINVAL;
       }
     } else {
@@ -4535,14 +4535,12 @@
     {
       SEQUENCE_WAIT_SCOPE_LOCK(locker_[info.client_id]);
       if (hwc_display_[info.client_id]) {
-        if (info.client_id == target_display) {
-          continue;
-        }
         if (info.disp_type == kPluggable && pending_hotplug_event_ == kHotPlugEvent) {
           continue;
         }
-        if (hwc_display_[info.client_id]->HandleSecureEvent(kTUITransitionUnPrepare,
-                                                            &needs_refresh) != kErrorNone) {
+        if (hwc_display_[info.client_id]->HandleSecureEvent(kTUITransitionUnPrepare, &needs_refresh,
+                                                            info.client_id == target_display) !=
+                                                            kErrorNone) {
           return -EINVAL;
         }
       }
diff --git a/gralloc/gr_allocator.cpp b/gralloc/gr_allocator.cpp
index feda5b5..b9c3491 100644
--- a/gralloc/gr_allocator.cpp
+++ b/gralloc/gr_allocator.cpp
@@ -62,7 +62,6 @@
 
 int Allocator::AllocateMem(AllocData *alloc_data, uint64_t usage, int format) {
   int ret;
-  int err = 0;
   bool is_secure = false;
   alloc_data->uncached = UseUncached(format, usage);
 
@@ -88,15 +87,16 @@
   } else {
     ALOGE("%s: Failed to allocate buffer - heap name: %s flags: 0x%x ret: %d", __FUNCTION__,
           alloc_data->heap_name.c_str(), alloc_data->flags, ret);
+    return ret;
   }
 
   if (!alloc_data->vm_names.empty()) {
-    err = alloc_intf->SecureMemPerms(alloc_data);
+    ret = alloc_intf->SecureMemPerms(alloc_data);
   }
 
-  if (err) {
+  if (ret) {
     ALOGE("%s: Failed to modify secure use permissions - heap name: %s flags: 0x%x, err: %d",
-          __FUNCTION__, alloc_data->heap_name.c_str(), alloc_data->flags, err);
+          __FUNCTION__, alloc_data->heap_name.c_str(), alloc_data->flags, ret);
   }
 
   return ret;
diff --git a/gralloc/gr_utils.h b/gralloc/gr_utils.h
index 1c4ec56..acc0e95 100644
--- a/gralloc/gr_utils.h
+++ b/gralloc/gr_utils.h
@@ -68,7 +68,7 @@
 #define OVERFLOW(x, y) (((y) != 0) && ((x) > (UINT_MAX / (y))))
 
 #define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
-inline int roundUpToPageSize(int x) {
+inline size_t roundUpToPageSize(size_t x) {
   return (x + (getpagesize() - 1)) & ~(getpagesize() - 1);
 }
 
diff --git a/include/display_properties.h b/include/display_properties.h
index ca304fd..8d33e5a 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -134,6 +134,8 @@
 // Disable SDR dimming support
 #define DISABLE_SDR_DIMMING                  DISPLAY_PROP("disable_sdr_dimming")
 #define FORCE_TONEMAPPING                    DISPLAY_PROP("force_tonemapping")
+// Allows color management(tonemapping) in native mode (native mode is considered BT709+sRGB)
+#define ALLOW_TONEMAP_NATIVE                 DISPLAY_PROP("allow_tonemap_native")
 
 // RC
 #define ENABLE_ROUNDED_CORNER                DISPLAY_PROP("enable_rounded_corner")
@@ -161,6 +163,8 @@
 #define ANTI_AGING_RECALIB_TIMER             DISPLAY_PROP("demura_recalib_timer")
 #define ANTI_AGING_RECORD_TIMER              DISPLAY_PROP("demura_record_timer")
 #define ANTI_AGING_IDLE_TIMER                DISPLAY_PROP("demura_idle_timer")
+#define ANTI_AGING_MEMORY_SIZE               DISPLAY_PROP("demura_memory_size")
+#define ANTI_AGING_RECALIB_TIMER_DIVIDER     DISPLAY_PROP("demura_recalib_timer_divider")
 
 // PERF hint properties
 #define ENABLE_PERF_HINT_LARGE_COMP_CYCLE    DISPLAY_PROP("enable_perf_hint_large_comp_cycle")
diff --git a/init/init.qti.display_boot.sh b/init/init.qti.display_boot.sh
index bf65e8f..2df8b36 100644
--- a/init/init.qti.display_boot.sh
+++ b/init/init.qti.display_boot.sh
@@ -57,8 +57,13 @@
     ;;
     "kalama")
     #SOC ID for Kalama is 519
+    #SOC ID for Kalama SG36 is 600
+    #SOC ID for Kalama SG p is 601
     case "$soc_hwid" in
-      519)
+       519|600|601|603|604)
+        #Set property for kalama
+        #SOC ID for QCS Kalama is 603
+        #SOC ID for QCM Kalama is 604
         setprop vendor.display.enable_fb_scaling 0
         setprop vendor.display.target.version 4
         setprop vendor.gralloc.use_dma_buf_heaps 1
diff --git a/sdm/include/private/demuratn_core_uvm_intf.h b/sdm/include/private/demuratn_core_uvm_intf.h
index 1639ea7..78b44cd 100644
--- a/sdm/include/private/demuratn_core_uvm_intf.h
+++ b/sdm/include/private/demuratn_core_uvm_intf.h
@@ -11,8 +11,15 @@
 
 namespace sdm {
 
+enum DemuraTnCoreState {
+  kDemuraTnCoreNotReady,
+  kDemuraTnCoreReady,
+  kDemuraTnCoreError,
+  kDemuraTnCoreStateMax,
+};
+
 enum DemuraTnCoreUvmParams {
-  /* Getter: bool */
+  /* Getter: DemuraTnCoreState */
   kDemuraTnCoreUvmParamInitReady,
   /* Getter/Setter: bool */
   kDemuraTnCoreUvmParamEnable,
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 18bec0f..13abdc7 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -125,6 +125,7 @@
   DisplayError error = kErrorNone;
   hw_panel_info_ = HWPanelInfo();
   hw_intf_->GetHWPanelInfo(&hw_panel_info_);
+  default_panel_mode_ = hw_panel_info_.mode;
   if (hw_info_intf_) {
     hw_info_intf_->GetHWResourceInfo(&hw_resource_info_);
   }
@@ -217,6 +218,10 @@
   if (Debug::Get()->GetProperty(DISABLE_LLCC_DURING_AOD, &prop) == kErrorNone) {
     disable_llcc_during_aod_ = (prop == 1);
   }
+  prop = 0;
+  if (Debug::Get()->GetProperty(ALLOW_TONEMAP_NATIVE, &prop) == kErrorNone) {
+    allow_tonemap_native_ = (prop == 1);
+  }
 
   SetupPanelFeatureFactory();
 
@@ -2540,6 +2545,9 @@
   }
 
   LayerRect &roi = cwb_config->cwb_roi;
+  // Set cwb full rect as per window rect.
+  cwb_config->cwb_full_rect.right -= (window_rect_.left + window_rect_.right);
+  cwb_config->cwb_full_rect.bottom -= (window_rect_.top + window_rect_.bottom);
   LayerRect &full_frame = cwb_config->cwb_full_rect;
   uint32_t cwb_roi_supported = 0;  // Check whether CWB ROI is supported.
   IsSupportedOnDisplay(kCwbCrop, &cwb_roi_supported);
@@ -2581,7 +2589,8 @@
     DLOGI_IF(kTagDisplay, "Client provided invalid ROI. Going for Full frame CWB.");
     roi = full_frame;
   }
-
+  // Reposition CWB ROI as per window rect.
+  roi = Reposition(roi, window_rect_.left, window_rect_.top);
   DLOGI_IF(kTagDisplay, "Cwb_config: tap_point %d, CWB ROI Rect(%f %f %f %f), PU_as_CWB_ROI %d",
            tap_point, roi.left, roi.top, roi.right, roi.bottom, pu_as_cwb_roi);
 
@@ -3580,7 +3589,8 @@
   } else if (color_gamut == kDcip3) {
     pt.primaries = GetColorPrimariesFromAttribute(color_gamut);
     pt.transfer = Transfer_sRGB;
-  } else if (color_gamut == kNative) {
+  } else if (color_gamut == kNative && !allow_tonemap_native_) {
+    // if allow_tonemap_native_ is set, blend space is defaulted to BT709 + sRGB
     pt.primaries = GetColorPrimariesFromAttribute(color_gamut);
     pt.transfer = Transfer_Max;
   }
@@ -3763,9 +3773,11 @@
   DLOGI("Secure event %d for display %d-%d", secure_event, display_id_, display_type_);
 
   if (secure_event == kTUITransitionStart &&
-      (state_ != kStateOn || (pending_power_state_ != kPowerStateNone))) {
-    DLOGW("Cannot start TUI session when display state is %d or pending_power_state %d",
-          state_, pending_power_state_);
+      (state_ != kStateOn || (pending_power_state_ != kPowerStateNone) ||
+       (hw_panel_info_.mode != default_panel_mode_))) {
+    DLOGW("Cannot start TUI session when display state is %d or pending_power_state %d "
+          "or panel mode is changed; current panel mode = %d, panel mode during bootup = %d",
+           state_, pending_power_state_, hw_panel_info_.mode, default_panel_mode_);
     return kErrorPermission;
   }
   shared_ptr<Fence> release_fence = nullptr;
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 3b54419..a40e986 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -431,6 +431,7 @@
   bool pending_commit_ = false;
   uint32_t active_refresh_rate_ = 0;
   bool disable_cwb_idle_fallback_ = false;
+  bool allow_tonemap_native_ = false;
 
  private:
   // Max tolerable power-state-change wait-times in milliseconds.
@@ -480,6 +481,7 @@
   bool windowed_display_ = false;
   LayerRect window_rect_ = {};
   bool enable_win_rect_mask_ = false;
+  HWDisplayMode default_panel_mode_ = kModeDefault;
 };
 
 }  // namespace sdm
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 2a4bc76..5402d8e 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -778,9 +778,9 @@
   *en = enable;
 
   if (enable) {  // make sure init is ready before enabling
-    bool *init_ready = nullptr;
+    DemuraTnCoreState *init_ready = nullptr;
     GenericPayload ready_pl;
-    ret = ready_pl.CreatePayload<bool>(init_ready);
+    ret = ready_pl.CreatePayload<DemuraTnCoreState>(init_ready);
     if (ret) {
       DLOGE("failed to create the payload. Error:%d", ret);
       return kErrorUndefined;
@@ -791,16 +791,25 @@
       DLOGE("GetParameter for InitReady failed ret %d", ret);
       return kErrorUndefined;
     }
-    if (!(*init_ready)) {
+    if (*init_ready == kDemuraTnCoreNotReady) {
       return kErrorNone;
-    }
-
-    ret = demuratn_->SetParameter(kDemuraTnCoreUvmParamEnable, payload);
-    if (ret) {
-      DLOGE("SetParameter for enable failed ret %d", ret);
+    } else if (*init_ready == kDemuraTnCoreError) {
+      DLOGE("DemuraTn init ready state returns error");
+      int rc = demuratn_->Deinit();
+      if (rc)
+        DLOGE("Failed to deinit DemuraTn ret %d", rc);
+      demuratn_factory_ = nullptr;
+      demuratn_.reset();
+      demuratn_ = nullptr;
       return kErrorUndefined;
+    } else if (*init_ready == kDemuraTnCoreReady) {
+      ret = demuratn_->SetParameter(kDemuraTnCoreUvmParamEnable, payload);
+      if (ret) {
+        DLOGE("SetParameter for enable failed ret %d", ret);
+        return kErrorUndefined;
+      }
+      demuratn_enabled_ = true;
     }
-    demuratn_enabled_ = true;
   } else {
     ret = demuratn_->SetParameter(kDemuraTnCoreUvmParamEnable, payload);
     if (ret) {
@@ -2394,7 +2403,9 @@
   }
 
   // Set sRGB as default blend space.
-  if (stc_color_modes_.list.empty()) {
+  bool native_mode = (color_mode.intent == snapdragoncolor::kNative) ||
+                     (color_mode.gamut == ColorPrimaries_Max && color_mode.gamma == Transfer_Max);
+  if (stc_color_modes_.list.empty() || (native_mode && allow_tonemap_native_)) {
     return blend_space;
   }
 
diff --git a/sdm/libs/dal/hw_device_drm.cpp b/sdm/libs/dal/hw_device_drm.cpp
index c70ff12..8164111 100644
--- a/sdm/libs/dal/hw_device_drm.cpp
+++ b/sdm/libs/dal/hw_device_drm.cpp
@@ -585,6 +585,14 @@
   PopulateHWPanelInfo();
   UpdateMixerAttributes();
 
+  LayerRect window_rect = {};
+  windowed_display_ = Debug::GetWindowRect(hw_panel_info_.is_primary_panel, &window_rect.left,
+                                           &window_rect.top, &window_rect.right,
+                                           &window_rect.bottom) == 0;
+  if (windowed_display_) {
+    window_rect_ = window_rect;
+  }
+
   // TODO(user): In future, remove has_qseed3 member, add version and pass version to constructor
   if (hw_resource_.has_qseed3) {
     hw_scale_ = new HWScaleDRM(HWScaleDRM::Version::V2);
@@ -2024,7 +2032,8 @@
   // for other metadata types we will run into issues.
   bool extended_md_present = input_buffer.extended_content_metadata != nullptr &&
                               input_buffer.extended_content_metadata->size;
-  if (extended_md_present && input_buffer.color_metadata.transfer == Transfer_SMPTE_170M) {
+  if (extended_md_present && (input_buffer.color_metadata.transfer == Transfer_SMPTE_170M
+                          || input_buffer.color_metadata.transfer == Transfer_sRGB)) {
       *type = DRMCscType::kCscYuv2RgbDolbyVisionP5;
       return;
   }
@@ -3058,6 +3067,13 @@
   sde_drm::DRMRect cwb_dst = full_frame;
   LayerRect cwb_roi = cwb_config->cwb_roi;
 
+  if (windowed_display_) {
+    cwb_roi.left += window_rect_.left;
+    cwb_roi.right += window_rect_.left;
+    cwb_roi.top += window_rect_.top;
+    cwb_roi.bottom += window_rect_.top;
+  }
+
   if (has_cwb_crop_) {  // If CWB ROI feature is supported, then set WB connector's roi_v1 property
     // to PU ROI and DST_* properties to CWB ROI. Else, set DST_* properties to full frame ROI.
     bool is_full_frame_update = IsFullFrameUpdate(hw_layer_info);
diff --git a/sdm/libs/dal/hw_device_drm.h b/sdm/libs/dal/hw_device_drm.h
index 144debf..63eba31 100644
--- a/sdm/libs/dal/hw_device_drm.h
+++ b/sdm/libs/dal/hw_device_drm.h
@@ -364,6 +364,8 @@
   static HWCwbConfig cwb_config_;
   static std::mutex cwb_state_lock_;  // cwb state lock. Set before accesing or updating cwb_config_
   uint32_t transfer_time_updated_ = 0;
+  LayerRect window_rect_ = {};
+  bool windowed_display_ = false;
 
  private:
   void GetCWBCapabilities();