| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ | 6 #define UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 15 #include "ui/gfx/native_pixmap_handle.h" |
| 15 #include "ui/ozone/public/client_native_pixmap.h" | 16 #include "ui/ozone/public/client_native_pixmap.h" |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 class ClientNativePixmapDmaBuf : public ClientNativePixmap { | 20 class ClientNativePixmapDmaBuf : public ClientNativePixmap { |
| 20 public: | 21 public: |
| 21 static std::unique_ptr<ClientNativePixmap> | 22 static std::unique_ptr<ClientNativePixmap> ImportFromDmabuf( |
| 22 ImportFromDmabuf(int dmabuf_fd, const gfx::Size& size, int stride); | 23 const gfx::NativePixmapHandle& handle, |
| 24 const gfx::Size& size); |
| 23 | 25 |
| 24 ~ClientNativePixmapDmaBuf() override; | 26 ~ClientNativePixmapDmaBuf() override; |
| 25 | 27 |
| 26 // Overridden from ClientNativePixmap. | 28 // Overridden from ClientNativePixmap. |
| 27 void* Map() override; | 29 bool Map() override; |
| 28 void Unmap() override; | 30 void Unmap() override; |
| 29 void GetStride(int* stride) const override; | 31 |
| 32 void* GetMemoryAddress(size_t plane) const override; |
| 33 int GetStride(size_t plane) const override; |
| 30 | 34 |
| 31 private: | 35 private: |
| 32 ClientNativePixmapDmaBuf(int dmabuf_fd, | 36 ClientNativePixmapDmaBuf(const gfx::NativePixmapHandle& handle, |
| 33 const gfx::Size& size, | 37 const gfx::Size& size); |
| 34 int stride, | |
| 35 size_t map_size); | |
| 36 | 38 |
| 39 const gfx::NativePixmapHandle pixmap_handle_; |
| 40 const gfx::Size size_; |
| 37 base::ScopedFD dmabuf_fd_; | 41 base::ScopedFD dmabuf_fd_; |
| 38 const size_t map_size_; | |
| 39 const gfx::Size size_; | |
| 40 const int stride_; | |
| 41 void* data_; | 42 void* data_; |
| 42 | 43 |
| 43 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapDmaBuf); | 44 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapDmaBuf); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace ui | 47 } // namespace ui |
| 47 | 48 |
| 48 #endif // UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ | 49 #endif // UI_OZONE_PLATFORM_DRM_COMMON_CLIENT_NATIVE_PIXMAP_DMABUF_H_ |
| OLD | NEW |