Revert "frecon: Fix atomic detection"

This reverts commit b95af607447955cc96a24b3234460b16b70e78d5.

Reverting fix to work around the inverse bug in ozone :-(

BUG=b:169889131
TEST=build and boot lazor

Change-Id: I801babc42ef82cd70bdf3c8a80f4ed10228dda31
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/frecon/+/2443952
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
diff --git a/drm.c b/drm.c
index 4e55aa7..240f79c 100644
--- a/drm.c
+++ b/drm.c
@@ -425,6 +425,7 @@
 	drm_t *best_drm = NULL;
 
 	for (i = 0; i < DRM_MAX_MINOR; i++) {
+		uint64_t atomic = 0;
 		drm_t* drm = calloc(1, sizeof(drm_t));
 
 		if (!drm)
@@ -454,10 +455,14 @@
 		/* Set universal planes cap if possible. Ignore any errors. */
 		drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
 
-		/* Try to set atomic, to detect if it is supported: */
-		ret = drmSetClientCap(drm->fd, DRM_CLIENT_CAP_ATOMIC, 1);
-		if (!ret) {
+		ret = drmGetCap(drm->fd, DRM_CLIENT_CAP_ATOMIC, &atomic);
+		if (!ret && atomic) {
 			drm->atomic = true;
+			ret = drmSetClientCap(drm->fd, DRM_CLIENT_CAP_ATOMIC, 1);
+			if (ret < 0) {
+				LOG(ERROR, "Failed to set atomic cap.");
+				drm->atomic = false;
+			}
 		}
 
 		drm->resources = drmModeGetResources(drm->fd);