Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: ui/gfx/linux/client_native_pixmap_dmabuf.cc

Issue 2805503003: ClientNativePixmapFactoryDmabuf uses ioctl, instead of drmIoctl. (Closed)
Patch Set: remove dcheck Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/linux/client_native_pixmap_dmabuf.cc
diff --git a/ui/gfx/linux/client_native_pixmap_dmabuf.cc b/ui/gfx/linux/client_native_pixmap_dmabuf.cc
index d656c338f0a6d9eb86e9a3e0a1dd304559d4e28e..1bb441dc25ce53269e8d9ca56af3eb8f21a5ed63 100644
--- a/ui/gfx/linux/client_native_pixmap_dmabuf.cc
+++ b/ui/gfx/linux/client_native_pixmap_dmabuf.cc
@@ -7,36 +7,35 @@
#include <fcntl.h>
#include <linux/version.h>
#include <stddef.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <xf86drm.h>
#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, 6, 0)
+#include <linux/dma-buf.h>
+#else
#include <linux/types.h>
-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 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)
-#define LOCAL_DMA_BUF_BASE 'b'
-#define LOCAL_DMA_BUF_IOCTL_SYNC \
- _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync)
-
-#else
-#include <linux/dma-buf.h>
+#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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698