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/mman.h> | 10 #include <sys/mman.h> |
(...skipping 29 matching lines...) Expand all Loading... | |
40 #endif | 40 #endif |
41 | 41 |
42 namespace gfx { | 42 namespace gfx { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 void PrimeSyncStart(int dmabuf_fd) { | 46 void PrimeSyncStart(int dmabuf_fd) { |
47 struct local_dma_buf_sync sync_start = {0}; | 47 struct local_dma_buf_sync sync_start = {0}; |
48 | 48 |
49 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; | 49 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; |
50 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) | 50 #if DCHECK_IS_ON() |
51 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; | 51 int rv = |
52 #endif | |
53 drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start); | |
marcheu
2017/03/28 01:07:26
I don't think drmIoctl is meant to be used for non
| |
54 DPLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_START"; | |
52 } | 55 } |
53 | 56 |
54 void PrimeSyncEnd(int dmabuf_fd) { | 57 void PrimeSyncEnd(int dmabuf_fd) { |
55 struct local_dma_buf_sync sync_end = {0}; | 58 struct local_dma_buf_sync sync_end = {0}; |
56 | 59 |
57 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW; | 60 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW; |
58 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end)) | 61 #if DCHECK_IS_ON() |
59 PLOG(ERROR) << "Failed DMA_BUF_SYNC_END"; | 62 int rv = |
63 #endif | |
64 drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end); | |
65 DPLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_END"; | |
60 } | 66 } |
61 | 67 |
62 } // namespace | 68 } // namespace |
63 | 69 |
64 // static | 70 // static |
65 std::unique_ptr<gfx::ClientNativePixmap> | 71 std::unique_ptr<gfx::ClientNativePixmap> |
66 ClientNativePixmapDmaBuf::ImportFromDmabuf( | 72 ClientNativePixmapDmaBuf::ImportFromDmabuf( |
67 const gfx::NativePixmapHandle& handle, | 73 const gfx::NativePixmapHandle& handle, |
68 const gfx::Size& size) { | 74 const gfx::Size& size) { |
69 return base::WrapUnique(new ClientNativePixmapDmaBuf(handle, size)); | 75 return base::WrapUnique(new ClientNativePixmapDmaBuf(handle, size)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 uint8_t* address = reinterpret_cast<uint8_t*>(data_); | 147 uint8_t* address = reinterpret_cast<uint8_t*>(data_); |
142 return address + pixmap_handle_.planes[plane].offset; | 148 return address + pixmap_handle_.planes[plane].offset; |
143 } | 149 } |
144 | 150 |
145 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { | 151 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { |
146 DCHECK_LT(plane, pixmap_handle_.planes.size()); | 152 DCHECK_LT(plane, pixmap_handle_.planes.size()); |
147 return pixmap_handle_.planes[plane].stride; | 153 return pixmap_handle_.planes[plane].stride; |
148 } | 154 } |
149 | 155 |
150 } // namespace gfx | 156 } // namespace gfx |
OLD | NEW |