[Mesa-dev] [PATCH 1/2] pipe-loader: Add auth_x parameter to pipe_loader_drm_probe_fd()

Tom Stellard tom at stellard.net
Mon Jan 27 08:13:56 PST 2014


From: Tom Stellard <thomas.stellard at amd.com>

The caller can use this boolean to parameter to tell the pipe-loader
to authenticate with the X server when probing a file descriptor.
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.h     | 6 +++++-
 src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 8 +++++---
 src/gallium/targets/gbm/gbm.c                       | 2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index e0525df..40c87eb 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -128,9 +128,13 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
  * This function is platform-specific.
  *
  * \sa pipe_loader_probe
+ *
+ * \param auth_x If true, the pipe-loader will attenpt to
+ *               authenticate with the X server.
  */
 boolean
-pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
+pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd,
+                         boolean auth_x);
 
 #endif
 
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index d6869fd..9484db8 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -113,7 +113,8 @@ disconnect:
 }
 
 boolean
-pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
+pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd,
+                         boolean auth_x)
 {
    struct pipe_loader_drm_device *ddev = CALLOC_STRUCT(pipe_loader_drm_device);
    int vendor_id, chip_id;
@@ -128,7 +129,8 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
    ddev->base.ops = &pipe_loader_drm_ops;
    ddev->fd = fd;
 
-   pipe_loader_drm_x_auth(fd);
+   if (auth_x)
+      pipe_loader_drm_x_auth(fd);
 
    ddev->base.driver_name = loader_get_driver_for_fd(fd, _LOADER_GALLIUM);
    if (!ddev->base.driver_name)
@@ -160,7 +162,7 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
       if (fd < 0)
          continue;
 
-      if (j >= ndev || !pipe_loader_drm_probe_fd(&devs[j], fd))
+      if (j >= ndev || !pipe_loader_drm_probe_fd(&devs[j], fd, true))
          close(fd);
 
       j++;
diff --git a/src/gallium/targets/gbm/gbm.c b/src/gallium/targets/gbm/gbm.c
index 8f46057..deaa401 100644
--- a/src/gallium/targets/gbm/gbm.c
+++ b/src/gallium/targets/gbm/gbm.c
@@ -52,7 +52,7 @@ gallium_screen_create(struct gbm_gallium_drm_device *gdrm)
 #ifdef HAVE_PIPE_LOADER_DRM
    int ret;
 
-   ret = pipe_loader_drm_probe_fd(&dev, gdrm->base.base.fd);
+   ret = pipe_loader_drm_probe_fd(&dev, gdrm->base.base.fd, true);
    if (!ret)
       return -1;
 #endif /* HAVE_PIPE_LOADER_DRM */
-- 
1.8.1.5



More information about the mesa-dev mailing list