From patchwork Mon Oct 7 01:54:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiang Yu X-Patchwork-Id: 11176701 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 852171709 for ; Mon, 7 Oct 2019 01:57:14 +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 6361A2080F for ; Mon, 7 Oct 2019 01:57:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6361A2080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 60A216E40A; Mon, 7 Oct 2019 01:57:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D24D6E40A; Mon, 7 Oct 2019 01:57:11 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id y35so7247463pgl.1; Sun, 06 Oct 2019 18:57:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2bhwS/SnHsqondyimF4YNq31YFsWVxNjhPDLbhSOJg4=; b=Pw/zpktFF3iZ4Pyuda6ijsHvyMoeSWhuUFwLsQ4yVxezH7vAV2TCsqLFoDNUMsImlv RQ4W28Q7z1ro79+ma22LAdh8zGzfRbW+5CX2nJfR7+FZbyL5mQdy0huTEbMtlqDWJaUA ccR6xRb8lzNgR5jAU6Ytz4xYsm9VI2msgDuOQ0KLxYCWB2DcoysuWwhQE2+gVvKJZLHl zPjCpCb+9IW+VnRksZUO4xR8HVg6VrE5C0qtHh5RP1xkzLorKOoeU1NUga1Fjax/YuHj RRE/1c05XMs/McDmB3GPDJWtLWP6tu2P0cYsw/w+mrEt3h1PiGs9qLNPGdYAnYrbYjrr BdVw== X-Gm-Message-State: APjAAAU3MFZrF04SQyI+wEEv7oOucxbYLePeeZka9DJClEh8mcY2Oesr U5lafmFm90VCSlPMhBUCoEgQ4cVRQWw= X-Google-Smtp-Source: APXvYqxpJfT0BrRua7QU2H1BcE5+SiqSvmgJQt+qT5ktV9LqqwKRB1IT3fY3VkEAIQM0f6V8JClMVQ== X-Received: by 2002:a17:90a:24a1:: with SMTP id i30mr32034346pje.128.1570413430867; Sun, 06 Oct 2019 18:57:10 -0700 (PDT) Received: from yuq-Aspire-4738G.lan (ah.ptr230.ptrcloud.net. [153.122.161.8]) by smtp.gmail.com with ESMTPSA id b123sm18328536pgc.72.2019.10.06.18.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 18:57:10 -0700 (PDT) From: Qiang Yu To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 0/6] drm/lima: simplify driver by using more drm helpers Date: Mon, 7 Oct 2019 09:54:24 +0800 Message-Id: <20191007015430.20829-1-yuq825@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2bhwS/SnHsqondyimF4YNq31YFsWVxNjhPDLbhSOJg4=; b=QD6C5I62nwIwALeKCWetD4hX7iw+c77A7lzpL9Tbli707itE4Eemt4CNgsWNmRWVxG 7GpHnfh8YyNV4ovYrR5qRYsNimG68N3OKt+71HqVpi4aLkocx/QGCKo1SylDTHPOHm0q 7fp1AlqBtokPJjy10nnURc+pqZZnI17aYQAQPY2QQ0SUDxFG/bRhNDtISZ7SOof0RFRy GfhAMwB7zeMJL5ZdLGBNcrUpJe2tbXzaGCV1Zb41gq/cEnPBIrAc7h8e22uq5Nz7+7lJ 8bMmKlnnaojjEOCNPnW0aisp2BjB3qj3Ai0/XV6jQ9fq1PU5DbqSoE3IlArzeUqKVSvf 87gg== 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: lima@lists.freedesktop.org, David Airlie , Maxime Ripard , Qiang Yu , Sean Paul MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" By using shared drm helpers: 1. drm_gem_objects_lookup 2. drm_gem_(un)lock_reservations 3. drm_gem_shmem_helpers we can simplify lima driver a lot and benifit from updates to these functions. drm_gem_objects_lookup need a refine in order to be used by lima. Note: 1. changes to panfrost and v3d are just compile tested. 2. patch series is based on drm-misc-next branch v2: Add drm_gem_objects_lookup_user and use it for driver which pass user GEM handles in contious array. v3: improve commit comment. Qiang Yu (6): drm/gem: refine drm_gem_objects_lookup drm/v3d: use drm_gem_objects_lookup_user drm/lima: use drm_gem_objects_lookup drm/lima: use drm_gem_shmem_helpers drm/lima: use drm_gem_(un)lock_reservations drm/lima: add __GFP_NOWARN flag to all dma_alloc_wc drivers/gpu/drm/drm_gem.c | 57 ++++-- drivers/gpu/drm/lima/Kconfig | 1 + drivers/gpu/drm/lima/Makefile | 4 +- drivers/gpu/drm/lima/lima_device.c | 2 +- drivers/gpu/drm/lima/lima_drv.c | 27 +-- drivers/gpu/drm/lima/lima_gem.c | 254 ++++++++++-------------- drivers/gpu/drm/lima/lima_gem.h | 32 ++- drivers/gpu/drm/lima/lima_gem_prime.c | 46 ----- drivers/gpu/drm/lima/lima_gem_prime.h | 13 -- drivers/gpu/drm/lima/lima_mmu.c | 1 - drivers/gpu/drm/lima/lima_object.c | 119 ----------- drivers/gpu/drm/lima/lima_object.h | 35 ---- drivers/gpu/drm/lima/lima_sched.c | 6 +- drivers/gpu/drm/lima/lima_vm.c | 87 ++++---- drivers/gpu/drm/panfrost/panfrost_drv.c | 6 +- drivers/gpu/drm/v3d/v3d_gem.c | 49 +---- include/drm/drm_gem.h | 4 +- 17 files changed, 239 insertions(+), 504 deletions(-) delete mode 100644 drivers/gpu/drm/lima/lima_gem_prime.c delete mode 100644 drivers/gpu/drm/lima/lima_gem_prime.h delete mode 100644 drivers/gpu/drm/lima/lima_object.c delete mode 100644 drivers/gpu/drm/lima/lima_object.h