diff options
42 files changed, 225 insertions, 246 deletions
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index de9512afd611..92ee2f982572 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst | |||
@@ -184,12 +184,6 @@ Contact: Sean Paul, Maintainer of the driver you plan to convert | |||
184 | Core refactorings | 184 | Core refactorings |
185 | ================= | 185 | ================= |
186 | 186 | ||
187 | Use new IDR deletion interface to clean up drm_gem_handle_delete() | ||
188 | ------------------------------------------------------------------ | ||
189 | |||
190 | See the "This is gross" comment -- apparently the IDR system now can return an | ||
191 | error code instead of oopsing. | ||
192 | |||
193 | Clean up the DRM header mess | 187 | Clean up the DRM header mess |
194 | ---------------------------- | 188 | ---------------------------- |
195 | 189 | ||
@@ -357,7 +351,16 @@ those drivers as simple as possible, so lots of room for refactoring: | |||
357 | - backlight helpers, probably best to put them into a new drm_backlight.c. | 351 | - backlight helpers, probably best to put them into a new drm_backlight.c. |
358 | This is because drivers/video is de-facto unmaintained. We could also | 352 | This is because drivers/video is de-facto unmaintained. We could also |
359 | move drivers/video/backlight to drivers/gpu/backlight and take it all | 353 | move drivers/video/backlight to drivers/gpu/backlight and take it all |
360 | over within drm-misc, but that's more work. | 354 | over within drm-misc, but that's more work. Backlight helpers require a fair |
355 | bit of reworking and refactoring. A simple example is the enabling of a backlight. | ||
356 | Tinydrm has helpers for this. It would be good if other drivers can also use the | ||
357 | helper. However, there are various cases we need to consider i.e different | ||
358 | drivers seem to have different ways of enabling/disabling a backlight. | ||
359 | We also need to consider the backlight drivers (like gpio_backlight). The situation | ||
360 | is further complicated by the fact that the backlight is tied to fbdev | ||
361 | via fb_notifier_callback() which has complicated logic. For further details, refer | ||
362 | to the following discussion thread: | ||
363 | https://groups.google.com/forum/#!topic/outreachy-kernel/8rBe30lwtdA | ||
361 | 364 | ||
362 | - spi helpers, probably best put into spi core/helper code. Thierry said | 365 | - spi helpers, probably best put into spi core/helper code. Thierry said |
363 | the spi maintainer is fast&reactive, so shouldn't be a big issue. | 366 | the spi maintainer is fast&reactive, so shouldn't be a big issue. |
diff --git a/MAINTAINERS b/MAINTAINERS index d2f6ec2992f1..fe121ea1ab99 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5461,6 +5461,7 @@ F: drivers/net/wan/sdla.c | |||
5461 | 5461 | ||
5462 | FRAMEBUFFER LAYER | 5462 | FRAMEBUFFER LAYER |
5463 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 5463 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
5464 | L: dri-devel@lists.freedesktop.org | ||
5464 | L: linux-fbdev@vger.kernel.org | 5465 | L: linux-fbdev@vger.kernel.org |
5465 | T: git git://github.com/bzolnier/linux.git | 5466 | T: git git://github.com/bzolnier/linux.git |
5466 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ | 5467 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ |
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 4a038dcf5361..bc1cb284111c 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c | |||
@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach); | |||
625 | struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, | 625 | struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, |
626 | enum dma_data_direction direction) | 626 | enum dma_data_direction direction) |
627 | { | 627 | { |
628 | struct sg_table *sg_table = ERR_PTR(-EINVAL); | 628 | struct sg_table *sg_table; |
629 | 629 | ||
630 | might_sleep(); | 630 | might_sleep(); |
631 | 631 | ||
diff --git a/drivers/gpu/drm/armada/armada_510.c b/drivers/gpu/drm/armada/armada_510.c index ad3d2ebf95c9..41a784f5a5e6 100644 --- a/drivers/gpu/drm/armada/armada_510.c +++ b/drivers/gpu/drm/armada/armada_510.c | |||
@@ -9,7 +9,6 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/io.h> | 11 | #include <linux/io.h> |
12 | #include <drm/drmP.h> | ||
13 | #include <drm/drm_crtc_helper.h> | 12 | #include <drm/drm_crtc_helper.h> |
14 | #include "armada_crtc.h" | 13 | #include "armada_crtc.h" |
15 | #include "armada_drm.h" | 14 | #include "armada_drm.h" |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 2fbd9d3393e8..2d45103d06cb 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/component.h> | 9 | #include <linux/component.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/of_graph.h> | 11 | #include <linux/of_graph.h> |
12 | #include <drm/drmP.h> | ||
13 | #include <drm/drm_crtc_helper.h> | 12 | #include <drm/drm_crtc_helper.h> |
14 | #include <drm/drm_of.h> | 13 | #include <drm/drm_of.h> |
15 | #include "armada_crtc.h" | 14 | #include "armada_crtc.h" |
diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c index 92e6b08ea64a..b9e1637cc4cf 100644 --- a/drivers/gpu/drm/armada/armada_fb.c +++ b/drivers/gpu/drm/armada/armada_fb.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | #include <drm/drmP.h> | ||
9 | #include <drm/drm_crtc_helper.h> | 8 | #include <drm/drm_crtc_helper.h> |
10 | #include <drm/drm_fb_helper.h> | 9 | #include <drm/drm_fb_helper.h> |
11 | #include "armada_drm.h" | 10 | #include "armada_drm.h" |
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 29c7d047b152..10e3fd87a83b 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | 12 | ||
13 | #include <drm/drmP.h> | ||
14 | #include <drm/drm_fb_helper.h> | 13 | #include <drm/drm_fb_helper.h> |
15 | #include "armada_crtc.h" | 14 | #include "armada_crtc.h" |
16 | #include "armada_drm.h" | 15 | #include "armada_drm.h" |
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 79835380d5c6..7837e6adb16f 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/dma-buf.h> | 8 | #include <linux/dma-buf.h> |
9 | #include <linux/dma-mapping.h> | 9 | #include <linux/dma-mapping.h> |
10 | #include <linux/shmem_fs.h> | 10 | #include <linux/shmem_fs.h> |
11 | #include <drm/drmP.h> | ||
12 | #include "armada_drm.h" | 11 | #include "armada_drm.h" |
13 | #include "armada_gem.h" | 12 | #include "armada_gem.h" |
14 | #include <drm/armada_drm.h> | 13 | #include <drm/armada_drm.h> |
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index c89953449e96..737f02885c28 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c | |||
@@ -70,7 +70,6 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) | |||
70 | 70 | ||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | |||
74 | EXPORT_SYMBOL(drm_agp_info); | 73 | EXPORT_SYMBOL(drm_agp_info); |
75 | 74 | ||
76 | int drm_agp_info_ioctl(struct drm_device *dev, void *data, | 75 | int drm_agp_info_ioctl(struct drm_device *dev, void *data, |
@@ -95,18 +94,18 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, | |||
95 | * Verifies the AGP device hasn't been acquired before and calls | 94 | * Verifies the AGP device hasn't been acquired before and calls |
96 | * \c agp_backend_acquire. | 95 | * \c agp_backend_acquire. |
97 | */ | 96 | */ |
98 | int drm_agp_acquire(struct drm_device * dev) | 97 | int drm_agp_acquire(struct drm_device *dev) |
99 | { | 98 | { |
100 | if (!dev->agp) | 99 | if (!dev->agp) |
101 | return -ENODEV; | 100 | return -ENODEV; |
102 | if (dev->agp->acquired) | 101 | if (dev->agp->acquired) |
103 | return -EBUSY; | 102 | return -EBUSY; |
104 | if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev))) | 103 | dev->agp->bridge = agp_backend_acquire(dev->pdev); |
104 | if (!dev->agp->bridge) | ||
105 | return -ENODEV; | 105 | return -ENODEV; |
106 | dev->agp->acquired = 1; | 106 | dev->agp->acquired = 1; |
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | |||
110 | EXPORT_SYMBOL(drm_agp_acquire); | 109 | EXPORT_SYMBOL(drm_agp_acquire); |
111 | 110 | ||
112 | /** | 111 | /** |
@@ -135,7 +134,7 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, | |||
135 | * | 134 | * |
136 | * Verifies the AGP device has been acquired and calls \c agp_backend_release. | 135 | * Verifies the AGP device has been acquired and calls \c agp_backend_release. |
137 | */ | 136 | */ |
138 | int drm_agp_release(struct drm_device * dev) | 137 | int drm_agp_release(struct drm_device *dev) |
139 | { | 138 | { |
140 | if (!dev->agp || !dev->agp->acquired) | 139 | if (!dev->agp || !dev->agp->acquired) |
141 | return -EINVAL; | 140 | return -EINVAL; |
@@ -161,7 +160,7 @@ int drm_agp_release_ioctl(struct drm_device *dev, void *data, | |||
161 | * Verifies the AGP device has been acquired but not enabled, and calls | 160 | * Verifies the AGP device has been acquired but not enabled, and calls |
162 | * \c agp_enable. | 161 | * \c agp_enable. |
163 | */ | 162 | */ |
164 | int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) | 163 | int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode) |
165 | { | 164 | { |
166 | if (!dev->agp || !dev->agp->acquired) | 165 | if (!dev->agp || !dev->agp->acquired) |
167 | return -EINVAL; | 166 | return -EINVAL; |
@@ -171,7 +170,6 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) | |||
171 | dev->agp->enabled = 1; | 170 | dev->agp->enabled = 1; |
172 | return 0; | 171 | return 0; |
173 | } | 172 | } |
174 | |||
175 | EXPORT_SYMBOL(drm_agp_enable); | 173 | EXPORT_SYMBOL(drm_agp_enable); |
176 | 174 | ||
177 | int drm_agp_enable_ioctl(struct drm_device *dev, void *data, | 175 | int drm_agp_enable_ioctl(struct drm_device *dev, void *data, |
@@ -203,12 +201,14 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) | |||
203 | 201 | ||
204 | if (!dev->agp || !dev->agp->acquired) | 202 | if (!dev->agp || !dev->agp->acquired) |
205 | return -EINVAL; | 203 | return -EINVAL; |
206 | if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) | 204 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
205 | if (!entry) | ||
207 | return -ENOMEM; | 206 | return -ENOMEM; |
208 | 207 | ||
209 | pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; | 208 | pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; |
210 | type = (u32) request->type; | 209 | type = (u32) request->type; |
211 | if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) { | 210 | memory = agp_allocate_memory(dev->agp->bridge, pages, type); |
211 | if (!memory) { | ||
212 | kfree(entry); | 212 | kfree(entry); |
213 | return -ENOMEM; | 213 | return -ENOMEM; |
214 | } | 214 | } |
@@ -244,8 +244,8 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, | |||
244 | * | 244 | * |
245 | * Walks through drm_agp_head::memory until finding a matching handle. | 245 | * Walks through drm_agp_head::memory until finding a matching handle. |
246 | */ | 246 | */ |
247 | static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev, | 247 | static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device *dev, |
248 | unsigned long handle) | 248 | unsigned long handle) |
249 | { | 249 | { |
250 | struct drm_agp_mem *entry; | 250 | struct drm_agp_mem *entry; |
251 | 251 | ||
@@ -275,9 +275,8 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) | |||
275 | 275 | ||
276 | if (!dev->agp || !dev->agp->acquired) | 276 | if (!dev->agp || !dev->agp->acquired) |
277 | return -EINVAL; | 277 | return -EINVAL; |
278 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) | 278 | entry = drm_agp_lookup_entry(dev, request->handle); |
279 | return -EINVAL; | 279 | if (!entry || !entry->bound) |
280 | if (!entry->bound) | ||
281 | return -EINVAL; | 280 | return -EINVAL; |
282 | ret = drm_unbind_agp(entry->memory); | 281 | ret = drm_unbind_agp(entry->memory); |
283 | if (ret == 0) | 282 | if (ret == 0) |
@@ -316,12 +315,12 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) | |||
316 | 315 | ||
317 | if (!dev->agp || !dev->agp->acquired) | 316 | if (!dev->agp || !dev->agp->acquired) |
318 | return -EINVAL; | 317 | return -EINVAL; |
319 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) | 318 | entry = drm_agp_lookup_entry(dev, request->handle); |
320 | return -EINVAL; | 319 | if (!entry || entry->bound) |
321 | if (entry->bound) | ||
322 | return -EINVAL; | 320 | return -EINVAL; |
323 | page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; | 321 | page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; |
324 | if ((retcode = drm_bind_agp(entry->memory, page))) | 322 | retcode = drm_bind_agp(entry->memory, page); |
323 | if (retcode) | ||
325 | return retcode; | 324 | return retcode; |
326 | entry->bound = dev->agp->base + (page << PAGE_SHIFT); | 325 | entry->bound = dev->agp->base + (page << PAGE_SHIFT); |
327 | DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", | 326 | DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", |
@@ -359,7 +358,8 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) | |||
359 | 358 | ||
360 | if (!dev->agp || !dev->agp->acquired) | 359 | if (!dev->agp || !dev->agp->acquired) |
361 | return -EINVAL; | 360 | return -EINVAL; |
362 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) | 361 | entry = drm_agp_lookup_entry(dev, request->handle); |
362 | if (!entry) | ||
363 | return -EINVAL; | 363 | return -EINVAL; |
364 | if (entry->bound) | 364 | if (entry->bound) |
365 | drm_unbind_agp(entry->memory); | 365 | drm_unbind_agp(entry->memory); |
@@ -373,7 +373,6 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) | |||
373 | EXPORT_SYMBOL(drm_agp_free); | 373 | EXPORT_SYMBOL(drm_agp_free); |
374 | 374 | ||
375 | 375 | ||
376 | |||
377 | int drm_agp_free_ioctl(struct drm_device *dev, void *data, | 376 | int drm_agp_free_ioctl(struct drm_device *dev, void *data, |
378 | struct drm_file *file_priv) | 377 | struct drm_file *file_priv) |
379 | { | 378 | { |
@@ -398,11 +397,13 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) | |||
398 | { | 397 | { |
399 | struct drm_agp_head *head = NULL; | 398 | struct drm_agp_head *head = NULL; |
400 | 399 | ||
401 | if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) | 400 | head = kzalloc(sizeof(*head), GFP_KERNEL); |
401 | if (!head) | ||
402 | return NULL; | 402 | return NULL; |
403 | head->bridge = agp_find_bridge(dev->pdev); | 403 | head->bridge = agp_find_bridge(dev->pdev); |
404 | if (!head->bridge) { | 404 | if (!head->bridge) { |
405 | if (!(head->bridge = agp_backend_acquire(dev->pdev))) { | 405 | head->bridge = agp_backend_acquire(dev->pdev); |
406 | if (!head->bridge) { | ||
406 | kfree(head); | 407 | kfree(head); |
407 | return NULL; | 408 | return NULL; |
408 | } | 409 | } |
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index bb2e60f5feb6..d8ca526ca4ee 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c | |||
@@ -719,6 +719,29 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, | |||
719 | * callback. For atomic drivers the remapping to the "ACTIVE" property is | 719 | * callback. For atomic drivers the remapping to the "ACTIVE" property is |
720 | * implemented in the DRM core. This is the only standard connector | 720 | * implemented in the DRM core. This is the only standard connector |
721 | * property that userspace can change. | 721 | * property that userspace can change. |
722 | * | ||
723 | * Note that this property cannot be set through the MODE_ATOMIC ioctl, | ||
724 | * userspace must use "ACTIVE" on the CRTC instead. | ||
725 | * | ||
726 | * WARNING: | ||
727 | * | ||
728 | * For userspace also running on legacy drivers the "DPMS" semantics are a | ||
729 | * lot more complicated. First, userspace cannot rely on the "DPMS" value | ||
730 | * returned by the GETCONNECTOR actually reflecting reality, because many | ||
731 | * drivers fail to update it. For atomic drivers this is taken care of in | ||
732 | * drm_atomic_helper_update_legacy_modeset_state(). | ||
733 | * | ||
734 | * The second issue is that the DPMS state is only well-defined when the | ||
735 | * connector is connected to a CRTC. In atomic the DRM core enforces that | ||
736 | * "ACTIVE" is off in such a case, no such checks exists for "DPMS". | ||
737 | * | ||
738 | * Finally, when enabling an output using the legacy SETCONFIG ioctl then | ||
739 | * "DPMS" is forced to ON. But see above, that might not be reflected in | ||
740 | * the software value on legacy drivers. | ||
741 | * | ||
742 | * Summarizing: Only set "DPMS" when the connector is known to be enabled, | ||
743 | * assume that a successful SETCONFIG call also sets "DPMS" to on, and | ||
744 | * never read back the value of "DPMS" because it can be incorrect. | ||
722 | * PATH: | 745 | * PATH: |
723 | * Connector path property to identify how this sink is physically | 746 | * Connector path property to identify how this sink is physically |
724 | * connected. Used by DP MST. This should be set by calling | 747 | * connected. Used by DP MST. This should be set by calling |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index be38ac7050d4..c0292e5d7281 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -286,13 +286,13 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) | |||
286 | spin_lock_irqsave(&drm_minor_lock, flags); | 286 | spin_lock_irqsave(&drm_minor_lock, flags); |
287 | minor = idr_find(&drm_minors_idr, minor_id); | 287 | minor = idr_find(&drm_minors_idr, minor_id); |
288 | if (minor) | 288 | if (minor) |
289 | drm_dev_ref(minor->dev); | 289 | drm_dev_get(minor->dev); |
290 | spin_unlock_irqrestore(&drm_minor_lock, flags); | 290 | spin_unlock_irqrestore(&drm_minor_lock, flags); |
291 | 291 | ||
292 | if (!minor) { | 292 | if (!minor) { |
293 | return ERR_PTR(-ENODEV); | 293 | return ERR_PTR(-ENODEV); |
294 | } else if (drm_dev_is_unplugged(minor->dev)) { | 294 | } else if (drm_dev_is_unplugged(minor->dev)) { |
295 | drm_dev_unref(minor->dev); | 295 | drm_dev_put(minor->dev); |
296 | return ERR_PTR(-ENODEV); | 296 | return ERR_PTR(-ENODEV); |
297 | } | 297 | } |
298 | 298 | ||
@@ -301,7 +301,7 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) | |||
301 | 301 | ||
302 | void drm_minor_release(struct drm_minor *minor) | 302 | void drm_minor_release(struct drm_minor *minor) |
303 | { | 303 | { |
304 | drm_dev_unref(minor->dev); | 304 | drm_dev_put(minor->dev); |
305 | } | 305 | } |
306 | 306 | ||
307 | /** | 307 | /** |
@@ -326,11 +326,11 @@ void drm_minor_release(struct drm_minor *minor) | |||
326 | * When cleaning up a device instance everything needs to be done in reverse: | 326 | * When cleaning up a device instance everything needs to be done in reverse: |
327 | * First unpublish the device instance with drm_dev_unregister(). Then clean up | 327 | * First unpublish the device instance with drm_dev_unregister(). Then clean up |
328 | * any other resources allocated at device initialization and drop the driver's | 328 | * any other resources allocated at device initialization and drop the driver's |
329 | * reference to &drm_device using drm_dev_unref(). | 329 | * reference to &drm_device using drm_dev_put(). |
330 | * | 330 | * |
331 | * Note that the lifetime rules for &drm_device instance has still a lot of | 331 | * Note that the lifetime rules for &drm_device instance has still a lot of |
332 | * historical baggage. Hence use the reference counting provided by | 332 | * historical baggage. Hence use the reference counting provided by |
333 | * drm_dev_ref() and drm_dev_unref() only carefully. | 333 | * drm_dev_get() and drm_dev_put() only carefully. |
334 | * | 334 | * |
335 | * It is recommended that drivers embed &struct drm_device into their own device | 335 | * It is recommended that drivers embed &struct drm_device into their own device |
336 | * structure, which is supported through drm_dev_init(). | 336 | * structure, which is supported through drm_dev_init(). |
@@ -345,7 +345,7 @@ void drm_minor_release(struct drm_minor *minor) | |||
345 | * Cleans up all DRM device, calling drm_lastclose(). | 345 | * Cleans up all DRM device, calling drm_lastclose(). |
346 | * | 346 | * |
347 | * Note: Use of this function is deprecated. It will eventually go away | 347 | * Note: Use of this function is deprecated. It will eventually go away |
348 | * completely. Please use drm_dev_unregister() and drm_dev_unref() explicitly | 348 | * completely. Please use drm_dev_unregister() and drm_dev_put() explicitly |
349 | * instead to make sure that the device isn't userspace accessible any more | 349 | * instead to make sure that the device isn't userspace accessible any more |
350 | * while teardown is in progress, ensuring that userspace can't access an | 350 | * while teardown is in progress, ensuring that userspace can't access an |
351 | * inconsistent state. | 351 | * inconsistent state. |
@@ -360,7 +360,7 @@ void drm_put_dev(struct drm_device *dev) | |||
360 | } | 360 | } |
361 | 361 | ||
362 | drm_dev_unregister(dev); | 362 | drm_dev_unregister(dev); |
363 | drm_dev_unref(dev); | 363 | drm_dev_put(dev); |
364 | } | 364 | } |
365 | EXPORT_SYMBOL(drm_put_dev); | 365 | EXPORT_SYMBOL(drm_put_dev); |
366 | 366 | ||
@@ -386,7 +386,7 @@ void drm_dev_unplug(struct drm_device *dev) | |||
386 | mutex_lock(&drm_global_mutex); | 386 | mutex_lock(&drm_global_mutex); |
387 | drm_device_set_unplugged(dev); | 387 | drm_device_set_unplugged(dev); |
388 | if (dev->open_count == 0) | 388 | if (dev->open_count == 0) |
389 | drm_dev_unref(dev); | 389 | drm_dev_put(dev); |
390 | mutex_unlock(&drm_global_mutex); | 390 | mutex_unlock(&drm_global_mutex); |
391 | } | 391 | } |
392 | EXPORT_SYMBOL(drm_dev_unplug); | 392 | EXPORT_SYMBOL(drm_dev_unplug); |
@@ -475,8 +475,8 @@ static void drm_fs_inode_free(struct inode *inode) | |||
475 | * initialization sequence to make sure userspace can't access an inconsistent | 475 | * initialization sequence to make sure userspace can't access an inconsistent |
476 | * state. | 476 | * state. |
477 | * | 477 | * |
478 | * The initial ref-count of the object is 1. Use drm_dev_ref() and | 478 | * The initial ref-count of the object is 1. Use drm_dev_get() and |
479 | * drm_dev_unref() to take and drop further ref-counts. | 479 | * drm_dev_put() to take and drop further ref-counts. |
480 | * | 480 | * |
481 | * Note that for purely virtual devices @parent can be NULL. | 481 | * Note that for purely virtual devices @parent can be NULL. |
482 | * | 482 | * |
@@ -626,8 +626,8 @@ EXPORT_SYMBOL(drm_dev_fini); | |||
626 | * initialization sequence to make sure userspace can't access an inconsistent | 626 | * initialization sequence to make sure userspace can't access an inconsistent |
627 | * state. | 627 | * state. |
628 | * | 628 | * |
629 | * The initial ref-count of the object is 1. Use drm_dev_ref() and | 629 | * The initial ref-count of the object is 1. Use drm_dev_get() and |
630 | * drm_dev_unref() to take and drop further ref-counts. | 630 | * drm_dev_put() to take and drop further ref-counts. |
631 | * | 631 | * |
632 | * Note that for purely virtual devices @parent can be NULL. | 632 | * Note that for purely virtual devices @parent can be NULL. |
633 | * | 633 | * |
@@ -670,36 +670,49 @@ static void drm_dev_release(struct kref *ref) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | /** | 672 | /** |
673 | * drm_dev_ref - Take reference of a DRM device | 673 | * drm_dev_get - Take reference of a DRM device |
674 | * @dev: device to take reference of or NULL | 674 | * @dev: device to take reference of or NULL |
675 | * | 675 | * |
676 | * This increases the ref-count of @dev by one. You *must* already own a | 676 | * This increases the ref-count of @dev by one. You *must* already own a |
677 | * reference when calling this. Use drm_dev_unref() to drop this reference | 677 | * reference when calling this. Use drm_dev_put() to drop this reference |
678 | * again. | 678 | * again. |
679 | * | 679 | * |
680 | * This function never fails. However, this function does not provide *any* | 680 | * This function never fails. However, this function does not provide *any* |
681 | * guarantee whether the device is alive or running. It only provides a | 681 | * guarantee whether the device is alive or running. It only provides a |
682 | * reference to the object and the memory associated with it. | 682 | * reference to the object and the memory associated with it. |
683 | */ | 683 | */ |
684 | void drm_dev_ref(struct drm_device *dev) | 684 | void drm_dev_get(struct drm_device *dev) |
685 | { | 685 | { |
686 | if (dev) | 686 | if (dev) |
687 | kref_get(&dev->ref); | 687 | kref_get(&dev->ref); |
688 | } | 688 | } |
689 | EXPORT_SYMBOL(drm_dev_ref); | 689 | EXPORT_SYMBOL(drm_dev_get); |
690 | 690 | ||
691 | /** | 691 | /** |
692 | * drm_dev_unref - Drop reference of a DRM device | 692 | * drm_dev_put - Drop reference of a DRM device |
693 | * @dev: device to drop reference of or NULL | 693 | * @dev: device to drop reference of or NULL |
694 | * | 694 | * |
695 | * This decreases the ref-count of @dev by one. The device is destroyed if the | 695 | * This decreases the ref-count of @dev by one. The device is destroyed if the |
696 | * ref-count drops to zero. | 696 | * ref-count drops to zero. |
697 | */ | 697 | */ |
698 | void drm_dev_unref(struct drm_device *dev) | 698 | void drm_dev_put(struct drm_device *dev) |
699 | { | 699 | { |
700 | if (dev) | 700 | if (dev) |
701 | kref_put(&dev->ref, drm_dev_release); | 701 | kref_put(&dev->ref, drm_dev_release); |
702 | } | 702 | } |
703 | EXPORT_SYMBOL(drm_dev_put); | ||
704 | |||
705 | /** | ||
706 | * drm_dev_unref - Drop reference of a DRM device | ||
707 | * @dev: device to drop reference of or NULL | ||
708 | * | ||
709 | * This is a compatibility alias for drm_dev_put() and should not be used by new | ||
710 | * code. | ||
711 | */ | ||
712 | void drm_dev_unref(struct drm_device *dev) | ||
713 | { | ||
714 | drm_dev_put(dev); | ||
715 | } | ||
703 | EXPORT_SYMBOL(drm_dev_unref); | 716 | EXPORT_SYMBOL(drm_dev_unref); |
704 | 717 | ||
705 | static int create_compat_control_link(struct drm_device *dev) | 718 | static int create_compat_control_link(struct drm_device *dev) |
@@ -839,7 +852,7 @@ EXPORT_SYMBOL(drm_dev_register); | |||
839 | * | 852 | * |
840 | * Unregister the DRM device from the system. This does the reverse of | 853 | * Unregister the DRM device from the system. This does the reverse of |
841 | * drm_dev_register() but does not deallocate the device. The caller must call | 854 | * drm_dev_register() but does not deallocate the device. The caller must call |
842 | * drm_dev_unref() to drop their final reference. | 855 | * drm_dev_put() to drop their final reference. |
843 | * | 856 | * |
844 | * A special form of unregistering for hotpluggable devices is drm_dev_unplug(), | 857 | * A special form of unregistering for hotpluggable devices is drm_dev_unplug(), |
845 | * which can be called while there are still open users of @dev. | 858 | * which can be called while there are still open users of @dev. |
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index f2ee88363015..0e3c14174d08 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c | |||
@@ -38,7 +38,7 @@ struct drm_fbdev_cma { | |||
38 | * Provides helper functions for creating a cma (contiguous memory allocator) | 38 | * Provides helper functions for creating a cma (contiguous memory allocator) |
39 | * backed framebuffer. | 39 | * backed framebuffer. |
40 | * | 40 | * |
41 | * drm_fb_cma_create() is used in the &drm_mode_config_funcs.fb_create | 41 | * drm_gem_fb_create() is used in the &drm_mode_config_funcs.fb_create |
42 | * callback function to create a cma backed framebuffer. | 42 | * callback function to create a cma backed framebuffer. |
43 | * | 43 | * |
44 | * An fbdev framebuffer backed by cma is also available by calling | 44 | * An fbdev framebuffer backed by cma is also available by calling |
@@ -61,8 +61,8 @@ struct drm_fbdev_cma { | |||
61 | * } | 61 | * } |
62 | * | 62 | * |
63 | * static struct drm_framebuffer_funcs driver_fb_funcs = { | 63 | * static struct drm_framebuffer_funcs driver_fb_funcs = { |
64 | * .destroy = drm_fb_cma_destroy, | 64 | * .destroy = drm_gem_fb_destroy, |
65 | * .create_handle = drm_fb_cma_create_handle, | 65 | * .create_handle = drm_gem_fb_create_handle, |
66 | * .dirty = driver_fb_dirty, | 66 | * .dirty = driver_fb_dirty, |
67 | * }; | 67 | * }; |
68 | * | 68 | * |
@@ -80,57 +80,6 @@ static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper *helper) | |||
80 | return container_of(helper, struct drm_fbdev_cma, fb_helper); | 80 | return container_of(helper, struct drm_fbdev_cma, fb_helper); |
81 | } | 81 | } |
82 | 82 | ||
83 | void drm_fb_cma_destroy(struct drm_framebuffer *fb) | ||
84 | { | ||
85 | drm_gem_fb_destroy(fb); | ||
86 | } | ||
87 | EXPORT_SYMBOL(drm_fb_cma_destroy); | ||
88 | |||
89 | int drm_fb_cma_create_handle(struct drm_framebuffer *fb, | ||
90 | struct drm_file *file_priv, unsigned int *handle) | ||
91 | { | ||
92 | return drm_gem_fb_create_handle(fb, file_priv, handle); | ||
93 | } | ||
94 | EXPORT_SYMBOL(drm_fb_cma_create_handle); | ||
95 | |||
96 | /** | ||
97 | * drm_fb_cma_create_with_funcs() - helper function for the | ||
98 | * &drm_mode_config_funcs.fb_create | ||
99 | * callback | ||
100 | * @dev: DRM device | ||
101 | * @file_priv: drm file for the ioctl call | ||
102 | * @mode_cmd: metadata from the userspace fb creation request | ||
103 | * @funcs: vtable to be used for the new framebuffer object | ||
104 | * | ||
105 | * This can be used to set &drm_framebuffer_funcs for drivers that need the | ||
106 | * &drm_framebuffer_funcs.dirty callback. Use drm_fb_cma_create() if you don't | ||
107 | * need to change &drm_framebuffer_funcs. | ||
108 | */ | ||
109 | struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, | ||
110 | struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, | ||
111 | const struct drm_framebuffer_funcs *funcs) | ||
112 | { | ||
113 | return drm_gem_fb_create_with_funcs(dev, file_priv, mode_cmd, funcs); | ||
114 | } | ||
115 | EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs); | ||
116 | |||
117 | /** | ||
118 | * drm_fb_cma_create() - &drm_mode_config_funcs.fb_create callback function | ||
119 | * @dev: DRM device | ||
120 | * @file_priv: drm file for the ioctl call | ||
121 | * @mode_cmd: metadata from the userspace fb creation request | ||
122 | * | ||
123 | * If your hardware has special alignment or pitch requirements these should be | ||
124 | * checked before calling this function. Use drm_fb_cma_create_with_funcs() if | ||
125 | * you need to set &drm_framebuffer_funcs.dirty. | ||
126 | */ | ||
127 | struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, | ||
128 | struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) | ||
129 | { | ||
130 | return drm_gem_fb_create(dev, file_priv, mode_cmd); | ||
131 | } | ||
132 | EXPORT_SYMBOL_GPL(drm_fb_cma_create); | ||
133 | |||
134 | /** | 83 | /** |
135 | * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer | 84 | * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer |
136 | * @fb: The framebuffer | 85 | * @fb: The framebuffer |
@@ -181,26 +130,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, | |||
181 | } | 130 | } |
182 | EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr); | 131 | EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr); |
183 | 132 | ||
184 | /** | ||
185 | * drm_fb_cma_prepare_fb() - Prepare CMA framebuffer | ||
186 | * @plane: Which plane | ||
187 | * @state: Plane state attach fence to | ||
188 | * | ||
189 | * This should be set as the &struct drm_plane_helper_funcs.prepare_fb hook. | ||
190 | * | ||
191 | * This function checks if the plane FB has an dma-buf attached, extracts | ||
192 | * the exclusive fence and attaches it to plane state for the atomic helper | ||
193 | * to wait on. | ||
194 | * | ||
195 | * There is no need for cleanup_fb for CMA based framebuffer drivers. | ||
196 | */ | ||
197 | int drm_fb_cma_prepare_fb(struct drm_plane *plane, | ||
198 | struct drm_plane_state *state) | ||
199 | { | ||
200 | return drm_gem_fb_prepare_fb(plane, state); | ||
201 | } | ||
202 | EXPORT_SYMBOL_GPL(drm_fb_cma_prepare_fb); | ||
203 | |||
204 | #ifdef CONFIG_DEBUG_FS | 133 | #ifdef CONFIG_DEBUG_FS |
205 | static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) | 134 | static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) |
206 | { | 135 | { |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 7199bba68c37..55d6182555c7 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -282,15 +282,6 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) | |||
282 | { | 282 | { |
283 | struct drm_gem_object *obj; | 283 | struct drm_gem_object *obj; |
284 | 284 | ||
285 | /* This is gross. The idr system doesn't let us try a delete and | ||
286 | * return an error code. It just spews if you fail at deleting. | ||
287 | * So, we have to grab a lock around finding the object and then | ||
288 | * doing the delete on it and dropping the refcount, or the user | ||
289 | * could race us to double-decrement the refcount and cause a | ||
290 | * use-after-free later. Given the frequency of our handle lookups, | ||
291 | * we may want to use ida for number allocation and a hash table | ||
292 | * for the pointers, anyway. | ||
293 | */ | ||
294 | spin_lock(&filp->table_lock); | 285 | spin_lock(&filp->table_lock); |
295 | 286 | ||
296 | /* Check if we currently have a reference on the object */ | 287 | /* Check if we currently have a reference on the object */ |
@@ -543,7 +534,7 @@ EXPORT_SYMBOL(drm_gem_create_mmap_offset); | |||
543 | * Note that you are not allowed to change gfp-zones during runtime. That is, | 534 | * Note that you are not allowed to change gfp-zones during runtime. That is, |
544 | * shmem_read_mapping_page_gfp() must be called with the same gfp_zone(gfp) as | 535 | * shmem_read_mapping_page_gfp() must be called with the same gfp_zone(gfp) as |
545 | * set during initialization. If you have special zone constraints, set them | 536 | * set during initialization. If you have special zone constraints, set them |
546 | * after drm_gem_init_object() via mapping_set_gfp_mask(). shmem-core takes care | 537 | * after drm_gem_object_init() via mapping_set_gfp_mask(). shmem-core takes care |
547 | * to keep pages in the required zone during swap-in. | 538 | * to keep pages in the required zone during swap-in. |
548 | */ | 539 | */ |
549 | struct page **drm_gem_get_pages(struct drm_gem_object *obj) | 540 | struct page **drm_gem_get_pages(struct drm_gem_object *obj) |
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 8dafbdfcd2ea..4c191c050e7d 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c | |||
@@ -233,6 +233,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, | |||
233 | 233 | ||
234 | if (!panel && !bridge) | 234 | if (!panel && !bridge) |
235 | return -EINVAL; | 235 | return -EINVAL; |
236 | if (panel) | ||
237 | *panel = NULL; | ||
236 | 238 | ||
237 | remote = of_graph_get_remote_node(np, port, endpoint); | 239 | remote = of_graph_get_remote_node(np, port, endpoint); |
238 | if (!remote) | 240 | if (!remote) |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 1235c9877d6f..4db9c515b74f 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -274,7 +274,7 @@ err_agp: | |||
274 | drm_pci_agp_destroy(dev); | 274 | drm_pci_agp_destroy(dev); |
275 | pci_disable_device(pdev); | 275 | pci_disable_device(pdev); |
276 | err_free: | 276 | err_free: |
277 | drm_dev_unref(dev); | 277 | drm_dev_put(dev); |
278 | return ret; | 278 | return ret; |
279 | } | 279 | } |
280 | EXPORT_SYMBOL(drm_get_pci_dev); | 280 | EXPORT_SYMBOL(drm_get_pci_dev); |
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 22408badc617..8de93a226c24 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -318,7 +318,7 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, | |||
318 | if (IS_ERR(dma_buf)) | 318 | if (IS_ERR(dma_buf)) |
319 | return dma_buf; | 319 | return dma_buf; |
320 | 320 | ||
321 | drm_dev_ref(dev); | 321 | drm_dev_get(dev); |
322 | drm_gem_object_get(exp_info->priv); | 322 | drm_gem_object_get(exp_info->priv); |
323 | 323 | ||
324 | return dma_buf; | 324 | return dma_buf; |
@@ -342,7 +342,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf) | |||
342 | /* drop the reference on the export fd holds */ | 342 | /* drop the reference on the export fd holds */ |
343 | drm_gem_object_put_unlocked(obj); | 343 | drm_gem_object_put_unlocked(obj); |
344 | 344 | ||
345 | drm_dev_unref(dev); | 345 | drm_dev_put(dev); |
346 | } | 346 | } |
347 | EXPORT_SYMBOL(drm_gem_dmabuf_release); | 347 | EXPORT_SYMBOL(drm_gem_dmabuf_release); |
348 | 348 | ||
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c index d9d6cc1c8e39..ddc68e476a4d 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <drm/drm_atomic_helper.h> | 13 | #include <drm/drm_atomic_helper.h> |
14 | #include <drm/drm_crtc_helper.h> | 14 | #include <drm/drm_crtc_helper.h> |
15 | #include <drm/drm_fb_cma_helper.h> | 15 | #include <drm/drm_fb_cma_helper.h> |
16 | #include <drm/drm_gem_framebuffer_helper.h> | ||
16 | 17 | ||
17 | #include "fsl_dcu_drm_crtc.h" | 18 | #include "fsl_dcu_drm_crtc.h" |
18 | #include "fsl_dcu_drm_drv.h" | 19 | #include "fsl_dcu_drm_drv.h" |
@@ -20,7 +21,7 @@ | |||
20 | static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = { | 21 | static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = { |
21 | .atomic_check = drm_atomic_helper_check, | 22 | .atomic_check = drm_atomic_helper_check, |
22 | .atomic_commit = drm_atomic_helper_commit, | 23 | .atomic_commit = drm_atomic_helper_commit, |
23 | .fb_create = drm_fb_cma_create, | 24 | .fb_create = drm_gem_fb_create, |
24 | }; | 25 | }; |
25 | 26 | ||
26 | int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) | 27 | int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) |
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index e27352ca26c4..c19ab4f91ae7 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <drm/drmP.h> | 22 | #include <drm/drmP.h> |
23 | #include <drm/drm_gem_cma_helper.h> | 23 | #include <drm/drm_gem_cma_helper.h> |
24 | #include <drm/drm_fb_cma_helper.h> | 24 | #include <drm/drm_fb_cma_helper.h> |
25 | #include <drm/drm_gem_framebuffer_helper.h> | ||
25 | #include <drm/drm_atomic_helper.h> | 26 | #include <drm/drm_atomic_helper.h> |
26 | #include <drm/drm_crtc_helper.h> | 27 | #include <drm/drm_crtc_helper.h> |
27 | #include <drm/drm_of.h> | 28 | #include <drm/drm_of.h> |
@@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev) | |||
56 | } | 57 | } |
57 | 58 | ||
58 | static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { | 59 | static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { |
59 | .fb_create = drm_fb_cma_create, | 60 | .fb_create = drm_gem_fb_create, |
60 | .output_poll_changed = kirin_fbdev_output_poll_changed, | 61 | .output_poll_changed = kirin_fbdev_output_poll_changed, |
61 | .atomic_check = drm_atomic_helper_check, | 62 | .atomic_check = drm_atomic_helper_check, |
62 | .atomic_commit = drm_atomic_helper_commit, | 63 | .atomic_commit = drm_atomic_helper_commit, |
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 7742c7d81ed8..3b804fdaf7a0 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <drm/drm_crtc_helper.h> | 34 | #include <drm/drm_crtc_helper.h> |
35 | #include <drm/drm_plane_helper.h> | 35 | #include <drm/drm_plane_helper.h> |
36 | #include <drm/drm_gem_cma_helper.h> | 36 | #include <drm/drm_gem_cma_helper.h> |
37 | #include <drm/drm_gem_framebuffer_helper.h> | ||
37 | #include <drm/drm_fb_cma_helper.h> | 38 | #include <drm/drm_fb_cma_helper.h> |
38 | #include <drm/drm_rect.h> | 39 | #include <drm/drm_rect.h> |
39 | #include <drm/drm_fb_helper.h> | 40 | #include <drm/drm_fb_helper.h> |
@@ -78,7 +79,7 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { | |||
78 | .output_poll_changed = meson_fb_output_poll_changed, | 79 | .output_poll_changed = meson_fb_output_poll_changed, |
79 | .atomic_check = drm_atomic_helper_check, | 80 | .atomic_check = drm_atomic_helper_check, |
80 | .atomic_commit = drm_atomic_helper_commit, | 81 | .atomic_commit = drm_atomic_helper_commit, |
81 | .fb_create = drm_fb_cma_create, | 82 | .fb_create = drm_gem_fb_create, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | static irqreturn_t meson_irq(int irq, void *arg) | 85 | static irqreturn_t meson_irq(int irq, void *arg) |
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 7fbad9cb656e..1207ffe36250 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <drm/drm_fb_helper.h> | 35 | #include <drm/drm_fb_helper.h> |
36 | #include <drm/drm_fb_cma_helper.h> | 36 | #include <drm/drm_fb_cma_helper.h> |
37 | #include <drm/drm_gem_cma_helper.h> | 37 | #include <drm/drm_gem_cma_helper.h> |
38 | #include <drm/drm_gem_framebuffer_helper.h> | ||
38 | #include <drm/drm_of.h> | 39 | #include <drm/drm_of.h> |
39 | #include <drm/drm_panel.h> | 40 | #include <drm/drm_panel.h> |
40 | #include <drm/drm_simple_kms_helper.h> | 41 | #include <drm/drm_simple_kms_helper.h> |
@@ -92,7 +93,7 @@ void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) | |||
92 | } | 93 | } |
93 | 94 | ||
94 | static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { | 95 | static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { |
95 | .fb_create = drm_fb_cma_create, | 96 | .fb_create = drm_gem_fb_create, |
96 | .atomic_check = drm_atomic_helper_check, | 97 | .atomic_check = drm_atomic_helper_check, |
97 | .atomic_commit = drm_atomic_helper_commit, | 98 | .atomic_commit = drm_atomic_helper_commit, |
98 | }; | 99 | }; |
@@ -127,7 +128,7 @@ static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, | |||
127 | static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, | 128 | static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, |
128 | struct drm_plane_state *plane_state) | 129 | struct drm_plane_state *plane_state) |
129 | { | 130 | { |
130 | return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); | 131 | return drm_gem_fb_prepare_fb(&pipe->plane, plane_state); |
131 | } | 132 | } |
132 | 133 | ||
133 | static struct drm_simple_display_pipe_funcs mxsfb_funcs = { | 134 | static struct drm_simple_display_pipe_funcs mxsfb_funcs = { |
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 7278b9703c15..566d1a948c8f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <drm/drm_crtc_helper.h> | 18 | #include <drm/drm_crtc_helper.h> |
19 | #include <drm/drm_fb_cma_helper.h> | 19 | #include <drm/drm_fb_cma_helper.h> |
20 | #include <drm/drm_gem_cma_helper.h> | 20 | #include <drm/drm_gem_cma_helper.h> |
21 | #include <drm/drm_gem_framebuffer_helper.h> | ||
21 | 22 | ||
22 | #include <linux/of_graph.h> | 23 | #include <linux/of_graph.h> |
23 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
@@ -213,7 +214,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
213 | } | 214 | } |
214 | } | 215 | } |
215 | 216 | ||
216 | return drm_fb_cma_create(dev, file_priv, mode_cmd); | 217 | return drm_gem_fb_create(dev, file_priv, mode_cmd); |
217 | } | 218 | } |
218 | 219 | ||
219 | static void rcar_du_output_poll_changed(struct drm_device *dev) | 220 | static void rcar_du_output_poll_changed(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index a57da051f516..275844d0d0ec 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c | |||
@@ -287,14 +287,6 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) | |||
287 | return ret; | 287 | return ret; |
288 | } | 288 | } |
289 | 289 | ||
290 | static struct drm_encoder * | ||
291 | cdn_dp_connector_best_encoder(struct drm_connector *connector) | ||
292 | { | ||
293 | struct cdn_dp_device *dp = connector_to_dp(connector); | ||
294 | |||
295 | return &dp->encoder; | ||
296 | } | ||
297 | |||
298 | static int cdn_dp_connector_mode_valid(struct drm_connector *connector, | 290 | static int cdn_dp_connector_mode_valid(struct drm_connector *connector, |
299 | struct drm_display_mode *mode) | 291 | struct drm_display_mode *mode) |
300 | { | 292 | { |
@@ -346,7 +338,6 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector, | |||
346 | 338 | ||
347 | static struct drm_connector_helper_funcs cdn_dp_connector_helper_funcs = { | 339 | static struct drm_connector_helper_funcs cdn_dp_connector_helper_funcs = { |
348 | .get_modes = cdn_dp_connector_get_modes, | 340 | .get_modes = cdn_dp_connector_get_modes, |
349 | .best_encoder = cdn_dp_connector_best_encoder, | ||
350 | .mode_valid = cdn_dp_connector_mode_valid, | 341 | .mode_valid = cdn_dp_connector_mode_valid, |
351 | }; | 342 | }; |
352 | 343 | ||
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index 1869c8bb76c8..1d9655576b6e 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c | |||
@@ -220,7 +220,7 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj, | |||
220 | { | 220 | { |
221 | struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); | 221 | struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); |
222 | unsigned int i, count = obj->size >> PAGE_SHIFT; | 222 | unsigned int i, count = obj->size >> PAGE_SHIFT; |
223 | unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 223 | unsigned long user_count = vma_pages(vma); |
224 | unsigned long uaddr = vma->vm_start; | 224 | unsigned long uaddr = vma->vm_start; |
225 | unsigned long offset = vma->vm_pgoff; | 225 | unsigned long offset = vma->vm_pgoff; |
226 | unsigned long end = user_count + offset; | 226 | unsigned long end = user_count + offset; |
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c index c5fbe533796c..84911bdc27d1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c | |||
@@ -346,7 +346,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, | |||
346 | struct drm_connector *connector; | 346 | struct drm_connector *connector; |
347 | struct device_node *remote = NULL; | 347 | struct device_node *remote = NULL; |
348 | struct device_node *port, *endpoint; | 348 | struct device_node *port, *endpoint; |
349 | int ret; | 349 | int ret = 0, child_count = 0; |
350 | const char *name; | 350 | const char *name; |
351 | u32 endpoint_id; | 351 | u32 endpoint_id; |
352 | 352 | ||
@@ -358,15 +358,20 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, | |||
358 | return -EINVAL; | 358 | return -EINVAL; |
359 | } | 359 | } |
360 | for_each_child_of_node(port, endpoint) { | 360 | for_each_child_of_node(port, endpoint) { |
361 | child_count++; | ||
361 | of_property_read_u32(endpoint, "reg", &endpoint_id); | 362 | of_property_read_u32(endpoint, "reg", &endpoint_id); |
362 | ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id, | 363 | ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id, |
363 | &lvds->panel, &lvds->bridge); | 364 | &lvds->panel, &lvds->bridge); |
364 | if (!ret) | 365 | if (!ret) |
365 | break; | 366 | break; |
366 | } | 367 | } |
367 | if (ret) { | 368 | if (!child_count) { |
369 | DRM_DEV_ERROR(dev, "lvds port does not have any children\n"); | ||
370 | ret = -EINVAL; | ||
371 | goto err_put_port; | ||
372 | } else if (ret) { | ||
368 | DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); | 373 | DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); |
369 | ret = -EPROBE_DEFER; | 374 | ret = -EPROBE_DEFER; |
370 | goto err_put_port; | 375 | goto err_put_port; |
371 | } | 376 | } |
372 | if (lvds->panel) | 377 | if (lvds->panel) |
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c index 388a0fc13564..d36919b14da7 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <drm/drm_crtc_helper.h> | 16 | #include <drm/drm_crtc_helper.h> |
17 | #include <drm/drm_fb_cma_helper.h> | 17 | #include <drm/drm_fb_cma_helper.h> |
18 | #include <drm/drm_gem_cma_helper.h> | 18 | #include <drm/drm_gem_cma_helper.h> |
19 | #include <drm/drm_gem_framebuffer_helper.h> | ||
19 | 20 | ||
20 | #include <video/sh_mobile_meram.h> | 21 | #include <video/sh_mobile_meram.h> |
21 | 22 | ||
@@ -131,7 +132,7 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
131 | } | 132 | } |
132 | } | 133 | } |
133 | 134 | ||
134 | return drm_fb_cma_create(dev, file_priv, mode_cmd); | 135 | return drm_gem_fb_create(dev, file_priv, mode_cmd); |
135 | } | 136 | } |
136 | 137 | ||
137 | static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = { | 138 | static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = { |
diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c index 9872e0fc03b0..2992f0a6b349 100644 --- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c +++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <drm/drm_atomic_helper.h> | 13 | #include <drm/drm_atomic_helper.h> |
14 | #include <drm/drm_fb_cma_helper.h> | 14 | #include <drm/drm_fb_cma_helper.h> |
15 | #include <drm/drm_gem_framebuffer_helper.h> | ||
15 | #include <drm/drmP.h> | 16 | #include <drm/drmP.h> |
16 | 17 | ||
17 | #include "sun4i_drv.h" | 18 | #include "sun4i_drv.h" |
@@ -28,7 +29,7 @@ static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = { | |||
28 | .output_poll_changed = sun4i_de_output_poll_changed, | 29 | .output_poll_changed = sun4i_de_output_poll_changed, |
29 | .atomic_check = drm_atomic_helper_check, | 30 | .atomic_check = drm_atomic_helper_check, |
30 | .atomic_commit = drm_atomic_helper_commit, | 31 | .atomic_commit = drm_atomic_helper_commit, |
31 | .fb_create = drm_fb_cma_create, | 32 | .fb_create = drm_gem_fb_create, |
32 | }; | 33 | }; |
33 | 34 | ||
34 | struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) | 35 | struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 406fe4544b83..d2589f310437 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c | |||
@@ -75,7 +75,7 @@ static void unref_worker(struct drm_flip_work *work, void *val) | |||
75 | struct drm_device *dev = tilcdc_crtc->base.dev; | 75 | struct drm_device *dev = tilcdc_crtc->base.dev; |
76 | 76 | ||
77 | mutex_lock(&dev->mode_config.mutex); | 77 | mutex_lock(&dev->mode_config.mutex); |
78 | drm_framebuffer_unreference(val); | 78 | drm_framebuffer_put(val); |
79 | mutex_unlock(&dev->mode_config.mutex); | 79 | mutex_unlock(&dev->mode_config.mutex); |
80 | } | 80 | } |
81 | 81 | ||
@@ -456,7 +456,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) | |||
456 | 456 | ||
457 | set_scanout(crtc, fb); | 457 | set_scanout(crtc, fb); |
458 | 458 | ||
459 | drm_framebuffer_reference(fb); | 459 | drm_framebuffer_get(fb); |
460 | 460 | ||
461 | crtc->hwmode = crtc->state->adjusted_mode; | 461 | crtc->hwmode = crtc->state->adjusted_mode; |
462 | } | 462 | } |
@@ -633,7 +633,7 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, | |||
633 | return -EBUSY; | 633 | return -EBUSY; |
634 | } | 634 | } |
635 | 635 | ||
636 | drm_framebuffer_reference(fb); | 636 | drm_framebuffer_get(fb); |
637 | 637 | ||
638 | crtc->primary->fb = fb; | 638 | crtc->primary->fb = fb; |
639 | tilcdc_crtc->event = event; | 639 | tilcdc_crtc->event = event; |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 146ac9a5a2fd..72ce063aa0d8 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | |||
@@ -226,7 +226,7 @@ static void tilcdc_fini(struct drm_device *dev) | |||
226 | 226 | ||
227 | pm_runtime_disable(dev->dev); | 227 | pm_runtime_disable(dev->dev); |
228 | 228 | ||
229 | drm_dev_unref(dev); | 229 | drm_dev_put(dev); |
230 | } | 230 | } |
231 | 231 | ||
232 | static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) | 232 | static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) |
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c index 551709e6b114..1a8a57cad431 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <drm/drm_atomic.h> | 10 | #include <drm/drm_atomic.h> |
11 | #include <drm/drm_atomic_helper.h> | 11 | #include <drm/drm_atomic_helper.h> |
12 | #include <drm/drm_crtc_helper.h> | 12 | #include <drm/drm_crtc_helper.h> |
13 | #include <drm/drm_gem_framebuffer_helper.h> | ||
13 | #include <drm/tinydrm/tinydrm.h> | 14 | #include <drm/tinydrm/tinydrm.h> |
14 | #include <linux/device.h> | 15 | #include <linux/device.h> |
15 | #include <linux/dma-buf.h> | 16 | #include <linux/dma-buf.h> |
@@ -128,7 +129,7 @@ tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv, | |||
128 | { | 129 | { |
129 | struct tinydrm_device *tdev = drm->dev_private; | 130 | struct tinydrm_device *tdev = drm->dev_private; |
130 | 131 | ||
131 | return drm_fb_cma_create_with_funcs(drm, file_priv, mode_cmd, | 132 | return drm_gem_fb_create_with_funcs(drm, file_priv, mode_cmd, |
132 | tdev->fb_funcs); | 133 | tdev->fb_funcs); |
133 | } | 134 | } |
134 | 135 | ||
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c index 177e9d861001..fc447c9a1a27 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <drm/drm_atomic_helper.h> | 10 | #include <drm/drm_atomic_helper.h> |
11 | #include <drm/drm_crtc_helper.h> | 11 | #include <drm/drm_crtc_helper.h> |
12 | #include <drm/drm_gem_framebuffer_helper.h> | ||
12 | #include <drm/drm_modes.h> | 13 | #include <drm/drm_modes.h> |
13 | #include <drm/tinydrm/tinydrm.h> | 14 | #include <drm/tinydrm/tinydrm.h> |
14 | 15 | ||
@@ -144,7 +145,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update); | |||
144 | * @pipe: Simple display pipe | 145 | * @pipe: Simple display pipe |
145 | * @plane_state: Plane state | 146 | * @plane_state: Plane state |
146 | * | 147 | * |
147 | * This function uses drm_fb_cma_prepare_fb() to check if the plane FB has an | 148 | * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an |
148 | * dma-buf attached, extracts the exclusive fence and attaches it to plane | 149 | * dma-buf attached, extracts the exclusive fence and attaches it to plane |
149 | * state for the atomic helper to wait on. Drivers can use this as their | 150 | * state for the atomic helper to wait on. Drivers can use this as their |
150 | * &drm_simple_display_pipe_funcs->prepare_fb callback. | 151 | * &drm_simple_display_pipe_funcs->prepare_fb callback. |
@@ -152,7 +153,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update); | |||
152 | int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, | 153 | int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe, |
153 | struct drm_plane_state *plane_state) | 154 | struct drm_plane_state *plane_state) |
154 | { | 155 | { |
155 | return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); | 156 | return drm_gem_fb_prepare_fb(&pipe->plane, plane_state); |
156 | } | 157 | } |
157 | EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb); | 158 | EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb); |
158 | 159 | ||
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index f0dedc244944..d43e992ab432 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <drm/drm_gem_framebuffer_helper.h> | ||
12 | #include <drm/tinydrm/mipi-dbi.h> | 13 | #include <drm/tinydrm/mipi-dbi.h> |
13 | #include <drm/tinydrm/tinydrm-helpers.h> | 14 | #include <drm/tinydrm/tinydrm-helpers.h> |
14 | #include <linux/debugfs.h> | 15 | #include <linux/debugfs.h> |
@@ -253,8 +254,8 @@ out_unlock: | |||
253 | } | 254 | } |
254 | 255 | ||
255 | static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = { | 256 | static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = { |
256 | .destroy = drm_fb_cma_destroy, | 257 | .destroy = drm_gem_fb_destroy, |
257 | .create_handle = drm_fb_cma_create_handle, | 258 | .create_handle = drm_gem_fb_create_handle, |
258 | .dirty = mipi_dbi_fb_dirty, | 259 | .dirty = mipi_dbi_fb_dirty, |
259 | }; | 260 | }; |
260 | 261 | ||
diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c index 5fbe14715c83..340198f5afea 100644 --- a/drivers/gpu/drm/tinydrm/repaper.c +++ b/drivers/gpu/drm/tinydrm/repaper.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/thermal.h> | 27 | #include <linux/thermal.h> |
28 | 28 | ||
29 | #include <drm/drm_gem_framebuffer_helper.h> | ||
29 | #include <drm/tinydrm/tinydrm.h> | 30 | #include <drm/tinydrm/tinydrm.h> |
30 | #include <drm/tinydrm/tinydrm-helpers.h> | 31 | #include <drm/tinydrm/tinydrm-helpers.h> |
31 | 32 | ||
@@ -636,8 +637,8 @@ out_unlock: | |||
636 | } | 637 | } |
637 | 638 | ||
638 | static const struct drm_framebuffer_funcs repaper_fb_funcs = { | 639 | static const struct drm_framebuffer_funcs repaper_fb_funcs = { |
639 | .destroy = drm_fb_cma_destroy, | 640 | .destroy = drm_gem_fb_destroy, |
640 | .create_handle = drm_fb_cma_create_handle, | 641 | .create_handle = drm_gem_fb_create_handle, |
641 | .dirty = repaper_fb_dirty, | 642 | .dirty = repaper_fb_dirty, |
642 | }; | 643 | }; |
643 | 644 | ||
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index 07b4d312784c..da9c0d83045f 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
18 | #include <video/mipi_display.h> | 18 | #include <video/mipi_display.h> |
19 | 19 | ||
20 | #include <drm/drm_gem_framebuffer_helper.h> | ||
20 | #include <drm/tinydrm/mipi-dbi.h> | 21 | #include <drm/tinydrm/mipi-dbi.h> |
21 | #include <drm/tinydrm/tinydrm-helpers.h> | 22 | #include <drm/tinydrm/tinydrm-helpers.h> |
22 | 23 | ||
@@ -167,8 +168,8 @@ out_unlock: | |||
167 | } | 168 | } |
168 | 169 | ||
169 | static const struct drm_framebuffer_funcs st7586_fb_funcs = { | 170 | static const struct drm_framebuffer_funcs st7586_fb_funcs = { |
170 | .destroy = drm_fb_cma_destroy, | 171 | .destroy = drm_gem_fb_destroy, |
171 | .create_handle = drm_fb_cma_create_handle, | 172 | .create_handle = drm_gem_fb_create_handle, |
172 | .dirty = st7586_fb_dirty, | 173 | .dirty = st7586_fb_dirty, |
173 | }; | 174 | }; |
174 | 175 | ||
diff --git a/drivers/gpu/drm/tve200/tve200_display.c b/drivers/gpu/drm/tve200/tve200_display.c index 18457de47bbc..2c668bd6d997 100644 --- a/drivers/gpu/drm/tve200/tve200_display.c +++ b/drivers/gpu/drm/tve200/tve200_display.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <drm/drmP.h> | 21 | #include <drm/drmP.h> |
22 | #include <drm/drm_panel.h> | 22 | #include <drm/drm_panel.h> |
23 | #include <drm/drm_gem_cma_helper.h> | 23 | #include <drm/drm_gem_cma_helper.h> |
24 | #include <drm/drm_gem_framebuffer_helper.h> | ||
24 | #include <drm/drm_fb_cma_helper.h> | 25 | #include <drm/drm_fb_cma_helper.h> |
25 | 26 | ||
26 | #include "tve200_drm.h" | 27 | #include "tve200_drm.h" |
@@ -221,7 +222,7 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe, | |||
221 | drm_crtc_vblank_on(crtc); | 222 | drm_crtc_vblank_on(crtc); |
222 | } | 223 | } |
223 | 224 | ||
224 | void tve200_display_disable(struct drm_simple_display_pipe *pipe) | 225 | static void tve200_display_disable(struct drm_simple_display_pipe *pipe) |
225 | { | 226 | { |
226 | struct drm_crtc *crtc = &pipe->crtc; | 227 | struct drm_crtc *crtc = &pipe->crtc; |
227 | struct drm_device *drm = crtc->dev; | 228 | struct drm_device *drm = crtc->dev; |
@@ -290,10 +291,10 @@ void tve200_disable_vblank(struct drm_device *drm, unsigned int crtc) | |||
290 | static int tve200_display_prepare_fb(struct drm_simple_display_pipe *pipe, | 291 | static int tve200_display_prepare_fb(struct drm_simple_display_pipe *pipe, |
291 | struct drm_plane_state *plane_state) | 292 | struct drm_plane_state *plane_state) |
292 | { | 293 | { |
293 | return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); | 294 | return drm_gem_fb_prepare_fb(&pipe->plane, plane_state); |
294 | } | 295 | } |
295 | 296 | ||
296 | const struct drm_simple_display_pipe_funcs tve200_display_funcs = { | 297 | static const struct drm_simple_display_pipe_funcs tve200_display_funcs = { |
297 | .check = tve200_display_check, | 298 | .check = tve200_display_check, |
298 | .enable = tve200_display_enable, | 299 | .enable = tve200_display_enable, |
299 | .disable = tve200_display_disable, | 300 | .disable = tve200_display_disable, |
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index eae38b669f0a..bd6c9454d767 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <drm/drm_atomic_helper.h> | 45 | #include <drm/drm_atomic_helper.h> |
46 | #include <drm/drm_crtc_helper.h> | 46 | #include <drm/drm_crtc_helper.h> |
47 | #include <drm/drm_gem_cma_helper.h> | 47 | #include <drm/drm_gem_cma_helper.h> |
48 | #include <drm/drm_gem_framebuffer_helper.h> | ||
48 | #include <drm/drm_fb_cma_helper.h> | 49 | #include <drm/drm_fb_cma_helper.h> |
49 | #include <drm/drm_panel.h> | 50 | #include <drm/drm_panel.h> |
50 | #include <drm/drm_of.h> | 51 | #include <drm/drm_of.h> |
@@ -55,7 +56,7 @@ | |||
55 | #define DRIVER_DESC "DRM module for Faraday TVE200" | 56 | #define DRIVER_DESC "DRM module for Faraday TVE200" |
56 | 57 | ||
57 | static const struct drm_mode_config_funcs mode_config_funcs = { | 58 | static const struct drm_mode_config_funcs mode_config_funcs = { |
58 | .fb_create = drm_fb_cma_create, | 59 | .fb_create = drm_gem_fb_create, |
59 | .atomic_check = drm_atomic_helper_check, | 60 | .atomic_check = drm_atomic_helper_check, |
60 | .atomic_commit = drm_atomic_helper_commit, | 61 | .atomic_commit = drm_atomic_helper_commit, |
61 | }; | 62 | }; |
@@ -225,7 +226,7 @@ static int tve200_probe(struct platform_device *pdev) | |||
225 | 226 | ||
226 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 227 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
227 | priv->regs = devm_ioremap_resource(dev, res); | 228 | priv->regs = devm_ioremap_resource(dev, res); |
228 | if (!priv->regs) { | 229 | if (IS_ERR(priv->regs)) { |
229 | dev_err(dev, "%s failed mmio\n", __func__); | 230 | dev_err(dev, "%s failed mmio\n", __func__); |
230 | ret = -EINVAL; | 231 | ret = -EINVAL; |
231 | goto clk_disable; | 232 | goto clk_disable; |
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index d1e0dc908048..925c726ac694 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <drm/drm_crtc_helper.h> | 33 | #include <drm/drm_crtc_helper.h> |
34 | #include <drm/drm_edid.h> | 34 | #include <drm/drm_edid.h> |
35 | #include <drm/drm_mipi_dsi.h> | 35 | #include <drm/drm_mipi_dsi.h> |
36 | #include <drm/drm_of.h> | ||
36 | #include <drm/drm_panel.h> | 37 | #include <drm/drm_panel.h> |
37 | #include <linux/clk.h> | 38 | #include <linux/clk.h> |
38 | #include <linux/clk-provider.h> | 39 | #include <linux/clk-provider.h> |
@@ -504,7 +505,6 @@ struct vc4_dsi { | |||
504 | struct mipi_dsi_host dsi_host; | 505 | struct mipi_dsi_host dsi_host; |
505 | struct drm_encoder *encoder; | 506 | struct drm_encoder *encoder; |
506 | struct drm_bridge *bridge; | 507 | struct drm_bridge *bridge; |
507 | bool is_panel_bridge; | ||
508 | 508 | ||
509 | void __iomem *regs; | 509 | void __iomem *regs; |
510 | 510 | ||
@@ -866,7 +866,8 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, | |||
866 | adjusted_mode->clock = pixel_clock_hz / 1000 + 1; | 866 | adjusted_mode->clock = pixel_clock_hz / 1000 + 1; |
867 | 867 | ||
868 | /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ | 868 | /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ |
869 | adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal); | 869 | adjusted_mode->htotal = adjusted_mode->clock * mode->htotal / |
870 | mode->clock; | ||
870 | adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal; | 871 | adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal; |
871 | adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal; | 872 | adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal; |
872 | 873 | ||
@@ -1288,7 +1289,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, | |||
1288 | struct mipi_dsi_device *device) | 1289 | struct mipi_dsi_device *device) |
1289 | { | 1290 | { |
1290 | struct vc4_dsi *dsi = host_to_dsi(host); | 1291 | struct vc4_dsi *dsi = host_to_dsi(host); |
1291 | int ret = 0; | ||
1292 | 1292 | ||
1293 | dsi->lanes = device->lanes; | 1293 | dsi->lanes = device->lanes; |
1294 | dsi->channel = device->channel; | 1294 | dsi->channel = device->channel; |
@@ -1323,34 +1323,12 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, | |||
1323 | return 0; | 1323 | return 0; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | dsi->bridge = of_drm_find_bridge(device->dev.of_node); | 1326 | return 0; |
1327 | if (!dsi->bridge) { | ||
1328 | struct drm_panel *panel = | ||
1329 | of_drm_find_panel(device->dev.of_node); | ||
1330 | |||
1331 | dsi->bridge = drm_panel_bridge_add(panel, | ||
1332 | DRM_MODE_CONNECTOR_DSI); | ||
1333 | if (IS_ERR(dsi->bridge)) { | ||
1334 | ret = PTR_ERR(dsi->bridge); | ||
1335 | dsi->bridge = NULL; | ||
1336 | return ret; | ||
1337 | } | ||
1338 | dsi->is_panel_bridge = true; | ||
1339 | } | ||
1340 | |||
1341 | return drm_bridge_attach(dsi->encoder, dsi->bridge, NULL); | ||
1342 | } | 1327 | } |
1343 | 1328 | ||
1344 | static int vc4_dsi_host_detach(struct mipi_dsi_host *host, | 1329 | static int vc4_dsi_host_detach(struct mipi_dsi_host *host, |
1345 | struct mipi_dsi_device *device) | 1330 | struct mipi_dsi_device *device) |
1346 | { | 1331 | { |
1347 | struct vc4_dsi *dsi = host_to_dsi(host); | ||
1348 | |||
1349 | if (dsi->is_panel_bridge) { | ||
1350 | drm_panel_bridge_remove(dsi->bridge); | ||
1351 | dsi->bridge = NULL; | ||
1352 | } | ||
1353 | |||
1354 | return 0; | 1332 | return 0; |
1355 | } | 1333 | } |
1356 | 1334 | ||
@@ -1492,16 +1470,13 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) | |||
1492 | struct platform_device *pdev = to_platform_device(dev); | 1470 | struct platform_device *pdev = to_platform_device(dev); |
1493 | struct drm_device *drm = dev_get_drvdata(master); | 1471 | struct drm_device *drm = dev_get_drvdata(master); |
1494 | struct vc4_dev *vc4 = to_vc4_dev(drm); | 1472 | struct vc4_dev *vc4 = to_vc4_dev(drm); |
1495 | struct vc4_dsi *dsi; | 1473 | struct vc4_dsi *dsi = dev_get_drvdata(dev); |
1496 | struct vc4_dsi_encoder *vc4_dsi_encoder; | 1474 | struct vc4_dsi_encoder *vc4_dsi_encoder; |
1475 | struct drm_panel *panel; | ||
1497 | const struct of_device_id *match; | 1476 | const struct of_device_id *match; |
1498 | dma_cap_mask_t dma_mask; | 1477 | dma_cap_mask_t dma_mask; |
1499 | int ret; | 1478 | int ret; |
1500 | 1479 | ||
1501 | dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); | ||
1502 | if (!dsi) | ||
1503 | return -ENOMEM; | ||
1504 | |||
1505 | match = of_match_device(vc4_dsi_dt_match, dev); | 1480 | match = of_match_device(vc4_dsi_dt_match, dev); |
1506 | if (!match) | 1481 | if (!match) |
1507 | return -ENODEV; | 1482 | return -ENODEV; |
@@ -1516,7 +1491,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) | |||
1516 | vc4_dsi_encoder->dsi = dsi; | 1491 | vc4_dsi_encoder->dsi = dsi; |
1517 | dsi->encoder = &vc4_dsi_encoder->base.base; | 1492 | dsi->encoder = &vc4_dsi_encoder->base.base; |
1518 | 1493 | ||
1519 | dsi->pdev = pdev; | ||
1520 | dsi->regs = vc4_ioremap_regs(pdev, 0); | 1494 | dsi->regs = vc4_ioremap_regs(pdev, 0); |
1521 | if (IS_ERR(dsi->regs)) | 1495 | if (IS_ERR(dsi->regs)) |
1522 | return PTR_ERR(dsi->regs); | 1496 | return PTR_ERR(dsi->regs); |
@@ -1597,6 +1571,18 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) | |||
1597 | return ret; | 1571 | return ret; |
1598 | } | 1572 | } |
1599 | 1573 | ||
1574 | ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, | ||
1575 | &panel, &dsi->bridge); | ||
1576 | if (ret) | ||
1577 | return ret; | ||
1578 | |||
1579 | if (panel) { | ||
1580 | dsi->bridge = devm_drm_panel_bridge_add(dev, panel, | ||
1581 | DRM_MODE_CONNECTOR_DSI); | ||
1582 | if (IS_ERR(dsi->bridge)) | ||
1583 | return PTR_ERR(dsi->bridge); | ||
1584 | } | ||
1585 | |||
1600 | /* The esc clock rate is supposed to always be 100Mhz. */ | 1586 | /* The esc clock rate is supposed to always be 100Mhz. */ |
1601 | ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); | 1587 | ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); |
1602 | if (ret) { | 1588 | if (ret) { |
@@ -1615,12 +1601,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) | |||
1615 | DRM_MODE_ENCODER_DSI, NULL); | 1601 | DRM_MODE_ENCODER_DSI, NULL); |
1616 | drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); | 1602 | drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); |
1617 | 1603 | ||
1618 | dsi->dsi_host.ops = &vc4_dsi_host_ops; | 1604 | ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL); |
1619 | dsi->dsi_host.dev = dev; | 1605 | if (ret) { |
1620 | 1606 | dev_err(dev, "bridge attach failed: %d\n", ret); | |
1621 | mipi_dsi_host_register(&dsi->dsi_host); | 1607 | return ret; |
1622 | 1608 | } | |
1623 | dev_set_drvdata(dev, dsi); | ||
1624 | 1609 | ||
1625 | pm_runtime_enable(dev); | 1610 | pm_runtime_enable(dev); |
1626 | 1611 | ||
@@ -1638,8 +1623,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, | |||
1638 | 1623 | ||
1639 | vc4_dsi_encoder_destroy(dsi->encoder); | 1624 | vc4_dsi_encoder_destroy(dsi->encoder); |
1640 | 1625 | ||
1641 | mipi_dsi_host_unregister(&dsi->dsi_host); | ||
1642 | |||
1643 | if (dsi->port == 1) | 1626 | if (dsi->port == 1) |
1644 | vc4->dsi1 = NULL; | 1627 | vc4->dsi1 = NULL; |
1645 | } | 1628 | } |
@@ -1651,12 +1634,47 @@ static const struct component_ops vc4_dsi_ops = { | |||
1651 | 1634 | ||
1652 | static int vc4_dsi_dev_probe(struct platform_device *pdev) | 1635 | static int vc4_dsi_dev_probe(struct platform_device *pdev) |
1653 | { | 1636 | { |
1654 | return component_add(&pdev->dev, &vc4_dsi_ops); | 1637 | struct device *dev = &pdev->dev; |
1638 | struct vc4_dsi *dsi; | ||
1639 | int ret; | ||
1640 | |||
1641 | dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); | ||
1642 | if (!dsi) | ||
1643 | return -ENOMEM; | ||
1644 | dev_set_drvdata(dev, dsi); | ||
1645 | |||
1646 | dsi->pdev = pdev; | ||
1647 | |||
1648 | /* Note, the initialization sequence for DSI and panels is | ||
1649 | * tricky. The component bind above won't get past its | ||
1650 | * -EPROBE_DEFER until the panel/bridge probes. The | ||
1651 | * panel/bridge will return -EPROBE_DEFER until it has a | ||
1652 | * mipi_dsi_host to register its device to. So, we register | ||
1653 | * the host during pdev probe time, so vc4 as a whole can then | ||
1654 | * -EPROBE_DEFER its component bind process until the panel | ||
1655 | * successfully attaches. | ||
1656 | */ | ||
1657 | dsi->dsi_host.ops = &vc4_dsi_host_ops; | ||
1658 | dsi->dsi_host.dev = dev; | ||
1659 | mipi_dsi_host_register(&dsi->dsi_host); | ||
1660 | |||
1661 | ret = component_add(&pdev->dev, &vc4_dsi_ops); | ||
1662 | if (ret) { | ||
1663 | mipi_dsi_host_unregister(&dsi->dsi_host); | ||
1664 | return ret; | ||
1665 | } | ||
1666 | |||
1667 | return 0; | ||
1655 | } | 1668 | } |
1656 | 1669 | ||
1657 | static int vc4_dsi_dev_remove(struct platform_device *pdev) | 1670 | static int vc4_dsi_dev_remove(struct platform_device *pdev) |
1658 | { | 1671 | { |
1672 | struct device *dev = &pdev->dev; | ||
1673 | struct vc4_dsi *dsi = dev_get_drvdata(dev); | ||
1674 | |||
1659 | component_del(&pdev->dev, &vc4_dsi_ops); | 1675 | component_del(&pdev->dev, &vc4_dsi_ops); |
1676 | mipi_dsi_host_unregister(&dsi->dsi_host); | ||
1677 | |||
1660 | return 0; | 1678 | return 0; |
1661 | } | 1679 | } |
1662 | 1680 | ||
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index b6d52055a11f..41b0930f7968 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c | |||
@@ -53,7 +53,7 @@ static void virtio_gpu_user_framebuffer_destroy(struct drm_framebuffer *fb) | |||
53 | struct virtio_gpu_framebuffer *virtio_gpu_fb | 53 | struct virtio_gpu_framebuffer *virtio_gpu_fb |
54 | = to_virtio_gpu_framebuffer(fb); | 54 | = to_virtio_gpu_framebuffer(fb); |
55 | 55 | ||
56 | drm_gem_object_unreference_unlocked(virtio_gpu_fb->obj); | 56 | drm_gem_object_put_unlocked(virtio_gpu_fb->obj); |
57 | drm_framebuffer_cleanup(fb); | 57 | drm_framebuffer_cleanup(fb); |
58 | kfree(virtio_gpu_fb); | 58 | kfree(virtio_gpu_fb); |
59 | } | 59 | } |
@@ -327,7 +327,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev, | |||
327 | ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj); | 327 | ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj); |
328 | if (ret) { | 328 | if (ret) { |
329 | kfree(virtio_gpu_fb); | 329 | kfree(virtio_gpu_fb); |
330 | drm_gem_object_unreference_unlocked(obj); | 330 | drm_gem_object_put_unlocked(obj); |
331 | return NULL; | 331 | return NULL; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c index 72ad7b103448..92fb27753b9e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c | |||
@@ -72,7 +72,7 @@ int virtio_gpu_gem_create(struct drm_file *file, | |||
72 | *obj_p = &obj->gem_base; | 72 | *obj_p = &obj->gem_base; |
73 | 73 | ||
74 | /* drop reference from allocate - handle holds it now */ | 74 | /* drop reference from allocate - handle holds it now */ |
75 | drm_gem_object_unreference_unlocked(&obj->gem_base); | 75 | drm_gem_object_put_unlocked(&obj->gem_base); |
76 | 76 | ||
77 | *handle_p = handle; | 77 | *handle_p = handle; |
78 | return 0; | 78 | return 0; |
@@ -130,7 +130,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv, | |||
130 | return -ENOENT; | 130 | return -ENOENT; |
131 | obj = gem_to_virtio_gpu_obj(gobj); | 131 | obj = gem_to_virtio_gpu_obj(gobj); |
132 | *offset_p = virtio_gpu_object_mmap_offset(obj); | 132 | *offset_p = virtio_gpu_object_mmap_offset(obj); |
133 | drm_gem_object_unreference_unlocked(gobj); | 133 | drm_gem_object_put_unlocked(gobj); |
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | 136 | ||
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index b94bd5440e57..0528edb4a2bf 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c | |||
@@ -86,7 +86,7 @@ static void virtio_gpu_unref_list(struct list_head *head) | |||
86 | bo = buf->bo; | 86 | bo = buf->bo; |
87 | qobj = container_of(bo, struct virtio_gpu_object, tbo); | 87 | qobj = container_of(bo, struct virtio_gpu_object, tbo); |
88 | 88 | ||
89 | drm_gem_object_unreference_unlocked(&qobj->gem_base); | 89 | drm_gem_object_put_unlocked(&qobj->gem_base); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
@@ -304,7 +304,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, | |||
304 | } | 304 | } |
305 | return ret; | 305 | return ret; |
306 | } | 306 | } |
307 | drm_gem_object_unreference_unlocked(obj); | 307 | drm_gem_object_put_unlocked(obj); |
308 | 308 | ||
309 | rc->res_handle = res_id; /* similiar to a VM address */ | 309 | rc->res_handle = res_id; /* similiar to a VM address */ |
310 | rc->bo_handle = handle; | 310 | rc->bo_handle = handle; |
@@ -341,7 +341,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data, | |||
341 | 341 | ||
342 | ri->size = qobj->gem_base.size; | 342 | ri->size = qobj->gem_base.size; |
343 | ri->res_handle = qobj->hw_res_handle; | 343 | ri->res_handle = qobj->hw_res_handle; |
344 | drm_gem_object_unreference_unlocked(gobj); | 344 | drm_gem_object_put_unlocked(gobj); |
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | 347 | ||
@@ -389,7 +389,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, | |||
389 | out_unres: | 389 | out_unres: |
390 | virtio_gpu_object_unreserve(qobj); | 390 | virtio_gpu_object_unreserve(qobj); |
391 | out: | 391 | out: |
392 | drm_gem_object_unreference_unlocked(gobj); | 392 | drm_gem_object_put_unlocked(gobj); |
393 | return ret; | 393 | return ret; |
394 | } | 394 | } |
395 | 395 | ||
@@ -439,7 +439,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, | |||
439 | out_unres: | 439 | out_unres: |
440 | virtio_gpu_object_unreserve(qobj); | 440 | virtio_gpu_object_unreserve(qobj); |
441 | out: | 441 | out: |
442 | drm_gem_object_unreference_unlocked(gobj); | 442 | drm_gem_object_put_unlocked(gobj); |
443 | return ret; | 443 | return ret; |
444 | } | 444 | } |
445 | 445 | ||
@@ -462,7 +462,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data, | |||
462 | nowait = true; | 462 | nowait = true; |
463 | ret = virtio_gpu_object_wait(qobj, nowait); | 463 | ret = virtio_gpu_object_wait(qobj, nowait); |
464 | 464 | ||
465 | drm_gem_object_unreference_unlocked(gobj); | 465 | drm_gem_object_put_unlocked(gobj); |
466 | return ret; | 466 | return ret; |
467 | } | 467 | } |
468 | 468 | ||
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 71bbaaec836d..ee06ecd6c01f 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h | |||
@@ -155,7 +155,7 @@ struct drm_driver { | |||
155 | * reverse order of the initialization. Similarly to the load | 155 | * reverse order of the initialization. Similarly to the load |
156 | * hook, this handler is deprecated and its usage should be | 156 | * hook, this handler is deprecated and its usage should be |
157 | * dropped in favor of an open-coded teardown function at the | 157 | * dropped in favor of an open-coded teardown function at the |
158 | * driver layer. See drm_dev_unregister() and drm_dev_unref() | 158 | * driver layer. See drm_dev_unregister() and drm_dev_put() |
159 | * for the proper way to remove a &struct drm_device. | 159 | * for the proper way to remove a &struct drm_device. |
160 | * | 160 | * |
161 | * The unload() hook is called right after unregistering | 161 | * The unload() hook is called right after unregistering |
@@ -611,7 +611,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, | |||
611 | int drm_dev_register(struct drm_device *dev, unsigned long flags); | 611 | int drm_dev_register(struct drm_device *dev, unsigned long flags); |
612 | void drm_dev_unregister(struct drm_device *dev); | 612 | void drm_dev_unregister(struct drm_device *dev); |
613 | 613 | ||
614 | void drm_dev_ref(struct drm_device *dev); | 614 | void drm_dev_get(struct drm_device *dev); |
615 | void drm_dev_put(struct drm_device *dev); | ||
615 | void drm_dev_unref(struct drm_device *dev); | 616 | void drm_dev_unref(struct drm_device *dev); |
616 | void drm_put_dev(struct drm_device *dev); | 617 | void drm_put_dev(struct drm_device *dev); |
617 | void drm_dev_unplug(struct drm_device *dev); | 618 | void drm_dev_unplug(struct drm_device *dev); |
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index a323781afc3f..023f052a5873 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h | |||
@@ -28,16 +28,6 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state); | |||
28 | void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma, | 28 | void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma, |
29 | bool state); | 29 | bool state); |
30 | 30 | ||
31 | void drm_fb_cma_destroy(struct drm_framebuffer *fb); | ||
32 | int drm_fb_cma_create_handle(struct drm_framebuffer *fb, | ||
33 | struct drm_file *file_priv, unsigned int *handle); | ||
34 | |||
35 | struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, | ||
36 | struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, | ||
37 | const struct drm_framebuffer_funcs *funcs); | ||
38 | struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, | ||
39 | struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd); | ||
40 | |||
41 | struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, | 31 | struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, |
42 | unsigned int plane); | 32 | unsigned int plane); |
43 | 33 | ||
@@ -45,9 +35,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, | |||
45 | struct drm_plane_state *state, | 35 | struct drm_plane_state *state, |
46 | unsigned int plane); | 36 | unsigned int plane); |
47 | 37 | ||
48 | int drm_fb_cma_prepare_fb(struct drm_plane *plane, | ||
49 | struct drm_plane_state *state); | ||
50 | |||
51 | #ifdef CONFIG_DEBUG_FS | 38 | #ifdef CONFIG_DEBUG_FS |
52 | struct seq_file; | 39 | struct seq_file; |
53 | 40 | ||
diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci index 0c7a9265c07e..dc10dee356c2 100644 --- a/scripts/coccinelle/api/drm-get-put.cocci +++ b/scripts/coccinelle/api/drm-get-put.cocci | |||
@@ -50,6 +50,9 @@ expression object; | |||
50 | | | 50 | | |
51 | - drm_property_unreference_blob(object) | 51 | - drm_property_unreference_blob(object) |
52 | + drm_property_blob_put(object) | 52 | + drm_property_blob_put(object) |
53 | | | ||
54 | - drm_dev_unref(object) | ||
55 | + drm_dev_put(object) | ||
53 | ) | 56 | ) |
54 | 57 | ||
55 | @r depends on report@ | 58 | @r depends on report@ |
@@ -81,6 +84,8 @@ drm_gem_object_unreference_unlocked(object) | |||
81 | drm_property_unreference_blob@p(object) | 84 | drm_property_unreference_blob@p(object) |
82 | | | 85 | | |
83 | drm_property_reference_blob@p(object) | 86 | drm_property_reference_blob@p(object) |
87 | | | ||
88 | drm_dev_unref@p(object) | ||
84 | ) | 89 | ) |
85 | 90 | ||
86 | @script:python depends on report@ | 91 | @script:python depends on report@ |