bool regions_empty = comp_regions.empty();
NativeSurface *surface = plane.GetOffScreenTarget();
if (!regions_empty &&
- (surface->ClearSurface() || surface->IsPartialClear())) {
+ (surface->ClearSurface() || surface->IsPartialClear() ||
+ surface->IsSurfaceDamageChanged())) {
plane.ResetCompositionRegion();
regions_empty = true;
}
void NativeSurface::SetClearSurface(ClearType clear_surface) {
if (clear_surface_ != clear_surface) {
clear_surface_ = clear_surface;
+ if (clear_surface_ == kFullClear) {
+ damage_changed_ = true;
+ }
}
}
surface_age_ = value;
}
+bool NativeSurface::IsSurfaceDamageChanged() const {
+ return damage_changed_;
+}
+
void NativeSurface::SetPlaneTarget(const DisplayPlaneState &plane,
uint32_t gpu_fd) {
const HwcRect<int> &display_rect = plane.GetDisplayFrame();
surface_damage_ = display_rect;
clear_surface_ = kFullClear;
+ damage_changed_ = true;
surface_age_ = 0;
if (layer_.GetBuffer()->GetFb() == 0) {
layer_.GetBuffer()->CreateFrameBuffer(gpu_fd);
const HwcRect<int> ¤tsurface_damage) {
if (surface_damage_.empty()) {
surface_damage_ = currentsurface_damage;
+ damage_changed_ = true;
return;
}
return;
}
+ HwcRect<int> temp = surface_damage_;
CalculateRect(currentsurface_damage, surface_damage_);
+ if (!damage_changed_) {
+ damage_changed_ = true;
+ if (temp == surface_damage_) {
+ damage_changed_ = false;
+ }
+ }
}
void NativeSurface::ResetDamage() {
surface_damage_ = HwcRect<int>(0, 0, 0, 0);
+ damage_changed_ = false;
}
void NativeSurface::InitializeLayer(HWCNativeHandle native_handle) {
// Applies rotation transform to this surface.
void SetTransform(uint32_t transform);
+ // Returns true in case damage of this surface has changed
+ // compared to previous frame.
+ bool IsSurfaceDamageChanged() const;
+
protected:
OverlayLayer layer_;
ResourceManager* resource_manager_;
int height_;
ClearType clear_surface_;
int surface_age_;
+ bool damage_changed_ = true;
HwcRect<int> surface_damage_;
};