| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gfx/buffer_format_util.h" | 5 #include "ui/gfx/buffer_format_util.h" |
| 6 #include "ui/gl/gl_image_ozone_native_pixmap.h" | 6 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
| 7 | 7 |
| 8 #define FOURCC(a, b, c, d) \ | 8 #define FOURCC(a, b, c, d) \ |
| 9 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ | 9 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ |
| 10 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) | 10 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 attrs.push_back(EGL_WIDTH); | 122 attrs.push_back(EGL_WIDTH); |
| 123 attrs.push_back(size_.width()); | 123 attrs.push_back(size_.width()); |
| 124 attrs.push_back(EGL_HEIGHT); | 124 attrs.push_back(EGL_HEIGHT); |
| 125 attrs.push_back(size_.height()); | 125 attrs.push_back(size_.height()); |
| 126 attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); | 126 attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); |
| 127 attrs.push_back(FourCC(format)); | 127 attrs.push_back(FourCC(format)); |
| 128 | 128 |
| 129 for (size_t plane = 0; | 129 for (size_t plane = 0; |
| 130 plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat()); | 130 plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat()); |
| 131 ++plane) { | 131 ++plane) { |
| 132 uint64_t modifier = pixmap->GetDmaBufModifier(plane); |
| 132 attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); | 133 attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); |
| 133 attrs.push_back(pixmap->GetDmaBufFd(plane)); | 134 attrs.push_back(pixmap->GetDmaBufFd(plane)); |
| 134 attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); | 135 attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); |
| 135 attrs.push_back(0); | 136 attrs.push_back(0); |
| 136 attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); | 137 attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); |
| 137 attrs.push_back(pixmap->GetDmaBufPitch(plane)); | 138 attrs.push_back(pixmap->GetDmaBufPitch(plane)); |
| 139 attrs.push_back(EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT + plane * 3); |
| 140 attrs.push_back(modifier & 0xffffffff); |
| 141 attrs.push_back(EGL_LINUX_DRM_PLANE0_MODIFIER1_EXT + plane * 3); |
| 142 attrs.push_back(static_cast<uint32_t>((modifier >> 32) & 0xffffffff)); |
| 138 } | 143 } |
| 139 attrs.push_back(EGL_NONE); | 144 attrs.push_back(EGL_NONE); |
| 140 | 145 |
| 141 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, | 146 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, |
| 142 static_cast<EGLClientBuffer>(nullptr), | 147 static_cast<EGLClientBuffer>(nullptr), |
| 143 &attrs[0])) { | 148 &attrs[0])) { |
| 144 return false; | 149 return false; |
| 145 } | 150 } |
| 146 } | 151 } |
| 147 | 152 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 187 } |
| 183 | 188 |
| 184 void GLImageOzoneNativePixmap::OnMemoryDump( | 189 void GLImageOzoneNativePixmap::OnMemoryDump( |
| 185 base::trace_event::ProcessMemoryDump* pmd, | 190 base::trace_event::ProcessMemoryDump* pmd, |
| 186 uint64_t process_tracing_id, | 191 uint64_t process_tracing_id, |
| 187 const std::string& dump_name) { | 192 const std::string& dump_name) { |
| 188 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 | 193 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 |
| 189 } | 194 } |
| 190 | 195 |
| 191 } // namespace gl | 196 } // namespace gl |
| OLD | NEW |