From 659c3180a259449634c1169b0fa31e320e65b3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 24 Feb 2009 16:37:29 +0000 Subject: [PATCH] - Update to 2.4.5, drop nouveau and intel patches, rebase radeon. --- .cvsignore | 2 +- libdrm-intel.patch | 541 ---------------------------------- libdrm-radeon.patch | 12 +- libdrm.spec | 19 +- nouveau-missing-headers.patch | 375 +++++++++++++++++++++++ sources | 2 +- 6 files changed, 392 insertions(+), 559 deletions(-) delete mode 100644 libdrm-intel.patch create mode 100644 nouveau-missing-headers.patch diff --git a/.cvsignore b/.cvsignore index 098b52e..90bcf47 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -libdrm-2.4.4.tar.bz2 +libdrm-2.4.5.tar.bz2 diff --git a/libdrm-intel.patch b/libdrm-intel.patch deleted file mode 100644 index 7186b9d..0000000 --- a/libdrm-intel.patch +++ /dev/null @@ -1,541 +0,0 @@ -diff --git a/libdrm/intel/Makefile.am b/libdrm/intel/Makefile.am -index 5e3dee0..c7526f6 100644 ---- a/libdrm/intel/Makefile.am -+++ b/libdrm/intel/Makefile.am -@@ -39,6 +39,7 @@ libdrm_intel_la_SOURCES = \ - intel_bufmgr_priv.h \ - intel_bufmgr_fake.c \ - intel_bufmgr_gem.c \ -+ intel_chipset.h \ - mm.c \ - mm.h - -diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c -index 188eac2..25a6828 100644 ---- a/libdrm/intel/intel_bufmgr.c -+++ b/libdrm/intel/intel_bufmgr.c -@@ -51,6 +51,13 @@ drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, - return bufmgr->bo_alloc(bufmgr, name, size, alignment); - } - -+drm_intel_bo * -+drm_intel_bo_alloc_for_render(drm_intel_bufmgr *bufmgr, const char *name, -+ unsigned long size, unsigned int alignment) -+{ -+ return bufmgr->bo_alloc_for_render(bufmgr, name, size, alignment); -+} -+ - void - drm_intel_bo_reference(drm_intel_bo *bo) - { -diff --git a/libdrm/intel/intel_bufmgr.h b/libdrm/intel/intel_bufmgr.h -index e8c2e06..111d2af 100644 ---- a/libdrm/intel/intel_bufmgr.h -+++ b/libdrm/intel/intel_bufmgr.h -@@ -75,6 +75,10 @@ struct _drm_intel_bo { - - drm_intel_bo *drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, - unsigned long size, unsigned int alignment); -+drm_intel_bo *drm_intel_bo_alloc_for_render(drm_intel_bufmgr *bufmgr, -+ const char *name, -+ unsigned long size, -+ unsigned int alignment); - void drm_intel_bo_reference(drm_intel_bo *bo); - void drm_intel_bo_unreference(drm_intel_bo *bo); - int drm_intel_bo_map(drm_intel_bo *bo, int write_enable); -diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c -index 6c21625..e7cec35 100644 ---- a/libdrm/intel/intel_bufmgr_fake.c -+++ b/libdrm/intel/intel_bufmgr_fake.c -@@ -1503,6 +1503,7 @@ drm_intel_bufmgr_fake_init(int fd, - - /* Hook in methods */ - bufmgr_fake->bufmgr.bo_alloc = drm_intel_fake_bo_alloc; -+ bufmgr_fake->bufmgr.bo_alloc_for_render = drm_intel_fake_bo_alloc; - bufmgr_fake->bufmgr.bo_reference = drm_intel_fake_bo_reference; - bufmgr_fake->bufmgr.bo_unreference = drm_intel_fake_bo_unreference; - bufmgr_fake->bufmgr.bo_map = drm_intel_fake_bo_map; -diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c -index 7b821de..6ddecf4 100644 ---- a/libdrm/intel/intel_bufmgr_gem.c -+++ b/libdrm/intel/intel_bufmgr_gem.c -@@ -52,8 +52,10 @@ - #include - - #include "errno.h" -+#include "libdrm_lists.h" - #include "intel_bufmgr.h" - #include "intel_bufmgr_priv.h" -+#include "intel_chipset.h" - #include "string.h" - - #include "i915_drm.h" -@@ -66,7 +68,8 @@ - typedef struct _drm_intel_bo_gem drm_intel_bo_gem; - - struct drm_intel_gem_bo_bucket { -- drm_intel_bo_gem *head, **tail; -+ drmMMListHead head; -+ - /** - * Limit on the number of entries in this bucket. - * -@@ -99,6 +102,8 @@ typedef struct _drm_intel_bufmgr_gem { - struct drm_intel_gem_bo_bucket cache_bucket[DRM_INTEL_GEM_BO_BUCKETS]; - - uint64_t gtt_size; -+ int available_fences; -+ int pci_device; - } drm_intel_bufmgr_gem; - - struct _drm_intel_bo_gem { -@@ -142,8 +147,8 @@ struct _drm_intel_bo_gem { - /** Mapped address for the buffer, saved across map/unmap cycles */ - void *virtual; - -- /** free list */ -- drm_intel_bo_gem *next; -+ /** BO cache list */ -+ drmMMListHead head; - - /** - * Boolean of whether this BO and its children have been included in -@@ -165,6 +170,11 @@ struct _drm_intel_bo_gem { - * the common case. - */ - int reloc_tree_size; -+ /** -+ * Number of potential fence registers required by this buffer and its -+ * relocations. -+ */ -+ int reloc_tree_fences; - }; - - static void drm_intel_gem_bo_reference_locked(drm_intel_bo *bo); -@@ -315,8 +325,9 @@ drm_intel_setup_reloc_list(drm_intel_bo *bo) - } - - static drm_intel_bo * --drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, -- unsigned long size, unsigned int alignment) -+drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, const char *name, -+ unsigned long size, unsigned int alignment, -+ int for_render) - { - drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr; - drm_intel_bo_gem *bo_gem; -@@ -345,18 +356,35 @@ drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, - /* Get a buffer out of the cache if available */ - if (bucket != NULL && bucket->num_entries > 0) { - struct drm_i915_gem_busy busy; -- -- bo_gem = bucket->head; -- busy.handle = bo_gem->gem_handle; -- -- ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_BUSY, &busy); -- alloc_from_cache = (ret == 0 && busy.busy == 0); - -- if (alloc_from_cache) { -- bucket->head = bo_gem->next; -- if (bo_gem->next == NULL) -- bucket->tail = &bucket->head; -+ if (for_render) { -+ /* Allocate new render-target BOs from the tail (MRU) -+ * of the list, as it will likely be hot in the GPU cache -+ * and in the aperture for us. -+ */ -+ bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.prev, head); -+ DRMLISTDEL(&bo_gem->head); - bucket->num_entries--; -+ alloc_from_cache = 1; -+ } else { -+ /* For non-render-target BOs (where we're probably going to map it -+ * first thing in order to fill it with data), check if the -+ * last BO in the cache is unbusy, and only reuse in that case. -+ * Otherwise, allocating a new buffer is probably faster than -+ * waiting for the GPU to finish. -+ */ -+ bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.next, head); -+ -+ memset(&busy, 0, sizeof(busy)); -+ busy.handle = bo_gem->gem_handle; -+ -+ ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_BUSY, &busy); -+ alloc_from_cache = (ret == 0 && busy.busy == 0); -+ -+ if (alloc_from_cache) { -+ DRMLISTDEL(&bo_gem->head); -+ bucket->num_entries--; -+ } - } - } - pthread_mutex_unlock(&bufmgr_gem->lock); -@@ -386,6 +414,7 @@ drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, - bo_gem->refcount = 1; - bo_gem->validate_index = -1; - bo_gem->reloc_tree_size = bo_gem->bo.size; -+ bo_gem->reloc_tree_fences = 0; - bo_gem->used_as_reloc_target = 0; - bo_gem->tiling_mode = I915_TILING_NONE; - bo_gem->swizzle_mode = I915_BIT_6_SWIZZLE_NONE; -@@ -396,6 +425,20 @@ drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, - return &bo_gem->bo; - } - -+static drm_intel_bo * -+drm_intel_gem_bo_alloc_for_render(drm_intel_bufmgr *bufmgr, const char *name, -+ unsigned long size, unsigned int alignment) -+{ -+ return drm_intel_gem_bo_alloc_internal(bufmgr, name, size, alignment, 1); -+} -+ -+static drm_intel_bo * -+drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name, -+ unsigned long size, unsigned int alignment) -+{ -+ return drm_intel_gem_bo_alloc_internal(bufmgr, name, size, alignment, 0); -+} -+ - /** - * Returns a drm_intel_bo wrapping the given buffer object handle. - * -@@ -435,6 +478,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, const char *name, - bo_gem->gem_handle = open_arg.handle; - bo_gem->global_name = handle; - -+ memset(&get_tiling, 0, sizeof(get_tiling)); - get_tiling.handle = bo_gem->gem_handle; - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling); - if (ret != 0) { -@@ -443,6 +487,10 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, const char *name, - } - bo_gem->tiling_mode = get_tiling.tiling_mode; - bo_gem->swizzle_mode = get_tiling.swizzle_mode; -+ if (bo_gem->tiling_mode == I915_TILING_NONE) -+ bo_gem->reloc_tree_fences = 0; -+ else -+ bo_gem->reloc_tree_fences = 1; - - DBG("bo_create_from_handle: %d (%s)\n", handle, bo_gem->name); - -@@ -480,6 +528,7 @@ drm_intel_gem_bo_free(drm_intel_bo *bo) - munmap (bo_gem->virtual, bo_gem->bo.size); - - /* Close this object */ -+ memset(&close, 0, sizeof(close)); - close.handle = bo_gem->gem_handle; - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_CLOSE, &close); - if (ret != 0) { -@@ -529,9 +578,7 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo) - bo_gem->reloc_target_bo = NULL; - bo_gem->reloc_count = 0; - -- bo_gem->next = NULL; -- *bucket->tail = bo_gem; -- bucket->tail = &bo_gem->next; -+ DRMLISTADDTAIL(&bo_gem->head, &bucket->head); - bucket->num_entries++; - } else { - drm_intel_gem_bo_free(bo); -@@ -811,10 +858,9 @@ drm_intel_bufmgr_gem_destroy(drm_intel_bufmgr *bufmgr) - struct drm_intel_gem_bo_bucket *bucket = &bufmgr_gem->cache_bucket[i]; - drm_intel_bo_gem *bo_gem; - -- while ((bo_gem = bucket->head) != NULL) { -- bucket->head = bo_gem->next; -- if (bo_gem->next == NULL) -- bucket->tail = &bucket->head; -+ while (!DRMLISTEMPTY(&bucket->head)) { -+ bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.next, head); -+ DRMLISTDEL(&bo_gem->head); - bucket->num_entries--; - - drm_intel_gem_bo_free(&bo_gem->bo); -@@ -860,6 +906,7 @@ drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, - */ - assert(!bo_gem->used_as_reloc_target); - bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size; -+ bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences; - - /* Flag the target to disallow further relocations in it. */ - target_bo_gem->used_as_reloc_target = 1; -@@ -996,6 +1043,7 @@ drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment) - struct drm_i915_gem_pin pin; - int ret; - -+ memset(&pin, 0, sizeof(pin)); - pin.handle = bo_gem->gem_handle; - pin.alignment = alignment; - -@@ -1018,6 +1066,7 @@ drm_intel_gem_bo_unpin(drm_intel_bo *bo) - struct drm_i915_gem_unpin unpin; - int ret; - -+ memset(&unpin, 0, sizeof(unpin)); - unpin.handle = bo_gem->gem_handle; - - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_UNPIN, &unpin); -@@ -1039,6 +1088,11 @@ drm_intel_gem_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode, - if (bo_gem->global_name == 0 && *tiling_mode == bo_gem->tiling_mode) - return 0; - -+ /* If we're going from non-tiling to tiling, bump fence count */ -+ if (bo_gem->tiling_mode == I915_TILING_NONE) -+ bo_gem->reloc_tree_fences++; -+ -+ memset(&set_tiling, 0, sizeof(set_tiling)); - set_tiling.handle = bo_gem->gem_handle; - set_tiling.tiling_mode = *tiling_mode; - set_tiling.stride = stride; -@@ -1051,6 +1105,10 @@ drm_intel_gem_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode, - bo_gem->tiling_mode = set_tiling.tiling_mode; - bo_gem->swizzle_mode = set_tiling.swizzle_mode; - -+ /* If we're going from tiling to non-tiling, drop fence count */ -+ if (bo_gem->tiling_mode == I915_TILING_NONE) -+ bo_gem->reloc_tree_fences--; -+ - *tiling_mode = bo_gem->tiling_mode; - return 0; - } -@@ -1075,6 +1133,7 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t *name) - int ret; - - if (!bo_gem->global_name) { -+ memset(&flink, 0, sizeof(flink)); - flink.handle = bo_gem->gem_handle; - - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_FLINK, &flink); -@@ -1129,6 +1188,31 @@ drm_intel_gem_bo_get_aperture_space(drm_intel_bo *bo) - } - - /** -+ * Count the number of buffers in this list that need a fence reg -+ * -+ * If the count is greater than the number of available regs, we'll have -+ * to ask the caller to resubmit a batch with fewer tiled buffers. -+ * -+ * This function over-counts if the same buffer is used multiple times. -+ */ -+static unsigned int -+drm_intel_gem_total_fences(drm_intel_bo **bo_array, int count) -+{ -+ int i; -+ unsigned int total = 0; -+ -+ for (i = 0; i < count; i++) { -+ drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo_array[i]; -+ -+ if (bo_gem == NULL) -+ continue; -+ -+ total += bo_gem->reloc_tree_fences; -+ } -+ return total; -+} -+ -+/** - * Clear the flag set by drm_intel_gem_bo_get_aperture_space() so we're ready - * for the next drm_intel_bufmgr_check_aperture_space() call. - */ -@@ -1206,9 +1290,17 @@ drm_intel_gem_check_aperture_space(drm_intel_bo **bo_array, int count) - drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo_array[0]->bufmgr; - unsigned int total = 0; - unsigned int threshold = bufmgr_gem->gtt_size * 3 / 4; -+ int total_fences; -+ -+ /* Check for fence reg constraints if necessary */ -+ if (bufmgr_gem->available_fences) { -+ total_fences = drm_intel_gem_total_fences(bo_array, count); -+ if (total_fences > bufmgr_gem->available_fences) -+ return -1; -+ } - - total = drm_intel_gem_estimate_batch_space(bo_array, count); -- -+ - if (total > threshold) - total = drm_intel_gem_compute_batch_space(bo_array, count); - -@@ -1234,6 +1326,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) - { - drm_intel_bufmgr_gem *bufmgr_gem; - struct drm_i915_gem_get_aperture aperture; -+ drm_i915_getparam_t gp; - int ret, i; - - bufmgr_gem = calloc(1, sizeof(*bufmgr_gem)); -@@ -1257,6 +1350,25 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) - (int)bufmgr_gem->gtt_size / 1024); - } - -+ gp.param = I915_PARAM_CHIPSET_ID; -+ gp.value = &bufmgr_gem->pci_device; -+ ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); -+ if (ret) { -+ fprintf(stderr, "get chip id failed: %d\n", ret); -+ fprintf(stderr, "param: %d, val: %d\n", gp.param, *gp.value); -+ } -+ -+ if (!IS_I965G(bufmgr_gem)) { -+ gp.param = I915_PARAM_NUM_FENCES_AVAIL; -+ gp.value = &bufmgr_gem->available_fences; -+ ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); -+ if (ret) { -+ fprintf(stderr, "get fences failed: %d\n", ret); -+ fprintf(stderr, "param: %d, val: %d\n", gp.param, *gp.value); -+ bufmgr_gem->available_fences = 0; -+ } -+ } -+ - /* Let's go with one relocation per every 2 dwords (but round down a bit - * since a power of two will mean an extra page allocation for the reloc - * buffer). -@@ -1266,6 +1378,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) - bufmgr_gem->max_relocs = batch_size / sizeof(uint32_t) / 2 - 2; - - bufmgr_gem->bufmgr.bo_alloc = drm_intel_gem_bo_alloc; -+ bufmgr_gem->bufmgr.bo_alloc_for_render = drm_intel_gem_bo_alloc_for_render; - bufmgr_gem->bufmgr.bo_reference = drm_intel_gem_bo_reference; - bufmgr_gem->bufmgr.bo_unreference = drm_intel_gem_bo_unreference; - bufmgr_gem->bufmgr.bo_map = drm_intel_gem_bo_map; -@@ -1285,7 +1398,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) - bufmgr_gem->bufmgr.check_aperture_space = drm_intel_gem_check_aperture_space; - /* Initialize the linked lists for BO reuse cache. */ - for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++) -- bufmgr_gem->cache_bucket[i].tail = &bufmgr_gem->cache_bucket[i].head; -+ DRMINITLISTHEAD(&bufmgr_gem->cache_bucket[i].head); - - return &bufmgr_gem->bufmgr; - } -diff --git a/libdrm/intel/intel_bufmgr_priv.h b/libdrm/intel/intel_bufmgr_priv.h -index 76d31e4..82d87b4 100644 ---- a/libdrm/intel/intel_bufmgr_priv.h -+++ b/libdrm/intel/intel_bufmgr_priv.h -@@ -51,6 +51,16 @@ struct _drm_intel_bufmgr { - drm_intel_bo *(*bo_alloc)(drm_intel_bufmgr *bufmgr, const char *name, - unsigned long size, unsigned int alignment); - -+ /** -+ * Allocate a buffer object, hinting that it will be used as a render target. -+ * -+ * This is otherwise the same as bo_alloc. -+ */ -+ drm_intel_bo *(*bo_alloc_for_render)(drm_intel_bufmgr *bufmgr, -+ const char *name, -+ unsigned long size, -+ unsigned int alignment); -+ - /** Takes a reference on a buffer object */ - void (*bo_reference)(drm_intel_bo *bo); - -diff --git a/libdrm/intel/intel_chipset.h b/libdrm/intel/intel_chipset.h -new file mode 100644 -index 0000000..0b3af02 ---- /dev/null -+++ b/libdrm/intel/intel_chipset.h -@@ -0,0 +1,71 @@ -+/* -+ * -+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. -+ * 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 TUNGSTEN GRAPHICS 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. -+ * -+ */ -+ -+#ifndef _INTEL_CHIPSET_H -+#define _INTEL_CHIPSET_H -+ -+#define IS_I830(dev) ((dev)->pci_device == 0x3577) -+#define IS_845G(dev) ((dev)->pci_device == 0x2562) -+#define IS_I85X(dev) ((dev)->pci_device == 0x3582) -+#define IS_I855(dev) ((dev)->pci_device == 0x3582) -+#define IS_I865G(dev) ((dev)->pci_device == 0x2572) -+ -+#define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a) -+#define IS_I915GM(dev) ((dev)->pci_device == 0x2592) -+#define IS_I945G(dev) ((dev)->pci_device == 0x2772) -+#define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\ -+ (dev)->pci_device == 0x27AE) -+#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \ -+ (dev)->pci_device == 0x2982 || \ -+ (dev)->pci_device == 0x2992 || \ -+ (dev)->pci_device == 0x29A2 || \ -+ (dev)->pci_device == 0x2A02 || \ -+ (dev)->pci_device == 0x2A12 || \ -+ (dev)->pci_device == 0x2A42 || \ -+ (dev)->pci_device == 0x2E02 || \ -+ (dev)->pci_device == 0x2E12 || \ -+ (dev)->pci_device == 0x2E22) -+ -+#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02) -+ -+#define IS_GM45(dev) ((dev)->pci_device == 0x2A42) -+ -+#define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ -+ (dev)->pci_device == 0x2E12 || \ -+ (dev)->pci_device == 0x2E22) -+ -+#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ -+ (dev)->pci_device == 0x29B2 || \ -+ (dev)->pci_device == 0x29D2) -+ -+#define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \ -+ IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev)) -+ -+#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ -+ IS_I945GM(dev) || IS_I965GM(dev) || IS_GM45(dev)) -+ -+#endif /* _INTEL_CHIPSET_H */ -diff --git a/libdrm/libdrm_lists.h b/libdrm/libdrm_lists.h -index 8e23991..6410f57 100644 ---- a/libdrm/libdrm_lists.h -+++ b/libdrm/libdrm_lists.h -@@ -29,6 +29,8 @@ - * list handling. No list looping yet. - */ - -+#include -+ - typedef struct _drmMMListHead - { - struct _drmMMListHead *prev; -diff --git a/shared-core/i915_drm.h b/shared-core/i915_drm.h -index 04ab4cf..5456e91 100644 ---- a/shared-core/i915_drm.h -+++ b/shared-core/i915_drm.h -@@ -296,6 +296,7 @@ typedef struct drm_i915_irq_wait { - #define I915_PARAM_LAST_DISPATCH 3 - #define I915_PARAM_CHIPSET_ID 4 - #define I915_PARAM_HAS_GEM 5 -+#define I915_PARAM_NUM_FENCES_AVAIL 6 - - typedef struct drm_i915_getparam { - int param; -@@ -307,6 +308,7 @@ typedef struct drm_i915_getparam { - #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 - #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 - #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 -+#define I915_SETPARAM_NUM_USED_FENCES 4 - - typedef struct drm_i915_setparam { - int param; diff --git a/libdrm-radeon.patch b/libdrm-radeon.patch index 2f3277f..682c872 100644 --- a/libdrm-radeon.patch +++ b/libdrm-radeon.patch @@ -7,18 +7,18 @@ diff -up libdrm-2.4.4/configure.ac.radeon libdrm-2.4.4/configure.ac libdrm/intel/Makefile + libdrm/radeon/Makefile + libdrm/radeon/libdrm_radeon.pc + libdrm/nouveau/Makefile + libdrm/nouveau/libdrm_nouveau.pc shared-core/Makefile - tests/Makefile - tests/modeprint/Makefile diff -up libdrm-2.4.4/libdrm/Makefile.am.radeon libdrm-2.4.4/libdrm/Makefile.am --- libdrm-2.4.4/libdrm/Makefile.am.radeon 2009-01-10 11:08:29.000000000 +1000 +++ libdrm-2.4.4/libdrm/Makefile.am 2009-02-18 09:27:49.000000000 +1000 @@ -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. + NOUVEAU_SUBDIR = nouveau + endif --SUBDIRS = . intel -+SUBDIRS = . intel radeon +-SUBDIRS = . intel $(NOUVEAU_SUBDIR) ++SUBDIRS = . intel radeon $(NOUVEAU_SUBDIR) libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir) diff --git a/libdrm.spec b/libdrm.spec index 80f2816..d43ce09 100644 --- a/libdrm.spec +++ b/libdrm.spec @@ -2,8 +2,8 @@ Summary: Direct Rendering Manager runtime library Name: libdrm -Version: 2.4.4 -Release: 9%{?dist} +Version: 2.4.5 +Release: 0%{?dist} License: MIT Group: System Environment/Libraries URL: http://dri.sourceforge.net @@ -15,9 +15,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: udev BuildRequires: pkgconfig automake autoconf libtool - BuildRequires: kernel-headers >= 2.6.29-0.145.rc6.fc11 - BuildRequires: libxcb-devel Source2: 91-drm-modeset.rules @@ -28,10 +26,8 @@ Patch3: libdrm-make-dri-perms-okay.patch Patch4: libdrm-2.4.0-no-bc.patch # radeon libdrm patches from modesetting-gem branch of upstream Patch8: libdrm-radeon.patch -# nouveau libdrm patches -Patch9: libdrm-nouveau.patch -# Add this while waiting for 2.4.5 -Patch10: libdrm-intel.patch +# 2.4.5 didn't dist nouveau_private.h and nouveau_dma.h, so add them like this +Patch9: nouveau-missing-headers.patch %description Direct Rendering Manager runtime library @@ -52,11 +48,10 @@ Direct Rendering Manager development package %patch4 -p1 -b .no-bc %patch8 -p1 -b .radeon %patch9 -p1 -b .nouveau -%patch10 -p1 -b .intel %build autoreconf -v --install || exit 1 -%configure --enable-udev +%configure --enable-udev --enable-nouveau-experimental-api make %{?_smp_mflags} %install @@ -107,10 +102,14 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libdrm_radeon.so %{_libdir}/libdrm_nouveau.so %{_libdir}/pkgconfig/libdrm.pc +%{_libdir}/pkgconfig/libdrm_intel.pc %{_libdir}/pkgconfig/libdrm_radeon.pc %{_libdir}/pkgconfig/libdrm_nouveau.pc %changelog +* Tue Feb 24 2009 Kristian Høgsberg - 2.4.5-0 +- Update to 2.4.5, drop nouveau and intel patches, rebase radeon. + * Mon Feb 23 2009 Kristian Høgsberg - 2.4.4-9 - Pull in intel bufmgr changes while waiting for 2.4.5. diff --git a/nouveau-missing-headers.patch b/nouveau-missing-headers.patch new file mode 100644 index 0000000..3c5d477 --- /dev/null +++ b/nouveau-missing-headers.patch @@ -0,0 +1,375 @@ +commit 407f4d42729488df4722012fcbbff2555a72f033 +Author: Kristian Høgsberg +Date: Tue Feb 24 11:34:10 2009 -0500 + + Add nouveau_private.h and nouveau_dma.h missing from 2.4.5. + +diff --git b/libdrm/nouveau/nouveau_dma.h a/libdrm/nouveau/nouveau_dma.h +new file mode 100644 +index 0000000..38fe1d6 +--- /dev/null ++++ a/libdrm/nouveau/nouveau_dma.h +@@ -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 --git b/libdrm/nouveau/nouveau_private.h a/libdrm/nouveau/nouveau_private.h +new file mode 100644 +index 0000000..9dc1b44 +--- /dev/null ++++ a/libdrm/nouveau/nouveau_private.h +@@ -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; ++ unsigned 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 --git a/sources b/sources index eacf48b..bb03187 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c183ee614b25f61ea325d57882a2fab2 libdrm-2.4.4.tar.bz2 +0d09025f069ff1a986cf3339e51908b3 libdrm-2.4.5.tar.bz2