OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 uint64 GpuChannel::GetMemoryUsage() { | 821 uint64 GpuChannel::GetMemoryUsage() { |
822 uint64 size = 0; | 822 uint64 size = 0; |
823 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); | 823 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
824 !it.IsAtEnd(); it.Advance()) { | 824 !it.IsAtEnd(); it.Advance()) { |
825 size += it.GetCurrentValue()->GetMemoryUsage(); | 825 size += it.GetCurrentValue()->GetMemoryUsage(); |
826 } | 826 } |
827 return size; | 827 return size; |
828 } | 828 } |
829 | 829 |
830 scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer( | 830 scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer( |
831 const gfx::GpuMemoryBufferHandle& handle, | 831 const std::vector<gfx::GpuMemoryBufferHandle>& handles, |
832 const gfx::Size& size, | 832 const gfx::Size& size, |
833 gfx::GpuMemoryBuffer::Format format, | 833 const std::vector<gfx::GpuMemoryBuffer::Format>& formats, |
834 uint32 internalformat) { | 834 uint32 internalformat) { |
835 // TODO(emircan): See http://crbug.com/439520; support passing multiple | |
reveman
2015/03/05 19:35:32
Sorry if I didn't make this clear but I don't want
emircan
2015/03/09 21:07:22
Ok, going all the way :) I got some advice to keep
| |
836 // buffers when new multi-planar formats are added. | |
837 if ((handles.size() != 1) || (formats.size() != 1)) { | |
838 NOTIMPLEMENTED(); | |
839 return scoped_refptr<gfx::GLImage>(); | |
840 } | |
841 | |
842 const gfx::GpuMemoryBufferHandle& handle = handles[0]; | |
843 const gfx::GpuMemoryBuffer::Format& format = formats[0]; | |
844 | |
835 switch (handle.type) { | 845 switch (handle.type) { |
836 case gfx::SHARED_MEMORY_BUFFER: { | 846 case gfx::SHARED_MEMORY_BUFFER: { |
837 scoped_refptr<gfx::GLImageSharedMemory> image( | 847 scoped_refptr<gfx::GLImageSharedMemory> image( |
838 new gfx::GLImageSharedMemory(size, internalformat)); | 848 new gfx::GLImageSharedMemory(size, internalformat)); |
839 if (!image->Initialize(handle, format)) | 849 if (!image->Initialize(handle, format)) |
840 return scoped_refptr<gfx::GLImage>(); | 850 return scoped_refptr<gfx::GLImage>(); |
841 | 851 |
842 return image; | 852 return image; |
843 } | 853 } |
844 default: { | 854 default: { |
845 GpuChannelManager* manager = gpu_channel_manager(); | 855 GpuChannelManager* manager = gpu_channel_manager(); |
846 if (!manager->gpu_memory_buffer_factory()) | 856 if (!manager->gpu_memory_buffer_factory()) |
847 return scoped_refptr<gfx::GLImage>(); | 857 return scoped_refptr<gfx::GLImage>(); |
848 | 858 |
849 return manager->gpu_memory_buffer_factory() | 859 return manager->gpu_memory_buffer_factory() |
850 ->AsImageFactory() | 860 ->AsImageFactory() |
851 ->CreateImageForGpuMemoryBuffer(handle, | 861 ->CreateImageForGpuMemoryBuffer(handles, |
852 size, | 862 size, |
853 format, | 863 formats, |
854 internalformat, | 864 internalformat, |
855 client_id_); | 865 client_id_); |
856 } | 866 } |
857 } | 867 } |
858 } | 868 } |
859 | 869 |
860 void GpuChannel::HandleUpdateValueState( | 870 void GpuChannel::HandleUpdateValueState( |
861 unsigned int target, const gpu::ValueState& state) { | 871 unsigned int target, const gpu::ValueState& state) { |
862 pending_valuebuffer_state_->UpdateState(target, state); | 872 pending_valuebuffer_state_->UpdateState(target, state); |
863 } | 873 } |
864 | 874 |
865 } // namespace content | 875 } // namespace content |
OLD | NEW |