diff options
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_fbdev.c')
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index f433eb7533a9..71f867340a88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
| @@ -6,24 +6,10 @@ | |||
| 6 | * Joonyoung Shim <jy0922.shim@samsung.com> | 6 | * Joonyoung Shim <jy0922.shim@samsung.com> |
| 7 | * Seung-Woo Kim <sw0312.kim@samsung.com> | 7 | * Seung-Woo Kim <sw0312.kim@samsung.com> |
| 8 | * | 8 | * |
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a | 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * copy of this software and associated documentation files (the "Software"), | 10 | * under the terms of the GNU General Public License as published by the |
| 11 | * to deal in the Software without restriction, including without limitation | 11 | * Free Software Foundation; either version 2 of the License, or (at your |
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 12 | * option) any later version. |
| 13 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 14 | * Software is furnished to do so, subject to the following conditions: | ||
| 15 | * | ||
| 16 | * The above copyright notice and this permission notice (including the next | ||
| 17 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 18 | * Software. | ||
| 19 | * | ||
| 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 23 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 26 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 27 | */ | 13 | */ |
| 28 | 14 | ||
| 29 | #include <drm/drmP.h> | 15 | #include <drm/drmP.h> |
| @@ -34,6 +20,7 @@ | |||
| 34 | #include "exynos_drm_drv.h" | 20 | #include "exynos_drm_drv.h" |
| 35 | #include "exynos_drm_fb.h" | 21 | #include "exynos_drm_fb.h" |
| 36 | #include "exynos_drm_gem.h" | 22 | #include "exynos_drm_gem.h" |
| 23 | #include "exynos_drm_iommu.h" | ||
| 37 | 24 | ||
| 38 | #define MAX_CONNECTOR 4 | 25 | #define MAX_CONNECTOR 4 |
| 39 | #define PREFERRED_BPP 32 | 26 | #define PREFERRED_BPP 32 |
| @@ -111,9 +98,18 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | |||
| 111 | 98 | ||
| 112 | /* map pages with kernel virtual space. */ | 99 | /* map pages with kernel virtual space. */ |
| 113 | if (!buffer->kvaddr) { | 100 | if (!buffer->kvaddr) { |
| 114 | unsigned int nr_pages = buffer->size >> PAGE_SHIFT; | 101 | if (is_drm_iommu_supported(dev)) { |
| 115 | buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, | 102 | unsigned int nr_pages = buffer->size >> PAGE_SHIFT; |
| 103 | |||
| 104 | buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, | ||
| 116 | pgprot_writecombine(PAGE_KERNEL)); | 105 | pgprot_writecombine(PAGE_KERNEL)); |
| 106 | } else { | ||
| 107 | phys_addr_t dma_addr = buffer->dma_addr; | ||
| 108 | if (dma_addr) | ||
| 109 | buffer->kvaddr = phys_to_virt(dma_addr); | ||
| 110 | else | ||
| 111 | buffer->kvaddr = (void __iomem *)NULL; | ||
| 112 | } | ||
| 117 | if (!buffer->kvaddr) { | 113 | if (!buffer->kvaddr) { |
| 118 | DRM_ERROR("failed to map pages to kernel space.\n"); | 114 | DRM_ERROR("failed to map pages to kernel space.\n"); |
| 119 | return -EIO; | 115 | return -EIO; |
| @@ -128,8 +124,12 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | |||
| 128 | 124 | ||
| 129 | dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; | 125 | dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; |
| 130 | fbi->screen_base = buffer->kvaddr + offset; | 126 | fbi->screen_base = buffer->kvaddr + offset; |
| 131 | fbi->fix.smem_start = (unsigned long) | 127 | if (is_drm_iommu_supported(dev)) |
| 128 | fbi->fix.smem_start = (unsigned long) | ||
| 132 | (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); | 129 | (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); |
| 130 | else | ||
| 131 | fbi->fix.smem_start = (unsigned long)buffer->dma_addr; | ||
| 132 | |||
| 133 | fbi->screen_size = size; | 133 | fbi->screen_size = size; |
| 134 | fbi->fix.smem_len = size; | 134 | fbi->fix.smem_len = size; |
| 135 | 135 | ||
| @@ -320,7 +320,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, | |||
| 320 | struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; | 320 | struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; |
| 321 | struct drm_framebuffer *fb; | 321 | struct drm_framebuffer *fb; |
| 322 | 322 | ||
| 323 | if (exynos_gem_obj->buffer->kvaddr) | 323 | if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr) |
| 324 | vunmap(exynos_gem_obj->buffer->kvaddr); | 324 | vunmap(exynos_gem_obj->buffer->kvaddr); |
| 325 | 325 | ||
| 326 | /* release drm framebuffer and real buffer */ | 326 | /* release drm framebuffer and real buffer */ |
