From patchwork Thu Jul 25 01:09:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 169658 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10934927ilk; Wed, 24 Jul 2019 18:10:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV3jseCzXrKhxW+ArItF4Z0oF5UVSQLnQulKyiq33gOYbC0nTuX8zcn/3uFYaHjo/m+4HF X-Received: by 2002:a17:90a:208d:: with SMTP id f13mr87470600pjg.68.1564017013916; Wed, 24 Jul 2019 18:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564017013; cv=none; d=google.com; s=arc-20160816; b=ioJCJc8SedVReyPvEjOG9H6YFHY+47CxSZ+fqCx2vwu8FEQK6DzHPdgDYZJbXIKGQz Rf5QYhLQxxJMDlbBE9kyMQ6qDPMcoNL6V85MhsreleXatA6fXS6evGBIl/uZwnLgpj06 tbtRAl0fw3Wqh2lSZc+ehaqtb6apWaGi7LLgXpe7SuX7wMqmDVKrX0Dhoy02uQbAIxpz WFuNYUy3yExtghJE8jqGEHdvDYEJrH9RgQ3dHlAx6+344XuOfPGvYvR55sndcs9/D7nZ ld15B0aB8shzDipbkkpRsqZoEbN4ApIDUsK6PUmYGj8jW8UshKsrAOvGfZVC1bi/EvlK p9pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=MrPoWX214gLRs1JCqG80V24D2Awrns3iAaLQH0X3yMA=; b=iJyu+IP4XYOLPGahx6MOrBl2DyVlirqXsBq+jwKyCrUABO5TgCmQquCyBS7gBC0k5z NuJ5stJwBpCnH4TfFWcpcY+QXusaaM5flnoK+xPQUvvqjlj2JIxVuV4e2dMkVsSLls/l vULCDbR9YKrM3hkAK47c0uPb1dLSbfVpZx++nIGqu+PZQlYhxGziIZoYrw5kc0cM92// XBzwoVZs7okyZcnLZkTcpv35qX1SFPstz5S9RyyT90FPOaHvzj22hFqlPdtCHbNJB5Ut 4Wu06dkHCtY1WGEjy4As+06i7VFCz82XoT6HIPahCrsHVeeezwN5GmAc5b3dPCAML1Tf ocAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id s19si15391269pgm.291.2019.07.24.18.10.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jul 2019 18:10:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 439766E313; Thu, 25 Jul 2019 01:10:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2DB366E2D1 for ; Thu, 25 Jul 2019 01:10:08 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id k20so93609921ios.10 for ; Wed, 24 Jul 2019 18:10:08 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ohz11I0BD5v1dSKvx1LVUw/2M1EDEBmAhM95SHgIQi4=; b=VGC8enFEGg+QLvlkKPTECdxHdybsnxtvkU01SFJoyiM9mcVZI9+m/vwTp1WSqg6HAC T7hqtmYVp1KEJzeHDW3CgRu6CmydxZBfipECZ1l+eHmkCuwhWYtYEgEi4VL/NA70WSil GyelarPYEso2bPS47/JyccxZoET7/LeOhfEKEwiy7EXPOQjR3OYyTlMQfT18N2qT2Bsl 1IsJpgnfLhpc270jGL7KNm/D0RsxW6lYdWtldNygPi8bCNcEVpe83gdG/lWIInXqqBEi 5ZWKfJY53WJ1J5oV7NwS3xdVpF5JuyKO/xazb3JjqCAkrV4HHsuVzt6MaOoQBKMOdnj+ TLIg== X-Gm-Message-State: APjAAAUpSHWpVuhdaf1AoiLw0EWQkeRRGmTTehTJOjDV3XwNS+6/E3tU GUntdHw/txhKIPhH9b964HCWqL8= X-Received: by 2002:a5e:d817:: with SMTP id l23mr9457434iok.282.1564017007097; Wed, 24 Jul 2019 18:10:07 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id o7sm40675924ioo.81.2019.07.24.18.10.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 18:10:06 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/7] drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages Date: Wed, 24 Jul 2019 19:09:57 -0600 Message-Id: <20190725011003.30837-2-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190725011003.30837-1-robh@kernel.org> References: <20190725011003.30837-1-robh@kernel.org> 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: Tomeu Vizoso , Maxime Ripard , Sean Paul , Steven Price , David Airlie , Boris Brezillon , Alyssa Rosenzweig , Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Panfrost has a need for pages allocated on demand via GPU page faults. When releasing the pages, the only thing preventing using drm_gem_put_pages() is needing to skip over unpopulated pages, so allow for skipping over NULL struct page pointers. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Signed-off-by: Rob Herring --- v2: - new patch drivers/gpu/drm/drm_gem.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 243f43d70f42..db373c945f16 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -633,6 +633,9 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, pagevec_init(&pvec); for (i = 0; i < npages; i++) { + if (!pages[i]) + continue; + if (dirty) set_page_dirty(pages[i]);