hwc2: Do not honor cursor position when cursor layer is not present

SurfaceFlinger is setting cursor position on invalid layers leading
to errors. Do not honor SetCursorPosition when cursor layer is not
present in layer stack.

Change-Id: I0d28f51d06f07791bc113ae6fcc8a60fd04d2f61
CRs-Fixed: 2239498
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 9a40b02..75cea13 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -1674,6 +1674,11 @@
     return HWC2::Error::None;
   }
 
+  if (!layer_stack_.flags.cursor_present) {
+    DLOGW("Cursor layer not present");
+    return HWC2::Error::BadLayer;
+  }
+
   HWCLayer *hwc_layer = GetHWCLayer(layer);
   if (hwc_layer == nullptr) {
     return HWC2::Error::BadLayer;