Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/platform/drm/gpu/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 } | 96 } |
| 97 | 97 |
| 98 scoped_ptr<SurfaceOzoneEGL> | 98 scoped_ptr<SurfaceOzoneEGL> |
| 99 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( | 99 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( |
| 100 gfx::AcceleratedWidget widget) { | 100 gfx::AcceleratedWidget widget) { |
| 101 DCHECK(thread_checker_.CalledOnValidThread()); | 101 DCHECK(thread_checker_.CalledOnValidThread()); |
| 102 return make_scoped_ptr( | 102 return make_scoped_ptr( |
| 103 new GbmSurfaceless(drm_thread_->CreateDrmWindowProxy(widget), this)); | 103 new GbmSurfaceless(drm_thread_->CreateDrmWindowProxy(widget), this)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GbmSurfaceFactory::GetSupportedFormats( | |
| 107 std::vector<uint32_t>* support_formats) { | |
| 108 if (drm_thread_ != nullptr) | |
| 109 drm_thread_->GetSupportedFormats(support_formats); | |
|
kalyank
2016/01/19 07:34:22
We can cache them here? no need to post a synchron
william.xie
2016/01/19 10:07:07
Done.
| |
| 110 } | |
| 111 | |
| 106 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 112 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| 107 gfx::AcceleratedWidget widget, | 113 gfx::AcceleratedWidget widget, |
| 108 gfx::Size size, | 114 gfx::Size size, |
| 109 gfx::BufferFormat format, | 115 gfx::BufferFormat format, |
| 110 gfx::BufferUsage usage) { | 116 gfx::BufferUsage usage) { |
| 111 #if !defined(OS_CHROMEOS) | 117 #if !defined(OS_CHROMEOS) |
| 112 // Support for memory mapping accelerated buffers requires some | 118 // Support for memory mapping accelerated buffers requires some |
| 113 // CrOS-specific patches (using vgem). | 119 // CrOS-specific patches (using vgem). |
| 114 DCHECK(gfx::BufferUsage::SCANOUT == usage); | 120 DCHECK(gfx::BufferUsage::SCANOUT == usage); |
| 115 #endif | 121 #endif |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 127 } | 133 } |
| 128 | 134 |
| 129 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( | 135 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( |
| 130 const gfx::NativePixmapHandle& handle) { | 136 const gfx::NativePixmapHandle& handle) { |
| 131 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); | 137 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); |
| 132 pixmap->Initialize(base::ScopedFD(handle.fd.fd), handle.stride); | 138 pixmap->Initialize(base::ScopedFD(handle.fd.fd), handle.stride); |
| 133 return pixmap; | 139 return pixmap; |
| 134 } | 140 } |
| 135 | 141 |
| 136 } // namespace ui | 142 } // namespace ui |
| OLD | NEW |