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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.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: address sievers's comment Created 5 years, 4 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
« no previous file with comments | « no previous file | ui/ozone/common/stub_client_native_pixmap_factory.cc » ('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 "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h " 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h "
6 6
7 #include "ui/ozone/public/client_native_pixmap_factory.h" 7 #include "ui/ozone/public/client_native_pixmap_factory.h"
8 #include "ui/ozone/public/surface_factory_ozone.h" 8 #include "ui/ozone/public/surface_factory_ozone.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 11 matching lines...) Expand all
22 // static 22 // static
23 scoped_ptr<GpuMemoryBufferImpl> 23 scoped_ptr<GpuMemoryBufferImpl>
24 GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( 24 GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle(
25 const gfx::GpuMemoryBufferHandle& handle, 25 const gfx::GpuMemoryBufferHandle& handle,
26 const gfx::Size& size, 26 const gfx::Size& size,
27 gfx::BufferFormat format, 27 gfx::BufferFormat format,
28 gfx::BufferUsage usage, 28 gfx::BufferUsage usage,
29 const DestructionCallback& callback) { 29 const DestructionCallback& callback) {
30 scoped_ptr<ui::ClientNativePixmap> native_pixmap = 30 scoped_ptr<ui::ClientNativePixmap> native_pixmap =
31 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle( 31 ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle(
32 handle.native_pixmap_handle, size, format, usage); 32 handle.native_pixmap_handle, size, usage);
33 DCHECK(native_pixmap); 33 DCHECK(native_pixmap);
34 return make_scoped_ptr<GpuMemoryBufferImpl>( 34 return make_scoped_ptr<GpuMemoryBufferImpl>(
35 new GpuMemoryBufferImplOzoneNativePixmap(handle.id, size, format, 35 new GpuMemoryBufferImplOzoneNativePixmap(handle.id, size, format,
36 callback, native_pixmap.Pass())); 36 callback, native_pixmap.Pass()));
37 } 37 }
38 38
39 bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) { 39 bool GpuMemoryBufferImplOzoneNativePixmap::Map(void** data) {
40 return pixmap_->Map(data); 40 mapped_ = pixmap_->Map(data);
41 DCHECK(mapped_);
42 return mapped_;
41 } 43 }
42 44
43 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() { 45 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() {
44 pixmap_->Unmap(); 46 pixmap_->Unmap();
no sievers 2015/08/18 19:05:49 so do you still want to call pixmap_->Unmap() here
dshwang 2015/08/19 07:02:59 it's checked inside pixmap_->Unmap(), so I didn't
reveman 2015/08/19 09:09:50 You should probably remove the return type from Pi
dshwang 2015/08/19 13:11:03 Done.
47 mapped_ = false;
45 } 48 }
46 49
47 void GpuMemoryBufferImplOzoneNativePixmap::GetStride(int* stride) const { 50 void GpuMemoryBufferImplOzoneNativePixmap::GetStride(int* stride) const {
48 pixmap_->GetStride(stride); 51 pixmap_->GetStride(stride);
49 } 52 }
50 53
51 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle() 54 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle()
52 const { 55 const {
53 gfx::GpuMemoryBufferHandle handle; 56 gfx::GpuMemoryBufferHandle handle;
54 handle.type = gfx::OZONE_NATIVE_PIXMAP; 57 handle.type = gfx::OZONE_NATIVE_PIXMAP;
55 handle.id = id_; 58 handle.id = id_;
56 return handle; 59 return handle;
57 } 60 }
58 61
59 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/common/stub_client_native_pixmap_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698