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" |
11 #include "ui/ozone/platform/drm/common/drm_util.h" | |
11 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck | 12 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck |
13 #include "ui/ozone/public/ozone_platform.h" | |
12 | 14 |
13 #if defined(USE_VGEM_MAP) | 15 #if defined(USE_VGEM_MAP) |
14 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h" | 16 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h" |
15 #endif | 17 #endif |
16 | 18 |
17 namespace ui { | 19 namespace ui { |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 class ClientNativePixmapGbm : public ClientNativePixmap { | 23 class ClientNativePixmapGbm : public ClientNativePixmap { |
(...skipping 22 matching lines...) Expand all Loading... | |
44 // It's called in IO thread. We rely on clients for thread-safety. | 46 // It's called in IO thread. We rely on clients for thread-safety. |
45 // Switching to an IPC message filter ensures thread-safety. | 47 // Switching to an IPC message filter ensures thread-safety. |
46 DCHECK_LT(vgem_fd_.get(), 0); | 48 DCHECK_LT(vgem_fd_.get(), 0); |
47 vgem_fd_ = std::move(device_fd); | 49 vgem_fd_ = std::move(device_fd); |
48 #endif | 50 #endif |
49 } | 51 } |
50 bool IsConfigurationSupported(gfx::BufferFormat format, | 52 bool IsConfigurationSupported(gfx::BufferFormat format, |
51 gfx::BufferUsage usage) const override { | 53 gfx::BufferUsage usage) const override { |
52 switch (usage) { | 54 switch (usage) { |
53 case gfx::BufferUsage::GPU_READ: | 55 case gfx::BufferUsage::GPU_READ: |
54 case gfx::BufferUsage::SCANOUT: | 56 case gfx::BufferUsage::SCANOUT: { |
55 return format == gfx::BufferFormat::RGBA_8888 || | 57 std::vector<uint32_t> support_formats; |
56 format == gfx::BufferFormat::RGBX_8888 || | 58 ui::OzonePlatform::GetInstance()->GetSupportedFormats(&support_formats); |
spang
2016/01/18 18:14:31
The renderer process is allowed to have a ClientNa
william.xie
2016/01/19 04:40:16
Done.
| |
57 format == gfx::BufferFormat::BGRA_8888 || | 59 return find(support_formats.begin(), support_formats.end(), |
58 format == gfx::BufferFormat::BGRX_8888; | 60 GetFourCCFormatForFramebuffer(format)) != |
61 support_formats.end(); | |
62 } | |
63 | |
59 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 64 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
60 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { | 65 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { |
61 #if defined(USE_VGEM_MAP) | 66 #if defined(USE_VGEM_MAP) |
62 return vgem_fd_.is_valid() && format == gfx::BufferFormat::BGRA_8888; | 67 return vgem_fd_.is_valid() && format == gfx::BufferFormat::BGRA_8888; |
63 #else | 68 #else |
64 return false; | 69 return false; |
65 #endif | 70 #endif |
66 } | 71 } |
67 } | 72 } |
68 NOTREACHED(); | 73 NOTREACHED(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 #endif | 106 #endif |
102 | 107 |
103 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); | 108 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); |
104 }; | 109 }; |
105 | 110 |
106 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { | 111 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { |
107 return new ClientNativePixmapFactoryGbm(); | 112 return new ClientNativePixmapFactoryGbm(); |
108 } | 113 } |
109 | 114 |
110 } // namespace ui | 115 } // namespace ui |
OLD | NEW |