Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm update from Dave Airlie:
"Exynos and Radeon mostly, with a dma-buf and ttm fix thrown in.

It's a bit big but its mostly exynos license fix ups and I'd rather
not hold those up since its legally stuff.

Radeon has a couple of fixes from dma engine work, TTM is just a
locking fix, and dma-buf fix has been hanging around and I finally got
a chance to review it."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (30 commits)
drm/ttm: fix fence locking in ttm_buffer_object_transfer
drm/prime: drop reference on imported dma-buf come from gem
drm/radeon: add quirk for d3 delay during switcheroo poweron for apple macbooks
drm/exynos: move finish page flip to a common place
drm/exynos: fimd: modify condition in fimd resume
drm/radeon: fix DMA CS parser for r6xx linear copy packet
drm/radeon: split r6xx and r7xx copy_dma functions
drm/exynos: Use devm_clk_get in exynos_drm_gsc.c
drm/exynos: Remove redundant NULL check in exynos_drm_gsc.c
drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_gsc.c
drm/exynos: Use devm_clk_get in exynos_drm_rotator.c
drm/exynos: Remove redundant NULL check in exynos_drm_rotator.c
drm/exynos: Remove unnecessary devm_* freeing APIs in exynos_drm_rotator.c
drm/exynos: Use devm_clk_get in exynos_drm_fimc.c
drm/exynos: Remove redundant NULL check
drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c
drm/exynos: Use devm_kzalloc in exynos_drm_ipp.c
drm/exynos: fix gem buffer allocation type checking
drm/exynos: remove needless parenthesis.
drm/exynos: fix incorrect interrupt induced by m2m operation.
...

