[Mesa-dev] [PATCH 2/2] RFC anv: Use direct call into kernel for ioctl()

Chris Wilson chris at chris-wilson.co.uk
Mon Jun 19 11:32:20 UTC 2017


Bypass libc's PLT indirection and its impedance mismatch by emitting the
single syscall instruction ourselves for linux/x86_64.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: Matt Turner <mattst88 at gmail.com>
Cc: Jason Ekstrand <jason.ekstrand at intel.com>
---
 src/intel/vulkan/anv_gem.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index ac47da4117..401580cdf9 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <string.h>
 #include <errno.h>
@@ -29,18 +28,9 @@
 #include <fcntl.h>
 
 #include "anv_private.h"
+#include "common/sys_ioctl.h"
 
-static int
-anv_ioctl(int fd, unsigned long request, void *arg)
-{
-   int ret;
-
-   do {
-      ret = ioctl(fd, request, arg);
-   } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-
-   return ret;
-}
+#define anv_ioctl sys_ioctl
 
 /**
  * Wrapper around DRM_IOCTL_I915_GEM_CREATE.
-- 
2.11.0



More information about the mesa-dev mailing list