Bug 569490 Don't build D3D9 layer if we can't find d3d9.h r=ted,jmuizelaar
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 06 Jun 2010 11:37:44 +0100
changeset 43174 7ebd45a023607518a858daed83d0f0de47901032
parent 43173 ac1ed3f6b2e71637e562866867c9ac571d2cb283
child 43175 b6126b690acd4889770b3df6628d28d79fc9ef88
push idunknown
push userunknown
push dateunknown
reviewersted, jmuizelaar
bugs569490
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 569490 Don't build D3D9 layer if we can't find d3d9.h r=ted,jmuizelaar
config/autoconf.mk.in
configure.in
gfx/layers/Makefile.in
gfx/thebes/src/Makefile.in
gfx/thebes/src/gfxDllDeps.cpp
widget/src/windows/Makefile.in
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindowGfx.cpp
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -507,16 +507,17 @@ CAIRO_FT_CFLAGS		= @CAIRO_FT_CFLAGS@
 MOZ_TREE_FREETYPE		= @MOZ_TREE_FREETYPE@
 MOZ_ENABLE_CAIRO_FT	= @MOZ_ENABLE_CAIRO_FT@
 MOZ_ENABLE_GTK2		= @MOZ_ENABLE_GTK2@
 MOZ_ENABLE_QT		= @MOZ_ENABLE_QT@
 MOZ_ENABLE_PHOTON	= @MOZ_ENABLE_PHOTON@
 MOZ_ENABLE_XREMOTE	= @MOZ_ENABLE_XREMOTE@
 MOZ_ENABLE_DWRITE_FONT	= @MOZ_ENABLE_DWRITE_FONT@
 MOZ_ENABLE_D2D_SURFACE	= @MOZ_ENABLE_D2D_SURFACE@
+MOZ_ENABLE_D3D9_LAYER	= @MOZ_ENABLE_D3D9_LAYER@
 
 MOZ_GTK2_CFLAGS		= @MOZ_GTK2_CFLAGS@
 MOZ_GTK2_LIBS		= @MOZ_GTK2_LIBS@
 
 MOZ_QT_CFLAGS		= @MOZ_QT_CFLAGS@
 MOZ_QT_LIBS		= @MOZ_QT_LIBS@
 
 MOZ_DBUS_CFLAGS         = @MOZ_DBUS_CFLAGS@
--- a/configure.in
+++ b/configure.in
@@ -8195,16 +8195,18 @@ if test "$MOZ_TREE_CAIRO"; then
                 WIN32_D2D_SURFACE_FEATURE=
             fi
         else
             WIN32_FONT_FEATURE=
             WIN32_DWRITE_FONT_FEATURE=
             WIN32_D2D_SURFACE_FEATURE=
         fi
 
+        AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
+
         AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
         if test -z "$HAS_DDRAW"; then
             AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface.  If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
             DDRAW_SURFACE_FEATURE=
         else
             DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
         fi
 
@@ -8242,16 +8244,17 @@ if test "$MOZ_TREE_CAIRO"; then
         MOZ_ENABLE_CAIRO_FT=1
     fi
     if test "$USE_FC_FREETYPE"; then
         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
     fi
     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
+    AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
     AC_SUBST(CAIRO_FT_CFLAGS)
     AC_SUBST(HAS_OGLES)
 
     if test "$MOZ_DEBUG"; then
       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
     else
       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
     fi
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -72,17 +72,17 @@ CPPSRCS = \
         ColorLayerOGL.cpp \
         ThebesLayerOGL.cpp \
         ContainerLayerOGL.cpp \
         ImageLayerOGL.cpp \
 	CanvasLayerOGL.cpp \
         $(NULL)
  
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-ifndef WINCE
+ifdef MOZ_ENABLE_D3D9_LAYER
 EXPORTS += LayerManagerD3D9.h
 
 CPPSRCS += \
         LayerManagerD3D9.cpp \
         ThebesLayerD3D9.cpp \
         ContainerLayerD3D9.cpp \
         ImageLayerD3D9.cpp \
         ColorLayerD3D9.cpp \
--- a/gfx/thebes/src/Makefile.in
+++ b/gfx/thebes/src/Makefile.in
@@ -104,16 +104,20 @@ endif
 
 CPPSRCS +=	gfxPDFSurface.cpp
 
 ifdef GNU_CXX
 _OS_LIBS	+= uuid
 endif
 OS_LIBS		+= $(call EXPAND_LIBNAME,$(_OS_LIBS))
 
+ifdef MOZ_ENABLE_D3D9_LAYER
+DEFINES +=	-DMOZ_ENABLE_D3D9_LAYER
+endif
+
 ACDEFINES +=	-UWIN32_LEAN_AND_MEAN
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
 CPPSRCS += \
 	gfxAndroidPlatform.cpp \
 	gfxFT2Fonts.cpp \
 	gfxFT2FontBase.cpp \