+447 -828
+53 -26
drivers/gpu/drm/exynos/exynos_drm_buf.c
··· 3 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #include <drm/drmP.h> ··· 15 29 #include "exynos_drm_drv.h" 16 30 #include "exynos_drm_gem.h" 17 31 #include "exynos_drm_buf.h" 32 + #include "exynos_drm_iommu.h" 18 33 19 34 static int lowlevel_buffer_allocate(struct drm_device *dev, 20 35 unsigned int flags, struct exynos_drm_gem_buf *buf) ··· 38 51 * region will be allocated else physically contiguous 39 52 * as possible. 40 53 */ 41 - if (flags & EXYNOS_BO_CONTIG) 54 + if (!(flags & EXYNOS_BO_NONCONTIG)) 42 55 dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs); 43 56 44 57 /* ··· 53 66 dma_set_attr(attr, &buf->dma_attrs); 54 67 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs); 55 68 56 - buf->pages = dma_alloc_attrs(dev->dev, buf->size, 57 - &buf->dma_addr, GFP_KERNEL, &buf->dma_attrs); 58 - if (!buf->pages) { 59 - DRM_ERROR("failed to allocate buffer.\n"); 60 - return -ENOMEM; 69 + nr_pages = buf->size >> PAGE_SHIFT; 70 + 71 + if (!is_drm_iommu_supported(dev)) { 72 + dma_addr_t start_addr; 73 + unsigned int i = 0; 74 + 75 + buf->pages = kzalloc(sizeof(struct page) * nr_pages, 76 + GFP_KERNEL); 77 + if (!buf->pages) { 78 + DRM_ERROR("failed to allocate pages.\n"); 79 + return -ENOMEM; 80 + } 81 + 82 + buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size, 83 + &buf->dma_addr, GFP_KERNEL, 84 + &buf->dma_attrs); 85 + if (!buf->kvaddr) { 86 + DRM_ERROR("failed to allocate buffer.\n"); 87 + kfree(buf->pages); 88 + return -ENOMEM; 89 + } 90 + 91 + start_addr = buf->dma_addr; 92 + while (i < nr_pages) { 93 + buf->pages[i] = phys_to_page(start_addr); 94 + start_addr += PAGE_SIZE; 95 + i++; 96 + } 97 + } else { 98 + 99 + buf->pages = dma_alloc_attrs(dev->dev, buf->size, 100 + &buf->dma_addr, GFP_KERNEL, 101 + &buf->dma_attrs); 102 + if (!buf->pages) { 103 + DRM_ERROR("failed to allocate buffer.\n"); 104 + return -ENOMEM; 105 + } 61 106 } 62 107 63 - nr_pages = buf->size >> PAGE_SHIFT; 64 108 buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); 65 109 if (!buf->sgt) { 66 110 DRM_ERROR("failed to get sg table.\n"); ··· 109 91 dma_free_attrs(dev->dev, buf->size, buf->pages, 110 92 (dma_addr_t)buf->dma_addr, &buf->dma_attrs); 111 93 buf->dma_addr = (dma_addr_t)NULL; 94 + 95 + if (!is_drm_iommu_supported(dev)) 96 + kfree(buf->pages); 112 97 113 98 return ret; 114 99 } ··· 135 114 kfree(buf->sgt); 136 115 buf->sgt = NULL; 137 116 138 - dma_free_attrs(dev->dev, buf->size, buf->pages, 117 + if (!is_drm_iommu_supported(dev)) { 118 + dma_free_attrs(dev->dev, buf->size, buf->kvaddr, 139 119 (dma_addr_t)buf->dma_addr, &buf->dma_attrs); 120 + kfree(buf->pages); 121 + } else 122 + dma_free_attrs(dev->dev, buf->size, buf->pages, 123 + (dma_addr_t)buf->dma_addr, &buf->dma_attrs); 124 + 140 125 buf->dma_addr = (dma_addr_t)NULL; 141 126 } 142 127
+4 -18
drivers/gpu/drm/exynos/exynos_drm_buf.h
··· 3 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_BUF_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_connector.c
··· 5 5 * Joonyoung Shim <jy0922.shim@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #include <drm/drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_connector.h
··· 5 5 * Joonyoung Shim <jy0922.shim@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #ifndef _EXYNOS_DRM_CONNECTOR_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_core.c
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #include <drm/drmP.h>
+34 -18
drivers/gpu/drm/exynos/exynos_drm_crtc.c
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #include <drm/drmP.h> ··· 392 406 393 407 exynos_drm_fn_encoder(private->crtc[crtc], &crtc, 394 408 exynos_drm_disable_vblank); 409 + } 410 + 411 + void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) 412 + { 413 + struct exynos_drm_private *dev_priv = dev->dev_private; 414 + struct drm_pending_vblank_event *e, *t; 415 + struct timeval now; 416 + unsigned long flags; 417 + 418 + DRM_DEBUG_KMS("%s\n", __FILE__); 419 + 420 + spin_lock_irqsave(&dev->event_lock, flags); 421 + 422 + list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, 423 + base.link) { 424 + /* if event's pipe isn't same as crtc then ignore it. */ 425 + if (crtc != e->pipe) 426 + continue; 427 + 428 + do_gettimeofday(&now); 429 + e->event.sequence = 0; 430 + e->event.tv_sec = now.tv_sec; 431 + e->event.tv_usec = now.tv_usec; 432 + 433 + list_move_tail(&e->base.link, &e->base.file_priv->event_list); 434 + wake_up_interruptible(&e->base.file_priv->event_wait); 435 + drm_vblank_put(dev, crtc); 436 + } 437 + 438 + spin_unlock_irqrestore(&dev->event_lock, flags); 395 439 }
+5 -18
drivers/gpu/drm/exynos/exynos_drm_crtc.h
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_CRTC_H_ ··· 18 32 int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); 19 33 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); 20 34 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); 35 + void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc); 21 36 22 37 #endif
+10 -19
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
··· 3 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #include <drm/drmP.h> ··· 208 222 struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); 209 223 210 224 return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops, 211 - exynos_gem_obj->base.size, 0600); 225 + exynos_gem_obj->base.size, flags); 212 226 } 213 227 214 228 struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, ··· 232 246 233 247 /* is it from our device? */ 234 248 if (obj->dev == drm_dev) { 249 + /* 250 + * Importing dmabuf exported from out own gem increases 251 + * refcount on gem itself instead of f_count of dmabuf. 252 + */ 235 253 drm_gem_object_reference(obj); 254 + dma_buf_put(dma_buf); 236 255 return obj; 237 256 } 238 257 }
+4 -18
drivers/gpu/drm/exynos/exynos_drm_dmabuf.h
··· 3 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_DMABUF_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 5 5 * Joonyoung Shim <jy0922.shim@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #include <drm/drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_drv.h
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_DRV_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_encoder.c
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #include <drm/drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_encoder.h
··· 5 5 * Joonyoung Shim <jy0922.shim@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #ifndef _EXYNOS_DRM_ENCODER_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_fb.c
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #include <drm/drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_fb.h
··· 5 5 * Joonyoung Shim <jy0922.shim@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #ifndef _EXYNOS_DRM_FB_H_
+22 -22
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #include <drm/drmP.h> ··· 20 34 #include "exynos_drm_drv.h" 21 35 #include "exynos_drm_fb.h" 22 36 #include "exynos_drm_gem.h" 37 + #include "exynos_drm_iommu.h" 23 38 24 39 #define MAX_CONNECTOR 4 25 40 #define PREFERRED_BPP 32 ··· 98 111 99 112 /* map pages with kernel virtual space. */ 100 113 if (!buffer->kvaddr) { 101 - unsigned int nr_pages = buffer->size >> PAGE_SHIFT; 102 - buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, 114 + if (is_drm_iommu_supported(dev)) { 115 + unsigned int nr_pages = buffer->size >> PAGE_SHIFT; 116 + 117 + buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, 103 118 pgprot_writecombine(PAGE_KERNEL)); 119 + } else { 120 + phys_addr_t dma_addr = buffer->dma_addr; 121 + if (dma_addr) 122 + buffer->kvaddr = phys_to_virt(dma_addr); 123 + else 124 + buffer->kvaddr = (void __iomem *)NULL; 125 + } 104 126 if (!buffer->kvaddr) { 105 127 DRM_ERROR("failed to map pages to kernel space.\n"); 106 128 return -EIO; ··· 124 128 125 129 dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; 126 130 fbi->screen_base = buffer->kvaddr + offset; 127 - fbi->fix.smem_start = (unsigned long) 131 + if (is_drm_iommu_supported(dev)) 132 + fbi->fix.smem_start = (unsigned long) 128 133 (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); 134 + else 135 + fbi->fix.smem_start = (unsigned long)buffer->dma_addr; 136 + 129 137 fbi->screen_size = size; 130 138 fbi->fix.smem_len = size; 131 139 ··· 320 320 struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; 321 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 324 vunmap(exynos_gem_obj->buffer->kvaddr); 325 325 326 326 /* release drm framebuffer and real buffer */
+4 -18
drivers/gpu/drm/exynos/exynos_drm_fbdev.h
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_FBDEV_H_
+39 -85
drivers/gpu/drm/exynos/exynos_drm_fimc.c
··· 25 25 #include "exynos_drm_fimc.h" 26 26 27 27 /* 28 - * FIMC is stand for Fully Interactive Mobile Camera and 28 + * FIMC stands for Fully Interactive Mobile Camera and 29 29 * supports image scaler/rotator and input/output DMA operations. 30 30 * input DMA reads image data from the memory. 31 31 * output DMA writes image data to memory. ··· 163 163 bool suspended; 164 164 }; 165 165 166 - static void fimc_sw_reset(struct fimc_context *ctx, bool pattern) 166 + static void fimc_sw_reset(struct fimc_context *ctx) 167 167 { 168 168 u32 cfg; 169 169 170 - DRM_DEBUG_KMS("%s:pattern[%d]\n", __func__, pattern); 170 + DRM_DEBUG_KMS("%s\n", __func__); 171 + 172 + /* stop dma operation */ 173 + cfg = fimc_read(EXYNOS_CISTATUS); 174 + if (EXYNOS_CISTATUS_GET_ENVID_STATUS(cfg)) { 175 + cfg = fimc_read(EXYNOS_MSCTRL); 176 + cfg &= ~EXYNOS_MSCTRL_ENVID; 177 + fimc_write(cfg, EXYNOS_MSCTRL); 178 + } 171 179 172 180 cfg = fimc_read(EXYNOS_CISRCFMT); 173 181 cfg |= EXYNOS_CISRCFMT_ITU601_8BIT; 174 - if (pattern) 175 - cfg |= EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR; 176 - 177 182 fimc_write(cfg, EXYNOS_CISRCFMT); 183 + 184 + /* disable image capture */ 185 + cfg = fimc_read(EXYNOS_CIIMGCPT); 186 + cfg &= ~(EXYNOS_CIIMGCPT_IMGCPTEN_SC | EXYNOS_CIIMGCPT_IMGCPTEN); 187 + fimc_write(cfg, EXYNOS_CIIMGCPT); 178 188 179 189 /* s/w reset */ 180 190 cfg = fimc_read(EXYNOS_CIGCTRL); ··· 705 695 { 706 696 struct fimc_context *ctx = get_fimc_context(dev); 707 697 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 708 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 698 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 709 699 struct drm_exynos_ipp_property *property; 710 700 struct drm_exynos_ipp_config *config; 711 701 ··· 715 705 } 716 706 717 707 property = &c_node->property; 718 - if (!property) { 719 - DRM_ERROR("failed to get property.\n"); 720 - return -EINVAL; 721 - } 722 708 723 709 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 724 710 property->prop_id, buf_id, buf_type); ··· 1212 1206 } 1213 1207 1214 1208 /* sequence id */ 1215 - cfg &= (~mask); 1209 + cfg &= ~mask; 1216 1210 cfg |= (enable << buf_id); 1217 1211 fimc_write(cfg, EXYNOS_CIFCNTSEQ); 1218 1212 ··· 1237 1231 { 1238 1232 struct fimc_context *ctx = get_fimc_context(dev); 1239 1233 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1240 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1234 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1241 1235 struct drm_exynos_ipp_property *property; 1242 1236 struct drm_exynos_ipp_config *config; 1243 1237 ··· 1247 1241 } 1248 1242 1249 1243 property = &c_node->property; 1250 - if (!property) { 1251 - DRM_ERROR("failed to get property.\n"); 1252 - return -EINVAL; 1253 - } 1254 1244 1255 1245 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 1256 1246 property->prop_id, buf_id, buf_type); ··· 1319 1317 { 1320 1318 struct fimc_context *ctx = dev_id; 1321 1319 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1322 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1320 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1323 1321 struct drm_exynos_ipp_event_work *event_work = 1324 1322 c_node->event_work; 1325 1323 int buf_id; ··· 1397 1395 case EXYNOS_DRM_FLIP_NONE: 1398 1396 case EXYNOS_DRM_FLIP_VERTICAL: 1399 1397 case EXYNOS_DRM_FLIP_HORIZONTAL: 1398 + case EXYNOS_DRM_FLIP_BOTH: 1400 1399 return true; 1401 1400 default: 1402 1401 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); ··· 1546 1543 DRM_DEBUG_KMS("%s\n", __func__); 1547 1544 1548 1545 /* reset h/w block */ 1549 - fimc_sw_reset(ctx, false); 1546 + fimc_sw_reset(ctx); 1550 1547 1551 1548 /* reset scaler capability */ 1552 1549 memset(&ctx->sc, 0x0, sizeof(ctx->sc)); ··· 1560 1557 { 1561 1558 struct fimc_context *ctx = get_fimc_context(dev); 1562 1559 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1563 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1560 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1564 1561 struct drm_exynos_ipp_property *property; 1565 1562 struct drm_exynos_ipp_config *config; 1566 1563 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; ··· 1576 1573 } 1577 1574 1578 1575 property = &c_node->property; 1579 - if (!property) { 1580 - DRM_ERROR("failed to get property.\n"); 1581 - return -EINVAL; 1582 - } 1583 1576 1584 1577 fimc_handle_irq(ctx, true, false, true); 1585 1578 ··· 1738 1739 platform_get_device_id(pdev)->driver_data; 1739 1740 1740 1741 /* clock control */ 1741 - ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); 1742 + ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc"); 1742 1743 if (IS_ERR(ctx->sclk_fimc_clk)) { 1743 1744 dev_err(dev, "failed to get src fimc clock.\n"); 1744 - ret = PTR_ERR(ctx->sclk_fimc_clk); 1745 - goto err_ctx; 1745 + return PTR_ERR(ctx->sclk_fimc_clk); 1746 1746 } 1747 1747 clk_enable(ctx->sclk_fimc_clk); 1748 1748 1749 - ctx->fimc_clk = clk_get(dev, "fimc"); 1749 + ctx->fimc_clk = devm_clk_get(dev, "fimc"); 1750 1750 if (IS_ERR(ctx->fimc_clk)) { 1751 1751 dev_err(dev, "failed to get fimc clock.\n"); 1752 - ret = PTR_ERR(ctx->fimc_clk); 1753 1752 clk_disable(ctx->sclk_fimc_clk); 1754 - clk_put(ctx->sclk_fimc_clk); 1755 - goto err_ctx; 1753 + return PTR_ERR(ctx->fimc_clk); 1756 1754 } 1757 1755 1758 - ctx->wb_clk = clk_get(dev, "pxl_async0"); 1756 + ctx->wb_clk = devm_clk_get(dev, "pxl_async0"); 1759 1757 if (IS_ERR(ctx->wb_clk)) { 1760 1758 dev_err(dev, "failed to get writeback a clock.\n"); 1761 - ret = PTR_ERR(ctx->wb_clk); 1762 1759 clk_disable(ctx->sclk_fimc_clk); 1763 - clk_put(ctx->sclk_fimc_clk); 1764 - clk_put(ctx->fimc_clk); 1765 - goto err_ctx; 1760 + return PTR_ERR(ctx->wb_clk); 1766 1761 } 1767 1762 1768 - ctx->wb_b_clk = clk_get(dev, "pxl_async1"); 1763 + ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1"); 1769 1764 if (IS_ERR(ctx->wb_b_clk)) { 1770 1765 dev_err(dev, "failed to get writeback b clock.\n"); 1771 - ret = PTR_ERR(ctx->wb_b_clk); 1772 1766 clk_disable(ctx->sclk_fimc_clk); 1773 - clk_put(ctx->sclk_fimc_clk); 1774 - clk_put(ctx->fimc_clk); 1775 - clk_put(ctx->wb_clk); 1776 - goto err_ctx; 1767 + return PTR_ERR(ctx->wb_b_clk); 1777 1768 } 1778 1769 1779 - parent_clk = clk_get(dev, ddata->parent_clk); 1770 + parent_clk = devm_clk_get(dev, ddata->parent_clk); 1780 1771 1781 1772 if (IS_ERR(parent_clk)) { 1782 1773 dev_err(dev, "failed to get parent clock.\n"); 1783 - ret = PTR_ERR(parent_clk); 1784 1774 clk_disable(ctx->sclk_fimc_clk); 1785 - clk_put(ctx->sclk_fimc_clk); 1786 - clk_put(ctx->fimc_clk); 1787 - clk_put(ctx->wb_clk); 1788 - clk_put(ctx->wb_b_clk); 1789 - goto err_ctx; 1775 + return PTR_ERR(parent_clk); 1790 1776 } 1791 1777 1792 1778 if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { 1793 1779 dev_err(dev, "failed to set parent.\n"); 1794 - ret = -EINVAL; 1795 - clk_put(parent_clk); 1796 1780 clk_disable(ctx->sclk_fimc_clk); 1797 - clk_put(ctx->sclk_fimc_clk); 1798 - clk_put(ctx->fimc_clk); 1799 - clk_put(ctx->wb_clk); 1800 - clk_put(ctx->wb_b_clk); 1801 - goto err_ctx; 1781 + return -EINVAL; 1802 1782 } 1803 1783 1804 - clk_put(parent_clk); 1784 + devm_clk_put(dev, parent_clk); 1805 1785 clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate); 1806 1786 1807 1787 /* resource memory */ 1808 1788 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1809 - if (!ctx->regs_res) { 1810 - dev_err(dev, "failed to find registers.\n"); 1811 - ret = -ENOENT; 1812 - goto err_clk; 1813 - } 1814 - 1815 1789 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); 1816 1790 if (!ctx->regs) { 1817 1791 dev_err(dev, "failed to map registers.\n"); 1818 - ret = -ENXIO; 1819 - goto err_clk; 1792 + return -ENXIO; 1820 1793 } 1821 1794 1822 1795 /* resource irq */ 1823 1796 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1824 1797 if (!res) { 1825 1798 dev_err(dev, "failed to request irq resource.\n"); 1826 - ret = -ENOENT; 1827 - goto err_get_regs; 1799 + return -ENOENT; 1828 1800 } 1829 1801 1830 1802 ctx->irq = res->start; ··· 1803 1833 IRQF_ONESHOT, "drm_fimc", ctx); 1804 1834 if (ret < 0) { 1805 1835 dev_err(dev, "failed to request irq.\n"); 1806 - goto err_get_regs; 1836 + return ret; 1807 1837 } 1808 1838 1809 1839 /* context initailization */ ··· 1849 1879 pm_runtime_disable(dev); 1850 1880 err_get_irq: 1851 1881 free_irq(ctx->irq, ctx); 1852 - err_get_regs: 1853 - devm_iounmap(dev, ctx->regs); 1854 - err_clk: 1855 - clk_put(ctx->sclk_fimc_clk); 1856 - clk_put(ctx->fimc_clk); 1857 - clk_put(ctx->wb_clk); 1858 - clk_put(ctx->wb_b_clk); 1859 - err_ctx: 1860 - devm_kfree(dev, ctx); 1882 + 1861 1883 return ret; 1862 1884 } 1863 1885 ··· 1867 1905 pm_runtime_disable(dev); 1868 1906 1869 1907 free_irq(ctx->irq, ctx); 1870 - devm_iounmap(dev, ctx->regs); 1871 - 1872 - clk_put(ctx->sclk_fimc_clk); 1873 - clk_put(ctx->fimc_clk); 1874 - clk_put(ctx->wb_clk); 1875 - clk_put(ctx->wb_b_clk); 1876 - 1877 - devm_kfree(dev, ctx); 1878 1908 1879 1909 return 0; 1880 1910 }
+4 -18
drivers/gpu/drm/exynos/exynos_drm_fimc.h
··· 6 6 * Jinyoung Jeon <jy0.jeon@samsung.com> 7 7 * Sangmin Lee <lsmin.lee@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_FIMC_H_
+2 -30
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 663 663 .display_ops = &fimd_display_ops, 664 664 }; 665 665 666 - static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) 667 - { 668 - struct exynos_drm_private *dev_priv = drm_dev->dev_private; 669 - struct drm_pending_vblank_event *e, *t; 670 - struct timeval now; 671 - unsigned long flags; 672 - 673 - spin_lock_irqsave(&drm_dev->event_lock, flags); 674 - 675 - list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, 676 - base.link) { 677 - /* if event's pipe isn't same as crtc then ignore it. */ 678 - if (crtc != e->pipe) 679 - continue; 680 - 681 - do_gettimeofday(&now); 682 - e->event.sequence = 0; 683 - e->event.tv_sec = now.tv_sec; 684 - e->event.tv_usec = now.tv_usec; 685 - 686 - list_move_tail(&e->base.link, &e->base.file_priv->event_list); 687 - wake_up_interruptible(&e->base.file_priv->event_wait); 688 - drm_vblank_put(drm_dev, crtc); 689 - } 690 - 691 - spin_unlock_irqrestore(&drm_dev->event_lock, flags); 692 - } 693 - 694 666 static irqreturn_t fimd_irq_handler(int irq, void *dev_id) 695 667 { 696 668 struct fimd_context *ctx = (struct fimd_context *)dev_id; ··· 682 710 goto out; 683 711 684 712 drm_handle_vblank(drm_dev, manager->pipe); 685 - fimd_finish_pageflip(drm_dev, manager->pipe); 713 + exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe); 686 714 687 715 /* set wait vsync event to zero and wake up queue. */ 688 716 if (atomic_read(&ctx->wait_vsync_event)) { ··· 1018 1046 * of pm runtime would still be 1 so in this case, fimd driver 1019 1047 * should be on directly not drawing on pm runtime interface. 1020 1048 */ 1021 - if (pm_runtime_suspended(dev)) { 1049 + if (!pm_runtime_suspended(dev)) { 1022 1050 int ret; 1023 1051 1024 1052 ret = fimd_activate(ctx, true);
+4 -18
drivers/gpu/drm/exynos/exynos_drm_gem.c
··· 3 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #include <drm/drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_gem.h
··· 3 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 4 * Authoer: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_GEM_H_
+12 -44
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 25 25 #include "exynos_drm_gsc.h" 26 26 27 27 /* 28 - * GSC is stand for General SCaler and 28 + * GSC stands for General SCaler and 29 29 * supports image scaler/rotator and input/output DMA operations. 30 30 * input DMA reads image data from the memory. 31 31 * output DMA writes image data to memory. ··· 711 711 { 712 712 struct gsc_context *ctx = get_gsc_context(dev); 713 713 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 714 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 714 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 715 715 struct drm_exynos_ipp_property *property; 716 716 717 717 if (!c_node) { ··· 720 720 } 721 721 722 722 property = &c_node->property; 723 - if (!property) { 724 - DRM_ERROR("failed to get property.\n"); 725 - return -EFAULT; 726 - } 727 723 728 724 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 729 725 property->prop_id, buf_id, buf_type); ··· 1167 1171 { 1168 1172 struct gsc_context *ctx = get_gsc_context(dev); 1169 1173 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1170 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1174 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1171 1175 struct drm_exynos_ipp_property *property; 1172 1176 1173 1177 if (!c_node) { ··· 1176 1180 } 1177 1181 1178 1182 property = &c_node->property; 1179 - if (!property) { 1180 - DRM_ERROR("failed to get property.\n"); 1181 - return -EFAULT; 1182 - } 1183 1183 1184 1184 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 1185 1185 property->prop_id, buf_id, buf_type); ··· 1304 1312 { 1305 1313 struct gsc_context *ctx = dev_id; 1306 1314 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1307 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1315 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1308 1316 struct drm_exynos_ipp_event_work *event_work = 1309 1317 c_node->event_work; 1310 1318 u32 status; ··· 1391 1399 case EXYNOS_DRM_FLIP_NONE: 1392 1400 case EXYNOS_DRM_FLIP_VERTICAL: 1393 1401 case EXYNOS_DRM_FLIP_HORIZONTAL: 1394 - case EXYNOS_DRM_FLIP_VERTICAL | EXYNOS_DRM_FLIP_HORIZONTAL: 1402 + case EXYNOS_DRM_FLIP_BOTH: 1395 1403 return true; 1396 1404 default: 1397 1405 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); ··· 1541 1549 { 1542 1550 struct gsc_context *ctx = get_gsc_context(dev); 1543 1551 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1544 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1552 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 1545 1553 struct drm_exynos_ipp_property *property; 1546 1554 struct drm_exynos_ipp_config *config; 1547 1555 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; ··· 1557 1565 } 1558 1566 1559 1567 property = &c_node->property; 1560 - if (!property) { 1561 - DRM_ERROR("failed to get property.\n"); 1562 - return -EINVAL; 1563 - } 1564 1568 1565 1569 gsc_handle_irq(ctx, true, false, true); 1566 1570 ··· 1592 1604 exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb); 1593 1605 1594 1606 /* src local path */ 1595 - cfg = readl(GSC_IN_CON); 1607 + cfg = gsc_read(GSC_IN_CON); 1596 1608 cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK); 1597 1609 cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB); 1598 1610 gsc_write(cfg, GSC_IN_CON); ··· 1684 1696 return -ENOMEM; 1685 1697 1686 1698 /* clock control */ 1687 - ctx->gsc_clk = clk_get(dev, "gscl"); 1699 + ctx->gsc_clk = devm_clk_get(dev, "gscl"); 1688 1700 if (IS_ERR(ctx->gsc_clk)) { 1689 1701 dev_err(dev, "failed to get gsc clock.\n"); 1690 - ret = PTR_ERR(ctx->gsc_clk); 1691 - goto err_ctx; 1702 + return PTR_ERR(ctx->gsc_clk); 1692 1703 } 1693 1704 1694 1705 /* resource memory */ 1695 1706 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1696 - if (!ctx->regs_res) { 1697 - dev_err(dev, "failed to find registers.\n"); 1698 - ret = -ENOENT; 1699 - goto err_clk; 1700 - } 1701 - 1702 1707 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); 1703 1708 if (!ctx->regs) { 1704 1709 dev_err(dev, "failed to map registers.\n"); 1705 - ret = -ENXIO; 1706 - goto err_clk; 1710 + return -ENXIO; 1707 1711 } 1708 1712 1709 1713 /* resource irq */ 1710 1714 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1711 1715 if (!res) { 1712 1716 dev_err(dev, "failed to request irq resource.\n"); 1713 - ret = -ENOENT; 1714 - goto err_get_regs; 1717 + return -ENOENT; 1715 1718 } 1716 1719 1717 1720 ctx->irq = res->start; ··· 1710 1731 IRQF_ONESHOT, "drm_gsc", ctx); 1711 1732 if (ret < 0) { 1712 1733 dev_err(dev, "failed to request irq.\n"); 1713 - goto err_get_regs; 1734 + return ret; 1714 1735 } 1715 1736 1716 1737 /* context initailization */ ··· 1754 1775 pm_runtime_disable(dev); 1755 1776 err_get_irq: 1756 1777 free_irq(ctx->irq, ctx); 1757 - err_get_regs: 1758 - devm_iounmap(dev, ctx->regs); 1759 - err_clk: 1760 - clk_put(ctx->gsc_clk); 1761 - err_ctx: 1762 - devm_kfree(dev, ctx); 1763 1778 return ret; 1764 1779 } 1765 1780 ··· 1771 1798 pm_runtime_disable(dev); 1772 1799 1773 1800 free_irq(ctx->irq, ctx); 1774 - devm_iounmap(dev, ctx->regs); 1775 - 1776 - clk_put(ctx->gsc_clk); 1777 - 1778 - devm_kfree(dev, ctx); 1779 1801 1780 1802 return 0; 1781 1803 }
+4 -18
drivers/gpu/drm/exynos/exynos_drm_gsc.h
··· 6 6 * Jinyoung Jeon <jy0.jeon@samsung.com> 7 7 * Sangmin Lee <lsmin.lee@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_GSC_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_hdmi.h
··· 3 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 4 * Authoer: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_HDMI_H_
+4 -18
drivers/gpu/drm/exynos/exynos_drm_iommu.c
··· 3 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #include <drmP.h>
+4 -18
drivers/gpu/drm/exynos/exynos_drm_iommu.h
··· 3 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 4 4 * Authoer: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_IOMMU_H_
+6 -16
drivers/gpu/drm/exynos/exynos_drm_ipp.c
··· 27 27 #include "exynos_drm_iommu.h" 28 28 29 29 /* 30 - * IPP is stand for Image Post Processing and 30 + * IPP stands for Image Post Processing and 31 31 * supports image scaler/rotator and input/output DMA operations. 32 32 * using FIMC, GSC, Rotator, so on. 33 33 * IPP is integration device driver of same attribute h/w ··· 1292 1292 DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id); 1293 1293 1294 1294 /* store command info in ippdrv */ 1295 - ippdrv->cmd = c_node; 1295 + ippdrv->c_node = c_node; 1296 1296 1297 1297 if (!ipp_check_mem_list(c_node)) { 1298 1298 DRM_DEBUG_KMS("%s:empty memory.\n", __func__); ··· 1303 1303 ret = ipp_set_property(ippdrv, property); 1304 1304 if (ret) { 1305 1305 DRM_ERROR("failed to set property.\n"); 1306 - ippdrv->cmd = NULL; 1306 + ippdrv->c_node = NULL; 1307 1307 return ret; 1308 1308 } 1309 1309 ··· 1487 1487 mutex_lock(&c_node->cmd_lock); 1488 1488 1489 1489 property = &c_node->property; 1490 - if (!property) { 1491 - DRM_ERROR("failed to get property:prop_id[%d]\n", 1492 - c_node->property.prop_id); 1493 - goto err_unlock; 1494 - } 1495 1490 1496 1491 switch (cmd_work->ctrl) { 1497 1492 case IPP_CTRL_PLAY: ··· 1699 1704 return; 1700 1705 } 1701 1706 1702 - c_node = ippdrv->cmd; 1707 + c_node = ippdrv->c_node; 1703 1708 if (!c_node) { 1704 1709 DRM_ERROR("failed to get command node.\n"); 1705 1710 return; ··· 1890 1895 struct exynos_drm_subdrv *subdrv; 1891 1896 int ret; 1892 1897 1893 - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 1898 + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); 1894 1899 if (!ctx) 1895 1900 return -ENOMEM; 1896 1901 ··· 1911 1916 ctx->event_workq = create_singlethread_workqueue("ipp_event"); 1912 1917 if (!ctx->event_workq) { 1913 1918 dev_err(dev, "failed to create event workqueue\n"); 1914 - ret = -EINVAL; 1915 - goto err_clear; 1919 + return -EINVAL; 1916 1920 } 1917 1921 1918 1922 /* ··· 1952 1958 destroy_workqueue(ctx->cmd_workq); 1953 1959 err_event_workq: 1954 1960 destroy_workqueue(ctx->event_workq); 1955 - err_clear: 1956 - kfree(ctx); 1957 1961 return ret; 1958 1962 } 1959 1963 ··· 1976 1984 /* destroy command, event work queue */ 1977 1985 destroy_workqueue(ctx->cmd_workq); 1978 1986 destroy_workqueue(ctx->event_workq); 1979 - 1980 - kfree(ctx); 1981 1987 1982 1988 return 0; 1983 1989 }
+6 -20
drivers/gpu/drm/exynos/exynos_drm_ipp.h
··· 6 6 * Jinyoung Jeon <jy0.jeon@samsung.com> 7 7 * Sangmin Lee <lsmin.lee@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _EXYNOS_DRM_IPP_H_ ··· 146 160 * @dedicated: dedicated ipp device. 147 161 * @ops: source, destination operations. 148 162 * @event_workq: event work queue. 149 - * @cmd: current command information. 163 + * @c_node: current command information. 150 164 * @cmd_list: list head for command information. 151 165 * @prop_list: property informations of current ipp driver. 152 166 * @check_property: check property about format, size, buffer. ··· 164 178 bool dedicated; 165 179 struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX]; 166 180 struct workqueue_struct *event_workq; 167 - struct drm_exynos_ipp_cmd_node *cmd; 181 + struct drm_exynos_ipp_cmd_node *c_node; 168 182 struct list_head cmd_list; 169 183 struct drm_exynos_ipp_prop_list *prop_list; 170 184
+6 -22
drivers/gpu/drm/exynos/exynos_drm_rotator.c
··· 139 139 { 140 140 struct rot_context *rot = arg; 141 141 struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; 142 - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 142 + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; 143 143 struct drm_exynos_ipp_event_work *event_work = c_node->event_work; 144 144 enum rot_irq_status irq_status; 145 145 u32 val; ··· 513 513 case EXYNOS_DRM_FLIP_NONE: 514 514 case EXYNOS_DRM_FLIP_VERTICAL: 515 515 case EXYNOS_DRM_FLIP_HORIZONTAL: 516 + case EXYNOS_DRM_FLIP_BOTH: 516 517 return true; 517 518 default: 518 519 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); ··· 656 655 platform_get_device_id(pdev)->driver_data; 657 656 658 657 rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 659 - if (!rot->regs_res) { 660 - dev_err(dev, "failed to find registers\n"); 661 - ret = -ENOENT; 662 - goto err_get_resource; 663 - } 664 - 665 658 rot->regs = devm_request_and_ioremap(dev, rot->regs_res); 666 659 if (!rot->regs) { 667 660 dev_err(dev, "failed to map register\n"); 668 - ret = -ENXIO; 669 - goto err_get_resource; 661 + return -ENXIO; 670 662 } 671 663 672 664 rot->irq = platform_get_irq(pdev, 0); 673 665 if (rot->irq < 0) { 674 666 dev_err(dev, "failed to get irq\n"); 675 - ret = rot->irq; 676 - goto err_get_irq; 667 + return rot->irq; 677 668 } 678 669 679 670 ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, 680 671 IRQF_ONESHOT, "drm_rotator", rot); 681 672 if (ret < 0) { 682 673 dev_err(dev, "failed to request irq\n"); 683 - goto err_get_irq; 674 + return ret; 684 675 } 685 676 686 - rot->clock = clk_get(dev, "rotator"); 677 + rot->clock = devm_clk_get(dev, "rotator"); 687 678 if (IS_ERR_OR_NULL(rot->clock)) { 688 679 dev_err(dev, "failed to get clock\n"); 689 680 ret = PTR_ERR(rot->clock); ··· 713 720 err_ippdrv_register: 714 721 devm_kfree(dev, ippdrv->prop_list); 715 722 pm_runtime_disable(dev); 716 - clk_put(rot->clock); 717 723 err_clk_get: 718 724 free_irq(rot->irq, rot); 719 - err_get_irq: 720 - devm_iounmap(dev, rot->regs); 721 - err_get_resource: 722 - devm_kfree(dev, rot); 723 725 return ret; 724 726 } 725 727 ··· 728 740 exynos_drm_ippdrv_unregister(ippdrv); 729 741 730 742 pm_runtime_disable(dev); 731 - clk_put(rot->clock); 732 743 733 744 free_irq(rot->irq, rot); 734 - devm_iounmap(dev, rot->regs); 735 - 736 - devm_kfree(dev, rot); 737 745 738 746 return 0; 739 747 }
+4 -18
drivers/gpu/drm/exynos/exynos_drm_rotator.h
··· 5 5 * YoungJun Cho <yj44.cho@samsung.com> 6 6 * Eunchul Kim <chulspro.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #ifndef _EXYNOS_DRM_ROTATOR_H_
+1 -29
drivers/gpu/drm/exynos/exynos_drm_vidi.c
··· 372 372 .display_ops = &vidi_display_ops, 373 373 }; 374 374 375 - static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) 376 - { 377 - struct exynos_drm_private *dev_priv = drm_dev->dev_private; 378 - struct drm_pending_vblank_event *e, *t; 379 - struct timeval now; 380 - unsigned long flags; 381 - 382 - spin_lock_irqsave(&drm_dev->event_lock, flags); 383 - 384 - list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, 385 - base.link) { 386 - /* if event's pipe isn't same as crtc then ignore it. */ 387 - if (crtc != e->pipe) 388 - continue; 389 - 390 - do_gettimeofday(&now); 391 - e->event.sequence = 0; 392 - e->event.tv_sec = now.tv_sec; 393 - e->event.tv_usec = now.tv_usec; 394 - 395 - list_move_tail(&e->base.link, &e->base.file_priv->event_list); 396 - wake_up_interruptible(&e->base.file_priv->event_wait); 397 - drm_vblank_put(drm_dev, crtc); 398 - } 399 - 400 - spin_unlock_irqrestore(&drm_dev->event_lock, flags); 401 - } 402 - 403 375 static void vidi_fake_vblank_handler(struct work_struct *work) 404 376 { 405 377 struct vidi_context *ctx = container_of(work, struct vidi_context, ··· 396 424 397 425 mutex_unlock(&ctx->lock); 398 426 399 - vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); 427 + exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe); 400 428 } 401 429 402 430 static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
+4 -18
drivers/gpu/drm/exynos/exynos_drm_vidi.h
··· 3 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 4 4 * Author: Inki Dae <inki.dae@samsung.com> 5 5 * 6 - * Permission is hereby granted, free of charge, to any person obtaining a 7 - * copy of this software and associated documentation files (the "Software"), 8 - * to deal in the Software without restriction, including without limitation 9 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 - * and/or sell copies of the Software, and to permit persons to whom the 11 - * Software is furnished to do so, subject to the following conditions: 12 - * 13 - * The above copyright notice and this permission notice (including the next 14 - * paragraph) shall be included in all copies or substantial portions of the 15 - * Software. 16 - * 17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 - * OTHER DEALINGS IN THE SOFTWARE. 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 24 10 */ 25 11 26 12 #ifndef _EXYNOS_DRM_VIDI_H_
+4 -18
drivers/gpu/drm/exynos/exynos_hdmi.h
··· 5 5 * Inki Dae <inki.dae@samsung.com> 6 6 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 7 * 8 - * Permission is hereby granted, free of charge, to any person obtaining a 9 - * copy of this software and associated documentation files (the "Software"), 10 - * to deal in the Software without restriction, including without limitation 11 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 - * and/or sell copies of the Software, and to permit persons to whom the 13 - * Software is furnished to do so, subject to the following conditions: 14 - * 15 - * The above copyright notice and this permission notice (including the next 16 - * paragraph) shall be included in all copies or substantial portions of the 17 - * Software. 18 - * 19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 - * OTHER DEALINGS IN THE SOFTWARE. 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 26 12 */ 27 13 28 14 #ifndef _EXYNOS_HDMI_H_
+3 -30
drivers/gpu/drm/exynos/exynos_mixer.c
··· 35 35 #include <drm/exynos_drm.h> 36 36 37 37 #include "exynos_drm_drv.h" 38 + #include "exynos_drm_crtc.h" 38 39 #include "exynos_drm_hdmi.h" 39 40 #include "exynos_drm_iommu.h" 40 41 ··· 950 949 .win_disable = mixer_win_disable, 951 950 }; 952 951 953 - /* for pageflip event */ 954 - static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) 955 - { 956 - struct exynos_drm_private *dev_priv = drm_dev->dev_private; 957 - struct drm_pending_vblank_event *e, *t; 958 - struct timeval now; 959 - unsigned long flags; 960 - 961 - spin_lock_irqsave(&drm_dev->event_lock, flags); 962 - 963 - list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, 964 - base.link) { 965 - /* if event's pipe isn't same as crtc then ignore it. */ 966 - if (crtc != e->pipe) 967 - continue; 968 - 969 - do_gettimeofday(&now); 970 - e->event.sequence = 0; 971 - e->event.tv_sec = now.tv_sec; 972 - e->event.tv_usec = now.tv_usec; 973 - 974 - list_move_tail(&e->base.link, &e->base.file_priv->event_list); 975 - wake_up_interruptible(&e->base.file_priv->event_wait); 976 - drm_vblank_put(drm_dev, crtc); 977 - } 978 - 979 - spin_unlock_irqrestore(&drm_dev->event_lock, flags); 980 - } 981 - 982 952 static irqreturn_t mixer_irq_handler(int irq, void *arg) 983 953 { 984 954 struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; ··· 978 1006 } 979 1007 980 1008 drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); 981 - mixer_finish_pageflip(drm_hdmi_ctx->drm_dev, ctx->pipe); 1009 + exynos_drm_crtc_finish_pageflip(drm_hdmi_ctx->drm_dev, 1010 + ctx->pipe); 982 1011 983 1012 /* set wait vsync event to zero and wake up queue. */ 984 1013 if (atomic_read(&ctx->wait_vsync_event)) {
+5
drivers/gpu/drm/i915/i915_gem_dmabuf.c
··· 266 266 obj = dma_buf->priv; 267 267 /* is it from our device? */ 268 268 if (obj->base.dev == dev) { 269 + /* 270 + * Importing dmabuf exported from out own gem increases 271 + * refcount on gem itself instead of f_count of dmabuf. 272 + */ 269 273 drm_gem_object_reference(&obj->base); 274 + dma_buf_put(dma_buf); 270 275 return &obj->base; 271 276 } 272 277 }
+1
drivers/gpu/drm/nouveau/nouveau_prime.c
··· 193 193 if (nvbo->gem) { 194 194 if (nvbo->gem->dev == dev) { 195 195 drm_gem_object_reference(nvbo->gem); 196 + dma_buf_put(dma_buf); 196 197 return nvbo->gem; 197 198 } 198 199 }
+5 -5
drivers/gpu/drm/radeon/r600.c
··· 2646 2646 * @num_gpu_pages: number of GPU pages to xfer 2647 2647 * @fence: radeon fence object 2648 2648 * 2649 - * Copy GPU paging using the DMA engine (r6xx-r7xx). 2649 + * Copy GPU paging using the DMA engine (r6xx). 2650 2650 * Used by the radeon ttm implementation to move pages if 2651 2651 * registered as the asic copy callback. 2652 2652 */ ··· 2669 2669 } 2670 2670 2671 2671 size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; 2672 - num_loops = DIV_ROUND_UP(size_in_dw, 0xffff); 2673 - r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); 2672 + num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFE); 2673 + r = radeon_ring_lock(rdev, ring, num_loops * 4 + 8); 2674 2674 if (r) { 2675 2675 DRM_ERROR("radeon: moving bo (%d).\n", r); 2676 2676 radeon_semaphore_free(rdev, &sem, NULL); ··· 2693 2693 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); 2694 2694 radeon_ring_write(ring, dst_offset & 0xfffffffc); 2695 2695 radeon_ring_write(ring, src_offset & 0xfffffffc); 2696 - radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); 2697 - radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); 2696 + radeon_ring_write(ring, (((upper_32_bits(dst_offset) & 0xff) << 16) | 2697 + (upper_32_bits(src_offset) & 0xff))); 2698 2698 src_offset += cur_size_in_dw * 4; 2699 2699 dst_offset += cur_size_in_dw * 4; 2700 2700 }
+22 -9
drivers/gpu/drm/radeon/r600_cs.c
··· 2677 2677 } 2678 2678 p->idx += 7; 2679 2679 } else { 2680 - src_offset = ib[idx+2]; 2681 - src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; 2682 - dst_offset = ib[idx+1]; 2683 - dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; 2680 + if (p->family >= CHIP_RV770) { 2681 + src_offset = ib[idx+2]; 2682 + src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; 2683 + dst_offset = ib[idx+1]; 2684 + dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; 2684 2685 2685 - ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); 2686 - ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); 2687 - ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; 2688 - ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; 2689 - p->idx += 5; 2686 + ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); 2687 + ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); 2688 + ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; 2689 + ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; 2690 + p->idx += 5; 2691 + } else { 2692 + src_offset = ib[idx+2]; 2693 + src_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; 2694 + dst_offset = ib[idx+1]; 2695 + dst_offset |= ((u64)(ib[idx+3] & 0xff0000)) << 16; 2696 + 2697 + ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); 2698 + ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); 2699 + ib[idx+3] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; 2700 + ib[idx+3] += (upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff) << 16; 2701 + p->idx += 4; 2702 + } 2690 2703 } 2691 2704 if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) { 2692 2705 dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n",
+2 -2
drivers/gpu/drm/radeon/radeon_asic.c
··· 1140 1140 .copy = { 1141 1141 .blit = &r600_copy_blit, 1142 1142 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, 1143 - .dma = &r600_copy_dma, 1143 + .dma = &rv770_copy_dma, 1144 1144 .dma_ring_index = R600_RING_TYPE_DMA_INDEX, 1145 - .copy = &r600_copy_dma, 1145 + .copy = &rv770_copy_dma, 1146 1146 .copy_ring_index = R600_RING_TYPE_DMA_INDEX, 1147 1147 }, 1148 1148 .surface = {
+4
drivers/gpu/drm/radeon/radeon_asic.h
··· 403 403 void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); 404 404 void r700_cp_stop(struct radeon_device *rdev); 405 405 void r700_cp_fini(struct radeon_device *rdev); 406 + int rv770_copy_dma(struct radeon_device *rdev, 407 + uint64_t src_offset, uint64_t dst_offset, 408 + unsigned num_gpu_pages, 409 + struct radeon_fence **fence); 406 410 407 411 /* 408 412 * evergreen
+28
drivers/gpu/drm/radeon/radeon_device.c
··· 897 897 } 898 898 899 899 /** 900 + * radeon_switcheroo_quirk_long_wakeup - return true if longer d3 delay is 901 + * needed for waking up. 902 + * 903 + * @pdev: pci dev pointer 904 + */ 905 + static bool radeon_switcheroo_quirk_long_wakeup(struct pci_dev *pdev) 906 + { 907 + 908 + /* 6600m in a macbook pro */ 909 + if (pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE && 910 + pdev->subsystem_device == 0x00e2) { 911 + printk(KERN_INFO "radeon: quirking longer d3 wakeup delay\n"); 912 + return true; 913 + } 914 + 915 + return false; 916 + } 917 + 918 + /** 900 919 * radeon_switcheroo_set_state - set switcheroo state 901 920 * 902 921 * @pdev: pci dev pointer ··· 929 910 struct drm_device *dev = pci_get_drvdata(pdev); 930 911 pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; 931 912 if (state == VGA_SWITCHEROO_ON) { 913 + unsigned d3_delay = dev->pdev->d3_delay; 914 + 932 915 printk(KERN_INFO "radeon: switched on\n"); 933 916 /* don't suspend or resume card normally */ 934 917 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 918 + 919 + if (d3_delay < 20 && radeon_switcheroo_quirk_long_wakeup(pdev)) 920 + dev->pdev->d3_delay = 20; 921 + 935 922 radeon_resume_kms(dev); 923 + 924 + dev->pdev->d3_delay = d3_delay; 925 + 936 926 dev->switch_power_state = DRM_SWITCH_POWER_ON; 937 927 drm_kms_helper_poll_enable(dev); 938 928 } else {
+1
drivers/gpu/drm/radeon/radeon_prime.c
··· 194 194 bo = dma_buf->priv; 195 195 if (bo->gem_base.dev == dev) { 196 196 drm_gem_object_reference(&bo->gem_base); 197 + dma_buf_put(dma_buf); 197 198 return &bo->gem_base; 198 199 } 199 200 }
+74
drivers/gpu/drm/radeon/rv770.c
··· 887 887 return 0; 888 888 } 889 889 890 + /** 891 + * rv770_copy_dma - copy pages using the DMA engine 892 + * 893 + * @rdev: radeon_device pointer 894 + * @src_offset: src GPU address 895 + * @dst_offset: dst GPU address 896 + * @num_gpu_pages: number of GPU pages to xfer 897 + * @fence: radeon fence object 898 + * 899 + * Copy GPU paging using the DMA engine (r7xx). 900 + * Used by the radeon ttm implementation to move pages if 901 + * registered as the asic copy callback. 902 + */ 903 + int rv770_copy_dma(struct radeon_device *rdev, 904 + uint64_t src_offset, uint64_t dst_offset, 905 + unsigned num_gpu_pages, 906 + struct radeon_fence **fence) 907 + { 908 + struct radeon_semaphore *sem = NULL; 909 + int ring_index = rdev->asic->copy.dma_ring_index; 910 + struct radeon_ring *ring = &rdev->ring[ring_index]; 911 + u32 size_in_dw, cur_size_in_dw; 912 + int i, num_loops; 913 + int r = 0; 914 + 915 + r = radeon_semaphore_create(rdev, &sem); 916 + if (r) { 917 + DRM_ERROR("radeon: moving bo (%d).\n", r); 918 + return r; 919 + } 920 + 921 + size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; 922 + num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF); 923 + r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); 924 + if (r) { 925 + DRM_ERROR("radeon: moving bo (%d).\n", r); 926 + radeon_semaphore_free(rdev, &sem, NULL); 927 + return r; 928 + } 929 + 930 + if (radeon_fence_need_sync(*fence, ring->idx)) { 931 + radeon_semaphore_sync_rings(rdev, sem, (*fence)->ring, 932 + ring->idx); 933 + radeon_fence_note_sync(*fence, ring->idx); 934 + } else { 935 + radeon_semaphore_free(rdev, &sem, NULL); 936 + } 937 + 938 + for (i = 0; i < num_loops; i++) { 939 + cur_size_in_dw = size_in_dw; 940 + if (cur_size_in_dw > 0xFFFF) 941 + cur_size_in_dw = 0xFFFF; 942 + size_in_dw -= cur_size_in_dw; 943 + radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); 944 + radeon_ring_write(ring, dst_offset & 0xfffffffc); 945 + radeon_ring_write(ring, src_offset & 0xfffffffc); 946 + radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); 947 + radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); 948 + src_offset += cur_size_in_dw * 4; 949 + dst_offset += cur_size_in_dw * 4; 950 + } 951 + 952 + r = radeon_fence_emit(rdev, fence, ring->idx); 953 + if (r) { 954 + radeon_ring_unlock_undo(rdev, ring); 955 + return r; 956 + } 957 + 958 + radeon_ring_unlock_commit(rdev, ring); 959 + radeon_semaphore_free(rdev, &sem, *fence); 960 + 961 + return r; 962 + } 963 + 890 964 static int rv770_startup(struct radeon_device *rdev) 891 965 { 892 966 struct radeon_ring *ring;
+3 -1
drivers/gpu/drm/ttm/ttm_bo_util.c
··· 654 654 */ 655 655 656 656 set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); 657 + 658 + /* ttm_buffer_object_transfer accesses bo->sync_obj */ 659 + ret = ttm_buffer_object_transfer(bo, &ghost_obj); 657 660 spin_unlock(&bdev->fence_lock); 658 661 if (tmp_obj) 659 662 driver->sync_obj_unref(&tmp_obj); 660 663 661 - ret = ttm_buffer_object_transfer(bo, &ghost_obj); 662 664 if (ret) 663 665 return ret; 664 666
+5
drivers/staging/omapdrm/omap_gem_dmabuf.c
··· 207 207 obj = buffer->priv; 208 208 /* is it from our device? */ 209 209 if (obj->dev == dev) { 210 + /* 211 + * Importing dmabuf exported from out own gem increases 212 + * refcount on gem itself instead of f_count of dmabuf. 213 + */ 210 214 drm_gem_object_reference(obj); 215 + dma_buf_put(buffer); 211 216 return obj; 212 217 } 213 218 }
+4 -18
include/drm/exynos_drm.h
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 #ifndef _EXYNOS_DRM_H_ 29 15 #define _EXYNOS_DRM_H_
+6 -18
include/uapi/drm/exynos_drm.h
··· 6 6 * Joonyoung Shim <jy0922.shim@samsung.com> 7 7 * Seung-Woo Kim <sw0312.kim@samsung.com> 8 8 * 9 - * Permission is hereby granted, free of charge, to any person obtaining a 10 - * copy of this software and associated documentation files (the "Software"), 11 - * to deal in the Software without restriction, including without limitation 12 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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. 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the 11 + * Free Software Foundation; either version 2 of the License, or (at your 12 + * option) any later version. 27 13 */ 28 14 29 15 #ifndef _UAPI_EXYNOS_DRM_H_ ··· 171 185 EXYNOS_DRM_FLIP_NONE = (0 << 0), 172 186 EXYNOS_DRM_FLIP_VERTICAL = (1 << 0), 173 187 EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1), 188 + EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL | 189 + EXYNOS_DRM_FLIP_HORIZONTAL, 174 190 }; 175 191 176 192 enum drm_exynos_degree {