From patchwork Thu Dec 15 17:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicolai_H=C3=A4hnle?= X-Patchwork-Id: 9476559 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 BAA9060571 for ; Thu, 15 Dec 2016 17:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A81DF287B8 for ; Thu, 15 Dec 2016 17:10:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CDAA287DA; Thu, 15 Dec 2016 17:10:59 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 69467287B8 for ; Thu, 15 Dec 2016 17:10:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B0C46EA41; Thu, 15 Dec 2016 17:10:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 326836EA36; Thu, 15 Dec 2016 17:10:29 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id g23so7776295wme.1; Thu, 15 Dec 2016 09:10:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ofi6EmBYO74nEqRkHUOW7MId/ZlCkcyhTeuy49a7Bls=; b=rHmc/qR+rBXXhRLVFvt08n6T7AozpV9oHrPu5QB/sRY7XSMIYyy39/Z0TlNs98erIb kQZosUFntJHJVtdjk88jKxlwVvxPyjrDQL58I8pGweUAzoFH3EThEBntt9e1dUlnzL7E 970XhsA5Ckg+mpLeptM4QNOBbFchB8ywzMIArQv/d5JSC17mgx1huHM2qRjmC+nefUOm gQ+0s0Or+UZPGpUsvj1GlH5zzorJstukQozNno4+0OsF2+yVv5DOWjLbIkjuA7hP1lD3 kBdemMEG1Dg47roRhIxxhaC09Ej56zBZU1D3Ui/6AGM4rrJgSZKTaGE/Gy+SZqiCcKXL pQcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ofi6EmBYO74nEqRkHUOW7MId/ZlCkcyhTeuy49a7Bls=; b=dgsR4rsc9nFtDIc2S1+4KG2tdAAR1f6GXHaVYNgPIFnXlNJQsQDRfCHKJAdQgNtRTD 8M60p2oLYLVOWs1X+TgMtRM53tCr9Y2sC10VLjgeOGSmEzWXnEDJ+TWHeo832XA3zBro 3Q/bnsO8YWTFIFGxXOwV+safU/SGVF68gptQ/k5iBMsABBVJ8oYxiL90tYHdJ21MdsHH yrafxL6ir+x/0MHKmWeCSD0R47UI4s/W0Yjltka6M6AwagstAX+kzCpfp+Ofq5kOGi0s U/gG7Wn+uL2cFqVbQE2dL1HlozBnFEf1PufOnhjxUmFdm+qziShTZjCtqN4N1Dt84+04 6/3g== X-Gm-Message-State: AIkVDXKIit8Q/NxyTnlVSeaiLQSbIKsWbwTT4OAxvGB2OwSWB1tIdHizInIyzGj8zt9y2g== X-Received: by 10.28.134.204 with SMTP id i195mr2374625wmd.77.1481821827194; Thu, 15 Dec 2016 09:10:27 -0800 (PST) Received: from auriga.fritz.box ([2001:a61:1106:8e01:10c0:f59e:de43:5485]) by smtp.gmail.com with ESMTPSA id d85sm13323015wmd.17.2016.12.15.09.10.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Dec 2016 09:10:26 -0800 (PST) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: amd-gfx@lists.freedesktop.org Subject: [PATCH 3/5] drm/amd/amdgpu: add amdgpu_bo_gpu_accessible helper function Date: Thu, 15 Dec 2016 18:10:13 +0100 Message-Id: <1481821815-9971-4-git-send-email-nhaehnle@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481821815-9971-1-git-send-email-nhaehnle@gmail.com> References: <1481821815-9971-1-git-send-email-nhaehnle@gmail.com> MIME-Version: 1.0 Cc: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolai Hähnle Signed-off-by: Nicolai Hähnle Reviewed-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 4306b2f..15a723a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -107,20 +107,29 @@ static inline unsigned amdgpu_bo_gpu_page_alignment(struct amdgpu_bo *bo) * amdgpu_bo_mmap_offset - return mmap offset of bo * @bo: amdgpu object for which we query the offset * * Returns mmap offset of the object. */ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo) { return drm_vma_node_offset_addr(&bo->tbo.vma_node); } +/** + * amdgpu_bo_gpu_accessible - return whether the bo is currently in memory that + * is accessible to the GPU. + */ +static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo) +{ + return bo->tbo.mem.mem_type != TTM_PL_SYSTEM; +} + int amdgpu_bo_create(struct amdgpu_device *adev, unsigned long size, int byte_align, bool kernel, u32 domain, u64 flags, struct sg_table *sg, struct reservation_object *resv, struct amdgpu_bo **bo_ptr); int amdgpu_bo_create_restricted(struct amdgpu_device *adev, unsigned long size, int byte_align, bool kernel, u32 domain, u64 flags, struct sg_table *sg,