Re: [PATCH 9/9] drm/omap: kill omap_gem_helpers.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 07, 2013 at 01:41:27PM -0400, Rob Clark wrote:
> Signed-off-by: Rob Clark <robdclark@xxxxxxxxx>

Patches 5-9 are Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/omapdrm/Makefile           |   3 -
>  drivers/gpu/drm/omapdrm/omap_gem.c         |   8 +-
>  drivers/gpu/drm/omapdrm/omap_gem_helpers.c | 124 -----------------------------
>  3 files changed, 4 insertions(+), 131 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_gem_helpers.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index d85e058..778372b 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -18,7 +18,4 @@ omapdrm-y := omap_drv.o \
>  	omap_dmm_tiler.o \
>  	tcm-sita.o
>  
> -# temporary:
> -omapdrm-y += omap_gem_helpers.o
> -
>  obj-$(CONFIG_DRM_OMAP)	+= omapdrm.o
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
> index f90531fc00..030af5a 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -237,7 +237,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
>  	 * mapping_gfp_mask(mapping) which conflicts w/ GFP_DMA32.. probably
>  	 * we actually want CMA memory for it all anyways..
>  	 */
> -	pages = _drm_gem_get_pages(obj, GFP_KERNEL);
> +	pages = drm_gem_get_pages(obj, GFP_KERNEL);
>  	if (IS_ERR(pages)) {
>  		dev_err(obj->dev->dev, "could not get pages: %ld\n", PTR_ERR(pages));
>  		return PTR_ERR(pages);
> @@ -271,7 +271,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
>  	return 0;
>  
>  free_pages:
> -	_drm_gem_put_pages(obj, pages, true, false);
> +	drm_gem_put_pages(obj, pages, true, false);
>  
>  	return ret;
>  }
> @@ -295,7 +295,7 @@ static void omap_gem_detach_pages(struct drm_gem_object *obj)
>  	kfree(omap_obj->addrs);
>  	omap_obj->addrs = NULL;
>  
> -	_drm_gem_put_pages(obj, omap_obj->pages, true, false);
> +	drm_gem_put_pages(obj, omap_obj->pages, true, false);
>  	omap_obj->pages = NULL;
>  }
>  
> @@ -316,7 +316,7 @@ static uint64_t mmap_offset(struct drm_gem_object *obj)
>  
>  	/* Make it mmapable */
>  	size = omap_gem_mmap_size(obj);
> -	ret = _drm_gem_create_mmap_offset_size(obj, size);
> +	ret = drm_gem_create_mmap_offset_size(obj, size);
>  	if (ret) {
>  		dev_err(dev->dev, "could not allocate mmap offset\n");
>  		return 0;
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem_helpers.c b/drivers/gpu/drm/omapdrm/omap_gem_helpers.c
> deleted file mode 100644
> index dbb1575..0000000
> --- a/drivers/gpu/drm/omapdrm/omap_gem_helpers.c
> +++ /dev/null
> @@ -1,124 +0,0 @@
> -/*
> - * drivers/gpu/drm/omapdrm/omap_gem_helpers.c
> - *
> - * Copyright (C) 2011 Texas Instruments
> - * Author: Rob Clark <rob.clark@xxxxxxxxxx>
> - *
> - * This program is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License version 2 as published by
> - * the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful, but WITHOUT
> - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> - * more details.
> - *
> - * You should have received a copy of the GNU General Public License along with
> - * this program.  If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -/* temporary copy of drm_gem_{get,put}_pages() until the
> - * "drm/gem: add functions to get/put pages" patch is merged..
> - */
> -
> -#include <linux/module.h>
> -#include <linux/types.h>
> -#include <linux/shmem_fs.h>
> -
> -#include <drm/drmP.h>
> -
> -/**
> - * drm_gem_get_pages - helper to allocate backing pages for a GEM object
> - * @obj: obj in question
> - * @gfpmask: gfp mask of requested pages
> - */
> -struct page **_drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask)
> -{
> -	struct inode *inode;
> -	struct address_space *mapping;
> -	struct page *p, **pages;
> -	int i, npages;
> -
> -	/* This is the shared memory object that backs the GEM resource */
> -	inode = file_inode(obj->filp);
> -	mapping = inode->i_mapping;
> -
> -	npages = obj->size >> PAGE_SHIFT;
> -
> -	pages = drm_malloc_ab(npages, sizeof(struct page *));
> -	if (pages == NULL)
> -		return ERR_PTR(-ENOMEM);
> -
> -	gfpmask |= mapping_gfp_mask(mapping);
> -
> -	for (i = 0; i < npages; i++) {
> -		p = shmem_read_mapping_page_gfp(mapping, i, gfpmask);
> -		if (IS_ERR(p))
> -			goto fail;
> -		pages[i] = p;
> -
> -		/* There is a hypothetical issue w/ drivers that require
> -		 * buffer memory in the low 4GB.. if the pages are un-
> -		 * pinned, and swapped out, they can end up swapped back
> -		 * in above 4GB.  If pages are already in memory, then
> -		 * shmem_read_mapping_page_gfp will ignore the gfpmask,
> -		 * even if the already in-memory page disobeys the mask.
> -		 *
> -		 * It is only a theoretical issue today, because none of
> -		 * the devices with this limitation can be populated with
> -		 * enough memory to trigger the issue.  But this BUG_ON()
> -		 * is here as a reminder in case the problem with
> -		 * shmem_read_mapping_page_gfp() isn't solved by the time
> -		 * it does become a real issue.
> -		 *
> -		 * See this thread: http://lkml.org/lkml/2011/7/11/238
> -		 */
> -		BUG_ON((gfpmask & __GFP_DMA32) &&
> -				(page_to_pfn(p) >= 0x00100000UL));
> -	}
> -
> -	return pages;
> -
> -fail:
> -	while (i--)
> -		page_cache_release(pages[i]);
> -
> -	drm_free_large(pages);
> -	return ERR_CAST(p);
> -}
> -
> -/**
> - * drm_gem_put_pages - helper to free backing pages for a GEM object
> - * @obj: obj in question
> - * @pages: pages to free
> - */
> -void _drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
> -		bool dirty, bool accessed)
> -{
> -	int i, npages;
> -
> -	npages = obj->size >> PAGE_SHIFT;
> -
> -	for (i = 0; i < npages; i++) {
> -		if (dirty)
> -			set_page_dirty(pages[i]);
> -
> -		if (accessed)
> -			mark_page_accessed(pages[i]);
> -
> -		/* Undo the reference we took when populating the table */
> -		page_cache_release(pages[i]);
> -	}
> -
> -	drm_free_large(pages);
> -}
> -
> -int
> -_drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size)
> -{
> -	struct drm_device *dev = obj->dev;
> -	struct drm_gem_mm *mm = dev->mm_private;
> -
> -	return drm_vma_offset_add(&mm->vma_manager, &obj->vma_node,
> -				  size / PAGE_SIZE);
> -}
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux