| 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 22 matching lines...) Expand all Loading... |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace ui { | 35 namespace ui { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 void PrimeSyncStart(int dmabuf_fd) { | 39 void PrimeSyncStart(int dmabuf_fd) { |
| 40 struct local_dma_buf_sync sync_start = {0}; | 40 struct local_dma_buf_sync sync_start = {0}; |
| 41 | 41 |
| 42 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_READ; | 42 sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_READ; |
| 43 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) | 43 // TODO(tiago.vignatti): fix the crash bug. crbug.com/605774 |
| 44 if (false && drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) |
| 44 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; | 45 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void PrimeSyncEnd(int dmabuf_fd) { | 48 void PrimeSyncEnd(int dmabuf_fd) { |
| 48 struct local_dma_buf_sync sync_end = {0}; | 49 struct local_dma_buf_sync sync_end = {0}; |
| 49 | 50 |
| 50 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_WRITE; | 51 sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_WRITE; |
| 51 if (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end)) | 52 if (false && drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end)) |
| 52 PLOG(ERROR) << "Failed DMA_BUF_SYNC_END"; | 53 PLOG(ERROR) << "Failed DMA_BUF_SYNC_END"; |
| 53 } | 54 } |
| 54 | 55 |
| 55 } // namespace | 56 } // namespace |
| 56 | 57 |
| 57 // static | 58 // static |
| 58 std::unique_ptr<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( | 59 std::unique_ptr<ClientNativePixmap> ClientNativePixmapDmaBuf::ImportFromDmabuf( |
| 59 int dmabuf_fd, | 60 int dmabuf_fd, |
| 60 const gfx::Size& size, | 61 const gfx::Size& size, |
| 61 int stride) { | 62 int stride) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 void ClientNativePixmapDmaBuf::Unmap() { | 92 void ClientNativePixmapDmaBuf::Unmap() { |
| 92 TRACE_EVENT0("drm", "DmaBuf:Unmap"); | 93 TRACE_EVENT0("drm", "DmaBuf:Unmap"); |
| 93 PrimeSyncEnd(dmabuf_fd_.get()); | 94 PrimeSyncEnd(dmabuf_fd_.get()); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void ClientNativePixmapDmaBuf::GetStride(int* stride) const { | 97 void ClientNativePixmapDmaBuf::GetStride(int* stride) const { |
| 97 *stride = stride_; | 98 *stride = stride_; |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace ui | 101 } // namespace ui |
| OLD | NEW |