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

libdrm: Changes to 'upstream-unstable'



 .cvsignore                    |   17 
 .gitignore                    |   99 
 bsd-core/.cvsignore           |    1 
 bsd-core/drm/.cvsignore       |    8 
 bsd-core/drmP.h               |    6 
 bsd-core/drm_drawable.c       |   52 
 bsd-core/drm_drv.c            |    3 
 bsd-core/i915/.cvsignore      |    8 
 bsd-core/i915_drv.c           |    2 
 bsd-core/mach64/.cvsignore    |    8 
 bsd-core/mga/.cvsignore       |    8 
 bsd-core/r128/.cvsignore      |    8 
 bsd-core/radeon/.cvsignore    |    8 
 bsd-core/savage/.cvsignore    |    8 
 bsd-core/sis/.cvsignore       |    8 
 bsd-core/tdfx/.cvsignore      |    8 
 bsd-core/via/.cvsignore       |    8 
 configure.ac                  |    3 
 libdrm/.cvsignore             |    8 
 libdrm/Makefile.am            |    4 
 libdrm/xf86drm.c              | 1196 ++++
 libdrm/xf86drm.h              |   34 
 libdrm/xf86mm.h               |  209 
 linux-core/.cvsignore         |    6 
 linux-core/Makefile           |    4 
 linux-core/Makefile.kernel    |    6 
 linux-core/ati_pcigart.c      |   18 
 linux-core/drmP.h             |  535 +
 linux-core/drm_agpsupport.c   |  158 
 linux-core/drm_auth.c         |   55 
 linux-core/drm_bo.c           | 1998 +++++++
 linux-core/drm_bufs.c         |  169 
 linux-core/drm_compat.c       |  434 +
 linux-core/drm_compat.h       |  163 
 linux-core/drm_context.c      |   52 
 linux-core/drm_core.h         |    8 
 linux-core/drm_drawable.c     |   56 
 linux-core/drm_drv.c          |  134 
 linux-core/drm_fence.c        |  619 ++
 linux-core/drm_fops.c         |  169 
 linux-core/drm_hashtab.c      |  281 -
 linux-core/drm_hashtab.h      |   34 
 linux-core/drm_ioctl.c        |   40 
 linux-core/drm_irq.c          |  186 
 linux-core/drm_lock.c         |   96 
 linux-core/drm_memory.c       |   70 
 linux-core/drm_memory.h       |    1 
 linux-core/drm_memory_debug.c |    1 
 linux-core/drm_memory_debug.h |    1 
 linux-core/drm_mm.c           |  211 
 linux-core/drm_object.c       |  287 +
 linux-core/drm_pci.c          |   18 
 linux-core/drm_proc.c         |  123 
 linux-core/drm_scatter.c      |    1 
 linux-core/drm_sman.c         |   67 
 linux-core/drm_sman.h         |   46 
 linux-core/drm_stub.c         |   39 
 linux-core/drm_sysfs.c        |    1 
 linux-core/drm_ttm.c          |  519 +
 linux-core/drm_ttm.h          |  145 
 linux-core/drm_vm.c           |  307 -
 linux-core/ffb_drv.c          |    1 
 linux-core/i810_dma.c         |   10 
 linux-core/i810_drv.c         |    1 
 linux-core/i810_drv.h         |   20 
 linux-core/i830_dma.c         |    4 
 linux-core/i830_drv.c         |    2 
 linux-core/i915_buffer.c      |   66 
 linux-core/i915_drv.c         |   32 
 linux-core/i915_fence.c       |  146 
 linux-core/imagine_drv.c      |    1 
 linux-core/mach64_drv.c       |    1 
 linux-core/mga_drv.c          |    2 
 linux-core/nv_drv.c           |    1 
 linux-core/r128_drv.c         |    1 
 linux-core/radeon_drv.c       |    3 
 linux-core/savage_drv.c       |    1 
 linux-core/sis_drv.c          |   14 
 linux-core/sis_mm.c           |  143 
 linux-core/tdfx_drv.c         |    1 
 linux-core/via_dmablit.c      |   25 
 linux-core/via_dmablit.h      |   10 
 linux-core/via_mm.c           |   47 
 linux/.cvsignore              |    6 
 linux/Config.in               |   17 
 linux/Doxyfile                | 1171 ----
 linux/Kconfig                 |  105 
 linux/Makefile                |  406 -
 linux/Makefile.kernel         |  100 
 linux/README.drm              |   46 
 linux/ati_pcigart.h           |  206 
 linux/drmP.h                  | 1012 ---
 linux/drm_agpsupport.h        |  472 -
 linux/drm_auth.h              |  230 
 linux/drm_bufs.h              | 1529 -----
 linux/drm_compat.h            |  173 
 linux/drm_context.h           |  578 --
 linux/drm_core.h              |   43 
 linux/drm_dma.h               |  179 
 linux/drm_drawable.h          |   56 
 linux/drm_drv.h               | 1127 ----
 linux/drm_fops.h              |  153 
 linux/drm_init.h              |  128 
 linux/drm_ioctl.h             |  349 -
 linux/drm_irq.h               |  367 -
 linux/drm_lock.h              |  168 
 linux/drm_memory.h            |  374 -
 linux/drm_memory_debug.h      |  459 -
 linux/drm_os_linux.h          |  177 
 linux/drm_pci.h               |  169 
 linux/drm_proc.h              |  538 -
 linux/drm_scatter.h           |  231 
 linux/drm_stub.h              |  358 -
 linux/drm_vm.h                |  670 --
 linux/ffb.h                   |   12 
 linux/ffb_context.c           |  616 --
 linux/ffb_drv.c               |  278 -
 linux/ffb_drv.h               |  283 -
 linux/i810.h                  |   77 
 linux/i810_dma.c              | 1421 -----
 linux/i810_drm.h              |  278 -
 linux/i810_drv.c              |   40 
 linux/i810_drv.h              |  253 
 linux/i830.h                  |   83 
 linux/i830_dma.c              | 1623 -----
 linux/i830_drm.h              |  335 -
 linux/i830_drv.c              |   42 
 linux/i830_drv.h              |  302 -
 linux/i830_irq.c              |  208 
 linux/i915_drv.c              |   17 
 linux/mach64_drv.c            |   37 
 linux/mga_drv.c               |   39 
 linux/r128_drv.c              |   40 
 linux/radeon_drv.c            |   41 
 linux/savage.h                |   32 
 linux/savage_dma.c            |   88 
 linux/savage_drm.h            |  238 
 linux/savage_drv.c            |  255 
 linux/savage_drv.h            |   72 
 linux/sis_drv.c               |   35 
 linux/tdfx_drv.c              |   43 
 scripts/create_lk_drm.sh      |   18 
 shared-core/.cvsignore        |    2 
 shared-core/drm.h             |  239 
 shared-core/drm_drawable.c    |  330 +
 shared-core/drm_pciids.txt    |  182 
 shared-core/i915_dma.c        |   80 
 shared-core/i915_drm.h        |   37 
 shared-core/i915_drv.h        |   91 
 shared-core/i915_irq.c        |  351 +
 shared-core/mach64_dma.c      |  234 
 shared-core/mach64_drm.h      |    4 
 shared-core/mach64_drv.h      |    7 
 shared-core/mach64_state.c    |  205 
 shared-core/r300_cmdbuf.c     |   33 
 shared-core/radeon_cp.c       |   67 
 shared-core/radeon_drv.h      |   38 
 shared-core/radeon_state.c    |  173 
 shared-core/savage_bci.c      |    1 
 shared-core/sis_drv.h         |   30 
 shared-core/via_dma.c         |   18 
 shared-core/via_drm.h         |   42 
 shared-core/via_drv.c         |    1 
 shared-core/via_drv.h         |   16 
 shared-core/via_irq.c         |   25 
 shared-core/via_verifier.h    |    8 
 shared/drm.h                  |  733 --
 shared/drm_pciids.txt         |  211 
 shared/drm_sarea.h            |   78 
 shared/i915.h                 |   49 
 shared/i915_dma.c             |  769 --
 shared/i915_drm.h             |  154 
 shared/i915_drv.h             |  219 
 shared/i915_irq.c             |  165 
 shared/i915_mem.c             |  347 -
 shared/mach64.h               |   69 
 shared/mach64_dma.c           | 1343 ----
 shared/mach64_drm.h           |  258 
 shared/mach64_drv.h           | 1040 ---
 shared/mach64_irq.c           |  130 
 shared/mach64_state.c         |  896 ---
 shared/mga.h                  |   63 
 shared/mga_dma.c              |  829 --
 shared/mga_drm.h              |  425 -
 shared/mga_drv.h              |  636 --
 shared/mga_irq.c              |  103 
 shared/mga_state.c            | 1110 ----
 shared/mga_ucode.h            |11645 ------------------------------------------
 shared/mga_warp.c             |  211 
 shared/r128.h                 |   75 
 shared/r128_cce.c             |  946 ---
 shared/r128_drm.h             |  345 -
 shared/r128_drv.h             |  516 -
 shared/r128_irq.c             |  103 
 shared/r128_state.c           | 1724 ------
 shared/radeon.h               |  124 
 shared/radeon_cp.c            | 2092 -------
 shared/radeon_drm.h           |  661 --
 shared/radeon_drv.h           | 1011 ---
 shared/radeon_irq.c           |  258 
 shared/radeon_mem.c           |  323 -
 shared/radeon_state.c         | 3093 -----------
 shared/sis.h                  |   57 
 shared/sis_drm.h              |   33 
 shared/sis_drv.h              |   48 
 shared/sis_ds.c               |  386 -
 shared/sis_ds.h               |  164 
 shared/sis_mm.c               |  417 -
 shared/tdfx.h                 |   50 
 shared/via.h                  |   54 
 shared/via_3d_reg.h           | 1651 -----
 shared/via_dma.c              |  742 --
 shared/via_drm.h              |  243 
 shared/via_drv.c              |   31 
 shared/via_drv.h              |  111 
 shared/via_ds.c               |  390 -
 shared/via_ds.h               |  113 
 shared/via_irq.c              |  340 -
 shared/via_map.c              |  112 
 shared/via_mm.c               |  372 -
 shared/via_mm.h               |   45 
 shared/via_verifier.c         | 1063 ---
 shared/via_verifier.h         |   61 
 shared/via_video.c            |  102 
 224 files changed, 9897 insertions(+), 59363 deletions(-)

