gecko-dev/gfx/layers/TextureSync.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 строки
1.6 KiB
C
Исходник Обычный вид История

Bug 1265824 - Wait on texture handles with IPC r=jld,mattwoodrow There's a lot going on here, but it all fits under the idea of being able to communicate about texture locking statuses without spinning on IsReadLocked. This is a bit of a trade - we could just always allocate/grab a texture from the pool, which would put a smaller cap on the amount of time we can possibly spend when a texture is locked. However, this eats up more CPU and memory than waiting on the textures to unlock, and could take longer, especially if there were a large number of textures which we just need to wait for for a short amount of time. In any case, we very rarely hit the case where we actually need to wait on the sync IPC to the compositor - most of the time the textures are already unlocked. There is also an async IPC call in here, which we make before flushing async paints. This just causes the compositor to check whether the GPU is done with its textures or not and unlock them if it is. This helps us avoid the case where we take a long time painting asynchronously, turn IPC back on at the end of that, and then have to wait for the compositor to to get into TiledLayerBufferComposite::UseTiles before getting a response. Specifically this eliminates several talos regressions which use ASAP mode. Lastly, there seem to be no other cases of static Monitors being used. This seems like it falls under similar use cases as StaticMutexes, so I added it in. I can move it into its own file if we think it might be generally useful in the future. MozReview-Commit-ID: IYQLwUqMxg2 --HG-- extra : rebase_source : 4f05832f51dae6db98773dcad03cb008a80eca6c
2018-05-06 01:46:26 +03:00
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 MOZILLA_LAYERS_TEXTURESYNC_H
#define MOZILLA_LAYERS_TEXTURESYNC_H
#include "base/process.h"
#include "nsTArray.h"
#include "mozilla/layers/TextureSourceProvider.h"
#include "SharedMemory.h"
class MachReceiveMessage;
namespace mozilla {
namespace ipc {
struct MemoryPorts;
} // namespace ipc
namespace layers {
class TextureSync {
public:
static void RegisterTextureSourceProvider(
layers::TextureSourceProvider* aTextureSourceProvider);
static void UnregisterTextureSourceProvider(
layers::TextureSourceProvider* aTextureSourceProvider);
static void DispatchCheckTexturesForUnlock();
static void HandleWaitForTexturesMessage(MachReceiveMessage* rmsg,
ipc::MemoryPorts* ports);
static void UpdateTextureLocks(base::ProcessId aProcessId);
static bool WaitForTextures(base::ProcessId aProcessId,
const nsTArray<uint64_t>& aTextureIds);
static void SetTexturesLocked(base::ProcessId aProcessId,
const nsTArray<uint64_t>& aTextureIds);
static void SetTexturesUnlocked(base::ProcessId aProcessId,
const nsTArray<uint64_t>& aTextureIds);
static void Shutdown();
static void CleanupForPid(base::ProcessId aProcessId);
};
} // namespace layers
} // namespace mozilla
#endif