| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <sys/mman.h> | 9 #include <sys/mman.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 namespace ui { | 37 namespace ui { |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 void PrimeSyncStart(int dmabuf_fd) { | 41 void PrimeSyncStart(int dmabuf_fd) { |
| 42 struct local_dma_buf_sync sync_start = {0}; | 42 struct local_dma_buf_sync sync_start = {0}; |
| 43 | 43 |
| 44 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; | 44 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; |
| 45 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) | 45 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) |
| 46 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; | 46 DPLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void PrimeSyncEnd(int dmabuf_fd) { | 49 void PrimeSyncEnd(int dmabuf_fd) { |
| 50 struct local_dma_buf_sync sync_end = {0}; | 50 struct local_dma_buf_sync sync_end = {0}; |
| 51 | 51 |
| 52 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW; | 52 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW; |
| 53 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end)) | 53 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end)) |
| 54 PLOG(ERROR) << "Failed DMA_BUF_SYNC_END"; | 54 DPLOG(ERROR) << "Failed DMA_BUF_SYNC_END"; |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 std::unique_ptr<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( | 60 std::unique_ptr<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( |
| 61 int dmabuf_fd, | 61 int dmabuf_fd, |
| 62 const gfx::Size& size, | 62 const gfx::Size& size, |
| 63 int stride) { | 63 int stride) { |
| 64 DCHECK_GE(dmabuf_fd, 0); | 64 DCHECK_GE(dmabuf_fd, 0); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void ClientNativePixmapDmaBuf::Unmap() { | 99 void ClientNativePixmapDmaBuf::Unmap() { |
| 100 TRACE_EVENT0("drm", "DmaBuf:Unmap"); | 100 TRACE_EVENT0("drm", "DmaBuf:Unmap"); |
| 101 PrimeSyncEnd(dmabuf_fd_.get()); | 101 PrimeSyncEnd(dmabuf_fd_.get()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ClientNativePixmapDmaBuf::GetStride(int* stride) const { | 104 void ClientNativePixmapDmaBuf::GetStride(int* stride) const { |
| 105 *stride = stride_; | 105 *stride = stride_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace ui | 108 } // namespace ui |
| OLD | NEW |