| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 DCHECK(task_runner_->BelongsToCurrentThread()); | 157 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 158 if (CheckContextLost()) | 158 if (CheckContextLost()) |
| 159 return; | 159 return; |
| 160 | 160 |
| 161 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 161 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 162 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); | 162 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); |
| 163 gles2->DeleteTextures(1, &texture_id); | 163 gles2->DeleteTextures(1, &texture_id); |
| 164 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); | 164 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) { | 167 void RendererGpuVideoAcceleratorFactories::WaitSyncToken( |
| 168 const gpu::SyncToken& sync_token) { |
| 168 DCHECK(task_runner_->BelongsToCurrentThread()); | 169 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 169 if (CheckContextLost()) | 170 if (CheckContextLost()) |
| 170 return; | 171 return; |
| 171 | 172 |
| 172 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 173 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 173 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); | 174 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); |
| 174 gles2->WaitSyncPointCHROMIUM(sync_point); | 175 gles2->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 175 | 176 |
| 176 // Callers expect the WaitSyncPoint to affect the next IPCs. Make sure to | 177 // Callers expect the WaitSyncToken to affect the next IPCs. Make sure to |
| 177 // flush the command buffers to ensure that. | 178 // flush the command buffers to ensure that. |
| 178 gles2->ShallowFlushCHROMIUM(); | 179 gles2->ShallowFlushCHROMIUM(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 scoped_ptr<gfx::GpuMemoryBuffer> | 182 scoped_ptr<gfx::GpuMemoryBuffer> |
| 182 RendererGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer( | 183 RendererGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer( |
| 183 const gfx::Size& size, | 184 const gfx::Size& size, |
| 184 gfx::BufferFormat format, | 185 gfx::BufferFormat format, |
| 185 gfx::BufferUsage usage) { | 186 gfx::BufferUsage usage) { |
| 186 scoped_ptr<gfx::GpuMemoryBuffer> buffer = | 187 scoped_ptr<gfx::GpuMemoryBuffer> buffer = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 gpu_channel_host_->gpu_info() | 260 gpu_channel_host_->gpu_info() |
| 260 .video_encode_accelerator_supported_profiles); | 261 .video_encode_accelerator_supported_profiles); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void RendererGpuVideoAcceleratorFactories::ReleaseContextProvider() { | 264 void RendererGpuVideoAcceleratorFactories::ReleaseContextProvider() { |
| 264 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 265 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 265 context_provider_refptr_ = nullptr; | 266 context_provider_refptr_ = nullptr; |
| 266 } | 267 } |
| 267 | 268 |
| 268 } // namespace content | 269 } // namespace content |
| OLD | NEW |