| 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/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> |
| 11 #include <xf86drm.h> | 11 #include <xf86drm.h> |
| 12 | 12 |
| 13 #include "base/debug/crash_logging.h" | 13 #include "base/debug/crash_logging.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/process/memory.h" | 15 #include "base/process/memory.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 32 #define LOCAL_DMA_BUF_SYNC_END (1 << 2) | 32 #define LOCAL_DMA_BUF_SYNC_END (1 << 2) |
| 33 | 33 |
| 34 #define LOCAL_DMA_BUF_BASE 'b' | 34 #define LOCAL_DMA_BUF_BASE 'b' |
| 35 #define LOCAL_DMA_BUF_IOCTL_SYNC \ | 35 #define LOCAL_DMA_BUF_IOCTL_SYNC \ |
| 36 _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync) | 36 _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync) |
| 37 | 37 |
| 38 #else | 38 #else |
| 39 #include <linux/dma-buf.h> | 39 #include <linux/dma-buf.h> |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 namespace ui { | 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 (drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start)) |
| 51 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; | 51 PLOG(ERROR) << "Failed DMA_BUF_SYNC_START"; |
| 52 } | 52 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 DCHECK_LT(plane, pixmap_handle_.planes.size()); | 140 DCHECK_LT(plane, pixmap_handle_.planes.size()); |
| 141 uint8_t* address = reinterpret_cast<uint8_t*>(data_); | 141 uint8_t* address = reinterpret_cast<uint8_t*>(data_); |
| 142 return address + pixmap_handle_.planes[plane].offset; | 142 return address + pixmap_handle_.planes[plane].offset; |
| 143 } | 143 } |
| 144 | 144 |
| 145 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { | 145 int ClientNativePixmapDmaBuf::GetStride(size_t plane) const { |
| 146 DCHECK_LT(plane, pixmap_handle_.planes.size()); | 146 DCHECK_LT(plane, pixmap_handle_.planes.size()); |
| 147 return pixmap_handle_.planes[plane].stride; | 147 return pixmap_handle_.planes[plane].stride; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace ui | 150 } // namespace gfx |
| OLD | NEW |