[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dri-devel
Subject:    Re: "no scatter/gather memory" ?
From:       Jesse Barnes <jbarnes () engr ! sgi ! com>
Date:       2005-03-04 19:18:15
Message-ID: 200503041118.15632.jbarnes () engr ! sgi ! com
[Download RAW message or body]

On Friday, March 4, 2005 10:31 am, Jesse Barnes wrote:
> Seems like we need something like this instead?
>
> Index: linux-core/drm_dma.c
> ===================================================================
> RCS file: /cvs/dri/drm/linux-core/drm_dma.c,v
> retrieving revision 1.39
> diff -u -r1.39 drm_dma.c
> --- linux-core/drm_dma.c        31 Oct 2004 15:16:44 -0000      1.39
> +++ linux-core/drm_dma.c        4 Mar 2005 18:29:03 -0000
> @@ -141,6 +141,9 @@
>         buf->filp = NULL;
>         buf->used = 0;
>
> +       pci_unmap_page(dev->pdev, buf->bus_address, buf->total,
> +                      PCI_DMA_FROMDEVICE);
> +

This is wrong since we may get here with AGP or other memory that wasn't 
pci_map*'d in the first place.  It should also use pci_unmap_single instead.

>         if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
>             && waitqueue_active(&buf->dma_wait)) {
>                 wake_up_interruptible(&buf->dma_wait);
> Index: linux-core/drm_bufs.c
> ===================================================================
> RCS file: /cvs/dri/drm/linux-core/drm_bufs.c,v
> retrieving revision 1.54
> diff -u -r1.54 drm_bufs.c
> --- linux-core/drm_bufs.c       5 Feb 2005 08:00:14 -0000       1.54
> +++ linux-core/drm_bufs.c       4 Mar 2005 18:29:04 -0000
> @@ -752,7 +752,9 @@
>                         buf->used = 0;
>                         buf->offset = (dma->byte_count + byte_count +
> offset); buf->address = (void *)(page + offset);
> -                       buf->bus_address = virt_to_bus(buf->address);
> +                       buf->bus_address = pci_map_page(dev->pdev, page,
> offset, +                                                       buf->total,
> +                                                       PCI_DMA_TODEVICE);
> buf->next = NULL;

This should be pci_map_single instead I think, since the buffer may be more 
than one page like you said?

   buf->bus_address = pci_map_single(dev->pdev,
         bus->address,
         buf->total,
         PCI_DMA_BIDIRECTIONAL);

Jesse


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic