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

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

Issue 948323002: Revert of Add support for compressed GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ui/gfx/gpu_memory_buffer.h ('k') | ui/gl/gl_image_memory.h » ('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 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 "ui/gl/gl_image_linux_dma_buffer.h" 5 #include "ui/gl/gl_image_linux_dma_buffer.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #define FOURCC(a, b, c, d) \ 9 #define FOURCC(a, b, c, d) \
10 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ 10 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
11 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) 11 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
12 12
13 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') 13 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4')
14 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') 14 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
15 15
16 namespace gfx { 16 namespace gfx {
17 namespace { 17 namespace {
18 18
19 bool ValidFormat(unsigned internalformat, gfx::GpuMemoryBuffer::Format format) { 19 bool ValidFormat(unsigned internalformat, gfx::GpuMemoryBuffer::Format format) {
20 switch (internalformat) { 20 switch (internalformat) {
21 case GL_ATC_RGB_AMD:
22 return format == gfx::GpuMemoryBuffer::ATC;
23 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
24 return format == gfx::GpuMemoryBuffer::ATCIA;
25 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
26 return format == gfx::GpuMemoryBuffer::DXT1;
27 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
28 return format == gfx::GpuMemoryBuffer::DXT5;
29 case GL_ETC1_RGB8_OES:
30 return format == gfx::GpuMemoryBuffer::ETC1;
31 case GL_RGB: 21 case GL_RGB:
32 switch (format) { 22 switch (format) {
33 case gfx::GpuMemoryBuffer::RGBX_8888: 23 case gfx::GpuMemoryBuffer::RGBX_8888:
34 return true; 24 return true;
35 case gfx::GpuMemoryBuffer::ATC:
36 case gfx::GpuMemoryBuffer::ATCIA:
37 case gfx::GpuMemoryBuffer::DXT1:
38 case gfx::GpuMemoryBuffer::DXT5:
39 case gfx::GpuMemoryBuffer::ETC1:
40 case gfx::GpuMemoryBuffer::RGBA_8888: 25 case gfx::GpuMemoryBuffer::RGBA_8888:
41 case gfx::GpuMemoryBuffer::BGRA_8888: 26 case gfx::GpuMemoryBuffer::BGRA_8888:
42 return false; 27 return false;
43 } 28 }
44 NOTREACHED(); 29 NOTREACHED();
45 return false; 30 return false;
46 case GL_RGBA: 31 case GL_RGBA:
47 switch (format) { 32 switch (format) {
48 case gfx::GpuMemoryBuffer::BGRA_8888: 33 case gfx::GpuMemoryBuffer::BGRA_8888:
49 return true; 34 return true;
50 case gfx::GpuMemoryBuffer::ATC:
51 case gfx::GpuMemoryBuffer::ATCIA:
52 case gfx::GpuMemoryBuffer::DXT1:
53 case gfx::GpuMemoryBuffer::DXT5:
54 case gfx::GpuMemoryBuffer::ETC1:
55 case gfx::GpuMemoryBuffer::RGBX_8888: 35 case gfx::GpuMemoryBuffer::RGBX_8888:
56 case gfx::GpuMemoryBuffer::RGBA_8888: 36 case gfx::GpuMemoryBuffer::RGBA_8888:
57 return false; 37 return false;
58 } 38 }
59 NOTREACHED(); 39 NOTREACHED();
60 return false; 40 return false;
61 default: 41 default:
62 return false; 42 return false;
63 } 43 }
64 } 44 }
65 45
66 EGLint FourCC(gfx::GpuMemoryBuffer::Format format) { 46 EGLint FourCC(gfx::GpuMemoryBuffer::Format format) {
67 switch (format) { 47 switch (format) {
68 case gfx::GpuMemoryBuffer::BGRA_8888: 48 case gfx::GpuMemoryBuffer::BGRA_8888:
69 return DRM_FORMAT_ARGB8888; 49 return DRM_FORMAT_ARGB8888;
70 case gfx::GpuMemoryBuffer::RGBX_8888: 50 case gfx::GpuMemoryBuffer::RGBX_8888:
71 return DRM_FORMAT_XRGB8888; 51 return DRM_FORMAT_XRGB8888;
72 case gfx::GpuMemoryBuffer::ATC:
73 case gfx::GpuMemoryBuffer::ATCIA:
74 case gfx::GpuMemoryBuffer::DXT1:
75 case gfx::GpuMemoryBuffer::DXT5:
76 case gfx::GpuMemoryBuffer::ETC1:
77 case gfx::GpuMemoryBuffer::RGBA_8888: 52 case gfx::GpuMemoryBuffer::RGBA_8888:
78 NOTREACHED(); 53 NOTREACHED();
79 return 0; 54 return 0;
80 } 55 }
81 56
82 NOTREACHED(); 57 NOTREACHED();
83 return 0; 58 return 0;
84 } 59 }
85 60
86 bool IsHandleValid(const base::FileDescriptor& handle) { 61 bool IsHandleValid(const base::FileDescriptor& handle) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 EGL_DMA_BUF_PLANE0_OFFSET_EXT, 98 EGL_DMA_BUF_PLANE0_OFFSET_EXT,
124 0, 99 0,
125 EGL_DMA_BUF_PLANE0_PITCH_EXT, 100 EGL_DMA_BUF_PLANE0_PITCH_EXT,
126 pitch, 101 pitch,
127 EGL_NONE}; 102 EGL_NONE};
128 return GLImageEGL::Initialize( 103 return GLImageEGL::Initialize(
129 EGL_LINUX_DMA_BUF_EXT, static_cast<EGLClientBuffer>(NULL), attrs); 104 EGL_LINUX_DMA_BUF_EXT, static_cast<EGLClientBuffer>(NULL), attrs);
130 } 105 }
131 106
132 } // namespace gfx 107 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gpu_memory_buffer.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698