summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/omap_gem.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-04-21 00:33:57 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-06-02 10:57:07 +0300
commit930dc19c0b7278c26c85f05f92cb417f2bd28aa3 (patch)
tree7a7694930ad10791e9c19f8b1d0fdd9a0a879a32 /drivers/gpu/drm/omapdrm/omap_gem.c
parent24fbaca0e20acebfcdf7468f03465d5b1966c314 (diff)
downloadlinux-930dc19c0b7278c26c85f05f92cb417f2bd28aa3.tar.gz
drm: omapdrm: DMA-unmap pages for all buffer types when freeing buffers
Both coherent (uncached) and non-coherent (cached) buffers can have their pages mapped to the device through the DMA mapping API. Make sure to unmap any mapped page when freeing a buffer, regardless of its type. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_gem.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index eb02a1399a10..94aef52c36ad 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -316,18 +316,13 @@ static int get_pages(struct drm_gem_object *obj, struct page ***pages)
static void omap_gem_detach_pages(struct drm_gem_object *obj)
{
struct omap_gem_object *omap_obj = to_omap_bo(obj);
+ unsigned int npages = obj->size >> PAGE_SHIFT;
+ unsigned int i;
- /* for non-cached buffers, ensure the new pages are clean because
- * DSS, GPU, etc. are not cache coherent:
- */
- if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) {
- int i, npages = obj->size >> PAGE_SHIFT;
- for (i = 0; i < npages; i++) {
- if (omap_obj->dma_addrs[i])
- dma_unmap_page(obj->dev->dev,
- omap_obj->dma_addrs[i],
- PAGE_SIZE, DMA_BIDIRECTIONAL);
- }
+ for (i = 0; i < npages; i++) {
+ if (omap_obj->dma_addrs[i])
+ dma_unmap_page(obj->dev->dev, omap_obj->dma_addrs[i],
+ PAGE_SIZE, DMA_BIDIRECTIONAL);
}
kfree(omap_obj->dma_addrs);