Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 attrs.push_back(EGL_WIDTH); | 133 attrs.push_back(EGL_WIDTH); |
| 134 attrs.push_back(size_.width()); | 134 attrs.push_back(size_.width()); |
| 135 attrs.push_back(EGL_HEIGHT); | 135 attrs.push_back(EGL_HEIGHT); |
| 136 attrs.push_back(size_.height()); | 136 attrs.push_back(size_.height()); |
| 137 attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); | 137 attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT); |
| 138 attrs.push_back(FourCC(format)); | 138 attrs.push_back(FourCC(format)); |
| 139 | 139 |
| 140 for (size_t plane = 0; | 140 for (size_t plane = 0; |
| 141 plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat()); | 141 plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat()); |
| 142 ++plane) { | 142 ++plane) { |
| 143 uint64_t modifier = pixmap->GetDmaBufModifier(plane); | |
| 143 attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); | 144 attrs.push_back(EGL_DMA_BUF_PLANE0_FD_EXT + plane * 3); |
| 144 attrs.push_back( | 145 attrs.push_back( |
| 145 pixmap->GetDmaBufFd(plane < pixmap->GetDmaBufFdCount() ? plane : 0)); | 146 pixmap->GetDmaBufFd(plane < pixmap->GetDmaBufFdCount() ? plane : 0)); |
| 146 attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); | 147 attrs.push_back(EGL_DMA_BUF_PLANE0_OFFSET_EXT + plane * 3); |
| 147 attrs.push_back(pixmap->GetDmaBufOffset(plane)); | 148 attrs.push_back(pixmap->GetDmaBufOffset(plane)); |
| 148 attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); | 149 attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3); |
| 149 attrs.push_back(pixmap->GetDmaBufPitch(plane)); | 150 attrs.push_back(pixmap->GetDmaBufPitch(plane)); |
| 151 attrs.push_back(EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT + plane * 3); | |
|
Daniele Castagna
2016/06/15 17:30:10
Is this working as intended?
for plane = 1 we pas
vinceh
2016/06/16 02:08:44
You're right. That's my mistake. I should have it
| |
| 152 attrs.push_back(modifier & 0xffffffff); | |
| 153 attrs.push_back(EGL_LINUX_DRM_PLANE0_MODIFIER1_EXT + plane * 3); | |
| 154 attrs.push_back(static_cast<uint32_t>(modifier >> 32)); | |
| 150 } | 155 } |
| 151 attrs.push_back(EGL_NONE); | 156 attrs.push_back(EGL_NONE); |
| 152 | 157 |
| 153 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, | 158 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, |
| 154 static_cast<EGLClientBuffer>(nullptr), | 159 static_cast<EGLClientBuffer>(nullptr), |
| 155 &attrs[0])) { | 160 &attrs[0])) { |
| 156 return false; | 161 return false; |
| 157 } | 162 } |
| 158 } | 163 } |
| 159 | 164 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 case gfx::BufferFormat::UYVY_422: | 231 case gfx::BufferFormat::UYVY_422: |
| 227 NOTREACHED(); | 232 NOTREACHED(); |
| 228 return GL_NONE; | 233 return GL_NONE; |
| 229 } | 234 } |
| 230 | 235 |
| 231 NOTREACHED(); | 236 NOTREACHED(); |
| 232 return GL_NONE; | 237 return GL_NONE; |
| 233 } | 238 } |
| 234 | 239 |
| 235 } // namespace gl | 240 } // namespace gl |
| OLD | NEW |