Ejemplo n.º 1
0
void
CanvasClientSharedSurface::Updated()
{
  if (!mNewFront) {
    return;
  }

  auto forwarder = GetForwarder();

#ifndef MOZ_WIDGET_GONK
  if (mFront) {
    if (mFront->GetFlags() & TextureFlags::RECYCLE) {
      mFront->WaitForCompositorRecycle();
    }
  }
#else
  // AutoRemoveTexture does the followings.
  // - Ensure to deliver FenceHandle from TextureHost to TextureClient, before
  //   next TextureClient usage.
  // - Control TextureClient's recycling timing.
  // - Call RemoveTexture() after newFront's UseTextures() call.
  //   It could improve performance of Host side's EGL handling on gonk
  AutoRemoveTexture autoRemove(this);
  if (mFront && mFront != mNewFront) {
    autoRemove.mTexture = mFront;
  }
#endif

  mFront = mNewFront;
  mNewFront = nullptr;

  // Add the new TexClient.
  MOZ_ALWAYS_TRUE( AddTextureClient(mFront) );

  AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
  CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
  t->mTextureClient = mFront;
  t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
  t->mFrameID = mFrameID;
  // XXX TODO - This reference to VRManagerChild will be moved with the
  //            implementation of the WebVR 1.0 API, which will enable
  //            the inputFrameID to be passed through Javascript with
  //            the new VRDisplay API.
  t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
  forwarder->UseTextures(this, textures);
}
Ejemplo n.º 2
0
void
CanvasClientSharedSurface::Updated()
{
  if (!mNewFront) {
    return;
  }

  auto forwarder = GetForwarder();

#ifndef MOZ_WIDGET_GONK
  if (mFront) {
    if (mFront->GetFlags() & TextureFlags::RECYCLE) {
      mFront->WaitForCompositorRecycle();
    }
  }
#else
  // AutoRemoveTexture does the followings.
  // - Ensure to deliver FenceHandle from TextureHost to TextureClient, before
  //   next TextureClient usage.
  // - Control TextureClient's recycling timing.
  // - Call RemoveTexture() after newFront's UseTextures() call.
  //   It could improve performance of Host side's EGL handling on gonk
  AutoRemoveTexture autoRemove(this);
  if (mFront && mFront != mNewFront) {
    autoRemove.mTexture = mFront;
  }
#endif

  mFront = mNewFront;
  mNewFront = nullptr;

  // Add the new TexClient.
  MOZ_ALWAYS_TRUE( AddTextureClient(mFront) );

  nsAutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
  CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
  t->mTextureClient = mFront;
  t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
  t->mFrameID = mFrameID;
  forwarder->UseTextures(this, textures);
}