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

MozReview-Commit-ID: 94PQA67fvoJ

--HG--
extra : rebase_source : 58b07b7c5d1f7c5bac729d18842655b3c620eba4
This commit is contained in:
dmu@mozilla.com 2017-05-24 11:01:45 +00:00
Родитель 1af1ee19d6
Коммит 5a72ace401
3 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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*/);