diff --git a/autobuild.xml b/autobuild.xml
index 19dd39c19b953788c2ef700930ea643844cb44d3..0c2fb6783f548c0259666fa3ac9ff43967fbb9d5 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1254,9 +1254,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>94e9e2224000a575fd80b75db52e54b8</string>
+              <string>9ddf0bb2238a937f0115d6c9f0cf723f</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/264762/arch/Linux/installer/llappearanceutility_source-0.1-linux-20120914.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/265084/arch/Linux/installer/llappearanceutility_source-0.1-linux-20120923.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
diff --git a/indra/cmake/DirectX.cmake b/indra/cmake/DirectX.cmake
index b2a18805d478fc5cd12633a1464999d7900cda72..8cae6068484d96c8c24fb7ff4e7a3defaf1e1fbb 100644
--- a/indra/cmake/DirectX.cmake
+++ b/indra/cmake/DirectX.cmake
@@ -3,6 +3,7 @@
 if (VIEWER AND WINDOWS)
   find_path(DIRECTX_INCLUDE_DIR dxdiag.h
             "$ENV{DXSDK_DIR}/Include"
+            "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2010)/Include"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2009)/Include"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Include"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Include"
@@ -25,6 +26,7 @@ if (VIEWER AND WINDOWS)
 
   find_path(DIRECTX_LIBRARY_DIR dxguid.lib
             "$ENV{DXSDK_DIR}/Lib/x86"
+            "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2010)/Lib/x86"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2009)/Lib/x86"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Lib/x86"
             "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Lib/x86"
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index deab7a87fc1bda9b9e306d9c0d298497f89d0fd2..bc615ed39ec593de0cda0d2bd3caa1639d7dad06 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -329,7 +329,7 @@ const char *LLFile::tmpdir()
 #if LL_WINDOWS
 
 LLFILE *	LLFile::_Fiopen(const std::string& filename, 
-		std::ios::openmode mode,int)	// protection currently unused
+		std::ios::openmode mode)
 {	// open a file
 	static const char *mods[] =
 	{	// fopen mode strings corresponding to valid[i]
@@ -899,7 +899,7 @@ llifstream::llifstream(_Filet *_File,
 }
 #endif
 
-#if LL_WINDOWS
+#if !LL_WINDOWS
 // explicit
 llifstream::llifstream(int __fd,
 		ios_base::openmode _Mode, size_t _Size) :
@@ -1014,7 +1014,7 @@ llofstream::llofstream(_Filet *_File,
 }
 #endif
 
-#if LL_WINDOWS
+#if !LL_WINDOWS
 // explicit
 llofstream::llofstream(int __fd,
 			ios_base::openmode _Mode, size_t _Size) :
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 7049ab13969f1012e5ac198f676755e97b575231..9d70db96ea83852d4365cf9f0096454bc2e41cec 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -38,7 +38,6 @@
 typedef FILE LLFILE;
 
 #include <fstream>
-#include <bits/postypes.h>
 #include <sys/stat.h>
 
 #if LL_WINDOWS
@@ -47,6 +46,7 @@ typedef struct _stat	llstat;
 #else
 typedef struct stat		llstat;
 #include <ext/stdio_filebuf.h>
+#include <bits/postypes.h>
 #endif
 
 #ifndef S_ISREG
diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp
index e338d4ec71ee566826a4f4a24bff428fe5ac77dd..4a9db7cd9822d8d65f0b3ee6880fcc036dc09890 100644
--- a/indra/llmessage/tests/llhttpclient_test.cpp
+++ b/indra/llmessage/tests/llhttpclient_test.cpp
@@ -47,37 +47,6 @@
 
 namespace tut
 {
-	LLSD storage;
-	
-	class LLSDStorageNode : public LLHTTPNode
-	{
-	public:
-		LLSD simpleGet() const					{ return storage; }
-		LLSD simplePut(const LLSD& value) const	{ storage = value; return LLSD(); }
-	};
-
-	class ErrorNode : public LLHTTPNode
-	{
-	public:
-		void get(ResponsePtr r, const LLSD& context) const
-			{ r->status(599, "Intentional error"); }
-		void post(ResponsePtr r, const LLSD& context, const LLSD& input) const
-			{ r->status(input["status"], input["reason"]); }
-	};
-
-	class TimeOutNode : public LLHTTPNode
-	{
-	public:
-		void get(ResponsePtr r, const LLSD& context) const
-		{
-            /* do nothing, the request will eventually time out */ 
-		}
-	};
-
-	LLHTTPRegistration<LLSDStorageNode> gStorageNode("/test/storage");
-	LLHTTPRegistration<ErrorNode>		gErrorNode("/test/error");
-	LLHTTPRegistration<TimeOutNode>		gTimeOutNode("/test/timeout");
-
 	struct HTTPClientTestData
 	{
 	public:
@@ -86,7 +55,6 @@ namespace tut
 		{
 			apr_pool_create(&mPool, NULL);
 			LLCurl::initClass(false);
-			mServerPump = new LLPumpIO(mPool);
 			mClientPump = new LLPumpIO(mPool);
 
 			LLHTTPClient::setPump(*mClientPump);
@@ -94,20 +62,11 @@ namespace tut
 		
 		~HTTPClientTestData()
 		{
-			delete mServerPump;
 			delete mClientPump;
 			LLProxy::cleanupClass();
 			apr_pool_destroy(mPool);
 		}
 
-		void setupTheServer()
-		{
-			LLHTTPNode& root = LLIOHTTPServer::create(mPool, *mServerPump, 8888);
-
-			LLHTTPStandardServices::useServices();
-			LLHTTPRegistrar::buildAllServices(root);
-		}
-		
 		void runThePump(float timeout = 100.0f)
 		{
 			LLTimer timer;
@@ -115,11 +74,7 @@ namespace tut
 
 			while(!mSawCompleted && !mSawCompletedHeader && !timer.hasExpired())
 			{
-				if (mServerPump)
-				{
-					mServerPump->pump();
-					mServerPump->callback();
-				}
+				LLFrameTimer::updateFrameTime();
 				if (mClientPump)
 				{
 					mClientPump->pump();
@@ -128,17 +83,10 @@ namespace tut
 			}
 		}
 
-		void killServer()
-		{
-			delete mServerPump;
-			mServerPump = NULL;
-		}
-
 		const std::string local_server;
 
 	private:
 		apr_pool_t* mPool;
-		LLPumpIO* mServerPump;
 		LLPumpIO* mClientPump;
 
 	protected:
@@ -283,14 +231,12 @@ namespace tut
 		sd["list"][1]["three"] = 3;
 		sd["list"][1]["four"] = 4;
 		
-		setupTheServer();
-
-		LLHTTPClient::post("http://localhost:8888/web/echo", sd, newResult());
+		LLHTTPClient::post(local_server + "web/echo", sd, newResult());
 		runThePump();
 		ensureStatusOK();
 		ensure_equals("echoed result matches", getResult(), sd);
 	}
-
+		
 	template<> template<>
 		void HTTPClientTestObject::test<4>()
 	{
@@ -298,12 +244,11 @@ namespace tut
 
 		sd["message"] = "This is my test message.";
 
-		setupTheServer();
-		LLHTTPClient::put("http://localhost:8888/test/storage", sd, newResult());
+		LLHTTPClient::put(local_server + "test/storage", sd, newResult());
 		runThePump();
 		ensureStatusOK();
 
-		LLHTTPClient::get("http://localhost:8888/test/storage", newResult());
+		LLHTTPClient::get(local_server + "test/storage", newResult());
 		runThePump();
 		ensureStatusOK();
 		ensure_equals("echoed result matches", getResult(), sd);
@@ -317,9 +262,7 @@ namespace tut
 		sd["status"] = 543;
 		sd["reason"] = "error for testing";
 
-		setupTheServer();
-
-		LLHTTPClient::post("http://localhost:8888/test/error", sd, newResult());
+		LLHTTPClient::post(local_server + "test/error", sd, newResult());
 		runThePump();
 		ensureStatusError();
 		ensure_contains("reason", mReason, sd["reason"]);
@@ -328,23 +271,16 @@ namespace tut
 	template<> template<>
 		void HTTPClientTestObject::test<6>()
 	{
-		setupTheServer();
-
-		LLHTTPClient::get("http://localhost:8888/test/timeout", newResult());
-		runThePump(1.0f);
-		killServer();
-		runThePump();
+		const F32 timeout = 1.0f;
+		LLHTTPClient::get(local_server + "test/timeout", newResult(), LLSD(), timeout);
+		runThePump(timeout * 5.0f);
 		ensureStatusError();
-		ensure_equals("reason", mReason, "STATUS_ERROR");
+		ensure_equals("reason", mReason, "STATUS_EXPIRED");
 	}
 
 	template<> template<>
 		void HTTPClientTestObject::test<7>()
 	{
-		// Can not use the little mini server.  The blocking request
-		// won't ever let it run.  Instead get from a known LLSD
-		// source and compare results with the non-blocking get which
-		// is tested against the mini server earlier.
 		LLHTTPClient::get(local_server, newResult());
 		runThePump();
 		ensureStatusOK();
diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py
index fe4f3a8c011b095ab7b020f5b6d01c1216bc30a7..b59c5a06cd6737d5e1baf99eadb6110450b0d9a8 100644
--- a/indra/llmessage/tests/test_llsdmessage_peer.py
+++ b/indra/llmessage/tests/test_llsdmessage_peer.py
@@ -1,153 +1,173 @@
-#!/usr/bin/env python
-"""\
-@file   test_llsdmessage_peer.py
-@author Nat Goodspeed
-@date   2008-10-09
-@brief  This script asynchronously runs the executable (with args) specified on
-        the command line, returning its result code. While that executable is
-        running, we provide dummy local services for use by C++ tests.
-
-$LicenseInfo:firstyear=2008&license=viewerlgpl$
-Second Life Viewer Source Code
-Copyright (C) 2010, Linden Research, Inc.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation;
-version 2.1 of the License only.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
-$/LicenseInfo$
-"""
-
-import os
-import sys
-from threading import Thread
-from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
-
-mydir = os.path.dirname(__file__)       # expected to be .../indra/llmessage/tests/
-sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))
-from indra.util.fastest_elementtree import parse as xml_parse
-from indra.base import llsd
-from testrunner import freeport, run, debug, VERBOSE
-
-class TestHTTPRequestHandler(BaseHTTPRequestHandler):
-    """This subclass of BaseHTTPRequestHandler is to receive and echo
-    LLSD-flavored messages sent by the C++ LLHTTPClient.
-    """
-    def read(self):
-        # The following logic is adapted from the library module
-        # SimpleXMLRPCServer.py.
-        # Get arguments by reading body of request.
-        # We read this in chunks to avoid straining
-        # socket.read(); around the 10 or 15Mb mark, some platforms
-        # begin to have problems (bug #792570).
-        try:
-            size_remaining = int(self.headers["content-length"])
-        except (KeyError, ValueError):
-            return ""
-        max_chunk_size = 10*1024*1024
-        L = []
-        while size_remaining:
-            chunk_size = min(size_remaining, max_chunk_size)
-            chunk = self.rfile.read(chunk_size)
-            L.append(chunk)
-            size_remaining -= len(chunk)
-        return ''.join(L)
-        # end of swiped read() logic
-
-    def read_xml(self):
-        # This approach reads the entire POST data into memory first
-        return llsd.parse(self.read())
-##         # This approach attempts to stream in the LLSD XML from self.rfile,
-##         # assuming that the underlying XML parser reads its input file
-##         # incrementally. Unfortunately I haven't been able to make it work.
-##         tree = xml_parse(self.rfile)
-##         debug("Finished raw parse")
-##         debug("parsed XML tree %s", tree)
-##         debug("parsed root node %s", tree.getroot())
-##         debug("root node tag %s", tree.getroot().tag)
-##         return llsd.to_python(tree.getroot())
-
-    def do_HEAD(self):
-        self.do_GET(withdata=False)
-
-    def do_GET(self, withdata=True):
-        # Of course, don't attempt to read data.
-        data = dict(reply="success", body="avatar", random=17)
-        self.answer(data, withdata=withdata)
-
-    def do_POST(self):
-        # Read the provided POST data.
-        self.answer(self.read_xml())
-
-    def answer(self, data, withdata=True):
-        debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
-        if "fail" not in self.path:
-            data = data.copy()          # we're going to modify
-            # Ensure there's a "reply" key in data, even if there wasn't before
-            data["reply"] = data.get("reply", llsd.LLSD("success"))
-            response = llsd.format_xml(data)
-            debug("success: %s", response)
-            self.send_response(200)
-            self.send_header("Content-type", "application/llsd+xml")
-            self.send_header("Content-Length", str(len(response)))
-            self.end_headers()
-            if withdata:
-                self.wfile.write(response)
-        else:                           # fail requested
-            status = data.get("status", 500)
-            # self.responses maps an int status to a (short, long) pair of
-            # strings. We want the longer string. That's why we pass a string
-            # pair to get(): the [1] will select the second string, whether it
-            # came from self.responses or from our default pair.
-            reason = data.get("reason",
-                               self.responses.get(status,
-                                                  ("fail requested",
-                                                   "Your request specified failure status %s "
-                                                   "without providing a reason" % status))[1])
-            debug("fail requested: %s: %r", status, reason)
-            self.send_error(status, reason)
-
-    if not VERBOSE:
-        # When VERBOSE is set, skip both these overrides because they exist to
-        # suppress output.
-
-        def log_request(self, code, size=None):
-            # For present purposes, we don't want the request splattered onto
-            # stderr, as it would upset devs watching the test run
-            pass
-
-        def log_error(self, format, *args):
-            # Suppress error output as well
-            pass
-
-class Server(HTTPServer):
-    # This pernicious flag is on by default in HTTPServer. But proper
-    # operation of freeport() absolutely depends on it being off.
-    allow_reuse_address = False
-
-if __name__ == "__main__":
-    # Instantiate a Server(TestHTTPRequestHandler) on the first free port
-    # in the specified port range. Doing this inline is better than in a
-    # daemon thread: if it blows up here, we'll get a traceback. If it blew up
-    # in some other thread, the traceback would get eaten and we'd run the
-    # subject test program anyway.
-    httpd, port = freeport(xrange(8000, 8020),
-                           lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler))
-    # Pass the selected port number to the subject test program via the
-    # environment. We don't want to impose requirements on the test program's
-    # command-line parsing -- and anyway, for C++ integration tests, that's
-    # performed in TUT code rather than our own.
-    os.environ["PORT"] = str(port)
-    debug("$PORT = %s", port)
-    sys.exit(run(server=Thread(name="httpd", target=httpd.serve_forever), *sys.argv[1:]))
+#!/usr/bin/env python
+"""\
+@file   test_llsdmessage_peer.py
+@author Nat Goodspeed
+@date   2008-10-09
+@brief  This script asynchronously runs the executable (with args) specified on
+        the command line, returning its result code. While that executable is
+        running, we provide dummy local services for use by C++ tests.
+
+$LicenseInfo:firstyear=2008&license=viewerlgpl$
+Second Life Viewer Source Code
+Copyright (C) 2010, Linden Research, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation;
+version 2.1 of the License only.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+$/LicenseInfo$
+"""
+
+import os
+import sys
+from threading import Thread
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+
+mydir = os.path.dirname(__file__)       # expected to be .../indra/llmessage/tests/
+sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))
+from indra.util.fastest_elementtree import parse as xml_parse
+from indra.base import llsd
+from testrunner import freeport, run, debug, VERBOSE
+import time
+
+_storage=None
+
+class TestHTTPRequestHandler(BaseHTTPRequestHandler):
+    """This subclass of BaseHTTPRequestHandler is to receive and echo
+    LLSD-flavored messages sent by the C++ LLHTTPClient.
+    """
+    def read(self):
+        # The following logic is adapted from the library module
+        # SimpleXMLRPCServer.py.
+        # Get arguments by reading body of request.
+        # We read this in chunks to avoid straining
+        # socket.read(); around the 10 or 15Mb mark, some platforms
+        # begin to have problems (bug #792570).
+        try:
+            size_remaining = int(self.headers["content-length"])
+        except (KeyError, ValueError):
+            return ""
+        max_chunk_size = 10*1024*1024
+        L = []
+        while size_remaining:
+            chunk_size = min(size_remaining, max_chunk_size)
+            chunk = self.rfile.read(chunk_size)
+            L.append(chunk)
+            size_remaining -= len(chunk)
+        return ''.join(L)
+        # end of swiped read() logic
+
+    def read_xml(self):
+        # This approach reads the entire POST data into memory first
+        return llsd.parse(self.read())
+##         # This approach attempts to stream in the LLSD XML from self.rfile,
+##         # assuming that the underlying XML parser reads its input file
+##         # incrementally. Unfortunately I haven't been able to make it work.
+##         tree = xml_parse(self.rfile)
+##         debug("Finished raw parse")
+##         debug("parsed XML tree %s", tree)
+##         debug("parsed root node %s", tree.getroot())
+##         debug("root node tag %s", tree.getroot().tag)
+##         return llsd.to_python(tree.getroot())
+
+    def do_HEAD(self):
+        self.do_GET(withdata=False)
+
+    def do_GET(self, withdata=True):
+        # Of course, don't attempt to read data.
+        data = dict(reply="success", body="avatar", random=17)
+        self.answer(data, withdata=withdata)
+
+    def do_POST(self):
+        # Read the provided POST data.
+        self.answer(self.read_xml())
+
+    def do_PUT(self):
+        # Read the provided PUT data.
+        self.answer(self.read_xml())
+
+    def answer(self, data, withdata=True):
+        global _storage
+        debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
+        if "fail" in self.path or "test/error" in self.path: # fail requested
+            status = data.get("status", 500)
+            # self.responses maps an int status to a (short, long) pair of
+            # strings. We want the longer string. That's why we pass a string
+            # pair to get(): the [1] will select the second string, whether it
+            # came from self.responses or from our default pair.
+            reason = data.get("reason",
+                               self.responses.get(status,
+                                                  ("fail requested",
+                                                   "Your request specified failure status %s "
+                                                   "without providing a reason" % status))[1])
+            debug("fail requested: %s: %r", status, reason)
+            self.send_error(status, reason)
+        else:
+            if "web/echo" in self.path:
+                pass
+            elif "test/timeout" in self.path:
+                time.sleep(5.0)
+                return
+            elif "test/storage" in self.path:
+                if "GET" == self.command:
+                    data = _storage
+                else:
+                    _storage = data
+                    data = "ok"
+            else:
+                data = data.copy()          # we're going to modify
+                # Ensure there's a "reply" key in data, even if there wasn't before
+                data["reply"] = data.get("reply", llsd.LLSD("success"))
+            response = llsd.format_xml(data)
+            debug("success: %s", response)
+            self.send_response(200)
+            self.send_header("Content-type", "application/llsd+xml")
+            self.send_header("Content-Length", str(len(response)))
+            self.end_headers()
+            if withdata:
+                self.wfile.write(response)
+
+    if not VERBOSE:
+        # When VERBOSE is set, skip both these overrides because they exist to
+        # suppress output.
+
+        def log_request(self, code, size=None):
+            # For present purposes, we don't want the request splattered onto
+            # stderr, as it would upset devs watching the test run
+            pass
+
+        def log_error(self, format, *args):
+            # Suppress error output as well
+            pass
+
+class Server(HTTPServer):
+    # This pernicious flag is on by default in HTTPServer. But proper
+    # operation of freeport() absolutely depends on it being off.
+    allow_reuse_address = False
+
+if __name__ == "__main__":
+    # Instantiate a Server(TestHTTPRequestHandler) on the first free port
+    # in the specified port range. Doing this inline is better than in a
+    # daemon thread: if it blows up here, we'll get a traceback. If it blew up
+    # in some other thread, the traceback would get eaten and we'd run the
+    # subject test program anyway.
+    httpd, port = freeport(xrange(8000, 8020),
+                           lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler))
+    # Pass the selected port number to the subject test program via the
+    # environment. We don't want to impose requirements on the test program's
+    # command-line parsing -- and anyway, for C++ integration tests, that's
+    # performed in TUT code rather than our own.
+    os.environ["PORT"] = str(port)
+    debug("$PORT = %s", port)
+    sys.exit(run(server=Thread(name="httpd", target=httpd.serve_forever), *sys.argv[1:]))
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 27d8056ea26a5e62acdf66d9c4b926536b4f40a7..a53c3ca9b7b0659e6b7ffa5e52722449bd6f5632 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -58,13 +58,8 @@
 BOOL gDebugSession = FALSE;
 BOOL gDebugGL = FALSE;
 BOOL gClothRipple = FALSE;
-BOOL gHeadlessClient = FALSE;
 BOOL gGLActive = FALSE;
 
-static const std::string HEADLESS_VENDOR_STRING("Linden Lab");
-static const std::string HEADLESS_RENDERER_STRING("Headless");
-static const std::string HEADLESS_VERSION_STRING("1.0");
-
 std::ofstream gFailLog;
 
 #if GL_ARB_debug_output
@@ -188,6 +183,9 @@ PFNGLWAITSYNCPROC				glWaitSync = NULL;
 PFNGLGETINTEGER64VPROC			glGetInteger64v = NULL;
 PFNGLGETSYNCIVPROC				glGetSynciv = NULL;
 
+// GL_APPLE_flush_buffer_range
+PFNGLBUFFERPARAMETERIAPPLEPROC	glBufferParameteriAPPLE = NULL;
+PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE = NULL;
 
 // vertex object prototypes
 PFNGLNEWOBJECTBUFFERATIPROC			glNewObjectBufferATI = NULL;
@@ -786,19 +784,9 @@ void LLGLManager::setToDebugGPU()
 
 void LLGLManager::getGLInfo(LLSD& info)
 {
-	if (gHeadlessClient)
-	{
-		info["GLInfo"]["GLVendor"] = HEADLESS_VENDOR_STRING;
-		info["GLInfo"]["GLRenderer"] = HEADLESS_RENDERER_STRING;
-		info["GLInfo"]["GLVersion"] = HEADLESS_VERSION_STRING;
-		return;
-	}
-	else
-	{
-		info["GLInfo"]["GLVendor"] = std::string((const char *)glGetString(GL_VENDOR));
-		info["GLInfo"]["GLRenderer"] = std::string((const char *)glGetString(GL_RENDERER));
-		info["GLInfo"]["GLVersion"] = std::string((const char *)glGetString(GL_VERSION));
-	}
+	info["GLInfo"]["GLVendor"] = std::string((const char *)glGetString(GL_VENDOR));
+	info["GLInfo"]["GLRenderer"] = std::string((const char *)glGetString(GL_RENDERER));
+	info["GLInfo"]["GLVersion"] = std::string((const char *)glGetString(GL_VERSION));
 
 #if !LL_MESA_HEADLESS
 	std::string all_exts = ll_safe_string((const char *)gGLHExts.mSysExts);
@@ -815,18 +803,9 @@ std::string LLGLManager::getGLInfoString()
 {
 	std::string info_str;
 
-	if (gHeadlessClient)
-	{
-		info_str += std::string("GL_VENDOR      ") + HEADLESS_VENDOR_STRING + std::string("\n");
-		info_str += std::string("GL_RENDERER    ") + HEADLESS_RENDERER_STRING + std::string("\n");
-		info_str += std::string("GL_VERSION     ") + HEADLESS_VERSION_STRING + std::string("\n");
-	}
-	else
-	{
-		info_str += std::string("GL_VENDOR      ") + ll_safe_string((const char *)glGetString(GL_VENDOR)) + std::string("\n");
-		info_str += std::string("GL_RENDERER    ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n");
-		info_str += std::string("GL_VERSION     ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n");
-	}
+	info_str += std::string("GL_VENDOR      ") + ll_safe_string((const char *)glGetString(GL_VENDOR)) + std::string("\n");
+	info_str += std::string("GL_RENDERER    ") + ll_safe_string((const char *)glGetString(GL_RENDERER)) + std::string("\n");
+	info_str += std::string("GL_VERSION     ") + ll_safe_string((const char *)glGetString(GL_VERSION)) + std::string("\n");
 
 #if !LL_MESA_HEADLESS 
 	std::string all_exts= ll_safe_string(((const char *)gGLHExts.mSysExts));
@@ -839,18 +818,9 @@ std::string LLGLManager::getGLInfoString()
 
 void LLGLManager::printGLInfoString()
 {
-	if (gHeadlessClient)
-	{
-		LL_INFOS("RenderInit") << "GL_VENDOR:     " << HEADLESS_VENDOR_STRING << LL_ENDL;
-		LL_INFOS("RenderInit") << "GL_RENDERER:   " << HEADLESS_RENDERER_STRING << LL_ENDL;
-		LL_INFOS("RenderInit") << "GL_VERSION:    " << HEADLESS_VERSION_STRING << LL_ENDL;
-	}
-	else
-	{
-		LL_INFOS("RenderInit") << "GL_VENDOR:     " << ((const char *)glGetString(GL_VENDOR)) << LL_ENDL;
-		LL_INFOS("RenderInit") << "GL_RENDERER:   " << ((const char *)glGetString(GL_RENDERER)) << LL_ENDL;
-		LL_INFOS("RenderInit") << "GL_VERSION:    " << ((const char *)glGetString(GL_VERSION)) << LL_ENDL;
-	}
+	LL_INFOS("RenderInit") << "GL_VENDOR:     " << ((const char *)glGetString(GL_VENDOR)) << LL_ENDL;
+	LL_INFOS("RenderInit") << "GL_RENDERER:   " << ((const char *)glGetString(GL_RENDERER)) << LL_ENDL;
+	LL_INFOS("RenderInit") << "GL_VERSION:    " << ((const char *)glGetString(GL_VERSION)) << LL_ENDL;
 
 #if !LL_MESA_HEADLESS
 	std::string all_exts= ll_safe_string(((const char *)gGLHExts.mSysExts));
@@ -862,14 +832,7 @@ void LLGLManager::printGLInfoString()
 std::string LLGLManager::getRawGLString()
 {
 	std::string gl_string;
-	if (gHeadlessClient)
-	{
-		gl_string = HEADLESS_VENDOR_STRING + " " + HEADLESS_RENDERER_STRING;
-	}
-	else
-	{
-		gl_string = ll_safe_string((char*)glGetString(GL_VENDOR)) + " " + ll_safe_string((char*)glGetString(GL_RENDERER));
-	}
+	gl_string = ll_safe_string((char*)glGetString(GL_VENDOR)) + " " + ll_safe_string((char*)glGetString(GL_RENDERER));
 	return gl_string;
 }
 
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 964495a3abce301eae301d196b1e3d917d0820db..d77c3ede068c4e19e75877d949398060e9554129 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -453,7 +453,6 @@ void init_glstates();
 void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific, std::string* version_string );
 
 extern BOOL gClothRipple;
-extern BOOL gHeadlessClient;
 extern BOOL gGLActive;
 
 // Deal with changing glext.h definitions for newer SDK versions, specifically
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index a4d7872ec25e0091152a4da7de8e60f2df09e5ed..d561f63544b1f2faa07dfa3e2c0e29d035e135b3 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1222,7 +1222,6 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
 //the texture is assiciate with some image by calling glTexImage outside LLImageGL
 BOOL LLImageGL::createGLTexture()
 {
-	if (gHeadlessClient) return FALSE;
 	if (gGLManager.mIsDisabled)
 	{
 		llwarns << "Trying to create a texture while GL is disabled!" << llendl;
@@ -1252,7 +1251,6 @@ BOOL LLImageGL::createGLTexture()
 
 BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category)
 {
-	if (gHeadlessClient) return FALSE;
 	if (gGLManager.mIsDisabled)
 	{
 		llwarns << "Trying to create a texture while GL is disabled!" << llendl;
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index d83278d87588abf63e51ded79bc01892231c79e7..9e4ad310c74a324836d045b6b40dbfa3588d484f 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -388,38 +388,28 @@ LLWindow* LLWindowManager::createWindow(
 	BOOL fullscreen, 
 	BOOL clearBg,
 	BOOL disable_vsync,
-	BOOL use_gl,
 	BOOL ignore_pixel_depth,
 	U32 fsaa_samples)
 {
 	LLWindow* new_window;
 
-	if (use_gl)
-	{
 #if LL_MESA_HEADLESS
-		new_window = new LLWindowMesaHeadless(callbacks,
-			title, name, x, y, width, height, flags, 
-			fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+	new_window = new LLWindowMesaHeadless(callbacks,
+		title, name, x, y, width, height, flags, 
+		fullscreen, clearBg, disable_vsync, ignore_pixel_depth);
 #elif LL_SDL
-		new_window = new LLWindowSDL(callbacks,
-			title, x, y, width, height, flags, 
-			fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+	new_window = new LLWindowSDL(callbacks,
+		title, x, y, width, height, flags, 
+		fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
 #elif LL_WINDOWS
-		new_window = new LLWindowWin32(callbacks,
-			title, name, x, y, width, height, flags, 
-			fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+	new_window = new LLWindowWin32(callbacks,
+		title, name, x, y, width, height, flags, 
+		fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
 #elif LL_DARWIN
-		new_window = new LLWindowMacOSX(callbacks,
-			title, name, x, y, width, height, flags, 
-			fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+	new_window = new LLWindowMacOSX(callbacks,
+		title, name, x, y, width, height, flags, 
+		fullscreen, clearBg, disable_vsync, ignore_pixel_depth, fsaa_samples);
 #endif
-	}
-	else
-	{
-		new_window = new LLWindowHeadless(callbacks,
-			title, name, x, y, width, height, flags, 
-			fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
-	}
 
 	if (FALSE == new_window->isValid())
 	{
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 4da87f4e068d64d90f5d039b8e9f3ca0fe890db5..e92b0fd387fbaae64ec0953ee44ea29954a6e4b7 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -265,7 +265,6 @@ class LLWindowManager
 		BOOL fullscreen = FALSE,
 		BOOL clearBg = FALSE,
 		BOOL disable_vsync = TRUE,
-		BOOL use_gl = TRUE,
 		BOOL ignore_pixel_depth = FALSE,
 		U32 fsaa_samples = 0);
 	static BOOL destroyWindow(LLWindow* window);
diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp
index e6e6bc67ff0ee0bc9dbf13c0e22f19a2012f463c..dbdb40f5b999d853af7612903d1fe4c15930aa61 100644
--- a/indra/llwindow/llwindowheadless.cpp
+++ b/indra/llwindow/llwindowheadless.cpp
@@ -35,7 +35,7 @@
 //
 LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
 							 U32 flags,  BOOL fullscreen, BOOL clear_background,
-							 BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
+							 BOOL disable_vsync, BOOL ignore_pixel_depth)
 	: LLWindow(callbacks, fullscreen, flags)
 {
 	// Initialize a headless keyboard.
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index 1f767f4c97d65716942ba819684b4fc217478951..72f9684ca38d5178a007c3f841c8743e71bb2a19 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -96,7 +96,7 @@ class LLWindowHeadless : public LLWindow
 		S32 x, S32 y, 
 		S32 width, S32 height,
 		U32 flags,  BOOL fullscreen, BOOL clear_background,
-		BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+		BOOL disable_vsync, BOOL ignore_pixel_depth);
 	virtual ~LLWindowHeadless();
 
 private:
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 97637c937fe6efe6e236dab40183113e6e8b177e..413a9df6169ec7bb5149a3f481417dd8fd9212ed 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -210,7 +210,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 							   const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
 							   S32 height, U32 flags,
 							   BOOL fullscreen, BOOL clearBg,
-							   BOOL disable_vsync, BOOL use_gl,
+							   BOOL disable_vsync,
 							   BOOL ignore_pixel_depth,
 							   U32 fsaa_samples)
 	: LLWindow(NULL, fullscreen, flags)
@@ -228,7 +228,6 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 	gKeyboard = new LLKeyboardMacOSX();
 	gKeyboard->setCallbacks(callbacks);
 
-	// Ignore use_gl for now, only used for drones on PC
 	mWindow = NULL;
 	mContext = NULL;
 	mPixelFormat = NULL;
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 52ba8b3bf3eb7f43c7044f08317aacc920887482..4484787a4ef571208e534e193f070e9ebf9c0a72 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -122,7 +122,7 @@ class LLWindowMacOSX : public LLWindow
 protected:
 	LLWindowMacOSX(LLWindowCallbacks* callbacks,
 		const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
-		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
 		BOOL ignore_pixel_depth,
 		U32 fsaa_samples);
 	~LLWindowMacOSX();
diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp
index 11c22ac94e5b41ab1dc0e6c7131dbf1a57cbb01c..2b668d3fc42a70b8e3568bd4b9a22a492c45b974 100644
--- a/indra/llwindow/llwindowmesaheadless.cpp
+++ b/indra/llwindow/llwindowmesaheadless.cpp
@@ -41,28 +41,25 @@ U16 *gMesaBuffer = NULL;
 LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
                                            const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
 							 U32 flags,  BOOL fullscreen, BOOL clearBg,
-							 BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
+							 BOOL disable_vsync, BOOL ignore_pixel_depth)
 	: LLWindow(callbacks, fullscreen, flags)
 {
-	if (use_gl)
-	{
-		llinfos << "MESA Init" << llendl;
-		mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL );
-
-		/* Allocate the image buffer */
-		mMesaBuffer = new unsigned char [width * height * 4 * MESA_CHANNEL_SIZE];
-		llassert(mMesaBuffer);
+	llinfos << "MESA Init" << llendl;
+	mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL );
 
-		gMesaBuffer = (U16*)mMesaBuffer;
+	/* Allocate the image buffer */
+	mMesaBuffer = new unsigned char [width * height * 4 * MESA_CHANNEL_SIZE];
+	llassert(mMesaBuffer);
 
-		/* Bind the buffer to the context and make it current */
-		if (!OSMesaMakeCurrent( mMesaContext, mMesaBuffer, MESA_CHANNEL_TYPE, width, height ))
-		{
-			llerrs << "MESA: OSMesaMakeCurrent failed!" << llendl;
-		}
+	gMesaBuffer = (U16*)mMesaBuffer;
 
-		llverify(gGLManager.initGL());
+	/* Bind the buffer to the context and make it current */
+	if (!OSMesaMakeCurrent( mMesaContext, mMesaBuffer, MESA_CHANNEL_TYPE, width, height ))
+	{
+		llerrs << "MESA: OSMesaMakeCurrent failed!" << llendl;
 	}
+
+	llverify(gGLManager.initGL());
 }
 
 
diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h
index bc8e25ec44618993dda5a272e752ee0a983f73c6..c8d2bf2824072804419b04c67a48c164e3c1292b 100644
--- a/indra/llwindow/llwindowmesaheadless.h
+++ b/indra/llwindow/llwindowmesaheadless.h
@@ -98,7 +98,7 @@ class LLWindowMesaHeadless : public LLWindow
 	LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
                          const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
 				  U32 flags,  BOOL fullscreen, BOOL clearBg,
-				  BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+				  BOOL disable_vsync, BOOL ignore_pixel_depth);
 	~LLWindowMesaHeadless();
 
 private:
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 3bf4a48cb6ddcb0e037a2662172f6dd164aabf27..de731df228cf1634ad561fd3bf20cd3d48ac4f90 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -186,7 +186,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
 			 const std::string& title, S32 x, S32 y, S32 width,
 			 S32 height, U32 flags,
 			 BOOL fullscreen, BOOL clearBg,
-			 BOOL disable_vsync, BOOL use_gl,
+			 BOOL disable_vsync,
 			 BOOL ignore_pixel_depth, U32 fsaa_samples)
 	: LLWindow(callbacks, fullscreen, flags),
 	  Lock_Display(NULL),
@@ -197,7 +197,6 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
 	gKeyboard->setCallbacks(callbacks);
 	// Note that we can't set up key-repeat until after SDL has init'd video
 
-	// Ignore use_gl for now, only used for drones on PC
 	mWindow = NULL;
 	mNeedsResize = FALSE;
 	mOverrideAspectRatio = 0.f;
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 4e2a269ea33b4587c903662e55106c05e22d8a8d..91ba73a0acf7413453792a4a0a86ecf33728ecb7 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -147,7 +147,7 @@ class LLWindowSDL : public LLWindow
 protected:
 	LLWindowSDL(LLWindowCallbacks* callbacks,
 		const std::string& title, int x, int y, int width, int height, U32 flags,
-		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
 		BOOL ignore_pixel_depth, U32 fsaa_samples);
 	~LLWindowSDL();
 
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 9a4dd41c4e789c87da8b6118ac99d8b16dca75d9..639ffb9d5655471e332adb54cbaa3901fee4b85e 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -362,7 +362,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
 							 const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
 							 S32 height, U32 flags, 
 							 BOOL fullscreen, BOOL clearBg,
-							 BOOL disable_vsync, BOOL use_gl,
+							 BOOL disable_vsync,
 							 BOOL ignore_pixel_depth,
 							 U32 fsaa_samples)
 	: LLWindow(callbacks, fullscreen, flags)
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 54c9ac4d4d182fd52349e67caeaf56fa92999b5c..aa7e2289bb278cbacc84f7f7509844282f11c5a5 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -118,7 +118,7 @@ class LLWindowWin32 : public LLWindow
 protected:
 	LLWindowWin32(LLWindowCallbacks* callbacks,
 		const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, 
-		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+		BOOL fullscreen, BOOL clearBg, BOOL disable_vsync,
 		BOOL ignore_pixel_depth, U32 fsaa_samples);
 	~LLWindowWin32();
 
diff --git a/indra/lscript/lscript_compile/CMakeLists.txt b/indra/lscript/lscript_compile/CMakeLists.txt
index 134703eed3ebb5001905ffd5c109be33edea0494..13cbd3ffd226062ded53acb4b2fbe978518d0ad4 100644
--- a/indra/lscript/lscript_compile/CMakeLists.txt
+++ b/indra/lscript/lscript_compile/CMakeLists.txt
@@ -113,8 +113,10 @@ if (WINDOWS)
         ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
       COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
+      ARGS
         ${BISON} ${M4_PATH}
-        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
+	-p indra_
+        -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/indra.y
       DEPENDS
         ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
diff --git a/indra/lscript/lscript_compile/bison.bat b/indra/lscript/lscript_compile/bison.bat
index 0baff4e5ef9c4bc6d98b36fd332d238542f29510..d40997225e01d8d744871d55002881587b966dbe 100644
--- a/indra/lscript/lscript_compile/bison.bat
+++ b/indra/lscript/lscript_compile/bison.bat
@@ -2,10 +2,11 @@
 @REM find m4, even if neither program is present in PATH.
 
 @set bison=%1
-set M4PATH=%2
+shift
+set M4PATH=%1
+shift
 set M4=
-@set output=%3
-@set input=%4
 
 set PATH=%M4PATH%;%PATH%
-%bison% -d -o %output% %input%
+@REM %* does not work with shift...
+%bison% %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 587435301dac1768a11f685732e8281145c17a0f..ce5180c0d29cdc172360a78020b1f821968fa082 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1319,11 +1319,11 @@ bool LLAppViewer::mainLoop()
 				// Scan keyboard for movement keys.  Command keys and typing
 				// are handled by windows callbacks.  Don't do this until we're
 				// done initializing.  JC
-				if ((gHeadlessClient || gViewerWindow->getWindow()->getVisible())
+				if (gViewerWindow->getWindow()->getVisible()
 					&& gViewerWindow->getActive()
 					&& !gViewerWindow->getWindow()->getMinimized()
 					&& LLStartUp::getStartupState() == STATE_STARTED
-					&& (gHeadlessClient || !gViewerWindow->getShowProgress())
+					&& !gViewerWindow->getShowProgress()
 					&& !gFocusMgr.focusLocked())
 				{
 					LLMemType mjk(LLMemType::MTYPE_JOY_KEY);
@@ -1371,8 +1371,7 @@ bool LLAppViewer::mainLoop()
 				}
 
 				// Render scene.
-				// *TODO: Should we run display() even during gHeadlessClient?  DK 2011-02-18
-				if (!LLApp::isExiting() && !gHeadlessClient)
+				if (!LLApp::isExiting())
 				{
 					pingMainloopTimeout("Main:Display");
 					gGLActive = TRUE;
@@ -2992,9 +2991,6 @@ bool LLAppViewer::initWindow()
 {
 	LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
 
-	// store setting in a global for easy access and modification
-	gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");
-
 	// always start windowed
 	BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index ab06b1f5aa3bb8593711e6d66c1f530fc4e0be36..561734aaaec3c825c5ee9d73600fd56e4435fe56 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -772,10 +772,6 @@ bool idle_startup()
 				gUserCredential = gLoginHandler.initializeLoginInfo();                 
 				display_startup();
 			}     
-			if (gHeadlessClient)
-			{
-				LL_WARNS("AppInit") << "Waiting at connection box in headless client.  Did you mean to add autologin params?" << LL_ENDL;
-			}
 			// Make sure the process dialog doesn't hide things
 			display_startup();
 			gViewerWindow->setShowProgress(FALSE);
@@ -3507,13 +3503,6 @@ bool process_login_success_response()
 
 void transition_back_to_login_panel(const std::string& emsg)
 {
-	if (gHeadlessClient && gSavedSettings.getBOOL("AutoLogin"))
-	{
-		LL_WARNS("AppInit") << "Failed to login!" << LL_ENDL;
-		LL_WARNS("AppInit") << emsg << LL_ENDL;
-		exit(0);
-	}
-
 	// Bounce back to the login screen.
 	reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
 	gSavedSettings.setBOOL("AutoLogin", FALSE);
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index cc697f8510e85282531f3b3e44b2734308fcd3e9..fae20b1c13ae4c161e8f007e73c9f65d05c92396 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -313,24 +313,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 	// Logic for forcing window updates if we're in drone mode.
 	//
 
-	// *TODO: Investigate running display() during gHeadlessClient.  See if this early exit is needed DK 2011-02-18
-	if (gHeadlessClient) 
-	{
-#if LL_WINDOWS
-		static F32 last_update_time = 0.f;
-		if ((gFrameTimeSeconds - last_update_time) > 1.f)
-		{
-			InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, FALSE);
-			last_update_time = gFrameTimeSeconds;
-		}
-#elif LL_DARWIN
-		// MBW -- Do something clever here.
-#endif
-		// Not actually rendering, don't bother.
-		return;
-	}
-
-
 	//
 	// Bail out if we're in the startup state and don't want to try to
 	// render the world.
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index c036fcc114152eb5e39cfba03d006fd1d71c2bf0..e399b45cba00d0b799cc03e09346e9bb7ec5e21c 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1524,7 +1524,6 @@ static LLFastTimer::DeclareTimer FTM_REGION_SHIFT("Region Shift");
 
 void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
 {
-	if (gHeadlessClient) return;
 	// This is called when we shift our origin when we cross region boundaries...
 	// We need to update many object caches, I'll document this more as I dig through the code
 	// cleaning things out...
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 0cad2e3ec6896fe80f65f5c5d84501ce840bda15..1780c2715a084396c2e537e77a25aa72e81bf2d5 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1385,43 +1385,6 @@ void LLViewerWindow::handleMenuSelect(LLWindow *window,  S32 menu_item)
 
 BOOL LLViewerWindow::handlePaint(LLWindow *window,  S32 x,  S32 y, S32 width,  S32 height)
 {
-	// *TODO: Enable similar information output for other platforms?  DK 2011-02-18
-#if LL_WINDOWS
-	if (gHeadlessClient)
-	{
-		HWND window_handle = (HWND)window->getPlatformWindow();
-		PAINTSTRUCT ps; 
-		HDC hdc; 
- 
-		RECT wnd_rect;
-		wnd_rect.left = 0;
-		wnd_rect.top = 0;
-		wnd_rect.bottom = 200;
-		wnd_rect.right = 500;
-
-		hdc = BeginPaint(window_handle, &ps); 
-		//SetBKColor(hdc, RGB(255, 255, 255));
-		FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255)));
-
-		std::string temp_str;
-		temp_str = llformat( "FPS %3.1f Phy FPS %2.1f Time Dil %1.3f",		/* Flawfinder: ignore */
-				LLViewerStats::getInstance()->mFPSStat.getMeanPerSec(),
-				LLViewerStats::getInstance()->mSimPhysicsFPS.getPrev(0),
-				LLViewerStats::getInstance()->mSimTimeDilation.getPrev(0));
-		S32 len = temp_str.length();
-		TextOutA(hdc, 0, 0, temp_str.c_str(), len); 
-
-
-		LLVector3d pos_global = gAgent.getPositionGlobal();
-		temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]);
-		len = temp_str.length();
-		TextOutA(hdc, 0, 25, temp_str.c_str(), len); 
-
-		TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61);
-		EndPaint(window_handle, &ps); 
-		return TRUE;
-	}
-#endif
 	return FALSE;
 }
 
@@ -1568,12 +1531,12 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 	resetSnapshotLoc();
 
 	// create window
+	const BOOL clear_bg = FALSE;
 	mWindow = LLWindowManager::createWindow(this,
 		p.title, p.name, p.x, p.y, p.width, p.height, 0,
 		p.fullscreen, 
-		gHeadlessClient,
+		clear_bg,
 		gSavedSettings.getBOOL("DisableVerticalSync"),
-		!gHeadlessClient,
 		p.ignore_pixel_depth,
 		gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
 
@@ -1717,7 +1680,6 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 
 void LLViewerWindow::initGLDefaults()
 {
-	if (gHeadlessClient) return;
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
 
 	if (!LLGLSLShader::sNoFixedFunction)
@@ -4997,11 +4959,6 @@ bool LLViewerWindow::onAlert(const LLSD& notify)
 {
 	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
 
-	if (gHeadlessClient)
-	{
-		llinfos << "Alert: " << notification->getName() << llendl;
-	}
-
 	// If we're in mouselook, the mouse is hidden and so the user can't click 
 	// the dialog buttons.  In that case, change to First Person instead.
 	if( gAgentCamera.cameraMouselook() )
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index e874373f9e6be30f0a914efaa3e9507bc9450157..61df5bc2ebf8b2e49033f7d7d6c783b1266a3b49 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1139,7 +1139,6 @@ void LLPipeline::releaseScreenBuffers()
 
 void LLPipeline::createGLBuffers()
 {
-	if (gHeadlessClient) return;
 	stop_glerror();
 	LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS);
 	assertInitialized();