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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 gfx::BufferUsage usage) override { | 73 gfx::BufferUsage usage) override { |
74 DCHECK(!handle.fds.empty()); | 74 DCHECK(!handle.fds.empty()); |
75 base::ScopedFD scoped_fd(handle.fds[0].fd); | 75 base::ScopedFD scoped_fd(handle.fds[0].fd); |
76 switch (usage) { | 76 switch (usage) { |
77 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 77 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
78 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 78 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
79 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
80 // TODO(dcastagna): Add support for pixmaps with multiple FDs for non | 80 // TODO(dcastagna): Add support for pixmaps with multiple FDs for non |
81 // scanout buffers. | 81 // scanout buffers. |
82 return ClientNativePixmapDmaBuf::ImportFromDmabuf( | 82 return ClientNativePixmapDmaBuf::ImportFromDmabuf( |
83 scoped_fd.release(), size, handle.strides_and_offsets[0].first); | 83 scoped_fd.release(), size, handle.planes[0].stride); |
84 #else | 84 #else |
85 NOTREACHED(); | 85 NOTREACHED(); |
86 return nullptr; | 86 return nullptr; |
87 #endif | 87 #endif |
88 case gfx::BufferUsage::GPU_READ: | 88 case gfx::BufferUsage::GPU_READ: |
89 case gfx::BufferUsage::SCANOUT: | 89 case gfx::BufferUsage::SCANOUT: |
90 return base::WrapUnique(new ClientNativePixmapGbm); | 90 return base::WrapUnique(new ClientNativePixmapGbm); |
91 } | 91 } |
92 NOTREACHED(); | 92 NOTREACHED(); |
93 return nullptr; | 93 return nullptr; |
94 } | 94 } |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); | 96 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); |
97 }; | 97 }; |
98 | 98 |
99 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { | 99 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { |
100 return new ClientNativePixmapFactoryGbm(); | 100 return new ClientNativePixmapFactoryGbm(); |
101 } | 101 } |
102 | 102 |
103 } // namespace ui | 103 } // namespace ui |
OLD | NEW |