Lines Matching refs:vsg
1507 via_unmap_blit_from_device(struct pci_dev *pdev, drm_via_sg_info_t *vsg) in via_unmap_blit_from_device() argument
1509 int num_desc = vsg->num_desc; in via_unmap_blit_from_device()
1510 unsigned cur_descriptor_page = num_desc / vsg->descriptors_per_page; in via_unmap_blit_from_device()
1511 unsigned descriptor_this_page = num_desc % vsg->descriptors_per_page; in via_unmap_blit_from_device()
1512 drm_via_descriptor_t *desc_ptr = vsg->desc_pages[cur_descriptor_page] + in via_unmap_blit_from_device()
1514 dma_addr_t next = vsg->chain_start; in via_unmap_blit_from_device()
1519 descriptor_this_page = vsg->descriptors_per_page - 1; in via_unmap_blit_from_device()
1520 desc_ptr = vsg->desc_pages[cur_descriptor_page] + in via_unmap_blit_from_device()
1524 dma_unmap_page(&pdev->dev, desc_ptr->mem_addr, desc_ptr->size, vsg->direction); in via_unmap_blit_from_device()
1539 drm_via_sg_info_t *vsg, in via_map_blit_for_device() argument
1557 desc_ptr = vsg->desc_pages[cur_descriptor_page]; in via_map_blit_for_device()
1573 vsg->pages[VIA_PFN(cur_mem) - in via_map_blit_for_device()
1576 vsg->direction); in via_map_blit_for_device()
1584 if (++num_descriptors_this_page >= vsg->descriptors_per_page) { in via_map_blit_for_device()
1586 desc_ptr = vsg->desc_pages[++cur_descriptor_page]; in via_map_blit_for_device()
1600 vsg->chain_start = next; in via_map_blit_for_device()
1601 vsg->state = dr_via_device_mapped; in via_map_blit_for_device()
1603 vsg->num_desc = num_desc; in via_map_blit_for_device()
1612 via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) in via_free_sg_info() argument
1616 switch (vsg->state) { in via_free_sg_info()
1618 via_unmap_blit_from_device(pdev, vsg); in via_free_sg_info()
1621 for (i = 0; i < vsg->num_desc_pages; ++i) { in via_free_sg_info()
1622 if (vsg->desc_pages[i] != NULL) in via_free_sg_info()
1623 free_page((unsigned long)vsg->desc_pages[i]); in via_free_sg_info()
1625 kfree(vsg->desc_pages); in via_free_sg_info()
1628 unpin_user_pages_dirty_lock(vsg->pages, vsg->num_pages, in via_free_sg_info()
1629 (vsg->direction == DMA_FROM_DEVICE)); in via_free_sg_info()
1632 vfree(vsg->pages); in via_free_sg_info()
1635 vsg->state = dr_via_sg_init; in via_free_sg_info()
1637 vfree(vsg->bounce_buffer); in via_free_sg_info()
1638 vsg->bounce_buffer = NULL; in via_free_sg_info()
1639 vsg->free_on_sequence = 0; in via_free_sg_info()
1646 via_fire_dmablit(struct drm_device *dev, drm_via_sg_info_t *vsg, int engine) in via_fire_dmablit() argument
1656 via_write(dev_priv, VIA_PCI_DMA_DPR0 + engine*0x10, vsg->chain_start); in via_fire_dmablit()
1667 via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) in via_lock_all_dma_pages() argument
1671 vsg->num_pages = VIA_PFN(xfer->mem_addr + (xfer->num_lines * xfer->mem_stride - 1)) - in via_lock_all_dma_pages()
1674 vsg->pages = vzalloc(array_size(sizeof(struct page *), vsg->num_pages)); in via_lock_all_dma_pages()
1675 if (NULL == vsg->pages) in via_lock_all_dma_pages()
1678 vsg->num_pages, in via_lock_all_dma_pages()
1679 vsg->direction == DMA_FROM_DEVICE ? FOLL_WRITE : 0, in via_lock_all_dma_pages()
1680 vsg->pages); in via_lock_all_dma_pages()
1681 if (ret != vsg->num_pages) { in via_lock_all_dma_pages()
1684 vsg->state = dr_via_pages_locked; in via_lock_all_dma_pages()
1687 vsg->state = dr_via_pages_locked; in via_lock_all_dma_pages()
1698 via_alloc_desc_pages(drm_via_sg_info_t *vsg) in via_alloc_desc_pages() argument
1702 vsg->descriptors_per_page = PAGE_SIZE / sizeof(drm_via_descriptor_t); in via_alloc_desc_pages()
1703 vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) / in via_alloc_desc_pages()
1704 vsg->descriptors_per_page; in via_alloc_desc_pages()
1706 if (NULL == (vsg->desc_pages = kcalloc(vsg->num_desc_pages, sizeof(void *), GFP_KERNEL))) in via_alloc_desc_pages()
1709 vsg->state = dr_via_desc_pages_alloc; in via_alloc_desc_pages()
1710 for (i = 0; i < vsg->num_desc_pages; ++i) { in via_alloc_desc_pages()
1711 if (NULL == (vsg->desc_pages[i] = in via_alloc_desc_pages()
1715 DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages, in via_alloc_desc_pages()
1716 vsg->num_desc); in via_alloc_desc_pages()
1989 via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) in via_build_sg_info() argument
1995 vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in via_build_sg_info()
1996 vsg->bounce_buffer = NULL; in via_build_sg_info()
1998 vsg->state = dr_via_sg_init; in via_build_sg_info()
2069 if (0 != (ret = via_lock_all_dma_pages(vsg, xfer))) { in via_build_sg_info()
2071 via_free_sg_info(pdev, vsg); in via_build_sg_info()
2075 via_map_blit_for_device(pdev, xfer, vsg, 0); in via_build_sg_info()
2076 if (0 != (ret = via_alloc_desc_pages(vsg))) { in via_build_sg_info()
2078 via_free_sg_info(pdev, vsg); in via_build_sg_info()
2081 via_map_blit_for_device(pdev, xfer, vsg, 1); in via_build_sg_info()
2135 drm_via_sg_info_t *vsg; in via_dmablit() local
2150 if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) { in via_dmablit()
2154 if (0 != (ret = via_build_sg_info(dev, vsg, xfer))) { in via_dmablit()
2156 kfree(vsg); in via_dmablit()
2161 blitq->blits[blitq->head++] = vsg; in via_dmablit()