[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libdrm: Changes to 'upstream-experimental'



 Makefile.am              |    2 
 autogen.sh               |   14 --
 configure.ac             |   47 ++++++----
 include/drm/drm.h        |   14 ++
 include/drm/drm_mode.h   |   29 ++++++
 intel/intel_bufmgr.c     |    9 +
 intel/intel_bufmgr_gem.c |    7 -
 libkms/Makefile.am       |    1 
 libkms/dumb.c            |  220 +++++++++++++++++++++++++++++++++++++++++++++++
 libkms/internal.h        |    2 
 libkms/linux.c           |    3 
 m4/.gitignore            |    5 +
 tests/Makefile.am        |   12 --
 xf86drm.c                |   12 ++
 xf86drm.h                |    4 
 15 files changed, 335 insertions(+), 46 deletions(-)

New commits:
commit ba11501bb9f5bd98110dfe1385b4501c0a9a643a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Apr 11 08:25:42 2011 +0100

    configure: version bump for 2.4.25 release
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index e1bb079..d9c826d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.24],
+        [2.4.25],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])
 

commit be8802a9414e85ba07ae257fccadd245fcf7c7b6
Author: Ilija Hadzic <ihadzic@research.bell-labs.com>
Date:   Thu Mar 24 13:24:28 2011 -0400

    libdrm: (revised) vblank wait on crtc > 1
    
    Hi Alex,
    
    Enclosed is a revised version of the patch sent on Mar 18, against
    the master branch of the drm userspace (i.e. libdrm). Details
    summarised in this thread:
    http://lists.freedesktop.org/archives/dri-devel/2011-March/009499.html
    
    This patch reconciles libdrm with the the kernel change that Dave
    pushed this morning. It *supersedes* the previously sent patch (i.e.
    apply it to the master branch as it exists at the time of this writing,
    not as an incremental patch to the one sent previously).
    
    Regards,
    
    Ilija
    
    Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
    Signed-off-by: Alex Deucher <alexdeucher@gmail.com>

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 416673a..5fd24fc 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -755,6 +755,7 @@ struct drm_event_vblank {
 };
 
 #define DRM_CAP_DUMB_BUFFER 0x1
+#define DRM_CAP_VBLANK_HIGH_CRTC   0x2
 
 /* typedef area */
 typedef struct drm_clip_rect drm_clip_rect_t;
diff --git a/xf86drm.h b/xf86drm.h
index bf0d5df..20f4c78 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -296,12 +296,15 @@ typedef struct _drmTextureRegion {
 typedef enum {
     DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
     DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
+    /* bits 1-6 are reserved for high crtcs */
+    DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
     DRM_VBLANK_EVENT = 0x4000000,	/**< Send event instead of blocking */
     DRM_VBLANK_FLIP = 0x8000000,	/**< Scheduled buffer swap should flip */
     DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
     DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
     DRM_VBLANK_SIGNAL   = 0x40000000	/* Send signal instead of blocking */
 } drmVBlankSeqType;
+#define DRM_VBLANK_HIGH_CRTC_SHIFT 1
 
 typedef struct _drmVBlankReq {
 	drmVBlankSeqType type;

commit f395b0a25c9f99688e7b2799ac02f1f930f24e09
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Apr 4 08:57:42 2011 +0100

    intel: Also handle mrb_exec fallback with ring == I915_EXEC_RENDER
    
    Reported-by: Oliver McFadden <oliver.mcfadden@nokia.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index e949ff2..2df93a5 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -143,11 +143,14 @@ drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
 					cliprects, num_cliprects, DR4,
 					rings);
 
-	if (rings == 0)
+	switch (rings) {
+	case I915_EXEC_DEFAULT:
+	case I915_EXEC_RENDER:
 		return bo->bufmgr->bo_exec(bo, used,
 					   cliprects, num_cliprects, DR4);
-
-	return -ENODEV;
+	default:
+		return -ENODEV;
+	}
 }
 
 void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)

commit 5cb554a0d6e986f2d7300a91d95983fa09b17f65
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Mar 30 06:11:21 2011 +1000

    drm_mode: fix types on recently added ioctls

diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 8b263ad..c7c1fbe 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -346,14 +346,14 @@ struct drm_mode_crtc_page_flip {
 
 /* create a dumb scanout buffer */
 struct drm_mode_create_dumb {
-        uint32_t height;
-        uint32_t width;
-        uint32_t bpp;
-        uint32_t flags;
+        __u32 height;
+        __u32 width;
+        __u32 bpp;
+        __u32 flags;
         /* handle, pitch, size will be returned */
-        uint32_t handle;
-        uint32_t pitch;
-        uint64_t size;
+        __u32 handle;
+        __u32 pitch;
+        __u64 size;
 };
 
 /* set up for mmap of a dumb scanout buffer */
@@ -370,7 +370,7 @@ struct drm_mode_map_dumb {
 };
 
 struct drm_mode_destroy_dumb {
-	uint32_t handle;
+	__u32 handle;
 };
 
 #endif

commit 06ebbf7c2c071c8a4f32d3cfac914874fe981054
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sat Mar 26 15:04:04 2011 +0100

    Cleanup gen2 tiling confusion
    
    A tile on gen2 has a size of 2kb, stride of 128 bytes and 16 rows.
    
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index f5ab0a6..4f4de92 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -762,13 +762,12 @@ drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
 		aligned_y = y;
 		height_alignment = 2;
 
-		if (tiling == I915_TILING_X)
+		if (IS_GEN2(bufmgr_gem) && tiling != I915_TILING_NONE)
+			height_alignment = 16;
+		else if (tiling == I915_TILING_X)
 			height_alignment = 8;
 		else if (tiling == I915_TILING_Y)
 			height_alignment = 32;
-		/* i8xx has a interleaved 2-row tile layout */
-		if (IS_GEN2(bufmgr_gem) && tiling != I915_TILING_NONE)
-			height_alignment *= 2;
 		aligned_y = ALIGN(y, height_alignment);
 
 		stride = x * cpp;

commit fd3ed34a2070fca3804baf54ece40d0bc2666226
Author: Javier Jardón <javier.jardon@codethink.co.uk>
Date:   Wed Feb 9 13:28:20 2011 +0000

    build: Update autotools configuration
    
    Replace some deprecated autoconf macros and use the new libtool
    syntax

diff --git a/Makefile.am b/Makefile.am
index 25d1747..a4d07f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@
 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-nouveau-experimental-api --enable-radeon-experimental-api
 
diff --git a/autogen.sh b/autogen.sh
index 904cd67..30d679f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,12 +1,6 @@
 #! /bin/sh
 
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-ORIGDIR=`pwd`
-cd $srcdir
-
-autoreconf -v --install || exit 1
-cd $ORIGDIR || exit $?
-
-$srcdir/configure --enable-maintainer-mode "$@"
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+autoreconf --force --install --verbose "$srcdir"
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
index 1998204..e1bb079 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,24 +18,34 @@
 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-AC_PREREQ(2.60)
-AC_INIT([libdrm], 2.4.24, [dri-devel@lists.sourceforge.net], libdrm)
-AC_USE_SYSTEM_EXTENSIONS
+AC_PREREQ([2.63])
+AC_INIT([libdrm],
+        [2.4.24],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
+        [libdrm])
+
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_SRCDIR([Makefile.am])
-AM_INIT_AUTOMAKE([dist-bzip2])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([build-aux])
+
+AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2])
+AM_MAINTAINER_MODE([enable])
 
-AM_CONFIG_HEADER([config.h])
+# Enable quiet compiles on automake 1.11.
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
+# Check for programs
 AC_PROG_CC
 
-AC_HEADER_STDC
+AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 AC_FUNC_ALLOCA
 
-# Enable quiet compiles on automake 1.11.
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+# Initialize libtool
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
 
 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
 AC_SUBST(PTHREADSTUBS_CFLAGS)
@@ -43,9 +53,10 @@ AC_SUBST(PTHREADSTUBS_LIBS)
 
 pkgconfigdir=${libdir}/pkgconfig
 AC_SUBST(pkgconfigdir)
-AC_ARG_ENABLE(udev,	AS_HELP_STRING([--enable-udev],
-				[Enable support for using udev instead of mknod (default: disabled)]),
-				[UDEV=$enableval], [UDEV=no])
+AC_ARG_ENABLE([udev],
+              [AS_HELP_STRING([--enable-udev],
+                              [Enable support for using udev instead of mknod (default: disabled)])],
+              [UDEV=$enableval], [UDEV=no])
 
 AC_ARG_ENABLE(libkms,
 	      AS_HELP_STRING([--disable-libkms],
@@ -188,12 +199,11 @@ if test "x$INTEL" != "xno" -o "x$RADEON" != "xno"; then
     [
 	    drm_cv_atomic_primitives="none"
 
-	    AC_TRY_LINK([
+	    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
     int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }
     int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); }
-    ], [],
-	      drm_cv_atomic_primitives="Intel"
-	      )
+                                            ]],[[]])],
+                           [drm_cv_atomic_primitives="Intel"],[])
 
 	    if test "x$drm_cv_atomic_primitives" = "xnone"; then
 		    AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
