Submitted By: DJ Lucas Date: 2017-06-25 Initial Package Version: 59.0.3027.109 Upstream Status: Committed Origin: https://codereview.chromium.org/2805503003 and https://codereview.chromium.org/2851803002 Description: Allows building with kernel versions above 4.6. diff -Naurp chromium-59.0.3071.109-orig/ui/gfx/linux/client_native_pixmap_dmabuf.cc chromium-59.0.3071.109/ui/gfx/linux/client_native_pixmap_dmabuf.cc --- chromium-59.0.3071.109-orig/ui/gfx/linux/client_native_pixmap_dmabuf.cc 2017-06-23 21:55:59.459660758 -0500 +++ chromium-59.0.3071.109/ui/gfx/linux/client_native_pixmap_dmabuf.cc 2017-06-23 21:57:42.976420267 -0500 @@ -7,36 +7,35 @@ #include #include #include +#include #include #include #include "base/debug/crash_logging.h" #include "base/memory/ptr_util.h" +#include "base/posix/eintr_wrapper.h" #include "base/process/memory.h" #include "base/process/process_metrics.h" #include "base/strings/stringprintf.h" #include "base/trace_event/trace_event.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#include +#else #include -struct local_dma_buf_sync { +struct dma_buf_sync { __u64 flags; }; -#define LOCAL_DMA_BUF_SYNC_READ (1 << 0) -#define LOCAL_DMA_BUF_SYNC_WRITE (2 << 0) -#define LOCAL_DMA_BUF_SYNC_RW \ - (LOCAL_DMA_BUF_SYNC_READ | LOCAL_DMA_BUF_SYNC_WRITE) -#define LOCAL_DMA_BUF_SYNC_START (0 << 2) -#define LOCAL_DMA_BUF_SYNC_END (1 << 2) - -#define LOCAL_DMA_BUF_BASE 'b' -#define LOCAL_DMA_BUF_IOCTL_SYNC \ - _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync) +#define DMA_BUF_SYNC_READ (1 << 0) +#define DMA_BUF_SYNC_WRITE (2 << 0) +#define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE) +#define DMA_BUF_SYNC_START (0 << 2) +#define DMA_BUF_SYNC_END (1 << 2) -#else -#include +#define DMA_BUF_BASE 'b' +#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) #endif namespace gfx { @@ -44,25 +43,19 @@ namespace gfx { namespace { void PrimeSyncStart(int dmabuf_fd) { - struct local_dma_buf_sync sync_start = {0}; + struct dma_buf_sync sync_start = {0}; - sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW; -#if DCHECK_IS_ON() - int rv = -#endif - drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start); - DPLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_START"; + sync_start.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW; + int rv = HANDLE_EINTR(ioctl(dmabuf_fd, DMA_BUF_IOCTL_SYNC, &sync_start)); + PLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_START"; } void PrimeSyncEnd(int dmabuf_fd) { - struct local_dma_buf_sync sync_end = {0}; + struct dma_buf_sync sync_end = {0}; - sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW; -#if DCHECK_IS_ON() - int rv = -#endif - drmIoctl(dmabuf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end); - DPLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_END"; + sync_end.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW; + int rv = HANDLE_EINTR(ioctl(dmabuf_fd, DMA_BUF_IOCTL_SYNC, &sync_end)); + PLOG_IF(ERROR, rv) << "Failed DMA_BUF_SYNC_END"; } } // namespace