TTM questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Now that I'm adding in TTM support to my 3Dfx driver I have a questions.
First I noticed in almost every driver for ttm initialization that two
struct ttm_global_reference global_ref are allocated. One for TTM_GLOBAL_TTM_MEM
and one for TTM_GLOBAL_TTM_BO. For a graphics card with only VRAM fb memory do 
you need to allocate the TTM_GLOBAL_TTM_BO area? From what I can tell that is yes. 
	After you set that up do pretty much do a:

ret = ttm_bo_device_init(&bdev, bo_global_ref.ref.object,
                         &my_bo_driver, DRM_FILE_PAGE_OFFSET,
                         dma_flag);
if (ret) {
	DRM_ERROR("failed!!!\n");
        return ret;
}

ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM, vram_size >> PAGE_SHIFT);
if (ret) {
        DRM_ERROR(dev, "failed\n");
        return ret;
}

// vram start
placement.fpfn = 0;
// static fb pci region length
placement.lpfn = pci_resource_len(pdev, num); // static fb pci region 
// Anything else needed in placement?

// What is the alignment for non-tile framebuffers?
// Is this related to info->pixmap.buf_align
page_align = PAGE_MASK;

// Usually the driver wants to start at the very beginning of vram
buffer_start = 0;
ttm_buffer_object *bo = kmalloc(sizeof(*bo);

ret = ttm_bo_init(&bdev, &bo, vram_size, TTM_PL_VRAM, 
                 &placement, align, buffer_start, false, NULL, 
                 vram_size, my_bo_del_ttm);
if (ret) {
	// ttm will call my_bo_del_ttm if it fails..
        return ret;
}

// Is the below needed ?
ret = ttm_bo_reserve(bo, false, false, false, 0);
if (ret)
        return ret;

ret = ttm_bo_validate(bo, &nvbo->placement, false, false, false);

ttm_bo_unreserve(bo);


Please fill in what I'm missing.


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux