summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2002-05-29file mga_dma.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file mga_drv.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file mga_state.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file mga_ucode.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file mga_warp.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file r128.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file r128_cce.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file r128_drv.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file r128_state.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file radeon.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file radeon_cp.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file radeon_drv.h was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-29file radeon_state.c was initially added on branch bsd-3-0-0-branch.Eric Anholt
2002-05-17Remove some older Linux 2.3.99 codeAlan Hourihane
2002-05-17same udelay fixesAlan Hourihane
2002-05-16Allow drm to build under 2.4 and 2.5(.14)Keith Whitwell
2002-04-09Merged drmcommand-0-0-1Jens Owen
2002-03-29file xf86drmCompat.c was initially added on branch drmcommand-0-0-1-branch.Jens Owen
2002-03-18file trident_drv.c was initially added on branch trident-0-0-1-branch.Alan Hourihane
2002-03-18file trident.h was initially added on branch trident-0-0-1-branch.Alan Hourihane
2002-03-11fixups for *BSDAlan Hourihane
2002-03-08Fix backwards compatibility bug, add tests for good numbers ofKeith Whitwell
2002-03-08missing fileAlan Hourihane
2002-03-06fixup the radeon driver (not tested)Alan Hourihane
2002-03-06i830 & mga contain minor changes from 4.2.0 for mesa 4.0 bsd mergeAlan Hourihane
2002-03-06first pass at merging mesa 4.0 kernel drivers into new bsd-3-0-0 branch.Alan Hourihane
2002-02-14First pass of mesa-4-0 branch merge into trunk.David Dawes
2002-02-02wrapper for ioremap_nocache() like for ioremap() (Paul Mundt)Michel Daenzer
2002-01-27First pass merge of XFree86 4.2.0 import.David Dawes
2002-01-27Import of XFree86 4.2.0David Dawes
2002-01-27Initial revisionDavid Dawes
2001-12-10merge with linux kernel 2.4.15Alan Hourihane
2001-11-27Put back i810 major version number (same reasons as for r128)Keith Whitwell
2001-11-26Put drm version back from 3.0 to 2.2; XFree86 4.1 is the baseline forKeith Whitwell
2001-11-02wrap the MODULE_LICENSE definition.Alan Hourihane
2001-10-22merge kernel 2.4.13-pre6.Alan Hourihane
2001-10-21file mach64.h was initially added on branch mach64-0-0-2-branch.Manuel Teira
2001-10-08commit Abraham vd Merwe fix.Alan Hourihane
2001-09-25merge with 2.4.10 kernelAlan Hourihane
2001-09-18remove Linux 2.3.x cruft.Alan Hourihane
2001-09-17bumped the DRM versions (already done in ddx and client side drivers).Alan Hourihane
2001-09-17Use CCE for 2D acceleration (Gerd Knorr)Alan Hourihane
2001-08-25- Remove the rest of the unneeded client-side libraries.David Dawes
2001-08-24file convert.c was initially added on branch bsd-2-0-0-branch.Alan Hourihane
2001-08-22First part of XFree86 4.1.99.1 merge.David Dawes
2001-08-22Import of XFree86 4.1.99.1David Dawes
2001-08-21file drm_ioctl_table.h was initially added on branch mesa-3-5-branch.Jeff Hartmann
2001-08-19No one's maintaining 2.2.x support - so remove all the cruft.Alan Hourihane
2001-08-14A few warning fixes when actually building under 2.4.9-pre2 + someJeff Hartmann
2001-08-13Sync with Linus 2.4.9-pre2 + make all nopage routines more alikeJeff Hartmann
l ppc">#include "i915_drv.h" struct drm_ttm_backend *i915_create_ttm_backend_entry(struct drm_device *dev) { return drm_agp_init_ttm(dev); } int i915_fence_type(struct drm_buffer_object *bo, uint32_t *fclass, uint32_t *type) { if (bo->mem.proposed_flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE)) *type = 3; else *type = 1; return 0; } int i915_invalidate_caches(struct drm_device *dev, uint64_t flags) { /* * FIXME: Only emit once per batchbuffer submission. */ uint32_t flush_cmd = MI_NO_WRITE_FLUSH; if (flags & DRM_BO_FLAG_READ) flush_cmd |= MI_READ_FLUSH; if (flags & DRM_BO_FLAG_EXE) flush_cmd |= MI_EXE_FLUSH; return i915_emit_mi_flush(dev, flush_cmd); } int i915_init_mem_type(struct drm_device *dev, uint32_t type, struct drm_mem_type_manager *man) { switch (type) { case DRM_BO_MEM_LOCAL: man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE | _DRM_FLAG_MEMTYPE_CACHED; man->drm_bus_maptype = 0; man->gpu_offset = 0; break; case DRM_BO_MEM_TT: if (!(drm_core_has_AGP(dev) && dev->agp)) { DRM_ERROR("AGP is not enabled for memory type %u\n", (unsigned)type); return -EINVAL; } man->io_offset = dev->agp->agp_info.aper_base; man->io_size = dev->agp->agp_info.aper_size * 1024 * 1024; man->io_addr = NULL; man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE | _DRM_FLAG_MEMTYPE_CSELECT | _DRM_FLAG_NEEDS_IOREMAP; man->drm_bus_maptype = _DRM_AGP; man->gpu_offset = 0; break; case DRM_BO_MEM_VRAM: if (!(drm_core_has_AGP(dev) && dev->agp)) { DRM_ERROR("AGP is not enabled for memory type %u\n", (unsigned)type); return -EINVAL; } man->io_offset = dev->agp->agp_info.aper_base; man->io_size = dev->agp->agp_info.aper_size * 1024 * 1024; man->io_addr = NULL; man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE | _DRM_FLAG_MEMTYPE_FIXED | _DRM_FLAG_NEEDS_IOREMAP; man->drm_bus_maptype = _DRM_AGP; man->gpu_offset = 0; break; case DRM_BO_MEM_PRIV0: /* for OS preallocated space */ DRM_ERROR("PRIV0 not used yet.\n"); break; default: DRM_ERROR("Unsupported memory type %u\n", (unsigned)type); return -EINVAL; } return 0; } /* * i915_evict_flags: * * @bo: the buffer object to be evicted * * Return the bo flags for a buffer which is not mapped to the hardware. * These will be placed in proposed_flags so that when the move is * finished, they'll end up in bo->mem.flags */ uint64_t i915_evict_flags(struct drm_buffer_object *bo) { switch (bo->mem.mem_type) { case DRM_BO_MEM_LOCAL: case DRM_BO_MEM_TT: return DRM_BO_FLAG_MEM_LOCAL; default: return DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_CACHED; } } #if 0 /* See comment below */ static void i915_emit_copy_blit(struct drm_device * dev, uint32_t src_offset, uint32_t dst_offset, uint32_t pages, int direction) { uint32_t cur_pages; uint32_t stride = PAGE_SIZE; struct drm_i915_private *dev_priv = dev->dev_private; RING_LOCALS; if (!dev_priv) return; i915_kernel_lost_context(dev); while (pages > 0) { cur_pages = pages; if (cur_pages > 2048) cur_pages = 2048; pages -= cur_pages; BEGIN_LP_RING(6); OUT_RING(SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB); OUT_RING((stride & 0xffff) | (0xcc << 16) | (1 << 24) | (1 << 25) | (direction ? (1 << 30) : 0)); OUT_RING((cur_pages << 16) | PAGE_SIZE); OUT_RING(dst_offset); OUT_RING(stride & 0xffff); OUT_RING(src_offset); ADVANCE_LP_RING(); } return; } static int i915_move_blit(struct drm_buffer_object * bo, int evict, int no_wait, struct drm_bo_mem_reg * new_mem) { struct drm_bo_mem_reg *old_mem = &bo->mem; int dir = 0; if ((old_mem->mem_type == new_mem->mem_type) && (new_mem->mm_node->start < old_mem->mm_node->start + old_mem->mm_node->size)) { dir = 1; } i915_emit_copy_blit(bo->dev, old_mem->mm_node->start << PAGE_SHIFT, new_mem->mm_node->start << PAGE_SHIFT, new_mem->num_pages, dir); i915_emit_mi_flush(bo->dev, MI_READ_FLUSH | MI_EXE_FLUSH); return drm_bo_move_accel_cleanup(bo, evict, no_wait, 0, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, DRM_I915_FENCE_FLAG_FLUSHED, new_mem); } /* * Flip destination ttm into cached-coherent AGP, * then blit and subsequently move out again. */ static int i915_move_flip(struct drm_buffer_object * bo, int evict, int no_wait, struct drm_bo_mem_reg * new_mem) { struct drm_device *dev = bo->dev; struct drm_bo_mem_reg tmp_mem; int ret; tmp_mem = *new_mem; tmp_mem.mm_node = NULL; tmp_mem.mask = DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_CACHED | DRM_BO_FLAG_FORCE_CACHING; ret = drm_bo_mem_space(bo, &tmp_mem, no_wait); if (ret) return ret; ret = drm_bind_ttm(bo->ttm, &tmp_mem); if (ret) goto out_cleanup; ret = i915_move_blit(bo, 1, no_wait, &tmp_mem); if (ret) goto out_cleanup; ret = drm_bo_move_ttm(bo, evict, no_wait, new_mem); out_cleanup: if (tmp_mem.mm_node) { mutex_lock(&dev->struct_mutex); if (tmp_mem.mm_node != bo->pinned_node) drm_mm_put_block(tmp_mem.mm_node); tmp_mem.mm_node = NULL; mutex_unlock(&dev->struct_mutex); } return ret; } #endif /* * Disable i915_move_flip for now, since we can't guarantee that the hardware * lock is held here. To re-enable we need to make sure either * a) The X server is using DRM to submit commands to the ring, or * b) DRM can use the HP ring for these blits. This means i915 needs to * implement a new ring submission mechanism and fence class. */ int i915_move(struct drm_buffer_object *bo, int evict, int no_wait, struct drm_bo_mem_reg *new_mem) { struct drm_bo_mem_reg *old_mem = &bo->mem; if (old_mem->mem_type == DRM_BO_MEM_LOCAL) { return drm_bo_move_memcpy(bo, evict, no_wait, new_mem); } else if (new_mem->mem_type == DRM_BO_MEM_LOCAL) { if (1) /*i915_move_flip(bo, evict, no_wait, new_mem)*/ return drm_bo_move_memcpy(bo, evict, no_wait, new_mem); } else { if (1) /*i915_move_blit(bo, evict, no_wait, new_mem)*/ return drm_bo_move_memcpy(bo, evict, no_wait, new_mem); } return 0; } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) static inline void clflush(volatile void *__p) { asm volatile("clflush %0" : "+m" (*(char __force *)__p)); } #endif static inline void drm_cache_flush_addr(void *virt) { #ifdef cpu_has_clflush int i; for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) clflush(virt+i); #endif } static inline void drm_cache_flush_page(struct page *p) { drm_cache_flush_addr(page_address(p)); } void i915_flush_ttm(struct drm_ttm *ttm) { int i; if (!ttm) return; DRM_MEMORYBARRIER(); #ifdef CONFIG_X86_32 #ifndef cpu_has_clflush #define cpu_has_clflush 0 #endif /* Hopefully nobody has built an x86-64 processor without clflush */ if (!cpu_has_clflush) { wbinvd(); DRM_MEMORYBARRIER(); return; } #endif for (i = ttm->num_pages - 1; i >= 0; i--) drm_cache_flush_page(drm_ttm_get_page(ttm, i)); DRM_MEMORYBARRIER(); }