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/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 <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 ui { | 42 namespace ui { |
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); | |
54 DPLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_START"; | |
dnicoara
2017/03/24 15:03:59
Without the PLOG, can we tell if these are failing
reveman
2017/03/24 17:16:49
I did that in previous patch but we thought this w
| |
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() |
Daniele Castagna
2017/03/24 01:54:08
It's ugly, but if it's the standard way of doing i
| |
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<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( | 71 std::unique_ptr<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( |
66 const gfx::NativePixmapHandle& handle, | 72 const gfx::NativePixmapHandle& handle, |
67 const gfx::Size& size) { | 73 const gfx::Size& size) { |
68 return base::WrapUnique(new ClientNativePixmapDmaBuf(handle, size)); | 74 return base::WrapUnique(new ClientNativePixmapDmaBuf(handle, size)); |
69 } | 75 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 uint8_t* address = reinterpret_cast<uint8_t*>(data_); | 146 uint8_t* address = reinterpret_cast<uint8_t*>(data_); |
141 return address + pixmap_handle_.planes[plane].offset; | 147 return address + pixmap_handle_.planes[plane].offset; |
142 } | 148 } |
143 | 149 |
144 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { | 150 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { |
145 DCHECK_LT(plane, pixmap_handle_.planes.size()); | 151 DCHECK_LT(plane, pixmap_handle_.planes.size()); |
146 return pixmap_handle_.planes[plane].stride; | 152 return pixmap_handle_.planes[plane].stride; |
147 } | 153 } |
148 | 154 |
149 } // namespace ui | 155 } // namespace ui |
OLD | NEW |