Allow Linux build without X11 dependency

ChromeOS runs tests on some bots which run on Linux, but do not support X11.
In order to allow SwiftShader to successfully build on these bots, all X11
dependencies are #ifdefed behind the USE_X11 flag, which is already supplied
by the Chromium build system.

Change-Id: I6b914b1e662d9fbf101eb7caea7ac59e43cc7b56
Reviewed-on: https://swiftshader-review.googlesource.com/19488
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libEGL/Surface.cpp b/src/OpenGL/libEGL/Surface.cpp
index 237804b..b8bba5f 100644
--- a/src/OpenGL/libEGL/Surface.cpp
+++ b/src/OpenGL/libEGL/Surface.cpp
@@ -26,7 +26,7 @@
 #include "common/debug.h"
 #include "Main/FrameBuffer.hpp"
 
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(USE_X11)
 #include "Main/libX11.hpp"
 #elif defined(_WIN32)
 #include <tchar.h>
@@ -341,7 +341,7 @@
 	#elif defined(__ANDROID__)
 		int windowWidth;  window->query(window, NATIVE_WINDOW_WIDTH, &windowWidth);
 		int windowHeight; window->query(window, NATIVE_WINDOW_HEIGHT, &windowHeight);
-	#elif defined(__linux__)
+	#elif defined(USE_X11)
 		XWindowAttributes windowAttributes;
 		Status status = libX11->XGetWindowAttributes((::Display*)display->getNativeDisplay(), window, &windowAttributes);
 
@@ -352,6 +352,10 @@
 
 		int windowWidth = windowAttributes.width;
 		int windowHeight = windowAttributes.height;
+	#elif defined(__linux__)
+		// Non X11 linux is headless only
+		int windowWidth = 100;
+		int windowHeight = 100;
 	#elif defined(__APPLE__)
 		int windowWidth;
 		int windowHeight;