New commits:
commit d51e1bb56ca2f7858cdeac6f61a7b747c1e15b1e
Author: Dave Airlie <airlied@linux.ie>
Date:   Thu Nov 9 08:55:58 2006 +1100

    libdrm: add drmOpenOnce + drmCloseOnce to libdrm

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 05b40f7..56450e8 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -3215,3 +3215,64 @@ int drmMMUnlock(int fd, unsigned memType)
     
     return ret;	
 }
+
+#define DRM_MAX_FDS 16
+static struct {
+   char *BusID;
+   int fd;
+   int refcount;
+} connection[DRM_MAX_FDS];
+
+static int nr_fds = 0;
+
+int drmOpenOnce(void *unused, 
+		const char *BusID,
+		int *newlyopened)
+{
+   int i;
+   int fd;
+   
+   for (i = 0; i < nr_fds; i++)
+      if (strcmp(BusID, connection[i].BusID) == 0) {
+	 connection[i].refcount++;
+	 *newlyopened = 0;
+	 return connection[i].fd;
+      }
+
+   fd = drmOpen(unused, BusID);
+   if (fd <= 0 || nr_fds == DRM_MAX_FDS)
+      return fd;
+   
+   connection[nr_fds].BusID = strdup(BusID);
+   connection[nr_fds].fd = fd;
+   connection[nr_fds].refcount = 1;
+   *newlyopened = 1;
+
+   if (0)
+      fprintf(stderr, "saved connection %d for %s %d\n", 
+              nr_fds, connection[nr_fds].BusID, 
+              strcmp(BusID, connection[nr_fds].BusID));
+
+   nr_fds++;
+
+   return fd;   
+}
+
+void drmCloseOnce(int fd)
+{
+   int i;
+
+   for (i = 0; i < nr_fds; i++) {
+      if (fd == connection[i].fd) {
+	 if (--connection[i].refcount == 0) {
+	    drmClose(connection[i].fd);
+	    free(connection[i].BusID);
+	    
+	    if (i < --nr_fds) 
+	       connection[i] = connection[nr_fds];
+
+	    return;
+	 }
+      }
+   }
+}
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index 4d9580c..34c9ec0 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -655,6 +655,9 @@ extern int  drmSLLookupNeighbors(void *l, unsigned long key,
 				 unsigned long *prev_key, void **prev_value,
 				 unsigned long *next_key, void **next_value);
 
