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/common/native_pixmap_manager_gbm.h" | 5 #include "ui/ozone/platform/drm/common/native_pixmap_manager_gbm.h" |
6 | 6 |
| 7 #include "base/file_descriptor_posix.h" |
| 8 #include "base/files/scoped_file.h" |
7 #include "ui/ozone/public/native_pixmap_manager.h" | 9 #include "ui/ozone/public/native_pixmap_manager.h" |
8 | 10 |
9 namespace ui { | 11 namespace ui { |
10 | 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 class NativePixmapManagerGbm : public NativePixmapManager { | 15 class NativePixmapManagerGbm : public NativePixmapManager { |
14 public: | 16 public: |
15 NativePixmapManagerGbm() {} | 17 NativePixmapManagerGbm() {} |
16 ~NativePixmapManagerGbm() override {} | 18 ~NativePixmapManagerGbm() override {} |
17 | 19 |
18 // NativePixmapManager: | 20 // NativePixmapManager: |
| 21 void Initialize(const base::FileDescriptor& device_fd) override { |
| 22 DCHECK_EQ(vgem_fd_.get(), -1); |
| 23 if (device_fd.fd > 0) |
| 24 vgem_fd_.reset(device_fd.fd); |
| 25 } |
19 std::vector<Configuration> GetSupportedNativePixmapConfigurations() | 26 std::vector<Configuration> GetSupportedNativePixmapConfigurations() |
20 const override { | 27 const override { |
21 std::vector<Configuration> configurations = { | 28 std::vector<Configuration> configurations = { |
22 {SurfaceFactoryOzone::BGRA_8888, SurfaceFactoryOzone::SCANOUT}, | 29 {SurfaceFactoryOzone::BGRA_8888, SurfaceFactoryOzone::SCANOUT}, |
23 {SurfaceFactoryOzone::RGBX_8888, SurfaceFactoryOzone::SCANOUT}}; | 30 {SurfaceFactoryOzone::RGBX_8888, SurfaceFactoryOzone::SCANOUT}}; |
24 return configurations; | 31 return configurations; |
25 } | 32 } |
26 | 33 |
27 private: | 34 private: |
| 35 base::ScopedFD vgem_fd_; |
| 36 |
28 DISALLOW_COPY_AND_ASSIGN(NativePixmapManagerGbm); | 37 DISALLOW_COPY_AND_ASSIGN(NativePixmapManagerGbm); |
29 }; | 38 }; |
30 | 39 |
31 } // namespace | 40 } // namespace |
32 | 41 |
33 NativePixmapManager* CreateNativePixmapManagerGbm() { | 42 NativePixmapManager* CreateNativePixmapManagerGbm() { |
34 return new NativePixmapManagerGbm(); | 43 return new NativePixmapManagerGbm(); |
35 } | 44 } |
36 | 45 |
37 } // namespace ui | 46 } // namespace ui |
OLD | NEW |