diff mbox series

[v2,1/7] drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages

Message ID 20190725011003.30837-2-robh@kernel.org
State Superseded
Headers show
Series drm/panfrost: Add heap and no execute buffer allocation | expand

Commit Message

Rob Herring July 25, 2019, 1:09 a.m. UTC
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 <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
v2:
 - new patch

 drivers/gpu/drm/drm_gem.c | 3 +++
 1 file changed, 3 insertions(+)

--
2.20.1

Comments

Steven Price July 25, 2019, 3:36 p.m. UTC | #1
On 25/07/2019 02:09, Rob Herring wrote:
> 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 <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Rob Herring <robh@kernel.org>

LGTM: Reviewed-by: Steven Price <steven.price@arm.com>

> ---
> v2:
>  - new patch
> 
>  drivers/gpu/drm/drm_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> 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]);
> 
> --
> 2.20.1
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox series

Patch

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]);