Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm sync viadrm with FreeBSD, big new featu...
details: https://anonhg.NetBSD.org/src/rev/71ccd3d37ae0
branches: trunk
changeset: 762263:71ccd3d37ae0
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Feb 18 14:26:09 2011 +0000
description:
sync viadrm with FreeBSD, big new feature is AGP DMA and PCI DMA support
diffstat:
sys/external/bsd/drm/conf/files.drm | 6 +-
sys/external/bsd/drm/dist/bsd-core/drmP.h | 5 +
sys/external/bsd/drm/dist/bsd-core/drm_hashtab.c | 180 ++++
sys/external/bsd/drm/dist/bsd-core/drm_hashtab.h | 65 +
sys/external/bsd/drm/dist/bsd-core/drm_linux_list.h | 36 +-
sys/external/bsd/drm/dist/bsd-core/drm_memory.c | 1 +
sys/external/bsd/drm/dist/bsd-core/drm_mm.c | 369 ++++++++
sys/external/bsd/drm/dist/bsd-core/drm_mm.h | 97 ++
sys/external/bsd/drm/dist/bsd-core/drm_sman.c | 352 ++++++++
sys/external/bsd/drm/dist/bsd-core/drm_sman.h | 178 ++++
sys/external/bsd/drm/dist/bsd-core/via_dmablit.c | 796 +++++++++++++++++++
sys/external/bsd/drm/dist/bsd-core/via_dmablit.h | 144 +++
sys/external/bsd/drm/dist/bsd-core/via_drv.c | 11 +-
sys/external/bsd/drm/dist/shared-core/via_dma.c | 112 +-
sys/external/bsd/drm/dist/shared-core/via_drm.h | 57 +-
sys/external/bsd/drm/dist/shared-core/via_drv.h | 135 +--
sys/external/bsd/drm/dist/shared-core/via_irq.c | 38 +-
sys/external/bsd/drm/dist/shared-core/via_map.c | 42 +-
sys/external/bsd/drm/dist/shared-core/via_mm.c | 437 +++-------
sys/external/bsd/drm/dist/shared-core/via_verifier.c | 24 +-
sys/external/bsd/drm/dist/shared-core/via_verifier.h | 10 +-
sys/external/bsd/drm/dist/shared-core/via_video.c | 7 +-
22 files changed, 2510 insertions(+), 592 deletions(-)
diffs (truncated from 3868 to 300 lines):
diff -r acc9f0e66302 -r 71ccd3d37ae0 sys/external/bsd/drm/conf/files.drm
--- a/sys/external/bsd/drm/conf/files.drm Fri Feb 18 14:25:04 2011 +0000
+++ b/sys/external/bsd/drm/conf/files.drm Fri Feb 18 14:26:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.drm,v 1.5 2010/07/21 03:14:32 mrg Exp $
+# $NetBSD: files.drm,v 1.6 2011/02/18 14:26:09 jmcneill Exp $
# direct rendering modules
define drmbase
@@ -16,12 +16,15 @@
file external/bsd/drm/dist/bsd-core/drm_drawable.c drmbase
file external/bsd/drm/dist/bsd-core/drm_drv.c drmbase
file external/bsd/drm/dist/bsd-core/drm_fops.c drmbase
+file external/bsd/drm/dist/bsd-core/drm_hashtab.c drmbase
file external/bsd/drm/dist/bsd-core/drm_ioctl.c drmbase
file external/bsd/drm/dist/bsd-core/drm_irq.c drmbase
file external/bsd/drm/dist/bsd-core/drm_lock.c drmbase
file external/bsd/drm/dist/bsd-core/drm_memory.c drmbase
+file external/bsd/drm/dist/bsd-core/drm_mm.c drmbase
file external/bsd/drm/dist/bsd-core/drm_pci.c drmbase
file external/bsd/drm/dist/bsd-core/drm_scatter.c drmbase
+file external/bsd/drm/dist/bsd-core/drm_sman.c drmbase
file external/bsd/drm/dist/bsd-core/drm_sysctl.c drmbase
file external/bsd/drm/dist/bsd-core/drm_vm.c drmbase
@@ -118,6 +121,7 @@
device viadrm: drmbase, drmpci
attach viadrm at drm
file external/bsd/drm/dist/bsd-core/via_drv.c viadrm
+file external/bsd/drm/dist/bsd-core/via_dmablit.c viadrm
file external/bsd/drm/dist/shared-core/via_dma.c viadrm
file external/bsd/drm/dist/shared-core/via_ds.c viadrm
file external/bsd/drm/dist/shared-core/via_irq.c viadrm
diff -r acc9f0e66302 -r 71ccd3d37ae0 sys/external/bsd/drm/dist/bsd-core/drmP.h
--- a/sys/external/bsd/drm/dist/bsd-core/drmP.h Fri Feb 18 14:25:04 2011 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drmP.h Fri Feb 18 14:26:09 2011 +0000
@@ -186,6 +186,7 @@
MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
MALLOC_DECLARE(DRM_MEM_SGLISTS);
MALLOC_DECLARE(DRM_MEM_DRAWABLE);
+MALLOC_DECLARE(DRM_MEM_MM);
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
@@ -266,6 +267,10 @@
#define IRQ_NONE 0
#endif
+#define container_of(ptr, type, member) ({ \
+ __typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
enum {
DRM_IS_NOT_AGP,
DRM_IS_AGP,
diff -r acc9f0e66302 -r 71ccd3d37ae0 sys/external/bsd/drm/dist/bsd-core/drm_hashtab.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_hashtab.c Fri Feb 18 14:26:09 2011 +0000
@@ -0,0 +1,180 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ **************************************************************************/
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: drm_hashtab.c,v 1.1 2011/02/18 14:26:09 jmcneill Exp $");
+
+/*
+ * Simple open hash tab implementation.
+ *
+ * Authors:
+ * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ */
+
+#include "drmP.h"
+#include "drm_hashtab.h"
+
+#include <sys/hash.h>
+
+int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
+{
+ ht->size = 1 << order;
+ ht->order = order;
+ ht->table = NULL;
+ ht->table = hashinit(ht->size, HASH_LIST, false, &ht->mask);
+ if (!ht->table) {
+ DRM_ERROR("Out of memory for hash table\n");
+ return -ENOMEM;
+ }
+ return 0;
+}
+
+void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
+{
+ struct drm_hash_item *entry;
+ struct drm_hash_item_list *h_list;
+ unsigned int hashed_key;
+ int count = 0;
+
+ hashed_key = hash32_buf(&key, sizeof(key), ht->order);
+ DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
+ h_list = &ht->table[hashed_key & ht->mask];
+ LIST_FOREACH(entry, h_list, head)
+ DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
+}
+
+static struct drm_hash_item *
+drm_ht_find_key(struct drm_open_hash *ht, unsigned long key)
+{
+ struct drm_hash_item *entry;
+ struct drm_hash_item_list *h_list;
+ unsigned int hashed_key;
+
+ hashed_key = hash32_buf(&key, sizeof(key), ht->order);
+ h_list = &ht->table[hashed_key & ht->mask];
+ LIST_FOREACH(entry, h_list, head) {
+ if (entry->key == key)
+ return entry;
+ if (entry->key > key)
+ break;
+ }
+ return NULL;
+}
+
+
+int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
+{
+ struct drm_hash_item *entry, *parent;
+ struct drm_hash_item_list *h_list;
+ unsigned int hashed_key;
+ unsigned long key = item->key;
+
+ hashed_key = hash32_buf(&key, sizeof(key), ht->order);
+ h_list = &ht->table[hashed_key & ht->mask];
+ parent = NULL;
+ LIST_FOREACH(entry, h_list, head) {
+ if (entry->key == key)
+ return -EINVAL;
+ if (entry->key > key)
+ break;
+ parent = entry;
+ }
+ if (parent) {
+ LIST_INSERT_AFTER(parent, item, head);
+ } else {
+ LIST_INSERT_HEAD(h_list, item, head);
+ }
+ return 0;
+}
+
+/*
+ * Just insert an item and return any "bits" bit key that hasn't been
+ * used before.
+ */
+int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
+ unsigned long seed, int bits, int shift,
+ unsigned long add)
+{
+ int ret;
+ unsigned long mask = (1 << bits) - 1;
+ unsigned long first, unshifted_key = 0;
+
+ unshifted_key = hash32_buf(&seed, sizeof(seed), unshifted_key);
+ first = unshifted_key;
+ do {
+ item->key = (unshifted_key << shift) + add;
+ ret = drm_ht_insert_item(ht, item);
+ if (ret)
+ unshifted_key = (unshifted_key + 1) & mask;
+ } while(ret && (unshifted_key != first));
+
+ if (ret) {
+ DRM_ERROR("Available key bit space exhausted\n");
+ return -EINVAL;
+ }
+ return 0;
+}
+
+int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
+ struct drm_hash_item **item)
+{
+ struct drm_hash_item *entry;
+
+ entry = drm_ht_find_key(ht, key);
+ if (!entry)
+ return -EINVAL;
+
+ *item = entry;
+ return 0;
+}
+
+int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key)
+{
+ struct drm_hash_item *entry;
+
+ entry = drm_ht_find_key(ht, key);
+ if (entry) {
+ LIST_REMOVE(entry, head);
+ return 0;
+ }
+ return -EINVAL;
+}
+
+int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
+{
+ LIST_REMOVE(item, head);
+ return 0;
+}
+
+void drm_ht_remove(struct drm_open_hash *ht)
+{
+ if (ht->table) {
+ hashdone(ht->table, HASH_LIST, ht->mask);
+ ht->table = NULL;
+ }
+}
diff -r acc9f0e66302 -r 71ccd3d37ae0 sys/external/bsd/drm/dist/bsd-core/drm_hashtab.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_hashtab.h Fri Feb 18 14:26:09 2011 +0000
@@ -0,0 +1,65 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismack, ND. USA.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ **************************************************************************/
+
+/*
+ * Simple open hash tab implementation.
+ *
+ * Authors:
+ * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ */
+
+#ifndef DRM_HASHTAB_H
+#define DRM_HASHTAB_H
+
+#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
+
+struct drm_hash_item {
+ LIST_ENTRY(drm_hash_item) head;
+ unsigned long key;
+};
+
+struct drm_open_hash {
+ LIST_HEAD(drm_hash_item_list, drm_hash_item) *table;
+ unsigned int size;
+ unsigned int order;
+ unsigned long mask;
+};
+
+extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
+extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
+extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
+ unsigned long seed, int bits, int shift,
+ unsigned long add);
Home |
Main Index |
Thread Index |
Old Index