From patchwork Tue Aug 28 12:51:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 10578395 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 31F1C13B8 for ; Tue, 28 Aug 2018 12:52:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EA3D2A1C5 for ; Tue, 28 Aug 2018 12:52:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1239D2A18D; Tue, 28 Aug 2018 12:52:12 +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 232962A1BD for ; Tue, 28 Aug 2018 12:52:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0431A6E34F; Tue, 28 Aug 2018 12:52:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD5136E34F for ; Tue, 28 Aug 2018 12:52:06 +0000 (UTC) Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:34828 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1fudTY-0003Vt-Ov; Tue, 28 Aug 2018 14:52:04 +0200 From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 0/2] drm: Add shmem GEM library Date: Tue, 28 Aug 2018 14:51:52 +0200 Message-Id: <20180828125154.12822-1-noralf@tronnes.org> X-Mailer: git-send-email 2.15.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: david@lechnology.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patchset adds a library for shmem backed GEM objects and makes use of it in tinydrm. When I made tinydrm I used the CMA helper because it was very easy to use. July last year I learned that this limits which drivers to PRIME import from, since CMA requires continuous memory. tinydrm drivers don't require that. So I set out to change that looking first at shmem, but that wasn't working since shmem didn't work with fbdev deferred I/O. Then I did a vmalloc buffer attempt which worked with deferred I/O, but maybe wouldn't be of so much use as a library for other drivers to use. As my work to split out stuff from the CMA helper for shared use came to an end, I had a generic fbdev emulation that uses a shadow buffer for deferred I/O. This means that I can now use shmem buffers after all. I have looked at the other drivers that use drm_gem_get_pages() and several supports different cache modes so I've done that even though tinydrm only uses the cached one. tinydrm can both use vmalloc and shmem buffers, it doesn't matter as far as I can see. So the question is what will benefit the rest of DRM the most. This is what a vmalloc helper might look like (minus the now unneeded fbdev stuff): https://patchwork.freedesktop.org/patch/182735/ Noralf. Noralf Trønnes (2): drm: Add library for shmem backed GEM objects drm/tinydrm: Switch from CMA to shmem buffers Documentation/gpu/drm-kms-helpers.rst | 12 + drivers/gpu/drm/Kconfig | 6 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_gem_shmem_helper.c | 673 +++++++++++++++++++++++++ drivers/gpu/drm/tinydrm/Kconfig | 2 +- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 90 +--- drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 5 + drivers/gpu/drm/tinydrm/ili9225.c | 14 +- drivers/gpu/drm/tinydrm/ili9341.c | 6 +- drivers/gpu/drm/tinydrm/mi0283qt.c | 6 +- drivers/gpu/drm/tinydrm/mipi-dbi.c | 38 +- drivers/gpu/drm/tinydrm/repaper.c | 24 +- drivers/gpu/drm/tinydrm/st7586.c | 15 +- drivers/gpu/drm/tinydrm/st7735r.c | 6 +- include/drm/drm_gem_shmem_helper.h | 198 ++++++++ include/drm/tinydrm/tinydrm.h | 36 +- 16 files changed, 978 insertions(+), 154 deletions(-) create mode 100644 drivers/gpu/drm/drm_gem_shmem_helper.c create mode 100644 include/drm/drm_gem_shmem_helper.h