aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-12-07 17:15:09 -0500
committerDave Airlie <airlied@redhat.com>2017-12-07 17:15:09 -0500
commitc2ef3a67c3b98f18fcd09d1ce032bb5e11a634a5 (patch)
tree4c4cb56c38e3caa6abd5a72f3d168a35cb040328
parentbd3a3a2e92624942a143e485c83e641b2492d828 (diff)
parent1cd6ae355bb2092a6a511558334564cb1f4ffd43 (diff)
Merge tag 'exynos-drm-fixes-for-v4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes
- fix page fault issue due to using wrong device object in prime import. - drop NONCONTIG flag without IOMMU support. - remove unnecessary members and declaration. * tag 'exynos-drm-fixes-for-v4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: drm/exynos: remove unnecessary function declaration drm/exynos: remove unnecessary descrptions drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU drm/exynos: Fix dma-buf import
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c46
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h5
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c15
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.h2
4 files changed, 39 insertions, 29 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 82b72425a42f..27e423b87266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -37,8 +37,6 @@
37#define DRIVER_MAJOR 1 37#define DRIVER_MAJOR 1
38#define DRIVER_MINOR 0 38#define DRIVER_MINOR 0
39 39
40static struct device *exynos_drm_get_dma_device(void);
41
42int exynos_atomic_check(struct drm_device *dev, 40int exynos_atomic_check(struct drm_device *dev,
43 struct drm_atomic_state *state) 41 struct drm_atomic_state *state)
44{ 42{
@@ -148,7 +146,7 @@ static struct drm_driver exynos_drm_driver = {
148 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 146 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
149 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 147 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
150 .gem_prime_export = drm_gem_prime_export, 148 .gem_prime_export = drm_gem_prime_export,
151 .gem_prime_import = drm_gem_prime_import, 149 .gem_prime_import = exynos_drm_gem_prime_import,
152 .gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table, 150 .gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
153 .gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table, 151 .gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
154 .gem_prime_vmap = exynos_drm_gem_prime_vmap, 152 .gem_prime_vmap = exynos_drm_gem_prime_vmap,
@@ -301,6 +299,27 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
301 return match ?: ERR_PTR(-ENODEV); 299 return match ?: ERR_PTR(-ENODEV);
302} 300}
303 301
302static struct device *exynos_drm_get_dma_device(void)
303{
304 int i;
305
306 for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
307 struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
308 struct device *dev;
309
310 if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
311 continue;
312
313 while ((dev = bus_find_device(&platform_bus_type, NULL,
314 &info->driver->driver,
315 (void *)platform_bus_type.match))) {
316 put_device(dev);
317 return dev;
318 }
319 }
320 return NULL;
321}
322
304static int exynos_drm_bind(struct device *dev) 323static int exynos_drm_bind(struct device *dev)
305{ 324{
306 struct exynos_drm_private *private; 325 struct exynos_drm_private *private;
@@ -469,27 +488,6 @@ static struct platform_driver exynos_drm_platform_driver = {
469 }, 488 },
470}; 489};
471 490
472static struct device *exynos_drm_get_dma_device(void)
473{
474 int i;
475
476 for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
477 struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
478 struct device *dev;
479
480 if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
481 continue;
482
483 while ((dev = bus_find_device(&platform_bus_type, NULL,
484 &info->driver->driver,
485 (void *)platform_bus_type.match))) {
486 put_device(dev);
487 return dev;
488 }
489 }
490 return NULL;
491}
492
493static void exynos_drm_unregister_devices(void) 491static void exynos_drm_unregister_devices(void)
494{ 492{
495 int i; 493 int i;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index c6847fa708fa..589d465a7f88 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -194,11 +194,6 @@ struct drm_exynos_file_private {
194/* 194/*
195 * Exynos drm private structure. 195 * Exynos drm private structure.
196 * 196 *
197 * @da_start: start address to device address space.
198 * with iommu, device address space starts from this address
199 * otherwise default one.
200 * @da_space_size: size of device address space.
201 * if 0 then default value is used for it.
202 * @pending: the crtcs that have pending updates to finish 197 * @pending: the crtcs that have pending updates to finish
203 * @lock: protect access to @pending 198 * @lock: protect access to @pending
204 * @wait: wait an atomic commit to finish 199 * @wait: wait an atomic commit to finish
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 077de014d610..11cc01b47bc0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
247 if (IS_ERR(exynos_gem)) 247 if (IS_ERR(exynos_gem))
248 return exynos_gem; 248 return exynos_gem;
249 249
250 if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
251 /*
252 * when no IOMMU is available, all allocated buffers are
253 * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
254 */
255 flags &= ~EXYNOS_BO_NONCONTIG;
256 DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
257 }
258
250 /* set memory type and cache attribute from user side. */ 259 /* set memory type and cache attribute from user side. */
251 exynos_gem->flags = flags; 260 exynos_gem->flags = flags;
252 261
@@ -506,6 +515,12 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
506} 515}
507 516
508/* low-level interface prime helpers */ 517/* low-level interface prime helpers */
518struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
519 struct dma_buf *dma_buf)
520{
521 return drm_gem_prime_import_dev(dev, dma_buf, to_dma_dev(dev));
522}
523
509struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj) 524struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj)
510{ 525{
511 struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); 526 struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h
index e86d1a9518c3..5a4c7de80f65 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -117,6 +117,8 @@ int exynos_drm_gem_fault(struct vm_fault *vmf);
117int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 117int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
118 118
119/* low-level interface prime helpers */ 119/* low-level interface prime helpers */
120struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
121 struct dma_buf *dma_buf);
120struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj); 122struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj);
121struct drm_gem_object * 123struct drm_gem_object *
122exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, 124exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,