Release 4.7 drivers/gpu/drm/nouveau/nouveau_sgdma.c
  
  
#include <linux/pagemap.h>
#include <linux/slab.h>
#include "nouveau_drv.h"
#include "nouveau_ttm.h"
struct nouveau_sgdma_be {
	/* this has to be the first field so populate/unpopulated in
         * nouve_bo.c works properly, otherwise have to move them here
         */
	
struct ttm_dma_tt ttm;
	
struct nvkm_mem *node;
};
static void
nouveau_sgdma_destroy(struct ttm_tt *ttm)
{
	struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
	if (ttm) {
		ttm_dma_tt_fini(&nvbe->ttm);
		kfree(nvbe);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 30 | 71.43% | 2 | 50.00% | 
| jerome glisse | jerome glisse | 12 | 28.57% | 2 | 50.00% | 
 | Total | 42 | 100.00% | 4 | 100.00% | 
static int
nv04_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
{
	struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
	struct nvkm_mem *node = mem->mm_node;
	if (ttm->sg) {
		node->sg    = ttm->sg;
		node->pages = NULL;
	} else {
		node->sg    = NULL;
		node->pages = nvbe->ttm.dma_address;
	}
	node->size = (mem->num_pages << PAGE_SHIFT) >> 12;
	nvkm_vm_map(&node->vma[0], node);
	nvbe->node = node;
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 107 | 93.86% | 6 | 75.00% | 
| jerome glisse | jerome glisse | 7 | 6.14% | 2 | 25.00% | 
 | Total | 114 | 100.00% | 8 | 100.00% | 
static int
nv04_sgdma_unbind(struct ttm_tt *ttm)
{
	struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
	nvkm_vm_unmap(&nvbe->node->vma[0]);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 36 | 92.31% | 6 | 85.71% | 
| jerome glisse | jerome glisse | 3 | 7.69% | 1 | 14.29% | 
 | Total | 39 | 100.00% | 7 | 100.00% | 
static struct ttm_backend_func nv04_sgdma_backend = {
	.bind			= nv04_sgdma_bind,
	.unbind			= nv04_sgdma_unbind,
	.destroy		= nouveau_sgdma_destroy
};
static int
nv50_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
{
	struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
	struct nvkm_mem *node = mem->mm_node;
	/* noop: bound in move_notify() */
	if (ttm->sg) {
		node->sg    = ttm->sg;
		node->pages = NULL;
	} else {
		node->sg    = NULL;
		node->pages = nvbe->ttm.dma_address;
	}
	node->size = (mem->num_pages << PAGE_SHIFT) >> 12;
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 71 | 73.96% | 7 | 70.00% | 
| dave airlie | dave airlie | 17 | 17.71% | 1 | 10.00% | 
| jerome glisse | jerome glisse | 8 | 8.33% | 2 | 20.00% | 
 | Total | 96 | 100.00% | 10 | 100.00% | 
static int
nv50_sgdma_unbind(struct ttm_tt *ttm)
{
	/* noop: unbound in move_notify() */
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 13 | 86.67% | 3 | 75.00% | 
| jerome glisse | jerome glisse | 2 | 13.33% | 1 | 25.00% | 
 | Total | 15 | 100.00% | 4 | 100.00% | 
static struct ttm_backend_func nv50_sgdma_backend = {
	.bind			= nv50_sgdma_bind,
	.unbind			= nv50_sgdma_unbind,
	.destroy		= nouveau_sgdma_destroy
};
struct ttm_tt *
nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
			 unsigned long size, uint32_t page_flags,
			 struct page *dummy_read_page)
{
	struct nouveau_drm *drm = nouveau_bdev(bdev);
	struct nouveau_sgdma_be *nvbe;
	nvbe = kzalloc(sizeof(*nvbe), GFP_KERNEL);
	if (!nvbe)
		return NULL;
	if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA)
		nvbe->ttm.ttm.func = &nv04_sgdma_backend;
	else
		nvbe->ttm.ttm.func = &nv50_sgdma_backend;
	if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
		/*
                 * A failing ttm_dma_tt_init() will call ttm_tt_destroy()
                 * and thus our nouveau_sgdma_destroy() hook, so we don't need
                 * to free nvbe here.
                 */
		return NULL;
	return &nvbe->ttm.ttm;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 98 | 78.40% | 6 | 60.00% | 
| jerome glisse | jerome glisse | 22 | 17.60% | 1 | 10.00% | 
| lucas stach | lucas stach | 3 | 2.40% | 1 | 10.00% | 
| alexandre courbot | alexandre courbot | 1 | 0.80% | 1 | 10.00% | 
| jon mason | jon mason | 1 | 0.80% | 1 | 10.00% | 
 | Total | 125 | 100.00% | 10 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ben skeggs | ben skeggs | 423 | 84.26% | 13 | 68.42% | 
| jerome glisse | jerome glisse | 57 | 11.35% | 2 | 10.53% | 
| dave airlie | dave airlie | 17 | 3.39% | 1 | 5.26% | 
| lucas stach | lucas stach | 3 | 0.60% | 1 | 5.26% | 
| alexandre courbot | alexandre courbot | 1 | 0.20% | 1 | 5.26% | 
| jon mason | jon mason | 1 | 0.20% | 1 | 5.26% | 
 | Total | 502 | 100.00% | 19 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.