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

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

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_RGB: 21 case GL_RGB:
22 switch (format) { 22 return format == gfx::GpuMemoryBuffer::RGBX_8888;
23 case gfx::GpuMemoryBuffer::RGBX_8888:
24 return true;
25 case gfx::GpuMemoryBuffer::RGBA_8888:
26 case gfx::GpuMemoryBuffer::BGRA_8888:
27 return false;
28 }
29 NOTREACHED();
30 return false;
31 case GL_RGBA: 23 case GL_RGBA:
32 switch (format) { 24 return format == gfx::GpuMemoryBuffer::BGRA_8888;
33 case gfx::GpuMemoryBuffer::BGRA_8888: 25 case GL_ATC_RGB_AMD:
34 return true; 26 return format == gfx::GpuMemoryBuffer::ATC;
35 case gfx::GpuMemoryBuffer::RGBX_8888: 27 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
36 case gfx::GpuMemoryBuffer::RGBA_8888: 28 return format == gfx::GpuMemoryBuffer::ATCIA;
37 return false; 29 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
38 } 30 return format == gfx::GpuMemoryBuffer::DXT1;
39 NOTREACHED(); 31 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
40 return false; 32 return format == gfx::GpuMemoryBuffer::DXT5;
33 case GL_ETC1_RGB8_OES:
34 return format == gfx::GpuMemoryBuffer::ETC1;
41 default: 35 default:
42 return false; 36 return false;
43 } 37 }
44 } 38 }
45 39
46 EGLint FourCC(gfx::GpuMemoryBuffer::Format format) { 40 EGLint FourCC(gfx::GpuMemoryBuffer::Format format) {
47 switch (format) { 41 switch (format) {
48 case gfx::GpuMemoryBuffer::BGRA_8888: 42 case gfx::GpuMemoryBuffer::BGRA_8888:
49 return DRM_FORMAT_ARGB8888; 43 return DRM_FORMAT_ARGB8888;
50 case gfx::GpuMemoryBuffer::RGBX_8888: 44 case gfx::GpuMemoryBuffer::RGBX_8888:
51 return DRM_FORMAT_XRGB8888; 45 return DRM_FORMAT_XRGB8888;
52 case gfx::GpuMemoryBuffer::RGBA_8888: 46 case gfx::GpuMemoryBuffer::RGBA_8888:
47 case gfx::GpuMemoryBuffer::ATC:
48 case gfx::GpuMemoryBuffer::ATCIA:
49 case gfx::GpuMemoryBuffer::DXT1:
50 case gfx::GpuMemoryBuffer::DXT5:
51 case gfx::GpuMemoryBuffer::ETC1:
53 NOTREACHED(); 52 NOTREACHED();
54 return 0; 53 return 0;
55 } 54 }
56 55
57 NOTREACHED(); 56 NOTREACHED();
58 return 0; 57 return 0;
59 } 58 }
60 59
61 bool IsHandleValid(const base::FileDescriptor& handle) { 60 bool IsHandleValid(const base::FileDescriptor& handle) {
62 return handle.fd >= 0; 61 return handle.fd >= 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EGL_DMA_BUF_PLANE0_OFFSET_EXT, 97 EGL_DMA_BUF_PLANE0_OFFSET_EXT,
99 0, 98 0,
100 EGL_DMA_BUF_PLANE0_PITCH_EXT, 99 EGL_DMA_BUF_PLANE0_PITCH_EXT,
101 pitch, 100 pitch,
102 EGL_NONE}; 101 EGL_NONE};
103 return GLImageEGL::Initialize( 102 return GLImageEGL::Initialize(
104 EGL_LINUX_DMA_BUF_EXT, static_cast<EGLClientBuffer>(NULL), attrs); 103 EGL_LINUX_DMA_BUF_EXT, static_cast<EGLClientBuffer>(NULL), attrs);
105 } 104 }
106 105
107 } // namespace gfx 106 } // 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