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

libdrm: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit 930c0e7cf4f4776f7a69e7acc6fedeed7addb235
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Nov 7 12:58:52 2008 -0800

    intel: Restart on interrupt of bo_wait_rendering instead of complaining.

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 5eaf5f5..9cb3359 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -658,7 +658,9 @@ drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
     set_domain.handle = bo_gem->gem_handle;
     set_domain.read_domains = I915_GEM_DOMAIN_GTT;
     set_domain.write_domain = 0;
-    ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
+    do {
+	ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
+    } while (ret == -1 && errno == EINTR);
     if (ret != 0) {
 	fprintf (stderr, "%s:%d: Error setting memory domains %d (%08x %08x): %s .\n",
 		 __FILE__, __LINE__,

commit 87e90c73620b88005fcca5fd40aaaad0b08932e1
Author: Pekka Paalanen <pq@iki.fi>
Date:   Sun Nov 2 13:48:32 2008 +0200

    nouveau: compat fix for set_page_locked().
    
    The set_page_locked() function has changed its name again.
    2.6.28 offers __set_page_locked() instead, which uses non-atomic
    __set_bit() to do the work. In this case, offer our own
    set_page_locked() using the atomic set_bit(), because I do not know
    if atomic access is really necessary. Atomic behaviour is the one
    previously expected.
    
    Signed-off-by: Pekka Paalanen <pq@iki.fi>

diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h
index e09be47..bc4d2e5 100644
--- a/linux-core/drm_compat.h
+++ b/linux-core/drm_compat.h
@@ -392,4 +392,17 @@ extern struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
 #endif
 #endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
+#define set_page_locked SetPageLocked
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+/*
+ * The kernel provides __set_page_locked, which uses the non-atomic
+ * __set_bit function. Let's use the atomic set_bit just in case.
+ */
+static inline void set_page_locked(struct page *page)
+{
+	set_bit(PG_locked, &page->flags);
+}
+#endif
+
 #endif
diff --git a/linux-core/nouveau_sgdma.c b/linux-core/nouveau_sgdma.c
index 739e025..1163baf 100644
--- a/linux-core/nouveau_sgdma.c
+++ b/linux-core/nouveau_sgdma.c
@@ -227,11 +227,7 @@ nouveau_sgdma_init(struct drm_device *dev)
 
 	dev_priv->gart_info.sg_dummy_page =
 		alloc_page(GFP_KERNEL|__GFP_DMA32);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
 	set_page_locked(dev_priv->gart_info.sg_dummy_page);
-#else
-	SetPageLocked(dev_priv->gart_info.sg_dummy_page);
-#endif
 	dev_priv->gart_info.sg_dummy_bus =
 		pci_map_page(dev->pdev, dev_priv->gart_info.sg_dummy_page, 0,
 			     PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);

commit 00847dabe0fa5ccf796658f486e8f6f7a77e043b
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Oct 30 11:36:46 2008 -0700

    libdrm 2.4.1.

diff --git a/configure.ac b/configure.ac
index 92507cb..0f7c79e 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.4.0, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.1, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 

commit 4b9826408f65976a1a13387beda748b65e03ec52
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Oct 30 09:33:07 2008 -0700

    intel: Rename dri_ and intel_ symbols to drm_intel_.
    
    I wanted to avoid doing this, as it's a bunch of churn, but there was a
    conflict between the dri_ symbols in libdrm and the symbols that were in
    Mesa in 7.2, which broke Mesa 7.2 AIGLX when the 2D driver had loaded new
    libdrm symbols.  The new naming was recommended by cworth for giving the
    code a unique prefix identifying where the code lives.
    
    Additionally, take the opportunity to fix up two API mistakes: emit_reloc's
    arguments were in a nonsensical order, and set_tiling lacked the stride
    argument that the kernel will want to use soon.  API compatibility with
    released code is maintained using #defines.

diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c
index 92b6046..188eac2 100644
--- a/libdrm/intel/intel_bufmgr.c
+++ b/libdrm/intel/intel_bufmgr.c
@@ -39,26 +39,26 @@
 #include "intel_bufmgr.h"
 #include "intel_bufmgr_priv.h"
 
-/** @file dri_bufmgr.c
+/** @file intel_bufmgr.c
  *
  * Convenience functions for buffer management methods.
  */
 
-dri_bo *
-dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
-	     unsigned int alignment)
+drm_intel_bo *
+drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
+		   unsigned long size, unsigned int alignment)
 {
    return bufmgr->bo_alloc(bufmgr, name, size, alignment);
 }
 
 void
-dri_bo_reference(dri_bo *bo)
+drm_intel_bo_reference(drm_intel_bo *bo)
 {
    bo->bufmgr->bo_reference(bo);
 }
 
 void
-dri_bo_unreference(dri_bo *bo)
+drm_intel_bo_unreference(drm_intel_bo *bo)
 {
    if (bo == NULL)
       return;
@@ -67,38 +67,39 @@ dri_bo_unreference(dri_bo *bo)
 }
 
 int
-dri_bo_map(dri_bo *buf, int write_enable)
+drm_intel_bo_map(drm_intel_bo *buf, int write_enable)
 {
    return buf->bufmgr->bo_map(buf, write_enable);
 }
 
 int
-dri_bo_unmap(dri_bo *buf)
+drm_intel_bo_unmap(drm_intel_bo *buf)
 {
    return buf->bufmgr->bo_unmap(buf);
 }
 
 int
-dri_bo_subdata(dri_bo *bo, unsigned long offset,
-	       unsigned long size, const void *data)
+drm_intel_bo_subdata(drm_intel_bo *bo, unsigned long offset,
+		     unsigned long size, const void *data)
 {
    int ret;
+
    if (bo->bufmgr->bo_subdata)
       return bo->bufmgr->bo_subdata(bo, offset, size, data);
    if (size == 0 || data == NULL)
       return 0;
 
-   ret = dri_bo_map(bo, 1);
+   ret = drm_intel_bo_map(bo, 1);
    if (ret)
        return ret;
    memcpy((unsigned char *)bo->virtual + offset, data, size);
-   dri_bo_unmap(bo);
+   drm_intel_bo_unmap(bo);
    return 0;
 }
 
 int
-dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
-		   unsigned long size, void *data)
+drm_intel_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
+			 unsigned long size, void *data)
 {
    int ret;
    if (bo->bufmgr->bo_subdata)
@@ -107,48 +108,48 @@ dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
    if (size == 0 || data == NULL)
       return 0;
 
-   ret = dri_bo_map(bo, 0);
+   ret = drm_intel_bo_map(bo, 0);
    if (ret)
        return ret;
    memcpy(data, (unsigned char *)bo->virtual + offset, size);
-   dri_bo_unmap(bo);
+   drm_intel_bo_unmap(bo);
    return 0;
 }
 
 void
-dri_bo_wait_rendering(dri_bo *bo)
+drm_intel_bo_wait_rendering(drm_intel_bo *bo)
 {
    bo->bufmgr->bo_wait_rendering(bo);
 }
 
 void
-dri_bufmgr_destroy(dri_bufmgr *bufmgr)
+drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr)
 {
    bufmgr->destroy(bufmgr);
 }
 
 int
-dri_bo_exec(dri_bo *bo, int used,
-	    drm_clip_rect_t *cliprects, int num_cliprects,
-	    int DR4)
+drm_intel_bo_exec(drm_intel_bo *bo, int used,
+		  drm_clip_rect_t *cliprects, int num_cliprects,
+		  int DR4)
 {
    return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
 }
 
 void
-dri_bufmgr_set_debug(dri_bufmgr *bufmgr, int enable_debug)
+drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
 {
    bufmgr->debug = enable_debug;
 }
 
 int
-dri_bufmgr_check_aperture_space(dri_bo **bo_array, int count)
+drm_intel_bufmgr_check_aperture_space(drm_intel_bo **bo_array, int count)
 {
 	return bo_array[0]->bufmgr->check_aperture_space(bo_array, count);
 }
 
 int
-dri_bo_flink(dri_bo *bo, uint32_t *name)
+drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name)
 {
     if (bo->bufmgr->bo_flink)
 	return bo->bufmgr->bo_flink(bo, name);
@@ -157,17 +158,17 @@ dri_bo_flink(dri_bo *bo, uint32_t *name)
 }
 
 int
-dri_bo_emit_reloc(dri_bo *reloc_buf,
-		  uint32_t read_domains, uint32_t write_domain,
-		  uint32_t delta, uint32_t offset, dri_bo *target_buf)
+drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
+			drm_intel_bo *target_bo, uint32_t target_offset,
+			uint32_t read_domains, uint32_t write_domain)
 {
-    return reloc_buf->bufmgr->bo_emit_reloc(reloc_buf,
-					    read_domains, write_domain,
-					    delta, offset, target_buf);
+	return bo->bufmgr->bo_emit_reloc(bo, offset,
+					 target_bo, target_offset,
+					 read_domains, write_domain);
 }
 
 int
-dri_bo_pin(dri_bo *bo, uint32_t alignment)
+drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
 {
     if (bo->bufmgr->bo_pin)
 	return bo->bufmgr->bo_pin(bo, alignment);
@@ -176,7 +177,7 @@ dri_bo_pin(dri_bo *bo, uint32_t alignment)
 }
 
 int
-dri_bo_unpin(dri_bo *bo)
+drm_intel_bo_unpin(drm_intel_bo *bo)
 {
     if (bo->bufmgr->bo_unpin)
 	return bo->bufmgr->bo_unpin(bo);
@@ -184,16 +185,18 @@ dri_bo_unpin(dri_bo *bo)
     return -ENODEV;
 }
 
-int dri_bo_set_tiling(dri_bo *bo, uint32_t *tiling_mode)
+int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
+			    uint32_t stride)
 {
     if (bo->bufmgr->bo_set_tiling)
-	return bo->bufmgr->bo_set_tiling(bo, tiling_mode);
+	return bo->bufmgr->bo_set_tiling(bo, tiling_mode, stride);
 
     *tiling_mode = I915_TILING_NONE;
     return 0;
 }
 
-int dri_bo_get_tiling(dri_bo *bo, uint32_t *tiling_mode, uint32_t *swizzle_mode)
+int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
+			    uint32_t *swizzle_mode)
 {
     if (bo->bufmgr->bo_get_tiling)
 	return bo->bufmgr->bo_get_tiling(bo, tiling_mode, swizzle_mode);
diff --git a/libdrm/intel/intel_bufmgr.h b/libdrm/intel/intel_bufmgr.h
index 0c7b0e4..e3af886 100644
--- a/libdrm/intel/intel_bufmgr.h
+++ b/libdrm/intel/intel_bufmgr.h
@@ -36,10 +36,10 @@
 
 #include <stdint.h>
 
-typedef struct _dri_bufmgr dri_bufmgr;
-typedef struct _dri_bo dri_bo;
+typedef struct _drm_intel_bufmgr drm_intel_bufmgr;
+typedef struct _drm_intel_bo drm_intel_bo;
 
-struct _dri_bo {
+struct _drm_intel_bo {
     /**
      * Size in bytes of the buffer object.
      *
@@ -58,72 +58,117 @@ struct _dri_bo {
     void *virtual;
 
     /** Buffer manager context associated with this buffer object */
-    dri_bufmgr *bufmgr;
+    drm_intel_bufmgr *bufmgr;
 };
 
-dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
-		     unsigned int alignment);
-void dri_bo_reference(dri_bo *bo);
-void dri_bo_unreference(dri_bo *bo);
-int dri_bo_map(dri_bo *buf, int write_enable);
-int dri_bo_unmap(dri_bo *buf);
-
-int dri_bo_subdata(dri_bo *bo, unsigned long offset,
-		   unsigned long size, const void *data);
-int dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
-		       unsigned long size, void *data);
-void dri_bo_wait_rendering(dri_bo *bo);
-
-void dri_bufmgr_set_debug(dri_bufmgr *bufmgr, int enable_debug);
-void dri_bufmgr_destroy(dri_bufmgr *bufmgr);
-int dri_bo_exec(dri_bo *bo, int used,
-		drm_clip_rect_t *cliprects, int num_cliprects,
-		int DR4);
-int dri_bufmgr_check_aperture_space(dri_bo **bo_array, int count);
-
-int dri_bo_emit_reloc(dri_bo *reloc_buf,
-		      uint32_t read_domains, uint32_t write_domain,
-		      uint32_t delta, uint32_t offset, dri_bo *target_buf);
-int dri_bo_pin(dri_bo *buf, uint32_t alignment);
-int dri_bo_unpin(dri_bo *buf);
-int dri_bo_set_tiling(dri_bo *buf, uint32_t *tiling_mode);
-int dri_bo_get_tiling(dri_bo *buf, uint32_t *tiling_mode,
-		      uint32_t *swizzle_mode);
-int dri_bo_flink(dri_bo *buf, uint32_t *name);
-
-/* intel_bufmgr_gem.c */
-dri_bufmgr *intel_bufmgr_gem_init(int fd, int batch_size);
-dri_bo *intel_bo_gem_create_from_name(dri_bufmgr *bufmgr, const char *name,
-				      unsigned int handle);
-void intel_bufmgr_gem_enable_reuse(dri_bufmgr *bufmgr);
-
-/* intel_bufmgr_fake.c */
-dri_bufmgr *intel_bufmgr_fake_init(int fd,
-				   unsigned long low_offset, void *low_virtual,
-				   unsigned long size,
-				   volatile unsigned int *last_dispatch);
-void intel_bufmgr_fake_set_last_dispatch(dri_bufmgr *bufmgr,
-					 volatile unsigned int *last_dispatch);
-void intel_bufmgr_fake_set_exec_callback(dri_bufmgr *bufmgr,
-					 int (*exec)(dri_bo *bo,
-						     unsigned int used,
-						     void *priv),
-					 void *priv);
-void intel_bufmgr_fake_set_fence_callback(dri_bufmgr *bufmgr,
-					  unsigned int (*emit)(void *priv),
-					  void (*wait)(unsigned int fence,
-						       void *priv),
-					  void *priv);
-dri_bo *intel_bo_fake_alloc_static(dri_bufmgr *bufmgr, const char *name,
-				   unsigned long offset, unsigned long size,
-				   void *virtual);
-void intel_bo_fake_disable_backing_store(dri_bo *bo,
-					 void (*invalidate_cb)(dri_bo *bo,
-							       void *ptr),
-					 void *ptr);
-
-void intel_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr);
-void intel_bufmgr_fake_evict_all(dri_bufmgr *bufmgr);
+drm_intel_bo *drm_intel_bo_alloc(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);
+int drm_intel_bo_unmap(drm_intel_bo *bo);
+
+int drm_intel_bo_subdata(drm_intel_bo *bo, unsigned long offset,
+		     unsigned long size, const void *data);
+int drm_intel_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
+			 unsigned long size, void *data);
+void drm_intel_bo_wait_rendering(drm_intel_bo *bo);
+
+void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug);
+void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
+int drm_intel_bo_exec(drm_intel_bo *bo, int used,
+		      drm_clip_rect_t *cliprects, int num_cliprects,
+		      int DR4);
+int drm_intel_bufmgr_check_aperture_space(drm_intel_bo **bo_array, int count);
+
+int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
+			    drm_intel_bo *target_bo, uint32_t target_offset,
+			    uint32_t read_domains, uint32_t write_domain);
+int drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment);
+int drm_intel_bo_unpin(drm_intel_bo *bo);
+int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
+			    uint32_t stride);
+int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
+			uint32_t *swizzle_mode);
+int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name);
+
+/* drm_intel_bufmgr_gem.c */
+drm_intel_bufmgr *drm_intel_bufmgr_gem_init(int fd, int batch_size);
+drm_intel_bo *drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
+						const char *name,
+						unsigned int handle);
+void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr);
+
+/* drm_intel_bufmgr_fake.c */
+drm_intel_bufmgr *drm_intel_bufmgr_fake_init(int fd,
+					     unsigned long low_offset,
+					     void *low_virtual,
+					     unsigned long size,
+					     volatile unsigned int *last_dispatch);
+void drm_intel_bufmgr_fake_set_last_dispatch(drm_intel_bufmgr *bufmgr,
+					     volatile unsigned int *last_dispatch);
+void drm_intel_bufmgr_fake_set_exec_callback(drm_intel_bufmgr *bufmgr,
+					     int (*exec)(drm_intel_bo *bo,
+							 unsigned int used,
+							 void *priv),
+					     void *priv);
+void drm_intel_bufmgr_fake_set_fence_callback(drm_intel_bufmgr *bufmgr,
+					      unsigned int (*emit)(void *priv),
+					      void (*wait)(unsigned int fence,
+							   void *priv),
+					      void *priv);
+drm_intel_bo *drm_intel_bo_fake_alloc_static(drm_intel_bufmgr *bufmgr,
+					     const char *name,
+					     unsigned long offset, unsigned long size,
+					     void *virtual);
+void drm_intel_bo_fake_disable_backing_store(drm_intel_bo *bo,
+					     void (*invalidate_cb)(drm_intel_bo *bo,
+								   void *ptr),
+					     void *ptr);
+
+void drm_intel_bufmgr_fake_contended_lock_take(drm_intel_bufmgr *bufmgr);
+void drm_intel_bufmgr_fake_evict_all(drm_intel_bufmgr *bufmgr);
+
+/** @{ Compatibility defines to keep old code building despite the symbol rename
+ * from dri_* to drm_intel_*
+ */
+#define dri_bo drm_intel_bo
+#define dri_bufmgr drm_intel_bufmgr
+#define dri_bo_alloc drm_intel_bo_alloc
+#define dri_bo_reference drm_intel_bo_reference
+#define dri_bo_unreference drm_intel_bo_unreference
+#define dri_bo_map drm_intel_bo_map
+#define dri_bo_unmap drm_intel_bo_unmap
+#define dri_bo_subdata drm_intel_bo_subdata
+#define dri_bo_get_subdata drm_intel_bo_get_subdata
+#define dri_bo_wait_rendering drm_intel_bo_wait_rendering
+#define dri_bufmgr_set_debug drm_intel_bufmgr_set_debug
+#define dri_bufmgr_destroy drm_intel_bufmgr_destroy
+#define dri_bo_exec drm_intel_bo_exec
+#define dri_bufmgr_check_aperture_space drm_intel_bufmgr_check_aperture_space
+#define dri_bo_emit_reloc(reloc_bo, read, write, target_offset,		\
+			  reloc_offset, target_bo)			\
+	drm_intel_bo_emit_reloc(reloc_bo, reloc_offset,			\
+			    target_bo, target_offset,			\
+			    read, write);
+#define dri_bo_pin drm_intel_bo_pin
+#define dri_bo_unpin drm_intel_bo_unpin
+#define dri_bo_get_tiling drm_intel_bo_get_tiling
+#define dri_bo_set_tiling(bo, mode) drm_intel_bo_set_tiling(bo, mode, 0)
+#define dri_bo_flink drm_intel_bo_flink
+#define intel_bufmgr_gem_init drm_intel_bufmgr_gem_init
+#define intel_bo_gem_create_from_name drm_intel_bo_gem_create_from_name
+#define intel_bufmgr_gem_enable_reuse drm_intel_bufmgr_gem_enable_reuse
+#define intel_bufmgr_fake_init drm_intel_bufmgr_fake_init
+#define intel_bufmgr_fake_set_last_dispatch drm_intel_bufmgr_fake_set_last_dispatch
+#define intel_bufmgr_fake_set_exec_callback drm_intel_bufmgr_fake_set_exec_callback
+#define intel_bufmgr_fake_set_fence_callback drm_intel_bufmgr_fake_set_fence_callback
+#define intel_bo_fake_alloc_static drm_intel_bo_fake_alloc_static
+#define intel_bo_fake_disable_backing_store drm_intel_bo_fake_disable_backing_store
+#define intel_bufmgr_fake_contended_lock_take drm_intel_bufmgr_fake_contended_lock_take
+#define intel_bufmgr_fake_evict_all drm_intel_bufmgr_fake_evict_all
+
+/** @{ */
 
 #endif /* INTEL_BUFMGR_H */
 
diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c
index c9545b3..6d8ee85 100644
--- a/libdrm/intel/intel_bufmgr_fake.c
+++ b/libdrm/intel/intel_bufmgr_fake.c
@@ -75,7 +75,7 @@
 struct fake_buffer_reloc
 {
    /** Buffer object that the relocation points at. */
-   dri_bo *target_buf;
+   drm_intel_bo *target_buf;
    /** Offset of the relocation entry within reloc_buf. */
    uint32_t offset;
    /** Cached value of the offset when we last performed this relocation. */
@@ -106,12 +106,12 @@ struct block {
    /** Fence cookie for the block. */
    unsigned fence; /* Split to read_fence, write_fence */
 
-   dri_bo *bo;
+   drm_intel_bo *bo;
    void *virtual;
 };
 
 typedef struct _bufmgr_fake {
-   dri_bufmgr bufmgr;
+   drm_intel_bufmgr bufmgr;
 
    pthread_mutex_t lock;
 
@@ -163,7 +163,7 @@ typedef struct _bufmgr_fake {
     * This allows the driver to hook in a replacement for the DRM usage in
     * bufmgr_fake.
     */
-   int (*exec)(dri_bo *bo, unsigned int used, void *priv);
+   int (*exec)(drm_intel_bo *bo, unsigned int used, void *priv);
    void *exec_priv;
 
    /** Driver-supplied argument to driver callbacks */
@@ -176,10 +176,10 @@ typedef struct _bufmgr_fake {
    int debug;
 
    int performed_rendering;
-} dri_bufmgr_fake;
+} drm_intel_bufmgr_fake;
 
-typedef struct _dri_bo_fake {
-   dri_bo bo;
+typedef struct _drm_intel_bo_fake {
+   drm_intel_bo bo;
 
    unsigned id;			/* debug only */
    const char *name;
@@ -214,11 +214,11 @@ typedef struct _dri_bo_fake {
 
    struct block *block;
    void *backing_store;
-   void (*invalidate_cb)(dri_bo *bo, void *ptr);
+   void (*invalidate_cb)(drm_intel_bo *bo, void *ptr);
    void *invalidate_ptr;
-} dri_bo_fake;
+} drm_intel_bo_fake;
 
-static int clear_fenced(dri_bufmgr_fake *bufmgr_fake,
+static int clear_fenced(drm_intel_bufmgr_fake *bufmgr_fake,
 			unsigned int fence_cookie);
 
 #define MAXFENCE 0x7fffffff
@@ -237,13 +237,13 @@ static int FENCE_LTE( unsigned a, unsigned b )
    return 0;
 }
 
-void intel_bufmgr_fake_set_fence_callback(dri_bufmgr *bufmgr,
-					  unsigned int (*emit)(void *priv),
-					  void (*wait)(unsigned int fence,
-						       void *priv),
-					  void *priv)
+void drm_intel_bufmgr_fake_set_fence_callback(drm_intel_bufmgr *bufmgr,
+					      unsigned int (*emit)(void *priv),
+					      void (*wait)(unsigned int fence,
+							   void *priv),
+					      void *priv)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bufmgr;
 
    bufmgr_fake->fence_emit = emit;
    bufmgr_fake->fence_wait = wait;
@@ -251,7 +251,7 @@ void intel_bufmgr_fake_set_fence_callback(dri_bufmgr *bufmgr,
 }
 
 static unsigned int
-_fence_emit_internal(dri_bufmgr_fake *bufmgr_fake)
+_fence_emit_internal(drm_intel_bufmgr_fake *bufmgr_fake)
 {
    struct drm_i915_irq_emit ie;
    int ret, seq = 1;
@@ -274,7 +274,7 @@ _fence_emit_internal(dri_bufmgr_fake *bufmgr_fake)
 }
 
 static void
-_fence_wait_internal(dri_bufmgr_fake *bufmgr_fake, int seq)
+_fence_wait_internal(drm_intel_bufmgr_fake *bufmgr_fake, int seq)
 {
    struct drm_i915_irq_wait iw;
    int hw_seq, busy_count = 0;
@@ -397,7 +397,7 @@ _fence_wait_internal(dri_bufmgr_fake *bufmgr_fake, int seq)
 }
 
 static int
-_fence_test(dri_bufmgr_fake *bufmgr_fake, unsigned fence)
+_fence_test(drm_intel_bufmgr_fake *bufmgr_fake, unsigned fence)
 {
    /* Slight problem with wrap-around:
     */
@@ -408,10 +408,10 @@ _fence_test(dri_bufmgr_fake *bufmgr_fake, unsigned fence)
  * Allocate a memory manager block for the buffer.
  */
 static int
-alloc_block(dri_bo *bo)
+alloc_block(drm_intel_bo *bo)
 {
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
-   dri_bufmgr_fake *bufmgr_fake= (dri_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake= (drm_intel_bufmgr_fake *)bo->bufmgr;
    struct block *block = (struct block *)calloc(sizeof *block, 1);
    unsigned int align_log2 = ffs(bo_fake->alignment) - 1;
    unsigned int sz;
@@ -444,15 +444,15 @@ alloc_block(dri_bo *bo)
 
 /* Release the card storage associated with buf:
  */
-static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block)
+static void free_block(drm_intel_bufmgr_fake *bufmgr_fake, struct block *block)
 {
-   dri_bo_fake *bo_fake;
+   drm_intel_bo_fake *bo_fake;
    DBG("free block %p %08x %d %d\n", block, block->mem->ofs, block->on_hardware, block->fenced);
 
    if (!block)
       return;
 
-   bo_fake = (dri_bo_fake *)block->bo;
+   bo_fake = (drm_intel_bo_fake *)block->bo;
    if (!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE)) && (bo_fake->card_dirty == 1)) {
      memcpy(bo_fake->backing_store, block->virtual, block->bo->size);
      bo_fake->card_dirty = 0;
@@ -475,10 +475,10 @@ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block)
 }
 
 static void
-alloc_backing_store(dri_bo *bo)
+alloc_backing_store(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
    assert(!bo_fake->backing_store);
    assert(!(bo_fake->flags & (BM_PINNED|BM_NO_BACKING_STORE)));
 
@@ -489,9 +489,9 @@ alloc_backing_store(dri_bo *bo)
 }
 
 static void
-free_backing_store(dri_bo *bo)
+free_backing_store(drm_intel_bo *bo)
 {
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    if (bo_fake->backing_store) {
       assert(!(bo_fake->flags & (BM_PINNED|BM_NO_BACKING_STORE)));
@@ -501,10 +501,10 @@ free_backing_store(dri_bo *bo)
 }
 
 static void
-set_dirty(dri_bo *bo)
+set_dirty(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    if (bo_fake->flags & BM_NO_BACKING_STORE && bo_fake->invalidate_cb != NULL)
       bo_fake->invalidate_cb(bo, bo_fake->invalidate_ptr);
@@ -516,14 +516,14 @@ set_dirty(dri_bo *bo)
 }
 
 static int
-evict_lru(dri_bufmgr_fake *bufmgr_fake, unsigned int max_fence)
+evict_lru(drm_intel_bufmgr_fake *bufmgr_fake, unsigned int max_fence)
 {
    struct block *block, *tmp;
 
    DBG("%s\n", __FUNCTION__);
 
    DRMLISTFOREACHSAFE(block, tmp, &bufmgr_fake->lru) {
-      dri_bo_fake *bo_fake = (dri_bo_fake *)block->bo;
+      drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)block->bo;
 
       if (bo_fake != NULL && (bo_fake->flags & BM_NO_FENCE_SUBDATA))
 	 continue;
@@ -542,14 +542,14 @@ evict_lru(dri_bufmgr_fake *bufmgr_fake, unsigned int max_fence)
 }
 
 static int
-evict_mru(dri_bufmgr_fake *bufmgr_fake)
+evict_mru(drm_intel_bufmgr_fake *bufmgr_fake)
 {
    struct block *block, *tmp;
 
    DBG("%s\n", __FUNCTION__);
 
    DRMLISTFOREACHSAFEREVERSE(block, tmp, &bufmgr_fake->lru) {
-      dri_bo_fake *bo_fake = (dri_bo_fake *)block->bo;
+      drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)block->bo;
 
       if (bo_fake && (bo_fake->flags & BM_NO_FENCE_SUBDATA))
 	 continue;
@@ -567,7 +567,7 @@ evict_mru(dri_bufmgr_fake *bufmgr_fake)
 /**
  * Removes all objects from the fenced list older than the given fence.
  */
-static int clear_fenced(dri_bufmgr_fake *bufmgr_fake,
+static int clear_fenced(drm_intel_bufmgr_fake *bufmgr_fake,
 			unsigned int fence_cookie)
 {
    struct block *block, *tmp;
@@ -611,7 +611,7 @@ static int clear_fenced(dri_bufmgr_fake *bufmgr_fake,
    return ret;
 }
 
-static void fence_blocks(dri_bufmgr_fake *bufmgr_fake, unsigned fence)
+static void fence_blocks(drm_intel_bufmgr_fake *bufmgr_fake, unsigned fence)
 {
    struct block *block, *tmp;
 
@@ -632,10 +632,10 @@ static void fence_blocks(dri_bufmgr_fake *bufmgr_fake, unsigned fence)
    assert(DRMLISTEMPTY(&bufmgr_fake->on_hardware));
 }
 
-static int evict_and_alloc_block(dri_bo *bo)
+static int evict_and_alloc_block(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    assert(bo_fake->block == NULL);
 
@@ -702,7 +702,7 @@ static int evict_and_alloc_block(dri_bo *bo)
  * Wait for hardware idle by emitting a fence and waiting for it.
  */
 static void
-dri_bufmgr_fake_wait_idle(dri_bufmgr_fake *bufmgr_fake)
+drm_intel_bufmgr_fake_wait_idle(drm_intel_bufmgr_fake *bufmgr_fake)
 {
    unsigned int cookie;
 
@@ -717,10 +717,10 @@ dri_bufmgr_fake_wait_idle(dri_bufmgr_fake *bufmgr_fake)
  * the necessary flushing.
  */
 static void
-dri_fake_bo_wait_rendering_locked(dri_bo *bo)
+drm_intel_fake_bo_wait_rendering_locked(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    if (bo_fake->block == NULL || !bo_fake->block->fenced)
       return;
@@ -729,12 +729,12 @@ dri_fake_bo_wait_rendering_locked(dri_bo *bo)
 }
 
 static void
-dri_fake_bo_wait_rendering(dri_bo *bo)
+drm_intel_fake_bo_wait_rendering(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
 
    pthread_mutex_lock(&bufmgr_fake->lock);
-   dri_fake_bo_wait_rendering_locked(bo);
+   drm_intel_fake_bo_wait_rendering_locked(bo);
    pthread_mutex_unlock(&bufmgr_fake->lock);
 }
 
@@ -743,9 +743,9 @@ dri_fake_bo_wait_rendering(dri_bo *bo)
  *  -- and wait for idle
  */
 void
-intel_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr)
+drm_intel_bufmgr_fake_contended_lock_take(drm_intel_bufmgr *bufmgr)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bufmgr;
    struct block *block, *tmp;
 
    pthread_mutex_lock(&bufmgr_fake->lock);
@@ -757,7 +757,7 @@ intel_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr)
     * happening, so we'll need to wait anyway before letting anything get
     * put on the card again.
     */
-   dri_bufmgr_fake_wait_idle(bufmgr_fake);
+   drm_intel_bufmgr_fake_wait_idle(bufmgr_fake);
 
    /* Check that we hadn't released the lock without having fenced the last
     * set of buffers.
@@ -773,14 +773,14 @@ intel_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr)
    pthread_mutex_unlock(&bufmgr_fake->lock);
 }
 
-static dri_bo *
-dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name,
-		  unsigned long size, unsigned int alignment)
+static drm_intel_bo *
+drm_intel_fake_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
+			unsigned long size, unsigned int alignment)
 {
-   dri_bufmgr_fake *bufmgr_fake;
-   dri_bo_fake *bo_fake;
+   drm_intel_bufmgr_fake *bufmgr_fake;
+   drm_intel_bo_fake *bo_fake;
 
-   bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+   bufmgr_fake = (drm_intel_bufmgr_fake *)bufmgr;
 
    assert(size != 0);
 
@@ -810,15 +810,15 @@ dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name,
    return &bo_fake->bo;
 }
 
-dri_bo *
-intel_bo_fake_alloc_static(dri_bufmgr *bufmgr, const char *name,
-			   unsigned long offset, unsigned long size,
-			   void *virtual)
+drm_intel_bo *
+drm_intel_bo_fake_alloc_static(drm_intel_bufmgr *bufmgr, const char *name,
+			       unsigned long offset, unsigned long size,
+			       void *virtual)
 {
-   dri_bufmgr_fake *bufmgr_fake;
-   dri_bo_fake *bo_fake;
+   drm_intel_bufmgr_fake *bufmgr_fake;
+   drm_intel_bo_fake *bo_fake;
 
-   bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+   bufmgr_fake = (drm_intel_bufmgr_fake *)bufmgr;
 
    assert(size != 0);
 
@@ -843,10 +843,10 @@ intel_bo_fake_alloc_static(dri_bufmgr *bufmgr, const char *name,
 }
 
 static void
-dri_fake_bo_reference(dri_bo *bo)
+drm_intel_fake_bo_reference(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    pthread_mutex_lock(&bufmgr_fake->lock);
    bo_fake->refcount++;
@@ -854,18 +854,18 @@ dri_fake_bo_reference(dri_bo *bo)
 }
 
 static void
-dri_fake_bo_reference_locked(dri_bo *bo)
+drm_intel_fake_bo_reference_locked(drm_intel_bo *bo)
 {
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    bo_fake->refcount++;
 }
 
 static void
-dri_fake_bo_unreference_locked(dri_bo *bo)
+drm_intel_fake_bo_unreference_locked(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
    int i;
 
    if (--bo_fake->refcount == 0) {
@@ -876,7 +876,7 @@ dri_fake_bo_unreference_locked(dri_bo *bo)
       free_backing_store(bo);
 
       for (i = 0; i < bo_fake->nr_relocs; i++)
-	 dri_fake_bo_unreference_locked(bo_fake->relocs[i].target_buf);
+	 drm_intel_fake_bo_unreference_locked(bo_fake->relocs[i].target_buf);
 
       DBG("drm_bo_unreference: free buf %d %s\n", bo_fake->id, bo_fake->name);
 
@@ -886,12 +886,12 @@ dri_fake_bo_unreference_locked(dri_bo *bo)
 }
 
 static void
-dri_fake_bo_unreference(dri_bo *bo)
+drm_intel_fake_bo_unreference(drm_intel_bo *bo)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
 
    pthread_mutex_lock(&bufmgr_fake->lock);
-   dri_fake_bo_unreference_locked(bo);
+   drm_intel_fake_bo_unreference_locked(bo);
    pthread_mutex_unlock(&bufmgr_fake->lock);
 }
 
@@ -899,13 +899,13 @@ dri_fake_bo_unreference(dri_bo *bo)
  * Set the buffer as not requiring backing store, and instead get the callback
  * invoked whenever it would be set dirty.
  */
-void intel_bo_fake_disable_backing_store(dri_bo *bo,
-					 void (*invalidate_cb)(dri_bo *bo,
-							       void *ptr),
-					 void *ptr)
+void drm_intel_bo_fake_disable_backing_store(drm_intel_bo *bo,
+					     void (*invalidate_cb)(drm_intel_bo *bo,
+								   void *ptr),
+					     void *ptr)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    pthread_mutex_lock(&bufmgr_fake->lock);
 
@@ -934,15 +934,15 @@ void intel_bo_fake_disable_backing_store(dri_bo *bo,
  * BM_NO_BACKING_STORE or BM_PINNED) or backing store, as necessary.
  */
 static int
-dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
+drm_intel_fake_bo_map_locked(drm_intel_bo *bo, int write_enable)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
-   dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)bo;
 
    /* Static buffers are always mapped. */
    if (bo_fake->is_static) {
       if (bo_fake->card_dirty) {
-         dri_bufmgr_fake_wait_idle(bufmgr_fake);
+         drm_intel_bufmgr_fake_wait_idle(bufmgr_fake);
          bo_fake->card_dirty = 0;
       }
       return 0;
@@ -976,7 +976,7 @@ dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
 
 	    if (!(bo_fake->flags & BM_NO_FENCE_SUBDATA) &&
 		bo_fake->block->fenced) {
-	       dri_fake_bo_wait_rendering_locked(bo);
+	       drm_intel_fake_bo_wait_rendering_locked(bo);
 	    }
 
 	    bo->virtual = bo_fake->block->virtual;
@@ -991,7 +991,7 @@ dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
 
          if ((bo_fake->card_dirty == 1) && bo_fake->block) {
             if (bo_fake->block->fenced)
-               dri_fake_bo_wait_rendering_locked(bo);
+               drm_intel_fake_bo_wait_rendering_locked(bo);
 
             memcpy(bo_fake->backing_store, bo_fake->block->virtual, bo_fake->block->bo->size);
             bo_fake->card_dirty = 0;
@@ -1005,23 +1005,23 @@ dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
 }
 
 static int
-dri_fake_bo_map(dri_bo *bo, int write_enable)
+drm_intel_fake_bo_map(drm_intel_bo *bo, int write_enable)
 {
-   dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
+   drm_intel_bufmgr_fake *bufmgr_fake = (drm_intel_bufmgr_fake *)bo->bufmgr;


Reply to: