Hello community,
here is the log from the commit of package libdrm for openSUSE:Factory
checked in at Thu Apr 23 20:52:23 CEST 2009.
--------
--- libdrm/libdrm.changes 2009-02-25 16:01:42.000000000 +0100
+++ libdrm/libdrm.changes 2009-04-18 13:58:14.000000000 +0200
@@ -1,0 +2,24 @@
+Sat Apr 18 13:52:48 CEST 2009 - sndirsch@suse.de
+
+- libdrm 2.4.9
+ * Aka, the "kick jbarnes" release. Not only did I push the
+ broken speedup patch but I flubbed the version bump, so we get
+ to go from 2.4.7 to 2.4.9. Yay for me.
+
+-------------------------------------------------------------------
+Fri Apr 10 12:38:59 CEST 2009 - sndirsch@suse.de
+
+- libdrm 2.4.7
+ * quick follow on release to 2.4.6 to fix an embarrasing
+ build problem in the test suite when libudev is not available.
+- obsoletes libdrm-commit-1faab66.diff
+
+-------------------------------------------------------------------
+Tue Apr 7 21:50:09 CEST 2009 - sndirsch@suse.de
+
+- libdrm 2.4.6
+ * various fixes
+- libdrm-commit-1faab66.diff
+ * fixes build of 2.4.6
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
libdrm-2.4.5.tar.bz2
New:
----
libdrm-2.4.9.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libdrm.spec ++++++
--- /var/tmp/diff_new_pack.vrS494/_old 2009-04-23 20:51:03.000000000 +0200
+++ /var/tmp/diff_new_pack.vrS494/_new 2009-04-23 20:51:03.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package libdrm (Version 2.4.5)
+# spec file for package libdrm (Version 2.4.9)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -31,7 +31,7 @@
Obsoletes: libdrm-64bit
%endif
#
-Version: 2.4.5
+Version: 2.4.9
Release: 1
Summary: Userspace Interface for Kernel DRM Services
Source: %{name}-%{version}.tar.bz2
@@ -152,6 +152,21 @@
%exclude %{_libdir}/libdrm_intel.la
%changelog
+* Sat Apr 18 2009 sndirsch@suse.de
+- libdrm 2.4.9
+ * Aka, the "kick jbarnes" release. Not only did I push the
+ broken speedup patch but I flubbed the version bump, so we get
+ to go from 2.4.7 to 2.4.9. Yay for me.
+* Fri Apr 10 2009 sndirsch@suse.de
+- libdrm 2.4.7
+ * quick follow on release to 2.4.6 to fix an embarrasing
+ build problem in the test suite when libudev is not available.
+- obsoletes libdrm-commit-1faab66.diff
+* Tue Apr 07 2009 sndirsch@suse.de
+- libdrm 2.4.6
+ * various fixes
+- libdrm-commit-1faab66.diff
+ * fixes build of 2.4.6
* Wed Feb 25 2009 sndirsch@suse.de
- libdrm 2.4.5
* Fri Jan 23 2009 sndirsch@suse.de
++++++ libdrm-2.4.5.tar.bz2 -> libdrm-2.4.9.tar.bz2 ++++++
++++ 62321 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/configure.ac new/libdrm-2.4.9/configure.ac
--- old/libdrm-2.4.5/configure.ac 2009-02-23 22:28:22.000000000 +0100
+++ new/libdrm-2.4.9/configure.ac 2009-04-11 00:34:07.000000000 +0200
@@ -19,7 +19,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AC_PREREQ(2.57)
-AC_INIT([libdrm], 2.4.5, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.9, [dri-devel@lists.sourceforge.net], libdrm)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -131,6 +131,13 @@
fi
AM_CONDITIONAL(HAVE_CAIRO, [test "x$HAVE_CAIRO" = xyes])
+# For enumerating devices in test case
+PKG_CHECK_MODULES(LIBUDEV, libudev, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
+if test "x$HAVE_LIBUDEV" = xyes; then
+ AC_DEFINE(HAVE_LIBUDEV, 1, [Have libudev support])
+fi
+AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
+
AC_SUBST(WARN_CFLAGS)
AC_OUTPUT([
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/config.h.in new/libdrm-2.4.9/libdrm/config.h.in
--- old/libdrm-2.4.5/libdrm/config.h.in 2009-02-23 22:32:28.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/config.h.in 2009-04-11 00:35:09.000000000 +0200
@@ -12,6 +12,9 @@
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
+/* Have libudev support */
+#undef HAVE_LIBUDEV
+
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
@@ -36,6 +39,10 @@
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
/* Name of package */
#undef PACKAGE
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/intel/intel_bufmgr_fake.c new/libdrm-2.4.9/libdrm/intel/intel_bufmgr_fake.c
--- old/libdrm-2.4.5/libdrm/intel/intel_bufmgr_fake.c 2009-02-21 18:54:48.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/intel/intel_bufmgr_fake.c 2009-03-19 00:51:12.000000000 +0100
@@ -444,7 +444,8 @@
/* Release the card storage associated with buf:
*/
-static void free_block(drm_intel_bufmgr_fake *bufmgr_fake, struct block *block)
+static void free_block(drm_intel_bufmgr_fake *bufmgr_fake, struct block *block,
+ int skip_dirty_copy)
{
drm_intel_bo_fake *bo_fake;
DBG("free block %p %08x %d %d\n", block, block->mem->ofs, block->on_hardware, block->fenced);
@@ -453,7 +454,11 @@
return;
bo_fake = (drm_intel_bo_fake *)block->bo;
- if (!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE)) && (bo_fake->card_dirty == 1)) {
+
+ if (bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE))
+ skip_dirty_copy = 1;
+
+ if (!skip_dirty_copy && (bo_fake->card_dirty == 1)) {
memcpy(bo_fake->backing_store, block->virtual, block->bo->size);
bo_fake->card_dirty = 0;
bo_fake->dirty = 1;
@@ -534,7 +539,7 @@
set_dirty(&bo_fake->bo);
bo_fake->block = NULL;
- free_block(bufmgr_fake, block);
+ free_block(bufmgr_fake, block, 0);
return 1;
}
@@ -557,7 +562,7 @@
set_dirty(&bo_fake->bo);
bo_fake->block = NULL;
- free_block(bufmgr_fake, block);
+ free_block(bufmgr_fake, block, 0);
return 1;
}
@@ -872,7 +877,7 @@
assert(bo_fake->map_count == 0);
/* No remaining references, so free it */
if (bo_fake->block)
- free_block(bufmgr_fake, bo_fake->block);
+ free_block(bufmgr_fake, bo_fake->block, 1);
free_backing_store(bo);
for (i = 0; i < bo_fake->nr_relocs; i++)
@@ -1064,7 +1069,7 @@
drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)block->bo;
block->on_hardware = 0;
- free_block(bufmgr_fake, block);
+ free_block(bufmgr_fake, block, 0);
bo_fake->block = NULL;
bo_fake->validated = 0;
if (!(bo_fake->flags & BM_NO_BACKING_STORE))
@@ -1463,7 +1468,7 @@
DRMLISTFOREACHSAFE(block, tmp, &bufmgr_fake->lru) {
/* Releases the memory, and memcpys dirty contents out if necessary. */
- free_block(bufmgr_fake, block);
+ free_block(bufmgr_fake, block, 0);
}
pthread_mutex_unlock(&bufmgr_fake->lock);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/intel/intel_bufmgr_gem.c new/libdrm-2.4.9/libdrm/intel/intel_bufmgr_gem.c
--- old/libdrm-2.4.5/libdrm/intel/intel_bufmgr_gem.c 2009-02-21 18:56:29.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/intel/intel_bufmgr_gem.c 2009-03-31 19:58:20.000000000 +0200
@@ -145,7 +145,9 @@
/** Number of entries in relocs */
int reloc_count;
/** Mapped address for the buffer, saved across map/unmap cycles */
- void *virtual;
+ void *mem_virtual;
+ /** GTT virtual address for the buffer, saved across map/unmap cycles */
+ void *gtt_virtual;
/** BO cache list */
drmMMListHead head;
@@ -524,8 +526,10 @@
struct drm_gem_close close;
int ret;
- if (bo_gem->virtual)
- munmap (bo_gem->virtual, bo_gem->bo.size);
+ if (bo_gem->mem_virtual)
+ munmap (bo_gem->mem_virtual, bo_gem->bo.size);
+ if (bo_gem->gtt_virtual)
+ munmap (bo_gem->gtt_virtual, bo_gem->bo.size);
/* Close this object */
memset(&close, 0, sizeof(close));
@@ -609,7 +613,7 @@
/* Allow recursive mapping. Mesa may recursively map buffers with
* nested display loops.
*/
- if (!bo_gem->virtual) {
+ if (!bo_gem->mem_virtual) {
struct drm_i915_gem_mmap mmap_arg;
DBG("bo_map: %d (%s)\n", bo_gem->gem_handle, bo_gem->name);
@@ -626,12 +630,12 @@
pthread_mutex_unlock(&bufmgr_gem->lock);
return ret;
}
- bo_gem->virtual = (void *)(uintptr_t)mmap_arg.addr_ptr;
+ bo_gem->mem_virtual = (void *)(uintptr_t)mmap_arg.addr_ptr;
bo_gem->swrast = 0;
}
DBG("bo_map: %d (%s) -> %p\n", bo_gem->gem_handle, bo_gem->name,
- bo_gem->virtual);
- bo->virtual = bo_gem->virtual;
+ bo_gem->mem_virtual);
+ bo->virtual = bo_gem->mem_virtual;
if (bo_gem->global_name != 0 || !bo_gem->swrast) {
set_domain.handle = bo_gem->gem_handle;
@@ -669,7 +673,7 @@
pthread_mutex_lock(&bufmgr_gem->lock);
/* Get a mapping of the buffer if we haven't before. */
- if (bo_gem->virtual == NULL) {
+ if (bo_gem->gtt_virtual == NULL) {
struct drm_i915_gem_mmap_gtt mmap_arg;
DBG("bo_map_gtt: %d (%s)\n", bo_gem->gem_handle, bo_gem->name);
@@ -690,10 +694,10 @@
}
/* and mmap it */
- bo_gem->virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
- MAP_SHARED, bufmgr_gem->fd,
- mmap_arg.offset);
- if (bo_gem->virtual == MAP_FAILED) {
+ bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, bufmgr_gem->fd,
+ mmap_arg.offset);
+ if (bo_gem->gtt_virtual == MAP_FAILED) {
fprintf(stderr,
"%s:%d: Error mapping buffer %d (%s): %s .\n",
__FILE__, __LINE__,
@@ -704,10 +708,10 @@
}
}
- bo->virtual = bo_gem->virtual;
+ bo->virtual = bo_gem->gtt_virtual;
DBG("bo_map: %d (%s) -> %p\n", bo_gem->gem_handle, bo_gem->name,
- bo_gem->virtual);
+ bo_gem->gtt_virtual);
/* Now move it to the GTT domain so that the CPU caches are flushed */
set_domain.handle = bo_gem->gem_handle;
@@ -719,7 +723,7 @@
} while (ret == -1 && errno == EINTR);
if (ret != 0) {
- fprintf (stderr, "%s:%d: Error setting swrast %d: %s\n",
+ fprintf (stderr, "%s:%d: Error setting domain %d: %s\n",
__FILE__, __LINE__, bo_gem->gem_handle, strerror (errno));
}
@@ -728,6 +732,26 @@
return 0;
}
+int
+drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo)
+{
+ drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
+ drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
+ struct drm_i915_gem_sw_finish sw_finish;
+ int ret = 0;
+
+ if (bo == NULL)
+ return 0;
+
+ assert(bo_gem->gtt_virtual != NULL);
+
+ pthread_mutex_lock(&bufmgr_gem->lock);
+ bo->virtual = NULL;
+ pthread_mutex_unlock(&bufmgr_gem->lock);
+
+ return ret;
+}
+
static int
drm_intel_gem_bo_unmap(drm_intel_bo *bo)
{
@@ -739,7 +763,7 @@
if (bo == NULL)
return 0;
- assert(bo_gem->virtual != NULL);
+ assert(bo_gem->mem_virtual != NULL);
pthread_mutex_lock(&bufmgr_gem->lock);
if (bo_gem->swrast) {
@@ -750,6 +774,7 @@
} while (ret == -1 && errno == EINTR);
bo_gem->swrast = 0;
}
+ bo->virtual = NULL;
pthread_mutex_unlock(&bufmgr_gem->lock);
return 0;
}
@@ -1260,8 +1285,21 @@
int i;
unsigned int total = 0;
- for (i = 0; i < count; i++)
+ for (i = 0; i < count; i++) {
total += drm_intel_gem_bo_get_aperture_space(bo_array[i]);
+ /* For the first buffer object in the array, we get an accurate count
+ * back for its reloc_tree size (since nothing had been flagged as
+ * being counted yet). We can save that value out as a more
+ * conservative reloc_tree_size that avoids double-counting target
+ * buffers. Since the first buffer happens to usually be the batch
+ * buffer in our callers, this can pull us back from doing the tree
+ * walk on every new batch emit.
+ */
+ if (i == 0) {
+ drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo_array[i];
+ bo_gem->reloc_tree_size = total;
+ }
+ }
for (i = 0; i < count; i++)
drm_intel_gem_bo_clear_aperture_space_flag(bo_array[i]);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/intel/intel_bufmgr.h new/libdrm-2.4.9/libdrm/intel/intel_bufmgr.h
--- old/libdrm-2.4.5/libdrm/intel/intel_bufmgr.h 2009-02-21 18:54:48.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/intel/intel_bufmgr.h 2009-03-31 19:58:20.000000000 +0200
@@ -115,6 +115,7 @@
unsigned int handle);
void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr);
int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo);
+int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo);
void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable);
/* drm_intel_bufmgr_fake.c */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/Makefile.am new/libdrm-2.4.9/libdrm/nouveau/Makefile.am
--- old/libdrm-2.4.5/libdrm/nouveau/Makefile.am 2009-02-11 01:09:35.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/Makefile.am 2009-03-19 00:51:12.000000000 +0100
@@ -19,7 +19,9 @@
nouveau_bo.c \
nouveau_resource.c \
nouveau_dma.c \
- nouveau_fence.c
+ nouveau_fence.c \
+ nouveau_dma.h \
+ nouveau_private.h
libdrm_nouveaucommonincludedir = ${includedir}/nouveau
libdrm_nouveaucommoninclude_HEADERS = \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_bo.c new/libdrm-2.4.9/libdrm/nouveau/nouveau_bo.c
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_bo.c 2009-02-11 01:09:35.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_bo.c 2009-03-31 19:58:20.000000000 +0200
@@ -347,24 +347,25 @@
if (!bo || !handle)
return -EINVAL;
- if (!nvdev->mm_enabled)
- return -ENODEV;
-
if (!nvbo->global_handle) {
struct drm_gem_flink req;
ret = nouveau_bo_kalloc(nvbo, NULL);
if (ret)
return ret;
-
- req.handle = nvbo->handle;
- ret = ioctl(nvdev->fd, DRM_IOCTL_GEM_FLINK, &req);
- if (ret) {
- nouveau_bo_kfree(nvbo);
- return ret;
+
+ if (nvdev->mm_enabled) {
+ req.handle = nvbo->handle;
+ ret = ioctl(nvdev->fd, DRM_IOCTL_GEM_FLINK, &req);
+ if (ret) {
+ nouveau_bo_kfree(nvbo);
+ return ret;
+ }
+
+ nvbo->global_handle = req.name;
+ } else {
+ nvbo->global_handle = nvbo->offset;
}
-
- nvbo->global_handle = req.name;
}
*handle = nvbo->global_handle;
@@ -412,6 +413,8 @@
{
struct nouveau_bo_priv *nvbo = priv;
+ nouveau_fence_ref(NULL, &nvbo->fence);
+ nouveau_fence_ref(NULL, &nvbo->wr_fence);
nouveau_bo_kfree(nvbo);
free(nvbo);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_device.c new/libdrm-2.4.9/libdrm/nouveau/nouveau_device.c
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_device.c 2009-02-21 18:54:48.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_device.c 2009-03-31 19:58:20.000000000 +0200
@@ -76,6 +76,22 @@
}
nvdev->base.vm_vram_base = value;
+ ret = nouveau_device_get_param(&nvdev->base,
+ NOUVEAU_GETPARAM_FB_SIZE, &value);
+ if (ret) {
+ nouveau_device_close((void *)&nvdev);
+ return ret;
+ }
+ nvdev->vram_aper_size = value;
+
+ ret = nouveau_device_get_param(&nvdev->base,
+ NOUVEAU_GETPARAM_AGP_SIZE, &value);
+ if (ret) {
+ nouveau_device_close((void *)&nvdev);
+ return ret;
+ }
+ nvdev->gart_aper_size = value;
+
ret = nouveau_bo_init(&nvdev->base);
if (ret) {
nouveau_device_close((void *)&nvdev);
@@ -128,7 +144,7 @@
{
struct nouveau_device_priv *nvdev;
- if (dev || !*dev)
+ if (!dev || !*dev)
return;
nvdev = nouveau_device(*dev);
*dev = NULL;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_dma.h new/libdrm-2.4.9/libdrm/nouveau/nouveau_dma.h
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_dma.h 1970-01-01 01:00:00.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_dma.h 2009-03-19 00:51:12.000000000 +0100
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2007 Nouveau Project
+ *
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS 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.
+ */
+
+#ifndef __NOUVEAU_DMA_H__
+#define __NOUVEAU_DMA_H__
+
+#include
+#include "nouveau_private.h"
+
+//#define NOUVEAU_DMA_DEBUG
+//#define NOUVEAU_DMA_TRACE
+//#define NOUVEAU_DMA_DUMP_POSTRELOC_PUSHBUF
+#if defined(__amd64__)
+#define NOUVEAU_DMA_BARRIER asm volatile("lock; addl $0,0(%%rsp)" ::: "memory")
+#elif defined(__i386__)
+#define NOUVEAU_DMA_BARRIER asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
+#else
+#define NOUVEAU_DMA_BARRIER
+#endif
+#define NOUVEAU_DMA_TIMEOUT 2000
+#define NOUVEAU_TIME_MSEC() 0
+#define RING_SKIPS 8
+
+extern int nouveau_dma_wait(struct nouveau_channel *chan, unsigned size);
+extern void nouveau_dma_subc_bind(struct nouveau_grobj *);
+extern void nouveau_dma_channel_init(struct nouveau_channel *);
+extern void nouveau_dma_kickoff(struct nouveau_channel *);
+
+#ifdef NOUVEAU_DMA_DEBUG
+static char faulty[1024];
+#endif
+
+static inline void
+nouveau_dma_out(struct nouveau_channel *chan, uint32_t data)
+{
+ struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
+ struct nouveau_dma_priv *dma = nvchan->dma;
+
+#ifdef NOUVEAU_DMA_DEBUG
+ if (dma->push_free == 0) {
+ printf("No space left in packet at %s\n", faulty);
+ return;
+ }
+ dma->push_free--;
+#endif
+#ifdef NOUVEAU_DMA_TRACE
+ {
+ uint32_t offset = (dma->cur << 2) + dma->base;
+ printf("\tOUT_RING %d/0x%08x -> 0x%08x\n",
+ nvchan->drm.channel, offset, data);
+ }
+#endif
+ nvchan->pushbuf[dma->cur + (dma->base - nvchan->drm.put_base)/4] = data;
+ dma->cur++;
+}
+
+static inline void
+nouveau_dma_outp(struct nouveau_channel *chan, uint32_t *ptr, int size)
+{
+ struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
+ struct nouveau_dma_priv *dma = nvchan->dma;
+ (void)dma;
+
+#ifdef NOUVEAU_DMA_DEBUG
+ if (dma->push_free < size) {
+ printf("Packet too small. Free=%d, Need=%d\n",
+ dma->push_free, size);
+ return;
+ }
+#endif
+#ifdef NOUVEAU_DMA_TRACE
+ while (size--) {
+ nouveau_dma_out(chan, *ptr);
+ ptr++;
+ }
+#else
+ memcpy(&nvchan->pushbuf[dma->cur], ptr, size << 2);
+#ifdef NOUVEAU_DMA_DEBUG
+ dma->push_free -= size;
+#endif
+ dma->cur += size;
+#endif
+}
+
+static inline void
+nouveau_dma_space(struct nouveau_channel *chan, unsigned size)
+{
+ struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
+ struct nouveau_dma_priv *dma = nvchan->dma;
+
+ if (dma->free < size) {
+ if (nouveau_dma_wait(chan, size) && chan->hang_notify)
+ chan->hang_notify(chan);
+ }
+ dma->free -= size;
+#ifdef NOUVEAU_DMA_DEBUG
+ dma->push_free = size;
+#endif
+}
+
+static inline void
+nouveau_dma_begin(struct nouveau_channel *chan, struct nouveau_grobj *grobj,
+ int method, int size, const char* file, int line)
+{
+ struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
+ struct nouveau_dma_priv *dma = nvchan->dma;
+ (void)dma;
+
+#ifdef NOUVEAU_DMA_TRACE
+ printf("BEGIN_RING %d/%08x/%d/0x%04x/%d\n", nvchan->drm.channel,
+ grobj->handle, grobj->subc, method, size);
+#endif
+
+#ifdef NOUVEAU_DMA_DEBUG
+ if (dma->push_free) {
+ printf("Previous packet incomplete: %d left at %s\n",
+ dma->push_free, faulty);
+ return;
+ }
+ sprintf(faulty,"%s:%d",file,line);
+#endif
+
+ nouveau_dma_space(chan, (size + 1));
+ nouveau_dma_out(chan, (size << 18) | (grobj->subc << 13) | method);
+}
+
+#define RING_SPACE_CH(ch,sz) nouveau_dma_space((ch), (sz))
+#define BEGIN_RING_CH(ch,gr,m,sz) nouveau_dma_begin((ch), (gr), (m), (sz), __FUNCTION__, __LINE__ )
+#define OUT_RING_CH(ch, data) nouveau_dma_out((ch), (data))
+#define OUT_RINGp_CH(ch,ptr,dwords) nouveau_dma_outp((ch), (void*)(ptr), \
+ (dwords))
+#define FIRE_RING_CH(ch) nouveau_dma_kickoff((ch))
+#define WAIT_RING_CH(ch,sz) nouveau_dma_wait((ch), (sz))
+
+#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_drmif.h new/libdrm-2.4.9/libdrm/nouveau/nouveau_drmif.h
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_drmif.h 2009-02-11 01:09:35.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_drmif.h 2009-03-31 19:58:20.000000000 +0200
@@ -37,6 +37,9 @@
int needs_close;
int mm_enabled;
+/*XXX: move to nouveau_device when interface gets bumped */
+ uint64_t vram_aper_size;
+ uint64_t gart_aper_size;
};
#define nouveau_device(n) ((struct nouveau_device_priv *)(n))
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_fence.c new/libdrm-2.4.9/libdrm/nouveau/nouveau_fence.c
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_fence.c 2009-02-11 01:09:35.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_fence.c 2009-03-31 19:58:20.000000000 +0200
@@ -96,22 +96,16 @@
int
nouveau_fence_ref(struct nouveau_fence *ref, struct nouveau_fence **fence)
{
- struct nouveau_fence_priv *nvfence;
-
if (!fence)
return -EINVAL;
- if (*fence) {
- nouveau_fence_del(fence);
- *fence = NULL;
- }
+ if (ref)
+ nouveau_fence(ref)->refcount++;
- if (ref) {
- nvfence = nouveau_fence(ref);
- nvfence->refcount++;
- *fence = &nvfence->base;
- }
+ if (*fence)
+ nouveau_fence_del(fence);
+ *fence = ref;
return 0;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/libdrm/nouveau/nouveau_private.h new/libdrm-2.4.9/libdrm/nouveau/nouveau_private.h
--- old/libdrm-2.4.5/libdrm/nouveau/nouveau_private.h 1970-01-01 01:00:00.000000000 +0100
+++ new/libdrm-2.4.9/libdrm/nouveau/nouveau_private.h 2009-03-19 00:51:12.000000000 +0100
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2007 Nouveau Project
+ *
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS 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.
+ */
+
+#ifndef __NOUVEAU_PRIVATE_H__
+#define __NOUVEAU_PRIVATE_H__
+
+#include
+#include
+#include
+
+#include "nouveau_drmif.h"
+#include "nouveau_device.h"
+#include "nouveau_channel.h"
+#include "nouveau_grobj.h"
+#include "nouveau_notifier.h"
+#include "nouveau_bo.h"
+#include "nouveau_resource.h"
+#include "nouveau_pushbuf.h"
+
+#define NOUVEAU_PUSHBUF_MAX_BUFFERS 1024
+#define NOUVEAU_PUSHBUF_MAX_RELOCS 1024
+struct nouveau_pushbuf_priv {
+ struct nouveau_pushbuf base;
+
+ int use_cal;
+ struct nouveau_bo *buffer;
+
+ unsigned *pushbuf;
+ unsigned size;
+
+ struct drm_nouveau_gem_pushbuf_bo *buffers;
+ unsigned nr_buffers;
+ struct drm_nouveau_gem_pushbuf_reloc *relocs;
+ unsigned nr_relocs;
+
+ /*XXX: nomm */
+ struct nouveau_fence *fence;
+};
+#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
+
+#define pbbo_to_ptr(o) ((uint64_t)(unsigned long)(o))
+#define ptr_to_pbbo(h) ((struct nouveau_pushbuf_bo *)(unsigned long)(h))
+#define pbrel_to_ptr(o) ((uint64_t)(unsigned long)(o))
+#define ptr_to_pbrel(h) ((struct nouveau_pushbuf_reloc *)(unsigned long)(h))
+#define bo_to_ptr(o) ((uint64_t)(unsigned long)(o))
+#define ptr_to_bo(h) ((struct nouveau_bo_priv *)(unsigned long)(h))
+
+int
+nouveau_pushbuf_init(struct nouveau_channel *);
+
+struct nouveau_dma_priv {
+ uint32_t base;
+ uint32_t max;
+ uint32_t cur;
+ uint32_t put;
+ uint32_t free;
+
+ int push_free;
+} dma;
+
+struct nouveau_channel_priv {
+ struct nouveau_channel base;
+
+ struct drm_nouveau_channel_alloc drm;
+
+ void *notifier_block;
+
+ struct nouveau_pushbuf_priv pb;
+
+ /*XXX: nomm */
+ volatile uint32_t *user, *put, *get, *ref_cnt;
+ uint32_t *pushbuf;
+ struct nouveau_dma_priv struct_dma;
+ struct nouveau_dma_priv *dma;
+ struct nouveau_fence *fence_head;
+ struct nouveau_fence *fence_tail;
+ uint32_t fence_sequence;
+ struct nouveau_grobj *fence_grobj;
+ struct nouveau_notifier *fence_ntfy;
+};
+#define nouveau_channel(n) ((struct nouveau_channel_priv *)(n))
+
+struct nouveau_fence {
+ struct nouveau_channel *channel;
+};
+
+struct nouveau_fence_cb {
+ struct nouveau_fence_cb *next;
+ void (*func)(void *);
+ void *priv;
+};
+
+struct nouveau_fence_priv {
+ struct nouveau_fence base;
+ int refcount;
+
+ struct nouveau_fence *next;
+ struct nouveau_fence_cb *signal_cb;
+
+ uint32_t sequence;
+ int emitted;
+ int signalled;
+};
+#define nouveau_fence(n) ((struct nouveau_fence_priv *)(n))
+
+int
+nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **);
+
+int
+nouveau_fence_ref(struct nouveau_fence *, struct nouveau_fence **);
+
+int
+nouveau_fence_signal_cb(struct nouveau_fence *, void (*)(void *), void *);
+
+void
+nouveau_fence_emit(struct nouveau_fence *);
+
+int
+nouveau_fence_wait(struct nouveau_fence **);
+
+void
+nouveau_fence_flush(struct nouveau_channel *);
+
+struct nouveau_grobj_priv {
+ struct nouveau_grobj base;
+};
+#define nouveau_grobj(n) ((struct nouveau_grobj_priv *)(n))
+
+struct nouveau_notifier_priv {
+ struct nouveau_notifier base;
+
+ struct drm_nouveau_notifierobj_alloc drm;
+ volatile void *map;
+};
+#define nouveau_notifier(n) ((struct nouveau_notifier_priv *)(n))
+
+struct nouveau_bo_priv {
+ struct nouveau_bo base;
+ int refcount;
+
+ /* Buffer configuration + usage hints */
+ unsigned flags;
+ unsigned size;
+ unsigned align;
+ int user;
+
+ /* Tracking */
+ struct drm_nouveau_gem_pushbuf_bo *pending;
+ struct nouveau_channel *pending_channel;
+ int write_marker;
+
+ /* Userspace object */
+ void *sysmem;
+
+ /* Kernel object */
+ uint32_t global_handle;
+ drm_handle_t handle;
+ void *map;
+
+ /* Last known information from kernel on buffer status */
+ int pinned;
+ uint64_t offset;
+ uint32_t domain;
+
+ /*XXX: nomm stuff */
+ struct nouveau_fence *fence;
+ struct nouveau_fence *wr_fence;
+};
+#define nouveau_bo(n) ((struct nouveau_bo_priv *)(n))
+
+int
+nouveau_bo_init(struct nouveau_device *);
+
+void
+nouveau_bo_takedown(struct nouveau_device *);
+
+struct drm_nouveau_gem_pushbuf_bo *
+nouveau_bo_emit_buffer(struct nouveau_channel *, struct nouveau_bo *);
+
+int
+nouveau_bo_validate_nomm(struct nouveau_bo_priv *, uint32_t);
+
+#include "nouveau_dma.h"
+#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/auth.c new/libdrm-2.4.9/tests/auth.c
--- old/libdrm-2.4.5/tests/auth.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/auth.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,137 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * 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, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Authors:
- * Eric Anholt
- *
- */
-
-#include
-#include "drmtest.h"
-
-enum auth_event {
- SERVER_READY,
- CLIENT_MAGIC,
- CLIENT_DONE,
-};
-
-int commfd[2];
-
-static void wait_event(int pipe, enum auth_event expected_event)
-{
- int ret;
- enum auth_event event;
- unsigned char in;
-
- ret = read(commfd[pipe], &in, 1);
- if (ret == -1)
- err(1, "read error");
- event = in;
-
- if (event != expected_event)
- errx(1, "unexpected event: %d\n", event);
-}
-
-static void
-send_event(int pipe, enum auth_event send_event)
-{
- int ret;
- unsigned char event;
-
- event = send_event;
- ret = write(commfd[pipe], &event, 1);
- if (ret == -1)
- err(1, "failed to send event %d", event);
-}
-
-static void client()
-{
- struct drm_auth auth;
- int drmfd, ret;
-
- /* XXX: Should make sure we open the same DRM as the master */
- wait_event(0, SERVER_READY);
-
- drmfd = drm_open_any();
-
- /* Get a client magic number and pass it to the master for auth. */
- auth.magic = 0; /* Quiet valgrind */
- ret = ioctl(drmfd, DRM_IOCTL_GET_MAGIC, &auth);
- if (ret == -1)
- err(1, "Couldn't get client magic");
- send_event(0, CLIENT_MAGIC);
- ret = write(commfd[0], &auth.magic, sizeof(auth.magic));
- if (ret == -1)
- err(1, "Couldn't write auth data");
-
- /* Signal that the client is completely done. */
- send_event(0, CLIENT_DONE);
-}
-
-static void server()
-{
- int drmfd, ret;
- struct drm_auth auth;
-
- drmfd = drm_open_any_master();
-
- auth.magic = 0xd0d0d0d0;
- ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth);
- if (ret != -1 || errno != EINVAL)
- errx(1, "Authenticating bad magic succeeded\n");
-
- send_event(1, SERVER_READY);
-
- wait_event(1, CLIENT_MAGIC);
- ret = read(commfd[1], &auth.magic, sizeof(auth.magic));
- if (ret == -1)
- err(1, "Failure to read client magic");
-
- ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth);
- if (ret == -1)
- err(1, "Failure to authenticate client magic\n");
-
- wait_event(1, CLIENT_DONE);
-}
-
-/**
- * Checks DRM authentication mechanisms.
- */
-int main(int argc, char **argv)
-{
- int ret;
-
- ret = pipe(commfd);
- if (ret == -1)
- err(1, "Couldn't create pipe");
-
- ret = fork();
- if (ret == -1)
- err(1, "failure to fork client");
- if (ret == 0)
- client();
- else
- server();
-
- return 0;
-}
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/drmtest.c new/libdrm-2.4.9/tests/drmtest.c
--- old/libdrm-2.4.5/tests/drmtest.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/drmtest.c 2009-04-11 00:16:38.000000000 +0200
@@ -26,58 +26,103 @@
*/
#include
+#include
#include
#include "drmtest.h"
-/** Open the first DRM device we can find, searching up to 16 device nodes */
-int drm_open_any(void)
+#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
+#include
+
+static int is_master(int fd)
{
- char name[20];
+ drm_client_t client;
+ int ret;
+
+ /* Check that we're the only opener and authed. */
+ client.idx = 0;
+ ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
+ assert (ret == 0);
+ if (!client.auth)
+ return 0;
+ client.idx = 1;
+ ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
+ if (ret != -1 || errno != EINVAL)
+ return 0;
+
+ return 1;
+}
+
+/** Open the first DRM device matching the criteria */
+int drm_open_matching(const char *pci_glob, int flags)
+{
+ struct udev *udev;
+ struct udev_enumerate *e;
+ struct udev_device *device, *parent;
+ struct udev_list_entry *entry;
+ const char *pci_id, *path;
int i, fd;
- for (i = 0; i < 16; i++) {
- sprintf(name, "/dev/dri/card%d", i);
- fd = open(name, O_RDWR);
- if (fd != -1)
- return fd;
+ udev = udev_new();
+ if (udev == NULL) {
+ fprintf(stderr, "failed to initialize udev context\n");
+ abort();
}
- abort();
+
+ fd = -1;
+ e = udev_enumerate_new(udev);
+ udev_enumerate_add_match_subsystem(e, "drm");
+ udev_enumerate_scan_devices(e);
+ udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+ path = udev_list_entry_get_name(entry);
+ device = udev_device_new_from_syspath(udev, path);
+ parent = udev_device_get_parent(device);
+ /* Filter out KMS output devices. */
+ if (strcmp(udev_device_get_subsystem(parent), "pci") != 0)
+ continue;
+ pci_id = udev_device_get_property_value(parent, "PCI_ID");
+ if (fnmatch(pci_glob, pci_id, 0) != 0)
+ continue;
+ fd = open(udev_device_get_devnode(device), O_RDWR);
+ if (fd < 0)
+ continue;
+ if ((flags & DRM_TEST_MASTER) && !is_master(fd)) {
+ close(fd);
+ fd = -1;
+ continue;
+ }
+
+ break;
+ }
+ udev_enumerate_unref(e);
+ udev_unref(udev);
+
+ return fd;
}
+int drm_open_any(void)
+{
+ int fd = drm_open_matching("*:*", 0);
+
+ if (fd < 0) {
+ fprintf(stderr, "failed to open any drm device\n");
+ abort();
+ }
+
+ return fd;
+}
/**
* Open the first DRM device we can find where we end up being the master.
*/
int drm_open_any_master(void)
{
- char name[20];
- int i, fd;
-
- for (i = 0; i < 16; i++) {
- drm_client_t client;
- int ret;
-
- sprintf(name, "/dev/dri/card%d", i);
- fd = open(name, O_RDWR);
- if (fd == -1)
- continue;
+ int fd = drm_open_matching("*:*", DRM_TEST_MASTER);
- /* Check that we're the only opener and authed. */
- client.idx = 0;
- ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- assert (ret == 0);
- if (!client.auth) {
- close(fd);
- continue;
- }
- client.idx = 1;
- ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- if (ret != -1 || errno != EINVAL) {
- close(fd);
- continue;
- }
- return fd;
+ if (fd < 0) {
+ fprintf(stderr, "failed to open any drm device\n");
+ abort();
}
- fprintf(stderr, "Couldn't find an un-controlled DRM device\n");
- abort();
+
+ return fd;
+
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/drmtest.h new/libdrm-2.4.9/tests/drmtest.h
--- old/libdrm-2.4.5/tests/drmtest.h 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/drmtest.h 2009-04-11 00:16:38.000000000 +0200
@@ -33,5 +33,8 @@
#include "xf86drm.h"
+#define DRM_TEST_MASTER 0x01
+
int drm_open_any(void);
int drm_open_any_master(void);
+int drm_open_matching(const char *pci_glob, int flags);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/gem_basic.c new/libdrm-2.4.9/tests/gem_basic.c
--- old/libdrm-2.4.5/tests/gem_basic.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/gem_basic.c 2009-04-11 00:16:38.000000000 +0200
@@ -88,7 +88,11 @@
{
int fd;
- fd = drm_open_any();
+ fd = drm_open_matching("8086:*", 0);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open intel drm device\n");
+ return 0;
+ }
test_bad_close(fd);
test_create_close(fd);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/gem_flink.c new/libdrm-2.4.9/tests/gem_flink.c
--- old/libdrm-2.4.5/tests/gem_flink.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/gem_flink.c 2009-04-11 00:16:38.000000000 +0200
@@ -117,7 +117,11 @@
{
int fd;
- fd = drm_open_any();
+ fd = drm_open_matching("8086:*", 0);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open intel drm device, skipping\n");
+ return 0;
+ }
test_flink(fd);
test_double_flink(fd);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/gem_mmap.c new/libdrm-2.4.9/tests/gem_mmap.c
--- old/libdrm-2.4.5/tests/gem_mmap.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/gem_mmap.c 2009-04-11 00:16:38.000000000 +0200
@@ -81,7 +81,11 @@
int ret;
int handle;
- fd = drm_open_any();
+ fd = drm_open_matching("8086:*", 0);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open intel drm device, skipping\n");
+ return 0;
+ }
memset(&mmap, 0, sizeof(mmap));
mmap.handle = 0x10101010;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/gem_readwrite.c new/libdrm-2.4.9/tests/gem_readwrite.c
--- old/libdrm-2.4.5/tests/gem_readwrite.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/gem_readwrite.c 2009-04-11 00:16:38.000000000 +0200
@@ -78,7 +78,11 @@
int ret;
int handle;
- fd = drm_open_any();
+ fd = drm_open_matching("8086:*", 0);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open intel drm device, skipping\n");
+ return 0;
+ }
memset(&create, 0, sizeof(create));
create.size = OBJECT_SIZE;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/getversion.c new/libdrm-2.4.9/tests/getversion.c
--- old/libdrm-2.4.5/tests/getversion.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/getversion.c 2009-04-11 00:16:38.000000000 +0200
@@ -40,7 +40,8 @@
assert(strlen(v->name) != 0);
assert(strlen(v->date) != 0);
assert(strlen(v->desc) != 0);
- assert(v->version_major >= 1);
+ if (strcmp(v->name, "i915") == 0)
+ assert(v->version_major >= 1);
drmFree(v);
close(fd);
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/lock.c new/libdrm-2.4.9/tests/lock.c
--- old/libdrm-2.4.5/tests/lock.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/lock.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,263 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * 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, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Authors:
- * Eric Anholt
- *
- */
-
-/** @file lock.c
- * Tests various potential failures of the DRM locking mechanisms
- */
-
-#include
-#include "drmtest.h"
-
-enum auth_event {
- SERVER_READY,
- CLIENT_MAGIC,
- SERVER_LOCKED,
- CLIENT_LOCKED,
-};
-
-int commfd[2];
-unsigned int lock1 = 0x00001111;
-unsigned int lock2 = 0x00002222;
-
-/* return time in milliseconds */
-static unsigned int
-get_millis()
-{
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-}
-
-static void
-wait_event(int pipe, enum auth_event expected_event)
-{
- int ret;
- enum auth_event event;
- unsigned char in;
-
- ret = read(commfd[pipe], &in, 1);
- if (ret == -1)
- err(1, "read error");
- event = in;
-
- if (event != expected_event)
- errx(1, "unexpected event: %d\n", event);
-}
-
-static void
-send_event(int pipe, enum auth_event send_event)
-{
- int ret;
- unsigned char event;
-
- event = send_event;
- ret = write(commfd[pipe], &event, 1);
- if (ret == -1)
- err(1, "failed to send event %d", event);
-}
-
-static void
-client_auth(int drmfd)
-{
- struct drm_auth auth;
- int ret;
-
- /* Get a client magic number and pass it to the master for auth. */
- ret = ioctl(drmfd, DRM_IOCTL_GET_MAGIC, &auth);
- if (ret == -1)
- err(1, "Couldn't get client magic");
- send_event(0, CLIENT_MAGIC);
- ret = write(commfd[0], &auth.magic, sizeof(auth.magic));
- if (ret == -1)
- err(1, "Couldn't write auth data");
-}
-
-static void
-server_auth(int drmfd)
-{
- struct drm_auth auth;
- int ret;
-
- send_event(1, SERVER_READY);
- wait_event(1, CLIENT_MAGIC);
- ret = read(commfd[1], &auth.magic, sizeof(auth.magic));
- if (ret == -1)
- err(1, "Failure to read client magic");
-
- ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth);
- if (ret == -1)
- err(1, "Failure to authenticate client magic\n");
-}
-
-/** Tests that locking is successful in normal conditions */
-static void
-test_lock_unlock(int drmfd)
-{
- int ret;
-
- ret = drmGetLock(drmfd, lock1, 0);
- if (ret != 0)
- err(1, "Locking failed");
- ret = drmUnlock(drmfd, lock1);
- if (ret != 0)
- err(1, "Unlocking failed");
-}
-
-/** Tests that unlocking the lock while it's not held works correctly */
-static void
-test_unlock_unlocked(int drmfd)
-{
- int ret;
-
- ret = drmUnlock(drmfd, lock1);
- if (ret == 0)
- err(1, "Unlocking unlocked lock succeeded");
-}
-
-/** Tests that unlocking a lock held by another context fails appropriately */
-static void
-test_unlock_unowned(int drmfd)
-{
- int ret;
-
- ret = drmGetLock(drmfd, lock1, 0);
- assert(ret == 0);
- ret = drmUnlock(drmfd, lock2);
- if (ret == 0)
- errx(1, "Unlocking other context's lock succeeded");
- ret = drmUnlock(drmfd, lock1);
- assert(ret == 0);
-}
-
-/**
- * Tests that an open/close by the same process doesn't result in the lock
- * being dropped.
- */
-static void test_open_close_locked(drmfd)
-{
- int ret, tempfd;
-
- ret = drmGetLock(drmfd, lock1, 0);
- assert(ret == 0);
- /* XXX: Need to make sure that this is the same device as drmfd */
- tempfd = drm_open_any();
- close(tempfd);
- ret = drmUnlock(drmfd, lock1);
- if (ret != 0)
- errx(1, "lock lost during open/close by same pid");
-}
-
-static void client()
-{
- int drmfd, ret;
- unsigned int time;
-
- wait_event(0, SERVER_READY);
-
- /* XXX: Should make sure we open the same DRM as the master */
- drmfd = drm_open_any();
-
- client_auth(drmfd);
-
- /* Wait for the server to grab the lock, then grab it ourselves (to
- * contest it). Hopefully we hit it within the window of when the
- * server locks.
- */
- wait_event(0, SERVER_LOCKED);
- ret = drmGetLock(drmfd, lock2, 0);
- time = get_millis();
- if (ret != 0)
- err(1, "Failed to get lock on client\n");
- drmUnlock(drmfd, lock2);
-
- /* Tell the server that our locking completed, and when it did */
- send_event(0, CLIENT_LOCKED);
- ret = write(commfd[0], &time, sizeof(time));
-
- close(drmfd);
- exit(0);
-}
-
-static void server()
-{
- int drmfd, tempfd, ret;
- unsigned int client_time, unlock_time;
-
- drmfd = drm_open_any_master();
-
- test_lock_unlock(drmfd);
- test_unlock_unlocked(drmfd);
- test_unlock_unowned(drmfd);
- test_open_close_locked(drmfd);
-
- /* Perform the authentication sequence with the client. */
- server_auth(drmfd);
-
- /* Now, test that the client attempting to lock while the server
- * holds the lock works correctly.
- */
- ret = drmGetLock(drmfd, lock1, 0);
- assert(ret == 0);
- send_event(1, SERVER_LOCKED);
- /* Wait a while for the client to do its thing */
- sleep(1);
- ret = drmUnlock(drmfd, lock1);
- assert(ret == 0);
- unlock_time = get_millis();
-
- wait_event(1, CLIENT_LOCKED);
- ret = read(commfd[1], &client_time, sizeof(client_time));
- if (ret == -1)
- err(1, "Failure to read client magic");
-
- if (client_time < unlock_time)
- errx(1, "Client took lock before server released it");
-
- close(drmfd);
-}
-
-int main(int argc, char **argv)
-{
- int ret;
-
-
- ret = pipe(commfd);
- if (ret == -1)
- err(1, "Couldn't create pipe");
-
- ret = fork();
- if (ret == -1)
- err(1, "failure to fork client");
- if (ret == 0)
- client();
- else
- server();
-
- return 0;
-}
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/Makefile.am new/libdrm-2.4.9/tests/Makefile.am
--- old/libdrm-2.4.5/tests/Makefile.am 2008-12-17 19:30:26.000000000 +0100
+++ new/libdrm-2.4.9/tests/Makefile.am 2009-04-11 00:16:38.000000000 +0200
@@ -1,37 +1,50 @@
-AM_CFLAGS = \
+AM_CPPFLAGS = \
-I $(top_srcdir)/shared-core \
-I $(top_srcdir)/libdrm
+LDADD = $(top_builddir)/libdrm/libdrm.la
+
noinst_PROGRAMS = \
dristat \
drmstat
+SUBDIRS = \
+ modeprint \
+ modetest
+
+if HAVE_LIBUDEV
+
EXTRA_LTLIBRARIES = libdrmtest.la
+
libdrmtest_la_SOURCES = \
drmtest.c \
drmtest.h
+
libdrmtest_la_LIBADD = \
- $(top_builddir)/libdrm/libdrm.la
+ $(top_builddir)/libdrm/libdrm.la \
+ $(LIBUDEV_LIBS)
-LDADD = libdrmtest.la
+LDADD += libdrmtest.la
-SUBDIRS = \
- modeprint \
- modetest
-
-TESTS = auth \
- openclose \
- getversion \
- getclient \
- getstats \
- lock \
- setversion \
- updatedraw \
- gem_basic \
- gem_flink \
- gem_readwrite \
+XFAIL_TESTS = \
+ auth \
+ lock
+
+TESTS = \
+ openclose \
+ getversion \
+ getclient \
+ getstats \
+ setversion \
+ updatedraw \
+ gem_basic \
+ gem_flink \
+ gem_readwrite \
gem_mmap
EXTRA_PROGRAMS = $(TESTS)
+
+endif
+
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/setversion.c new/libdrm-2.4.9/tests/setversion.c
--- old/libdrm-2.4.5/tests/setversion.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/setversion.c 2009-04-11 00:16:38.000000000 +0200
@@ -40,6 +40,11 @@
int fd, ret;
drm_set_version_t sv, version;
+ if (getuid() != 0) {
+ fprintf(stderr, "setversion test requires root, skipping\n");
+ return 0;
+ }
+
fd = drm_open_any_master();
/* First, check that we can get the DD/DI versions. */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libdrm-2.4.5/tests/updatedraw.c new/libdrm-2.4.9/tests/updatedraw.c
--- old/libdrm-2.4.5/tests/updatedraw.c 2008-10-09 21:02:11.000000000 +0200
+++ new/libdrm-2.4.9/tests/updatedraw.c 2009-04-11 00:16:38.000000000 +0200
@@ -123,6 +123,11 @@
{
int fd, ret, d1, d2;
+ if (getuid() != 0) {
+ fprintf(stderr, "updatedraw test requires root, skipping\n");
+ return 0;
+ }
+
fd = drm_open_any_master();
d1 = add_drawable(fd);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org