summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-02-19 11:29:57 +0100
committerThierry Reding <treding@nvidia.com>2014-07-09 11:45:02 +0200
commitd08109dde59b0f1ed40fe76e4a5ee53029e7a574 (patch)
treebe8bcb10eb96ad93f101d5c7e14491b3bda7845d
parent72452cd5d179e44dfebbd73cbe5c83fe15b5a12f (diff)
Open Tegra DRM device
The libdrm-tegra API will perform some basic sanity checks on the file descriptor and wrap it into an opaque structure. This is groundwork to implement more advanced features such as EXA or DRI2. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--configure.ac2
-rw-r--r--src/driver.c10
-rw-r--r--src/driver.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index b839b3d..dec9ee7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
AC_HEADER_STDC
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.2])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.2 libdrm_tegra])
AM_CONDITIONAL(DRM, test "x$DRM" = xyes)
PKG_CHECK_MODULES(UDEV, [libudev], [udev=yes], [udev=no])
diff --git a/src/driver.c b/src/driver.c
index 6434f0e..66dc3f2 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -58,6 +58,8 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
+#include <libdrm/tegra.h>
+
#include "compat-api.h"
#include "driver.h"
@@ -353,6 +355,12 @@ TegraPreInit(ScrnInfoPtr pScrn, int flags)
if (tegra->fd < 0)
return FALSE;
+ ret = drm_tegra_new(&tegra->drm, tegra->fd);
+ if (ret < 0) {
+ close(tegra->fd);
+ return FALSE;
+ }
+
tegra->drmmode.fd = tegra->fd;
#ifdef TEGRA_OUTPUT_SLAVE_SUPPORT
@@ -593,6 +601,8 @@ TegraCloseScreen(CLOSE_SCREEN_ARGS_DECL)
if (pScrn->vtSema)
TegraLeaveVT(VT_FUNC_ARGS);
+ drm_tegra_close(tegra->drm);
+
pScreen->CreateScreenResources = tegra->createScreenResources;
pScreen->BlockHandler = tegra->BlockHandler;
diff --git a/src/driver.h b/src/driver.h
index 563e854..15d4e4c 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -45,6 +45,7 @@ typedef struct
typedef struct _TegraRec
{
+ struct drm_tegra *drm;
int fd;
EntPtr entityPrivate;