+extern int drmOpenOnce(void *unused, const char *BusID, int *newlyopened);
+extern void drmCloseOnce(int fd);
+
 #include "xf86mm.h"
 
 #endif

commit 79038751ffe47ed1ce82766e027d98fd2f0e2c6a
Author: Dave Airlie <airlied@linux.ie>
Date:   Wed Nov 8 15:08:09 2006 +1100

    libdrm: add support for server side functionality in libdrm
    
    This adds APIs to allow the X server to use libdrm from the system
    rather than its own in-built copy.

diff --git a/configure.ac b/configure.ac
index 224f43a..c0b11b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.2.0, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.3.0, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 
diff --git a/libdrm/Makefile.am b/libdrm/Makefile.am
index 91a7e5d..e7e07e4 100644
--- a/libdrm/Makefile.am
+++ b/libdrm/Makefile.am
@@ -20,7 +20,7 @@
 
 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
-libdrm_la_LDFLAGS = -version-number 2:0:0 -no-undefined
+libdrm_la_LDFLAGS = -version-number 2:3:0 -no-undefined
 
 AM_CFLAGS = -I$(top_srcdir)/shared-core
 libdrm_la_SOURCES = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 5efb532..05b40f7 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -35,40 +35,25 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
-# include "xf86.h"
-# include "xf86_OSproc.h"
-# include "drm.h"
-# include "xf86_ansic.h"
-# define _DRM_MALLOC xalloc
-# define _DRM_FREE   xfree
-# ifndef XFree86LOADER
-#  include <sys/mman.h>
-# endif
-#else
-# ifdef HAVE_CONFIG_H
-#  include <config.h>
-# endif
-# include <stdio.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <string.h>
-# include <ctype.h>
-# include <fcntl.h>
-# include <errno.h>
-# include <signal.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# define stat_t struct stat
-# include <sys/ioctl.h>
-# include <sys/mman.h>
-# include <sys/time.h>
-# include <stdarg.h>
-# define _DRM_MALLOC malloc
-# define _DRM_FREE   free
-# include "drm.h"
+#ifdef HAVE_CONFIG_H
+# include <config.h>
 #endif
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define stat_t struct stat
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <stdarg.h>
+#include "drm.h"
 
 /* Not all systems have MAP_FAILED defined */
 #ifndef MAP_FAILED
