gfx: add SWAP_NON_SIMPLE_OVERLAYS_FAILED

This CL adds a new failure type - SWAP_NON_SIMPLE_OVERLAYS_FAILED.
This failure will be used by ozone/drm when non simple overlays
such as fullscreen are failed.

Bug: 331237773
Change-Id: Id858e726c972cfe908bd6d5da4d24ce2d885ad15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5625933
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1315052}
diff --git a/ui/gfx/mojom/swap_result.mojom b/ui/gfx/mojom/swap_result.mojom
index 3dde836..4a26fd7 100644
--- a/ui/gfx/mojom/swap_result.mojom
+++ b/ui/gfx/mojom/swap_result.mojom
@@ -14,4 +14,5 @@
   FAILED,
   SKIPPED,
   NAK_RECREATE_BUFFERS,
+  NON_SIMPLE_OVERLAYS_FAILED,
 };
diff --git a/ui/gfx/mojom/swap_result_mojom_traits.h b/ui/gfx/mojom/swap_result_mojom_traits.h
index 33b395f..7c30c36 100644
--- a/ui/gfx/mojom/swap_result_mojom_traits.h
+++ b/ui/gfx/mojom/swap_result_mojom_traits.h
@@ -22,6 +22,8 @@
         return gfx::mojom::SwapResult::FAILED;
       case gfx::SwapResult::SWAP_SKIPPED:
         return gfx::mojom::SwapResult::SKIPPED;
+      case gfx::SwapResult::SWAP_NON_SIMPLE_OVERLAYS_FAILED:
+        return gfx::mojom::SwapResult::NON_SIMPLE_OVERLAYS_FAILED;
       case gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS:
         return gfx::mojom::SwapResult::NAK_RECREATE_BUFFERS;
     }
@@ -40,6 +42,9 @@
       case gfx::mojom::SwapResult::SKIPPED:
         *out = gfx::SwapResult::SWAP_SKIPPED;
         return true;
+      case gfx::mojom::SwapResult::NON_SIMPLE_OVERLAYS_FAILED:
+        *out = gfx::SwapResult::SWAP_NON_SIMPLE_OVERLAYS_FAILED;
+        return true;
       case gfx::mojom::SwapResult::NAK_RECREATE_BUFFERS:
         *out = gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS;
         return true;
diff --git a/ui/gfx/swap_result.h b/ui/gfx/swap_result.h
index 869c96f8..f4d5fd26 100644
--- a/ui/gfx/swap_result.h
+++ b/ui/gfx/swap_result.h
@@ -28,7 +28,10 @@
   // SWAP_SKIPPED.
   SWAP_SKIPPED,
   SWAP_NAK_RECREATE_BUFFERS,
-  SWAP_RESULT_LAST = SWAP_NAK_RECREATE_BUFFERS,
+  // This swap result identifies cases when flipping non-simple overlay planes
+  // fails.
+  SWAP_NON_SIMPLE_OVERLAYS_FAILED,
+  SWAP_RESULT_LAST = SWAP_NON_SIMPLE_OVERLAYS_FAILED,
 };
 
 struct SwapTimings {
diff --git a/ui/ozone/demo/skia/skia_surfaceless_gl_renderer.cc b/ui/ozone/demo/skia/skia_surfaceless_gl_renderer.cc
index 5370beb..f843ecc 100644
--- a/ui/ozone/demo/skia/skia_surfaceless_gl_renderer.cc
+++ b/ui/ozone/demo/skia/skia_surfaceless_gl_renderer.cc
@@ -305,6 +305,7 @@
       break;
     case gfx::SwapResult::SWAP_SKIPPED:
     case gfx::SwapResult::SWAP_FAILED:
+    case gfx::SwapResult::SWAP_NON_SIMPLE_OVERLAYS_FAILED:
       LOG(FATAL) << "Failed to swap buffers";
   }
 }
diff --git a/ui/ozone/demo/surfaceless_gl_renderer.cc b/ui/ozone/demo/surfaceless_gl_renderer.cc
index 59fb334..eb2fbe7 100644
--- a/ui/ozone/demo/surfaceless_gl_renderer.cc
+++ b/ui/ozone/demo/surfaceless_gl_renderer.cc
@@ -327,6 +327,7 @@
       break;
     case gfx::SwapResult::SWAP_SKIPPED:
     case gfx::SwapResult::SWAP_FAILED:
+    case gfx::SwapResult::SWAP_NON_SIMPLE_OVERLAYS_FAILED:
       LOG(FATAL) << "Failed to swap buffers";
   }
 }