Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc

Issue 2488673003: Ozone DRM: Improve inclusions of hardcoded definitions for dma-buf. (Closed)
Patch Set: Use correct version of Linux. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ozone/platform/drm/common/client_native_pixmap_dmabuf.h" 5 #include "ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/version.h>
8 #include <stddef.h> 9 #include <stddef.h>
9 #include <sys/mman.h> 10 #include <sys/mman.h>
10 #include <xf86drm.h> 11 #include <xf86drm.h>
11 12
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/process/memory.h" 14 #include "base/process/memory.h"
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 16
16 #if defined(USE_OZONE) 17 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
17 // TODO(vignatti): replace the local definitions below with #include
18 // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
19 #include <linux/types.h> 18 #include <linux/types.h>
20 19
21 struct local_dma_buf_sync { 20 struct local_dma_buf_sync {
22 __u64 flags; 21 __u64 flags;
23 }; 22 };
24 23
25 #define LOCAL_DMA_BUF_SYNC_READ (1 << 0) 24 #define LOCAL_DMA_BUF_SYNC_READ (1 << 0)
26 #define LOCAL_DMA_BUF_SYNC_WRITE (2 << 0) 25 #define LOCAL_DMA_BUF_SYNC_WRITE (2 << 0)
27 #define LOCAL_DMA_BUF_SYNC_RW \ 26 #define LOCAL_DMA_BUF_SYNC_RW \
28 (LOCAL_DMA_BUF_SYNC_READ | LOCAL_DMA_BUF_SYNC_WRITE) 27 (LOCAL_DMA_BUF_SYNC_READ | LOCAL_DMA_BUF_SYNC_WRITE)
29 #define LOCAL_DMA_BUF_SYNC_START (0 << 2) 28 #define LOCAL_DMA_BUF_SYNC_START (0 << 2)
30 #define LOCAL_DMA_BUF_SYNC_END (1 << 2) 29 #define LOCAL_DMA_BUF_SYNC_END (1 << 2)
31 30
32 #define LOCAL_DMA_BUF_BASE 'b' 31 #define LOCAL_DMA_BUF_BASE 'b'
33 #define LOCAL_DMA_BUF_IOCTL_SYNC \ 32 #define LOCAL_DMA_BUF_IOCTL_SYNC \
34 _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync) 33 _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync)
34
35 #else
36 #include <linux/dma-buf.h>
35 #endif 37 #endif
36 38
37 namespace ui { 39 namespace ui {
38 40
39 namespace { 41 namespace {
40 42
41 void PrimeSyncStart(int dmabuf_fd) { 43 void PrimeSyncStart(int dmabuf_fd) {
42 struct local_dma_buf_sync sync_start = {0}; 44 struct local_dma_buf_sync sync_start = {0};
43 45
44 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; 46 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 uint8_t* address = reinterpret_cast<uint8_t*>(data_); 112 uint8_t* address = reinterpret_cast<uint8_t*>(data_);
111 return address + pixmap_handle_.planes[plane].offset; 113 return address + pixmap_handle_.planes[plane].offset;
112 } 114 }
113 115
114 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { 116 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const {
115 DCHECK_LT(plane, pixmap_handle_.planes.size()); 117 DCHECK_LT(plane, pixmap_handle_.planes.size());
116 return pixmap_handle_.planes[plane].stride; 118 return pixmap_handle_.planes[plane].stride;
117 } 119 }
118 120
119 } // namespace ui 121 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698