@@ -107,6 +92,13 @@
 
 #define DRM_MSG_VERBOSITY 3
 
+static drmServerInfoPtr drm_server_info;
+
+void drmSetServerInfo(drmServerInfoPtr info)
+{
+  drm_server_info = info;
+}
+
 /**
  * Output a message to stderr.
  *
@@ -115,44 +107,54 @@
  * \internal
  * This function is a wrapper around vfprintf().
  */
+
+static int drmDebugPrint(const char *format, va_list ap)
+{
+  return vfprintf(stderr, format, ap);
+}
+
+static int (*drm_debug_print)(const char *format, va_list ap) = drmDebugPrint;
+
 static void
 drmMsg(const char *format, ...)
 {
     va_list	ap;
-
-#ifndef XFree86Server
     const char *env;
-    if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose"))
-#endif
+    if (((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) || drm_server_info)
     {
 	va_start(ap, format);
-#ifdef XFree86Server
-	xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
-#else
-	vfprintf(stderr, format, ap);
-#endif
+	if (drm_server_info) {
+	  drm_server_info->debug_print(format,ap);
+	} else {
+	  drm_debug_print(format, ap);
+	}
 	va_end(ap);
     }
 }
 
+void
+drmSetDebugMsgFunction(int (*debug_msg_ptr)(const char *format, va_list ap))
+{
+  drm_debug_print = debug_msg_ptr;
+}
+
 static void *drmHashTable = NULL; /* Context switch callbacks */
 
-typedef struct drmHashEntry {
-    int      fd;
-    void     (*f)(int, void *, void *);
-    void     *tagTable;
-} drmHashEntry;
+void *drmGetHashTable(void)
+{
+  return drmHashTable;
+}
 
 void *drmMalloc(int size)
 {
     void *pt;
-    if ((pt = _DRM_MALLOC(size))) memset(pt, 0, size);
+    if ((pt = malloc(size))) memset(pt, 0, size);
     return pt;
 }
 
 void drmFree(void *pt)
 {
-    if (pt) _DRM_FREE(pt);
+    if (pt) free(pt);
 }
 
 /* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */
@@ -163,7 +165,7 @@ static char *drmStrdup(const char *s)
     if (!s)
         return NULL;
 
-    retval = _DRM_MALLOC(strlen(s)+1);
+    retval = malloc(strlen(s)+1);
     if (!retval)
         return NULL;
 
@@ -182,7 +184,7 @@ static unsigned long drmGetKeyFromFd(int fd)
     return st.st_rdev;
 }
 
