Do not call SetBufferDamagedRects if the damaged rect is empty 78/280378/1
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 29 Aug 2022 07:53:28 +0000 (16:53 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 29 Aug 2022 07:53:28 +0000 (16:53 +0900)
An empty damaged rect means we will not render the scene and not swap buffers.
A call to eglSetDamageRegion without out eglSwapBuffers may cause EGL_BAD_ACCESS error.

Change-Id: I949498c39d9a558b42b7e2edbbe1162f432e87b8

dali/internal/window-system/common/window-render-surface.cpp

index 22ac0f3..8dd26e9 100644 (file)
@@ -636,12 +636,6 @@ bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect
     {
       mDamagedRects.assign(1, surfaceRect);
     }
-    else if(mDamagedRects.empty() && !clippingRect.IsEmpty())
-    {
-      // We will render clippingRect area but mDamagedRects is empty.
-      // So make mDamagedRects same with clippingRect to swap buffers.
-      mDamagedRects.assign(1, clippingRect);
-    }
   }
 
   // This is now done when the render pass for the render surface begins
@@ -887,6 +881,13 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
       return;
     }
 
+    if(damagedRects.empty())
+    {
+      // Empty damaged rect. We don't need rendering
+      clippingRect = Rect<int>();
+      return;
+    }
+
     mGraphics->ActivateSurfaceContext(this);
 
     EGLint bufferAge = eglImpl.GetBufferAge(mEGLSurface);