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

Side by Side Diff: ui/gl/gl_image_x11.cc

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include x11 pixmap tracker Created 6 years, 6 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 | Annotate | Revision Log
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 "ui/gl/gl_image.h" 5 #include "ui/gl/gl_image.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "ui/gl/gl_image_glx.h" 8 #include "ui/gl/gl_image_glx.h"
9 #include "ui/gl/gl_image_shm.h" 9 #include "ui/gl/gl_image_shm.h"
10 #include "ui/gl/gl_image_stub.h" 10 #include "ui/gl/gl_image_stub.h"
11 #include "ui/gl/gl_implementation.h" 11 #include "ui/gl/gl_implementation.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) {
16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage");
17 switch (GetGLImplementation()) {
18 case kGLImplementationOSMesaGL:
19 return NULL;
20 case kGLImplementationDesktopGL: {
21 scoped_refptr<GLImageGLX> image(new GLImageGLX(window));
22 if (!image->Initialize())
23 return NULL;
24
25 return image;
26 }
27 case kGLImplementationEGLGLES2:
28 return NULL;
29 case kGLImplementationMockGL:
30 return new GLImageStub;
31 default:
32 NOTREACHED();
33 return NULL;
34 }
35 }
36
37 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( 15 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer(
38 gfx::GpuMemoryBufferHandle buffer, 16 gfx::GpuMemoryBufferHandle buffer,
39 gfx::Size size, 17 gfx::Size size,
40 unsigned internalformat) { 18 unsigned internalformat) {
41 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); 19 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer");
42 switch (GetGLImplementation()) { 20 switch (GetGLImplementation()) {
21 case kGLImplementationDesktopGL:
22 switch (buffer.type) {
23 case X11_PIXMAP_BUFFER: {
24 scoped_refptr<GLImageGLX> image(new GLImageGLX(size, internalformat));
25 if (!image->Initialize(buffer))
26 return NULL;
27
28 return image;
29 }
30 default:
31 break;
32 }
33 // Fall-through.
43 case kGLImplementationOSMesaGL: 34 case kGLImplementationOSMesaGL:
44 case kGLImplementationDesktopGL:
45 case kGLImplementationEGLGLES2: 35 case kGLImplementationEGLGLES2:
46 switch (buffer.type) { 36 switch (buffer.type) {
47 case SHARED_MEMORY_BUFFER: { 37 case SHARED_MEMORY_BUFFER: {
48 scoped_refptr<GLImageShm> image( 38 scoped_refptr<GLImageShm> image(
49 new GLImageShm(size, internalformat)); 39 new GLImageShm(size, internalformat));
50 if (!image->Initialize(buffer)) 40 if (!image->Initialize(buffer))
51 return NULL; 41 return NULL;
52 42
53 return image; 43 return image;
54 } 44 }
55 default: 45 default:
56 NOTREACHED(); 46 NOTREACHED();
57 return NULL; 47 return NULL;
58 } 48 }
59 case kGLImplementationMockGL: 49 case kGLImplementationMockGL:
60 return new GLImageStub; 50 return new GLImageStub;
61 default: 51 default:
62 NOTREACHED(); 52 NOTREACHED();
63 return NULL; 53 return NULL;
64 } 54 }
65 } 55 }
66 56
67 } // namespace gfx 57 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698