--- a/gfx/thebes/src/gfxDllDeps.cpp
+++ b/gfx/thebes/src/gfxDllDeps.cpp
@@ -1,19 +1,19 @@
 #include "Layers.h"
 #include "LayerManagerOGL.h"
 #include "BasicLayers.h"
 #include "ImageLayers.h"
-#if defined(XP_WIN) && !defined(WINCE)
+#ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
 
 using namespace mozilla;
 using namespace layers;
 
 void XXXNeverCalled_Layers()
 {
   BasicLayerManager(nsnull);
   LayerManagerOGL(nsnull);
-#if defined(XP_WIN) && !defined(WINCE)
+#ifdef MOZ_ENABLE_D3D9_LAYER
   LayerManagerD3D9(nsnull);
 #endif
 }
--- a/widget/src/windows/Makefile.in
+++ b/widget/src/windows/Makefile.in
@@ -103,16 +103,20 @@ CPPSRCS += \
 ifdef NS_ENABLE_TSF
 CPPSRCS		+= nsTextStore.cpp
 endif
 endif
 
 
 DEFINES		+= -D_IMPL_NS_WIDGET -DMOZ_UNICODE 
 
+ifdef MOZ_ENABLE_D3D9_LAYER
+DEFINES		+= -DMOZ_ENABLE_D3D9_LAYER
+endif
+
 ifdef BUILD_STATIC_LIBS
 DEFINES		+= -DMOZ_STATIC_COMPONENT_LIBS
 endif # BUILD_STATIC_LIBS
 
 
 EXPORTS		= nsdefs.h WindowHook.h
 
 LOCAL_INCLUDES	= \
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -164,17 +164,19 @@
 #if defined(WINCE_WINDOWS_MOBILE)
 #define KILL_PRIORITY_ID 2444
 #endif
 
 #include "nsWindowGfx.h"
 #include "gfxWindowsPlatform.h"
 #include "Layers.h"
 #ifndef WINCE
+#ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
+#endif
 #include "LayerManagerOGL.h"
 #endif
 
 #if !defined(WINCE)
 #include "nsUXThemeConstants.h"
 #include "nsKeyboardLayout.h"
 #include "nsNativeDragTarget.h"
 #include <mmsystem.h> // needed for WIN32_LEAN_AND_MEAN
@@ -2939,26 +2941,28 @@ nsWindow::GetLayerManager()
       if (prefs) {
         prefs->GetBoolPref("mozilla.widget.accelerated-layers",
                            &allowAcceleration);
         prefs->GetBoolPref("mozilla.layers.prefer-opengl",
                            &preferOpenGL);
       }
       
       if (allowAcceleration) {
-        if (preferOpenGL) {
-          nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
-            new mozilla::layers::LayerManagerOGL(this);
+#ifdef MOZ_ENABLE_D3D9_LAYER
+        if (!preferOpenGL) {
+          nsRefPtr<mozilla::layers::LayerManagerD3D9> layerManager =
+            new mozilla::layers::LayerManagerD3D9(this);
           if (layerManager->Initialize()) {
             mLayerManager = layerManager;
           }
         }
+#endif
         if (!mLayerManager) {
-          nsRefPtr<mozilla::layers::LayerManagerD3D9> layerManager =
-            new mozilla::layers::LayerManagerD3D9(this);
+          nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
+            new mozilla::layers::LayerManagerOGL(this);
           if (layerManager->Initialize()) {
             mLayerManager = layerManager;
           }
         }
       }
     }
   }
 #endif
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -66,17 +66,17 @@ using mozilla::plugins::PluginInstancePa
 #include "gfxWindowsPlatform.h"
 #include "nsGfxCIID.h"
 #include "gfxContext.h"
 #include "nsIRenderingContext.h"
 #include "nsIDeviceContext.h"
 #include "prmem.h"
 
 #include "LayerManagerOGL.h"
-#ifndef WINCE
+#ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
 
 #ifndef WINCE
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
 #endif
 
@@ -675,17 +675,17 @@ DDRAW_FAILED:
           }
         }
         break;
       case LayerManager::LAYERS_OPENGL:
         static_cast<mozilla::layers::LayerManagerOGL*>(GetLayerManager())->
           SetClippingRegion(event.region);
         result = DispatchWindowEvent(&event, eventStatus);
         break;
-#ifndef WINCE
+#ifdef MOZ_ENABLE_D3D9_LAYER
       case LayerManager::LAYERS_D3D9:
         static_cast<mozilla::layers::LayerManagerD3D9*>(GetLayerManager())->
           SetClippingRegion(event.region);
         result = DispatchWindowEvent(&event, eventStatus);
         break;
 #endif
       default:
         NS_ERROR("Unknown layers backend used!");