| 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> |
| 8 |
| 7 #include "ui/gfx/native_pixmap_handle_ozone.h" | 9 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| 8 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck | 10 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck |
| 9 | 11 |
| 10 #if defined(USE_VGEM_MAP) | 12 #if defined(USE_VGEM_MAP) |
| 11 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h" | 13 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h" |
| 12 #endif | 14 #endif |
| 13 | 15 |
| 14 namespace ui { | 16 namespace ui { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 public: | 36 public: |
| 35 ClientNativePixmapFactoryGbm() {} | 37 ClientNativePixmapFactoryGbm() {} |
| 36 ~ClientNativePixmapFactoryGbm() override {} | 38 ~ClientNativePixmapFactoryGbm() override {} |
| 37 | 39 |
| 38 // ClientNativePixmapFactory: | 40 // ClientNativePixmapFactory: |
| 39 void Initialize(base::ScopedFD device_fd) override { | 41 void Initialize(base::ScopedFD device_fd) override { |
| 40 #if defined(USE_VGEM_MAP) | 42 #if defined(USE_VGEM_MAP) |
| 41 // It's called in IO thread. We rely on clients for thread-safety. | 43 // It's called in IO thread. We rely on clients for thread-safety. |
| 42 // Switching to an IPC message filter ensures thread-safety. | 44 // Switching to an IPC message filter ensures thread-safety. |
| 43 DCHECK_LT(vgem_fd_.get(), 0); | 45 DCHECK_LT(vgem_fd_.get(), 0); |
| 44 vgem_fd_ = device_fd.Pass(); | 46 vgem_fd_ = std::move(device_fd); |
| 45 #endif | 47 #endif |
| 46 } | 48 } |
| 47 bool IsConfigurationSupported(gfx::BufferFormat format, | 49 bool IsConfigurationSupported(gfx::BufferFormat format, |
| 48 gfx::BufferUsage usage) const override { | 50 gfx::BufferUsage usage) const override { |
| 49 switch (usage) { | 51 switch (usage) { |
| 50 case gfx::BufferUsage::GPU_READ: | 52 case gfx::BufferUsage::GPU_READ: |
| 51 case gfx::BufferUsage::SCANOUT: | 53 case gfx::BufferUsage::SCANOUT: |
| 52 return format == gfx::BufferFormat::RGBA_8888 || | 54 return format == gfx::BufferFormat::RGBA_8888 || |
| 53 format == gfx::BufferFormat::BGRA_8888 || | 55 format == gfx::BufferFormat::BGRA_8888 || |
| 54 format == gfx::BufferFormat::BGRX_8888; | 56 format == gfx::BufferFormat::BGRX_8888; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #endif | 99 #endif |
| 98 | 100 |
| 99 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); | 101 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { | 104 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { |
| 103 return new ClientNativePixmapFactoryGbm(); | 105 return new ClientNativePixmapFactoryGbm(); |
| 104 } | 106 } |
| 105 | 107 |
| 106 } // namespace ui | 108 } // namespace ui |
| OLD | NEW |