| 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/client_native_pixmap_manager_gbm.h" | 5 #include "ui/ozone/platform/drm/common/client_native_pixmap_manager_gbm.h" |
| 6 | 6 |
| 7 #include "base/file_descriptor_posix.h" | 7 #include "base/file_descriptor_posix.h" |
| 8 #include "ui/ozone/public/client_native_pixmap_manager.h" | 8 #include "ui/ozone/public/client_native_pixmap_manager.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 class ClientNativePixmapManagerGbm : public ClientNativePixmapManager { | 14 class ClientNativePixmapManagerGbm : public ClientNativePixmapManager { |
| 15 public: | 15 public: |
| 16 ClientNativePixmapManagerGbm() {} | 16 ClientNativePixmapManagerGbm() {} |
| 17 ~ClientNativePixmapManagerGbm() override {} | 17 ~ClientNativePixmapManagerGbm() override { |
| 18 if (vgem_fd_.auto_close) { |
| 19 base::ScopedFD closing_fd(vgem_fd_.fd); |
| 20 } |
| 21 } |
| 18 | 22 |
| 19 // ClientNativePixmapManager: | 23 // ClientNativePixmapManager: |
| 20 std::vector<Configuration> GetSupportedConfigurations() const override { | 24 std::vector<Configuration> GetSupportedConfigurations() const override { |
| 21 std::vector<Configuration> configurations = { | 25 std::vector<Configuration> configurations = { |
| 22 {NATIVE_PIXMAP_FORMAT_BGRA_8888, NATIVE_PIXMAP_USAGE_SCANOUT}, | 26 {NATIVE_PIXMAP_FORMAT_BGRA_8888, NATIVE_PIXMAP_USAGE_SCANOUT}, |
| 23 {NATIVE_PIXMAP_FORMAT_RGBX_8888, NATIVE_PIXMAP_USAGE_SCANOUT}}; | 27 {NATIVE_PIXMAP_FORMAT_RGBX_8888, NATIVE_PIXMAP_USAGE_SCANOUT}}; |
| 24 return configurations; | 28 return configurations; |
| 25 } | 29 } |
| 26 scoped_ptr<ClientNativePixmap> ImportClientNativePixmap( | 30 scoped_ptr<ClientNativePixmap> ImportClientNativePixmap( |
| 27 base::FileDescriptor handle, | 31 base::FileDescriptor handle, |
| 28 gfx::Size size, | 32 gfx::Size size, |
| 29 NativePixmapFormat format, | 33 NativePixmapFormat format, |
| 30 NativePixmapUsage usage) override { | 34 NativePixmapUsage usage) override { |
| 31 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
| 32 return nullptr; | 36 return nullptr; |
| 33 } | 37 } |
| 34 | 38 |
| 35 private: | 39 private: |
| 40 void Initialize(const base::FileDescriptor& virtual_device) override { |
| 41 DCHECK_EQ(vgem_fd_.fd, -1); |
| 42 if (virtual_device.fd >= 0) |
| 43 vgem_fd_ = virtual_device; |
| 44 } |
| 45 |
| 46 base::FileDescriptor vgem_fd_; |
| 47 |
| 36 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapManagerGbm); | 48 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapManagerGbm); |
| 37 }; | 49 }; |
| 38 | 50 |
| 39 } // namespace | 51 } // namespace |
| 40 | 52 |
| 41 ClientNativePixmapManager* CreateClientNativePixmapManagerGbm() { | 53 ClientNativePixmapManager* CreateClientNativePixmapManagerGbm() { |
| 42 return new ClientNativePixmapManagerGbm(); | 54 return new ClientNativePixmapManagerGbm(); |
| 43 } | 55 } |
| 44 | 56 |
| 45 } // namespace ui | 57 } // namespace ui |
| OLD | NEW |