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/ozone/platform/drm/client_native_pixmap_factory_gbm.h" | 5 #include "ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/gfx/native_pixmap_handle_ozone.h" | 10 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 gfx::BufferUsage usage) const override { | 40 gfx::BufferUsage usage) const override { |
| 41 switch (usage) { | 41 switch (usage) { |
| 42 case gfx::BufferUsage::GPU_READ: | 42 case gfx::BufferUsage::GPU_READ: |
| 43 case gfx::BufferUsage::SCANOUT: | 43 case gfx::BufferUsage::SCANOUT: |
| 44 return format == gfx::BufferFormat::RGBA_8888 || | 44 return format == gfx::BufferFormat::RGBA_8888 || |
| 45 format == gfx::BufferFormat::RGBX_8888 || | 45 format == gfx::BufferFormat::RGBX_8888 || |
| 46 format == gfx::BufferFormat::BGRA_8888 || | 46 format == gfx::BufferFormat::BGRA_8888 || |
| 47 format == gfx::BufferFormat::BGRX_8888; | 47 format == gfx::BufferFormat::BGRX_8888; |
| 48 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 48 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
| 49 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { | 49 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { |
| 50 #if defined(OS_CHROMEOS) | |
| 50 return format == gfx::BufferFormat::BGRA_8888; | 51 return format == gfx::BufferFormat::BGRA_8888; |
| 52 #else | |
| 53 return false; | |
| 54 #endif | |
| 51 } | 55 } |
| 52 } | 56 } |
| 53 NOTREACHED(); | 57 NOTREACHED(); |
| 54 return false; | 58 return false; |
| 55 } | 59 } |
| 56 scoped_ptr<ClientNativePixmap> ImportFromHandle( | 60 scoped_ptr<ClientNativePixmap> ImportFromHandle( |
| 57 const gfx::NativePixmapHandle& handle, | 61 const gfx::NativePixmapHandle& handle, |
| 58 const gfx::Size& size, | 62 const gfx::Size& size, |
| 59 gfx::BufferUsage usage) override { | 63 gfx::BufferUsage usage) override { |
| 60 base::ScopedFD scoped_fd(handle.fd.fd); | 64 base::ScopedFD scoped_fd(handle.fd.fd); |
| 61 | 65 |
| 62 switch (usage) { | 66 switch (usage) { |
| 63 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 67 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
| 64 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 68 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
| 69 #if defined(OS_CHROMEOS) | |
| 65 return ClientNativePixmapDmaBuf::ImportFromDmabuf( | 70 return ClientNativePixmapDmaBuf::ImportFromDmabuf( |
| 66 scoped_fd.get(), size, handle.stride); | 71 scoped_fd.release(), size, handle.stride); |
| 72 #else | |
| 73 return nullptr; | |
|
spang
2016/03/30 21:03:24
NOTREACHED()
vignatti (out of this project)
2016/03/30 21:13:56
Done.
spang
2016/03/30 21:20:01
You forgot the semicolon.
| |
| 74 #endif | |
| 67 case gfx::BufferUsage::GPU_READ: | 75 case gfx::BufferUsage::GPU_READ: |
| 68 case gfx::BufferUsage::SCANOUT: | 76 case gfx::BufferUsage::SCANOUT: |
| 69 return make_scoped_ptr<ClientNativePixmapGbm>( | 77 return make_scoped_ptr<ClientNativePixmapGbm>( |
| 70 new ClientNativePixmapGbm); | 78 new ClientNativePixmapGbm); |
| 71 } | 79 } |
| 72 NOTREACHED(); | 80 NOTREACHED(); |
| 73 return nullptr; | 81 return nullptr; |
| 74 } | 82 } |
| 75 | 83 |
| 76 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); | 84 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); |
| 77 }; | 85 }; |
| 78 | 86 |
| 79 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { | 87 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { |
| 80 return new ClientNativePixmapFactoryGbm(); | 88 return new ClientNativePixmapFactoryGbm(); |
| 81 } | 89 } |
| 82 | 90 |
| 83 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |