From patchwork Mon Aug 13 10:24:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 10564013 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 7169614E2 for ; Mon, 13 Aug 2018 10:24:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CC1728F80 for ; Mon, 13 Aug 2018 10:24:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50AC5290C3; Mon, 13 Aug 2018 10:24:55 +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 0474A28F80 for ; Mon, 13 Aug 2018 10:24:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F09CA89FC8; Mon, 13 Aug 2018 10:24:53 +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 BCBB289FC8; Mon, 13 Aug 2018 10:24:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 035FFAD47; Mon, 13 Aug 2018 10:24:50 +0000 (UTC) From: Thomas Zimmermann To: christian.koenig@amd.com, ray.huang@amd.com, Jerry.Zhang@amd.com, dri-devel@lists.freedesktop.org Subject: [PATCH 0/2] Provide init/release functions for struct ttm_bo_global Date: Mon, 13 Aug 2018 12:24:41 +0200 Message-Id: <20180813102443.12662-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.18.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: thellstrom@vmware.com, nouveau@lists.freedesktop.org, airlied@linux.ie, puck.chen@hisilicon.com, amd-gfx@lists.freedesktop.org, virtualization@lists.linux-foundation.org, z.liuxinliang@hisilicon.com, zourongrong@gmail.com, kong.kongxinwei@hisilicon.com, linux-graphics-maintainer@vmware.com, kraxel@redhat.com, Thomas Zimmermann , gregkh@linuxfoundation.org, alexander.deucher@amd.com, bskeggs@redhat.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP TTM uses global memory and BO for backing graphics buffers. These are represented by struct ttm_mem_global and struct ttm_bo_global. Currently, struct ttm_bo_global can only be initialized and released through struct ttm_bo_global_ref. This is a workaround for passing an instance of ttm_mem_global to the BO global initialization code. The use of struct ttm_bo_global_ref makes driver code unnecessary hard to understand. At the same time drivers can use any combination of memory and BO for initializing the global instances. This can result in subtle bugs when the order of initializing and releasing drivers changes. As a first step for resolving these problems, the provided patch set separates initialization and release of struct ttm_bo_global from struct ttm_bo_global_ref. The first patch only renames ttm_bo_global_{init/release}. Hopefully this change can be applied at once for all drivers. Future directions: All TTM-based drivers follow the same pattern for setting up the TTM. In a follow-up patch, this code can be moved into a single place and shared among drivers. Thomas Zimmermann (2): drm/ttm: Rename ttm_bo_global_{init,release}() to ttm_bo_global_ref_*() drm/ttm: Provide ttm_bo_global_{init/release}() for struct ttm_bo_global drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/ast/ast_ttm.c | 4 +- drivers/gpu/drm/bochs/bochs_mm.c | 4 +- drivers/gpu/drm/cirrus/cirrus_ttm.c | 4 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 4 +- drivers/gpu/drm/mgag200/mgag200_ttm.c | 4 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo.c | 12 ++--- drivers/gpu/drm/virtio/virtgpu_ttm.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 4 +- drivers/staging/vboxvideo/vbox_ttm.c | 4 +- include/drm/ttm/ttm_bo_driver.h | 53 ++++++++++++++++----- 14 files changed, 70 insertions(+), 43 deletions(-) --- 2.18.0