From patchwork Thu Oct 18 16:27:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 10647605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B55E14E2 for ; Thu, 18 Oct 2018 16:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CD0328E42 for ; Thu, 18 Oct 2018 16:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5107F28E53; Thu, 18 Oct 2018 16:28:06 +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.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 0824728E42 for ; Thu, 18 Oct 2018 16:28:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08B756E02C; Thu, 18 Oct 2018 16:28:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C17B89BFF; Thu, 18 Oct 2018 16:28:01 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 094FDAF13; Thu, 18 Oct 2018 16:28:00 +0000 (UTC) From: Thomas Zimmermann To: christian.koenig@amd.com, ray.huang@amd.com, Jerry.Zhang@amd.com, alexander.deucher@amd.com, David1.Zhou@amd.com, airlied@linux.ie Subject: [PATCH 0/3] Provide struct ttm_global for TTM global state Date: Thu, 18 Oct 2018 18:27:49 +0200 Message-Id: <20181018162752.2241-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 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: Thomas Zimmermann , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP TTM provides global memory and a global BO that is shared by all TTM-based drivers. The data structures are provided by struct drm_global and its helpers. All TTM-based DRM drivers copy the initialization and clean-up code for the global TTM state from each other; leading to code duplication. The new structure struct ttm_global and its helpers provide a unified implementation. Drivers only have to initialize it and forward the contained BO global object to ttm_bo_device_init(). The amdgpu and radeon drivers are converted to struct ttm_global as part of this patch set. All other TTM-based drivers share exactly the same code patterns and can be converted in the same way. Future directions: I already have patches for converting the remaining TTM drivers to struct ttm_global. These patches can be merged after the structure has become available in upstream. struct ttm_global is implemented on top of struct drm_global. The latter actually maintains TTM state instead of DRM state. Once all drivers have been converted, the code for struct drm_global can be merged into struct ttm_global. (Resending this patch set, as I forgot to CC the mailing lists as first.) Thomas Zimmermann (3): drm/ttm: Provide struct ttm_global for referencing TTM global state drm/amdgpu: Replace TTM initialization/release with ttm_global drm/radeon: Replace TTM initialization/release with ttm_global drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 63 ++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 4 +- drivers/gpu/drm/radeon/radeon.h | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 40 ++-------- drivers/gpu/drm/ttm/Makefile | 2 +- drivers/gpu/drm/ttm/ttm_global.c | 98 +++++++++++++++++++++++++ include/drm/drm_global.h | 8 ++ include/drm/ttm/ttm_global.h | 79 ++++++++++++++++++++ 8 files changed, 200 insertions(+), 98 deletions(-) create mode 100644 drivers/gpu/drm/ttm/ttm_global.c create mode 100644 include/drm/ttm/ttm_global.h --- 2.19.1