Bug 721489 - Backout changeset 0cb6641ab21a for a more desirable fix.
authorBenoit Girard <b56girard@gmail.com>
Fri, 10 Feb 2012 15:12:35 -0500
changeset 92429 295fbbce99f057ba5b207025a90a76c163b72d25
parent 92428 2983e4b0c419d9552fc942ec145a33b06cefeb1e
child 92430 02a93a9ff51a5184fc9101ef2aebfc1c614a64f7
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs721489
milestone13.0a1
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 721489 - Backout changeset 0cb6641ab21a for a more desirable fix.
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/ipc/ShadowLayersParent.h
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/layers/opengl/LayerManagerOGL.h
gfx/thebes/gfxSharedImageSurface.h
widget/xpwidgets/nsBaseWidget.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -599,22 +599,16 @@ GLContext::InitExtensions()
 
 bool
 GLContext::IsExtensionSupported(const char *extension)
 {
     return ListHasExtension(fGetString(LOCAL_GL_EXTENSIONS), extension);
 }
 
 bool
-GLContext::PreferPowerOfTwoTextures()
-{
-    return Renderer() == RendererAdreno200;
-}
-
-bool
 GLContext::CanUploadSubTextures()
 {
     // There are certain GPUs that we don't want to use glTexSubImage2D on
     // because that function can be very slow and/or buggy
 
     return !(Renderer() == RendererAdreno200);
 }
 
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -699,22 +699,16 @@ public:
     }
 
     int Renderer() const {
         return mRenderer;
     }
 
     bool CanUploadSubTextures();
 
-    // Quirks mode to force the platform to use Power of Two.
-    // Currently provided only as a best effort. We're not in a
-    // state where we can yet quarante that the platform will honor
-    // this.
-    bool PreferPowerOfTwoTextures();
-
     /**
      * If this context wraps a double-buffered target, swap the back
      * and front buffers.  It should be assumed that after a swap, the
      * contents of the new back buffer are undefined.
      */
     virtual bool SwapBuffers() { return false; }
 
     /**
--- a/gfx/layers/ipc/PLayers.ipdl
+++ b/gfx/layers/ipc/PLayers.ipdl
@@ -69,24 +69,16 @@ namespace layers {
 
 // Create a shadow layer for |layer|
 struct OpCreateThebesLayer     { PLayer layer; };
 struct OpCreateContainerLayer  { PLayer layer; };
 struct OpCreateImageLayer      { PLayer layer; };
 struct OpCreateColorLayer      { PLayer layer; };
 struct OpCreateCanvasLayer     { PLayer layer; };
 
-struct LayerForwarderQuirks {
-  // 1 << 0 -> Use power of two Shmem for GPU that require it.
-  //           The other alternative would be to memcpy the Shmem
-  //           into a PoT buffer before the upload and wasting bandwidth.
-  // 1 << 1 -> Unused
-  uint32_t quirks;
-};
-
 struct SurfaceDescriptorD3D10 {
   WindowsHandle handle;
 };
 
 union SurfaceDescriptor {
   Shmem;
   SurfaceDescriptorD3D10;
   SurfaceDescriptorX11;
@@ -235,21 +227,16 @@ union EditReply {
 
 sync protocol PLayers {
   manager PRenderFrame or PCompositor;
   manages PLayer;
 
 parent:
   async PLayer();
 
-  // LayersBackend can request the quirks from the layer
-  // fowarder.
-  sync GetForwarderQuirks()
-    returns (LayerForwarderQuirks Quirks);
-
   sync Update(Edit[] cset)
     returns (EditReply[] reply);
 
   async __delete__();
 };
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -387,17 +387,17 @@ ShadowLayerForwarder::AllocBuffer(const 
                                   gfxSharedImageSurface** aBuffer)
 {
   NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
 
   gfxASurface::gfxImageFormat format = OptimalFormatFor(aContent);
   SharedMemory::SharedMemoryType shmemType = OptimalShmemType();
 
   nsRefPtr<gfxSharedImageSurface> back =
-    gfxSharedImageSurface::CreateUnsafe(mShadowManager, aSize, format, shmemType, mUsePoTShmem);
+    gfxSharedImageSurface::CreateUnsafe(mShadowManager, aSize, format, shmemType);
   if (!back)
     return false;
 
   *aBuffer = nsnull;
   back.swap(*aBuffer);
   return true;
 }
 
@@ -502,21 +502,16 @@ ShadowLayerForwarder::DestroySharedSurfa
 
 PLayerChild*
 ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
 {
   NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
   return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
 }
 
-LayerForwarderQuirks
-ShadowLayerManager::GetForwarderQuirks()
-{
-  return LayerForwarderQuirks(0);
-}
 
 void
 ShadowLayerManager::DestroySharedSurface(gfxSharedImageSurface* aSurface,
                                          PLayersParent* aDeallocator)
 {
   aDeallocator->DeallocShmem(aSurface->GetShmem());
 }
 
@@ -583,16 +578,10 @@ ShadowLayerManager::PlatformSyncBeforeRe
 #endif  // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
 
 bool
 IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
 {
   return SurfaceDescriptor::T__None != aSurface.type();
 }
 
-void
-ShadowLayerForwarder::SetForwarderQuirks(LayerForwarderQuirks aQuirks)
-{
-  mUsePoTShmem = aQuirks.quirks() & (1 << 0);
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -37,27 +37,25 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_layers_ShadowLayers_h
 #define mozilla_layers_ShadowLayers_h 1
 
 #include "gfxASurface.h"
-#include "ShadowLayers.h"
-#include "ShadowLayersManager.h"
+
 #include "ImageLayers.h"
 #include "Layers.h"
 
 class gfxSharedImageSurface;
 
 namespace mozilla {
 namespace layers {
 
-class LayerForwarderQuirks;
 class Edit;
 class EditReply;
 class OptionalThebesBuffer;
 class PLayerChild;
 class PLayersChild;
 class PLayersParent;
 class ShadowableLayer;
 class ShadowThebesLayer;
@@ -305,18 +303,16 @@ public:
   }
 
   /*
    * No need to use double buffer in system memory with GPU rendering,
    * texture used as front buffer.
    */
   bool ShouldDoubleBuffer() { return GetParentBackendType() == LayerManager::LAYERS_BASIC; }
 
-  void SetForwarderQuirks(LayerForwarderQuirks aQuirks);
-
 protected:
   ShadowLayerForwarder();
 
   PLayersChild* mShadowManager;
 
 private:
   bool PlatformAllocDoubleBuffer(const gfxIntSize& aSize,
                                    gfxASurface::gfxContentType aContent,
@@ -331,17 +327,16 @@ private:
   PlatformOpenDescriptor(const SurfaceDescriptor& aDescriptor);
 
   bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
 
   static void PlatformSyncBeforeUpdate();
 
   Transaction* mTxn;
   LayersBackend mParentBackend;
-  bool mUsePoTShmem;
 };
 
 
 class ShadowLayerManager : public LayerManager
 {
 public:
   virtual ~ShadowLayerManager() {}
 
@@ -359,18 +354,16 @@ public:
   virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer() = 0;
   /** CONSTRUCTION PHASE ONLY */
   virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer() = 0;
   /** CONSTRUCTION PHASE ONLY */
   virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer() = 0;
   /** CONSTRUCTION PHASE ONLY */
   virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer() = 0;
 
-  virtual LayerForwarderQuirks GetForwarderQuirks();
-
   static void PlatformSyncBeforeReplyUpdate();
 
 protected:
   ShadowLayerManager() {}
 
   bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
 };
 
--- a/gfx/layers/ipc/ShadowLayersParent.cpp
+++ b/gfx/layers/ipc/ShadowLayersParent.cpp
@@ -383,22 +383,16 @@ ShadowLayersParent::RecvUpdate(const Inf
   // other's buffer contents.
   ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
 
   mShadowLayersManager->ShadowLayersUpdated();
 
   return true;
 }
 
-bool
-ShadowLayersParent::RecvGetForwarderQuirks(mozilla::layers::LayerForwarderQuirks* aQuirks) {
-  *aQuirks = layer_manager()->GetForwarderQuirks();
-  return true;
-}
-
 PLayerParent*
 ShadowLayersParent::AllocPLayer()
 {
   return new ShadowLayerParent();
 }
 
 bool
 ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
--- a/gfx/layers/ipc/ShadowLayersParent.h
+++ b/gfx/layers/ipc/ShadowLayersParent.h
@@ -75,18 +75,16 @@ public:
 
   virtual void DestroySharedSurface(gfxSharedImageSurface* aSurface);
   virtual void DestroySharedSurface(SurfaceDescriptor* aSurface);
 
 protected:
   NS_OVERRIDE virtual bool RecvUpdate(const EditArray& cset,
                                       EditReplyArray* reply);
 
-  NS_OVERRIDE virtual bool RecvGetForwarderQuirks(mozilla::layers::LayerForwarderQuirks* aQuirks);
-
   NS_OVERRIDE virtual PLayerParent* AllocPLayer();
   NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);
 
 private:
   nsRefPtr<ShadowLayerManager> mLayerManager;
   ShadowLayersManager* mShadowLayersManager;
   // Hold the root because it might be grafted under various
   // containers in the "real" layer tree
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -916,27 +916,16 @@ LayerManagerOGL::GetWorldTransform(void)
 void
 LayerManagerOGL::WorldTransformRect(nsIntRect& aRect)
 {
   gfxRect grect(aRect.x, aRect.y, aRect.width, aRect.height);
   grect = mWorldMatrix.TransformBounds(grect);
   aRect.SetRect(grect.X(), grect.Y(), grect.Width(), grect.Height());
 }
 
