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

Side by Side Diff: ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc

Issue 1134993003: ozone: Implement zero/one-copy texture for Ozone GBM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" 5 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gl/gl_image_egl.h" 8 #include "ui/gl/gl_image_egl.h"
9 #include "ui/gl/gl_image_linux_dma_buffer.h" 9 #include "ui/gl/gl_image_linux_dma_buffer.h"
10 #include "ui/ozone/public/native_pixmap.h" 10 #include "ui/ozone/public/native_pixmap.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return false; 65 return false;
66 pixmap_ = pixmap; 66 pixmap_ = pixmap;
67 return true; 67 return true;
68 } 68 }
69 69
70 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 70 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
71 int z_order, 71 int z_order,
72 gfx::OverlayTransform transform, 72 gfx::OverlayTransform transform,
73 const gfx::Rect& bounds_rect, 73 const gfx::Rect& bounds_rect,
74 const gfx::RectF& crop_rect) override { 74 const gfx::RectF& crop_rect) override {
75 DCHECK(pixmap_->GetBufferUsage() == NativePixmap::SCANOUT);
reveman 2015/05/11 16:40:57 nit: use DCHECK_EQ
dshwang 2015/05/14 12:25:47 Done.
75 return SurfaceFactoryOzone::GetInstance()->ScheduleOverlayPlane( 76 return SurfaceFactoryOzone::GetInstance()->ScheduleOverlayPlane(
76 widget, z_order, transform, pixmap_, bounds_rect, crop_rect); 77 widget, z_order, transform, pixmap_, bounds_rect, crop_rect);
77 } 78 }
78 79
79 protected: 80 protected:
80 ~GLImageOzoneNativePixmapDmaBuf() override {} 81 ~GLImageOzoneNativePixmapDmaBuf() override {}
81 82
82 private: 83 private:
83 scoped_refptr<NativePixmap> pixmap_; 84 scoped_refptr<NativePixmap> pixmap_;
84 }; 85 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 GpuMemoryBufferFactoryOzoneNativeBuffer:: 133 GpuMemoryBufferFactoryOzoneNativeBuffer::
133 ~GpuMemoryBufferFactoryOzoneNativeBuffer() { 134 ~GpuMemoryBufferFactoryOzoneNativeBuffer() {
134 } 135 }
135 136
136 bool GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( 137 bool GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer(
137 gfx::GpuMemoryBufferId id, 138 gfx::GpuMemoryBufferId id,
138 const gfx::Size& size, 139 const gfx::Size& size,
139 gfx::GpuMemoryBuffer::Format format, 140 gfx::GpuMemoryBuffer::Format format,
140 gfx::GpuMemoryBuffer::Usage usage, 141 gfx::GpuMemoryBuffer::Usage usage,
141 int client_id, 142 int client_id,
142 gfx::PluginWindowHandle surface_handle) { 143 gfx::PluginWindowHandle surface_handle,
144 gfx::GpuMemoryBufferHandle* new_handle) {
143 scoped_refptr<NativePixmap> pixmap = 145 scoped_refptr<NativePixmap> pixmap =
144 SurfaceFactoryOzone::GetInstance()->CreateNativePixmap( 146 SurfaceFactoryOzone::GetInstance()->CreateNativePixmap(
145 surface_handle, size, GetOzoneFormatFor(format), 147 surface_handle, size, GetOzoneFormatFor(format),
146 GetOzoneUsageFor(usage)); 148 GetOzoneUsageFor(usage), new_handle);
147 if (!pixmap.get()) { 149 if (!pixmap.get()) {
148 LOG(ERROR) << "Failed to create pixmap " << size.width() << "x" 150 LOG(ERROR) << "Failed to create pixmap " << size.width() << "x"
149 << size.height() << " format " << format << ", usage " << usage; 151 << size.height() << " format " << format << ", usage " << usage;
150 return false; 152 return false;
151 } 153 }
152 base::AutoLock lock(native_pixmap_map_lock_); 154 base::AutoLock lock(native_pixmap_map_lock_);
153 native_pixmap_map_[GetIndex(id, client_id)] = pixmap; 155 native_pixmap_map_[GetIndex(id, client_id)] = pixmap;
154 return true; 156 return true;
155 } 157 }
156 158
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 new GLImageOzoneNativePixmapDmaBuf(size, internalformat); 202 new GLImageOzoneNativePixmapDmaBuf(size, internalformat);
201 if (!image->Initialize(pixmap.get(), format)) { 203 if (!image->Initialize(pixmap.get(), format)) {
202 return scoped_refptr<gfx::GLImage>(); 204 return scoped_refptr<gfx::GLImage>();
203 } 205 }
204 return image; 206 return image;
205 } 207 }
206 return scoped_refptr<gfx::GLImage>(); 208 return scoped_refptr<gfx::GLImage>();
207 } 209 }
208 210
209 } // namespace ui 211 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698