From patchwork Thu Jul 30 09:00:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11692535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 949BE6C1 for ; Thu, 30 Jul 2020 09:00:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 731C62072A for ; Thu, 30 Jul 2020 09:00:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="egZTU4gA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 731C62072A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AFDE6E8A0; Thu, 30 Jul 2020 09:00:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 19FE76E89C for ; Thu, 30 Jul 2020 09:00:31 +0000 (UTC) Received: by mail-ej1-x643.google.com with SMTP id bo3so4549672ejb.11 for ; Thu, 30 Jul 2020 02:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7TfgMtTQ6g96UDPfNiMo+eWA7+sxRHXa7rA7d4IoY9k=; b=egZTU4gAx40f6O/IcjyaFec1mnnJryo5Zb9NVu1m5sFXotYvcraGo1AboiaeXLPNbV XzID+wOxmV2JnTWy7wOcGs0g8wSZeEGjjSbzkJ9sTu9TrpeNvHMF7XoU0ji6pt/tGHgw S7JK/wUuAHt61xkYIwMJFYSScUBqL0YOjhFn1aX/CEivb9IKtmFFenNDxZcE9WJzUVJ2 rtstptkUm00Xeq7EOeHu4uj+cRVfGnORt4OVPVDudfy//TX88wbdxEyd+8puj7Khig9g lRprCj6He1og/hcdtvcl9rrRR8G8U9yWF5prNnlXjQeD274AZXMOTcrs9RK36l9PNARG FSxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7TfgMtTQ6g96UDPfNiMo+eWA7+sxRHXa7rA7d4IoY9k=; b=W097O7tpIYn+3BC0omEfdBgtl91vKb/24lS3ymeF9zMEoVkwIqnWtkyUfjnVdCXyFV 4yp/sIvTL4m+CRTYsm/jdzdWgvnk7koBQ3SL6zY/Fo0ss1OhBqnbHJQyC8ZMng6IurB1 7U2ekfZ0vkqC2nQkJEW0hpUJShJLdNDsybE4SKTlWkCrjRURexuvn2WQxCX3C3gjkZ94 AtBfKOsaXoyHHM3XAQt6g7zFtNTmSpAjr6jdzhT8HybagdbVRahW7vbrdAoWaSoTUSye bssMTkxweNLHQoGWHZDYzq1zOURyF9X7NKm0w9efwlgvYFrkMxu4PnvrXKLrK4K7mFQM me+A== X-Gm-Message-State: AOAM533ymOd/B4FH5JG8A2yMoQ9xf0w8VkeVFszn+YFg+NGZvj6r0RZb YQlHwRhoH3cWviY0/SFCFCzHr+TW X-Google-Smtp-Source: ABdhPJw5MkBBZkzJtvbq26/W8OkTh/UAE6P664CXi700Ozb9uxgccUqvOGo84nsrbVyETU1KopLV9w== X-Received: by 2002:a17:906:e118:: with SMTP id gj24mr1585954ejb.219.1596099629481; Thu, 30 Jul 2020 02:00:29 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:cb71:127d:d8c4:4acb]) by smtp.gmail.com with ESMTPSA id j24sm4968238ejv.32.2020.07.30.02.00.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2020 02:00:29 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/9] drm/qxl: stop implementing init_mem_type Date: Thu, 30 Jul 2020 11:00:13 +0200 Message-Id: <20200730090015.17295-7-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200730090015.17295-1-christian.koenig@amd.com> References: <20200730090015.17295-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead just initialize the memory type parameters before calling ttm_bo_init_mm. Signed-off-by: Christian König Reviewed-by: Alex Deucher --- drivers/gpu/drm/qxl/qxl_ttm.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index abb9fa4d80cf..852089d7f783 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -51,21 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev) static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, struct ttm_mem_type_manager *man) { - switch (type) { - case TTM_PL_SYSTEM: - /* System memory */ - break; - case TTM_PL_VRAM: - case TTM_PL_PRIV: - /* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching = TTM_PL_MASK_CACHING; - man->default_caching = TTM_PL_FLAG_CACHED; - break; - default: - DRM_ERROR("Unsupported memory type %u\n", (unsigned int)type); - return -EINVAL; - } return 0; } @@ -238,6 +223,19 @@ static struct ttm_bo_driver qxl_bo_driver = { .move_notify = &qxl_bo_move_notify, }; +static int qxl_ttm_init_mem_type(struct qxl_device *qdev, + unsigned int type, + uint64_t size) +{ + struct ttm_mem_type_manager *man = &qdev->mman.bdev.man[type]; + + man->func = &ttm_bo_manager_func; + man->available_caching = TTM_PL_MASK_CACHING; + man->default_caching = TTM_PL_FLAG_CACHED; + + return ttm_bo_init_mm(&qdev->mman.bdev, type, size); +} + int qxl_ttm_init(struct qxl_device *qdev) { int r; @@ -255,14 +253,13 @@ int qxl_ttm_init(struct qxl_device *qdev) } /* NOTE: this includes the framebuffer (aka surface 0) */ num_io_pages = qdev->rom->ram_header_offset / PAGE_SIZE; - r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_VRAM, - num_io_pages); + r = qxl_ttm_init_mem_type(qdev, TTM_PL_VRAM, num_io_pages); if (r) { DRM_ERROR("Failed initializing VRAM heap.\n"); return r; } - r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_PRIV, - qdev->surfaceram_size / PAGE_SIZE); + r = qxl_ttm_init_mem_type(qdev, TTM_PL_PRIV, + qdev->surfaceram_size / PAGE_SIZE); if (r) { DRM_ERROR("Failed initializing Surfaces heap.\n"); return r;