aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2017-11-15 09:19:56 -0500
committerNoralf Trønnes <noralf@tronnes.org>2017-12-08 08:47:43 -0500
commitb8f429a77f6ece525ecf180a6df50357b86b96a6 (patch)
tree0f25b21f6a2eb06844195b2becbb83ae1277edb9
parent4f054fcf4779a70888a397aa2e5a662e72e9b9e8 (diff)
drm/vc4: Use drm_fb_cma_fbdev_init/fini()
Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly. Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-18-noralf@tronnes.org
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c13
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h2
-rw-r--r--drivers/gpu/drm/vc4/vc4_kms.c18
3 files changed, 6 insertions, 27 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e3c29729da2e..ceb385fd69c5 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -111,13 +111,6 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
111 return 0; 111 return 0;
112} 112}
113 113
114static void vc4_lastclose(struct drm_device *dev)
115{
116 struct vc4_dev *vc4 = to_vc4_dev(dev);
117
118 drm_fbdev_cma_restore_mode(vc4->fbdev);
119}
120
121static const struct vm_operations_struct vc4_vm_ops = { 114static const struct vm_operations_struct vc4_vm_ops = {
122 .fault = vc4_fault, 115 .fault = vc4_fault,
123 .open = drm_gem_vm_open, 116 .open = drm_gem_vm_open,
@@ -159,7 +152,7 @@ static struct drm_driver vc4_drm_driver = {
159 DRIVER_HAVE_IRQ | 152 DRIVER_HAVE_IRQ |
160 DRIVER_RENDER | 153 DRIVER_RENDER |
161 DRIVER_PRIME), 154 DRIVER_PRIME),
162 .lastclose = vc4_lastclose, 155 .lastclose = drm_fb_helper_lastclose,
163 .irq_handler = vc4_irq, 156 .irq_handler = vc4_irq,
164 .irq_preinstall = vc4_irq_preinstall, 157 .irq_preinstall = vc4_irq_preinstall,
165 .irq_postinstall = vc4_irq_postinstall, 158 .irq_postinstall = vc4_irq_postinstall,
@@ -301,12 +294,10 @@ static void vc4_drm_unbind(struct device *dev)
301{ 294{
302 struct platform_device *pdev = to_platform_device(dev); 295 struct platform_device *pdev = to_platform_device(dev);
303 struct drm_device *drm = platform_get_drvdata(pdev); 296 struct drm_device *drm = platform_get_drvdata(pdev);
304 struct vc4_dev *vc4 = to_vc4_dev(drm);
305 297
306 drm_dev_unregister(drm); 298 drm_dev_unregister(drm);
307 299
308 if (vc4->fbdev) 300 drm_fb_cma_fbdev_fini(drm);
309 drm_fbdev_cma_fini(vc4->fbdev);
310 301
311 drm_mode_config_cleanup(drm); 302 drm_mode_config_cleanup(drm);
312 303
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 9c0d380c96f2..3af22936d9b3 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -39,8 +39,6 @@ struct vc4_dev {
39 struct vc4_dsi *dsi1; 39 struct vc4_dsi *dsi1;
40 struct vc4_vec *vec; 40 struct vc4_vec *vec;
41 41
42 struct drm_fbdev_cma *fbdev;
43
44 struct vc4_hang_state *hang_state; 42 struct vc4_hang_state *hang_state;
45 43
46 /* The kernel-space BO cache. Tracks buffers that have been 44 /* The kernel-space BO cache. Tracks buffers that have been
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 50c4959b5bd3..4256f294c346 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -19,17 +19,11 @@
19#include <drm/drm_atomic_helper.h> 19#include <drm/drm_atomic_helper.h>
20#include <drm/drm_crtc_helper.h> 20#include <drm/drm_crtc_helper.h>
21#include <drm/drm_plane_helper.h> 21#include <drm/drm_plane_helper.h>
22#include <drm/drm_fb_helper.h>
22#include <drm/drm_fb_cma_helper.h> 23#include <drm/drm_fb_cma_helper.h>
23#include <drm/drm_gem_framebuffer_helper.h> 24#include <drm/drm_gem_framebuffer_helper.h>
24#include "vc4_drv.h" 25#include "vc4_drv.h"
25 26
26static void vc4_output_poll_changed(struct drm_device *dev)
27{
28 struct vc4_dev *vc4 = to_vc4_dev(dev);
29
30 drm_fbdev_cma_hotplug_event(vc4->fbdev);
31}
32
33static void 27static void
34vc4_atomic_complete_commit(struct drm_atomic_state *state) 28vc4_atomic_complete_commit(struct drm_atomic_state *state)
35{ 29{
@@ -194,7 +188,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev,
194} 188}
195 189
196static const struct drm_mode_config_funcs vc4_mode_funcs = { 190static const struct drm_mode_config_funcs vc4_mode_funcs = {
197 .output_poll_changed = vc4_output_poll_changed, 191 .output_poll_changed = drm_fb_helper_output_poll_changed,
198 .atomic_check = drm_atomic_helper_check, 192 .atomic_check = drm_atomic_helper_check,
199 .atomic_commit = vc4_atomic_commit, 193 .atomic_commit = vc4_atomic_commit,
200 .fb_create = vc4_fb_create, 194 .fb_create = vc4_fb_create,
@@ -224,12 +218,8 @@ int vc4_kms_load(struct drm_device *dev)
224 218
225 drm_mode_config_reset(dev); 219 drm_mode_config_reset(dev);
226 220
227 if (dev->mode_config.num_connector) { 221 if (dev->mode_config.num_connector)
228 vc4->fbdev = drm_fbdev_cma_init(dev, 32, 222 drm_fb_cma_fbdev_init(dev, 32, 0);
229 dev->mode_config.num_connector);
230 if (IS_ERR(vc4->fbdev))
231 vc4->fbdev = NULL;
232 }
233 223
234 drm_kms_helper_poll_init(dev); 224 drm_kms_helper_poll_init(dev);
235 225