@@ -255,7 +265,7 @@ AC_ARG_WITH([kernel-source],
 AC_SUBST(kernel_source)
 
 AC_SUBST(WARN_CFLAGS)
-AC_OUTPUT([
+AC_CONFIG_FILES([
 	Makefile
 	libkms/Makefile
 	libkms/libkms.pc
@@ -273,6 +283,7 @@ AC_OUTPUT([
 	include/Makefile
 	include/drm/Makefile
 	libdrm.pc])
+AC_OUTPUT
 
 echo ""
 echo "$PACKAGE_STRING will be compiled with:"
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..464ba5c
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,5 @@
+libtool.m4
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4

commit 3b04c73650b5e9bbcb602fdb8cea0b16ad82d0c0
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Mar 4 15:48:31 2011 +1000

    libdrm: oops fix get cap return value.

diff --git a/xf86drm.c b/xf86drm.c
index bc7a97f..a183eee 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -820,7 +820,7 @@ int drmGetCap(int fd, uint64_t capability, uint64_t *value)
 		return ret;
 
 	*value = cap.value;
-	return cap.value;
+	return 0;
 }
 
 /**

commit bb994653667986757b4c906b8f144737667f7374
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Feb 9 13:41:49 2011 +1000

    libkms: add dumb support
    
    this uses the drm cap interface to check if the dumb ioctl
    is supported.

diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 5c2e63f..fa379a4 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -16,6 +16,7 @@ libkms_la_SOURCES = \
 	internal.h \
 	linux.c \
 	intel.c \
+	dumb.c \
 	api.c
 
 if HAVE_VMWGFX
diff --git a/libkms/dumb.c b/libkms/dumb.c
new file mode 100644
index 0000000..3be5f7a
--- /dev/null
+++ b/libkms/dumb.c
@@ -0,0 +1,220 @@
+/**************************************************************************
+ *
+ * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#define HAVE_STDINT_H
+#define _FILE_OFFSET_BITS 64
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "internal.h"
+
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include "xf86drm.h"
+
+#include "i915_drm.h"
+
+struct dumb_bo
+{
+	struct kms_bo base;
+	unsigned map_count;
+};
+
+static int
+dumb_get_prop(struct kms_driver *kms, unsigned key, unsigned *out)
+{
+	switch (key) {
+	case KMS_BO_TYPE:
+		*out = KMS_BO_TYPE_SCANOUT_X8R8G8B8 | KMS_BO_TYPE_CURSOR_64X64_A8R8G8B8;
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int
+dumb_destroy(struct kms_driver *kms)
+{
+	free(kms);
+	return 0;
+}
+
+static int
+dumb_bo_create(struct kms_driver *kms,
+		 const unsigned width, const unsigned height,
+		 const enum kms_bo_type type, const unsigned *attr,
+		 struct kms_bo **out)
+{
+	struct drm_mode_create_dumb arg;
+	struct dumb_bo *bo;
+	int i, ret;
+
+	for (i = 0; attr[i]; i += 2) {
+		switch (attr[i]) {
+		case KMS_WIDTH:
+		case KMS_HEIGHT:
+			break;
+		case KMS_BO_TYPE:
+			break;
+		default:
+			return -EINVAL;
+		}
+	}
+
+	bo = calloc(1, sizeof(*bo));
+	if (!bo)
+		return -ENOMEM;
+
+	memset(&arg, 0, sizeof(arg));
+
+	arg.bpp = 16;
+	arg.width = width;
+	arg.height = height;
+
+	ret = drmIoctl(kms->fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
+	if (ret)
+		goto err_free;
+
+	bo->base.kms = kms;
+	bo->base.handle = arg.handle;
+	bo->base.size = arg.size;
+	bo->base.pitch = arg.pitch;
+
+	*out = &bo->base;
+
+	return 0;
+
+err_free:
+	free(bo);
+	return ret;
+}
+
+static int
+dumb_bo_get_prop(struct kms_bo *bo, unsigned key, unsigned *out)
+{
+	switch (key) {
+	default:
+		return -EINVAL;
+	}
+}
+
+static int
+dumb_bo_map(struct kms_bo *_bo, void **out)
+{
+	struct dumb_bo *bo = (struct dumb_bo *)_bo;
+	struct drm_mode_map_dumb arg;
+	void *map = NULL;
+	int ret;
+
+	if (bo->base.ptr) {
+		bo->map_count++;
+		*out = bo->base.ptr;
+		return 0;
+	}
+
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = bo->base.handle;
+
+	ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+	if (ret)
+		return ret;
+
+	map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
+	if (map == MAP_FAILED)
+		return -errno;
+
+	bo->base.ptr = map;
+	bo->map_count++;
+	*out = bo->base.ptr;
+
+	return 0;
+}
+
+static int
+dumb_bo_unmap(struct kms_bo *_bo)
+{
+	struct dumb_bo *bo = (struct dumb_bo *)_bo;
+	bo->map_count--;
+	return 0;
+}
+
+static int
+dumb_bo_destroy(struct kms_bo *_bo)
+{
+	struct dumb_bo *bo = (struct dumb_bo *)_bo;
+	struct drm_mode_destroy_dumb arg;
+	int ret;
+
+	if (bo->base.ptr) {
+		/* XXX Sanity check map_count */
+		munmap(bo->base.ptr, bo->base.size);
+		bo->base.ptr = NULL;
+	}
+
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = bo->base.handle;
+
+	ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
+	if (ret)
+		return -errno;
+
+	free(bo);
+	return 0;
+}
+
+int
+dumb_create(int fd, struct kms_driver **out)
+{
+	struct kms_driver *kms;
+	int ret;
+	uint64_t cap = 0;
+
+	ret = drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &cap);
+	if (ret || cap == 0)
+		return -EINVAL;
+
+	kms = calloc(1, sizeof(*kms));
+	if (!kms)
+		return -ENOMEM;
+
+	kms->fd = fd;
+
+	kms->bo_create = dumb_bo_create;
+	kms->bo_map = dumb_bo_map;
+	kms->bo_unmap = dumb_bo_unmap;
+	kms->bo_get_prop = dumb_bo_get_prop;
+	kms->bo_destroy = dumb_bo_destroy;
+	kms->get_prop = dumb_get_prop;
+	kms->destroy = dumb_destroy;
+	*out = kms;
+
+	return 0;
+}
diff --git a/libkms/internal.h b/libkms/internal.h
index 51f5e65..5e2501e 100644
--- a/libkms/internal.h
+++ b/libkms/internal.h
@@ -68,6 +68,8 @@ int vmwgfx_create(int fd, struct kms_driver **out);
 
 int intel_create(int fd, struct kms_driver **out);
 
+int dumb_create(int fd, struct kms_driver **out);
+
 int nouveau_create(int fd, struct kms_driver **out);
 
 int radeon_create(int fd, struct kms_driver **out);
diff --git a/libkms/linux.c b/libkms/linux.c
index 7449abc..fc4f205 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -216,6 +216,9 @@ linux_from_udev(int fd, struct kms_driver **out)
 int
 linux_create(int fd, struct kms_driver **out)
 {
+	if (!dumb_create(fd, out))
+		return 0;
+
 	if (!linux_from_udev(fd, out))
 		return 0;
 

commit 5c6c6913d1260024e5d156db7973c9e46fe1ff03
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Feb 21 11:27:19 2011 +1000

    Implement drmGetCap() to query device/driver capabilities
    
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

diff --git a/include/drm/drm.h b/include/drm/drm.h
index c968dc8..416673a 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -612,6 +612,12 @@ struct drm_gem_open {
 	__u64 size;
 };
 
+/** DRM_IOCTL_GET_CAP ioctl argument type */
+struct drm_get_cap {
+	__u64 capability;
+	__u64 value;
+};
+
 #include "drm_mode.h"
 
 #define DRM_IOCTL_BASE			'd'
@@ -632,6 +638,7 @@ struct drm_gem_open {
 #define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
 #define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
 #define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
+#define DRM_IOCTL_GET_CAP		DRM_IOWR(0x0c, struct drm_get_cap)
 
 #define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
 #define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
@@ -747,6 +754,8 @@ struct drm_event_vblank {
 	__u32 reserved;
 };
 
+#define DRM_CAP_DUMB_BUFFER 0x1
+
 /* typedef area */
 typedef struct drm_clip_rect drm_clip_rect_t;
 typedef struct drm_drawable_info drm_drawable_info_t;
diff --git a/xf86drm.c b/xf86drm.c
index 799fcdd..bc7a97f 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -810,6 +810,18 @@ drmVersionPtr drmGetLibVersion(int fd)
     return (drmVersionPtr)version;
 }
 
+int drmGetCap(int fd, uint64_t capability, uint64_t *value)
+{
+	struct drm_get_cap cap = { capability, 0 };
+	int ret;
+
+	ret = drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap);
+	if (ret)
+		return ret;
+
+	*value = cap.value;
+	return cap.value;
+}
 
 /**
  * Free the bus ID information.
diff --git a/xf86drm.h b/xf86drm.h
index 9b89f56..bf0d5df 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -542,6 +542,7 @@ extern int drmOpenControl(int minor);
 extern int           drmClose(int fd);
 extern drmVersionPtr drmGetVersion(int fd);
 extern drmVersionPtr drmGetLibVersion(int fd);
+extern int           drmGetCap(int fd, uint64_t capability, uint64_t *value);
 extern void          drmFreeVersion(drmVersionPtr);
 extern int           drmGetMagic(int fd, drm_magic_t * magic);
 extern char          *drmGetBusid(int fd);

commit 4473a7e8234da6d16f4ccfa660fbd72ff1b7dd95
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Feb 9 13:41:28 2011 +1000

    drm: add dumb interface

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 2ba7136..c968dc8 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -703,6 +703,10 @@ struct drm_gem_open {
 #define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
 #define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
 
+#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
+#define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)
+#define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x99.
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 0fc7397..8b263ad 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -344,4 +344,33 @@ struct drm_mode_crtc_page_flip {
 	__u64 user_data;
 };
 
+/* create a dumb scanout buffer */
+struct drm_mode_create_dumb {
+        uint32_t height;
+        uint32_t width;
+        uint32_t bpp;
+        uint32_t flags;
+        /* handle, pitch, size will be returned */
+        uint32_t handle;
+        uint32_t pitch;
+        uint64_t size;
+};
+
+/* set up for mmap of a dumb scanout buffer */
+struct drm_mode_map_dumb {
+        /** Handle for the object being mapped. */
+        __u32 handle;
+        __u32 pad;
+        /**
+         * Fake offset to use for subsequent mmap call
+         *
+         * This is a fixed-size type for 32/64 compatibility.
+         */
+        __u64 offset;
+};
+
+struct drm_mode_destroy_dumb {
+	uint32_t handle;
+};
+
 #endif

commit edd41db37deb21aab5154b94354fe9470fc59cf3
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Thu Mar 3 21:35:28 2011 -0500

    Build modetest for all chipsets, always build modeprint

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 01ca8b4..bf1987f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,10 +10,10 @@ check_PROGRAMS = \
 	dristat \
 	drmstat
 
-SUBDIRS =
+SUBDIRS = modeprint
 
 if HAVE_LIBKMS
-SUBDIRS += kmstest
+SUBDIRS += kmstest modetest
 endif
 
 if HAVE_LIBUDEV
@@ -47,15 +47,6 @@ TESTS =						\
 SUBDIRS += vbltest $(NULL)
 
 if HAVE_INTEL
-if HAVE_LIBKMS
-SUBDIRS += \
-	modetest
-endif
-
-SUBDIRS += \
-	modeprint				\
-	$(NULL)
-
 TESTS +=					\
 	gem_basic				\
 	gem_flink				\

commit 3293eb95cabc83f5d2282c2890919c07e6af5205
Author: Matt Turner <mattst88@gmail.com>
Date:   Thu Mar 3 21:20:52 2011 -0500

    don't try to build modetest without libkms
    
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ebf4853..01ca8b4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,9 +16,6 @@ if HAVE_LIBKMS
 SUBDIRS += kmstest
 endif
 
-if HAVE_INTEL
-endif
-
 if HAVE_LIBUDEV
 
 check_LTLIBRARIES = libdrmtest.la
@@ -50,9 +47,13 @@ TESTS =						\
 SUBDIRS += vbltest $(NULL)
 
 if HAVE_INTEL
+if HAVE_LIBKMS
+SUBDIRS += \
+	modetest
+endif
+
 SUBDIRS += \
 	modeprint				\
-	modetest				\
 	$(NULL)
 
 TESTS +=					\


Reply to: