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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc

Issue 1831513003: Pull gpu service/client shared memory buffer code to GpuMemoryBufferSupport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed ifdef mixup Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/gpu/gpu_memory_buffer_factory_surface_texture.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h"
6 6
7 #include "gpu/ipc/common/android/surface_texture_manager.h" 7 #include "gpu/ipc/common/android/surface_texture_manager.h"
8 #include "ui/gl/android/surface_texture.h" 8 #include "ui/gl/android/surface_texture.h"
9 #include "ui/gl/gl_image_surface_texture.h" 9 #include "ui/gl/gl_image_surface_texture.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 GpuMemoryBufferFactorySurfaceTexture::GpuMemoryBufferFactorySurfaceTexture() { 13 GpuMemoryBufferFactorySurfaceTexture::GpuMemoryBufferFactorySurfaceTexture() {
14 } 14 }
15 15
16 GpuMemoryBufferFactorySurfaceTexture::~GpuMemoryBufferFactorySurfaceTexture() { 16 GpuMemoryBufferFactorySurfaceTexture::~GpuMemoryBufferFactorySurfaceTexture() {
17 } 17 }
18 18
19 // static
20 bool GpuMemoryBufferFactorySurfaceTexture::
21 IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format,
22 gfx::BufferUsage usage) {
23 switch (usage) {
24 case gfx::BufferUsage::GPU_READ:
25 case gfx::BufferUsage::SCANOUT:
26 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
27 return false;
28 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
29 return format == gfx::BufferFormat::RGBA_8888;
30 }
31 NOTREACHED();
32 return false;
33 }
34
35 gfx::GpuMemoryBufferHandle 19 gfx::GpuMemoryBufferHandle
36 GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer( 20 GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer(
37 gfx::GpuMemoryBufferId id, 21 gfx::GpuMemoryBufferId id,
38 const gfx::Size& size, 22 const gfx::Size& size,
39 gfx::BufferFormat format, 23 gfx::BufferFormat format,
40 gfx::BufferUsage usage, 24 gfx::BufferUsage usage,
41 int client_id, 25 int client_id,
42 gpu::SurfaceHandle surface_handle) { 26 gpu::SurfaceHandle surface_handle) {
43 // Note: this needs to be 0 as the surface texture implemenation will take 27 // Note: this needs to be 0 as the surface texture implemenation will take
44 // ownership of the texture and call glDeleteTextures when the GPU service 28 // ownership of the texture and call glDeleteTextures when the GPU service
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 99
116 scoped_refptr<gl::GLImageSurfaceTexture> image( 100 scoped_refptr<gl::GLImageSurfaceTexture> image(
117 new gl::GLImageSurfaceTexture(size)); 101 new gl::GLImageSurfaceTexture(size));
118 if (!image->Initialize(it->second.get())) 102 if (!image->Initialize(it->second.get()))
119 return scoped_refptr<gl::GLImage>(); 103 return scoped_refptr<gl::GLImage>();
120 104
121 return image; 105 return image;
122 } 106 }
123 107
124 } // namespace content 108 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698