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

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

Issue 2039813002: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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
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((uint32_t)((modifier >> 32) & 0xffffffff));
piman 2016/06/07 01:37:46 nit: use static_cast<uint32_t> instead of c-style
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
148 pixmap_ = pixmap; 153 pixmap_ = pixmap;
154
reveman 2016/06/07 01:33:10 nit: avoid adding this blankline?
149 return true; 155 return true;
150 } 156 }
151 157
152 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { 158 unsigned GLImageOzoneNativePixmap::GetInternalFormat() {
153 return internalformat_; 159 return internalformat_;
154 } 160 }
155 161
156 void GLImageOzoneNativePixmap::Destroy(bool have_context) { 162 void GLImageOzoneNativePixmap::Destroy(bool have_context) {
157 GLImageEGL::Destroy(have_context); 163 GLImageEGL::Destroy(have_context);
158 } 164 }
(...skipping 11 matching lines...) Expand all
170 return GLImageEGL::CopyTexImage(target); 176 return GLImageEGL::CopyTexImage(target);
171 } 177 }
172 178
173 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane( 179 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane(
174 gfx::AcceleratedWidget widget, 180 gfx::AcceleratedWidget widget,
175 int z_order, 181 int z_order,
176 gfx::OverlayTransform transform, 182 gfx::OverlayTransform transform,
177 const gfx::Rect& bounds_rect, 183 const gfx::Rect& bounds_rect,
178 const gfx::RectF& crop_rect) { 184 const gfx::RectF& crop_rect) {
179 DCHECK(pixmap_); 185 DCHECK(pixmap_);
186
reveman 2016/06/07 01:33:10 nit: avoid adding this blankline?
180 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect, 187 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect,
181 crop_rect); 188 crop_rect);
182 } 189 }
183 190
184 void GLImageOzoneNativePixmap::OnMemoryDump( 191 void GLImageOzoneNativePixmap::OnMemoryDump(
185 base::trace_event::ProcessMemoryDump* pmd, 192 base::trace_event::ProcessMemoryDump* pmd,
186 uint64_t process_tracing_id, 193 uint64_t process_tracing_id,
187 const std::string& dump_name) { 194 const std::string& dump_name) {
188 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 195 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914
189 } 196 }
190 197
191 } // namespace gl 198 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698