From patchwork Thu May 10 05:01:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Jerry(Junwei)" X-Patchwork-Id: 10391137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32FB26053D for ; Thu, 10 May 2018 05:02:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15D6628470 for ; Thu, 10 May 2018 05:02:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A4CA286DC; Thu, 10 May 2018 05:02:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C524228470 for ; Thu, 10 May 2018 05:01:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73BA66EE09; Thu, 10 May 2018 05:01:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0049.outbound.protection.outlook.com [104.47.42.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E73F6EE03; Thu, 10 May 2018 05:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4o19n1NxNthFEyBaQ/fJVBL8mDxNNXDaz132omzutxg=; b=A+n+WbjBwHaKT9tnjN16l7B5X3valdW9nz/udMK9fDnaSQA37qIcWh1z/H5Snb4anL6TVcSDocvCvmfhwjAE9bzeCBnDZIjTXZqCf3jQgxbL44JHxtlicAP7QopMkJAhuWzmZ99DGBohY5fgZW3tmTUWuMO2aaJs2GSVCL7nwGY= Received: from MWHPR12CA0064.namprd12.prod.outlook.com (2603:10b6:300:103::26) by DM3PR12MB0761.namprd12.prod.outlook.com (2a01:111:e400:5984::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.19; Thu, 10 May 2018 05:01:52 +0000 Received: from BY2NAM03FT021.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::202) by MWHPR12CA0064.outlook.office365.com (2603:10b6:300:103::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.755.16 via Frontend Transport; Thu, 10 May 2018 05:01:51 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT021.mail.protection.outlook.com (10.152.84.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.735.16 via Frontend Transport; Thu, 10 May 2018 05:01:51 +0000 Received: from junwei-u1404.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.382.0; Thu, 10 May 2018 00:01:31 -0500 From: Junwei Zhang To: , Subject: [PATCH] drm/ttm: specify bo priority when initializing ttm bo Date: Thu, 10 May 2018 13:01:47 +0800 Message-ID: <1525928507-27452-1-git-send-email-Jerry.Zhang@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(376002)(2980300002)(428003)(189003)(199004)(450100002)(486006)(476003)(426003)(2616005)(50226002)(48376002)(50466002)(336012)(8936002)(68736007)(316002)(59450400001)(356003)(4326008)(2906002)(110136005)(36756003)(26005)(5660300001)(106466001)(126002)(104016004)(81166006)(8676002)(81156014)(1857600001)(47776003)(16586007)(72206003)(478600001)(86362001)(51416003)(305945005)(7696005)(77096007)(53936002)(186003)(53416004)(105586002)(6666003)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0761; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT021; 1:EQWJ1nAv9eT5K0JLLiE0mad0Gge6V0v4QfHsSXVX3IUmWdkv/HXWQXWMVQdRcm9c7pIVHJWKw62dhaX9pv3hbg/0PVCoEU3mvU4WyqeX92wWt+KWvhwhsON0IdXjZrrm X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:DM3PR12MB0761; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0761; 3:lnNSHl/aDjWw+H6e9dNatxuzWtiMM3pwno2E7U6YNBRbryMxuxkvBBcS19iX7FOUikC07b6qixVtgM/BDIOBlf/ErGMvmb3Py52EREh6GCaFtIFn2IFs4C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rdM6rbhlJqMB4DhcGaP0vN1tmtbZHjI0JA0rPe/0DrzldY25vmIgJXAiTURaFBYZQ5fa5X6acFXLDquccQOxTIjUS/uq9i3vX3WB25k9HxoGTAi2E1ziMa5vBLkFWKRpnTXZM2HyLT8oTaAOdFXBrk3oDn2EKlB/pdFqC0v6ngLL77K+gOFPqxd9mRazS7JHjd+7tZrtcWD8CpYKd2kPsQPHHJad1hIHvcn5HTgPcz/+LpmHwhIlzxjKVLLwEKseIlCHAazzvaX3t2gVS/CALOlk3QrvAMNY3rjeFfPisWB4+awewAD2ycY0OpJT4n70Bi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93003095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:DM3PR12MB0761; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0761; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0761; 4:o6KTHlxxjMn6BkMrRSGFWGiK4gZKgevSAxmqPuzPZHlJvxxE5khIGaVWgKJmeMwuhWerJZMHaqFpS61NhS2mQ+iEKPjtVyIcosFz+sH0HXfQq4PCVkVPQTBLcOg6RmSELIRTWBXb3ODQGYt3vWKzOCiNdvIY+y0KFw/xyAkENcb5ZnGTLVx1/3dxxQTjJ5satNBtWdMLx9BDkggpQNSGhxoiKgBAX9hd3H5YrAOVR6B5pBRGAg4+t/VxloV5IMT4IKyEi+7+Ks3Y/sV4FynDncHLbc7mHxJP6uaXvOxbHstvJ1rdu6iSLqit605cUvce X-Forefront-PRVS: 066898046A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0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xS8vauVg==; 5:0VOHpM+nMzMGH+G/OTFXeHI/roh94KuzbQ9Nqjd1IXqiN41kVQoLAPlUQFrShpmPaLalbSBlGUoK/KcbGsS4ci9jzi9qQK32co/5xBMh8NhOjB6RUUVKL9lX5c4+kbjlHuRggVi5WFxv5Gaq+ZCM+1dlYMnnUygjovFZMuhZaDM=; 24:jtzGVEinGDVcymBdE0FHiAMNHWjpneUTP1i2xS0JxugMXM8M10aGyN76/uHrmWK+07GSTy85xVGD1vOnM+g9kHCYU++vsFp6m7nYTxugOd8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0761; 7:SUhRgTYMMoelaw9mJrtFFE9Z7C+nISomL9QwJO+DM+yh3r/BEmcMRbyTMK2lhCDkXPtqeFzRlLIIeOo/dT6xt/eZk5MSj5xWYxfyqsxaBF4TlbFA002xunIJcAY/Ra4obrgL2I7RQFRAONTZeAPAQlDxG4ZfLfiubzulVyjeO/S85r/ehH8eIckWh7FwHp6KD/6fB+NUnPg4B4eh7Q6q4lyKxuLZ9TaNL2Dia3RWLDr/09+B+RDUSD/MEEuANaS6; 20:9cY846+34mJwqtINx7yEyLBRfQWdSoj29LdWiP2wRJW7k9IpXtdOJD0u/nbhgO5KUxFPQTwSp2XSSmUbOV7Bvi5ZMaSi/4lOeDF7CLOXAwT723hEUwmXO+kBnkLu7yQsrCeIShIRLK5njI5OZp3C8gVcR5DOLCIGHXCcTbWUVL7Q3ui82LWaEGHp3XigJrT9Kt80gsnvJH/C0kuEe50WdW3sbGMMjkdx0Vj6n4pZuSqQ2Ya73TLc3OWVDUm+C77a X-MS-Office365-Filtering-Correlation-Id: 4fad3cbc-f1d4-4f3e-13a3-08d5b6332488 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 05:01:51.1371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fad3cbc-f1d4-4f3e-13a3-08d5b6332488 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0761 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Junwei Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Expect to add an evitable bo who has reservation object to the correct lru[bo->priority] list Signed-off-by: Junwei Zhang --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 ++++++----- drivers/gpu/drm/ast/ast_ttm.c | 2 +- drivers/gpu/drm/bochs/bochs_mm.c | 2 +- drivers/gpu/drm/cirrus/cirrus_ttm.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++--- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 2 +- drivers/staging/vboxvideo/vbox_ttm.c | 2 +- include/drm/ttm/ttm_bo_api.h | 5 ++++- 14 files changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index e62153a..9a25ecb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -360,6 +360,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, }; struct amdgpu_bo *bo; unsigned long page_align, size = bp->size; + uint32_t prio = 0; size_t acc_size; int r; @@ -419,10 +420,13 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, bo->tbo.bdev = &adev->mman.bdev; amdgpu_ttm_placement_from_domain(bo, bp->domain); + if (bp->type == ttm_bo_type_kernel) + prio = 1; r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, bp->type, - &bo->placement, page_align, &ctx, acc_size, - NULL, bp->resv, &amdgpu_ttm_bo_destroy); + prio, &bo->placement, page_align, &ctx, + acc_size, NULL, bp->resv, + &amdgpu_ttm_bo_destroy); if (unlikely(r != 0)) return r; @@ -434,9 +438,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, else amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0); - if (bp->type == ttm_bo_type_kernel) - bo->tbo.priority = 1; - if (bp->flags & AMDGPU_GEM_CREATE_VRAM_CLEARED && bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) { struct dma_fence *fence; diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index fe354eb..aabb96a 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c @@ -320,7 +320,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, sizeof(struct ast_bo)); ret = ttm_bo_init(&ast->ttm.bdev, &astbo->bo, size, - ttm_bo_type_device, &astbo->placement, + ttm_bo_type_device, 0, &astbo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, ast_bo_ttm_destroy); if (ret) diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c index 39cd084..9693109 100644 --- a/drivers/gpu/drm/bochs/bochs_mm.c +++ b/drivers/gpu/drm/bochs/bochs_mm.c @@ -366,7 +366,7 @@ static int bochs_bo_create(struct drm_device *dev, int size, int align, sizeof(struct bochs_bo)); ret = ttm_bo_init(&bochs->ttm.bdev, &bochsbo->bo, size, - ttm_bo_type_device, &bochsbo->placement, + ttm_bo_type_device, 0, &bochsbo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, bochs_bo_ttm_destroy); if (ret) diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index f219532..c1d85f8 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c @@ -327,7 +327,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, sizeof(struct cirrus_bo)); ret = ttm_bo_init(&cirrus->ttm.bdev, &cirrusbo->bo, size, - ttm_bo_type_device, &cirrusbo->placement, + ttm_bo_type_device, 0, &cirrusbo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, cirrus_bo_ttm_destroy); if (ret) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c index 4871025..8c24731 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c @@ -315,7 +315,7 @@ int hibmc_bo_create(struct drm_device *dev, int size, int align, sizeof(struct hibmc_bo)); ret = ttm_bo_init(&hibmc->bdev, &hibmcbo->bo, size, - ttm_bo_type_device, &hibmcbo->placement, + ttm_bo_type_device, 0, &hibmcbo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, hibmc_bo_ttm_destroy); if (ret) { diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 05570f0..e4db046 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c @@ -323,7 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, sizeof(struct mgag200_bo)); ret = ttm_bo_init(&mdev->ttm.bdev, &mgabo->bo, size, - ttm_bo_type_device, &mgabo->placement, + ttm_bo_type_device, 0, &mgabo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, mgag200_bo_ttm_destroy); if (ret) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 6f402c4..8a6f949 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -297,7 +297,7 @@ sizeof(struct nouveau_bo)); ret = ttm_bo_init(&drm->ttm.bdev, &nvbo->bo, size, - type, &nvbo->placement, + type, 0, &nvbo->placement, align >> PAGE_SHIFT, false, acc_size, sg, robj, nouveau_bo_del_ttm); if (ret) { diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 6a30196..3e8c64b 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -108,7 +108,7 @@ int qxl_bo_create(struct qxl_device *qdev, qxl_ttm_placement_from_domain(bo, domain, pinned); - r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, + r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, 0, &bo->placement, 0, !kernel, size, NULL, NULL, &qxl_ttm_bo_destroy); if (unlikely(r != 0)) { diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index edbb4cd..b274e3f 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -256,7 +256,7 @@ int radeon_bo_create(struct radeon_device *rdev, radeon_ttm_placement_from_domain(bo, domain); /* Kernel allocation are uninterruptible */ down_read(&rdev->pm.mclk_lock); - r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, + r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, 0, &bo->placement, page_align, !kernel, acc_size, sg, resv, &radeon_ttm_bo_destroy); up_read(&rdev->pm.mclk_lock); diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 98e06f8..d1f0585 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1109,6 +1109,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, struct ttm_buffer_object *bo, unsigned long size, enum ttm_bo_type type, + uint32_t priority, struct ttm_placement *placement, uint32_t page_alignment, struct ttm_operation_ctx *ctx, @@ -1175,7 +1176,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, reservation_object_init(&bo->ttm_resv); atomic_inc(&bo->bdev->glob->bo_count); drm_vma_node_reset(&bo->vma_node); - bo->priority = 0; + bo->priority = priority; /* * For ttm_bo_type_device buffers, allocate @@ -1219,6 +1220,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, struct ttm_buffer_object *bo, unsigned long size, enum ttm_bo_type type, + uint32_t priority, struct ttm_placement *placement, uint32_t page_alignment, bool interruptible, @@ -1230,7 +1232,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, struct ttm_operation_ctx ctx = { interruptible, false }; int ret; - ret = ttm_bo_init_reserved(bdev, bo, size, type, placement, + ret = ttm_bo_init_reserved(bdev, bo, size, type, priority, placement, page_alignment, &ctx, acc_size, sg, resv, destroy); if (ret) @@ -1288,7 +1290,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev, return -ENOMEM; acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); - ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, + ret = ttm_bo_init(bdev, bo, size, type, 0, placement, page_alignment, interruptible, acc_size, NULL, NULL, NULL); if (likely(ret == 0)) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 9f2f470..c11eba8 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -88,7 +88,7 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, bo->dumb = false; virtio_gpu_init_ttm_placement(bo, pinned); - ret = ttm_bo_init(&vgdev->mman.bdev, &bo->tbo, size, type, + ret = ttm_bo_init(&vgdev->mman.bdev, &bo->tbo, size, type, 0, &bo->placement, 0, !kernel, acc_size, NULL, NULL, &virtio_gpu_ttm_bo_destroy); /* ttm_bo_init failure will call the destroy */ diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 6b3a942..e7a4216 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -385,7 +385,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, INIT_LIST_HEAD(&vmw_bo->res_list); ret = ttm_bo_init(bdev, &vmw_bo->base, size, - ttm_bo_type_device, placement, + ttm_bo_type_device, 0, placement, 0, interruptible, acc_size, NULL, NULL, bo_free); return ret; diff --git a/drivers/staging/vboxvideo/vbox_ttm.c b/drivers/staging/vboxvideo/vbox_ttm.c index 548edb7..b93f8f0 100644 --- a/drivers/staging/vboxvideo/vbox_ttm.c +++ b/drivers/staging/vboxvideo/vbox_ttm.c @@ -329,7 +329,7 @@ int vbox_bo_create(struct drm_device *dev, int size, int align, sizeof(struct vbox_bo)); ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size, - ttm_bo_type_device, &vboxbo->placement, + ttm_bo_type_device, 0, &vboxbo->placement, align >> PAGE_SHIFT, false, acc_size, NULL, NULL, vbox_bo_ttm_destroy); if (ret) diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index c67977a..f4142af 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -464,6 +464,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, * @bo: Pointer to a ttm_buffer_object to be initialized. * @size: Requested size of buffer object. * @type: Requested type of buffer object. + * @priority: Requested priority of buffer object. * @flags: Initial placement flags. * @page_alignment: Data alignment in pages. * @ctx: TTM operation context for memory allocation. @@ -496,6 +497,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, struct ttm_buffer_object *bo, unsigned long size, enum ttm_bo_type type, + uint32_t priority, struct ttm_placement *placement, uint32_t page_alignment, struct ttm_operation_ctx *ctx, @@ -511,6 +513,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, * @bo: Pointer to a ttm_buffer_object to be initialized. * @size: Requested size of buffer object. * @type: Requested type of buffer object. + * @priority: Requested priority of buffer object. * @flags: Initial placement flags. * @page_alignment: Data alignment in pages. * @interruptible: If needing to sleep to wait for GPU resources, @@ -542,7 +545,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources. */ int ttm_bo_init(struct ttm_bo_device *bdev, struct ttm_buffer_object *bo, - unsigned long size, enum ttm_bo_type type, + unsigned long size, enum ttm_bo_type type, uint32_t priority, struct ttm_placement *placement, uint32_t page_alignment, bool interrubtible, size_t acc_size, struct sg_table *sg, struct reservation_object *resv,