From patchwork Fri Sep 27 09:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11164161 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 A19A314DB for ; Fri, 27 Sep 2019 09:13:32 +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 89A4C2146E for ; Fri, 27 Sep 2019 09:13:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89A4C2146E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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 B97236EECE; Fri, 27 Sep 2019 09:13:31 +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 961FA6EEC6 for ; Fri, 27 Sep 2019 09:13:04 +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 16C41AE7F; Fri, 27 Sep 2019 09:13:03 +0000 (UTC) From: Thomas Zimmermann To: airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com, sam@ravnborg.org Subject: [PATCH v3 0/7] drm/mgag200: Place cursor BOs at VRAM high-end Date: Fri, 27 Sep 2019 11:12:54 +0200 Message-Id: <20190927091301.10574-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.23.0 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 , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" (was: drm/ast/mgag200: Place cursor BOs at VRAM high-end) This patchset cleans up the memory management of HW cursors in mgag200. It further moves the allocated cursor BOs to the of the video RAM to reduce memory fragmentation. The mgag200 driver manages cursor memory in dedicated GEM VRAM buffer objects. It uses a double-buffering scheme of alternating between two GEM BOs The code is convoluted and can lead to memory fragmentation if a BO is stored the middle of VRAM. This is especially a problem as mgag200 devices only contain a small amount of video memory (e.g., 16 MiB). With this patchset, the cursor handling in mgag200 is first split up into separate functions for copying cursor images, managing buffer objects, setting scanout addresses, and moving and hiding the cursor. Furthermore, the driver dedicates a few KiB at the high end of a device's video memory to storing the cursor's buffer objects. This prevents memory fragmentation. The patchset has been tested on mgag200 hardware. v3: * split-off mgag200 patches into separate series v2: * remove VRAM buffers in favor of GEM BOs * manage BO placement with pin flag Thomas Zimmermann (7): drm/mgag200: Rename cursor functions to use mgag200_ prefix drm/mgag200: Add init and fini functions for cursor handling drm/mgag200: Add separate move-cursor function drm/mgag200: Move cursor-image update to mgag200_show_cursor() drm/mgag200: Move cursor BO swapping into mgag200_show_cursor() drm/mgag200: Reserve video memory for cursor plane drm/mgag200: Allocate cursor BOs at high end of video memory drivers/gpu/drm/mgag200/mgag200_cursor.c | 313 ++++++++++++++--------- drivers/gpu/drm/mgag200/mgag200_drv.h | 22 +- drivers/gpu/drm/mgag200/mgag200_main.c | 20 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 6 +- drivers/gpu/drm/mgag200/mgag200_ttm.c | 4 + 5 files changed, 216 insertions(+), 149 deletions(-) Acked-by: Gerd Hoffmann --- 2.23.0