Commit 2992e56e authored by alexst's avatar alexst Committed by Commit bot

We need to cleanup GpuMemoryBuffers allocated in the GPU process.

This code conditionally stashes a sync point for buffer types that require it for the destruction phase.

BUG=416873

Review URL: https://codereview.chromium.org/654223006

Cr-Commit-Position: refs/heads/master@{#302561}
parent 84beeaa3
......@@ -93,4 +93,9 @@ TestGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer);
}
void TestGpuMemoryBufferManager::SetDestructionSyncPoint(
gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) {
}
} // namespace cc
......@@ -21,6 +21,8 @@ class TestGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
gfx::GpuMemoryBuffer::Usage usage) override;
gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
ClientBuffer buffer) override;
void SetDestructionSyncPoint(gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) override;
private:
DISALLOW_COPY_AND_ASSIGN(TestGpuMemoryBufferManager);
......
......@@ -110,10 +110,13 @@ BrowserGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
void BrowserGpuMemoryBufferManager::ChildProcessDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process_handle) {
base::ProcessHandle child_process_handle,
int child_client_id,
uint32 sync_point) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
GpuMemoryBufferImpl::DeletedByChildProcess(type, id, child_process_handle);
GpuMemoryBufferImpl::DeletedByChildProcess(
type, id, child_process_handle, child_client_id, sync_point);
}
void BrowserGpuMemoryBufferManager::ProcessRemoved(
......@@ -143,4 +146,11 @@ void BrowserGpuMemoryBufferManager::GpuMemoryBufferCreatedOnIO(
request->event.Signal();
}
void BrowserGpuMemoryBufferManager::SetDestructionSyncPoint(
gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) {
static_cast<GpuMemoryBufferImpl*>(buffer)
->set_destruction_sync_point(sync_point);
}
} // namespace content
......@@ -30,6 +30,8 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
gfx::GpuMemoryBuffer::Usage usage) override;
gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
ClientBuffer buffer) override;
void SetDestructionSyncPoint(gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) override;
void AllocateGpuMemoryBufferForChildProcess(
const gfx::Size& size,
......@@ -41,7 +43,9 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
void ChildProcessDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process_handle);
base::ProcessHandle child_process_handle,
int child_client_id,
uint32 sync_point);
void ProcessRemoved(base::ProcessHandle process_handle);
private:
......
......@@ -24,6 +24,24 @@ void GpuMemoryBufferFactoryHostImpl::CreateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Format format,
gfx::GpuMemoryBuffer::Usage usage,
const CreateGpuMemoryBufferCallback& callback) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(&GpuMemoryBufferFactoryHostImpl::CreateGpuMemoryBufferOnIO,
base::Unretained(this),
handle,
size,
format,
usage,
callback));
}
void GpuMemoryBufferFactoryHostImpl::CreateGpuMemoryBufferOnIO(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::GpuMemoryBuffer::Format format,
gfx::GpuMemoryBuffer::Usage usage,
const CreateGpuMemoryBufferCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
......@@ -48,6 +66,18 @@ void GpuMemoryBufferFactoryHostImpl::CreateGpuMemoryBuffer(
void GpuMemoryBufferFactoryHostImpl::DestroyGpuMemoryBuffer(
const gfx::GpuMemoryBufferHandle& handle,
int32 sync_point) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(&GpuMemoryBufferFactoryHostImpl::DestroyGpuMemoryBufferOnIO,
base::Unretained(this),
handle,
sync_point));
}
void GpuMemoryBufferFactoryHostImpl::DestroyGpuMemoryBufferOnIO(
const gfx::GpuMemoryBufferHandle& handle,
int32 sync_point) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
......
......@@ -30,6 +30,13 @@ class CONTENT_EXPORT GpuMemoryBufferFactoryHostImpl
void set_gpu_host_id(int gpu_host_id) { gpu_host_id_ = gpu_host_id; }
private:
void CreateGpuMemoryBufferOnIO(const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::GpuMemoryBuffer::Format format,
gfx::GpuMemoryBuffer::Usage usage,
const CreateGpuMemoryBufferCallback& callback);
void DestroyGpuMemoryBufferOnIO(const gfx::GpuMemoryBufferHandle& handle,
int32 sync_point);
void OnGpuMemoryBufferCreated(uint32 request_id,
const gfx::GpuMemoryBufferHandle& handle);
......
......@@ -1272,9 +1272,10 @@ void RenderMessageFilter::GpuMemoryBufferAllocated(
void RenderMessageFilter::OnDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id) {
const gfx::GpuMemoryBufferId& id,
uint32 sync_point) {
BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer(
type, id, PeerHandle());
type, id, PeerHandle(), render_process_id_, sync_point);
}
} // namespace content
......@@ -305,7 +305,8 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter {
void GpuMemoryBufferAllocated(IPC::Message* reply,
const gfx::GpuMemoryBufferHandle& handle);
void OnDeletedGpuMemoryBuffer(gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id);
const gfx::GpuMemoryBufferId& id,
uint32 sync_point);
// Cached resource request dispatcher host and plugin service, guaranteed to
// be non-null if Init succeeds. We do not own the objects, they are managed
......
......@@ -13,10 +13,12 @@ namespace {
void DeletedGpuMemoryBuffer(ThreadSafeSender* sender,
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id) {
const gfx::GpuMemoryBufferId& id,
uint32 sync_point) {
TRACE_EVENT0("renderer",
"ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer");
sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id));
sender->Send(
new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id, sync_point));
}
} // namespace
......@@ -56,7 +58,7 @@ ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
&DeletedGpuMemoryBuffer, sender_, handle.type, handle.global_id)));
if (!buffer) {
sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(
handle.type, handle.global_id));
handle.type, handle.global_id, 0));
return scoped_ptr<gfx::GpuMemoryBuffer>();
}
......@@ -69,4 +71,11 @@ ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
return GpuMemoryBufferImpl::FromClientBuffer(buffer);
}
void ChildGpuMemoryBufferManager::SetDestructionSyncPoint(
gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) {
static_cast<GpuMemoryBufferImpl*>(buffer)
->set_destruction_sync_point(sync_point);
}
} // namespace content
......@@ -22,6 +22,8 @@ class ChildGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
gfx::GpuMemoryBuffer::Usage usage) override;
gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
ClientBuffer buffer) override;
void SetDestructionSyncPoint(gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) override;
private:
scoped_refptr<ThreadSafeSender> sender_;
......
......@@ -344,7 +344,8 @@ void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer(
void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id) {
const gfx::GpuMemoryBufferId& id,
uint32 sync_point) {
// Note: Nothing to do here as ownership of shared memory backed
// GpuMemoryBuffers is passed with IPC.
}
......
......@@ -85,7 +85,8 @@ class CONTENT_EXPORT ChildProcessHostImpl : public ChildProcessHost,
gfx::GpuMemoryBuffer::Usage usage,
IPC::Message* reply);
void OnDeletedGpuMemoryBuffer(gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id);
const gfx::GpuMemoryBufferId& id,
uint32 sync_point);
void GpuMemoryBufferAllocated(IPC::Message* reply,
const gfx::GpuMemoryBufferHandle& handle);
......
......@@ -198,9 +198,10 @@ IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
gfx::GpuMemoryBufferHandle)
// Informs the browser that the child deleted a gpu memory buffer.
IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
gfx::GpuMemoryBufferType,
gfx::GpuMemoryBufferId)
gfx::GpuMemoryBufferId,
uint32 /* sync_point */)
// Asks the browser to create a block of discardable shared memory for the
// child process.
......
......@@ -308,17 +308,19 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer,
int32 new_id = channel_->ReserveImageId();
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager =
channel_->gpu_memory_buffer_manager();
gfx::GpuMemoryBuffer* gpu_memory_buffer =
channel_->gpu_memory_buffer_manager()->GpuMemoryBufferFromClientBuffer(
buffer);
gpu_memory_buffer_manager->GpuMemoryBufferFromClientBuffer(buffer);
DCHECK(gpu_memory_buffer);
// This handle is owned by the GPU process and must be passed to it or it
// will leak. In otherwords, do not early out on error between here and the
// sending of the CreateImage IPC below.
bool requires_sync_point = false;
gfx::GpuMemoryBufferHandle handle =
channel_->ShareGpuMemoryBufferToGpuProcess(
gpu_memory_buffer->GetHandle());
channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(),
&requires_sync_point);
DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
internalformat, gpu_memory_buffer->GetFormat()));
......@@ -331,6 +333,11 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer,
return -1;
}
if (requires_sync_point) {
gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
InsertSyncPoint());
}
return new_id;
}
......
......@@ -281,28 +281,34 @@ int32 GpuChannelHost::ReserveTransferBufferId() {
}
gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess(
gfx::GpuMemoryBufferHandle source_handle) {
gfx::GpuMemoryBufferHandle source_handle,
bool* requires_sync_point) {
switch (source_handle.type) {
case gfx::SHARED_MEMORY_BUFFER: {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::SHARED_MEMORY_BUFFER;
handle.handle = ShareToGpuProcess(source_handle.handle);
*requires_sync_point = false;
return handle;
}
#if defined(USE_OZONE)
case gfx::OZONE_NATIVE_BUFFER:
*requires_sync_point = true;
return source_handle;
#endif
#if defined(OS_MACOSX)
case gfx::IO_SURFACE_BUFFER:
*requires_sync_point = true;
return source_handle;
#endif
#if defined(OS_ANDROID)
case gfx::SURFACE_TEXTURE_BUFFER:
*requires_sync_point = true;
return source_handle;
#endif
#if defined(USE_X11)
case gfx::X11_PIXMAP_BUFFER:
*requires_sync_point = true;
return source_handle;
#endif
default:
......
......@@ -153,7 +153,8 @@ class GpuChannelHost : public IPC::Sender,
// IPC to the GPU process. The caller is responsible for ensuring it is
// closed. Returns an invalid handle on failure.
gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess(
gfx::GpuMemoryBufferHandle source_handle);
gfx::GpuMemoryBufferHandle source_handle,
bool* requires_sync_point);
// Reserve one unused image ID.
int32 ReserveImageId();
......
......@@ -11,11 +11,15 @@ namespace content {
GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size,
Format format,
const DestructionCallback& callback)
: size_(size), format_(format), callback_(callback), mapped_(false) {
: size_(size),
format_(format),
callback_(callback),
mapped_(false),
destruction_sync_point_(0) {
}
GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
callback_.Run();
callback_.Run(destruction_sync_point_);
}
// static
......
......@@ -19,7 +19,7 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
CreationCallback;
typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
AllocationCallback;
typedef base::Closure DestructionCallback;
typedef base::Callback<void(uint32 sync_point)> DestructionCallback;
~GpuMemoryBufferImpl() override;
......@@ -44,7 +44,9 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
// Notify that GPU memory buffer has been deleted by |child_process|.
static void DeletedByChildProcess(gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process);
base::ProcessHandle child_process,
int child_client_id,
uint32 sync_point);
// Creates an instance from the given |handle|. |size| and |internalformat|
// should match what was used to allocate the |handle|. |callback| is
......@@ -68,6 +70,10 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
Format GetFormat() const override;
ClientBuffer AsClientBuffer() override;
void set_destruction_sync_point(uint32 sync_point) {
destruction_sync_point_ = sync_point;
}
protected:
GpuMemoryBufferImpl(const gfx::Size& size,
Format format,
......@@ -77,6 +83,7 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
const Format format_;
const DestructionCallback callback_;
bool mapped_;
uint32 destruction_sync_point_;
DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
};
......
......@@ -60,7 +60,24 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
void GpuMemoryBufferImpl::DeletedByChildProcess(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process) {
base::ProcessHandle child_process,
int child_client_id,
uint32 sync_point) {
switch (type) {
case gfx::SHARED_MEMORY_BUFFER:
break;
case gfx::SURFACE_TEXTURE_BUFFER:
if (id.secondary_id != child_client_id) {
LOG(ERROR)
<< "Child attempting to delete GpuMemoryBuffer it does not own";
} else {
GpuMemoryBufferImplSurfaceTexture::DeletedByChildProcess(id,
sync_point);
}
break;
default:
NOTREACHED();
}
}
// static
......
......@@ -15,7 +15,10 @@ namespace {
base::StaticAtomicSequenceNumber g_next_buffer_id;
void Noop() {
void GpuMemoryBufferDeleted(const gfx::GpuMemoryBufferHandle& handle,
uint32 sync_point) {
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
void GpuMemoryBufferCreated(
......@@ -26,7 +29,7 @@ void GpuMemoryBufferCreated(
DCHECK_EQ(gfx::IO_SURFACE_BUFFER, handle.type);
callback.Run(GpuMemoryBufferImplIOSurface::CreateFromHandle(
handle, size, format, base::Bind(&Noop)));
handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle)));
}
void GpuMemoryBufferCreatedForChildProcess(
......@@ -102,6 +105,16 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle(
size, format, callback, io_surface.get()));
}
void GpuMemoryBufferImplIOSurface::DeletedByChildProcess(
const gfx::GpuMemoryBufferId& id,
uint32_t sync_point) {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::IO_SURFACE_BUFFER;
handle.global_id = id;
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
// static
bool GpuMemoryBufferImplIOSurface::IsFormatSupported(Format format) {
switch (format) {
......
......@@ -31,6 +31,9 @@ class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl {
Format format,
const DestructionCallback& callback);
static void DeletedByChildProcess(const gfx::GpuMemoryBufferId& id,
uint32_t sync_point);
static bool IsFormatSupported(Format format);
static bool IsUsageSupported(Usage usage);
static bool IsConfigurationSupported(Format format, Usage usage);
......
......@@ -45,7 +45,9 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
void GpuMemoryBufferImpl::DeletedByChildProcess(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process) {
base::ProcessHandle child_process,
int child_client_id,
uint32 sync_point) {
}
// static
......
......@@ -57,7 +57,23 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
void GpuMemoryBufferImpl::DeletedByChildProcess(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process) {
base::ProcessHandle child_process,
int child_client_id,
uint32 sync_point) {
switch (type) {
case gfx::SHARED_MEMORY_BUFFER:
break;
case gfx::IO_SURFACE_BUFFER:
if (id.secondary_id != child_client_id) {
LOG(ERROR)
<< "Child attempting to delete GpuMemoryBuffer it does not own";
} else {
GpuMemoryBufferImplIOSurface::DeletedByChildProcess(id, sync_point);
}
break;
default:
NOTREACHED();
}
}
// static
......
......@@ -60,7 +60,24 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
void GpuMemoryBufferImpl::DeletedByChildProcess(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process) {
base::ProcessHandle child_process,
int child_client_id,
uint32_t sync_point) {
switch (type) {
case gfx::SHARED_MEMORY_BUFFER:
break;
case gfx::OZONE_NATIVE_BUFFER:
if (id.secondary_id != child_client_id) {
LOG(ERROR)
<< "Child attempting to delete GpuMemoryBuffer it does not own";
} else {
GpuMemoryBufferImplOzoneNativeBuffer::DeletedByChildProcess(id,
sync_point);
}
break;
default:
NOTREACHED();
}
}
// static
......
......@@ -14,7 +14,10 @@ namespace {
base::StaticAtomicSequenceNumber g_next_buffer_id;
void Noop() {
void GpuMemoryBufferDeleted(const gfx::GpuMemoryBufferHandle& handle,
uint32 sync_point) {
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
void GpuMemoryBufferCreated(
......@@ -25,7 +28,7 @@ void GpuMemoryBufferCreated(
DCHECK_EQ(gfx::OZONE_NATIVE_BUFFER, handle.type);
callback.Run(GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
handle, size, format, base::Bind(&Noop)));
handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle)));
}
void GpuMemoryBufferCreatedForChildProcess(
......@@ -99,6 +102,17 @@ GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
size, format, callback, handle.global_id));
}
// static
void GpuMemoryBufferImplOzoneNativeBuffer::DeletedByChildProcess(
const gfx::GpuMemoryBufferId& id,
uint32_t sync_point) {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::OZONE_NATIVE_BUFFER;
handle.global_id = id;
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
// static
bool GpuMemoryBufferImplOzoneNativeBuffer::IsFormatSupported(Format format) {
switch (format) {
......
......@@ -28,6 +28,9 @@ class GpuMemoryBufferImplOzoneNativeBuffer : public GpuMemoryBufferImpl {
Format format,
const DestructionCallback& callback);
static void DeletedByChildProcess(const gfx::GpuMemoryBufferId& id,
uint32_t sync_point);
static bool IsFormatSupported(Format format);
static bool IsUsageSupported(Usage usage);
static bool IsConfigurationSupported(Format format, Usage usage);
......
......@@ -11,7 +11,7 @@
namespace content {
namespace {
void Noop() {
void Noop(uint32 sync_point) {
}
} // namespace
......
......@@ -17,7 +17,10 @@ namespace {
base::StaticAtomicSequenceNumber g_next_buffer_id;
void Noop() {
void GpuMemoryBufferDeleted(const gfx::GpuMemoryBufferHandle& handle,
uint32 sync_point) {
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
void GpuMemoryBufferCreated(
......@@ -28,7 +31,7 @@ void GpuMemoryBufferCreated(
DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type);
callback.Run(GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
handle, size, format, base::Bind(&Noop)));
handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle)));
}
void GpuMemoryBufferCreatedForChildProcess(
......@@ -116,6 +119,17 @@ GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
size, format, callback, handle.global_id, native_window));
}
// static
void GpuMemoryBufferImplSurfaceTexture::DeletedByChildProcess(
const gfx::GpuMemoryBufferId& id,
uint32_t sync_point) {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::SURFACE_TEXTURE_BUFFER;
handle.global_id = id;
GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
sync_point);
}
// static
bool GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(Format format) {
switch (format) {
......
......@@ -30,6 +30,9 @@ class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl {
Format format,
const DestructionCallback& callback);
static void DeletedByChildProcess(const gfx::GpuMemoryBufferId& id,
uint32_t sync_point);
static bool IsFormatSupported(Format format);
static bool IsUsageSupported(Usage usage);
static bool IsConfigurationSupported(Format format, Usage usage);
......
......@@ -45,7 +45,9 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
void GpuMemoryBufferImpl::DeletedByChildProcess(
gfx::GpuMemoryBufferType type,
const gfx::GpuMemoryBufferId& id,
base::ProcessHandle child_process) {
base::ProcessHandle child_process,
int child_client_id,
uint32 sync_point) {
}
// static
......
......@@ -27,6 +27,10 @@ class GPU_EXPORT GpuMemoryBufferManager {
virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
ClientBuffer buffer) = 0;
// Associates destruction sync point with |buffer|.
virtual void SetDestructionSyncPoint(gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) = 0;
protected:
virtual ~GpuMemoryBufferManager();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment