summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 10:24:48 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 10:24:48 +0200
commit7058d06317e17253d874bf4df7b09d0d52a5fd74 (patch)
treedd48a7b248b12b6bc32266f6cdf34a4d0c48587a
parentb81ca5e031b2fbd9c5c401057c72f5857f7f5a3a (diff)
Initial i915 buffer object driver
-rw-r--r--linux-core/Makefile.kernel3
-rw-r--r--linux-core/drm_agpsupport.c4
-rw-r--r--linux-core/i915_buffer.c40
-rw-r--r--linux-core/i915_drv.c8
-rw-r--r--shared-core/i915_drv.h7
5 files changed, 59 insertions, 3 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index bf5221d1..e571f29e 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -19,7 +19,8 @@ r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o
mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
i810-objs := i810_drv.o i810_dma.o
i830-objs := i830_drv.o i830_dma.o i830_irq.o
-i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o
+i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o \
+ i915_buffer.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
sis-objs := sis_drv.o sis_mm.o
ffb-objs := ffb_drv.o ffb_context.o
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 92868005..e7226f1f 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -682,7 +682,7 @@ drm_ttm_backend_t *drm_agp_init_ttm_uncached(struct drm_device *dev) {
agp_be->destroy = drm_agp_destroy_ttm;
return agp_be;
}
-
+EXPORT_SYMBOL(drm_agp_init_ttm_uncached);
drm_ttm_backend_t *drm_agp_init_ttm_cached(struct drm_device *dev) {
@@ -715,6 +715,6 @@ drm_ttm_backend_t *drm_agp_init_ttm_cached(struct drm_device *dev) {
agp_be->destroy = drm_agp_destroy_ttm;
return agp_be;
}
-
+EXPORT_SYMBOL(drm_agp_init_ttm_cached);
#endif /* __OS_HAS_AGP */
diff --git a/linux-core/i915_buffer.c b/linux-core/i915_buffer.c
new file mode 100644
index 00000000..bedbd41c
--- /dev/null
+++ b/linux-core/i915_buffer.c
@@ -0,0 +1,40 @@
+/**************************************************************************
+ *
+ * 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 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.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+/*
+ * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ */
+
+#include "drmP.h"
+
+drm_ttm_backend_t *i915_create_ttm_backend_entry(drm_device_t *dev, int cached)
+{
+ if (cached)
+ return drm_agp_init_ttm_cached(dev);
+ else
+ return drm_agp_init_ttm_uncached(dev);
+}
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 56ac5fc7..64ab3f50 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -48,6 +48,12 @@ static drm_fence_driver_t i915_fence_driver = {
.poke_flush = i915_poke_flush,
};
+static drm_bo_driver_t i915_bo_driver = {
+ .cached_pages = 1,
+ .create_ttm_backend_entry = i915_create_ttm_backend_entry
+};
+
+
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
/* don't use mtrr's here, the Xserver or user space app should
@@ -89,6 +95,8 @@ static struct drm_driver driver = {
},
.fence_driver = &i915_fence_driver,
+ .bo_driver = &i915_bo_driver,
+
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h
index 475ff474..403124c9 100644
--- a/shared-core/i915_drv.h
+++ b/shared-core/i915_drv.h
@@ -53,6 +53,7 @@
#if defined(__linux__)
#define I915_HAVE_FENCE
+#define I915_HAVE_BUFFER
#endif
typedef struct _drm_i915_ring_buffer {
@@ -153,6 +154,12 @@ extern void i915_poke_flush(drm_device_t *dev);
extern void i915_sync_flush(drm_device_t *dev);
#endif
+#ifdef I915_HAVE_BUFFER
+/* i915_buffer.c */
+extern drm_ttm_backend_t *i915_create_ttm_backend_entry(drm_device_t *dev,
+ int cached);
+#endif
+
#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
#define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg))