debian/changelog | 7 debian/control | 31 debian/libdrm-nouveau1a.install | 1 debian/libdrm-nouveau1a.lintian-overrides | 1 debian/libdrm-nouveau1a.symbols | 46 debian/patches/04_libdrm-2.4.37-nouveau-1.diff | 2921 ------------------------- debian/patches/series | 1 debian/rules | 8 8 files changed, 1 insertion(+), 3015 deletions(-)
New commits: commit d05a296c523daed4558ea01b0eac7c896c66a63d Author: Sven Joachim <[email protected]> Date: Wed Sep 5 19:19:24 2012 +0200 Remove libdrm-nouveau1a Since Plymouth in Wheezy no longer links against libdrm_nouveau and Mesa 9.0 uses the new nouveau ABI, this package is redundant. diff --git a/debian/changelog b/debian/changelog index 11f33a7..51d7487 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,12 +2,7 @@ libdrm (2.4.39-1) UNRELEASED; urgency=low [ Maarten Lankhorst ] * New upstream release. - * Modify libdrm-2.4.37-nouveau-1.patch from fedora 17 - - Allows building libdrm_nouveau.so.1 and 2 simultaneously - - libdrm_nouveau1.{so,pc} links to legacy libdrm_nouveau.so.1 - - libdrm_nouveau.{so,pc} links to new api libdrm_nouveau.so.2 - - This is done to allow building upstream unmodified, - while retaining compatibility with mesa stable + - Nouveau ABI change, replace libdrm-nouveau1a with libdrm-nouveau2. [ Timo Aaltonen ] * Bump libdrm-intel1's and libdrm-nouveau2's shlibs due to new symbols. diff --git a/debian/control b/debian/control index 96826f3..12171e7 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,6 @@ Depends: libdrm2 (= ${binary:Version}), libdrm-intel1 (= ${binary:Version}) [amd64 i386 kfreebsd-amd64 kfreebsd-i386], libdrm-radeon1 (= ${binary:Version}) [linux-any], - libdrm-nouveau1a (= ${binary:Version}) [linux-any], libdrm-nouveau2 (= ${binary:Version}) [linux-any], libdrm-omap1 (= ${binary:Version}) [any-arm], libkms1 (= ${binary:Version}) [linux-any], @@ -113,36 +112,6 @@ Description: Userspace interface to intel-specific kernel DRM services -- debugg . This package provides the debugging symbols for the libdrm-intel1 package. -Package: libdrm-nouveau1a -Section: libs -Architecture: linux-any -Depends: ${shlibs:Depends}, - ${misc:Depends}, -Conflicts: libdrm-nouveau1 -Pre-Depends: ${misc:Pre-Depends} -Multi-Arch: same -Description: Userspace interface to nouveau-specific kernel DRM services -- runtime - This library implements the userspace interface to the nouveau-specific kernel - DRM services. DRM stands for "Direct Rendering Manager", which is the - kernelspace portion of the "Direct Rendering Infrastructure" (DRI). The DRI is - currently used on Linux to provide hardware-accelerated OpenGL drivers. - -Package: libdrm-nouveau1a-dbg -Section: debug -Priority: extra -Architecture: linux-any -Depends: libdrm-nouveau1a (= ${binary:Version}), - ${misc:Depends}, -Conflicts: libdrm-nouveau1-dbg -Multi-Arch: same -Description: Userspace interface to nouveau-specific kernel DRM -- debugging symbols - This library implements the userspace interface to the kernel DRM services. - DRM stands for "Direct Rendering Manager", which is the kernelspace portion - of the "Direct Rendering Infrastructure" (DRI). The DRI is currently used on - Linux to provide hardware-accelerated OpenGL drivers. - . - This package provides the debugging symbols for the libdrm-nouveau1a package. - Package: libdrm-nouveau2 Section: libs Architecture: linux-any diff --git a/debian/libdrm-nouveau1a.install b/debian/libdrm-nouveau1a.install deleted file mode 100644 index 6c55080..0000000 --- a/debian/libdrm-nouveau1a.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/libdrm_nouveau.so.1* diff --git a/debian/libdrm-nouveau1a.lintian-overrides b/debian/libdrm-nouveau1a.lintian-overrides deleted file mode 100644 index 76c525b..0000000 --- a/debian/libdrm-nouveau1a.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -libdrm-nouveau1a: package-name-doesnt-match-sonames libdrm-nouveau1 diff --git a/debian/libdrm-nouveau1a.symbols b/debian/libdrm-nouveau1a.symbols deleted file mode 100644 index a2ba922..0000000 --- a/debian/libdrm-nouveau1a.symbols +++ /dev/null @@ -1,46 +0,0 @@ -libdrm_nouveau.so.1 libdrm-nouveau1a #MINVER# - nouveau_bo_busy@Base 2.4.23 - nouveau_bo_emit_buffer@Base 2.4.23 - nouveau_bo_handle_get@Base 2.4.23 - nouveau_bo_handle_ref@Base 2.4.23 - nouveau_bo_init@Base 2.4.23 - nouveau_bo_map@Base 2.4.23 - nouveau_bo_map_flush@Base 2.4.23 - nouveau_bo_map_range@Base 2.4.23 - nouveau_bo_new@Base 2.4.23 - nouveau_bo_new_tile@Base 2.4.23 - nouveau_bo_pending@Base 2.4.23 - nouveau_bo_ref@Base 2.4.23 - nouveau_bo_takedown@Base 2.4.23 - nouveau_bo_unmap@Base 2.4.23 - nouveau_bo_user@Base 2.4.23 - nouveau_bo_wrap@Base 2.4.23 - nouveau_channel_alloc@Base 2.4.23 - nouveau_channel_free@Base 2.4.23 - nouveau_device_close@Base 2.4.23 - nouveau_device_get_param@Base 2.4.23 - nouveau_device_open@Base 2.4.23 - nouveau_device_open_existing@Base 2.4.23 - nouveau_device_set_param@Base 2.4.23 - nouveau_grobj_alloc@Base 2.4.23 - nouveau_grobj_autobind@Base 2.4.23 - nouveau_grobj_free@Base 2.4.23 - nouveau_grobj_ref@Base 2.4.23 - nouveau_notifier_alloc@Base 2.4.23 - nouveau_notifier_free@Base 2.4.23 - nouveau_notifier_reset@Base 2.4.23 - nouveau_notifier_return_val@Base 2.4.23 - nouveau_notifier_status@Base 2.4.23 - nouveau_notifier_wait_status@Base 2.4.23 - nouveau_pushbuf_emit_reloc@Base 2.4.23 - nouveau_pushbuf_fini@Base 2.4.23 - nouveau_pushbuf_flush@Base 2.4.23 - nouveau_pushbuf_init@Base 2.4.23 - nouveau_pushbuf_marker_emit@Base 2.4.23 - nouveau_pushbuf_marker_undo@Base 2.4.23 - nouveau_pushbuf_submit@Base 2.4.23 - nouveau_reloc_emit@Base 2.4.23 - nouveau_resource_alloc@Base 2.4.23 - nouveau_resource_destroy@Base 2.4.23 - nouveau_resource_free@Base 2.4.23 - nouveau_resource_init@Base 2.4.23 diff --git a/debian/patches/04_libdrm-2.4.37-nouveau-1.diff b/debian/patches/04_libdrm-2.4.37-nouveau-1.diff deleted file mode 100644 index 10f02a9..0000000 --- a/debian/patches/04_libdrm-2.4.37-nouveau-1.diff +++ /dev/null @@ -1,2921 +0,0 @@ -diff --git a/Makefile.am b/Makefile.am -index 256a8cc..045add1 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -34,7 +34,7 @@ INTEL_SUBDIR = intel - endif - - if HAVE_NOUVEAU --NOUVEAU_SUBDIR = nouveau -+NOUVEAU_SUBDIR = nouveau-1 nouveau - endif - - if HAVE_RADEON -diff --git a/configure.ac b/configure.ac -index a1c8c69..6439b81 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -319,6 +319,8 @@ AC_CONFIG_FILES([ - intel/libdrm_intel.pc - radeon/Makefile - radeon/libdrm_radeon.pc -+ nouveau-1/Makefile -+ nouveau-1/libdrm_nouveau1.pc - nouveau/Makefile - nouveau/libdrm_nouveau.pc - omap/Makefile -diff --git a/nouveau-1/Makefile.am b/nouveau-1/Makefile.am -new file mode 100644 -index 0000000..7e6aa13 ---- /dev/null -+++ b/nouveau-1/Makefile.am -@@ -0,0 +1,43 @@ -+AM_CFLAGS = \ -+ $(WARN_CFLAGS) \ -+ -I$(top_srcdir) \ -+ -I$(top_srcdir)/nouveau-1 \ -+ $(PTHREADSTUBS_CFLAGS) \ -+ -I$(top_srcdir)/include/drm -+ -+libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la -+libdrm_nouveau_ladir = $(libdir) -+libdrm_nouveau_la_LDFLAGS = -version-number 1:0:0 -no-undefined -+libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ -+ -+libdrm_nouveau_la_SOURCES = \ -+ nouveau_device.c \ -+ nouveau_channel.c \ -+ nouveau_pushbuf.c \ -+ nouveau_grobj.c \ -+ nouveau_notifier.c \ -+ nouveau_bo.c \ -+ nouveau_resource.c \ -+ nouveau_private.h \ -+ nouveau_reloc.c -+ -+libdrm_nouveaucommonincludedir = ${includedir}/nouveau -+libdrm_nouveaucommoninclude_HEADERS = \ -+ nouveau_device.h \ -+ nouveau_channel.h \ -+ nouveau_grobj.h \ -+ nouveau_notifier.h \ -+ nouveau_pushbuf.h \ -+ nv04_pushbuf.h \ -+ nvc0_pushbuf.h \ -+ nouveau_bo.h \ -+ nouveau_resource.h \ -+ nouveau_reloc.h -+ -+ -+libdrm_nouveauincludedir = ${includedir}/libdrm -+libdrm_nouveauinclude_HEADERS = \ -+ nouveau_drmif.h -+ -+pkgconfigdir = @pkgconfigdir@ -+pkgconfig_DATA = libdrm_nouveau1.pc -diff --git a/nouveau-1/libdrm_nouveau1.pc.in b/nouveau-1/libdrm_nouveau1.pc.in -new file mode 100644 -index 0000000..8f3d40f ---- /dev/null -+++ b/nouveau-1/libdrm_nouveau1.pc.in -@@ -0,0 +1,11 @@ -+prefix=@prefix@ -+exec_prefix=@exec_prefix@ -+libdir=@libdir@ -+includedir=@includedir@ -+ -+Name: libdrm_nouveau -+Description: Userspace interface to nouveau kernel DRM services -+Version: 0.6 -+Libs: -L${libdir} -ldrm_nouveau1 -+Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/nouveau -+Requires.private: libdrm -diff --git a/nouveau-1/nouveau_bo.c b/nouveau-1/nouveau_bo.c -new file mode 100644 -index 0000000..d6bb22d ---- /dev/null -+++ b/nouveau-1/nouveau_bo.c -@@ -0,0 +1,549 @@ -+/* -+ * 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include <config.h> -+#endif -+#include <stdint.h> -+#include <stdlib.h> -+#include <errno.h> -+#include <assert.h> -+ -+#include <sys/mman.h> -+ -+#include "nouveau_private.h" -+ -+int -+nouveau_bo_init(struct nouveau_device *dev) -+{ -+ return 0; -+} -+ -+void -+nouveau_bo_takedown(struct nouveau_device *dev) -+{ -+} -+ -+static int -+nouveau_bo_info(struct nouveau_bo_priv *nvbo, struct drm_nouveau_gem_info *arg) -+{ -+ nvbo->handle = nvbo->base.handle = arg->handle; -+ nvbo->domain = arg->domain; -+ nvbo->size = arg->size; -+ nvbo->offset = arg->offset; -+ nvbo->map_handle = arg->map_handle; -+ nvbo->base.tile_mode = arg->tile_mode; -+ /* XXX - flag inverted for backwards compatibility */ -+ nvbo->base.tile_flags = arg->tile_flags ^ NOUVEAU_GEM_TILE_NONCONTIG; -+ return 0; -+} -+ -+static int -+nouveau_bo_allocated(struct nouveau_bo_priv *nvbo) -+{ -+ if (nvbo->sysmem || nvbo->handle) -+ return 1; -+ return 0; -+} -+ -+static int -+nouveau_bo_ualloc(struct nouveau_bo_priv *nvbo) -+{ -+ if (nvbo->user || nvbo->sysmem) { -+ assert(nvbo->sysmem); -+ return 0; -+ } -+ -+ nvbo->sysmem = malloc(nvbo->size); -+ if (!nvbo->sysmem) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void -+nouveau_bo_ufree(struct nouveau_bo_priv *nvbo) -+{ -+ if (nvbo->sysmem) { -+ if (!nvbo->user) -+ free(nvbo->sysmem); -+ nvbo->sysmem = NULL; -+ } -+} -+ -+static void -+nouveau_bo_kfree(struct nouveau_bo_priv *nvbo) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device); -+ struct drm_gem_close req; -+ -+ if (!nvbo->handle) -+ return; -+ -+ if (nvbo->map) { -+ munmap(nvbo->map, nvbo->size); -+ nvbo->map = NULL; -+ } -+ -+ req.handle = nvbo->handle; -+ nvbo->handle = 0; -+ drmIoctl(nvdev->fd, DRM_IOCTL_GEM_CLOSE, &req); -+} -+ -+static int -+nouveau_bo_kalloc(struct nouveau_bo_priv *nvbo, struct nouveau_channel *chan) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device); -+ struct drm_nouveau_gem_new req; -+ struct drm_nouveau_gem_info *info = &req.info; -+ int ret; -+ -+ if (nvbo->handle) -+ return 0; -+ -+ req.channel_hint = chan ? chan->id : 0; -+ req.align = nvbo->align; -+ -+ -+ info->size = nvbo->size; -+ info->domain = 0; -+ -+ if (nvbo->flags & NOUVEAU_BO_VRAM) -+ info->domain |= NOUVEAU_GEM_DOMAIN_VRAM; -+ if (nvbo->flags & NOUVEAU_BO_GART) -+ info->domain |= NOUVEAU_GEM_DOMAIN_GART; -+ if (!info->domain) { -+ info->domain |= (NOUVEAU_GEM_DOMAIN_VRAM | -+ NOUVEAU_GEM_DOMAIN_GART); -+ } -+ -+ if (nvbo->flags & NOUVEAU_BO_MAP) -+ info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE; -+ -+ info->tile_mode = nvbo->base.tile_mode; -+ info->tile_flags = nvbo->base.tile_flags; -+ /* XXX - flag inverted for backwards compatibility */ -+ info->tile_flags ^= NOUVEAU_GEM_TILE_NONCONTIG; -+ if (!nvdev->has_bo_usage) -+ info->tile_flags &= NOUVEAU_GEM_TILE_LAYOUT_MASK; -+ -+ ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_NEW, -+ &req, sizeof(req)); -+ if (ret) -+ return ret; -+ -+ nouveau_bo_info(nvbo, &req.info); -+ return 0; -+} -+ -+static int -+nouveau_bo_kmap(struct nouveau_bo_priv *nvbo) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device); -+ -+ if (nvbo->map) -+ return 0; -+ -+ if (!nvbo->map_handle) -+ return -EINVAL; -+ -+ nvbo->map = mmap(0, nvbo->size, PROT_READ | PROT_WRITE, -+ MAP_SHARED, nvdev->fd, nvbo->map_handle); -+ if (nvbo->map == MAP_FAILED) { -+ nvbo->map = NULL; -+ return -errno; -+ } -+ -+ return 0; -+} -+ -+int -+nouveau_bo_new_tile(struct nouveau_device *dev, uint32_t flags, int align, -+ int size, uint32_t tile_mode, uint32_t tile_flags, -+ struct nouveau_bo **bo) -+{ -+ struct nouveau_bo_priv *nvbo; -+ int ret; -+ -+ if (!dev || !bo || *bo) -+ return -EINVAL; -+ -+ nvbo = calloc(1, sizeof(struct nouveau_bo_priv)); -+ if (!nvbo) -+ return -ENOMEM; -+ nvbo->base.device = dev; -+ nvbo->base.size = size; -+ nvbo->base.tile_mode = tile_mode; -+ nvbo->base.tile_flags = tile_flags; -+ -+ nvbo->refcount = 1; -+ nvbo->flags = flags; -+ nvbo->size = size; -+ nvbo->align = align; -+ -+ if (flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) { -+ ret = nouveau_bo_kalloc(nvbo, NULL); -+ if (ret) { -+ nouveau_bo_ref(NULL, (void *)&nvbo); -+ return ret; -+ } -+ } -+ -+ *bo = &nvbo->base; -+ return 0; -+} -+ -+int -+nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, int align, -+ int size, struct nouveau_bo **bo) -+{ -+ return nouveau_bo_new_tile(dev, flags, align, size, 0, 0, bo); -+} -+ -+int -+nouveau_bo_user(struct nouveau_device *dev, void *ptr, int size, -+ struct nouveau_bo **bo) -+{ -+ struct nouveau_bo_priv *nvbo; -+ int ret; -+ -+ ret = nouveau_bo_new(dev, NOUVEAU_BO_MAP, 0, size, bo); -+ if (ret) -+ return ret; -+ nvbo = nouveau_bo(*bo); -+ -+ nvbo->sysmem = ptr; -+ nvbo->user = 1; -+ return 0; -+} -+ -+int -+nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle, -+ struct nouveau_bo **bo) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(dev); -+ struct drm_nouveau_gem_info req; -+ struct nouveau_bo_priv *nvbo; -+ int ret; -+ -+ ret = nouveau_bo_new(dev, 0, 0, 0, bo); -+ if (ret) -+ return ret; -+ nvbo = nouveau_bo(*bo); -+ -+ req.handle = handle; -+ ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_INFO, -+ &req, sizeof(req)); -+ if (ret) { -+ nouveau_bo_ref(NULL, bo); -+ return ret; -+ } -+ -+ nouveau_bo_info(nvbo, &req); -+ nvbo->base.size = nvbo->size; -+ return 0; -+} -+ -+int -+nouveau_bo_handle_get(struct nouveau_bo *bo, uint32_t *handle) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(bo->device); -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ int ret; -+ -+ if (!bo || !handle) -+ return -EINVAL; -+ -+ if (!nvbo->global_handle) { -+ struct drm_gem_flink req; -+ -+ ret = nouveau_bo_kalloc(nvbo, NULL); -+ if (ret) -+ return ret; -+ -+ req.handle = nvbo->handle; -+ ret = drmIoctl(nvdev->fd, DRM_IOCTL_GEM_FLINK, &req); -+ if (ret) { -+ nouveau_bo_kfree(nvbo); -+ return ret; -+ } -+ -+ nvbo->global_handle = req.name; -+ } -+ -+ *handle = nvbo->global_handle; -+ return 0; -+} -+ -+int -+nouveau_bo_handle_ref(struct nouveau_device *dev, uint32_t handle, -+ struct nouveau_bo **bo) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(dev); -+ struct nouveau_bo_priv *nvbo; -+ struct drm_gem_open req; -+ int ret; -+ -+ req.name = handle; -+ ret = drmIoctl(nvdev->fd, DRM_IOCTL_GEM_OPEN, &req); -+ if (ret) { -+ nouveau_bo_ref(NULL, bo); -+ return ret; -+ } -+ -+ ret = nouveau_bo_wrap(dev, req.handle, bo); -+ if (ret) { -+ nouveau_bo_ref(NULL, bo); -+ return ret; -+ } -+ -+ nvbo = nouveau_bo(*bo); -+ nvbo->base.handle = nvbo->handle; -+ return 0; -+} -+ -+static void -+nouveau_bo_del(struct nouveau_bo **bo) -+{ -+ struct nouveau_bo_priv *nvbo; -+ -+ if (!bo || !*bo) -+ return; -+ nvbo = nouveau_bo(*bo); -+ *bo = NULL; -+ -+ if (--nvbo->refcount) -+ return; -+ -+ if (nvbo->pending) { -+ nvbo->pending = NULL; -+ nouveau_pushbuf_flush(nvbo->pending_channel, 0); -+ } -+ -+ nouveau_bo_ufree(nvbo); -+ nouveau_bo_kfree(nvbo); -+ free(nvbo); -+} -+ -+int -+nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pbo) -+{ -+ if (!pbo) -+ return -EINVAL; -+ -+ if (ref) -+ nouveau_bo(ref)->refcount++; -+ -+ if (*pbo) -+ nouveau_bo_del(pbo); -+ -+ *pbo = ref; -+ return 0; -+} -+ -+static int -+nouveau_bo_wait(struct nouveau_bo *bo, int cpu_write, int no_wait, int no_block) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(bo->device); -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ struct drm_nouveau_gem_cpu_prep req; -+ int ret; -+ -+ if (!nvbo->global_handle && !nvbo->write_marker && !cpu_write) -+ return 0; -+ -+ if (nvbo->pending && -+ (nvbo->pending->write_domains || cpu_write)) { -+ nvbo->pending = NULL; -+ nouveau_pushbuf_flush(nvbo->pending_channel, 0); -+ } -+ -+ req.handle = nvbo->handle; -+ req.flags = 0; -+ if (cpu_write) -+ req.flags |= NOUVEAU_GEM_CPU_PREP_WRITE; -+ if (no_wait) -+ req.flags |= NOUVEAU_GEM_CPU_PREP_NOWAIT; -+ if (no_block) -+ req.flags |= NOUVEAU_GEM_CPU_PREP_NOBLOCK; -+ -+ do { -+ ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_PREP, -+ &req, sizeof(req)); -+ } while (ret == -EAGAIN); -+ if (ret) -+ return ret; -+ -+ if (ret == 0) -+ nvbo->write_marker = 0; -+ return 0; -+} -+ -+int -+nouveau_bo_map_range(struct nouveau_bo *bo, uint32_t delta, uint32_t size, -+ uint32_t flags) -+{ -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ int ret; -+ -+ if (!nvbo || bo->map) -+ return -EINVAL; -+ -+ if (!nouveau_bo_allocated(nvbo)) { -+ if (nvbo->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) { -+ ret = nouveau_bo_kalloc(nvbo, NULL); -+ if (ret) -+ return ret; -+ } -+ -+ if (!nouveau_bo_allocated(nvbo)) { -+ ret = nouveau_bo_ualloc(nvbo); -+ if (ret) -+ return ret; -+ } -+ } -+ -+ if (nvbo->sysmem) { -+ bo->map = (char *)nvbo->sysmem + delta; -+ } else { -+ ret = nouveau_bo_kmap(nvbo); -+ if (ret) -+ return ret; -+ -+ if (!(flags & NOUVEAU_BO_NOSYNC)) { -+ ret = nouveau_bo_wait(bo, (flags & NOUVEAU_BO_WR), -+ (flags & NOUVEAU_BO_NOWAIT), 0); -+ if (ret) -+ return ret; -+ -+ nvbo->map_refcnt++; -+ } -+ -+ bo->map = (char *)nvbo->map + delta; -+ } -+ -+ return 0; -+} -+ -+void -+nouveau_bo_map_flush(struct nouveau_bo *bo, uint32_t delta, uint32_t size) -+{ -+} -+ -+int -+nouveau_bo_map(struct nouveau_bo *bo, uint32_t flags) -+{ -+ return nouveau_bo_map_range(bo, 0, bo->size, flags); -+} -+ -+void -+nouveau_bo_unmap(struct nouveau_bo *bo) -+{ -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ -+ if (bo->map && !nvbo->sysmem && nvbo->map_refcnt) { -+ struct nouveau_device_priv *nvdev = nouveau_device(bo->device); -+ struct drm_nouveau_gem_cpu_fini req; -+ -+ req.handle = nvbo->handle; -+ drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_FINI, -+ &req, sizeof(req)); -+ nvbo->map_refcnt--; -+ } -+ -+ bo->map = NULL; -+} -+ -+int -+nouveau_bo_busy(struct nouveau_bo *bo, uint32_t access) -+{ -+ return nouveau_bo_wait(bo, (access & NOUVEAU_BO_WR), 1, 1); -+} -+ -+uint32_t -+nouveau_bo_pending(struct nouveau_bo *bo) -+{ -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ uint32_t flags; -+ -+ if (!nvbo->pending) -+ return 0; -+ -+ flags = 0; -+ if (nvbo->pending->read_domains) -+ flags |= NOUVEAU_BO_RD; -+ if (nvbo->pending->write_domains) -+ flags |= NOUVEAU_BO_WR; -+ -+ return flags; -+} -+ -+struct drm_nouveau_gem_pushbuf_bo * -+nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo) -+{ -+ struct nouveau_pushbuf_priv *nvpb = &nouveau_channel(chan)->pb; -+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); -+ struct drm_nouveau_gem_pushbuf_bo *pbbo; -+ struct nouveau_bo *ref = NULL; -+ int ret; -+ -+ if (nvbo->pending) -+ return nvbo->pending; -+ -+ if (!nvbo->handle) { -+ ret = nouveau_bo_kalloc(nvbo, chan); -+ if (ret) -+ return NULL; -+ -+ if (nvbo->sysmem) { -+ void *sysmem_tmp = nvbo->sysmem; -+ -+ nvbo->sysmem = NULL; -+ ret = nouveau_bo_map(bo, NOUVEAU_BO_WR); -+ if (ret) -+ return NULL; -+ nvbo->sysmem = sysmem_tmp; -+ -+ memcpy(bo->map, nvbo->sysmem, nvbo->base.size); -+ nouveau_bo_ufree(nvbo); -+ nouveau_bo_unmap(bo); -+ } -+ } -+ -+ if (nvpb->nr_buffers >= NOUVEAU_GEM_MAX_BUFFERS) -+ return NULL; -+ pbbo = nvpb->buffers + nvpb->nr_buffers++; -+ nvbo->pending = pbbo; -+ nvbo->pending_channel = chan; -+ nvbo->pending_refcnt = 0; -+ -+ nouveau_bo_ref(bo, &ref); -+ pbbo->user_priv = (uint64_t)(unsigned long)ref; -+ pbbo->handle = nvbo->handle; -+ pbbo->valid_domains = NOUVEAU_GEM_DOMAIN_VRAM | NOUVEAU_GEM_DOMAIN_GART; -+ pbbo->read_domains = 0; -+ pbbo->write_domains = 0; -+ pbbo->presumed.domain = nvbo->domain; -+ pbbo->presumed.offset = nvbo->offset; -+ pbbo->presumed.valid = 1; -+ return pbbo; -+} -diff --git a/nouveau-1/nouveau_bo.h b/nouveau-1/nouveau_bo.h -new file mode 100644 -index 0000000..3a1f2d4 ---- /dev/null -+++ b/nouveau-1/nouveau_bo.h -@@ -0,0 +1,104 @@ -+/* -+ * 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_BO_H__ -+#define __NOUVEAU_BO_H__ -+ -+/* Relocation/Buffer type flags */ -+#define NOUVEAU_BO_VRAM (1 << 0) -+#define NOUVEAU_BO_GART (1 << 1) -+#define NOUVEAU_BO_RD (1 << 2) -+#define NOUVEAU_BO_WR (1 << 3) -+#define NOUVEAU_BO_RDWR (NOUVEAU_BO_RD | NOUVEAU_BO_WR) -+#define NOUVEAU_BO_MAP (1 << 4) -+#define NOUVEAU_BO_LOW (1 << 6) -+#define NOUVEAU_BO_HIGH (1 << 7) -+#define NOUVEAU_BO_OR (1 << 8) -+#define NOUVEAU_BO_INVAL (1 << 12) -+#define NOUVEAU_BO_NOSYNC (1 << 13) -+#define NOUVEAU_BO_NOWAIT (1 << 14) -+#define NOUVEAU_BO_IFLUSH (1 << 15) -+#define NOUVEAU_BO_DUMMY (1 << 31) -+ -+#define NOUVEAU_BO_TILE_LAYOUT_MASK 0x0000ff00 -+#define NOUVEAU_BO_TILE_16BPP 0x00000001 -+#define NOUVEAU_BO_TILE_32BPP 0x00000002 -+#define NOUVEAU_BO_TILE_ZETA 0x00000004 -+#define NOUVEAU_BO_TILE_SCANOUT 0x00000008 -+ -+struct nouveau_bo { -+ struct nouveau_device *device; -+ uint32_t handle; -+ -+ uint64_t size; -+ void *map; -+ -+ uint32_t tile_mode; -+ uint32_t tile_flags; -+}; -+ -+int -+nouveau_bo_new(struct nouveau_device *, uint32_t flags, int align, int size, -+ struct nouveau_bo **); -+ -+int -+nouveau_bo_new_tile(struct nouveau_device *, uint32_t flags, int align, -+ int size, uint32_t tile_mode, uint32_t tile_flags, -+ struct nouveau_bo **); -+ -+int -+nouveau_bo_user(struct nouveau_device *, void *ptr, int size, -+ struct nouveau_bo **); -+ -+int -+nouveau_bo_wrap(struct nouveau_device *, uint32_t handle, struct nouveau_bo **); -+ -+int -+nouveau_bo_handle_get(struct nouveau_bo *, uint32_t *); -+ -+int -+nouveau_bo_handle_ref(struct nouveau_device *, uint32_t handle, -+ struct nouveau_bo **); -+ -+int -+nouveau_bo_ref(struct nouveau_bo *, struct nouveau_bo **); -+ -+int -+nouveau_bo_map_range(struct nouveau_bo *, uint32_t delta, uint32_t size, -+ uint32_t flags); -+ -+void -+nouveau_bo_map_flush(struct nouveau_bo *, uint32_t delta, uint32_t size); -+ -+int -+nouveau_bo_map(struct nouveau_bo *, uint32_t flags); -+ -+void -+nouveau_bo_unmap(struct nouveau_bo *); -+ -+int -+nouveau_bo_busy(struct nouveau_bo *, uint32_t access); -+ -+uint32_t -+nouveau_bo_pending(struct nouveau_bo *); -+ -+#endif -diff --git a/nouveau-1/nouveau_channel.c b/nouveau-1/nouveau_channel.c -new file mode 100644 -index 0000000..96fa03b ---- /dev/null -+++ b/nouveau-1/nouveau_channel.c -@@ -0,0 +1,142 @@ -+/* -+ * 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. -+ */ -+ -+#include <stdlib.h> -+#include <string.h> -+#include <errno.h> -+ -+#include "nouveau_private.h" -+ -+int -+nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma, -+ uint32_t tt_ctxdma, int pushbuf_size, -+ struct nouveau_channel **chan) -+{ -+ struct nouveau_device_priv *nvdev = nouveau_device(dev); -+ struct nouveau_channel_priv *nvchan; -+ unsigned i; -+ int ret; -+ -+ if (!nvdev || !chan || *chan) -+ return -EINVAL; -+ -+ nvchan = calloc(1, sizeof(struct nouveau_channel_priv)); -+ if (!nvchan) -+ return -ENOMEM; -+ nvchan->base.device = dev; -+ -+ nvchan->drm.fb_ctxdma_handle = fb_ctxdma; -+ nvchan->drm.tt_ctxdma_handle = tt_ctxdma; -+ ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, -+ &nvchan->drm, sizeof(nvchan->drm)); -+ if (ret) { -+ free(nvchan); -+ return ret; -+ } -+ -+ nvchan->base.id = nvchan->drm.channel; -+ if (nouveau_grobj_ref(&nvchan->base, nvchan->drm.fb_ctxdma_handle, -+ &nvchan->base.vram) || -+ nouveau_grobj_ref(&nvchan->base, nvchan->drm.tt_ctxdma_handle, -+ &nvchan->base.gart)) { -+ nouveau_channel_free((void *)&nvchan); -+ return -EINVAL; -+ } -+ -+ /* Mark all DRM-assigned subchannels as in-use */ -+ for (i = 0; i < nvchan->drm.nr_subchan; i++) { -+ struct nouveau_grobj_priv *gr = calloc(1, sizeof(*gr)); -+ -+ gr->base.bound = NOUVEAU_GROBJ_BOUND_EXPLICIT; -+ gr->base.subc = i; -+ gr->base.handle = nvchan->drm.subchan[i].handle; -+ gr->base.grclass = nvchan->drm.subchan[i].grclass; -+ gr->base.channel = &nvchan->base; -+ -+ nvchan->base.subc[i].gr = &gr->base; -+ } -+ -+ if (dev->chipset < 0xc0) { -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

