Initial i915 buffer object driver

This commit is contained in:
Thomas Hellstrom 2006-08-22 10:24:48 +02:00
parent b81ca5e031
commit 7058d06317
5 changed files with 59 additions and 3 deletions

View file

@ -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

View file

@ -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 */

40
linux-core/i915_buffer.c Normal file
View file

@ -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);
}

View file

@ -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,

View file

@ -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))