From patchwork Wed Oct 17 13:04:49 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: 10645611 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 CF47D13B0 for ; Wed, 17 Oct 2018 13:21:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C17F42B0BB for ; Wed, 17 Oct 2018 13:21:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B60CC2B0C7; Wed, 17 Oct 2018 13:21: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=unavailable 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 665952B0BB for ; Wed, 17 Oct 2018 13:21:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E73F6E38E; Wed, 17 Oct 2018 13:21:11 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 61BD06E389 for ; Wed, 17 Oct 2018 13:21:09 +0000 (UTC) Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:33958 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 1gClVg-0007x9-04; Wed, 17 Oct 2018 15:05:12 +0200 From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org Date: Wed, 17 Oct 2018 15:04:49 +0200 Message-Id: <20181017130454.44292-1-noralf@tronnes.org> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 0/5] drm: Add shmem GEM library X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas@shipmail.org, intel-gfx@lists.freedesktop.org, =?utf-8?q?Noralf_T?= =?utf-8?q?r=C3=B8nnes?= , sam@ravnborg.org, david@lechnology.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This patchset adds a library for shmem backed GEM objects and makes use of it in tinydrm. Daniel suggested that I make a generic mmap function for GEM PRIME. I wondered if I could make it the default for drm_driver->gem_prime_mmap so I looked at all the drivers that don't set that callback: - armada, i915, omap and udl has their own dmabuf implementations. - nouveau and radeon use drm_gem_prime_export(), but don't set the ->gem_prime_mmap callback. Making it default would change the behaviour of those last two so I let it be. I'm cc'ing intel-gfx to have the CI look at the core changes I've made. I can't exercise all the codepaths using vc4 and tinydrm. Noralf. Changes since version 4: - Add drm_gem_prime_mmap() (Daniel Vetter) - Drop drm_gem_object_funcs->prime_mmap - drm_gem_shmem_mmap(): Subtract drm_vma_node_start() to get the real vma->vm_pgoff - drm_gem_shmem_fault(): Use vmf->pgoff now that vma->vm_pgoff is correct Changes since version 3: - Drop cache modes (Thomas Hellstrom) - Add a GEM object attached vtable Changes since version 2: - Grammar (Sam Ravnborg) - s/drm_gem_shmem_put_pages_unlocked/drm_gem_shmem_put_pages_locked/ (Sam Ravnborg) - Add debug ouput in error path (Sam Ravnborg) Changes since version 1: - Fix missing argument in docs (kbuild test robot) - Fix: sparse: expression using sizeof(void) (kbuild test robot) - Rebasing gave a new checkpatch warning, so I changed to bitfields: CHECK: Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384 #834: FILE: include/drm/drm_gem_shmem_helper.h:84: + bool pages_mark_dirty_on_put; #841: FILE: include/drm/drm_gem_shmem_helper.h:91: + bool pages_mark_accessed_on_put; Noralf Trønnes (5): drm/driver: Add defaults for .gem_prime_export/import callbacks drm/prime: Add drm_gem_prime_mmap() drm/gem: Add drm_gem_object_funcs drm: Add library for shmem backed GEM objects drm/tinydrm: Switch from CMA to shmem buffers Documentation/gpu/drm-kms-helpers.rst | 12 + Documentation/gpu/todo.rst | 7 + drivers/gpu/drm/Kconfig | 6 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_client.c | 12 +- drivers/gpu/drm/drm_gem.c | 109 ++++- drivers/gpu/drm/drm_gem_shmem_helper.c | 551 +++++++++++++++++++++++++ drivers/gpu/drm/drm_prime.c | 79 +++- drivers/gpu/drm/tinydrm/Kconfig | 2 +- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 92 ++--- 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_drv.h | 4 + include/drm/drm_gem.h | 131 ++++++ include/drm/drm_gem_shmem_helper.h | 153 +++++++ include/drm/drm_prime.h | 1 + include/drm/tinydrm/tinydrm.h | 36 +- 23 files changed, 1122 insertions(+), 188 deletions(-) create mode 100644 drivers/gpu/drm/drm_gem_shmem_helper.c create mode 100644 include/drm/drm_gem_shmem_helper.h