Bug 1366941 - Checking LayersIPCChannel type when using recycled textureClient; r=nical

MozReview-Commit-ID: AJUJIC2tkHC

--HG--
extra : rebase_source : 259b8c9f63313dcb5c2291bacb4bcfdc04e757b1
This commit is contained in:
Daosheng Mu 2017-06-01 13:34:00 +08:00
parent dbea6f45b8
commit e10b834325
3 changed files with 15 additions and 6 deletions

View File

@ -2352,7 +2352,7 @@ WebGLContext::GetVRFrame()
if (sharedSurface && sharedSurface->GetAllocator() != vrmc) {
RefPtr<SharedSurfaceTextureClient> dest =
screen->Factory()->NewTexClient(sharedSurface->GetSize());
screen->Factory()->NewTexClient(sharedSurface->GetSize(), vrmc);
if (!dest) {
return nullptr;
}

View File

@ -17,6 +17,7 @@
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/Unused.h"
#include "VRManagerChild.h"
namespace mozilla {
namespace gl {
@ -317,15 +318,22 @@ SurfaceFactory::~SurfaceFactory()
}
already_AddRefed<layers::SharedSurfaceTextureClient>
SurfaceFactory::NewTexClient(const gfx::IntSize& size)
SurfaceFactory::NewTexClient(const gfx::IntSize& size, const layers::LayersIPCChannel* aLayersChannel)
{
while (!mRecycleFreePool.empty()) {
RefPtr<layers::SharedSurfaceTextureClient> cur = mRecycleFreePool.front();
mRecycleFreePool.pop();
if (cur->Surf()->mSize == size) {
cur->Surf()->WaitForBufferOwnership();
return cur.forget();
if (cur->Surf()->mSize == size){
// In the general case, textureClients transit textures through
// CompositorForwarder. But, the textureClient created by VRManagerChild
// has a different LayerIPCChannel, PVRManager. Therefore, textureClients
// need to be separated into different cases.
if (aLayersChannel && (aLayersChannel == cur->GetAllocator()) ||
cur->GetAllocator() != gfx::VRManagerChild::Get()) {
cur->Surf()->WaitForBufferOwnership();
return cur.forget();
}
}
StopRecycling(cur);

View File

@ -306,7 +306,8 @@ protected:
public:
UniquePtr<SharedSurface> NewSharedSurface(const gfx::IntSize& size);
//already_AddRefed<ShSurfHandle> NewShSurfHandle(const gfx::IntSize& size);
already_AddRefed<layers::SharedSurfaceTextureClient> NewTexClient(const gfx::IntSize& size);
already_AddRefed<layers::SharedSurfaceTextureClient> NewTexClient(const gfx::IntSize& size,
const layers::LayersIPCChannel* aLayersChannel = nullptr);
static void RecycleCallback(layers::TextureClient* tc, void* /*closure*/);