Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: gpu/ipc/service/gpu_channel.cc

Issue 2148983002: gpu: Take surface handle into account when importing buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid crash in DrmDeviceManager::GetDrmDevice when passed invalid widget Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "gpu/ipc/service/gpu_channel.h" 5 #include "gpu/ipc/service/gpu_channel.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 tracker); 1038 tracker);
1039 } 1039 }
1040 1040
1041 return size; 1041 return size;
1042 } 1042 }
1043 1043
1044 scoped_refptr<gl::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer( 1044 scoped_refptr<gl::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
1045 const gfx::GpuMemoryBufferHandle& handle, 1045 const gfx::GpuMemoryBufferHandle& handle,
1046 const gfx::Size& size, 1046 const gfx::Size& size,
1047 gfx::BufferFormat format, 1047 gfx::BufferFormat format,
1048 uint32_t internalformat) { 1048 uint32_t internalformat,
1049 SurfaceHandle surface_handle) {
1049 switch (handle.type) { 1050 switch (handle.type) {
1050 case gfx::SHARED_MEMORY_BUFFER: { 1051 case gfx::SHARED_MEMORY_BUFFER: {
1051 if (!base::IsValueInRangeForNumericType<size_t>(handle.stride)) 1052 if (!base::IsValueInRangeForNumericType<size_t>(handle.stride))
1052 return nullptr; 1053 return nullptr;
1053 scoped_refptr<gl::GLImageSharedMemory> image( 1054 scoped_refptr<gl::GLImageSharedMemory> image(
1054 new gl::GLImageSharedMemory(size, internalformat)); 1055 new gl::GLImageSharedMemory(size, internalformat));
1055 if (!image->Initialize(handle.handle, handle.id, format, handle.offset, 1056 if (!image->Initialize(handle.handle, handle.id, format, handle.offset,
1056 handle.stride)) { 1057 handle.stride)) {
1057 return nullptr; 1058 return nullptr;
1058 } 1059 }
1059 1060
1060 return image; 1061 return image;
1061 } 1062 }
1062 default: { 1063 default: {
1063 GpuChannelManager* manager = gpu_channel_manager(); 1064 GpuChannelManager* manager = gpu_channel_manager();
1064 if (!manager->gpu_memory_buffer_factory()) 1065 if (!manager->gpu_memory_buffer_factory())
1065 return nullptr; 1066 return nullptr;
1066 1067
1067 return manager->gpu_memory_buffer_factory() 1068 return manager->gpu_memory_buffer_factory()
1068 ->AsImageFactory() 1069 ->AsImageFactory()
1069 ->CreateImageForGpuMemoryBuffer(handle, 1070 ->CreateImageForGpuMemoryBuffer(handle, size, format, internalformat,
1070 size, 1071 client_id_, surface_handle);
1071 format,
1072 internalformat,
1073 client_id_);
1074 } 1072 }
1075 } 1073 }
1076 } 1074 }
1077 1075
1078 } // namespace gpu 1076 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698