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 #include "ui/gfx/linux/client_native_pixmap_dmabuf.h" | 5 #include "ui/gfx/linux/client_native_pixmap_dmabuf.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/version.h> | 8 #include <linux/version.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/ioctl.h> | 10 #include <sys/ioctl.h> |
11 #include <sys/mman.h> | 11 #include <sys/mman.h> |
12 #include <xf86drm.h> | 12 #include <xf86drm.h> |
13 | 13 |
14 #include "base/debug/crash_logging.h" | 14 #include "base/debug/crash_logging.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/posix/eintr_wrapper.h" | 16 #include "base/posix/eintr_wrapper.h" |
17 #include "base/process/memory.h" | 17 #include "base/process/memory.h" |
18 #include "base/process/process_metrics.h" | 18 #include "base/process/process_metrics.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
21 | 21 |
22 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) | 22 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) |
23 #include <linux/dma-buf.h> | 23 #include <linux/dma-buf.h> |
24 #else | 24 #else |
25 #include <linux/types.h> | 25 #include <linux/types.h> |
26 | 26 |
27 struct dma_buf_sync { | 27 struct dma_buf_sync { |
28 __u64 flags; | 28 __u64 flags; |
29 }; | 29 }; |
30 | 30 |
31 #define DMA_BUF_SYNC_READ (1 << 0) | 31 #define DMA_BUF_SYNC_READ (1 << 0) |
32 #define DMA_BUF_SYNC_WRITE (2 << 0) | 32 #define DMA_BUF_SYNC_WRITE (2 << 0) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 uint8_t* address = reinterpret_cast<uint8_t*>(data_); | 155 uint8_t* address = reinterpret_cast<uint8_t*>(data_); |
156 return address + pixmap_handle_.planes[plane].offset; | 156 return address + pixmap_handle_.planes[plane].offset; |
157 } | 157 } |
158 | 158 |
159 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { | 159 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { |
160 DCHECK_LT(plane, pixmap_handle_.planes.size()); | 160 DCHECK_LT(plane, pixmap_handle_.planes.size()); |
161 return pixmap_handle_.planes[plane].stride; | 161 return pixmap_handle_.planes[plane].stride; |
162 } | 162 } |
163 | 163 |
164 } // namespace gfx | 164 } // namespace gfx |
OLD | NEW |