-static drmHashEntry *drmGetEntry(int fd)
+drmHashEntry *drmGetEntry(int fd)
 {
     unsigned long key = drmGetKeyFromFd(fd);
     void          *value;
@@ -269,21 +271,20 @@ static int drmOpenDevice(long dev, int minor)
     stat_t          st;
     char            buf[64];
     int             fd;
-    mode_t          devmode = DRM_DEV_MODE;
+    mode_t          devmode = DRM_DEV_MODE, serv_mode;
     int             isroot  = !geteuid();
-#if defined(XFree86Server)
     uid_t           user    = DRM_DEV_UID;
-    gid_t           group   = DRM_DEV_GID;
-#endif
-
+    gid_t           group   = DRM_DEV_GID, serv_group;
+    
     sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
     drmMsg("drmOpenDevice: node name is %s\n", buf);
 
-#if defined(XFree86Server)
-    devmode  = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
-    devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
-    group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
-#endif
+    if (drm_server_info) {
+      drm_server_info->get_perms(&serv_group, &serv_mode);
+      devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
+      devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+      group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
+    }
 
     if (stat(DRM_DIR_NAME, &st)) {
 	if (!isroot) return DRM_ERR_NOT_ROOT;
@@ -298,10 +299,11 @@ static int drmOpenDevice(long dev, int minor)
 	remove(buf);
 	mknod(buf, S_IFCHR | devmode, dev);
     }
-#if defined(XFree86Server)
-    chown(buf, user, group);
-    chmod(buf, devmode);
-#endif
+
+    if (drm_server_info) {
+      chown(buf, user, group);
+      chmod(buf, devmode);
+    }
 
     fd = open(buf, O_RDWR, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
@@ -315,10 +317,10 @@ static int drmOpenDevice(long dev, int minor)
 	if (!isroot) return DRM_ERR_NOT_ROOT;
 	remove(buf);
 	mknod(buf, S_IFCHR | devmode, dev);
-#if defined(XFree86Server)
-	chown(buf, user, group);
-	chmod(buf, devmode);
-#endif
+	if (drm_server_info) {
+	  chown(buf, user, group);
+	  chmod(buf, devmode);
+	}
     }
     fd = open(buf, O_RDWR, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
@@ -456,16 +458,16 @@ static int drmOpenByName(const char *name)
     char *        id;
     
     if (!drmAvailable()) {
-#if !defined(XFree86Server)
+      if (!drm_server_info)
 	return -1;
-#else
+      else {
         /* try to load the kernel module now */
-        if (!xf86LoadKernelModule(name)) {
-            ErrorF("[drm] failed to load kernel module \"%s\"\n",
-		   name);
-            return -1;
+        if (!drm_server_info->load_module(name)) {
+	  drmMsg("[drm] failed to load kernel module \"%s\"\n",
+		 name);
+	  return -1;
         }
-#endif
+      }
     }
 
     /*
@@ -547,16 +549,14 @@ static int drmOpenByName(const char *name)
  */
 int drmOpen(const char *name, const char *busid)
 {
-#ifdef XFree86Server
-    if (!drmAvailable() && name != NULL) {
+    if (!drmAvailable() && name != NULL && drm_server_info) {
 	/* try to load the kernel */
-	if (!xf86LoadKernelModule(name)) {
-	    ErrorF("[drm] failed to load kernel module \"%s\"\n",
+	if (!drm_server_info->load_module(name)) {
+	  drmMsg("[drm] failed to load kernel module \"%s\"\n",
 	           name);
 	    return -1;
 	}
     }
-#endif
 
     if (busid) {
 	int fd;
@@ -710,15 +710,17 @@ drmVersionPtr drmGetLibVersion(int fd)
     drm_version_t *version = drmMalloc(sizeof(*version));
 
     /* Version history:
+     *   NOTE THIS MUST NOT GO ABOVE VERSION 1.X due to drivers needing it
      *   revision 1.0.x = original DRM interface with no drmGetLibVersion
      *                    entry point and many drm<Device> extensions
      *   revision 1.1.x = added drmCommand entry points for device extensions
      *                    added drmGetLibVersion to identify libdrm.a version
      *   revision 1.2.x = added drmSetInterfaceVersion
      *                    modified drmOpen to handle both busid and name
+     *   revision 1.3.x = added server + memory manager
      */
-    version->version_major      = 2;
-    version->version_minor      = 2;
+    version->version_major      = 1;
+    version->version_minor      = 3;
     version->version_patchlevel = 0;
 
     return (drmVersionPtr)version;
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index 86ee7d3..4d9580c 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -36,6 +36,8 @@
 #ifndef _XF86DRM_H_
 #define _XF86DRM_H_
 
+#include <stdarg.h>
+#include <sys/types.h>
 #include <drm.h>
 
 				/* Defaults, if nothing set in xf86config */
@@ -61,6 +63,21 @@
 typedef unsigned int  drmSize,     *drmSizePtr;	    /**< For mapped regions */
 typedef void          *drmAddress, **drmAddressPtr; /**< For mapped regions */
 
+typedef struct _drmServerInfo {
+  int (*debug_print)(const char *format, va_list ap);
+  int (*load_module)(const char *name);
+  void (*get_perms)(gid_t *, mode_t *);
+} drmServerInfo, *drmServerInfoPtr;
+
+typedef struct drmHashEntry {
+    int      fd;
+    void     (*f)(int, void *, void *);
+    void     *tagTable;
+} drmHashEntry;
+
+extern void *drmGetHashTable(void);
+extern drmHashEntry *drmGetEntry(int fd);
+
 /**
  * Driver version information.
  *
@@ -604,6 +621,7 @@ extern int           drmScatterGatherFree(int fd, drm_handle_t handle);
 extern int           drmWaitVBlank(int fd, drmVBlankPtr vbl);
 
 /* Support routines */
+extern void          drmSetServerInfo(drmServerInfoPtr info);
 extern int           drmError(int err, const char *label);
 extern void          *drmMalloc(int size);
 extern void          drmFree(void *pt);

commit 584acab6d6103552711bd6b5596ee4ccad305bc2
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 7 09:36:40 2006 -0800

    Add drm_u64_t typedef on non-linux to fix libdrm build.

diff --git a/shared-core/drm.h b/shared-core/drm.h
index 16e8626..9efb1dc 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -139,6 +139,8 @@ typedef unsigned long long drm_u64_t;
 
 typedef unsigned int drm_handle_t;
 #else
+#include <sys/types.h>
+typedef u_int64_t drm_u64_t;
 typedef unsigned long drm_handle_t;	/**< To mapped regions */
 #endif
 typedef unsigned int drm_context_t;	/**< GLXContext handle */

commit 7b6cd95bb6c41653aed78952da0a461bd4791413
Author: Alan Hourihane <alanh@fairlite.demon.co.uk>
Date:   Tue Oct 31 10:01:53 2006 +0000

    Fix bug #8839 - a comment

diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index 269d7b3..d42b207 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -1,4 +1,4 @@
-/* i915_drv.c -- ATI Radeon driver -*- linux-c -*-
+/* i915_drv.c -- Intel i915 driver -*- linux-c -*-
  * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
  */
 /*-

commit 4b04c0cc45f7a89c757ce442e4f2742b9d3aa293
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Mon Oct 30 11:18:44 2006 +0100

    Bugzilla Bug #8819
    Build fixes for powerpc.
    Reported by Katerina Barone-Adesi

diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 13bec48..931972a 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -30,7 +30,7 @@
 
 static void drm_ttm_ipi_handler(void *null)
 {
-	wbinvd();
+	flush_agp_cache();
 }
 
 static void drm_ttm_cache_flush(void) 
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index fd6e89d..6eb996a 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -57,7 +57,7 @@ pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
 	}
 #elif defined(__powerpc__)
 	pgprot_val(tmp) |= _PAGE_NO_CACHE;
-	if (map->type == _DRM_REGISTERS)
+	if (map_type == _DRM_REGISTERS)
 		pgprot_val(tmp) |= _PAGE_GUARDED;
 #endif
 #if defined(__ia64__)

commit 56563c22d658b6dcb7926fd41513618cd46c31a6
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Sun Oct 29 15:39:11 2006 +0100

    Minor bugfix, indentation and removal of unnused variables.

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index df41d77..5efb532 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2369,14 +2369,14 @@ int drmFenceUpdate(int fd, drmFence *fence)
 	drm_fence_arg_t arg;
 	
     memset(&arg, 0, sizeof(arg));
-	arg.handle = fence->handle;
-	arg.op = drm_fence_signaled;
-	if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
-	    return -errno;
-	fence->class = arg.class;
-	fence->type = arg.type;
-	fence->signaled = arg.signaled;
-	return 0;
+    arg.handle = fence->handle;
+    arg.op = drm_fence_signaled;
+    if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+	return -errno;
+    fence->class = arg.class;
+    fence->type = arg.type;
+    fence->signaled = arg.signaled;
+    return 0;
 }
 
 int drmFenceSignaled(int fd, drmFence *fence, unsigned fenceType, 
@@ -2493,7 +2493,6 @@ void drmBOFreeList(drmBOList *list)
 {
     drmBONode *node;
     drmMMListHead *l;
-    int ret = 0;
 
     l = list->list.next;
     while(l != &list->list) {
@@ -2975,7 +2974,6 @@ int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
 		       int *newItem)
 {
     drmBONode *node, *cur;
-    unsigned oldFlags, newFlags;
     drmMMListHead *l;
 
     *newItem = 0;
@@ -3146,7 +3144,7 @@ int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle)
 	  return -EFAULT;
       if (rep->ret)
 	  return rep->ret;
-      drmBOCopyReply(rep, buf);
+      drmBOCopyReply(rep, node->buf);
   }
 
   return 0;

commit decacb2e6415029fe87a3680c8f967483ba05281
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Oct 27 13:08:31 2006 +0200

    Reserve the new IOCTLs also for *bsd.
    Bump libdrm version number to 2.2.0

diff --git a/configure.ac b/configure.ac
index b5d7945..224f43a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.1.2-mm, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.2.0, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index ebf3f83..df41d77 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -717,7 +717,7 @@ drmVersionPtr drmGetLibVersion(int fd)
      *   revision 1.2.x = added drmSetInterfaceVersion
      *                    modified drmOpen to handle both busid and name
      */
-    version->version_major      = 1;
+    version->version_major      = 2;
     version->version_minor      = 2;
     version->version_patchlevel = 0;
 
@@ -2257,7 +2257,6 @@ int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data,
     return 0;
 }
 
-#ifdef __linux__
 
 /*
  * Valid flags are 
@@ -3216,6 +3215,3 @@ int drmMMUnlock(int fd, unsigned memType)
     
     return ret;	
 }
-
-
-#endif
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 330aa3f..16e8626 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -660,7 +660,6 @@ typedef struct drm_set_version {
 	int drm_dd_minor;
 } drm_set_version_t;
 
-#ifdef __linux__
 
 #define DRM_FENCE_FLAG_EMIT                0x00000001
 #define DRM_FENCE_FLAG_SHAREABLE           0x00000002
@@ -844,8 +843,6 @@ typedef union drm_mm_init_arg{
 		unsigned expand_pad[8]; /*Future expansion */
 	} rep;
 } drm_mm_init_arg_t;
-#endif
-
 
 /**
  * \name Ioctls Definitions
@@ -912,11 +909,9 @@ typedef union drm_mm_init_arg{
 
 #define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, drm_wait_vblank_t)
 
-#ifdef __linux__
 #define DRM_IOCTL_FENCE                 DRM_IOWR(0x3b, drm_fence_arg_t)
 #define DRM_IOCTL_BUFOBJ                DRM_IOWR(0x3d, drm_bo_arg_t)
 #define DRM_IOCTL_MM_INIT               DRM_IOWR(0x3e, drm_mm_init_arg_t)
-#endif
 
 #define DRM_IOCTL_UPDATE_DRAW           DRM_IOW(0x3f, drm_update_draw_t)
 

commit f6d5fecdd20b9fd9e8744d8f43fa276b73a1da78
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Oct 27 11:28:37 2006 +0200

    Last minute changes to support multi-page size buffer offset alignments.
    This will come in very handy for tiled buffers on intel hardware.
    Also add some padding to interface structures to allow future binary backwards
    compatible changes.

diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 9047c8d..ebf3f83 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2613,12 +2613,14 @@ static void drmBOCopyReply(const drm_bo_arg_reply_t *rep,
     buf->start = rep->buffer_start;
     buf->fenceFlags = rep->fence_flags;
     buf->replyFlags = rep->rep_flags;
+    buf->pageAlignment = rep->page_alignment;
 }
     
     
 
-int drmBOCreate(int fd, void *ttm, unsigned long start, unsigned long size,
-		void *user_buffer, drm_bo_type_t type, unsigned mask,
+int drmBOCreate(int fd, unsigned long start, unsigned long size, 
+		unsigned pageAlignment, void *user_buffer, drm_bo_type_t type, 
+		unsigned mask,
 		unsigned hint, drmBO *buf)
 {
     drm_bo_arg_t arg;
@@ -2632,6 +2634,7 @@ int drmBOCreate(int fd, void *ttm, unsigned long start, unsigned long size,
     req->hint = hint;
     req->size = size;
     req->type = type;
+    req->page_alignment = pageAlignment;
 
     buf->virtual = NULL;
 
diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h
index da868fe..bd0d281 100644
--- a/libdrm/xf86mm.h
+++ b/libdrm/xf86mm.h
@@ -99,6 +99,7 @@ typedef struct _drmFence{
         unsigned type; 
         unsigned flags;
         unsigned signaled;
+        unsigned pad[4]; /* for future expansion */
 } drmFence;
 
 typedef struct _drmBO{
@@ -113,9 +114,11 @@ typedef struct _drmBO{
     unsigned long start;
     unsigned replyFlags;
     unsigned fenceFlags;
+    unsigned pageAlignment;
     void *virtual;
     void *mapVirtual;
     int mapCount;
+    unsigned pad[8];     /* for future expansion */
 } drmBO;
 
 
@@ -168,9 +171,10 @@ extern int drmBOCreateList(int numTarget, drmBOList *list);
  * Buffer object functions.
  */
 
-extern int drmBOCreate(int fd, void *ttm, unsigned long start, unsigned long size,
-			      void *user_buffer, drm_bo_type_t type, unsigned mask,
-		unsigned hint, drmBO *buf);
+extern int drmBOCreate(int fd, unsigned long start, unsigned long size,
+		       unsigned pageAlignment,void *user_buffer, 
+		       drm_bo_type_t type, unsigned mask,
+		       unsigned hint, drmBO *buf);
 extern int drmBODestroy(int fd, drmBO *buf);
 extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
 extern int drmBOUnReference(int fd, drmBO *buf);
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 1ed20b0..d02184c 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -1016,7 +1016,7 @@ typedef struct drm_buffer_object{
         unsigned long buffer_start;
         drm_bo_type_t type;
         unsigned long offset;
-
+        uint32_t page_alignment;
 	atomic_t mapped;
 	uint32_t flags;
 	uint32_t mask;
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 954b7a0..65e24fb 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -571,7 +571,7 @@ int drm_bo_alloc_space(drm_buffer_object_t * buf, unsigned mem_type,
 
 	mutex_lock(&dev->struct_mutex);
 	do {
-		node = drm_mm_search_free(mm, size, 0, 1);
+		node = drm_mm_search_free(mm, size, buf->page_alignment, 1);



Reply to: