Bug 1313281 - Part 6: Remove FenceHandle. r=sotaro
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 27 Oct 2016 21:02:12 +1300
changeset 362552 2d0a7bf026ed4aadcb17f9e1f9de0f1488b17cee
parent 362551 72f023146710175d724a27ce099f48a316ce5fdc
child 362553 642bd2b0839fe64e22d5494a951a0d42a637b8da
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-beta@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1313281
milestone52.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 1313281 - Part 6: Remove FenceHandle. r=sotaro
gfx/layers/Compositor.cpp
gfx/layers/Compositor.h
gfx/layers/client/TextureClient.h
gfx/layers/composite/TextureHost.h
gfx/layers/ipc/FenceUtils.cpp
gfx/layers/ipc/FenceUtils.h
gfx/layers/moz.build
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -600,16 +600,10 @@ Compositor::IsValid() const
   return !!mParent;
 }
 
 void
 Compositor::SetDispAcquireFence(Layer* aLayer)
 {
 }
 
-FenceHandle
-Compositor::GetReleaseFence()
-{
-  return FenceHandle();
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -12,17 +12,16 @@
 #include "mozilla/gfx/2D.h"             // for DrawTarget
 #include "mozilla/gfx/MatrixFwd.h"      // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize, Point
 #include "mozilla/gfx/Polygon.h"        // for Polygon3D
 #include "mozilla/gfx/Rect.h"           // for Rect, IntRect
 #include "mozilla/gfx/Types.h"          // for Float
 #include "mozilla/gfx/Triangle.h"       // for Triangle, TexturedTriangle
 #include "mozilla/layers/CompositorTypes.h"  // for DiagnosticTypes, etc
-#include "mozilla/layers/FenceUtils.h"  // for FenceHandle
 #include "mozilla/layers/LayersTypes.h"  // for LayersBackend
 #include "mozilla/widget/CompositorWidget.h"
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsRegion.h"
 #include <vector>
 #include "mozilla/WidgetUtils.h"
 
 /**
@@ -430,18 +429,16 @@ public:
    * Flush the current frame to the screen and tidy up.
    *
    * Derived class overriding this should call Compositor::EndFrame.
    */
   virtual void EndFrame();
 
   virtual void SetDispAcquireFence(Layer* aLayer);
 
-  virtual FenceHandle GetReleaseFence();
-
   /**
    * Post-rendering stuff if the rendering is done outside of this Compositor
    * e.g., by Composer2D.
    * aTransform is the transform from user space to window space.
    */
   virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) = 0;
 
   /**
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -12,17 +12,16 @@
 #include "ImageTypes.h"                 // for StereoMode
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/Attributes.h"         // for override
 #include "mozilla/DebugOnly.h"
 #include "mozilla/RefPtr.h"             // for RefPtr, RefCounted
 #include "mozilla/gfx/2D.h"             // for DrawTarget
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/gfx/Types.h"          // for SurfaceFormat
-#include "mozilla/layers/FenceUtils.h"  // for FenceHandle
 #include "mozilla/ipc/Shmem.h"          // for Shmem
 #include "mozilla/layers/AtomicRefCountedWithFinalize.h"
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags, etc
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "mozilla/gfx/CriticalSection.h"
@@ -282,20 +281,16 @@ public:
                 LayersBackend aLayersBackend,
                 TextureFlags aFlags = TextureFlags::DEFAULT,
                 TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const { return nullptr; }
 
   virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) { return false; };
 
   virtual bool ReadBack(TextureReadbackSink* aReadbackSink) { return false; }
 
-  /// Ideally this should not be exposed and users of TextureClient would use Lock/Unlock
-  /// preoperly but that requires a few changes to SharedSurface and maybe gonk video.
-  virtual void WaitForFence(FenceHandle* aFence) {};
-
   virtual void SyncWithObject(SyncObject* aFence) {};
 
   virtual TextureFlags GetTextureFlags() const { return TextureFlags::NO_FLAGS; }
 
 #ifdef XP_WIN
   virtual D3D11TextureData* AsD3D11TextureData() {
     return nullptr;
   }
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -12,17 +12,16 @@
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/Attributes.h"         // for override
 #include "mozilla/RefPtr.h"             // for RefPtr, already_AddRefed, etc
 #include "mozilla/gfx/2D.h"             // for DataSourceSurface
 #include "mozilla/gfx/Point.h"          // for IntSize, IntPoint
 #include "mozilla/gfx/Types.h"          // for SurfaceFormat, etc
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags, etc
-#include "mozilla/layers/FenceUtils.h"  // for FenceHandle
 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
 #include "mozilla/layers/LayersSurfaces.h"
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "mozilla/UniquePtr.h"          // for UniquePtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsRegion.h"                   // for nsIntRegion
deleted file mode 100644
--- a/gfx/layers/ipc/FenceUtils.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "FenceUtils.h"
-
-using namespace mozilla::layers;
-
-namespace IPC {
-
-void
-ParamTraits<FenceHandle>::Write(Message* aMsg,
-                                const paramType& aParam)
-{
-  FenceHandle handle = aParam;
-
-  MOZ_ASSERT(handle.IsValid());
-}
-
-bool
-ParamTraits<FenceHandle>::Read(const Message* aMsg,
-                               PickleIterator* aIter, paramType* aResult)
-{
-  return true;
-}
-
-} // namespace IPC
-
-namespace mozilla {
-namespace layers {
-
-FenceHandle::FenceHandle()
-  : mFence(new FdObj())
-{
-}
-
-FenceHandle::FenceHandle(FdObj* aFdObj)
-  : mFence(aFdObj)
-{
-  MOZ_ASSERT(aFdObj);
-}
-
-void
-FenceHandle::Merge(const FenceHandle& aFenceHandle)
-{
-}
-
-void
-FenceHandle::TransferToAnotherFenceHandle(FenceHandle& aFenceHandle)
-{
-  aFenceHandle.mFence = this->GetAndResetFdObj();
-}
-
-already_AddRefed<FenceHandle::FdObj>
-FenceHandle::GetAndResetFdObj()
-{
-  RefPtr<FdObj> fence = mFence;
-  mFence = new FdObj();
-  return fence.forget();
-}
-
-already_AddRefed<FenceHandle::FdObj>
-FenceHandle::GetDupFdObj()
-{
-  RefPtr<FdObj> fdObj;
-  if (IsValid()) {
-    fdObj = new FenceHandle::FdObj(dup(mFence->mFd));
-  } else {
-    fdObj = new FenceHandle::FdObj();
-  }
-  return fdObj.forget();
-}
-
-} // namespace layers
-} // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/ipc/FenceUtils.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef IPC_FencerUtils_h
-#define IPC_FencerUtils_h
-
-#include "ipc/IPCMessageUtils.h"
-#include "mozilla/RefPtr.h"             // for nsRefPtr
-
-namespace mozilla {
-namespace layers {
-
-class FenceHandle {
-public:
-  class FdObj {
-    NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FdObj)
-    friend class FenceHandle;
-  public:
-    FdObj()
-      : mFd(-1) {}
-    explicit FdObj(int aFd)
-      : mFd(aFd) {}
-    int GetAndResetFd()
-    {
-      int fd = mFd;
-      mFd = -1;
-      return fd;
-    }
-
-  private:
-    virtual ~FdObj() {
-      if (mFd != -1) {
-        close(mFd);
-      }
-    }
-
-    int mFd;
-  };
-
-  FenceHandle();
-
-  explicit FenceHandle(FdObj* aFdObj);
-
-  bool operator==(const FenceHandle& aOther) const {
-    return mFence.get() == aOther.mFence.get();
-  }
-
-  bool IsValid() const
-  {
-    return (mFence->mFd != -1);
-  }
-
-  void Merge(const FenceHandle& aFenceHandle);
-
-  void TransferToAnotherFenceHandle(FenceHandle& aFenceHandle);
-
-  already_AddRefed<FdObj> GetAndResetFdObj();
-
-  already_AddRefed<FdObj> GetDupFdObj();
-
-private:
-  RefPtr<FdObj> mFence;
-};
-
-} // namespace layers
-} // namespace mozilla
-
-namespace IPC {
-
-template <>
-struct ParamTraits<mozilla::layers::FenceHandle> {
-  typedef mozilla::layers::FenceHandle paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam);
-  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult);
-};
-
-} // namespace IPC
-
-#endif // IPC_FencerUtils_h
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -163,17 +163,16 @@ EXPORTS.mozilla.layers += [
     'ipc/APZChild.h',
     'ipc/APZCTreeManagerChild.h',
     'ipc/APZCTreeManagerParent.h',
     'ipc/CompositableForwarder.h',
     'ipc/CompositableTransactionParent.h',
     'ipc/CompositorBridgeChild.h',
     'ipc/CompositorBridgeParent.h',
     'ipc/CompositorThread.h',
-    'ipc/FenceUtils.h',
     'ipc/GonkNativeHandle.h',
     'ipc/GonkNativeHandleUtils.h',
     'ipc/ImageBridgeChild.h',
     'ipc/ImageBridgeParent.h',
     'ipc/ImageContainerChild.h',
     'ipc/ImageContainerParent.h',
     'ipc/ISurfaceAllocator.h',
     'ipc/KnowsCompositor.h',
@@ -332,17 +331,16 @@ UNIFIED_SOURCES += [
     'ipc/APZCTreeManagerChild.cpp',
     'ipc/APZCTreeManagerParent.cpp',
     'ipc/CompositableForwarder.cpp',
     'ipc/CompositableTransactionParent.cpp',
     'ipc/CompositorBench.cpp',
     'ipc/CompositorBridgeChild.cpp',
     'ipc/CompositorBridgeParent.cpp',
     'ipc/CompositorThread.cpp',
-    'ipc/FenceUtils.cpp',
     'ipc/ImageBridgeChild.cpp',
     'ipc/ImageBridgeParent.cpp',
     'ipc/ImageContainerChild.cpp',
     'ipc/ImageContainerParent.cpp',
     'ipc/ISurfaceAllocator.cpp',
     'ipc/LayerAnimationUtils.cpp',
     'ipc/LayerTransactionChild.cpp',
     'ipc/LayerTransactionParent.cpp',