diff options
author | Michael Fitzpatrick <leahcim@gentoo.org> | 2003-04-22 03:48:29 +0000 |
---|---|---|
committer | Michael Fitzpatrick <leahcim@gentoo.org> | 2003-04-22 03:48:29 +0000 |
commit | 8fbb4cb07218411e8ff84f6945fee7ce6dc3fdf2 (patch) | |
tree | 31b28de618e7d860adcb78518a8cf78f177eb4d8 /x11-base/xfree-drm | |
parent | new rev to fix bug #19183 and a couple of other bugs (lsmod not working as us... (diff) | |
download | historical-8fbb4cb07218411e8ff84f6945fee7ce6dc3fdf2.tar.gz historical-8fbb4cb07218411e8ff84f6945fee7ce6dc3fdf2.tar.bz2 historical-8fbb4cb07218411e8ff84f6945fee7ce6dc3fdf2.zip |
Combine x86 and ppc builds. Add radeon suspend/resume patch.
Diffstat (limited to 'x11-base/xfree-drm')
6 files changed, 756 insertions, 1 deletions
diff --git a/x11-base/xfree-drm/ChangeLog b/x11-base/xfree-drm/ChangeLog index 5287cf70da24..f5c169273a78 100644 --- a/x11-base/xfree-drm/ChangeLog +++ b/x11-base/xfree-drm/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for x11-base/xfree-drm # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree-drm/ChangeLog,v 1.15 2003/04/21 10:17:21 seemant Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree-drm/ChangeLog,v 1.16 2003/04/22 03:48:29 leahcim Exp $ + +*xfree-drm-4.3.0-r2 (22 Apr 2003) + + 22 Apr 2003; Michael Fitzpatrick <leahcim@gentoo.org> + xfree-drm-4.3.0-r2.ebuild, files/digest-xfree-drm-4.3.0-r2, + files/xfree-drm-4.3.0-r2-gentoo-Makefile-fixup.patch, + files/xfree-drm-4.3.0-r2-radeon-resume-v8.patch : + Combine x86 and ppc builds. Added "radeon resume/suspend" patch. 24 Mar 2003; Martin Schlemmer <azarah@gentoo.org> xfree-drm-4.3.0.ebuild : Update to rather use the "more official" DRM sources from diff --git a/x11-base/xfree-drm/files/digest-xfree-drm-4.3.0-r2 b/x11-base/xfree-drm/files/digest-xfree-drm-4.3.0-r2 new file mode 100644 index 000000000000..605ea6f3a481 --- /dev/null +++ b/x11-base/xfree-drm/files/digest-xfree-drm-4.3.0-r2 @@ -0,0 +1 @@ +MD5 34515784c7b67f6cc9169aa9eed982c7 linux-drm-4.3.0-kernelsource-20030306.tar.gz 201035 diff --git a/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-drm-ioremap.patch b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-drm-ioremap.patch new file mode 100644 index 000000000000..f6612bb0589b --- /dev/null +++ b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-drm-ioremap.patch @@ -0,0 +1,324 @@ +diff -u drm/drmold/drmP.h drm/drmP.h +--- drm/drmold/drmP.h 2003-04-20 21:16:27.000000000 +0100 ++++ drm/drmP.h 2003-04-20 21:17:27.000000000 +0100 +@@ -249,6 +249,15 @@ + DRM(ioremapfree)( (map)->handle, (map)->size ); \ + } while (0) + ++#define DRM_IOREMAPAGP(map, dev) \ ++ (map)->handle = DRM(ioremap_agp)( (map)->offset, (map)->size, (dev) ) ++ ++#define DRM_IOREMAPAGPFREE(map) \ ++ do { \ ++ if ( (map)->handle && (map)->size ) \ ++ DRM(ioremap_agp_free)( (map)->handle, (map)->size ); \ ++ } while (0) ++ + #define DRM_FIND_MAP(_map, _o) \ + do { \ + struct list_head *_list; \ +@@ -705,6 +714,9 @@ + extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); + extern void DRM(ioremapfree)(void *pt, unsigned long size); + ++extern void *DRM(ioremap_agp)(unsigned long offset, unsigned long size, drm_device_t *dev); ++extern void DRM(ioremap_agp_free)(void *pt, unsigned long size); ++ + #if __REALLY_HAVE_AGP + extern agp_memory *DRM(alloc_agp)(int pages, u32 type); + extern int DRM(free_agp)(agp_memory *handle, int pages); +Only in drm/: drmP.h~ +diff -u drm/drmold/drm_memory.h drm/drm_memory.h +--- drm/drmold/drm_memory.h 2003-04-20 21:16:27.000000000 +0100 ++++ drm/drm_memory.h 2003-04-20 21:17:27.000000000 +0100 +@@ -314,6 +314,109 @@ + return pt; + } + ++#ifdef CONFIG_ALL_PPC ++/* PPC specific routine used by ioremap_agp, to be replaced by some ++ * more generic implementation ++ */ ++extern int map_page(unsigned long va, unsigned long pa, int flags); ++ ++void *DRM(ioremap_agp)(unsigned long offset, unsigned long size, drm_device_t *dev) ++{ ++ void *pt; ++ struct vm_struct *area; ++ struct drm_agp_mem *agpmem; ++ unsigned int flags = _PAGE_NO_CACHE|_PAGE_KERNEL|_PAGE_PRESENT|_PAGE_RW|_PAGE_DIRTY; ++ int err, i; ++ ++ printk("drm: ioremap_agp, offset: 0x%08lx, size: 0x%08lx\n", offset, size); ++ ++#if __REALLY_HAVE_AGP ++ if (!size) { ++ DRM_MEM_ERROR(DRM_MEM_MAPPINGS, ++ "Mapping 0 bytes at 0x%08lx\n", offset); ++ return NULL; ++ } ++ ++ if (!dev->agp || !dev->agp->cant_use_aperture) ++ return DRM(ioremap)(offset, size); ++ ++ /* XXX This has to be changed into something more generic ++ * this implementation is really only valid on PPC ++ */ ++ area = get_vm_area(size, VM_IOREMAP); ++ if (area == 0) { ++ spin_lock(&DRM(mem_lock)); ++ ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; ++ spin_unlock(&DRM(mem_lock)); ++ printk("->NULL\n"); ++ return NULL; ++ } ++ pt = (void *)VMALLOC_VMADDR(area->addr); ++ err = 0; ++ for (i = 0; i < size && err == 0; i += PAGE_SIZE) { ++ unsigned long baddr = offset + i; ++ unsigned long index; ++ ++ /* ++ * It's AGP memory - find the real physical page to map ++ */ ++ for(agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { ++ if (agpmem->bound <= baddr && ++ agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) ++ break; ++ } ++ if (!agpmem) { ++ printk("drm: not matching AGP page in ioremap_agp\n"); ++ err = 1; ++ break; ++ } ++ index = (baddr - agpmem->bound) >> PAGE_SHIFT; ++ err = map_page(((unsigned long)pt)+i, agpmem->memory->memory[index], flags); ++ } ++ if (err) { ++ vfree((void *)pt); ++ spin_lock(&DRM(mem_lock)); ++ ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; ++ spin_unlock(&DRM(mem_lock)); ++ printk("->NULL\n"); ++ return NULL; ++ } ++ ++ spin_lock(&DRM(mem_lock)); ++ ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; ++ DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; ++ spin_unlock(&DRM(mem_lock)); ++ printk("->pt=0x%p\n", pt); ++ return pt; ++#else ++ return NULL; ++#endif ++} ++ ++void DRM(ioremap_agp_free)(void *pt, unsigned long size) ++{ ++ int alloc_count; ++ int free_count; ++ ++ if (!pt) ++ DRM_MEM_ERROR(DRM_MEM_MAPPINGS, ++ "Attempt to free NULL pointer\n"); ++ else ++ vfree(pt); ++ ++ spin_lock(&DRM(mem_lock)); ++ DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size; ++ free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count; ++ alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; ++ spin_unlock(&DRM(mem_lock)); ++ if (free_count > alloc_count) { ++ DRM_MEM_ERROR(DRM_MEM_MAPPINGS, ++ "Excess frees: %d frees, %d allocs\n", ++ free_count, alloc_count); ++ } ++} ++#endif /* CONFIG_ALL_PPC */ ++ + void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) + { + void *pt; +diff -u drm/drmold/drm_vm.h drm/drm_vm.h +--- drm/drmold/drm_vm.h 2003-04-20 21:16:27.000000000 +0100 ++++ drm/drm_vm.h 2003-04-20 21:17:27.000000000 +0100 +@@ -381,7 +381,16 @@ + + if ( !priv->authenticated ) return -EACCES; + +- if (!VM_OFFSET(vma)) return DRM(mmap_dma)(filp, vma); ++ /* We check for "dma". On Apple's UniNorth, it's valid to have ++ * the AGP mapped at physical address 0 ++ * --BenH. ++ */ ++ if (!VM_OFFSET(vma) ++#if __REALLY_HAVE_AGP ++ && (!dev->agp || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE) ++#endif ++ ) ++ return DRM(mmap_dma)(filp, vma); + + /* A sequential search of a linked list is + fine here because: 1) there will only be +@@ -420,18 +429,25 @@ + } + + switch (map->type) { ++#if __REALLY_HAVE_AGP + case _DRM_AGP: +-#if defined(__alpha__) +- /* +- * On Alpha we can't talk to bus dma address from the +- * CPU, so for memory of type DRM_AGP, we'll deal with +- * sorting out the real physical pages and mappings +- * in nopage() +- */ +- vma->vm_ops = &DRM(vm_ops); +- break; +-#endif ++ if (!dev->agp) ++ return -ENODEV; ++ if (dev->agp->cant_use_aperture) { ++ /* ++ * On Alpha we can't talk to bus dma address from the ++ * CPU, so for memory of type DRM_AGP, we'll deal with ++ * sorting out the real physical pages and mappings ++ * in nopage() ++ */ ++#if defined(__powerpc__) ++ pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; ++#endif ++ vma->vm_ops = &DRM(vm_ops); ++ break; ++ } + /* fall through to _DRM_FRAME_BUFFER... */ ++#endif /*__REALLY_HAVE_AGP */ + case _DRM_FRAME_BUFFER: + case _DRM_REGISTERS: + if (VM_OFFSET(vma) >= __pa(high_memory)) { +Only in drm/: drmold +diff -u drm/drmold/r128_cce.c drm/r128_cce.c +--- drm/drmold/r128_cce.c 2003-04-20 21:16:27.000000000 +0100 ++++ drm/r128_cce.c 2003-04-20 21:17:27.000000000 +0100 +@@ -109,6 +109,10 @@ + } + #endif + ++#if __REALLY_HAVE_AGP && defined(CONFIG_ALL_PPC) ++extern unsigned long agp_special_page; ++#endif ++ + + /* ================================================================ + * Engine, FIFO control +@@ -339,6 +343,14 @@ + SET_RING_HEAD( &dev_priv->ring, 0 ); + + if ( !dev_priv->is_pci ) { ++#if __REALLY_HAVE_AGP && defined(CONFIG_ALL_PPC) ++ if (_machine == _MACH_Pmac) { ++ dev_priv->ring.head = (__volatile__ u32 *) agp_special_page; ++ SET_RING_HEAD( &dev_priv->ring, 0 ); ++ R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, ++ __pa( dev_priv->ring.head ) ); ++ } else ++#endif + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { +@@ -540,9 +552,15 @@ + init->sarea_priv_offset); + + if ( !dev_priv->is_pci ) { ++#ifdef CONFIG_ALL_PPC ++ DRM_IOREMAPAGP( dev_priv->cce_ring, dev ); ++ DRM_IOREMAPAGP( dev_priv->ring_rptr, dev ); ++ DRM_IOREMAPAGP( dev_priv->buffers, dev ); ++#else + DRM_IOREMAP( dev_priv->cce_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); ++#endif + if(!dev_priv->cce_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { +@@ -618,9 +636,15 @@ + #if __REALLY_HAVE_SG + if ( !dev_priv->is_pci ) { + #endif ++#ifdef CONFIG_ALL_PPC ++ DRM_IOREMAPAGPFREE( dev_priv->cce_ring ); ++ DRM_IOREMAPAGPFREE( dev_priv->ring_rptr ); ++ DRM_IOREMAPAGPFREE( dev_priv->buffers ); ++#else + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); ++#endif + #if __REALLY_HAVE_SG + } else { + if (!DRM(ati_pcigart_cleanup)( dev, +diff -u drm/drmold/radeon_cp.c drm/radeon_cp.c +--- drm/drmold/radeon_cp.c 2003-04-20 21:16:27.000000000 +0100 ++++ drm/radeon_cp.c 2003-04-20 21:18:12.000000000 +0100 +@@ -36,7 +36,10 @@ + + #define RADEON_FIFO_DEBUG 0 + +- ++#if __REALLY_HAVE_AGP && defined(CONFIG_ALL_PPC) ++extern unsigned long agp_special_page; ++#endif ++ + + /* CP microcode (from ATI) */ + static u32 R200_cp_microcode[][2] = { +@@ -889,6 +892,14 @@ + dev_priv->ring.tail = cur_read_ptr; + + if ( !dev_priv->is_pci ) { ++#if __REALLY_HAVE_AGP && defined(CONFIG_ALL_PPC) ++ if (_machine == _MACH_Pmac) { ++ dev_priv->ring.head = (__volatile__ u32 *) agp_special_page; ++ SET_RING_HEAD( &dev_priv->ring, cur_read_ptr ); ++ RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, ++ __pa( dev_priv->ring.head ) ); ++ } else ++#endif + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { +@@ -1142,9 +1153,15 @@ + init->sarea_priv_offset); + + if ( !dev_priv->is_pci ) { ++#ifdef CONFIG_ALL_PPC ++ DRM_IOREMAPAGP( dev_priv->cp_ring, dev ); ++ DRM_IOREMAPAGP( dev_priv->ring_rptr, dev ); ++ DRM_IOREMAPAGP( dev_priv->buffers, dev ); ++#else + DRM_IOREMAP( dev_priv->cp_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); ++#endif + if(!dev_priv->cp_ring->handle || + !dev_priv->ring_rptr->handle || + !dev_priv->buffers->handle) { +@@ -1263,9 +1280,15 @@ + drm_radeon_private_t *dev_priv = dev->dev_private; + + if ( !dev_priv->is_pci ) { ++#ifdef CONFIG_ALL_PPC ++ DRM_IOREMAPAGPFREE( dev_priv->cp_ring ); ++ DRM_IOREMAPAGPFREE( dev_priv->ring_rptr ); ++ DRM_IOREMAPAGPFREE( dev_priv->buffers ); ++#else + DRM_IOREMAPFREE( dev_priv->cp_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); ++#endif + } else { + #if __REALLY_HAVE_SG + if (!DRM(ati_pcigart_cleanup)( dev, diff --git a/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-gentoo-Makefile-fixup.patch b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-gentoo-Makefile-fixup.patch new file mode 100644 index 000000000000..15e616aec0f2 --- /dev/null +++ b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-gentoo-Makefile-fixup.patch @@ -0,0 +1,50 @@ +--- Makefile.linux.orig 2003-04-21 21:25:07.000000000 +0100 ++++ Makefile.linux 2003-04-21 21:32:23.000000000 +0100 +@@ -155,20 +155,23 @@ + ifeq ($(AGP),1) + MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE + DRMTEMPLATES += drm_agpsupport.h +-MODS += mga.o + ifeq ($(MACHINE),i386) ++MODS += mga.o ++MODS += sis.o + MODS += i810.o + MODS += i830.o + endif + ifeq ($(MACHINE),i686) ++MODS += mga.o ++MODS += sis.o + MODS += i810.o + MODS += i830.o + endif + + MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o +-MGAHEADERS = mga.h mga_drv.h mga_drm.h $(DRMHEADERS) $(DRMTEMPLATES) ++MGAHEADERS = mga.h mga_drv.h mga_drm.h mga_ucode.h $(DRMHEADERS) $(DRMTEMPLATES) + MGASHARED = mga.h mga_dma.c mga_drm.h mga_drv.h mga_state.c \ +- mga_ucode.h mga_warp.c ++ mga_ucode.h mga_warp.c mga_irq.c + + I810OBJS = i810_drv.o i810_dma.o + I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) +@@ -186,7 +189,6 @@ + endif + + +-MODS += sis.o + + SISOBJS= sis_drv.o sis_mm.o sis_ds.o + SISHEADERS= sis_drv.h sis_drm.h $(DRMHEADERS) +@@ -300,6 +302,12 @@ + $(I830OBJS): $(I830HEADERS) + endif + ++install: $(MODS) ++ install -d -m 0755 $(DESTDIR)/lib/modules/$(KV)/kernel/drivers/char/drm ++ @for i in $(MODS); do \ ++ install -m 0755 $$i $(DESTDIR)/lib/modules/$(KV)/kernel/drivers/char/drm; \ ++ done ++ + clean cleandir:: + rm -f *.o *.a *~ core + @for i in $(SHAREDSRC); do \ diff --git a/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-radeon-resume-v8.patch b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-radeon-resume-v8.patch new file mode 100644 index 000000000000..8911645e25f0 --- /dev/null +++ b/x11-base/xfree-drm/files/xfree-drm-4.3.0-r2-radeon-resume-v8.patch @@ -0,0 +1,248 @@ +Index: os-support/shared/drm/kernel/radeon.h +=================================================================== +RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon.h,v +retrieving revision 1.1 +diff -u -r1.1 radeon.h +--- os-support/shared/drm/kernel/radeon.h 2002/10/30 12:52:41 1.1 ++++ os-support/shared/drm/kernel/radeon.h 2003/02/07 23:56:52 +@@ -85,6 +85,7 @@ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ ++ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESUME)] = { radeon_cp_resume, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ +Index: os-support/shared/drm/kernel/radeon_cp.c +=================================================================== +RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_cp.c,v +retrieving revision 1.5 +diff -u -r1.5 radeon_cp.c +--- os-support/shared/drm/kernel/radeon_cp.c 2003/02/04 01:48:38 1.5 ++++ os-support/shared/drm/kernel/radeon_cp.c 2003/02/07 23:56:53 +@@ -1283,6 +1283,177 @@ + return 0; + } + ++/* This code will reinit the Radeon CP hardware after a resume from disc. ++ * AFAIK, it would be very difficult to pickle the state at suspend time, so ++ * here we make sure that all Radeon hardware initialisation is re-done without ++ * affecting running applications. This function is called radeon_do_resume_cp() ++ * as it was derived from radeon_init_cp, where most of the initialisation takes ++ * place during DRI init. ++ * ++ * This patch is NOT to be confused with my and Michel Daenzer's earlier DRI ++ * reinit work, which de- and re-initialised the complete DRI at every VT ++ * switch. ++ * ++ * Charl P. Botha <http://cpbotha.net> ++ */ ++static int radeon_do_resume_cp( drm_device_t *dev) ++{ ++ drm_radeon_private_t *dev_priv; ++ u32 tmp; ++ DRM_DEBUG( "\n" ); ++ ++ DRM_DEBUG("Starting radeon_do_resume_cp()\n"); ++ ++ /* get the existing dev_private */ ++ dev_priv = dev->dev_private; ++ ++#if !defined(PCIGART_ENABLED) ++ /* PCI support is not 100% working, so we disable it here. ++ */ ++ if ( dev_priv->is_pci ) { ++ DRM_ERROR( "PCI GART not yet supported for Radeon!\n" ); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++#endif ++ ++ if ( dev_priv->is_pci && !dev->sg ) { ++ DRM_ERROR( "PCI GART memory not allocated!\n" ); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if ( dev_priv->usec_timeout < 1 || ++ dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { ++ DRM_DEBUG( "TIMEOUT problem!\n" ); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if ( ( dev_priv->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && ++ ( dev_priv->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { ++ DRM_DEBUG( "BAD cp_mode (%x)!\n", dev_priv->cp_mode ); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->sarea) { ++ DRM_ERROR("could not find sarea!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->fb) { ++ DRM_ERROR("could not find framebuffer!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->mmio) { ++ DRM_ERROR("could not find mmio region!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->cp_ring) { ++ DRM_ERROR("could not find cp ring region!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->ring_rptr) { ++ DRM_ERROR("could not find ring read pointer!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if(!dev_priv->buffers) { ++ DRM_ERROR("could not find dma buffer region!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ ++ if ( !dev_priv->is_pci ) { ++ if(!dev_priv->agp_textures) { ++ DRM_ERROR("could not find agp texture region!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ } ++ ++ if ( !dev_priv->is_pci ) { ++ if(!dev_priv->cp_ring->handle || ++ !dev_priv->ring_rptr->handle || ++ !dev_priv->buffers->handle) { ++ DRM_ERROR("could not find ioremap agp regions!\n"); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(EINVAL); ++ } ++ } else { ++ DRM_DEBUG( "dev_priv->cp_ring->handle %p\n", ++ dev_priv->cp_ring->handle ); ++ DRM_DEBUG( "dev_priv->ring_rptr->handle %p\n", ++ dev_priv->ring_rptr->handle ); ++ DRM_DEBUG( "dev_priv->buffers->handle %p\n", ++ dev_priv->buffers->handle ); ++ } ++ ++ ++ DRM_DEBUG( "dev_priv->agp_size %d\n", ++ dev_priv->agp_size ); ++ DRM_DEBUG( "dev_priv->agp_vm_start 0x%x\n", ++ dev_priv->agp_vm_start ); ++ DRM_DEBUG( "dev_priv->agp_buffers_offset 0x%lx\n", ++ dev_priv->agp_buffers_offset ); ++ ++#if __REALLY_HAVE_SG ++ if ( dev_priv->is_pci ) { ++ /* I'm not so sure about this ati_picgart_init after at resume-time... */ ++ if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, ++ &dev_priv->bus_pci_gart)) { ++ DRM_ERROR( "failed to init PCI GART!\n" ); ++ radeon_do_cleanup_cp(dev); ++ return DRM_ERR(ENOMEM); ++ } ++ ++ tmp = RADEON_READ( RADEON_AIC_CNTL ) ++ | RADEON_PCIGART_TRANSLATE_EN; ++ RADEON_WRITE( RADEON_AIC_CNTL, tmp ); ++ ++ /* set PCI GART page-table base address ++ */ ++ RADEON_WRITE( RADEON_AIC_PT_BASE, dev_priv->bus_pci_gart ); ++ ++ /* set address range for PCI address translate ++ */ ++ RADEON_WRITE( RADEON_AIC_LO_ADDR, dev_priv->agp_vm_start ); ++ RADEON_WRITE( RADEON_AIC_HI_ADDR, dev_priv->agp_vm_start ++ + dev_priv->agp_size - 1); ++ ++ /* Turn off AGP aperture -- is this required for PCIGART? ++ */ ++ RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0xffffffc0 ); /* ?? */ ++ RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ ++ } else { ++#endif /* __REALLY_HAVE_SG */ ++ /* Turn off PCI GART ++ */ ++ tmp = RADEON_READ( RADEON_AIC_CNTL ) ++ & ~RADEON_PCIGART_TRANSLATE_EN; ++ RADEON_WRITE( RADEON_AIC_CNTL, tmp ); ++#if __REALLY_HAVE_SG ++ } ++#endif /* __REALLY_HAVE_SG */ ++ ++ radeon_cp_load_microcode( dev_priv ); ++ radeon_cp_init_ring_buffer( dev, dev_priv ); ++ ++ radeon_do_engine_reset( dev ); ++ ++ return 0; ++} ++ ++ + int radeon_cp_init( DRM_IOCTL_ARGS ) + { + DRM_DEVICE; +@@ -1402,6 +1573,16 @@ + + return radeon_do_cp_idle( dev_priv ); + } ++ ++/* Added by Charl P. Botha to call radeon_do_resume_cp(). ++ */ ++int radeon_cp_resume( DRM_IOCTL_ARGS ) ++{ ++ DRM_DEVICE; ++ ++ return radeon_do_resume_cp(dev); ++} ++ + + int radeon_engine_reset( DRM_IOCTL_ARGS ) + { +Index: os-support/shared/drm/kernel/radeon_drm.h +=================================================================== +RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drm.h,v +retrieving revision 1.2 +diff -u -r1.2 radeon_drm.h +--- os-support/shared/drm/kernel/radeon_drm.h 2003/02/04 03:02:00 1.2 ++++ os-support/shared/drm/kernel/radeon_drm.h 2003/02/07 23:56:53 +@@ -391,6 +391,8 @@ + #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( 0x55, drm_radeon_mem_init_heap_t) + #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR( 0x56, drm_radeon_irq_emit_t) + #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( 0x57, drm_radeon_irq_wait_t) ++/* added by Charl P. Botha - see radeon_cp.c for details */ ++#define DRM_IOCTL_RADEON_CP_RESUME DRM_IO(0x58) + + typedef struct drm_radeon_init { + enum { +Index: os-support/shared/drm/kernel/radeon_drv.h +=================================================================== +RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_drv.h,v +retrieving revision 1.3 +diff -u -r1.3 radeon_drv.h +--- os-support/shared/drm/kernel/radeon_drv.h 2003/02/05 00:23:15 1.3 ++++ os-support/shared/drm/kernel/radeon_drv.h 2003/02/07 23:56:53 +@@ -153,6 +153,7 @@ + extern int radeon_cp_stop( DRM_IOCTL_ARGS ); + extern int radeon_cp_reset( DRM_IOCTL_ARGS ); + extern int radeon_cp_idle( DRM_IOCTL_ARGS ); ++extern int radeon_cp_resume( DRM_IOCTL_ARGS ); + extern int radeon_engine_reset( DRM_IOCTL_ARGS ); + extern int radeon_fullscreen( DRM_IOCTL_ARGS ); + extern int radeon_cp_buffers( DRM_IOCTL_ARGS ); diff --git a/x11-base/xfree-drm/xfree-drm-4.3.0-r2.ebuild b/x11-base/xfree-drm/xfree-drm-4.3.0-r2.ebuild new file mode 100644 index 000000000000..b9ded45f6131 --- /dev/null +++ b/x11-base/xfree-drm/xfree-drm-4.3.0-r2.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree-drm/xfree-drm-4.3.0-r2.ebuild,v 1.1 2003/04/22 03:48:29 leahcim Exp $ + +# Small note: we should prob consider using a DRM only tarball, as it will ease +# some of the overhead on older systems, and will enable us to +# update DRM if there are fixes not already in XFree86 tarballs ... + +IUSE="3dfx gamma i8x0 matrox rage128 radeon sis" + +inherit eutils + +# Make sure Portage does _NOT_ strip symbols. We will do it later and make sure +# that only we only strip stuff that are safe to strip ... +DEBUG="yes" +RESTRICT="nostrip" + +SNAPSHOT="20030306" + +S="${WORKDIR}/drm" +DESCRIPTION="Xfree86 Kernel DRM modules" +HOMEPAGE="http://www.xfree.org" +SRC_URI="mirror://gentoo/linux-drm-${PV}-kernelsource-${SNAPSHOT}.tar.gz" +# Latest tarball of DRM sources can be found here: +# +# http://www.xfree86.org/~alanh/ +# + +LICENSE="X11" +SLOT="0" +KEYWORDS="~x86 ~ppc ~alpha" + +DEPEND=">=x11-base/xfree-${PV} + virtual/linux-sources" + +PROVIDE="virtual/drm" + + +VIDCARDS="" + +if [ "`use matrox`" ] +then + VIDCARDS="${VIDCARDS} mga.o" +fi +if [ "`use 3dfx`" ] +then + VIDCARDS="${VIDCARDS} tdfx.o" +fi +if [ "`use rage128`" ] +then + VIDCARDS="${VIDCARDS} r128.o" +fi +if [ "`use radeon`" ] +then + VIDCARDS="${VIDCARDS} radeon.o" +fi +if [ "`use sis`" ] +then + VIDCARDS="${VIDCARDS} sis.o" +fi +if [ "`use i8x0`" ] +then + VIDCARDS="${VIDCARDS} i810.o i830.o" +fi +if [ "`use gamma`" ] +then + VIDCARDS="${VIDCARDS} gamma.o" +fi +if [ -z "${VIDCARDS}" -a "${ARCH}" = "ppc" ] +then + VIDCARDS="r128.o radeon.o" +fi + +src_unpack() { + unpack ${A} + cd ${S} + + epatch ${FILESDIR}/${PF}-gentoo-Makefile-fixup.patch + epatch ${FILESDIR}/${PF}-drm-ioremap.patch + epatch ${FILESDIR}/${PF}-radeon-resume-v8.patch +} + +src_compile() { + + ln -sf Makefile.linux Makefile + einfo "Building DRM..." + if [ -z "${VIDCARDS}" ] + then + make \ + TREE="/usr/src/linux/include" KV="${KVERS}" + else + make ${VIDCARDS} \ + TREE="/usr/src/linux/include" KV="${KVERS}" + fi +} + +src_install() { + + einfo "installing DRM..." + if [ -z "${VIDCARDS}" ] + then + make \ + TREE="/usr/src/linux/include" \ + KV="${KVERS}" \ + DESTDIR="${D}" \ + install || die + else + make \ + TREE="/usr/src/linux/include" \ + KV="${KVERS}" \ + DESTDIR="${D}" \ + MODS="${VIDCARDS}" \ + install || die + fi + dodoc README* +} + +pkg_postinst() { + + if [ "${ROOT}" = "/" ] + then + /sbin/modules-update + fi +} |