From: James Simmons Subject: TTM questions Date: Thu, 15 Jul 2010 16:54:12 +0100 (BST) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by gabe.freedesktop.org (Postfix) with ESMTP id 5736B9E75D for ; Thu, 15 Jul 2010 08:54:14 -0700 (PDT) Received: from localhost ([127.0.0.1]) by casper.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1OZQlI-0003Hm-N8 for dri-devel@lists.freedesktop.org; Thu, 15 Jul 2010 15:54:12 +0000 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: DRI development list List-Id: dri-devel@lists.freedesktop.org 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.