-LayerForwarderQuirks
-LayerManagerOGL::GetForwarderQuirks()
-{
-  uint16_t quirks = 0;
-  if (mGLContext->PreferPowerOfTwoTextures()) {
-    quirks |= 1 << 0;
-  }
-
-  return LayerForwarderQuirks(quirks);
-}
-
 void
 LayerManagerOGL::SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy)
 {
   // Set the viewport correctly. 
   mGLContext->fViewport(0, 0, aWidth, aHeight);
 
   // We flip the view matrix around so that everything is right-side up; we're
   // drawing directly into the window's back buffer, so this keeps things
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -392,18 +392,16 @@ public:
    * Setup World transform matrix.
    * Transform will be ignored if it is not PreservesAxisAlignedRectangles
    * or has non integer scale
    */
   void SetWorldTransform(const gfxMatrix& aMatrix);
   gfxMatrix& GetWorldTransform(void);
   void WorldTransformRect(nsIntRect& aRect);
 
-  LayerForwarderQuirks GetForwarderQuirks();
-
 private:
   /** Widget associated with this layer manager */
   nsIWidget *mWidget;
   nsIntSize mWidgetSize;
 
   /** 
    * Context target, NULL when drawing directly to our swap chain.
    */
--- a/gfx/thebes/gfxSharedImageSurface.h
+++ b/gfx/thebes/gfxSharedImageSurface.h
@@ -80,21 +80,19 @@ public:
     static already_AddRefed<gfxSharedImageSurface>
     Open(const Shmem& aShmem);
 
     template<class ShmemAllocator>
     static already_AddRefed<gfxSharedImageSurface>
     CreateUnsafe(ShmemAllocator* aAllocator,
                  const gfxIntSize& aSize,
                  gfxImageFormat aFormat,
-                 SharedMemory::SharedMemoryType aShmType = SharedMemory::TYPE_BASIC,
-                 bool aUsePoTSharedSurface = false)
+                 SharedMemory::SharedMemoryType aShmType = SharedMemory::TYPE_BASIC)
     {
-        return Create<ShmemAllocator, true>(aAllocator, aSize, aFormat,
-                                            aShmType, aUsePoTSharedSurface);
+        return Create<ShmemAllocator, true>(aAllocator, aSize, aFormat, aShmType);
     }
 
     Shmem& GetShmem() { return mShmem; }
 
     static bool IsSharedImage(gfxASurface *aSurface);
 
 private:
     gfxSharedImageSurface(const gfxIntSize&, gfxImageFormat, const Shmem&);
@@ -103,40 +101,24 @@ private:
 
     static size_t GetAlignedSize(const gfxIntSize&, long aStride);
 
     template<class ShmemAllocator, bool Unsafe>
     static already_AddRefed<gfxSharedImageSurface>
     Create(ShmemAllocator* aAllocator,
            const gfxIntSize& aSize,
            gfxImageFormat aFormat,
-           SharedMemory::SharedMemoryType aShmType,
-           bool aUsePoTSharedSurface = false)
+           SharedMemory::SharedMemoryType aShmType)
     {
         if (!CheckSurfaceSize(aSize))
             return nsnull;
 
         Shmem shmem;
-        long stride;
-        size_t size;
-        if (aUsePoTSharedSurface) {
-            printf_stderr("Buffer PoT\n");
-            int potW = 1;
-            while( potW < aSize.width ) potW <<= 1;
-            int potH = 1;
-            while( potH < aSize.height ) potH <<= 1;
-
-            stride = ComputeStride(gfxIntSize(potW, potH), aFormat);
-            size = GetAlignedSize(gfxIntSize(potW, potH), stride);
-        } else {
-            printf_stderr("Buffer NOT PoT\n");
-            stride = ComputeStride(aSize, aFormat);
-            size = GetAlignedSize(aSize, stride);
-        }
-
+        long stride = ComputeStride(aSize, aFormat);
+        size_t size = GetAlignedSize(aSize, stride);
         if (!Unsafe) {
             if (!aAllocator->AllocShmem(size, aShmType, &shmem))
                 return nsnull;
         } else {
             if (!aAllocator->AllocUnsafeShmem(size, aShmType, &shmem))
                 return nsnull;
         }
 
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/Util.h"
 
 #include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/CompositorParent.h"
-#include "mozilla/layers/PLayersChild.h"
 #include "nsBaseWidget.h"
 #include "nsDeviceContext.h"
 #include "nsCOMPtr.h"
 #include "nsGfxCIID.h"
 #include "nsWidgetsCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIScreenManager.h"
 #include "nsAppDirectoryServiceDefs.h"
@@ -853,22 +852,18 @@ void nsBaseWidget::CreateCompositor()
     MessageLoop *childMessageLoop = mCompositorThread->message_loop();
     mCompositorChild = new CompositorChild(lm);
     AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
     AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
     mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
     PLayersChild* shadowManager =
       mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL);
 
-    LayerForwarderQuirks forwarderQuirk;
-    shadowManager->SendGetForwarderQuirks(&forwarderQuirk);
-
     if (shadowManager) {
       ShadowLayerForwarder* lf = lm->AsShadowForwarder();
-      lf->SetForwarderQuirks(forwarderQuirk);
       if (!lf) {
         delete lm;
         mCompositorChild = nsnull;
         return;
       }
       lf->SetShadowManager(shadowManager);
       lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);